diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e1d5af91413b0..e56eccb40e4d93 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,207 @@ ### [Versions](https://material-ui.com/versions/) +## 5.0.0-alpha.38 + + + +_Jun 23, 2021_ + +Big thanks to the 18 contributors who made this release possible. Here are some highlights ✨: + +- 🚀 We have only 2 left in the [breaking changes](https://github.com/mui-org/material-ui/issues/20012). The plan to release 5.0.0-beta.0 is on July 1st and will start to promote its usage over v4. +- 🎨 We have updated `Slider` to match current [Material Design guidelines](https://material.io/components/sliders). + + + +- 💡 `IconButton` now supports 3 sizes (`small, medium, large`). [See demo](/components/buttons/#sizes-2). +- ♿️ We have improved the default style of the `Link` to be more accessible (#26145) @ahmed-28 + + + +### `@material-ui/core@5.0.0-alpha.38` + +#### Breaking changes + +- [Menu] Use ButtonBase in MenuItem (#26591) @siriwatknp + + - Change the default value of `anchorOrigin.vertical` to follow the Material Design guidelines. The menu now displays below the anchor instead of on top of it. You can restore the previous behavior with: + + ```diff + + +
  • + ``` + + - The prop `listItemClasses` was removed, you can use `classes` instead. + + ```diff + - + + + ``` + +- [theme] Improve default breakpoints (#26746) @siriwatknp + + The default breakpoints were changed to better match the common use cases. They also better match the Material Design guidelines. [Read more about the change](https://github.com/mui-org/material-ui/issues/21902). + + ```diff + { + xs: 0, + sm: 600, + - md: 960, + + md: 900, + - lg: 1280, + + lg: 1200, + - xl: 1920, + + xl: 1536, + } + ``` + + If you prefer the old breakpoint values, use the snippet below. + + ```js + import { createTheme } from '@material-ui/core/styles'; + + const theme = createTheme({ + breakpoints: { + values: { + xs: 0, + sm: 600, + md: 960, + lg: 1280, + xl: 1920, + }, + }, + }); + ``` + +- [IconButton] Add size `large` and update styles (#26748) @siriwatknp + + The default size's padding is reduced to `8px` which makes the default IconButton size of `40px`. To get the old default size (`48px`), use `size="large"`. The change was done to better match Google's products when Material Design stopped documenting the icon button pattern. + + ```diff + - + + + ``` + +- [Slider] Adjust css to match the specification (#26632) @siriwatknp + + Rework the CSS to match the latest [Material Design guidelines](https://material.io/components/sliders) and make custom styles more intuitive. [See documentation](https://next.material-ui.com/components/slider/). + + + + You can reduce the density of the slider, closer to v4 with the [`size="small"` prop](https://next.material-ui.com/components/slider/#sizes). + + + +- [IconButton] Remove label span (#26801) @siriwatknp + + `span` element that wraps children has been removed. `label` classKey is also removed. More details about [this change](https://github.com/mui-org/material-ui/pull/26666). + + ```diff + + ``` + +- [core] Remove `unstable_` prefix on the `useThemeProps` hook (#26777) @mnajdova + + The following utilities were renamed to not contain the `unstable_` prefix: + + - `@material-ui/sytstem` + + ```diff + import { + - unstable_useThemeProps, + + useThemeProps, + } from '@material-ui/system'; + ``` + + - `@material-ui/core` + + ```diff + import { + - unstable_useThemeProps, + + useThemeProps, + } from '@material-ui/core/styles'; + ``` + +#### Changes + +- [Alert] Add support for custom colors (#26831) @varandasi +- [Button] Fix loading text invisible when disabled (#26857) @DanielBretzigheimer +- [ButtonBase] Consider as a link with a custom component and `to` prop (#26576) @shadab14meb346 +- [ButtonBase] Derive state on render instead of in layout effects (#26762) @eps1lon +- [Drawer] Fix incorrect z-index (#26791) @michal-perlakowski +- [Drawer] Remove incorrect transition handler props (#26835) @eps1lon +- [Link] Improve accessibility support (#26145) @ahmed-28 +- [Modal] Fix calculating scrollbar size when using custom scrollbar (#26816) @michal-perlakowski +- [Rating] Make input ids less predictable (#26493) @eps1lon +- [Stepper] Add componentsProps.label to StepLabel (#26807) @michal-perlakowski +- [Tabs] Show error when Tab has display: none (#26783) @michal-perlakowski +- [theme] Add base color palette type to components (#26697) @siriwatknp + +### `@material-ui/system@5.0.0-alpha.38` + +#### Breaking Changes + +- [system] Normalize api for `createBox` (#26820) @mnajdova + + ```diff + import { createBox } from '@material-ui/system'; + + -const styled = createBox(defaultTheme); + +const styled = createBox({ defaultTheme }); + ``` + +#### Changes + +- [system] Add ThemeProvider component (#26787) @mnajdova + +### Docs + +- [docs] Fix misspelling of the word Typography (#26898) @dmrqx +- [docs] Instruct users to install @material-ui/icons with the next tag (#26873) @michal-perlakowski +- [docs] Sync translations (#26828) @l10nbot +- [docs] Improve grammar of autocomplete/autofill section (#26798) @dijonkitchen +- [docs] Explain "inherited props" better in the props table (#26778) @eps1lon +- [docs] Fix documentation for upgrading to v5 (#26812) @tungdt-90 +- [docs] Improve notification color (#26796) @mnajdova +- [docs] Fix various a11y issues with /customization/color (#26757) @eps1lon +- [docs] Move custom theme to frame (#26744) @siriwatknp +- [docs] Fix small PT typo fix: inciar -> iniciar (#26775) @brunocavalcante +- [I10n] Add Chinese (Hong Kong) (zh-HK) locale (#26637) @kshuiroy +- [l10n] Add sinhalese (siLK) locale (#26875) @pavinduLakshan +- [examples] Rename nextjs typescript theme from tsx to ts (#26862) @Izhaki + +### Core + +- [test] Fix Drawer test API @oliviertassinari +- [test] Adjust expected useAutocomplete error messages for React 18 (#26858) @eps1lon +- [test] Convert Drawer tests to testing-library (#26837) @eps1lon +- [test] Convert remaining enzyme tests to testing-library (#26832) @eps1lon +- [test] Ignore ReactDOM.hydrate deprecation warnings (#26815) @eps1lon +- [test] Reduce flakiness (#26761) @eps1lon +- [useId] Reduce likelyhood of collisions (#26758) @eps1lon +- yarn deduplicate @oliviertassinari +- Fix running framer's prettier under pwsh (#26819) @michaldudak +- [core] Update babel-plugin-optimize-clsx (#26861) @oliviertassinari +- [core] Assume no document.all at runtime (#26821) @eps1lon +- [core] Remove dependency on `@material-ui/private-theming` (#26793) @mnajdova +- [core] Remove dependency on `@material-ui/styled-engine` (#26792) @mnajdova + +All contributors of this release in alphabetical order: @ahmed-28, @brunocavalcante, @DanielBretzigheimer, @dijonkitchen, @dmrqx, @eps1lon, @Izhaki, @kshuiroy, @l10nbot, @michal-perlakowski, @michaldudak, @mnajdova, @oliviertassinari, @pavinduLakshan, @shadab14meb346, @siriwatknp, @tungdt-90, @varandasi + ## 5.0.0-alpha.37 diff --git a/babel.config.js b/babel.config.js index 0c6023d6294478..7c3ba507ed0bee 100644 --- a/babel.config.js +++ b/babel.config.js @@ -96,6 +96,9 @@ module.exports = function getBabelConfig(api) { } return { + assumptions: { + noDocumentAll: true, + }, presets, plugins, ignore: [/@babel[\\|/]runtime/], // Fix a Windows issue. diff --git a/benchmark/package.json b/benchmark/package.json index 39c8173935469e..81fc39f2bece36 100644 --- a/benchmark/package.json +++ b/benchmark/package.json @@ -1,6 +1,6 @@ { "name": "benchmark", - "version": "5.0.0-alpha.37", + "version": "5.0.0-alpha.38", "private": "true", "scripts": { "browser": "yarn webpack --config browser/webpack.config.js && node browser/scripts/benchmark.js", @@ -14,9 +14,9 @@ "@chakra-ui/system": "^1.0.0", "@emotion/react": "^11.0.0", "@emotion/styled": "^11.0.0", - "@material-ui/core": "5.0.0-alpha.37", - "@material-ui/styles": "5.0.0-alpha.35", - "@material-ui/system": "5.0.0-alpha.37", + "@material-ui/core": "5.0.0-alpha.38", + "@material-ui/styles": "5.0.0-alpha.36", + "@material-ui/system": "5.0.0-alpha.38", "@styled-system/css": "^5.1.5", "benchmark": "^2.1.4", "playwright": "^1.6.1", diff --git a/docs/babel.config.js b/docs/babel.config.js index 167d585abf533e..c9e98edcca5209 100644 --- a/docs/babel.config.js +++ b/docs/babel.config.js @@ -37,6 +37,10 @@ const { version: transformRuntimeVersion } = fse.readJSONSync( ); module.exports = { + // TODO: Enable once nextjs uses babel 7.13 + // assumptions: { + // noDocumentAll: true, + // }, presets: [ // backport of https://github.com/zeit/next.js/pull/9511 [ diff --git a/docs/package.json b/docs/package.json index 51b31af848fe44..9d8eedc4e09ee6 100644 --- a/docs/package.json +++ b/docs/package.json @@ -1,6 +1,6 @@ { "name": "docs", - "version": "5.0.0-alpha.37", + "version": "5.0.0-alpha.38", "private": true, "author": "Material-UI Team", "license": "MIT", @@ -30,17 +30,17 @@ "@fortawesome/fontawesome-svg-core": "^1.2.30", "@fortawesome/free-solid-svg-icons": "^5.14.0", "@fortawesome/react-fontawesome": "^0.1.11", - "@material-ui/core": "5.0.0-alpha.37", + "@material-ui/core": "5.0.0-alpha.38", "@material-ui/data-grid": "^4.0.0-alpha.29", - "@material-ui/docs": "5.0.0-alpha.36", + "@material-ui/docs": "5.0.0-alpha.37", "@material-ui/icons": "5.0.0-alpha.37", - "@material-ui/lab": "5.0.0-alpha.37", + "@material-ui/lab": "5.0.0-alpha.38", "@material-ui/styled-engine": "5.0.0-alpha.34", "@material-ui/styled-engine-sc": "5.0.0-alpha.35", - "@material-ui/styles": "5.0.0-alpha.35", - "@material-ui/system": "5.0.0-alpha.37", + "@material-ui/styles": "5.0.0-alpha.36", + "@material-ui/system": "5.0.0-alpha.38", "@material-ui/types": "6.0.1", - "@material-ui/unstyled": "5.0.0-alpha.37", + "@material-ui/unstyled": "5.0.0-alpha.38", "@trendmicro/react-interpolate": "^0.5.5", "@types/autosuggest-highlight": "^3.1.0", "@types/css-mediaquery": "^0.1.0", @@ -53,14 +53,14 @@ "@types/react-text-mask": "^5.4.6", "@types/react-virtualized": "^9.21.4", "@types/react-window": "^1.7.0", - "@types/styled-components": "5.1.9", + "@types/styled-components": "5.1.10", "accept-language": "^3.0.18", "address": "^1.0.3", "ast-types": "^0.14.1", "autoprefixer": "^10.0.1", "autosuggest-highlight": "^3.1.1", "babel-plugin-module-resolver": "^4.0.0", - "babel-plugin-optimize-clsx": "^2.4.1", + "babel-plugin-optimize-clsx": "^2.6.2", "babel-plugin-react-remove-properties": "^0.3.0", "babel-plugin-transform-react-remove-prop-types": "^0.4.24", "clean-css": "^5.0.1", diff --git a/docs/pages/api-docs/alert.json b/docs/pages/api-docs/alert.json index 4cbe542220066d..dac98c4ef6cbc2 100644 --- a/docs/pages/api-docs/alert.json +++ b/docs/pages/api-docs/alert.json @@ -6,8 +6,8 @@ "closeText": { "type": { "name": "string" }, "default": "'Close'" }, "color": { "type": { - "name": "enum", - "description": "'error'
    | 'info'
    | 'success'
    | 'warning'" + "name": "union", + "description": "'error'
    | 'info'
    | 'success'
    | 'warning'
    | string" } }, "icon": { "type": { "name": "node" } }, diff --git a/docs/pages/api-docs/badge.json b/docs/pages/api-docs/badge.json index 700a75dd7833bb..99d6c002c17c14 100644 --- a/docs/pages/api-docs/badge.json +++ b/docs/pages/api-docs/badge.json @@ -13,7 +13,7 @@ "color": { "type": { "name": "union", - "description": "'default'
    | 'error'
    | 'primary'
    | 'secondary'
    | string" + "description": "'default'
    | 'primary'
    | 'secondary'
    | 'error'
    | 'info'
    | 'success'
    | 'warning'
    | string" }, "default": "'default'" }, @@ -57,7 +57,10 @@ "invisible", "colorPrimary", "colorSecondary", - "colorError" + "colorError", + "colorInfo", + "colorSuccess", + "colorWarning" ], "globalClasses": {}, "name": "MuiBadge" diff --git a/docs/pages/api-docs/checkbox.json b/docs/pages/api-docs/checkbox.json index 1691c62db67a43..ae297dd5a7b5f3 100644 --- a/docs/pages/api-docs/checkbox.json +++ b/docs/pages/api-docs/checkbox.json @@ -6,7 +6,7 @@ "color": { "type": { "name": "union", - "description": "'default'
    | 'primary'
    | 'secondary'
    | string" + "description": "'default'
    | 'primary'
    | 'secondary'
    | 'error'
    | 'info'
    | 'succes'
    | 'warning'
    | string" }, "default": "'primary'" }, diff --git a/docs/pages/api-docs/chip.json b/docs/pages/api-docs/chip.json index 494b8cfedb62cf..7a0367b8ad152e 100644 --- a/docs/pages/api-docs/chip.json +++ b/docs/pages/api-docs/chip.json @@ -7,7 +7,7 @@ "color": { "type": { "name": "union", - "description": "'default'
    | 'primary'
    | 'secondary'
    | string" + "description": "'default'
    | 'primary'
    | 'secondary'
    | 'error'
    | 'info'
    | 'success'
    | 'warning'
    | string" }, "default": "'default'" }, diff --git a/docs/pages/api-docs/circular-progress.json b/docs/pages/api-docs/circular-progress.json index 07ce1993ed6d8b..3854e8c07fe9ea 100644 --- a/docs/pages/api-docs/circular-progress.json +++ b/docs/pages/api-docs/circular-progress.json @@ -4,7 +4,7 @@ "color": { "type": { "name": "union", - "description": "'inherit'
    | 'primary'
    | 'secondary'
    | string" + "description": "'inherit'
    | 'primary'
    | 'secondary'
    | 'error'
    | 'info'
    | 'success'
    | 'warning'
    | string" }, "default": "'primary'" }, diff --git a/docs/pages/api-docs/dialog.json b/docs/pages/api-docs/dialog.json index c1dfefc3337334..7aced0231dceec 100644 --- a/docs/pages/api-docs/dialog.json +++ b/docs/pages/api-docs/dialog.json @@ -3,7 +3,10 @@ "open": { "type": { "name": "bool" }, "required": true }, "aria-describedby": { "type": { "name": "string" } }, "aria-labelledby": { "type": { "name": "string" } }, - "BackdropComponent": { "type": { "name": "elementType" } }, + "BackdropComponent": { + "type": { "name": "elementType" }, + "default": "styled(Backdrop, {\n name: 'MuiModal',\n slot: 'Backdrop',\n overridesResolver: (props, styles) => {\n return styles.backdrop;\n },\n})({\n zIndex: -1,\n})" + }, "children": { "type": { "name": "node" } }, "classes": { "type": { "name": "object" } }, "disableEscapeKeyDown": { "type": { "name": "bool" } }, diff --git a/docs/pages/api-docs/form-control.json b/docs/pages/api-docs/form-control.json index 59053ffe875580..ecf3b5d8ea9728 100644 --- a/docs/pages/api-docs/form-control.json +++ b/docs/pages/api-docs/form-control.json @@ -5,7 +5,7 @@ "color": { "type": { "name": "union", - "description": "'primary'
    | 'secondary'
    | string" + "description": "'primary'
    | 'secondary'
    | 'error'
    | 'info'
    | 'success'
    | 'warning'
    | string" }, "default": "'primary'" }, diff --git a/docs/pages/api-docs/form-label.json b/docs/pages/api-docs/form-label.json index 9ae4df8f9c2649..bf9bf3f7d4f319 100644 --- a/docs/pages/api-docs/form-label.json +++ b/docs/pages/api-docs/form-label.json @@ -2,7 +2,12 @@ "props": { "children": { "type": { "name": "node" } }, "classes": { "type": { "name": "object" } }, - "color": { "type": { "name": "enum", "description": "'primary'
    | 'secondary'" } }, + "color": { + "type": { + "name": "enum", + "description": "'error'
    | 'info'
    | 'primary'
    | 'secondary'
    | 'success'
    | 'warning'" + } + }, "component": { "type": { "name": "elementType" } }, "disabled": { "type": { "name": "bool" } }, "error": { "type": { "name": "bool" } }, diff --git a/docs/pages/api-docs/icon-button.json b/docs/pages/api-docs/icon-button.json index 867c25e9aa9b51..1f99122fbb5f3a 100644 --- a/docs/pages/api-docs/icon-button.json +++ b/docs/pages/api-docs/icon-button.json @@ -5,7 +5,7 @@ "color": { "type": { "name": "union", - "description": "'inherit'
    | 'default'
    | 'primary'
    | 'secondary'
    | string" + "description": "'inherit'
    | 'default'
    | 'primary'
    | 'secondary'
    | 'error'
    | 'info'
    | 'success'
    | 'warning'
    | string" }, "default": "'default'" }, @@ -40,8 +40,7 @@ "disabled", "sizeSmall", "sizeMedium", - "sizeLarge", - "label" + "sizeLarge" ], "globalClasses": { "disabled": "Mui-disabled" }, "name": "MuiIconButton" diff --git a/docs/pages/api-docs/icon.json b/docs/pages/api-docs/icon.json index f9093b9e6c1b15..2ad1d645cc7c20 100644 --- a/docs/pages/api-docs/icon.json +++ b/docs/pages/api-docs/icon.json @@ -6,7 +6,7 @@ "color": { "type": { "name": "union", - "description": "'action'
    | 'disabled'
    | 'error'
    | 'inherit'
    | 'primary'
    | 'secondary'
    | string" + "description": "'inherit'
    | 'action'
    | 'disabled'
    | 'primary'
    | 'secondary'
    | 'error'
    | 'info'
    | 'success'
    | 'warning'
    | string" }, "default": "'inherit'" }, diff --git a/docs/pages/api-docs/input-base.json b/docs/pages/api-docs/input-base.json index ed46d19bdadd70..5c6a862d203ddd 100644 --- a/docs/pages/api-docs/input-base.json +++ b/docs/pages/api-docs/input-base.json @@ -6,7 +6,7 @@ "color": { "type": { "name": "union", - "description": "'primary'
    | 'secondary'
    | string" + "description": "'primary'
    | 'secondary'
    | 'error'
    | 'info'
    | 'success'
    | 'warning'
    | string" } }, "components": { diff --git a/docs/pages/api-docs/input-label.json b/docs/pages/api-docs/input-label.json index 9691e15bf92d41..14abacf402c5f7 100644 --- a/docs/pages/api-docs/input-label.json +++ b/docs/pages/api-docs/input-label.json @@ -2,7 +2,12 @@ "props": { "children": { "type": { "name": "node" } }, "classes": { "type": { "name": "object" } }, - "color": { "type": { "name": "enum", "description": "'primary'
    | 'secondary'" } }, + "color": { + "type": { + "name": "enum", + "description": "'error'
    | 'info'
    | 'primary'
    | 'secondary'
    | 'success'
    | 'warning'" + } + }, "disableAnimation": { "type": { "name": "bool" } }, "disabled": { "type": { "name": "bool" } }, "error": { "type": { "name": "bool" } }, diff --git a/docs/pages/api-docs/modal.json b/docs/pages/api-docs/modal.json index 22d06f7d84fed9..34be074742341f 100644 --- a/docs/pages/api-docs/modal.json +++ b/docs/pages/api-docs/modal.json @@ -2,7 +2,10 @@ "props": { "children": { "type": { "name": "custom", "description": "element" }, "required": true }, "open": { "type": { "name": "bool" }, "required": true }, - "BackdropComponent": { "type": { "name": "elementType" }, "default": "Backdrop" }, + "BackdropComponent": { + "type": { "name": "elementType" }, + "default": "styled(Backdrop, {\n name: 'MuiModal',\n slot: 'Backdrop',\n overridesResolver: (props, styles) => {\n return styles.backdrop;\n },\n})({\n zIndex: -1,\n})" + }, "BackdropProps": { "type": { "name": "object" } }, "classes": { "type": { "name": "object" } }, "closeAfterTransition": { "type": { "name": "bool" } }, diff --git a/docs/pages/api-docs/radio.json b/docs/pages/api-docs/radio.json index 7f8c0679c03410..862defcd787744 100644 --- a/docs/pages/api-docs/radio.json +++ b/docs/pages/api-docs/radio.json @@ -6,7 +6,7 @@ "color": { "type": { "name": "union", - "description": "'default'
    | 'primary'
    | 'secondary'
    | string" + "description": "'default'
    | 'primary'
    | 'secondary'
    | 'error'
    | 'info'
    | 'success'
    | 'warning'
    | string" }, "default": "'primary'" }, diff --git a/docs/pages/api-docs/step-label.json b/docs/pages/api-docs/step-label.json index 5ef791c7597688..846e633491c10b 100644 --- a/docs/pages/api-docs/step-label.json +++ b/docs/pages/api-docs/step-label.json @@ -2,6 +2,7 @@ "props": { "children": { "type": { "name": "node" } }, "classes": { "type": { "name": "object" } }, + "componentsProps": { "type": { "name": "object" }, "default": "{}" }, "error": { "type": { "name": "bool" } }, "icon": { "type": { "name": "node" } }, "optional": { "type": { "name": "node" } }, diff --git a/docs/pages/api-docs/svg-icon.json b/docs/pages/api-docs/svg-icon.json index 7b17989059ed5d..f7576cdead80a8 100644 --- a/docs/pages/api-docs/svg-icon.json +++ b/docs/pages/api-docs/svg-icon.json @@ -5,7 +5,7 @@ "color": { "type": { "name": "union", - "description": "'action'
    | 'disabled'
    | 'error'
    | 'inherit'
    | 'primary'
    | 'secondary'
    | string" + "description": "'inherit'
    | 'action'
    | 'disabled'
    | 'primary'
    | 'secondary'
    | 'error'
    | 'info'
    | 'success'
    | 'warning'
    | string" }, "default": "'inherit'" }, diff --git a/docs/pages/api-docs/switch.json b/docs/pages/api-docs/switch.json index 5aa06ebbc06972..ff39b7b32b6139 100644 --- a/docs/pages/api-docs/switch.json +++ b/docs/pages/api-docs/switch.json @@ -6,7 +6,7 @@ "color": { "type": { "name": "union", - "description": "'default'
    | 'primary'
    | 'secondary'
    | string" + "description": "'default'
    | 'primary'
    | 'secondary'
    | 'error'
    | 'info'
    | 'success'
    | 'warning'
    | string" }, "default": "'primary'" }, diff --git a/docs/pages/api-docs/text-field.json b/docs/pages/api-docs/text-field.json index 30f6b18e552e4c..f0c1ce3fd5fe1d 100644 --- a/docs/pages/api-docs/text-field.json +++ b/docs/pages/api-docs/text-field.json @@ -6,7 +6,7 @@ "color": { "type": { "name": "union", - "description": "'primary'
    | 'secondary'
    | string" + "description": "'primary'
    | 'secondary'
    | 'error'
    | 'info'
    | 'success'
    | 'warning'
    | string" }, "default": "'primary'" }, diff --git a/docs/pages/api-docs/timeline-dot.json b/docs/pages/api-docs/timeline-dot.json index becba6d1f1cd6d..2165fe72f2be50 100644 --- a/docs/pages/api-docs/timeline-dot.json +++ b/docs/pages/api-docs/timeline-dot.json @@ -5,7 +5,7 @@ "color": { "type": { "name": "enum", - "description": "'grey'
    | 'inherit'
    | 'primary'
    | 'secondary'" + "description": "'error'
    | 'grey'
    | 'info'
    | 'inherit'
    | 'primary'
    | 'secondary'
    | 'success'
    | 'warning'" }, "default": "'grey'" }, diff --git a/docs/pages/system/the-sx-prop.js b/docs/pages/system/the-sx-prop.js new file mode 100644 index 00000000000000..1c1f12db5d0bc5 --- /dev/null +++ b/docs/pages/system/the-sx-prop.js @@ -0,0 +1,15 @@ +import * as React from 'react'; +import MarkdownDocs from 'docs/src/modules/components/MarkdownDocs'; +import { + demos, + docs, + requireDemo, +} from '!@material-ui/markdown/loader!docs/src/pages/system/display/display.md'; + +// Run styled-components ref logic +// https://github.com/styled-components/styled-components/pull/2998 +requireDemo.keys().map(requireDemo); + +export default function Page() { + return ; +} diff --git a/docs/scripts/buildApi.ts b/docs/scripts/buildApi.ts index d2027f2f8e61b1..8c59e7ae4453e3 100644 --- a/docs/scripts/buildApi.ts +++ b/docs/scripts/buildApi.ts @@ -853,8 +853,7 @@ async function buildDocs(options: { if (propName === 'classes') { description += ' See CSS API below for more details.'; } else if (propName === 'sx') { - description += - ' See the `sx` page for more details.'; + description += ' See the `sx` page for more details.'; } componentApi.propDescriptions[propName] = description.replace(/\n@default.*$/, ''); diff --git a/docs/src/modules/components/ApiPage.js b/docs/src/modules/components/ApiPage.js index d397e608b337d0..7a02778bd09bcf 100644 --- a/docs/src/modules/components/ApiPage.js +++ b/docs/src/modules/components/ApiPage.js @@ -284,6 +284,7 @@ import { ${componentName} } from '${source}';`} )} +


    {cssComponent && ( @@ -298,8 +299,6 @@ import { ${componentName} } from '${source}';`} )} -
    - {inheritance && ( diff --git a/docs/src/modules/components/Notifications.js b/docs/src/modules/components/Notifications.js index d362c71ed66f65..e87a4c9a3ee337 100644 --- a/docs/src/modules/components/Notifications.js +++ b/docs/src/modules/components/Notifications.js @@ -146,7 +146,7 @@ export default function Notifications() { data-ga-event-action="toggleNotifications" > このパッケージは、まだコアに移動する準備ができていないインキュベーター・コンポーネントをホストします。

    -Labパッケージとcoreパッケージの明確な違いはどのようにバージョン管理されるかです。 Coreパッケージは[slower-moving policy](https://material-ui.com/versions/#release-frequency). Labパッケージとcoreパッケージの明確な違いはどのようにバージョン管理されるかです。 Coreパッケージは[slower-moving policy](https://material-ui.com/versions/#release-frequency). +Labパッケージとcoreパッケージの明確な違いはどのようにバージョン管理されるかです。 Labパッケージとcoreパッケージの明確な違いはどのようにバージョン管理されるかです。 Coreパッケージは[slower-moving policy](https://material-ui.com/versions/#release-frequency). 開発者としてlabパッケージのコンポーネントをテスト/使用し、不具合や、使いにくさ、デザインなどについて報告する事ができます。そうする事によってLab パッケージのコンポーネントをより良くする事ができます。 みなさんが使ってくれれば使ってくれるほど、将来的に起きうる重大な問題を早期に発見・改善する事ができます。 Coreパッケージに移るためには以下の基準を考慮します。 -- **使用されている**必要があります。 **使用されている**必要があります。 The Material-UI team uses Google Analytics stats among other metrics to evaluate the usage of each component. 実験的なコンポーネントで使用率が低いものは、動作が不完全であるか需要がないかのどちらかを意味します。 -- Coreコンポーネントと同**品質**である必要が あります。 Coreパッケージに含まれるほど完璧である必要はないが、開発者が頼れる信頼性はひつようです。 - - 各コンポーネントが**型定義**を持つこと。 現在、Labパッケージへの採用基準に型はひつようないですが、Coreパッケージに移すためには必要です。 - - 十分な**テスト網羅度**がひつようです。 Labコンポーネントのいくつかは十分なテストコードが現在ありません。 -- ユーザーが最新のメジャーバージョンにアップデートするほどの**影響力**として使えるか? コミュニティが分断されないほど、良い。 -- 短/中期的に**破壊的変更**が起きる可能性が少ないことが必要。 たとえば、新しい機能を追加するのに破壊的変更が必要な可能性があれば、そのコンポーネントのCoreへの移動は遅らせた方がよい。 +- きちんと**使われている**必要があります。 Material-UI開発チームはドキュメントにGoogleAnalyticsを使用しています。それはそれぞれのコンポーネントがどれだけ使われているかを評価するためです。 A lab component with low usage either means that it isn't fully working yet, or that there is low demand for it. +- Coreコンポーネントと同じ**品質**である必要が あります。 It doesn't have to be perfect to be part of the core, but the component should be reliable enough that developers can depend on it. + - 各コンポーネントが**型定義**を持つことが必要です。 現在、Labパッケージのコンポーネントに型は必要ありませんが、Coreパッケージに移すためには必要です。 + - 十分な**コード網羅率**が必要です。 Labコンポーネントのいくつかは十分なテストコードが現在ありません。 +- ユーザーが最新のメジャーバージョンにアップデートすることに**魅力**を感じるか? コミュニティが分断されないほど、良い。 +- 短/中期的に**破壊的変更**が起きる可能性が低いようにしてください。 たとえば、新しい機能を追加するのに破壊的変更が必要な可能性があれば、そのコンポーネントのCoreへの移動は遅らせた方がよい。 ## インストール 次を使用して、プロジェクトディレクトリにパッケージをインストールします。 ```sh -// with npm -npm install @material-ui/lab +// npmの場合 +npm install @material-ui/lab@next -// with yarn -yarn add @material-ui/lab +// yarnの場合 +yarn add @material-ui/lab@next ``` このラボには、コアコンポーネントへのピア依存関係があります。 プロジェクトでまだMaterial-UIを使用していない場合は、次のコマンドでインストールできます。 ```sh // npmの場合 -npm install @material-ui/core +npm install @material-ui/core@next // yarnの場合 -yarn add @material-ui/core +yarn add @material-ui/core@next + ``` ## TypeScript -[CSS overrides](/customization/theme-components/#global-style-overrides)と[default prop customization](/customization/theme-components/#default-props)の恩恵を受けるために、TypeScriptユーザーは以下の型をインポートする必要があります 内部的には、[module augmentation](/guides/typescript/#customization-of-theme)を使って、デフォルトのテーマ構造をLabで利用可能なコンポーネントに拡張します 内部的には、[module augmentation](/guides/typescript/#customization-of-theme)を使って、デフォルトのテーマ構造をLabで利用可能なコンポーネントに拡張します +[CSSのオーバーライド](/customization/theme-components/#global-style-overrides)と[デフォルトのプロパティのカスタマイズ](/customization/theme-components/#default-props)をするには、TypeScriptユーザーは以下の型をインポートする必要があります。 内部的には、[module augmentation](/guides/typescript/#customization-of-theme)を使って、デフォルトのテーマ構造をLabで利用可能なコンポーネントに拡張します ```tsx import '@material-ui/lab/themeAugmentation'; diff --git a/docs/src/pages/components/about-the-lab/about-the-lab-pt.md b/docs/src/pages/components/about-the-lab/about-the-lab-pt.md index 43490ca4d3f097..9313a744418a0a 100644 --- a/docs/src/pages/components/about-the-lab/about-the-lab-pt.md +++ b/docs/src/pages/components/about-the-lab/about-the-lab-pt.md @@ -8,8 +8,8 @@ A principal diferença entre o lab e o core (núcleo) é como os componentes sã Para que um componente esteja pronto para ir para o core, são considerados os seguintes critérios: -- Ele precisa ser **utilizado**. A equipe do Material-UI usa o Google Analytics e outras métricas para avaliar o uso de cada componente. Um componente do lab com baixo uso significa que ainda não está totalmente funcional ou que há uma baixa demanda por ele. -- Ele precisa atender critérios de **qualidade de código**, semelhante aos componentes do core. O componente não precisa ser perfeito para fazer parte do core, mas ele deve ser confiável o suficiente para que os desenvolvedores possam depender dele. +- Ele precisa ser **utilizado**. The Material-UI team uses Google Analytics in the documentation (among other metrics) to evaluate the usage of each component. A lab component with low usage either means that it isn't fully working yet, or that there is low demand for it. +- Ele precisa atender critérios de **qualidade de código**, semelhante aos componentes do core. It doesn't have to be perfect to be part of the core, but the component should be reliable enough that developers can depend on it. - Cada componente precisa de **definições de tipo**. Atualmente, não é necessário que um componente do lab seja tipado, mas ele precisará ser tipado para passar para o core. - Requer boa **cobertura de teste**. Atualmente, alguns dos componentes do lab não têm testes abrangentes. - O componente pode ser usado como **alavancagem** para incentivar os usuários a atualizar para a versão mais recente? Quanto menos fragmentada a comunidade, melhor. diff --git a/docs/src/pages/components/about-the-lab/about-the-lab-ru.md b/docs/src/pages/components/about-the-lab/about-the-lab-ru.md index 5e0ba8611c3a76..85257ccc6fcfb3 100644 --- a/docs/src/pages/components/about-the-lab/about-the-lab-ru.md +++ b/docs/src/pages/components/about-the-lab/about-the-lab-ru.md @@ -8,8 +8,8 @@ Готовность компонента к перемещению в основной пакет определяется следующими критериями: -- Он должен **использоваться**. Команда Material-UI помимо прочих метрик использует Google Analytics, чтобы оценить использование каждого компонента. Если компонент пакета lab используется редко, это может говорить о том, что он не полностью работоспособен, либо об отсутствии спроса на этот компонент. -- Он должен соответствовать **качеству кода** компонентов основного пакета. Он не обязан быть совершенным, чтобы стать частью основного пакета, но компонент должен быть достаточно надёжным, чтобы сторонние разработчики могли на него положиться. +- Он должен **использоваться**. Команда Material-UI, помимо прочих метрик, использует Google Analytics, чтобы оценить использование каждого компонента. Если компонент пакета lab используется редко, это может говорить о том, что он не полностью работоспособен, либо об отсутствии спроса на этот компонент. +- Он должен соответствовать **качеству кода** компонентов основного пакета. Он не обязан быть идеальным, чтобы стать частью основного пакета, но компонент должен быть достаточно надёжным, чтобы разработчики могли на него положиться. - Для каждого компонента требуется **определение типов**. Компоненты пакета lab на данный момент не обязаны быть типизированными, но это понадобится для перемещения компонента в основной пакет. - Требуется хорошее **покрытие тестами**. Некоторые компоненты пакета lab на данный момент не имеют всесторонних тестов. - Может ли он использоваться как **рычаг**, стимулирующий пользователей к обновлению до последней мажорной версии? Чем менее разрозненно коммьюнити, тем лучше. @@ -30,16 +30,16 @@ yarn add @material-ui/lab Пакет lab зависит напрямую от пакета основных компонентов. Если Material-UI ещё не использовался вашем проекте, вы можете установить его командой: ```sh -// with npm +// для npm npm install @material-ui/core -// with yarn +// для yarn yarn add @material-ui/core ``` ## TypeScript -Чтобы получить возможность пользоваться [переопределением CSS](/customization/theme-components/#global-style-overrides) и [изменением свойств по умолчанию](/customization/theme-components/#default-props), разработчикам, использующим TypeScript, нужно импортировать следующие типы. Чтобы расширить структуру темы по умолчанию для использования компонентов доступных в пакете lab, внутри используется [аугментация модулей](/guides/typescript/#customization-of-theme). +Чтобы воспользоваться преимуществами [переопределения CSS](/customization/theme-components/#global-style-overrides) и [изменения свойств по умолчанию](/customization/theme-components/#default-props), разработчикам, использующим TypeScript, необходимо импортировать следующие типы. Чтобы расширить структуру темы по умолчанию для использования компонентов доступных в пакете lab, внутри используется [аугментация модулей](/guides/typescript/#customization-of-theme). ```tsx import '@material-ui/lab/themeAugmentation'; diff --git a/docs/src/pages/components/about-the-lab/about-the-lab-zh.md b/docs/src/pages/components/about-the-lab/about-the-lab-zh.md index 4a2a38bd872156..f0d01a4fecbeb5 100644 --- a/docs/src/pages/components/about-the-lab/about-the-lab-zh.md +++ b/docs/src/pages/components/about-the-lab/about-the-lab-zh.md @@ -8,9 +8,9 @@ 对于那些准备放到核心库里的组件,需要考虑以下几点: -- 它需要**被使用过**。 Material-UI 团队使用谷歌分析的数据(Google Analytics stats)去评估每个组件的使用情况。 如果一个 lab 的组件使用数据比较低,意味着它并不能全部正常工作,或者需求量比较小。 -- 它的**代码质量**要和核心组件保持一致。 作为核心代码的一部分,它不需要很完美,但是这个组件应该要很可靠,这样其他开发者可以依赖它。 - - 每个组件都需要**类型定义**。 就目前来说,一个实验室组件不需要定义类型,但是当搬到核心代码之后就需要定义好类型了。 +- 它需要**被使用过**。 The Material-UI team uses Google Analytics in the documentation (among other metrics) to evaluate the usage of each component. A lab component with low usage either means that it isn't fully working yet, or that there is low demand for it. +- 它的**代码质量**要和核心组件保持一致。 It doesn't have to be perfect to be part of the core, but the component should be reliable enough that developers can depend on it. + - 每个组件需要**类型定义**。 就目前来说,一个实验室组件不需要定义类型,但是当搬到核心代码之后就需要定义好类型了。 - 需要较高的**测试覆盖率**。 有一些实验室组件目前不带有一些综合的测试。 - 该组件是否可以作为**杠杆**来激励用户升级到最新的主要版本? 一个社区的分裂程度越低越好。 - 它需要尽量避免在中短期内发生**破坏性更改**。 例如,如果它需要一个新的功能并因此将有可能引入重大更改,那么最好推迟将其纳入核心库的进程。 diff --git a/docs/src/pages/components/accordion/accordion-de.md b/docs/src/pages/components/accordion/accordion-de.md index 6741d9f4d7c64c..8873b921f5f29b 100644 --- a/docs/src/pages/components/accordion/accordion-de.md +++ b/docs/src/pages/components/accordion/accordion-de.md @@ -6,7 +6,7 @@ materialDesign: https://material.io/archive/guidelines/components/expansion-pane waiAria: 'https://www.w3.org/TR/wai-aria-practices/#accordion' --- -# Akkordeon (Accordion) +# Accordion (Akkordeon)

    Erweiterungspanels (Tafeln) enthalten Erstellungsabläufe und ermöglichen die einfache Bearbeitung eines Elements.

    @@ -14,11 +14,11 @@ waiAria: 'https://www.w3.org/TR/wai-aria-practices/#accordion' {{"component": "modules/components/ComponentLinkHeader.js"}} -> **Hinweis:** Diese Komponente ist zwar nicht mehr in den [Material-Design-Richtlinien](https://material.io/) dokumentiert, wird aber weiterhin von Material-UI unterstützt. It was formerly known as the "expansion panel". +> **Hinweis:** Diese Komponente ist zwar nicht mehr in den [Material-Design-Richtlinien](https://material.io/) dokumentiert, wird aber weiterhin von Material-UI unterstützt. Es war früher als "Erweiterungspanel" bekannt. ## Einfaches Erweiterungspanel -{{"demo": "pages/components/accordion/SimpleAccordion.js", "bg": true}} +{{"demo": "pages/components/accordion/BasicAccordion.js", "bg": true}} ## Kontrolliertes Akkordeon diff --git a/docs/src/pages/components/accordion/accordion-fr.md b/docs/src/pages/components/accordion/accordion-fr.md index 9348be01e42992..35ebee5524609b 100644 --- a/docs/src/pages/components/accordion/accordion-fr.md +++ b/docs/src/pages/components/accordion/accordion-fr.md @@ -1,5 +1,5 @@ --- -title: React Accordion component +title: Composant React Accordéon components: Accordion, AccordionActions, AccordionDetails, AccordionSummary githubLabel: 'component: Accordion' materialDesign: https://material.io/archive/guidelines/components/expansion-panels.html @@ -10,7 +10,7 @@ waiAria: 'https://www.w3.org/TR/wai-aria-practices/#accordion'

    L'accordéon contient le flux de création et permet la modification légère de ses éléments.

    -[Un panneau d'extension](https://material.io/archive/guidelines/components/expansion-panels.html) est un conteneur léger pouvant être autonome ou connecté à une surface plus grande, telle qu'une carte. +Un [panneau d'extension](https://material.io/archive/guidelines/components/expansion-panels.html) est un conteneur léger pouvant être autonome ou connecté à une surface plus grande, telle qu'une carte. {{"component": "modules/components/ComponentLinkHeader.js"}} @@ -26,7 +26,7 @@ waiAria: 'https://www.w3.org/TR/wai-aria-practices/#accordion' {{"demo": "pages/components/accordion/ControlledAccordions.js", "bg": true}} -## Customized accordions +## Accordéon personnalisé Voici un exemple de personnalisation du composant. Vous pouvez en savoir plus dans la [page de documentation des overrides](/customization/how-to-customize/). diff --git a/docs/src/pages/components/accordion/accordion-ja.md b/docs/src/pages/components/accordion/accordion-ja.md index c837e8a5fa17d8..2bcb2a836f9fff 100644 --- a/docs/src/pages/components/accordion/accordion-ja.md +++ b/docs/src/pages/components/accordion/accordion-ja.md @@ -1,5 +1,5 @@ --- -title: React Accordion component +title: React アコーディオン コンポーネント components: Accordion, AccordionActions, AccordionDetails, AccordionSummary githubLabel: 'component: Accordion' materialDesign: https://material.io/archive/guidelines/components/expansion-panels.html @@ -10,15 +10,15 @@ waiAria: 'https://www.w3.org/TR/wai-aria-practices/#accordion'

    Expansion panels(拡張パネル) には作成フローが含まれ、要素を簡単に編集できます。

    -[拡張パネル](https://material.io/archive/guidelines/components/expansion-panels.html)は 独立した軽量のコンテナであるか、カードなどの大きなサーフェスに接続されています。 +Reactアコーディオンコンポーネントは 単体で扱えるコンテナ、もしくはカードコンポーネントのようにより大きなコンポーネントと組み合わせて使います。 {{"component": "modules/components/ComponentLinkHeader.js"}} > **注:** 拡張パネルについては、[Material Design guidelines](https://material.io/)では説明されていませんが、Material-UIでは引き続きサポートされます。 以前は"expansion panel"としてしられていたものです。 -## Simple Accordion +## 基本の Accordionコンポーネント -{{"demo": "pages/components/accordion/SimpleAccordion.js", "bg": true}} +{{"demo": "pages/components/accordion/BasicAccordion.js", "bg": true}} ## Controlled Accordion @@ -26,9 +26,9 @@ waiAria: 'https://www.w3.org/TR/wai-aria-practices/#accordion' {{"demo": "pages/components/accordion/ControlledAccordions.js", "bg": true}} -## カスタマイズされた拡張パネル +## アコーディオンコンポーネントのカスタマイズ -コンポーネントのカスタマイズ例を次に示します。 詳細については、 [overrides documentation page](/customization/how-to-customize/)を参照してください。 +コンポーネントのカスタマイズ例を次に示します。 詳細については、 [こちら](/customization/how-to-customize/)を参照してください。 {{"demo": "pages/components/accordion/CustomizedAccordions.js"}} diff --git a/docs/src/pages/components/accordion/accordion-pt.md b/docs/src/pages/components/accordion/accordion-pt.md index 5bb9a4ae5ee612..fbee0278722a98 100644 --- a/docs/src/pages/components/accordion/accordion-pt.md +++ b/docs/src/pages/components/accordion/accordion-pt.md @@ -18,7 +18,7 @@ waiAria: 'https://www.w3.org/TR/wai-aria-practices/#accordion' ## Painel de Expansão Simples -{{"demo": "pages/components/accordion/SimpleAccordion.js", "bg": true}} +{{"demo": "pages/components/accordion/BasicAccordion.js", "bg": true}} ## Acordeão controlado diff --git a/docs/src/pages/components/accordion/accordion-ru.md b/docs/src/pages/components/accordion/accordion-ru.md index b3a3de8fd91cca..f6f741eeb23556 100644 --- a/docs/src/pages/components/accordion/accordion-ru.md +++ b/docs/src/pages/components/accordion/accordion-ru.md @@ -10,15 +10,15 @@ waiAria: 'https://www.w3.org/TR/wai-aria-practices/#accordion'

    Аккордеоны содержат потоки создания и позволяют осуществить легковесное редактирование элемента.

    -[Accordion](https://material.io/archive/guidelines/components/expansion-panels.html) это простой контейнер, который может использоваться отдельно, либо как часть более крупного компонента, такого как Card (карточка). +Аккордеон это простой контейнер, который может использоваться как самостоятельно, так и внутри более крупного компонента, такого как Card (карточка). {{"component": "modules/components/ComponentLinkHeader.js"}} > **На заметку:** Аккордеоны больше не задокументированы в [руководствах Material Design](https://material.io/), но Material-UI будет продолжать поддерживать их. Ранее они были известны как "expansion panels". -## Простая Accordion +## Простой аккордеон -{{"demo": "pages/components/accordion/SimpleAccordion.js", "bg": true}} +{{"demo": "pages/components/accordion/BasicAccordion.js", "bg": true}} ## Контролируемый аккордеон @@ -26,9 +26,9 @@ waiAria: 'https://www.w3.org/TR/wai-aria-practices/#accordion' {{"demo": "pages/components/accordion/ControlledAccordions.js", "bg": true}} -## Customized accordions +## Кастомизированные аккордеоны -Ниже находится пример кастомизации компонента. You can learn more about this in the [overrides documentation page](/customization/how-to-customize/). +Ниже находится пример кастомизации компонента. Вы можете узнать об этом больше [в документации по переопределению свойств](/customization/how-to-customize/). {{"demo": "pages/components/accordion/CustomizedAccordions.js"}} diff --git a/docs/src/pages/components/accordion/accordion-zh.md b/docs/src/pages/components/accordion/accordion-zh.md index 8861355033a567..21dbd82690ed3d 100644 --- a/docs/src/pages/components/accordion/accordion-zh.md +++ b/docs/src/pages/components/accordion/accordion-zh.md @@ -18,7 +18,7 @@ waiAria: 'https://www.w3.org/TR/wai-aria-practices/#accordion' ## 简单的扩展面板 -{{"demo": "pages/components/accordion/SimpleAccordion.js", "bg": true}} +{{"demo": "pages/components/accordion/BasicAccordion.js", "bg": true}} ## 可控制的折叠面板 diff --git a/docs/src/pages/components/alert/alert-fr.md b/docs/src/pages/components/alert/alert-fr.md index 081d7acfc52b08..1a493eba9a4af3 100644 --- a/docs/src/pages/components/alert/alert-fr.md +++ b/docs/src/pages/components/alert/alert-fr.md @@ -1,5 +1,5 @@ --- -title: React Alert component +title: Composant React Alerte components: Alert, AlertTitle githubLabel: 'component: Alert' waiAria: 'https://www.w3.org/TR/wai-aria-practices/#alert' diff --git a/docs/src/pages/components/alert/alert-ja.md b/docs/src/pages/components/alert/alert-ja.md index c7adbdb1879802..5d3bb802572c97 100644 --- a/docs/src/pages/components/alert/alert-ja.md +++ b/docs/src/pages/components/alert/alert-ja.md @@ -1,5 +1,5 @@ --- -title: React Alert component +title: React アラート コンポーネント components: Alert, AlertTitle githubLabel: 'component: Alert' waiAria: 'https://www.w3.org/TR/wai-aria-practices/#alert' @@ -9,11 +9,11 @@ waiAria: 'https://www.w3.org/TR/wai-aria-practices/#alert'

    アラートは、ユーザのタスクを中断することなく、ユーザの注意を引き付けるような短く重要なメッセージを表示します。

    -**注意:** このコンポーネントは [Material Design guidelines](https://material.io/)に記載されていませんが、Material-UIはそれをサポートしています。 +**注意:** このコンポーネントは [マテリアルデザインのガイドライン](https://material.io/)に記載されていませんが、Material-UI ではサポートしています。 {{"component": "modules/components/ComponentLinkHeader.js"}} -## Simple alerts +## 基本のアラートコンポーネント このアラートは、特徴的なアイコンと色を設定する4つの重要度レベルを提供します。 @@ -43,9 +43,9 @@ waiAria: 'https://www.w3.org/TR/wai-aria-practices/#alert' `アイコン` プロパティでは、アラートコンポーネントの先頭にアイコンを追加できます。 これは指定された重要度のデフォルトアイコンを上書きします。 これは指定された重要度のデフォルトアイコンを上書きします。 これは指定された重要度のデフォルトアイコンを上書きします。 これは指定された重要度のデフォルトアイコンを上書きします。 これは指定された重要度のデフォルトアイコンを上書きします。 -`iconMapping` プロパティを使用して、デフォルトの重要度をアイコンマッピングに変更できます。 `iconMapping` プロパティを使用して、デフォルトの重要度をアイコンマッピングに変更できます。 [テーマカスタマイズ](/customization/globals/#default-props)を使用してグローバルに定義することができます。 `iconMapping` プロパティを使用して、デフォルトの重要度をアイコンマッピングに変更できます。 [テーマカスタマイズ](/customization/globals/#default-props)を使用してグローバルに定義することができます。 `iconMapping` プロパティを使用して、デフォルトの重要度をアイコンマッピングに変更できます。 [テーマカスタマイズ](/customization/globals/#default-props)を使用してグローバルに定義することができます。 [テーマカスタマイズ](/customization/theme-components/#default-props)を使用してグローバルに定義することができます。 +`iconMapping` プロパティを使用して、デフォルトの重要度をアイコンマッピングに変更できます。 `iconMapping` プロパティを使用して、デフォルトの重要度をアイコンマッピングに変更できます。 [テーマカスタマイズ](/customization/globals/#default-props)を使用してグローバルに定義することができます。 `iconMapping` プロパティを使用して、デフォルトの重要度をアイコンマッピングに変更できます。 [テーマカスタマイズ](/customization/globals/#default-props)を使用してグローバルに定義することができます。 `iconMapping` プロパティを使用して、デフォルトの重要度をアイコンマッピングに変更できます。 [テーマカスタマイズ](/customization/globals/#default-props)を使用してグローバルに定義することができます。 [テーマをカスタマイズ](/customization/theme-components/#default-props)してグローバルに定義することができます。 -Setting the icon prop to false will remove the icon altogether. +icon プロパティ を `false` に設定すると、アイコンが全て削除されます。 {{"demo": "pages/components/alert/IconAlerts.js"}} @@ -75,8 +75,8 @@ Snackbar を使ってアラートで [乾杯を表示](/components/snackbars/#cu (WAI-ARIA: https://www.w3.org/TR/wai-aria-practices/#alert) -コンポーネントが動的に表示されると、ほとんどのスクリーンリーダーによってコンテンツが自動的に表示されます。 この時点で、スクリーンリーダーは、ページが読み込まれたときに存在するアラートをユーザーに知らせることはありません。 コンポーネントが動的に表示されると、ほとんどのスクリーンリーダーによってコンテンツが自動的に表示されます。 この時点で、スクリーンリーダーは、ページが読み込まれたときに存在するアラートをユーザーに知らせることはありません。 コンポーネントが動的に表示されると、ほとんどのスクリーンリーダーによってコンテンツが自動的に表示されます。 この時点で、スクリーンリーダーは、ページが読み込まれたときに存在するアラートをユーザーに知らせることはありません。 この時点で、スクリーンリーダーは、ページが読み込まれたときに存在するアラートをユーザーに知らせることはありません。 +コンポーネントが動的に表示されると、ほとんどのスクリーンリーダーによってコンテンツが自動的に表示されます。 この時点で、スクリーンリーダーは、ページが読み込まれたときに存在するアラートをユーザーに知らせることはありません。 -色を使って意味を加えることは視覚的な表示のみを提供し、スクリーンリーダーなどの支援技術の利用者には伝えられません。 色で示されている情報がコンテンツ自体から明らかになっていることを確認してください (例えば、目に見えるテキスト) または、隠されたテキストなどの代替手段によって含まれています。 色で示されている情報がコンテンツ自体から明らかになっていることを確認してください (例えば、目に見えるテキスト) または、隠されたテキストなどの代替手段によって含まれています。 色で示されている情報がコンテンツ自体から明らかになっていることを確認してください (例えば、目に見えるテキスト) または、隠されたテキストなどの代替手段によって含まれています。 +色を使って意味を加えることは視覚的な表示のみを提供し、スクリーンリーダーなどの支援技術の利用者には伝えられません。 色で示されている情報がコンテンツ自体から明らかになっていることを確認してください (例えば、目に見えるテキスト) または、隠されたテキストなどの代替手段によって含まれています。 アクションはキーボードのみのユーザーがアクセスできるように、タブインデックスが 0 である必要があります。 diff --git a/docs/src/pages/components/alert/alert-ru.md b/docs/src/pages/components/alert/alert-ru.md index 8d8d491f2be5dd..ae1c7a7a3b5715 100644 --- a/docs/src/pages/components/alert/alert-ru.md +++ b/docs/src/pages/components/alert/alert-ru.md @@ -13,7 +13,7 @@ waiAria: 'https://www.w3.org/TR/wai-aria-practices/#alert' {{"component": "modules/components/ComponentLinkHeader.js"}} -## Простейшие предупреждения +## Простые предупреждения Alert предлагает 4 уровня важности предупреждения с уникальными цветом и значком. @@ -43,9 +43,9 @@ You can use a [transition component](/components/transitions/) such as `Collapse The `icon` prop allows you to add an icon to the beginning of the alert component. This will override the default icon for the specified severity. -You can change the default severity to icon mapping with the `iconMapping` prop. This can be defined globally using [theme customization](/customization/theme-components/#default-props). +You can change the default severity to icon mapping with the `iconMapping` prop. Это может быть определено глобально в [настройках темы](/customization/theme-components/#default-props). -Setting the icon prop to false will remove the icon altogether. +Присвоение свойству icon значения `false` полностью удалит иконку. {{"demo": "pages/components/alert/IconAlerts.js"}} diff --git a/docs/src/pages/components/app-bar/app-bar-de.md b/docs/src/pages/components/app-bar/app-bar-de.md index ea2595d77d994f..802b54513cc97c 100644 --- a/docs/src/pages/components/app-bar/app-bar-de.md +++ b/docs/src/pages/components/app-bar/app-bar-de.md @@ -72,21 +72,18 @@ function App() { 3. You can use `theme.mixins.toolbar` CSS: ```jsx -const useStyles = makeStyles(theme => ({ - offset: theme.mixins.toolbar, -})) +const Offset = styled('div')(({ theme }) => theme.mixins.toolbar); function App() { - const classes = useStyles(); return ( {/* content */} -
    + - ) -}; + ); +} ``` ## Scrollen @@ -115,11 +112,11 @@ Beim Scrollen erscheint ein schwebender Button, um einfach wieder zum Seitenanfa #### Parameter -1. `options` (*Object* [optional]): +1. `options` (_object_ [optional]): - - `options.disableHysteresis` (*Boolean* [optional]): Standardeinstellung ist `false`. Hysterese deaktivieren. Die Bildlaufrichtung wird beim Bestimmen des `trigger`-Werts ignoriert. + - `options.disableHysteresis` (_bool_ [optional]): Defaults to `false`. Hysterese deaktivieren. Die Bildlaufrichtung wird beim Bestimmen des `trigger`-Werts ignoriert. - `options.target` (*Node* [optional]): Standardwert `window`. - - `options.threshold` (*Number* [optional]): Defaults to `100`. Change the `trigger` value when the vertical scroll strictly crosses this threshold (exclusive). + - `options.threshold` (*number* [optional]): Defaults to `100`. Change the `trigger` value when the vertical scroll strictly crosses this threshold (exclusive). #### Rückgabewerte @@ -139,3 +136,27 @@ function HideOnScroll(props) { ); } ``` + +## Enable Color on Dark + +Following the [Material Design guidelines](https://material.io/design/color/dark-theme.html), the `color` prop has no effect on the appearance of the AppBar in dark mode. You can override this behavior by setting the `enableColorOnDark` prop to `true`. + +```jsx +// Specific element via prop + + +// Affect all AppBars via theme + + + +``` diff --git a/docs/src/pages/components/app-bar/app-bar-es.md b/docs/src/pages/components/app-bar/app-bar-es.md index c3ebd86f5d81b3..e509136b771f16 100644 --- a/docs/src/pages/components/app-bar/app-bar-es.md +++ b/docs/src/pages/components/app-bar/app-bar-es.md @@ -139,3 +139,27 @@ function HideOnScroll(props) { ); } ``` + +## Enable Color on Dark + +Following the [Material Design guidelines](https://material.io/design/color/dark-theme.html), the `color` prop has no effect on the appearance of the AppBar in dark mode. You can override this behavior by setting the `enableColorOnDark` prop to `true`. + +```jsx +// Specific element via prop + + +// Affect all AppBars via theme + + + +``` diff --git a/docs/src/pages/components/app-bar/app-bar-fr.md b/docs/src/pages/components/app-bar/app-bar-fr.md index b193c42eb8c486..efce76d1f6de91 100644 --- a/docs/src/pages/components/app-bar/app-bar-fr.md +++ b/docs/src/pages/components/app-bar/app-bar-fr.md @@ -9,7 +9,7 @@ materialDesign: https://material.io/components/app-bars-top

    La barre d'application affiche des informations et des actions relatives à l'écran actuel.

    -[La barre d'application](https://material.io/design/components/app-bars-top.html) de la page fournit le contenu et les actions liés à l'écran actuel. It's used for branding, screen titles, navigation, and actions. +[La barre d'application](https://material.io/design/components/app-bars-top.html) de la page fournit le contenu et les actions liés à l'écran actuel. Elle est utilisée pour le marquage, les titres d'écran, la navigation et les actions. Il peut être utilisé en tant que barre d'action contextuel ou en tant que barre de navigation. @@ -53,7 +53,7 @@ Barre d'application étendu. Quand vous rendez la barre d'application en position fixe, les dimensions de l'élément n'impact pas le reste de page. Cela peut rendre certaine partie de votre contenu invisible, caché derrière la barre d'application. Voici 3 solutions possible: -1. Vous pouvez utiliser `position="sticky"` au lieu de `position="fixed"`. ⚠️ sticky is not supported by IE11. +1. Vous pouvez utiliser `position="sticky"` au lieu de `position="fixed"`. ⚠️ sticky n'est pas supporté par IE11. 2. Vous pouvez rendre un deuxième composant `` : ```jsx @@ -118,7 +118,7 @@ Au défilement un bouton d'action flottant apparaît pour faciliter le retour au 1. `options` (*Object* [optional]): - `options.disableHysteresis` (*Boolean* [optional]): Valeur par défaut `false`. Désactive l'hystérésis. Ignore le sens de défilement lors de la détermination de la valeur `trigger`. - - `options.target` (*Node* [optional]): Valeur par défaut `window`. + - `options.target` (_Nœud_ [optionnel]) : Valeur par défaut `window`. - `options.threshold` (*Nombre* [optional]): Valeur par défaut `100`. Modifier la valeur de `déclenchement` quand lorsque le défilement vertical dépasse strictement ce seuil (exclusif). #### Valeur de retour @@ -139,3 +139,27 @@ function HideOnScroll(props) { ); } ``` + +## Enable Color on Dark + +Following the [Material Design guidelines](https://material.io/design/color/dark-theme.html), the `color` prop has no effect on the appearance of the AppBar in dark mode. You can override this behavior by setting the `enableColorOnDark` prop to `true`. + +```jsx +// Specific element via prop + + +// Affect all AppBars via theme + + + +``` diff --git a/docs/src/pages/components/app-bar/app-bar-ja.md b/docs/src/pages/components/app-bar/app-bar-ja.md index f127777df00faa..01b7150ae882e3 100644 --- a/docs/src/pages/components/app-bar/app-bar-ja.md +++ b/docs/src/pages/components/app-bar/app-bar-ja.md @@ -9,13 +9,13 @@ materialDesign: https://material.io/components/app-bars-top

    App Barには、現在の画面に関する情報と操作が表示されます。

    -[top App Bar](https://material.io/design/components/app-bars-top.html) は、現在の画面に関連するコンテンツとアクションを提供します。 It's used for branding, screen titles, navigation, and actions. +トップにあるApp Barは、現在の画面に関連するコンテンツとアクションを提供します。 それらはブランディング、画面タイトル、ナビゲーション、およびアクションに使用されます。 アクションバーに変換したり、ナビゲーションバーとして使うことができます。 {{"component": "modules/components/ComponentLinkHeader.js"}} -## シンプルなアプリバー +## 基本的なApp Bar {{"demo": "pages/components/app-bar/ButtonAppBar.js", "bg": true}} @@ -51,9 +51,9 @@ materialDesign: https://material.io/components/app-bars-top ## ラベルの配置 -アプリバーの位置を固定してレンダリングすると、要素の寸法はページの残りの部分に影響しません。 これにより、コンテンツの一部がアプリバーの背後で見えなくなる可能性があります。 以下に3つの解決策を示します。 これにより、コンテンツの一部がアプリバーの背後で見えなくなる可能性があります。 以下に3つの解決策を示します。 +アプリバーの位置を固定してレンダリングすると、要素の寸法はページの残りの部分に影響しません。 これにより、コンテンツの一部がアプリバーの背後で見えなくなる可能性があります。 以下に3つの解決策を示します。 これにより、コンテンツの一部がアプリバーの背後で見えなくなる可能性があります。 以下に3つの解決策を示します。 これにより、コンテンツの一部がアプリバーの背後で見えなくなる可能性があります。 以下に3つの解決策を示します。 これにより、コンテンツの一部がアプリバーの背後で見えなくなる可能性があります。 以下に3つの解決策を示します。 これにより、コンテンツの一部がアプリバーの背後で見えなくなる可能性があります。 以下に3つの解決策を示します。 -1. fixed の代わりに `position="sticky"` を使用できます。 ⚠️ sticky is not supported by IE11. +1. fixed の代わりに `position="sticky"` を使用できます。 ⚠️ stickyはIE11ではサポートされていません。 2. 2番目の `` コンポーネントをレンダリングできます: ```jsx @@ -72,21 +72,18 @@ function App() { 3. `theme.mixins.toolbar` CSSを使えます。: ```jsx -const useStyles = makeStyles(theme => ({ - offset: theme.mixins.toolbar, -})) +const Offset = styled('div')(({ theme }) => theme.mixins.toolbar); function App() { - const classes = useStyles(); return ( {/* content */} -
    + - ) -}; + ); +} ``` ## スクロール @@ -115,11 +112,11 @@ function App() { #### 引数 -1. `オプション` (*オプジェクト* [任意]): +1. `options` (_object_ [optional]): - - `options.disableHysteresis` (*ブール値* [任意]): デフォルト値 `false`. ヒステリシスを無効にします。 ヒステリシスを無効にします。 ヒステリシスを無効にします。 ヒステリシスを無効にします。 ヒステリシスを無効にします。 `trigger` 値を決定するときにスクロール方向を無視します。 - - `options.target` (*ノード* [任意]): デフォルト地 `window`. - - `options.threshold` (*Number* [optional]): デフォルトは`100`. 垂直スクロールがこのしきい値(排他的) を厳密に超えたときに`trigger` 値を変更します。 + - `options.disableHysteresis` (_bool_ [optional]): Defaults to `false`. ヒステリシスを無効にします。 ` trigger ` 値を決定するときにスクロール方向を無視します。 + - `options.target` (*Node* [optional]): デフォルト値: `window`. + - `options.threshold` (*number* [optional]): デフォルト値:`100`. 垂直スクロールがこのしきい値(排他的) を厳密に超えたときに`trigger` 値を変更します。 #### 戻り値 @@ -139,3 +136,27 @@ function HideOnScroll(props) { ); } ``` + +## Enable Color on Dark + +Following the [Material Design guidelines](https://material.io/design/color/dark-theme.html), the `color` prop has no effect on the appearance of the AppBar in dark mode. You can override this behavior by setting the `enableColorOnDark` prop to `true`. + +```jsx +// Specific element via prop + + +// Affect all AppBars via theme + + + +``` diff --git a/docs/src/pages/components/app-bar/app-bar-pt.md b/docs/src/pages/components/app-bar/app-bar-pt.md index 060dd999d26e52..662abcf98964cd 100644 --- a/docs/src/pages/components/app-bar/app-bar-pt.md +++ b/docs/src/pages/components/app-bar/app-bar-pt.md @@ -72,19 +72,18 @@ function App() { 3. Você pode usar o CSS `theme.mixins.toolbar`: ```jsx -const useStyles = makeStyles(theme => ({ - offset: theme.mixins.toolbar, -})) +const Offset = styled('div')(({ theme }) => theme.mixins.toolbar); function App() { - const classes = useStyles(); return ( - + - {/* conteúdo */} + {/* content */} -
    - + + ); +} ``` ## Rolagem @@ -113,11 +112,11 @@ Um botão de ação flutuante aparece na rolagem para facilitar o retorno ao top #### Argumentos -1. `options` (_Object_ [opcional]): +1. `options` (_object_ [optional]): - - `options.disableHysteresis` (_Boolean_ [opcional]): Padrão `false`. Desabilita a histerese. Ignora a direção de rolagem ao determinar o valor de `trigger`. + - `options.disableHysteresis` (_bool_ [optional]): Defaults to `false`. Desabilita a histerese. Ignora a direção de rolagem ao determinar o valor de `trigger`. - `options.target` (_Node_ [opcional]): Padrão `window`. - - `options.threshold` (_Number_ [opcional]): Padrão `100`. Modifica o valor limite que aciona a `trigger` quando a barra de rolagem vertical cruzar ou chegar a este limite. + - `options.threshold` (_number_ [opcional]): Padrão `100`. Modifica o valor limite que aciona a `trigger` quando a barra de rolagem vertical cruzar ou chegar a este limite. #### Retornos @@ -137,3 +136,27 @@ function HideOnScroll(props) { ); } ``` + +## Enable Color on Dark + +Following the [Material Design guidelines](https://material.io/design/color/dark-theme.html), the `color` prop has no effect on the appearance of the AppBar in dark mode. You can override this behavior by setting the `enableColorOnDark` prop to `true`. + +```jsx +// Specific element via prop + + +// Affect all AppBars via theme + + + +``` diff --git a/docs/src/pages/components/app-bar/app-bar-ru.md b/docs/src/pages/components/app-bar/app-bar-ru.md index ed8fe471b21727..b604c5323b169d 100644 --- a/docs/src/pages/components/app-bar/app-bar-ru.md +++ b/docs/src/pages/components/app-bar/app-bar-ru.md @@ -9,7 +9,7 @@ materialDesign: https://material.io/components/app-bars-top

    Панель навигации отображает информацию и действия, относящиеся к текущему экрану.

    -В [](https://material.io/design/components/app-bars-top.html)верхней панели приложений отображается содержимое и действия, связанные с текущим экраном. It's used for branding, screen titles, navigation, and actions. +В [](https://material.io/design/components/app-bars-top.html)верхней панели приложений отображается содержимое и действия, связанные с текущим экраном. Она используется для брендинга, заголовков экрана, навигации и действий. Она может использоваться как контекстное меню или как навигационная панель. @@ -72,21 +72,18 @@ function App() { 3. Вы можете использовать `theme.mixins.toolbar` в CSS: ```jsx -const useStyles = makeStyles(theme => ({ - offset: theme.mixins.toolbar, -})) +const Offset = styled('div')(({ theme }) => theme.mixins.toolbar); function App() { - const classes = useStyles(); return ( - {/* содержимое */} + {/* content */} -
    + - ) -}; + ); +} ``` ## Прокрутка @@ -115,11 +112,11 @@ function App() { #### Аргументы -1. `варианты` (*объекта* [optional]): +1. `options` (_object_ [optional]): - - `options.disableHysteresis` (*Boolean* [optional]): По умолчанию - `false`. Отключение запаздывания. Игнорирование направления прокрутки когда определено `trigger` значение. + - `options.disableHysteresis` (_bool_ [optional]): Defaults to `false`. Отключение запаздывания. Игнорирование направления прокрутки когда определено `trigger` значение. - `options.target` (*Node* [optional]): По умолчанию `window`. - - `options.threshold` (*Number* [optional]): По умолчанию `100`. Измените значение `trigger` когда вертикальная прокрутка строго первышает этот порог (исключительно). + - `options.threshold` (*number* [optional]): По умолчанию `100`. Измените значение `trigger` когда вертикальная прокрутка строго первышает этот порог (исключительно). #### Возвращает @@ -130,3 +127,27 @@ function App() { ```jsx
    ``` + +## Enable Color on Dark + +Following the [Material Design guidelines](https://material.io/design/color/dark-theme.html), the `color` prop has no effect on the appearance of the AppBar in dark mode. You can override this behavior by setting the `enableColorOnDark` prop to `true`. + +```jsx +// Specific element via prop + + +// Affect all AppBars via theme + + + +``` diff --git a/docs/src/pages/components/app-bar/app-bar-zh.md b/docs/src/pages/components/app-bar/app-bar-zh.md index ff1111257dd88c..5b348c169d45a1 100644 --- a/docs/src/pages/components/app-bar/app-bar-zh.md +++ b/docs/src/pages/components/app-bar/app-bar-zh.md @@ -72,18 +72,15 @@ function App() { 3. 也可以用 `theme.mixins.toolbar` 的 CSS: ```jsx -const useStyles = makeStyles((theme) => ({ - offset: theme.mixins.toolbar, -})); +const Offset = styled('div')(({ theme }) => theme.mixins.toolbar); function App() { - const classes = useStyles(); return ( - {/* 内容 */} + {/* content */} -
    + ); } @@ -115,11 +112,11 @@ function App() { #### 参数 -1. `options` (_Object_ [optional]): +1. `options` (_object_ [optional]): - - `options.disableHysteresis` (_Boolean_ [optional]):默认值为 `false`。 禁用迟滞的效果。 在决定 `trigger` 的值时会忽略在滚动的方向。 + - `options.disableHysteresis` (_bool_ [optional]): Defaults to `false`. 禁用迟滞的效果。 在决定 `trigger` 的值时会忽略在滚动的方向。 - `options.target` (_Node_ [optional]):默认值是 `window`。 - - `options.threshold` (_Number_ [optional]):默认值是 `100`。 严格来说,当垂直滚动超过(但不包括)此阈值时,请更改 `trigger` 的值。 + - `options.threshold` (_number_ [optional]):默认值是 `100`。 严格来说,当垂直滚动超过(但不包括)此阈值时,请更改 `trigger` 的值。 #### 返回结果 @@ -139,3 +136,27 @@ function HideOnScroll(props) { ); } ``` + +## Enable Color on Dark + +Following the [Material Design guidelines](https://material.io/design/color/dark-theme.html), the `color` prop has no effect on the appearance of the AppBar in dark mode. You can override this behavior by setting the `enableColorOnDark` prop to `true`. + +```jsx +// Specific element via prop + + +// Affect all AppBars via theme + + + +``` diff --git a/docs/src/pages/components/autocomplete/FreeSoloCreateOptionDialog.js b/docs/src/pages/components/autocomplete/FreeSoloCreateOptionDialog.js index fedc10610f7d6e..c3d13b3b5f9f62 100644 --- a/docs/src/pages/components/autocomplete/FreeSoloCreateOptionDialog.js +++ b/docs/src/pages/components/autocomplete/FreeSoloCreateOptionDialog.js @@ -95,9 +95,9 @@ export default function FreeSoloCreateOptionDialog() { freeSolo renderInput={(params) => } /> - +
    - Add a new film + Add a new film Did you miss any film in our list? Please, add it! diff --git a/docs/src/pages/components/autocomplete/FreeSoloCreateOptionDialog.tsx b/docs/src/pages/components/autocomplete/FreeSoloCreateOptionDialog.tsx index 5c9505ed7ffb80..b20b03d8994852 100644 --- a/docs/src/pages/components/autocomplete/FreeSoloCreateOptionDialog.tsx +++ b/docs/src/pages/components/autocomplete/FreeSoloCreateOptionDialog.tsx @@ -93,9 +93,9 @@ export default function FreeSoloCreateOptionDialog() { freeSolo renderInput={(params) => } /> - + - Add a new film + Add a new film Did you miss any film in our list? Please, add it! diff --git a/docs/src/pages/components/autocomplete/autocomplete-de.md b/docs/src/pages/components/autocomplete/autocomplete-de.md index eb3c6ed74e11f9..aa56352c964690 100644 --- a/docs/src/pages/components/autocomplete/autocomplete-de.md +++ b/docs/src/pages/components/autocomplete/autocomplete-de.md @@ -52,7 +52,7 @@ However, you can use different structures by providing a `getOptionLabel` prop. ### Spielwiese -Die folgenden Beispiele demonstrieren je eine Funktion der Autocomplete-Komponente. +Each of the following examples demonstrates one feature of the Autocomplete component. {{"demo": "pages/components/autocomplete/Playground.js"}} @@ -62,14 +62,14 @@ Wählen Sie eines der 248 Länder. {{"demo": "pages/components/autocomplete/CountrySelect.js"}} -### Controllable states +### Controlled states The component has two states that can be controlled: 1. the "value" state with the `value`/`onChange` props combination. This state represents the value selected by the user, for instance when pressing Enter. 2. the "input value" state with the `inputValue`/`onInputChange` props combination. This state represents the value displayed in the textbox. -> ⚠️ These two state are isolated, they should be controlled independently. +> ⚠️ These two states are isolated, they should be controlled independently. {{"demo": "pages/components/autocomplete/ControllableStates.js"}} @@ -110,7 +110,7 @@ You can group the options with the `groupBy` prop. If you do so, make sure that ## `useAutocomplete` -For advanced customization use cases, we expose a headless `useAutocomplete()` hook. It accepts almost the same options as the Autocomplete component minus all the props related to the rendering of JSX. The Autocomplete component uses this hook internally. +For advanced customization use cases, a headless `useAutocomplete()` hook is exposed. It accepts almost the same options as the Autocomplete component minus all the props related to the rendering of JSX. The Autocomplete component is built on this hook. ```jsx import useAutocomplete from '@material-ui/core/useAutocomplete'; @@ -226,14 +226,14 @@ import { createFilterOptions } from '@material-ui/core/Autocomplete'; #### Parameter -1. `config` (*Object* [optional]): +1. `config` (_object_ [optional]): -- `config.ignoreAccents` (*Boolean* [optional]): Defaults to `true`. Remove diacritics. -- `config.ignoreCase` (*Boolean* [optional]): Defaults to `true`. Alles in Kleinbuchstaben. -- `config.limit` (*Number* [optional]): Default to null. Limit the number of suggested options to be shown. For example, if `config.limit` is `100`, only the first `100` matching options are shown. It can be useful if a lot of options match and virtualization wasn't set up. +- `config.ignoreAccents` (_bool_ [optional]): Defaults to `true`. Remove diacritics. +- `config.ignoreCase` (_bool_ [optional]): Defaults to `true`. Alles in Kleinbuchstaben. +- `config.limit` (*number* [optional]): Default to null. Limit the number of suggested options to be shown. For example, if `config.limit` is `100`, only the first `100` matching options are shown. It can be useful if a lot of options match and virtualization wasn't set up. - `config.matchFrom` (*'any' | 'start'* [optional]): Defaults to `'any'`. -- `config.stringify` (*Func* [optional]): Controls how an option is converted into a string so that it can be matched against the input text fragment. -- `config.trim` (*Boolean* [optional]): Standardeinstellung ist `false`. Abschließende Leerzeichen entfernen. +- `config.stringify` (*func* [optional]): Controls how an option is converted into a string so that it can be matched against the input text fragment. +- `config.trim` (_bool_ [optional]): Defaults to `false`. Abschließende Leerzeichen entfernen. #### Rückgabewerte @@ -279,7 +279,7 @@ If you would like to prevent the default key handler behavior, you can set the e onKeyDown={(event) => { if (event.key === 'Enter') { // Prevent's default 'Enter' behavior. - event.defaultMuiPrevented = false; + event.defaultMuiPrevented = true; // your handler code } }} @@ -290,9 +290,9 @@ If you would like to prevent the default key handler behavior, you can set the e ### autocomplete/autofill -Die Browser haben Heuristiken, um den Benutzern zu helfen, die Formulareingaben auszufüllen. Es kann jedoch die UX der Komponente negativ beeinflussen. +Browsers have heuristics to help the user fill in form inputs. However, this can harm the UX of the component. -By default, the component disables the **autocomplete** feature (remembering what the user has typed for a given field in a previous session) with the `autoComplete="off"` attribute. Google Chrome does not currently support this attribute setting ([Issue 587466](https://bugs.chromium.org/p/chromium/issues/detail?id=587466)). A possible workaround is to remove the `id` to have the component generate a random one. +By default, the component disables the input **autocomplete** feature (remembering what the user has typed for a given field in a previous session) with the `autoComplete="off"` attribute. Google Chrome does not currently support this attribute setting ([Issue 587466](https://bugs.chromium.org/p/chromium/issues/detail?id=587466)). A possible workaround is to remove the `id` to have the component generate a random one. In addition to remembering past entered values, the browser might also propose **autofill** suggestions (saved login, address, or payment details). Falls Sie die automatische Füllung vermeiden möchten, können Sie Folgendes versuchen: diff --git a/docs/src/pages/components/autocomplete/autocomplete-es.md b/docs/src/pages/components/autocomplete/autocomplete-es.md index f993d806cafc91..bd7b530fafda1f 100644 --- a/docs/src/pages/components/autocomplete/autocomplete-es.md +++ b/docs/src/pages/components/autocomplete/autocomplete-es.md @@ -290,9 +290,9 @@ If you would like to prevent the default key handler behavior, you can set the e ### autocompletar/autorellenar -Los navegadores tienen heurísticos para ayudar a los usuarios a rellenar el formulario. Sin embargo, puede dañar la experiencia de usuario del componente. +Browsers have heuristics to help the user fill in form inputs. However, this can harm the UX of the component. -By default, the component disables the **autocomplete** feature (remembering what the user has typed for a given field in a previous session) with the `autoComplete="off"` attribute. Google Chrome does not currently support this attribute setting ([Issue 587466](https://bugs.chromium.org/p/chromium/issues/detail?id=587466)). A possible workaround is to remove the `id` to have the component generate a random one. +By default, the component disables the input **autocomplete** feature (remembering what the user has typed for a given field in a previous session) with the `autoComplete="off"` attribute. Google Chrome does not currently support this attribute setting ([Issue 587466](https://bugs.chromium.org/p/chromium/issues/detail?id=587466)). A possible workaround is to remove the `id` to have the component generate a random one. In addition to remembering past entered values, the browser might also propose **autofill** suggestions (saved login, address, or payment details). En el caso de que desees evitar el autorellenar, puedes intentar lo siguiente: diff --git a/docs/src/pages/components/autocomplete/autocomplete-fr.md b/docs/src/pages/components/autocomplete/autocomplete-fr.md index 87e4a75d4056c8..bd5aee1e482962 100644 --- a/docs/src/pages/components/autocomplete/autocomplete-fr.md +++ b/docs/src/pages/components/autocomplete/autocomplete-fr.md @@ -1,5 +1,5 @@ --- -title: React Autocomplete component +title: Composant React Autocomplétion components: TextField, Popper, Autocomplete githubLabel: 'component: Autocomplete' waiAria: 'https://www.w3.org/TR/wai-aria-practices/#combobox' @@ -24,9 +24,9 @@ La valeur doit être choisie à partir d'un ensemble prédéfini de valeurs auto {{"demo": "pages/components/autocomplete/ComboBox.js"}} -### Options structure +### Structure des options -By default, the component accepts the following options structures: +Par défaut, le composant accepte les structures d'options suivantes : ```ts const filterOptions = createFilterOptions({ @@ -37,7 +37,7 @@ const filterOptions = createFilterOptions({ ``` -par exemple: +Par exemple : ```js const options = [ @@ -48,7 +48,7 @@ const options = [ const options = ['The Godfather', 'Pulp Fiction']; ``` -However, you can use different structures by providing a `getOptionLabel` prop. +Cependant, vous pouvez utiliser différentes structures en fournissant une propriété `getOptionLabel`. ### Playground @@ -79,7 +79,7 @@ Définissez `freeSolo` à true pour que le textbox puisse contenir n'importe que ### Search input -La prop est conçue pour couvrir le cas d'utilisation principal d'une **search input** avec des suggestions, par exemple la recherche Google ou le react-autowhatever. +La propriété est conçue pour couvrir le cas d'utilisation principal d'une **entrée de recherche** avec des suggestions, par exemple la recherche Google ou le react-autowhatever. {{"demo": "pages/components/autocomplete/FreeSolo.js"}} @@ -100,7 +100,7 @@ Vous pouvez également afficher une boîte de dialogue lorsque l'utilisateur sou ## Groupé -You can group the options with the `groupBy` prop. If you do so, make sure that the options are also sorted with the same dimension that they are grouped by, otherwise you will notice duplicate headers. +Vous pouvez regrouper les options avec la propriété `groupBy`. Si vous le faites, assurez-vous que les options sont également triées avec la même dimension que celle par laquelle elles sont regroupées. Sinon vous remarquerez des en-têtes en double. {{"demo": "pages/components/autocomplete/Grouped.js"}} @@ -124,26 +124,26 @@ import useAutocomplete from '@material-ui/core/useAutocomplete'; {{"demo": "pages/components/autocomplete/CustomizedHook.js"}} -Head to the [Customized Autocomplete](#customized-autocomplete) section for a customization example with the `Autocomplete` component instead of the hook. +Rendez-vous à la [section de personnalisation](#customization) pour un exemple avec le composant `Auto-complétion` au lieu du crochet. ## Demandes asynchrones -The component supports two different asynchronous use-cases: +Le composant supporte deux cas d'utilisation asynchrones différents : -- [Load on open](#load-on-open): it waits for the component to be interacted with to load the options. -- [Search as you type](#search-as-you-type): a new request is made for each keystroke. +- [Charge à l'ouverture](#load-on-open) : cela attend le composant avec lequel il doit interagir pour charger les options. +- [Recherche au fur et à mesure](#search-as-you-type) : une nouvelle requête est faite pour chaque changement. -### Load on open +### Charger à l'ouverture -It displays a progress state as long as the network request is pending. +Cela affiche un état de progression tant que la requête réseau est en attente. {{"demo": "pages/components/autocomplete/Asynchronous.js"}} -### Search as you type +### Rechercher au fur et à mesure -If your logic is fetching new options on each keystroke and using the current value of the textbox to filter on the server, you may want to consider throttling requests. +Si votre logique consiste à récupérer de nouvelles options à chaque frappe et à utiliser la valeur actuelle de la zone de texte pour filtrer sur le serveur, vous pouvez envisager de limiter les requêtes. -Additionally, you will need to disable the built-in filtering of the `Autocomplete` component by overriding the `filterOptions` prop: +De plus, vous devrez désactiver le filtrage intégré du composant `Auto-complétion` en écrasant les propriétés `filterOptions` : ```jsx import matchSorter from 'match-sorter'; @@ -231,7 +231,7 @@ import { createFilterOptions } from '@material-ui/core/Autocomplete'; - `config.ignoreAccents` (*Boolean* [optional]): Defaults to `true`. Supprimer les diacritiques. - `config.ignoreCase` (*Boolean* [optional]): Defaults to `true`. Tout en minuscule. - `config.limit` (*Number* [optional]): Default to null. Limiter le nombre d'options suggérées à afficher. Par exemple, si `config.limite` est `100`, seule les premières `100` options correspondantes sont affichées. Cela peut être utile si beaucoup d'options de correspondance et de virtualisation n'ont pas été mises en place. -- `config.matchFrom` (*'any' | 'start'* [optional]): Defaults to `'any'`. +- `config.matchFrom` (_'any' | 'start'_ [optionnel]) : Valeur par défaut à `'any'`. - `config.stringify` (*Func* [optional]): Controls how an option is converted into a string so that it can be matched against the input text fragment. - `config.trim` (*Boolean* [optional]): Valeur par défaut `false`. Supprimer les espaces suivants. @@ -270,15 +270,15 @@ Recherchez dans 10 000 options générées aléatoirement. La liste est virtuali {{"demo": "pages/components/autocomplete/Virtualize.js"}} -## Events +## Évènements -If you would like to prevent the default key handler behavior, you can set the event's `defaultMuiPrevented` property to `true`: +Si vous souhaitez empêcher le comportement du gestionnaire de clés par défaut, vous pouvez définir la propriété `defaultMuiPrevented` de l'événement à `true` : ```jsx { if (event.key === 'Enter') { - // Prevent's default 'Enter' behavior. + // Empêche le comportement par défaut 'Enter'. event.defaultMuiPrevented = false; // your handler code } @@ -290,14 +290,14 @@ If you would like to prevent the default key handler behavior, you can set the e ### autocomplete/autofill -Les navigateurs ont des heuristiques pour aider les utilisateurs à remplir les entrées de formulaire. Cependant, cela peut nuire à l'UX du composant. +Browsers have heuristics to help the user fill in form inputs. However, this can harm the UX of the component. -By default, the component disables the **autocomplete** feature (remembering what the user has typed for a given field in a previous session) with the `autoComplete="off"` attribute. Google Chrome does not currently support this attribute setting ([Issue 587466](https://bugs.chromium.org/p/chromium/issues/detail?id=587466)). A possible workaround is to remove the `id` to have the component generate a random one. +By default, the component disables the input **autocomplete** feature (remembering what the user has typed for a given field in a previous session) with the `autoComplete="off"` attribute. Google Chrome ne prend actuellement pas en charge ce paramètre d'attribut ([Problème 587466](https://bugs.chromium.org/p/chromium/issues/detail?id=587466)). Une solution possible consiste à supprimer l'`id` pour que le composant génère un code aléatoire. -In addition to remembering past entered values, the browser might also propose **autofill** suggestions (saved login, address, or payment details). Dans le cas où vous voulez le remplissage automatique, vous pouvez essayer ce qui suit : +En plus de se souvenir des valeurs entrées précédemment, le navigateur peut également proposer des suggestions de **saisie automatique** (connexion, adresse ou détails de paiement enregistrés). Dans le cas où vous voulez le remplissage automatique, vous pouvez essayer ce qui suit : - Nommez l'input sans fuir les informations que le navigateur peut utiliser. par exemple `id="field1"` au lieu de `id="country"`. Si vous laissez l'id vide, le composant utilise un id aléatoire. -- Set `autoComplete="new-password"` (some browsers will suggest a strong password for inputs with this attribute setting): +- Définissez `autoComplete="new-password"` (certains navigateurs suggèrent un mot de passe fort pour les entrées avec ce paramètre d'attribut) : ```jsx ``` -Read [the guide on MDN](https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion) for more details. +Lisez le [guide sur MDN](https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion) pour plus de détails. ### voiceOver iOS diff --git a/docs/src/pages/components/autocomplete/autocomplete-ja.md b/docs/src/pages/components/autocomplete/autocomplete-ja.md index 22969bc96eb44f..81ea9e8817083e 100644 --- a/docs/src/pages/components/autocomplete/autocomplete-ja.md +++ b/docs/src/pages/components/autocomplete/autocomplete-ja.md @@ -1,5 +1,5 @@ --- -title: React Autocomplete component +title: React 入力補完 コンポーネント components: TextField, Popper, Autocomplete githubLabel: 'component: Autocomplete' waiAria: 'https://www.w3.org/TR/wai-aria-practices/#combobox' @@ -11,7 +11,7 @@ waiAria: 'https://www.w3.org/TR/wai-aria-practices/#combobox' ウィジェットは、単一行テキストボックスの値を設定する際に以下の2通りの状況で役に立ちます。 -1. テキストボックスの値が、予め決められた許容値の中から選ばないといけない場合。 例えば、位置の欄は [combo box](#combo-box)の中から選ばないといけない。 +1. テキストボックスの値が、予め決められた許容値の中から選ばないといけない場合。 例えば、位置の欄は [combo box](#combo-box)の中から選ばなければなりません。 2. テキストボックスが任意の値を含む可能性があるが、ユーザーに可能性のある値の提案をすることが有効な場合。例えば、検索欄で近い、又は、以前の検索結果を示してユーザーの時間を節約する。[free solo](#free-solo). "react-select"と"downshift"というパッケージの改良版であることを意識しています。 @@ -24,9 +24,9 @@ waiAria: 'https://www.w3.org/TR/wai-aria-practices/#combobox' {{"demo": "pages/components/autocomplete/ComboBox.js"}} -### Options structure +### オプション -By default, the component accepts the following options structures: +デフォルトでは、以下のオプションが設定可能です。 ```ts const filterOptions = createFilterOptions({ @@ -48,11 +48,11 @@ const options = [ const options = ['The Godfather', 'Pulp Fiction']; ``` -However, you can use different structures by providing a `getOptionLabel` prop. +ただし、 `getOptionLabel` プロパティを使用することで、異なる構造を使用することができます。 ### Playground -以下の各例は、Autocompleteコンポーネントの各機能を示しています。 +Each of the following examples demonstrates one feature of the Autocomplete component. {{"demo": "pages/components/autocomplete/Playground.js"}} @@ -62,14 +62,14 @@ However, you can use different structures by providing a `getOptionLabel` prop. {{"demo": "pages/components/autocomplete/CountrySelect.js"}} -### Controllable states +### Controlled states コンポーネントは、操作できる二つのステートを持ちます。 -1. "value"ステートは `value`/`onChange` を組み合わせて使用します。 "value"ステートは `value`/`onChange` を組み合わせて使用します。 この値は、ユーザーが選択した値を示します。例えば、Enterを押している状態。 "value"ステートは `value`/`onChange` を組み合わせて使用します。 この値は、ユーザーが選択した値を示します。例えば、Enterを押している状態。 +1. "value"ステートは `value`/`onChange` を組み合わせて使用します。 ユーザーがEnterキーを押している場合、この値はEnterになります。 2. "input value"ステートは`inputValue`/`onInputChange` を組み合わせて使用します。 この値は、テキストボックスに表示される値を示します。 この値は、テキストボックスに表示される値を示します。 この値は、テキストボックスに表示される値を示します。 この値は、テキストボックスに表示される値を示します。 -> 二つのステートは解離しており、独立して管理される必要があります。 +> ⚠️ These two states are isolated, they should be controlled independently. {{"demo": "pages/components/autocomplete/ControllableStates.js"}} @@ -79,7 +79,7 @@ However, you can use different structures by providing a `getOptionLabel` prop. ### Search input -提案付きの**検索欄**に使われることを主な使われ方として設計されています。 例えば、Google searchやreact-autowhatever +Google searchやreact-autowhateverなどの検索候補が表示されるような**検索ボックス**に使われることを想定して設計されています。 {{"demo": "pages/components/autocomplete/FreeSolo.js"}} @@ -89,7 +89,7 @@ However, you can use different structures by providing a `getOptionLabel` prop. - `selectOnFocus`でユーザーが選択した値を消せるようにする。 - `clearOnBlur` でユーザーが新しい値を入力できるようにする。 -- `handleHomeEndKeys`でポップアップな内でHome and Endキーを使ってフォーカスが移動できるようにする。 +- `handleHomeEndKeys`を使えば、ポップアップ内でHomeキーやEndキーを使ってフォーカスが移動できるようになります。 - 最後の選択肢に, 例えば`Add "YOUR SEARCH"`を追加する。 {{"demo": "pages/components/autocomplete/FreeSoloCreateOption.js"}} @@ -100,7 +100,7 @@ However, you can use different structures by providing a `getOptionLabel` prop. ## Grouped -You can group the options with the `groupBy` prop. If you do so, make sure that the options are also sorted with the same dimension that they are grouped by, otherwise you will notice duplicate headers. +`groupBy` プロパティを使えば、選択肢をグループ化できます。 これを使う場合、グループ化される選択肢は同じ順序でソートされたものにしてください。そうしないと、ヘッダーが重複してしまいます。 {{"demo": "pages/components/autocomplete/Grouped.js"}} @@ -110,13 +110,13 @@ You can group the options with the `groupBy` prop. If you do so, make sure that ## `useAutocomplete` -For advanced customization use cases, we expose a headless `useAutocomplete()` hook. JSXのレンダリングに関連する値以外は、Autocompleteコンポーネントとほぼ同じ値をとります。 Autocompleteコンポーネントは内部でこのhookを使用しています。 Autocompleteコンポーネントは内部でこのhookを使用しています。 Autocompleteコンポーネントは内部でこのhookを使用しています。 +For advanced customization use cases, a headless `useAutocomplete()` hook is exposed. JSXのレンダリングに関連する値以外は、Autocompleteコンポーネントとほぼ同じ値をとります。 Autocompleteコンポーネントは内部でこのhookを使用しています。 Autocompleteコンポーネントは内部でこのhookを使用しています。 The Autocomplete component is built on this hook. ```jsx import useAutocomplete from '@material-ui/core/useAutocomplete'; ``` -- [4.5 kB gzipped](/size-snapshot). +- 📦 [4.5 kB gzipped](/size-snapshot). {{"demo": "pages/components/autocomplete/UseAutocomplete.js", "defaultCodeOpen": false}} @@ -126,24 +126,24 @@ import useAutocomplete from '@material-ui/core/useAutocomplete'; Head to the [Customized Autocomplete](#customized-autocomplete) section for a customization example with the `Autocomplete` component instead of the hook. -## Asynchronous requests +## 非同期リクエスト -The component supports two different asynchronous use-cases: +2つの異なる非同期のユースケースをサポートしています: -- [Load on open](#load-on-open): it waits for the component to be interacted with to load the options. -- [Search as you type](#search-as-you-type): a new request is made for each keystroke. +- [開いてロード](#load-on-open): 選択肢をロードするのにコンポーネントが操作されるのを待ちます。 +- [入力して検索](#search-as-you-type): キーストロークごとに新しいリクエストが行われます。 -### Load on open +### 開いてロード -It displays a progress state as long as the network request is pending. +ネットワークリクエストがペンディング中であるとき、進行状況を表示します。 {{"demo": "pages/components/autocomplete/Asynchronous.js"}} -### Search as you type +### 入力して検索 -If your logic is fetching new options on each keystroke and using the current value of the textbox to filter on the server, you may want to consider throttling requests. +キーストロークごとに新しい選択肢をフェッチし、現在のテキストボックスの値を使用してサーバー上でフィルタリングする場合、リクエストの抑制をしたいかもしれません。 -Additionally, you will need to disable the built-in filtering of the `Autocomplete` component by overriding the `filterOptions` prop: +さらに、 `filterOptions` プロパティを 上書きすることで、 `Autocomplete` コンポーネントの組み込みフィルタリングを無効にする必要があります。 ```jsx import matchSorter from 'match-sorter'; @@ -166,7 +166,7 @@ Google マップの位置の自動保管用のカスタムUI ## Multiple values -タグとも言える。ユーザーは一つ以上の値を選択することができます。 +タグとも呼ばれ、ユーザーは複数の値を入力することができます。 {{"demo": "pages/components/autocomplete/Tags.js"}} @@ -188,7 +188,7 @@ Google マップの位置の自動保管用のカスタムUI ## サイズ -Fancy smaller inputs? `size`propを使用します。 +小さい入力欄が好きですか? `size`propを使用します。 {{"demo": "pages/components/autocomplete/Sizes.js"}} @@ -196,7 +196,7 @@ Fancy smaller inputs? `size`propを使用します。 ### Custom input -`renderInput`でレンダリングされる入力をカスタマイズできます。 このrender propsの一つ目の引数は、継承する必要のあるpropsを含みます。 `ref` と `inputProps` の扱いに特に注意してください。 このrender propsの一つ目の引数は、継承する必要のあるpropsを含みます。 `ref` と `inputProps` の扱いに特に注意してください。 +`renderInput`でレンダリングされる入力をカスタマイズできます。 このrender propsの一つ目の引数は、継承する必要のあるpropsを含みます。 `ref` と `inputProps` の扱いに特に注意してください。 {{"demo": "pages/components/autocomplete/CustomInputAutocomplete.js"}} @@ -210,13 +210,13 @@ GitHubのラベルピッカーを再現したデモです。 ## Highlights -以下のデモはこちらに依存します。[autosuggest-highlight](https://github.com/moroshko/autosuggest-highlight), 提案されたテキストや自動保管コンポーネントをハイライトする小さいサイズの(1 kB)ユーティリティ +以下のデモは[autosuggest-highlight](https://github.com/moroshko/autosuggest-highlight)に依存しています。提案されたテキストや自動保管コンポーネントをハイライトする小さいサイズの(1 kB)ユーティリティ {{"demo": "pages/components/autocomplete/Highlights.js"}} ## Custom filter -`filterOptions`に流せるフィルターメソッドを作成できるファクトリーを露出しているコンポーネント デフォルトのフィルター挙動を変更するのに使うことができます。 デフォルトのフィルター挙動を変更するのに使うことができます。 デフォルトのフィルター挙動を変更するのに使うことができます。 デフォルトのフィルター挙動を変更するのに使うことができます。 +コンポーネントは `filterOptions` プロパティに提供できるフィルタメソッドを作成するためのファクトリを公開しています。 デフォルトのフィルター挙動を変更するのに使うことができます。 ```js import { createFilterOptions } from '@material-ui/core/Autocomplete'; @@ -226,14 +226,14 @@ import { createFilterOptions } from '@material-ui/core/Autocomplete'; #### 引数 -1. `config` (*Object* [optional]): +1. `config` (_object_ [optional]): -- `config.ignoreAccents` (*Boolean* [optional]): Defaults to `true`. 発音記号を削除する -- `config.ignoreCase` (*Boolean* [optional]): Defaults to `true`. すべて小文字にする。 -- `config.limit` (*Number* [optional]): Default to null. 表示される推奨オプションの数を制限する。 例えば、 `config.limit` が `100`の時、頭の`100`個のマッチングオプションのみが表示されます。 バーチャライズせずに、大量の選択肢を扱うのに有効です。 +- `config.ignoreAccents` (_bool_ [optional]): Defaults to `true`. 発音記号を削除する +- `config.ignoreCase` (_bool_ [optional]): Defaults to `true`. すべて小文字にする。 +- `config.limit` (*number* [optional]): Default to null. 表示される推奨オプションの数を制限する。 例えば、 `config.limit` が `100`の時、頭の`100`個のマッチングオプションのみが表示されます。 バーチャライズせずに、大量の選択肢を扱うのに有効です。 - `config.matchFrom` (*'any' | 'start'* [optional]): Defaults to `'any'`. -- `config.stringify` (*Func* [optional]): Controls how an option is converted into a string so that it can be matched against the input text fragment. -- `config.trim` (*Boolean* [optional]): Defaults `false`. 末尾のスペースを削除します。 +- `config.stringify` (*func* [optional]): Controls how an option is converted into a string so that it can be matched against the input text fragment. +- `config.trim` (_bool_ [optional]): Defaults to `false`. 末尾のスペースを削除します。 #### 戻り値 @@ -254,7 +254,7 @@ const filterOptions = createFilterOptions({ ### 高度な機能(Advanced) -fuzzy matchingのような高度なメカニズの為には [match-sorter](https://github.com/kentcdodds/match-sorter)を見ることをおすすめします。 例えば: 例えば: 例えば: 例えば: +Fuzzy matchingのような高度なメカニズムについては [match-sorter](https://github.com/kentcdodds/match-sorter) を見ることをおすすめします。 例えば: ```jsx import matchSorter from 'match-sorter'; @@ -266,20 +266,20 @@ const filterOptions = (options, { inputValue }) => matchSorter(options, inputVal ## Virtualization -10,000のランダム生成された選択肢内で検索します。 10,000のランダム生成された選択肢内で検索します。 10,000のランダム生成された選択肢内で検索します。 [react-window](https://github.com/bvaughn/react-window)でリストをバーチャライズしています。 10,000のランダム生成された選択肢内で検索します。 10,000のランダム生成された選択肢内で検索します。 [react-window](https://github.com/bvaughn/react-window)でリストをバーチャライズしています。 +10,000のランダム生成された選択肢内で検索します。 リストは [react-window](https://github.com/bvaughn/react-window) によって仮想化されています。 {{"demo": "pages/components/autocomplete/Virtualize.js"}} -## Events +## イベント -If you would like to prevent the default key handler behavior, you can set the event's `defaultMuiPrevented` property to `true`: +デフォルトのキーハンドラの動作を防止したい場合は、イベントの `defaultMuiPrevented` プロパティを `true` に設定します。 ```jsx { if (event.key === 'Enter') { - // Prevent's default 'Enter' behavior. - event.defaultMuiPrevented = false; + // 'Enter' のデフォルトの動作を防止する。 + event.defaultMuiPrevented = true; // your handler code } }} @@ -290,14 +290,14 @@ If you would like to prevent the default key handler behavior, you can set the e ### autocomplete/autofill -ブラウザは入力補助のために経験則を持っています。 しかし、これはコンポーネントのUXを損なう可能性があります。 +Browsers have heuristics to help the user fill in form inputs. However, this can harm the UX of the component. -By default, the component disables the **autocomplete** feature (remembering what the user has typed for a given field in a previous session) with the `autoComplete="off"` attribute. Google Chrome does not currently support this attribute setting ([Issue 587466](https://bugs.chromium.org/p/chromium/issues/detail?id=587466)). A possible workaround is to remove the `id` to have the component generate a random one. +By default, the component disables the input **autocomplete** feature (remembering what the user has typed for a given field in a previous session) with the `autoComplete="off"` attribute. Google Chromeは現在、この属性設定をサポートしていません ([Issue 587466](https://bugs.chromium.org/p/chromium/issues/detail?id=587466)). 可能な回避策は、コンポーネントにランダムなものを生成させるために `id` を削除することです。 -In addition to remembering past entered values, the browser might also propose **autofill** suggestions (saved login, address, or payment details). autofillを避けたい場合、以下の方法を取れます。 +入力された過去の値を記憶することに加えて、ブラウザは **autofill** (保存されたログイン、アドレス、または支払いの詳細) をサジェストするかもしれません。 autofillを避けたい場合、以下の方法を取れます。 -- ブラウザが判断できない命名を入力欄に使う。 ブラウザが判断できない命名を入力欄に使う。 例: `id="country"`の代わりに、`id="field1"`を使う idを空にした場合、コンポーネントはランダムなidを保管します。 idを空にした場合、コンポーネントはランダムなidを保管します。 -- Set `autoComplete="new-password"` (some browsers will suggest a strong password for inputs with this attribute setting): +- ブラウザが判断できない命名を入力欄に使う。 例: `id="country"`の代わりに、`id="field1"`を使う idを空にした場合、コンポーネントはランダムなidを保管します。 +- `autoComplete="new-password"` に設定する。 (一部のブラウザはこの属性設定使うと入力用の強力なパスワードを提案します): ```jsx ``` -Read [the guide on MDN](https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion) for more details. +詳細は [MDNのガイド](https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion) を参照してください。 ### iOS VoiceOver @@ -323,4 +323,4 @@ iOS Safariのボイスオーバーは`aria-owns` を十分にサポートして (WAI-ARIA: https://www.w3.org/TR/wai-aria-practices/#combobox) -テキストボックスに対して、ラベルの使用を奨励しています。 コンポーネントは WAI-ARIA オーサリングを実装しています。 コンポーネントは WAI-ARIA オーサリングを実装しています。 +テキストボックスに対して、ラベルの使用を奨励しています。 コンポーネントは WAI-ARIA オーサリングを実装しています。 diff --git a/docs/src/pages/components/autocomplete/autocomplete-pt.md b/docs/src/pages/components/autocomplete/autocomplete-pt.md index a6fb9223bdb947..de213a4f3ff819 100644 --- a/docs/src/pages/components/autocomplete/autocomplete-pt.md +++ b/docs/src/pages/components/autocomplete/autocomplete-pt.md @@ -51,7 +51,7 @@ No entanto, você pode usar estruturas diferentes fornecendo um prop `getOptionL ### Área de exemplos -Cada um dos exemplos a seguir demonstra uma funcionalidade do componente Autocomplete. +Each of the following examples demonstrates one feature of the Autocomplete component. {{"demo": "pages/components/autocomplete/Playground.js"}} @@ -61,14 +61,14 @@ Escolha um dos 248 países. {{"demo": "pages/components/autocomplete/CountrySelect.js"}} -### Estados controláveis +### Controlled states O componente tem dois estados que podem ser controlados: 1. o estado "value" com a combinação das propriedades `value`/`onChange`. Esse estado representa o valor selecionado pelo usuário, por exemplo, quando pressionando Enter. 2. o estado "input value" com a combinação das propriedades `inputValue`/`onInputChange`. Esse estado representa o valor exibido na caixa de texto. -> ⚠️ Esses dois estados estão isolados, eles podem ser controlados de forma independente. +> ⚠️ These two states are isolated, they should be controlled independently. {{"demo": "pages/components/autocomplete/ControllableStates.js"}} @@ -109,7 +109,7 @@ Você pode agrupar as opções com o prop `groupBy`. Se você fizer isso, certif ## `useAutocomplete` -Para casos de customização avançada, nós expomos o hook `useAutocomplete()`. Ele aceita quase as mesmas opções do componente autocompletar exceto todas as propriedades relacionadas a renderização do JSX. O componente autocompletar usa esse hook internamente. +For advanced customization use cases, a headless `useAutocomplete()` hook is exposed. Ele aceita quase as mesmas opções do componente autocompletar exceto todas as propriedades relacionadas a renderização do JSX. The Autocomplete component is built on this hook. ```jsx import useAutocomplete from '@material-ui/core/useAutocomplete'; @@ -220,14 +220,14 @@ import { createFilterOptions } from '@material-ui/core/Autocomplete'; #### Argumentos -1. `config` (_Object_ [opcional]): +1. `config` (_object_ [optional]): -- `config.ignoreAccents` (_Boolean_ [opcional]): Padrão `true`. Remover sinais diacríticos. -- `config.ignoreCase` (_Boolean_ [opcional]): Padrão `true`. Minúsculas em tudo. -- `config.limit` (_Number_ [opcional]): Padrão null. Limitar o número de opções sugeridas a serem exibidas. Por exemplo, se `config.limit` é `100`, somente as primeiras `100` opções correspondentes são exibidas. Isto pode ser útil se um monte corresponderem e a virtualização não estiver configurada. +- `config.ignoreAccents` (_bool_ [optional]): Defaults to `true`. Remover sinais diacríticos. +- `config.ignoreCase` (_bool_ [optional]): Defaults to `true`. Minúsculas em tudo. +- `config.limit` (*number* [opcional]): Padrão null. Limitar o número de opções sugeridas a serem exibidas. Por exemplo, se `config.limit` é `100`, somente as primeiras `100` opções correspondentes são exibidas. Isto pode ser útil se um monte corresponderem e a virtualização não estiver configurada. - `config.matchFrom` (_'any' | 'start'_ [opcional]): Padrão `'any'`. -- `config.stringify` (_Func_ [opcional]): Controla a forma como a opção é convertida para texto para poder ser comparada com qualquer fragmento de texto de entrada. -- `config.trim` (_Boolean_ [opcional]): Padrão `false`. Remover espaços ao fim. +- `config.stringify` (*func* [opcional]): Controla a forma como a opção é convertida em texto, dessa forma pode ser comparada com qualquer fragmento de texto. +- `config.trim` (_bool_ [optional]): Defaults to `false`. Remover espaços ao fim. #### Retornos @@ -273,8 +273,8 @@ Se você deseja evitar o comportamento padrão do teclado, você pode definir a onKeyDown={(event) => { if (event.key === 'Enter') { // Previne o comportamento padrão do 'Enter'. - event.defaultMuiPrevented = false; - // seu código manipulador + event.defaultMuiPrevented = true; + // your handler code } }} /> @@ -284,9 +284,9 @@ Se você deseja evitar o comportamento padrão do teclado, você pode definir a ### autocomplete/autofill -Os navegadores têm heurística para ajudar os usuários a preencherem os campos do formulário. No entanto, isso pode prejudicar a experiência do usuário com o componente. +Browsers have heuristics to help the user fill in form inputs. However, this can harm the UX of the component. -Por padrão, o componente desabilita o recurso de **autocomplete** (recurso que memoriza informações que o usuário forneceu em sessões anteriores) com o atributo `autoComplete="off"`. Atualmente, o Google Chrome não suporta essa configuração de atributo ([Issue 587466](https://bugs.chromium.org/p/chromium/issues/detail?id=587466)). Uma solução alternativa possível é remover o `id` para que o componente gere um aleatório. +By default, the component disables the input **autocomplete** feature (remembering what the user has typed for a given field in a previous session) with the `autoComplete="off"` attribute. Atualmente, o Google Chrome não suporta essa configuração de atributo ([Issue 587466](https://bugs.chromium.org/p/chromium/issues/detail?id=587466)). Uma solução alternativa possível é remover o `id` para que o componente gere um aleatório. No entanto, além de relembrar valores fornecidos anteriormente, o navegador também pode propor sugestões de **autofill** (preenchimento automático para informações de login, endereço ou detalhes de pagamento). No caso de você querer evitar o recurso de preenchimento automático, tente o seguinte: diff --git a/docs/src/pages/components/autocomplete/autocomplete-ru.md b/docs/src/pages/components/autocomplete/autocomplete-ru.md index 9629fe603a09dc..8138db53d27f85 100644 --- a/docs/src/pages/components/autocomplete/autocomplete-ru.md +++ b/docs/src/pages/components/autocomplete/autocomplete-ru.md @@ -26,7 +26,7 @@ It's meant to be an improved version of the "react-select" and "downshift" packa ### Песочница -By default, the component accepts the following options structures: +По умолчанию, компонент принимает следующую структуру параметров: ```ts const filterOptions = createFilterOptions({ @@ -37,7 +37,7 @@ const filterOptions = createFilterOptions({ ``` -например: +Например: ```js const options = [ @@ -48,28 +48,28 @@ const options = [ const options = ['The Godfather', 'Pulp Fiction']; ``` -However, you can use different structures by providing a `getOptionLabel` prop. +Но, можно использовать разные структуры, добавив `getOptionLabel`. ### Песочница -Каждый из следующих примеров демонстрирует одну функцию компонента автозаполнения. +Each of the following examples demonstrates one feature of the Autocomplete component. {{"demo": "pages/components/autocomplete/Playground.js"}} ### Выбор страны -Choose one of the 248 countries. +Выберите одну из 248 стран. {{"demo": "pages/components/autocomplete/CountrySelect.js"}} -### Controllable states +### Controlled states The component has two states that can be controlled: -1. the "value" state with the `value`/`onChange` props combination. This state represents the value selected by the user, for instance when pressing Enter. +1. the "value" state with the `value`/`onChange` props combination. Это состояние показывает значение, выбранное пользователем, для instance объекта при нажатии Enter. 2. the "input value" state with the `inputValue`/`onInputChange` props combination. This state represents the value displayed in the textbox. -> ⚠️ These two state are isolated, they should be controlled independently. +> ⚠️ These two states are isolated, they should be controlled independently. {{"demo": "pages/components/autocomplete/ControllableStates.js"}} @@ -89,7 +89,7 @@ If you intend to use this mode for a [combo box](#combo-box) like experience (an - `selectOnFocus` to helps the user clear the selected value. - `clearOnBlur` to helps the user to enter a new value. -- `handleHomeEndKeys` to move focus inside the popup with the Home and End keys. +- `handleHomeEndKeys` , чтобы переместить фокус внутри всплывающего окна с помощью клавиш Home и End. - A last option, for instance `Add "YOUR SEARCH"`. {{"demo": "pages/components/autocomplete/FreeSoloCreateOption.js"}} @@ -100,7 +100,7 @@ If you intend to use this mode for a [combo box](#combo-box) like experience (an ## Сгруппированные -You can group the options with the `groupBy` prop. If you do so, make sure that the options are also sorted with the same dimension that they are grouped by, otherwise you will notice duplicate headers. +Вы можете сгруппировать параметры с помощью `groupBy`. Если вы это сделаете, убедитесь, что параметры также сортируются с одинаковым размером, который они сгруппированы, в противном случае будут повторяющиеся заголовки. {{"demo": "pages/components/autocomplete/Grouped.js"}} @@ -110,7 +110,7 @@ You can group the options with the `groupBy` prop. If you do so, make sure that ## `useAutocomplete` -For advanced customization use cases, we expose a headless `useAutocomplete()` hook. It accepts almost the same options as the Autocomplete component minus all the props related to the rendering of JSX. The Autocomplete component uses this hook internally. +For advanced customization use cases, a headless `useAutocomplete()` hook is exposed. It accepts almost the same options as the Autocomplete component minus all the props related to the rendering of JSX. The Autocomplete component is built on this hook. ```jsx import useAutocomplete from '@material-ui/core/useAutocomplete'; @@ -128,18 +128,18 @@ Head to the [Customized Autocomplete](#customized-autocomplete) section for a cu ## Асинхронные запросы -The component supports two different asynchronous use-cases: +Компонент поддерживает два асинхронных варианта использования: - [Load on open](#load-on-open): it waits for the component to be interacted with to load the options. - [Search as you type](#search-as-you-type): a new request is made for each keystroke. -### Load on open +### Загрузить на открытие -It displays a progress state as long as the network request is pending. +Он отображает состояние прогресса до тех пор, пока запрос находится в ожидании (pending). {{"demo": "pages/components/autocomplete/Asynchronous.js"}} -### Search as you type +### Поиск при вводе If your logic is fetching new options on each keystroke and using the current value of the textbox to filter on the server, you may want to consider throttling requests. @@ -202,11 +202,11 @@ The `renderInput` prop allows you to customize the rendered input. The first arg ### GitHub's picker -This demo reproduces the GitHub's label picker: +Эта демо-версия показывает label picker с сайта GitHub: {{"demo": "pages/components/autocomplete/GitHubLabel.js"}} -Head to the [Customized hook](#customized-hook) section for a customization example with the `useAutocomplete` hook instead of the component. +Перейдите в секцию [Кастомизированный хук](#customized-hook) для примера кастомизации хука ` useAutocomplete` вместо компонента ## Основные моменты @@ -226,14 +226,14 @@ import { createFilterOptions } from '@material-ui/core/Autocomplete'; #### Аргументы -1. `config` (*Object* [optional]): +1. `config` (_object_ [optional]): -- `config.ignoreAccents` (*Boolean* [optional]): Defaults to `true`. Remove diacritics. -- `config.ignoreCase` (*Boolean* [optional]): Defaults to `true`. Lowercase everything. -- `config.limit` (*Number* [optional]): Default to null. Limit the number of suggested options to be shown. For example, if `config.limit` is `100`, only the first `100` matching options are shown. It can be useful if a lot of options match and virtualization wasn't set up. +- `config.ignoreAccents` (_bool_ [optional]): Defaults to `true`. Remove diacritics. +- `config.ignoreCase` (_bool_ [optional]): Defaults to `true`. Lowercase everything. +- `config.limit` (*number* [optional]): Default to null. Limit the number of suggested options to be shown. For example, if `config.limit` is `100`, only the first `100` matching options are shown. It can be useful if a lot of options match and virtualization wasn't set up. - `config.matchFrom` (*'any' | 'start'* [optional]): Defaults to `'any'`. -- `config.stringify` (*Func* [optional]): Controls how an option is converted into a string so that it can be matched against the input text fragment. -- `config.trim` (*Boolean* [optional]): По умолчанию - `false`. Remove trailing spaces. +- `config.stringify` (*func* [optional]): Controls how an option is converted into a string so that it can be matched against the input text fragment. +- `config.trim` (_bool_ [optional]): Defaults to `false`. Remove trailing spaces. #### Возвращает @@ -279,7 +279,7 @@ If you would like to prevent the default key handler behavior, you can set the e onKeyDown={(event) => { if (event.key === 'Enter') { // Prevent's default 'Enter' behavior. - event.defaultMuiPrevented = false; + event.defaultMuiPrevented = true; // your handler code } }} @@ -290,9 +290,9 @@ If you would like to prevent the default key handler behavior, you can set the e ### Автозаполнение -The browsers have heuristics to help the users fill the form inputs. However, it can harm the UX of the component. +Browsers have heuristics to help the user fill in form inputs. However, this can harm the UX of the component. -By default, the component disables the **autocomplete** feature (remembering what the user has typed for a given field in a previous session) with the `autoComplete="off"` attribute. Google Chrome does not currently support this attribute setting ([Issue 587466](https://bugs.chromium.org/p/chromium/issues/detail?id=587466)). A possible workaround is to remove the `id` to have the component generate a random one. +By default, the component disables the input **autocomplete** feature (remembering what the user has typed for a given field in a previous session) with the `autoComplete="off"` attribute. Google Chrome does not currently support this attribute setting ([Issue 587466](https://bugs.chromium.org/p/chromium/issues/detail?id=587466)). A possible workaround is to remove the `id` to have the component generate a random one. In addition to remembering past entered values, the browser might also propose **autofill** suggestions (saved login, address, or payment details). In the event you want the avoid autofill, you can try the following: diff --git a/docs/src/pages/components/autocomplete/autocomplete-zh.md b/docs/src/pages/components/autocomplete/autocomplete-zh.md index 42e350b9113996..9c00f678430dc5 100644 --- a/docs/src/pages/components/autocomplete/autocomplete-zh.md +++ b/docs/src/pages/components/autocomplete/autocomplete-zh.md @@ -51,7 +51,7 @@ const options = ['The Godfather', 'Pulp Fiction']; ### 练习 -以下每个示例演示了自动补全组件的单项功能。 +Each of the following examples demonstrates one feature of the Autocomplete component. {{"demo": "pages/components/autocomplete/Playground.js"}} @@ -61,14 +61,14 @@ const options = ['The Godfather', 'Pulp Fiction']; {{"demo": "pages/components/autocomplete/CountrySelect.js"}} -### 可控的状态 +### Controlled states 此组件有两种可控的状态: 1. “value” 状态(state)包含了 `value`/`onChange` 两种属性的组合。 这个状态表示用户选择的值,如当按下 Enter 键时。 2. “input value” 状态(state) 则包含了 `inputValue`/`onInputChange` 两种属性的组合。 这个状态展示了在文本框中显示的值。 -> ⚠️ 以上两种状态互不干涉,它们应该被单独控制着。 +> ⚠️ These two states are isolated, they should be controlled independently. {{"demo": "pages/components/autocomplete/ControllableStates.js"}} @@ -109,7 +109,7 @@ const options = ['The Godfather', 'Pulp Fiction']; ## `useAutocomplete` -对于高级定制用例,我们暴露了一个无头(headless)的 `useAutocomplete()` hook。 它接受几乎与 Autocomplete 组件相同的参数,辅以与 JSX 渲染有关的所有参数。 Autocomplete 组件内部也是使用的此 hook。 +For advanced customization use cases, a headless `useAutocomplete()` hook is exposed. 它接受几乎与 Autocomplete 组件相同的参数,辅以与 JSX 渲染有关的所有参数。 The Autocomplete component is built on this hook. ```jsx import useAutocomplete from '@material-ui/core/useAutocomplete'; @@ -220,14 +220,14 @@ import { createFilterOptions } from '@material-ui/core/Autocomplete'; #### 参数 -1. `config` (_Object_ [optional]): +1. `config` (_object_ [optional]): -- `config.ignoreAccents` (_Boolean_ [optional]):默认值为 `true`。 移除字母的变音符号。 -- `config.ignoreCase` (_Boolean_ [optional]): 默认值为 `true`。 所有字母都小写。 -- `config.limit` (_Number_ [optional]): 默认值为 null。 显示限定数量的建议选项。 例如,如果 `config.limit` 是 `100`,,那么只显示前 `100 个` 匹配的选项。 如果存在很多选项匹配,并且虚拟化设置还没建立成时,这样的限制是非常有效的。 +- `config.ignoreAccents` (_bool_ [optional]): Defaults to `true`. 移除字母的变音符号。 +- `config.ignoreCase` (_bool_ [optional]): Defaults to `true`. 所有字母都小写。 +- `config.limit` (*number* [optional]): 默认值为 null。 显示限定数量的建议选项。 例如,如果 `config.limit` 是 `100`,,那么只显示前 `100 个` 匹配的选项。 如果存在很多选项匹配,并且虚拟化设置还没建立成时,这样的限制是非常有效的。 - `config.matchFrom` (_'any' | 'start'_ [optional]): 默认值为 `'any'`。 -- `config.stringify` (_Func_ [optional]): 控制如何将一个选项转换成一个字符串,这样选项就能够和输入文本的片段相匹配。 -- `config.trim` (_Boolean_ [optional]): 默认值为 `false`。 删除尾随空格。 +- `config.stringify` (*func* [optional]): 控制如何将一个选项转换成一个字符串,这样,选项就能够和输入文本的片段相匹配。 +- `config.trim` (_bool_ [optional]): Defaults to `false`. 删除尾随空格。 #### 返回结果 @@ -273,8 +273,8 @@ const filterOptions = (options, { inputValue }) => matchSorter(options, inputVal onKeyDown={(event) => { if (event.key === 'Enter') { // 阻止默认的“Enter”行为。 - event.defaultMuiPrevented = false; - // 你的处理器代码 + event.defaultMuiPrevented = true; + // your handler code } }} /> @@ -284,9 +284,9 @@ const filterOptions = (options, { inputValue }) => matchSorter(options, inputVal ### autocomplete/autofill -浏览器会有启发性的帮助用户填写表格。 然而,这样的功能会削弱的组件用户体验。 +Browsers have heuristics to help the user fill in form inputs. However, this can harm the UX of the component. -默认情况下,组件将会使用 `autoComplete="off"` 属性来禁用 **autocomplete** 功能(记住用户在之前的会话中为某个字段输入的内容)。 Google Chrome 浏览器目前不支持此属性设置([Issue 587466](https://bugs.chromium.org/p/chromium/issues/detail?id=587466))。 要解决这个问题,可以采用的变通方法是删除 `id`,让组件自行随机生成。 +By default, the component disables the input **autocomplete** feature (remembering what the user has typed for a given field in a previous session) with the `autoComplete="off"` attribute. Google Chrome 浏览器目前不支持此属性设置([Issue 587466](https://bugs.chromium.org/p/chromium/issues/detail?id=587466))。 要解决这个问题,可以采用的变通方法是删除 `id`,让组件自行随机生成。 除了记住过去输入的值,浏览器还可能发出 **自动填写(autofill)**建议(保存的登录名、地址或支付详情)。 若您不需要自动填充,您可以尝试以下的方式: diff --git a/docs/src/pages/components/autocomplete/autocomplete.md b/docs/src/pages/components/autocomplete/autocomplete.md index 841dbe86aa9765..1d56730eb23d6b 100644 --- a/docs/src/pages/components/autocomplete/autocomplete.md +++ b/docs/src/pages/components/autocomplete/autocomplete.md @@ -294,10 +294,10 @@ If you would like to prevent the default key handler behavior, you can set the e ### autocomplete/autofill -The browsers have heuristics to help the users fill the form inputs. -However, it can harm the UX of the component. +Browsers have heuristics to help the user fill in form inputs. +However, this can harm the UX of the component. -By default, the component disables the **autocomplete** feature (remembering what the user has typed for a given field in a previous session) with the `autoComplete="off"` attribute. +By default, the component disables the input **autocomplete** feature (remembering what the user has typed for a given field in a previous session) with the `autoComplete="off"` attribute. Google Chrome does not currently support this attribute setting ([Issue 587466](https://bugs.chromium.org/p/chromium/issues/detail?id=587466)). A possible workaround is to remove the `id` to have the component generate a random one. diff --git a/docs/src/pages/components/avatars/avatars-de.md b/docs/src/pages/components/avatars/avatars-de.md index 6b47702f8befa1..4bfbc5034bf427 100644 --- a/docs/src/pages/components/avatars/avatars-de.md +++ b/docs/src/pages/components/avatars/avatars-de.md @@ -22,6 +22,10 @@ Avatars containing simple characters can be created by passing a string as `chil {{"demo": "pages/components/avatars/LetterAvatars.js"}} +You can use different background colors for the avatar. The following demo generates the color based on the name of the person. + +{{"demo": "pages/components/avatars/BackgroundLetterAvatars.js"}} + ## Größen Die Größe des Avatars kann mit den `height`- und `width`-CSS-Eigenschaften verändert werden. diff --git a/docs/src/pages/components/avatars/avatars-es.md b/docs/src/pages/components/avatars/avatars-es.md index cc99974734b190..079c93c7802cdc 100644 --- a/docs/src/pages/components/avatars/avatars-es.md +++ b/docs/src/pages/components/avatars/avatars-es.md @@ -1,5 +1,5 @@ --- -title: React Avatar component +title: Componente de Avatar de React components: Avatar, AvatarGroup, Badge githubLabel: 'component: Avatar' --- @@ -22,6 +22,10 @@ Los avatares que contengan carácteres simples pueden ser creados pasándoles un {{"demo": "pages/components/avatars/LetterAvatars.js"}} +You can use different background colors for the avatar. The following demo generates the color based on the name of the person. + +{{"demo": "pages/components/avatars/BackgroundLetterAvatars.js"}} + ## Tamaños Puedes cambiar el tamaño del avatar con las propiedades de CSS `height` y `width`. diff --git a/docs/src/pages/components/avatars/avatars-fr.md b/docs/src/pages/components/avatars/avatars-fr.md index 92e32afc251bfd..2f60291d7112ea 100644 --- a/docs/src/pages/components/avatars/avatars-fr.md +++ b/docs/src/pages/components/avatars/avatars-fr.md @@ -1,5 +1,5 @@ --- -title: React Avatar component +title: Composant React Avatar components: Avatar, AvatarGroup, Badge githubLabel: 'component: Avatar' --- @@ -22,6 +22,10 @@ Les avatars contenant des caractères simples peuvent être créés en passant u {{"demo": "pages/components/avatars/LetterAvatars.js"}} +You can use different background colors for the avatar. The following demo generates the color based on the name of the person. + +{{"demo": "pages/components/avatars/BackgroundLetterAvatars.js"}} + ## Tailles Vous pouvez modifier la taille de l'avatar avec les propriétés CSS `height` et `width`. diff --git a/docs/src/pages/components/avatars/avatars-ja.md b/docs/src/pages/components/avatars/avatars-ja.md index 6de009bc5b0cef..fdebbbff8ed6a5 100644 --- a/docs/src/pages/components/avatars/avatars-ja.md +++ b/docs/src/pages/components/avatars/avatars-ja.md @@ -22,6 +22,10 @@ Image Avatars(画像アバター) は通常の`img` propsである、 `src` も {{"demo": "pages/components/avatars/LetterAvatars.js"}} +You can use different background colors for the avatar. The following demo generates the color based on the name of the person. + +{{"demo": "pages/components/avatars/BackgroundLetterAvatars.js"}} + ## サイズ アバターのサイズは、 `height` と `width` の CSS プロパティで変更できます。 diff --git a/docs/src/pages/components/avatars/avatars-pt.md b/docs/src/pages/components/avatars/avatars-pt.md index 948c8b7ed29ce8..9be96beac690cc 100644 --- a/docs/src/pages/components/avatars/avatars-pt.md +++ b/docs/src/pages/components/avatars/avatars-pt.md @@ -22,6 +22,10 @@ Avatares com letras podem ser criados passando sua string como `children`. {{"demo": "pages/components/avatars/LetterAvatars.js"}} +You can use different background colors for the avatar. The following demo generates the color based on the name of the person. + +{{"demo": "pages/components/avatars/BackgroundLetterAvatars.js"}} + ## Tamanhos Você pode alterar o tamanho do avatar com as propriedades CSS `height` e `width`. diff --git a/docs/src/pages/components/avatars/avatars-ru.md b/docs/src/pages/components/avatars/avatars-ru.md index 96eaa35ac11b78..161ae4523570dc 100644 --- a/docs/src/pages/components/avatars/avatars-ru.md +++ b/docs/src/pages/components/avatars/avatars-ru.md @@ -22,6 +22,10 @@ githubLabel: 'component: Avatar' {{"demo": "pages/components/avatars/LetterAvatars.js"}} +Вы можете использовать другие фоновые цвета для аватара The following demo generates the color based on the name of the person. + +{{"demo": "pages/components/avatars/BackgroundLetterAvatars.js"}} + ## Размеры Вы можете изменить размер аватара используя `height` и `width` свойств CSS. diff --git a/docs/src/pages/components/avatars/avatars-zh.md b/docs/src/pages/components/avatars/avatars-zh.md index 683afe5b6b375e..6a545e18aee19c 100644 --- a/docs/src/pages/components/avatars/avatars-zh.md +++ b/docs/src/pages/components/avatars/avatars-zh.md @@ -22,6 +22,10 @@ githubLabel: 'component: Avatar' {{"demo": "pages/components/avatars/LetterAvatars.js"}} +You can use different background colors for the avatar. The following demo generates the color based on the name of the person. + +{{"demo": "pages/components/avatars/BackgroundLetterAvatars.js"}} + ## 尺寸 你可以通过改变 `height` 以及 `width` 这两个 CSS 属性来改变头像组件的尺寸。 diff --git a/docs/src/pages/components/backdrop/backdrop-de.md b/docs/src/pages/components/backdrop/backdrop-de.md index 00f8018fe3d2fa..f746de1b6d0b45 100644 --- a/docs/src/pages/components/backdrop/backdrop-de.md +++ b/docs/src/pages/components/backdrop/backdrop-de.md @@ -1,17 +1,25 @@ --- -title: Backdrop React Component -components: Backdrop +title: Backdrop React Komponente +components: Backdrop, BackdropUnstyled githubLabel: 'component: Backdrop' --- # Backdrop -

    The backdrop component is used to provide emphasis on a particular element or parts of it.

    +

    Die Hintergrundkomponente wird verwendet, um ein bestimmtes Element oder Teile davon hervorzuheben.

    -The backdrop signals to the user of a state change within the application and can be used for creating loaders, dialogs and more. In its simplest form, the backdrop component will add a dimmed layer over your application. +The backdrop signals to the user of a state change within the application and can be used for creating loaders, dialogs, and more. In ihrer einfachsten Form fügt die Hintergrundkomponente eine abgeblendete Ebene über Ihrer Anwendung hinzu. {{"component": "modules/components/ComponentLinkHeader.js"}} ## Beispiel {{"demo": "pages/components/backdrop/SimpleBackdrop.js"}} + +## Unstyled + +The backdrop also comes with the unstyled package. It's ideal for doing heavy customizations and minimizing bundle size. + +```js +import Backdrop from '@material-ui/unstyled/Backdrop'; +``` diff --git a/docs/src/pages/components/backdrop/backdrop-es.md b/docs/src/pages/components/backdrop/backdrop-es.md index e51839c4feb609..9b5e4031e2da49 100644 --- a/docs/src/pages/components/backdrop/backdrop-es.md +++ b/docs/src/pages/components/backdrop/backdrop-es.md @@ -1,6 +1,6 @@ --- title: Backdrop React Componente -components: Backdrop +components: Backdrop, BackdropUnstyled githubLabel: 'component: Backdrop' --- @@ -15,3 +15,11 @@ El backdrop señala al usuario de un cambio de estado dentro de una aplicación ## Ejemplo {{"demo": "pages/components/backdrop/SimpleBackdrop.js"}} + +## Unstyled + +The backdrop also comes with the unstyled package. It's ideal for doing heavy customizations and minimizing bundle size. + +```js +import Backdrop from '@material-ui/unstyled/Backdrop'; +``` diff --git a/docs/src/pages/components/backdrop/backdrop-fr.md b/docs/src/pages/components/backdrop/backdrop-fr.md index ffc3a2ba50dea6..2f5394fa9a62a7 100644 --- a/docs/src/pages/components/backdrop/backdrop-fr.md +++ b/docs/src/pages/components/backdrop/backdrop-fr.md @@ -1,6 +1,6 @@ --- title: Composant React Backdrop -components: Backdrop +components: Backdrop, BackdropUnstyled githubLabel: 'component: Backdrop' --- @@ -15,3 +15,11 @@ Le Backdrop signale à l'utilisateur d'un changement d'état dans l'application ## Exemple {{"demo": "pages/components/backdrop/SimpleBackdrop.js"}} + +## Unstyled + +The backdrop also comes with the unstyled package. It's ideal for doing heavy customizations and minimizing bundle size. + +```js +import Backdrop from '@material-ui/unstyled/Backdrop'; +``` diff --git a/docs/src/pages/components/backdrop/backdrop-ja.md b/docs/src/pages/components/backdrop/backdrop-ja.md index 531cf02ce9955c..38823220764cbd 100644 --- a/docs/src/pages/components/backdrop/backdrop-ja.md +++ b/docs/src/pages/components/backdrop/backdrop-ja.md @@ -1,6 +1,6 @@ --- title: 背景 React Component -components: Backdrop +components: Backdrop, BackdropUnstyled githubLabel: 'component: Backdrop' --- @@ -8,10 +8,18 @@ githubLabel: 'component: Backdrop'

    背景コンポーネントは、特定の要素やその一部に重点を置くために使用されます。

    -アプリケーション内での状態変化のユーザーへのバックドロップ信号と、ローダー、ダイアログなどの作成に使用できます。 最も簡単な形式では、backdrop コンポーネントはアプリケーションにdimmed レイヤーを追加します。 +The backdrop signals to the user of a state change within the application and can be used for creating loaders, dialogs, and more. 最も簡単な形式では、backdrop コンポーネントはアプリケーションにdimmed レイヤーを追加します。 {{"component": "modules/components/ComponentLinkHeader.js"}} ## 例 {{"demo": "pages/components/backdrop/SimpleBackdrop.js"}} + +## Unstyled + +The backdrop also comes with the unstyled package. It's ideal for doing heavy customizations and minimizing bundle size. + +```js +import Backdrop from '@material-ui/unstyled/Backdrop'; +``` diff --git a/docs/src/pages/components/backdrop/backdrop-pt.md b/docs/src/pages/components/backdrop/backdrop-pt.md index 3f5846dfa31cf6..28f48e3e969442 100644 --- a/docs/src/pages/components/backdrop/backdrop-pt.md +++ b/docs/src/pages/components/backdrop/backdrop-pt.md @@ -1,6 +1,6 @@ --- title: Componente React para Pano de Fundo -components: Backdrop +components: Backdrop, BackdropUnstyled githubLabel: 'component: Backdrop' --- @@ -8,10 +8,18 @@ githubLabel: 'component: Backdrop'

    O componente backdrop (pano de fundo) é usado para fornecer ênfase em um elemento específico ou partes dele.

    -O backdrop sinaliza para o usuário uma mudança de estado dentro do aplicativo e pode ser usado para criar progressos, diálogos e muito mais. Em seu formato mais simples, o componente backdrop irá adicionar uma camada escurecida sobre seu aplicativo. +The backdrop signals to the user of a state change within the application and can be used for creating loaders, dialogs, and more. Em seu formato mais simples, o componente backdrop irá adicionar uma camada escurecida sobre seu aplicativo. {{"component": "modules/components/ComponentLinkHeader.js"}} ## Exemplo {{"demo": "pages/components/backdrop/SimpleBackdrop.js"}} + +## Unstyled + +The backdrop also comes with the unstyled package. It's ideal for doing heavy customizations and minimizing bundle size. + +```js +import Backdrop from '@material-ui/unstyled/Backdrop'; +``` diff --git a/docs/src/pages/components/backdrop/backdrop-ru.md b/docs/src/pages/components/backdrop/backdrop-ru.md index 432c87325e3d6b..c94f0ec087c9f8 100644 --- a/docs/src/pages/components/backdrop/backdrop-ru.md +++ b/docs/src/pages/components/backdrop/backdrop-ru.md @@ -1,6 +1,6 @@ --- title: Backdrop React Component -components: Backdrop +components: Backdrop, BackdropUnstyled githubLabel: 'component: Backdrop' --- @@ -8,10 +8,18 @@ githubLabel: 'component: Backdrop'

    Затемнение предназначено для акцентирования внимания пользователя на определенном элементе интерфейса.

    -Затемнение сигнализирует пользователю об изменении состояния в приложении и может быть использован для создания загрузчиков, диалогов и многое другое. Проще говоря, затемнение добавляет затемнённый слой поверх вашего приложения. +The backdrop signals to the user of a state change within the application and can be used for creating loaders, dialogs, and more. Проще говоря, затемнение добавляет затемнённый слой поверх вашего приложения. {{"component": "modules/components/ComponentLinkHeader.js"}} ## Пример {{"demo": "pages/components/backdrop/SimpleBackdrop.js"}} + +## Unstyled + +The backdrop also comes with the unstyled package. It's ideal for doing heavy customizations and minimizing bundle size. + +```js +import Backdrop from '@material-ui/unstyled/Backdrop'; +``` diff --git a/docs/src/pages/components/backdrop/backdrop-zh.md b/docs/src/pages/components/backdrop/backdrop-zh.md index c321bcabb237c7..859e844d5a6a08 100644 --- a/docs/src/pages/components/backdrop/backdrop-zh.md +++ b/docs/src/pages/components/backdrop/backdrop-zh.md @@ -1,6 +1,6 @@ --- title: React Backdrop(背景暗化)组件 -components: Backdrop +components: Backdrop, BackdropUnstyled githubLabel: '组件:背景暗化' --- @@ -8,10 +8,18 @@ githubLabel: '组件:背景暗化'

    背景暗化组件用于提供针对特定元素或这个元素一部分的强调。

    -Backdrop组件提醒用户应用程序内部状态的变化,也可以用来创建进度条、对话框等等。 在最简单的情况下,背景暗化组件将在您的应用程序上添加一个暗淡的图层。 +The backdrop signals to the user of a state change within the application and can be used for creating loaders, dialogs, and more. 在最简单的情况下,背景暗化组件将在您的应用程序上添加一个暗淡的图层。 {{"component": "modules/components/ComponentLinkHeader.js"}} ## 示例 {{"demo": "pages/components/backdrop/SimpleBackdrop.js"}} + +## Unstyled + +The backdrop also comes with the unstyled package. It's ideal for doing heavy customizations and minimizing bundle size. + +```js +import Backdrop from '@material-ui/unstyled/Backdrop'; +``` diff --git a/docs/src/pages/components/badges/ColorBadge.js b/docs/src/pages/components/badges/ColorBadge.js new file mode 100644 index 00000000000000..c73901c4f46639 --- /dev/null +++ b/docs/src/pages/components/badges/ColorBadge.js @@ -0,0 +1,17 @@ +import * as React from 'react'; +import Badge from '@material-ui/core/Badge'; +import Stack from '@material-ui/core/Stack'; +import MailIcon from '@material-ui/icons/Mail'; + +export default function ColorBadge() { + return ( + + + + + + + + + ); +} diff --git a/docs/src/pages/components/badges/ColorBadge.tsx b/docs/src/pages/components/badges/ColorBadge.tsx new file mode 100644 index 00000000000000..c73901c4f46639 --- /dev/null +++ b/docs/src/pages/components/badges/ColorBadge.tsx @@ -0,0 +1,17 @@ +import * as React from 'react'; +import Badge from '@material-ui/core/Badge'; +import Stack from '@material-ui/core/Stack'; +import MailIcon from '@material-ui/icons/Mail'; + +export default function ColorBadge() { + return ( + + + + + + + + + ); +} diff --git a/docs/src/pages/components/badges/SimpleBadge.js b/docs/src/pages/components/badges/SimpleBadge.js index 29695efc06fe1f..6956cc470c2bcd 100644 --- a/docs/src/pages/components/badges/SimpleBadge.js +++ b/docs/src/pages/components/badges/SimpleBadge.js @@ -1,17 +1,11 @@ import * as React from 'react'; -import Stack from '@material-ui/core/Stack'; import Badge from '@material-ui/core/Badge'; import MailIcon from '@material-ui/icons/Mail'; export default function SimpleBadge() { return ( - - - - - - - - + + + ); } diff --git a/docs/src/pages/components/badges/SimpleBadge.tsx b/docs/src/pages/components/badges/SimpleBadge.tsx index 29695efc06fe1f..6956cc470c2bcd 100644 --- a/docs/src/pages/components/badges/SimpleBadge.tsx +++ b/docs/src/pages/components/badges/SimpleBadge.tsx @@ -1,17 +1,11 @@ import * as React from 'react'; -import Stack from '@material-ui/core/Stack'; import Badge from '@material-ui/core/Badge'; import MailIcon from '@material-ui/icons/Mail'; export default function SimpleBadge() { return ( - - - - - - - - + + + ); } diff --git a/docs/src/pages/components/badges/badges-de.md b/docs/src/pages/components/badges/badges-de.md index 649610e280e7f0..be401b8722925f 100644 --- a/docs/src/pages/components/badges/badges-de.md +++ b/docs/src/pages/components/badges/badges-de.md @@ -10,7 +10,7 @@ githubLabel: 'component: Badge' {{"component": "modules/components/ComponentLinkHeader.js"}} -## Basic badges +## Einfaches Abzeichen Beispiele für Text Badges in Primär- und Sekundärfarben. The badge is applied to its children. @@ -18,7 +18,7 @@ Beispiele für Text Badges in Primär- und Sekundärfarben. The badge is applied ## Benutzerdefinierte Badges -Hier ist ein Beispiel zum Anpassen der Komponente. You can learn more about this in the [overrides documentation page](/customization/how-to-customize/). +Hier ist ein Beispiel zum Anpassen der Komponente. Weitere Informationen hierzu finden Sie auf der [Dokumentationsseite zu Overrides](/customization/how-to-customize/). {{"demo": "pages/components/badges/CustomizedBadges.js"}} @@ -28,7 +28,7 @@ Die Sichtbarkeit von Badges kann über die Eigenschaft `invisible` gesteuert wer {{"demo": "pages/components/badges/BadgeVisibility.js"}} -The badge auto hides with badgeContent is zero. You can override this with the `showZero` property. +The badge auto hides with badgeContent is zero. Sie können dies mit der Eigenschaft `showZero` überschreiben. {{"demo": "pages/components/badges/ShowZeroBadge.js"}} @@ -40,13 +40,13 @@ Sie können die Eigenschaft `max` verwenden, um den Wert des Badge-Inhalts zu be ## Dot badge -The `dot` property changes a badge into a small dot. This can be used as a notification that something has changed without giving a count. +Die Eigenschaft `dot` verwandelt ein Badge in einen kleinen Punkt. This can be used as a notification that something has changed without giving a count. {{"demo": "pages/components/badges/DotBadge.js"}} ## Badge overlap -You can use the `overlap` property to place the badge relative to the corner of the wrapped element. +Du kannst dieser `overlap`, um das Badge relativ zur Ecke des umschlossenen Elements zu platzieren. {{"demo": "pages/components/badges/BadgeOverlap.js"}} @@ -56,6 +56,18 @@ You can use the `anchorOrigin` prop to move the badge to any corner of the wrapp {{"demo": "pages/components/badges/BadgeAlignment.js", "hideToolbar": true}} -## Unstyled badge +## Unstyled + +The badge also comes with an unstyled version. It's ideal for doing heavy customizations and minimizing bundle size. + +```js +import BadgeUnstyled from '@material-ui/unstyled/BadgeUnstyled'; +``` {{"demo": "pages/components/badges/UnstyledBadge.js"}} + +## Barrierefreiheit + +You can't rely on the content of the badge to be announced correctly. You should provide a full description, for instance, with `aria-label`: + +{{"demo": "pages/components/badges/AccessibleBadges.js"}} diff --git a/docs/src/pages/components/badges/badges-es.md b/docs/src/pages/components/badges/badges-es.md index 81c97b3b68494b..e0c74fef332554 100644 --- a/docs/src/pages/components/badges/badges-es.md +++ b/docs/src/pages/components/badges/badges-es.md @@ -56,6 +56,18 @@ Puede usar la propiedad `overlap` para colocar la insignia relativa a la esquina {{"demo": "pages/components/badges/BadgeAlignment.js", "hideToolbar": true}} -## Unstyled badge +## Unstyled + +The badge also comes with an unstyled version. It's ideal for doing heavy customizations and minimizing bundle size. + +```js +import BadgeUnstyled from '@material-ui/unstyled/BadgeUnstyled'; +``` {{"demo": "pages/components/badges/UnstyledBadge.js"}} + +## Accesibilidad + +You can't rely on the content of the badge to be announced correctly. You should provide a full description, for instance, with `aria-label`: + +{{"demo": "pages/components/badges/AccessibleBadges.js"}} diff --git a/docs/src/pages/components/badges/badges-fr.md b/docs/src/pages/components/badges/badges-fr.md index bf9536817e1ae6..1037dbe6810f01 100644 --- a/docs/src/pages/components/badges/badges-fr.md +++ b/docs/src/pages/components/badges/badges-fr.md @@ -1,5 +1,5 @@ --- -title: React Badge component +title: Composant React Badge components: Badge, BadgeUnstyled githubLabel: 'component: Badge' --- @@ -10,7 +10,7 @@ githubLabel: 'component: Badge' {{"component": "modules/components/ComponentLinkHeader.js"}} -## Basic badges +## Badges Basique Exemples de badges contenant du texte, utilisant les couleurs primaires et secondaires. Le badge est appliqué aux enfants. @@ -56,6 +56,18 @@ Vous pouvez utiliser le prop `anchorOrigin` pour déplacer le badge dans n'impor {{"demo": "pages/components/badges/BadgeAlignment.js", "hideToolbar": true}} -## Unstyled badge +## Unstyled + +The badge also comes with an unstyled version. It's ideal for doing heavy customizations and minimizing bundle size. + +```js +import BadgeUnstyled from '@material-ui/unstyled/BadgeUnstyled'; +``` {{"demo": "pages/components/badges/UnstyledBadge.js"}} + +## Accessibilité + +You can't rely on the content of the badge to be announced correctly. You should provide a full description, for instance, with `aria-label`: + +{{"demo": "pages/components/badges/AccessibleBadges.js"}} diff --git a/docs/src/pages/components/badges/badges-ja.md b/docs/src/pages/components/badges/badges-ja.md index 6b7aa19afce320..6522a45143f3d3 100644 --- a/docs/src/pages/components/badges/badges-ja.md +++ b/docs/src/pages/components/badges/badges-ja.md @@ -6,7 +6,7 @@ githubLabel: 'component: Badge' # Badge -

    バッジは、その子供の右上に小さなバッジを生成します。

    +

    バッジは、その子要素の右上に小さなバッジを生成します。

    {{"component": "modules/components/ComponentLinkHeader.js"}} @@ -18,7 +18,7 @@ githubLabel: 'component: Badge' ## Customized badges (カスタマイズされたバッジ) -コンポーネントのカスタマイズ例を次に示します。 詳細については、 [オーバーライドドキュメントページ](/customization/how-to-customize/)ご覧ください。 +コンポーネントのカスタマイズ例を次に示します。 詳細については、 [オーバーライドについてのドキュメント](/customization/how-to-customize/) を参照してください。 {{"demo": "pages/components/badges/CustomizedBadges.js"}} @@ -46,7 +46,7 @@ BadgeContentが0の場合、バッジは自動的に非表示になります。 ## バッジの重複 -`オーバーラップ` プロパティを使用して、ラップされた要素の角を基準にしてバッジを配置できます。 +`overlap` プロパティを使用して、ラップされた要素の角を基準にしてバッジを配置できます。 {{"demo": "pages/components/badges/BadgeOverlap.js"}} @@ -56,6 +56,18 @@ BadgeContentが0の場合、バッジは自動的に非表示になります。 {{"demo": "pages/components/badges/BadgeAlignment.js", "hideToolbar": true}} -## Unstyled badge +## Unstyled + +The badge also comes with an unstyled version. It's ideal for doing heavy customizations and minimizing bundle size. + +```js +import BadgeUnstyled from '@material-ui/unstyled/BadgeUnstyled'; +``` {{"demo": "pages/components/badges/UnstyledBadge.js"}} + +## アクセシビリティ + +You can't rely on the content of the badge to be announced correctly. You should provide a full description, for instance, with `aria-label`: + +{{"demo": "pages/components/badges/AccessibleBadges.js"}} diff --git a/docs/src/pages/components/badges/badges-pt.md b/docs/src/pages/components/badges/badges-pt.md index 3070a12eff8760..01f29114c14ae9 100644 --- a/docs/src/pages/components/badges/badges-pt.md +++ b/docs/src/pages/components/badges/badges-pt.md @@ -56,6 +56,18 @@ Você pode usar a propriedade `anchorOrigin` para mover o emblema para qualquer {{"demo": "pages/components/badges/BadgeAlignment.js", "hideToolbar": true}} -## Emblema sem estilo +## Unstyled + +The badge also comes with an unstyled version. It's ideal for doing heavy customizations and minimizing bundle size. + +```js +import BadgeUnstyled from '@material-ui/unstyled/BadgeUnstyled'; +``` {{"demo": "pages/components/badges/UnstyledBadge.js"}} + +## Acessibilidade + +You can't rely on the content of the badge to be announced correctly. You should provide a full description, for instance, with `aria-label`: + +{{"demo": "pages/components/badges/AccessibleBadges.js"}} diff --git a/docs/src/pages/components/badges/badges-ru.md b/docs/src/pages/components/badges/badges-ru.md index 01f94fb99b088f..cf9a5fe67f59eb 100644 --- a/docs/src/pages/components/badges/badges-ru.md +++ b/docs/src/pages/components/badges/badges-ru.md @@ -56,6 +56,18 @@ githubLabel: 'component: Badge' {{"demo": "pages/components/badges/BadgeAlignment.js", "hideToolbar": true}} -## Unstyled badge +## Unstyled + +The badge also comes with an unstyled version. It's ideal for doing heavy customizations and minimizing bundle size. + +```js +import BadgeUnstyled from '@material-ui/unstyled/BadgeUnstyled'; +``` {{"demo": "pages/components/badges/UnstyledBadge.js"}} + +## Доступность + +You can't rely on the content of the badge to be announced correctly. You should provide a full description, for instance, with `aria-label`: + +{{"demo": "pages/components/badges/AccessibleBadges.js"}} diff --git a/docs/src/pages/components/badges/badges-zh.md b/docs/src/pages/components/badges/badges-zh.md index 6d71fb4a11a879..190ef1071141e5 100644 --- a/docs/src/pages/components/badges/badges-zh.md +++ b/docs/src/pages/components/badges/badges-zh.md @@ -56,6 +56,18 @@ githubLabel: 'component: Badge' {{"demo": "pages/components/badges/BadgeAlignment.js", "hideToolbar": true}} -## 无样式的徽章 +## Unstyled + +The badge also comes with an unstyled version. It's ideal for doing heavy customizations and minimizing bundle size. + +```js +import BadgeUnstyled from '@material-ui/unstyled/BadgeUnstyled'; +``` {{"demo": "pages/components/badges/UnstyledBadge.js"}} + +## 无障碍设计 + +You can't rely on the content of the badge to be announced correctly. You should provide a full description, for instance, with `aria-label`: + +{{"demo": "pages/components/badges/AccessibleBadges.js"}} diff --git a/docs/src/pages/components/badges/badges.md b/docs/src/pages/components/badges/badges.md index e7f5a3ebcab63d..ddd2f21f457210 100644 --- a/docs/src/pages/components/badges/badges.md +++ b/docs/src/pages/components/badges/badges.md @@ -16,6 +16,12 @@ Examples of badges containing text, using primary and secondary colors. The badg {{"demo": "pages/components/badges/SimpleBadge.js"}} +## Color + +Use `color` prop to apply theme palette to component. + +{{"demo": "pages/components/badges/ColorBadge.js"}} + ## Customized badges Here is an example of customizing the component. You can learn more about this in the [overrides documentation page](/customization/how-to-customize/). diff --git a/docs/src/pages/components/bottom-navigation/bottom-navigation-de.md b/docs/src/pages/components/bottom-navigation/bottom-navigation-de.md index 3484f56d228c49..7df4b8b251e317 100644 --- a/docs/src/pages/components/bottom-navigation/bottom-navigation-de.md +++ b/docs/src/pages/components/bottom-navigation/bottom-navigation-de.md @@ -30,3 +30,7 @@ Bei **4** oder **5** Aktionen werden inaktive Ansichten nur als Symbole angezeig This demo keeps bottom navigation fixed to the bottom, no matter the amount of content on-screen. {{"demo": "pages/components/bottom-navigation/FixedBottomNavigation.js", "bg": true, "iframe": true, "maxWidth": 600}} + +## Drittanbieter-Routing Bibliothek + +One frequent use case is to perform navigation on the client only, without an HTTP round-trip to the server. The `BottomNavigationAction` component provides the `component` prop to handle this use case. Here is a [more detailed guide](/guides/routing). diff --git a/docs/src/pages/components/bottom-navigation/bottom-navigation-es.md b/docs/src/pages/components/bottom-navigation/bottom-navigation-es.md index 3454ddf12e0609..87e641f34fea92 100644 --- a/docs/src/pages/components/bottom-navigation/bottom-navigation-es.md +++ b/docs/src/pages/components/bottom-navigation/bottom-navigation-es.md @@ -30,3 +30,7 @@ Si hay **cuatro ** o **cinco** acciones, mostrar vistas inactivas solamente como This demo keeps bottom navigation fixed to the bottom, no matter the amount of content on-screen. {{"demo": "pages/components/bottom-navigation/FixedBottomNavigation.js", "bg": true, "iframe": true, "maxWidth": 600}} + +## Librería externa de routing + +One frequent use case is to perform navigation on the client only, without an HTTP round-trip to the server. The `BottomNavigationAction` component provides the `component` prop to handle this use case. Here is a [more detailed guide](/guides/routing). diff --git a/docs/src/pages/components/bottom-navigation/bottom-navigation-fr.md b/docs/src/pages/components/bottom-navigation/bottom-navigation-fr.md index e1d9a80517d3a9..69e50c6828c90b 100644 --- a/docs/src/pages/components/bottom-navigation/bottom-navigation-fr.md +++ b/docs/src/pages/components/bottom-navigation/bottom-navigation-fr.md @@ -9,24 +9,36 @@ materialDesign: https://material.io/components/bottom-navigation

    Les barres de navigation inférieures permettent de se déplacer entre les destinations principales dans une application.

    -[La barre de navigation inférieure](https://material.io/design/components/bottom-navigation.html) affichage de trois à cinq destinations au bas de l'écran. Chaque destination est représentée par une icône et une étiquette de texte optionnelle. Lorsqu'une icône de navigation en bas de page est enfoncée, l'utilisateur est dirigé vers la destination de navigation de niveau supérieur associée à cette icône. +La barre de navigation inférieure affiche de de trois à cinq destinations en bas de l'écran. Chaque destination est représentée par une icône et une étiquette de texte optionnelle. Lorsqu'une icône de navigation en bas de page est enfoncée, l'utilisateur est dirigé vers la destination de navigation de niveau supérieur associée à cette icône.

    {{"component": "modules/components/ComponentLinkHeader.js"}} + + ## Bottom Navigation (Barre de navigation inférieure) Si il y a **quatre** ou **cinq** actions, affichage inactif points de vue uniquement sous forme d'icônes. {{"demo": "pages/components/bottom-navigation/SimpleBottomNavigation.js", "bg": true}} + + ## Navigation du bas sans étiquette -S'il y a **quatre actions** ou **cinq actions** , afficher les vues inactives uniquement sous forme d'icônes. +S'il y a **quatre actions** ou **cinq actions** , les vues inactives sont affichées uniquement sous forme d'icônes. {{"demo": "pages/components/bottom-navigation/LabelBottomNavigation.js", "bg": true}} -## Fixed positioning -This demo keeps bottom navigation fixed to the bottom, no matter the amount of content on-screen. + +## Position fixe + +Cette démo maintient la navigation de bas en bas, peu importe la quantité de contenu à l'écran. {{"demo": "pages/components/bottom-navigation/FixedBottomNavigation.js", "bg": true, "iframe": true, "maxWidth": 600}} + + + +## Bibliothèque de routage tierce + +One frequent use case is to perform navigation on the client only, without an HTTP round-trip to the server. The `BottomNavigationAction` component provides the `component` prop to handle this use case. Here is a [more detailed guide](/guides/routing). diff --git a/docs/src/pages/components/bottom-navigation/bottom-navigation-ja.md b/docs/src/pages/components/bottom-navigation/bottom-navigation-ja.md index 6de8bf47c7614a..050321fb9f808d 100644 --- a/docs/src/pages/components/bottom-navigation/bottom-navigation-ja.md +++ b/docs/src/pages/components/bottom-navigation/bottom-navigation-ja.md @@ -9,13 +9,13 @@ materialDesign: https://material.io/components/bottom-navigation

    ボトムナビゲーションを使用すると、アプリ内の主要な目的地間を移動できます。

    -[ボトムナビゲーション](https://material.io/design/components/bottom-navigation.html) バーは、画面下部に3〜5つの目的地を表示します。 各目的地は、アイコンとオプションのテキストラベルで表されます。 ボトムナビゲーションアイコンをタップすると、そのアイコンに関連付けられている最上位のナビゲーション先に移動します。 +ボトムナビゲーションバーは、画面下部に3〜5つの目的地を表示します。 各目的地は、アイコンとオプションのテキストラベルで表されます。 ボトムナビゲーションアイコンをタップすると、そのアイコンに関連付けられている最上位のナビゲーション先に移動します。 {{"component": "modules/components/ComponentLinkHeader.js"}} ## ボトムナビゲーション -**4** または **5** アクションがある場合は、非アクティブビューをアイコンとしてのみ表示します。 +**3 **アクションしかない場合は、アイコンとテキストラベルの両方を常に表示します。 {{"demo": "pages/components/bottom-navigation/SimpleBottomNavigation.js", "bg": true}} @@ -25,8 +25,12 @@ materialDesign: https://material.io/components/bottom-navigation {{"demo": "pages/components/bottom-navigation/LabelBottomNavigation.js", "bg": true}} -## Fixed positioning +## 固定位置 -This demo keeps bottom navigation fixed to the bottom, no matter the amount of content on-screen. +このデモでは、画面上のコンテンツの量に関係なく、下部ナビゲーションを下部に固定します。 {{"demo": "pages/components/bottom-navigation/FixedBottomNavigation.js", "bg": true, "iframe": true, "maxWidth": 600}} + +## サードパーティ製ルーティングライブラリ + +One frequent use case is to perform navigation on the client only, without an HTTP round-trip to the server. The `BottomNavigationAction` component provides the `component` prop to handle this use case. Here is a [more detailed guide](/guides/routing). diff --git a/docs/src/pages/components/bottom-navigation/bottom-navigation-pt.md b/docs/src/pages/components/bottom-navigation/bottom-navigation-pt.md index 32a025a59349b2..9a67725181b7f8 100644 --- a/docs/src/pages/components/bottom-navigation/bottom-navigation-pt.md +++ b/docs/src/pages/components/bottom-navigation/bottom-navigation-pt.md @@ -30,3 +30,7 @@ Se existir **quatro** ou **cinco** ações, exiba os destinos inativos somente c Esta demonstração mantém a navegação inferior fixa na parte inferior, não importa a quantidade de conteúdo na tela. {{"demo": "pages/components/bottom-navigation/FixedBottomNavigation.js", "bg": true, "iframe": true, "maxWidth": 600}} + +## Biblioteca de roteamento de terceiros + +One frequent use case is to perform navigation on the client only, without an HTTP round-trip to the server. The `BottomNavigationAction` component provides the `component` prop to handle this use case. Here is a [more detailed guide](/guides/routing). diff --git a/docs/src/pages/components/bottom-navigation/bottom-navigation-ru.md b/docs/src/pages/components/bottom-navigation/bottom-navigation-ru.md index d87e0ef9777378..b375c39e02bfb9 100644 --- a/docs/src/pages/components/bottom-navigation/bottom-navigation-ru.md +++ b/docs/src/pages/components/bottom-navigation/bottom-navigation-ru.md @@ -25,8 +25,12 @@ materialDesign: https://material.io/components/bottom-navigation {{"demo": "pages/components/bottom-navigation/LabelBottomNavigation.js", "bg": true}} -## Fixed positioning +## Fixed positioning (фиксированное позиционирование) -This demo keeps bottom navigation fixed to the bottom, no matter the amount of content on-screen. +В этом примере нижняя панель навигации остаётся зафиксированной снизу вне зависимости от количества контента на экране. {{"demo": "pages/components/bottom-navigation/FixedBottomNavigation.js", "bg": true, "iframe": true, "maxWidth": 600}} + +## Сторонняя библиотека маршрутизации + +One frequent use case is to perform navigation on the client only, without an HTTP round-trip to the server. The `BottomNavigationAction` component provides the `component` prop to handle this use case. Here is a [more detailed guide](/guides/routing). diff --git a/docs/src/pages/components/bottom-navigation/bottom-navigation-zh.md b/docs/src/pages/components/bottom-navigation/bottom-navigation-zh.md index 4b8501a99822b9..17fbb6706f750d 100644 --- a/docs/src/pages/components/bottom-navigation/bottom-navigation-zh.md +++ b/docs/src/pages/components/bottom-navigation/bottom-navigation-zh.md @@ -30,3 +30,7 @@ materialDesign: https://material.io/components/bottom-navigation 无论屏幕上有多少内容,该演示的内容都会将底部导航固定在底部。 {{"demo": "pages/components/bottom-navigation/FixedBottomNavigation.js", "bg": true, "iframe": true, "maxWidth": 600}} + +## Third-party routing library(第三方路由库) + +One frequent use case is to perform navigation on the client only, without an HTTP round-trip to the server. The `BottomNavigationAction` component provides the `component` prop to handle this use case. Here is a [more detailed guide](/guides/routing). diff --git a/docs/src/pages/components/box/box-de.md b/docs/src/pages/components/box/box-de.md index 0cf9c49a70aace..e2e4b14619dfcf 100644 --- a/docs/src/pages/components/box/box-de.md +++ b/docs/src/pages/components/box/box-de.md @@ -7,7 +7,7 @@ githubLabel: 'component: Box'

    Die Box-Komponente dient als Wrapper-Komponente für die meisten Anforderungen des CSS-Dienstprogramms.

    -Die Box-Komponente kombiniert [alle Stilfunktionen](/system/basics/#all-inclusive), die in `@material-ui/system` verfügbar sind. Die Box-Komponente kombiniert [alle Stilfunktionen](/system/basics/#all-inclusive), die in `@material-ui/system` verfügbar sind. +Die Box-Komponente kombiniert [alle Stilfunktionen](/system/basics/#all-inclusive), die in `@material-ui/system` verfügbar sind. Die Style-Funktion der [Palette](/system/palette/). @@ -15,9 +15,9 @@ Die Style-Funktion der [Palette](/system/palette/). Die Style-Funktion der [Palette](/system/palette/). -## The sx prop +## The `sx` prop -All system properties are available via the `sx` prop. In addition, this prop allows you to specify any other CSS rules you may need. Here's an example of how you can use it: +All system properties are available via the [`sx` prop](/system/basics/#the-sx-prop). In addition, the `sx` prop allows you to specify any other CSS rules you may need. Here's an example of how you can use it: {{"demo": "pages/components/box/BoxSx.js", "defaultCodeOpen": true }} @@ -29,31 +29,40 @@ Die Box-Komponente umschließt Ihre Komponente. It creates a new DOM element, a Dies funktioniert hervorragend, wenn die Änderungen für ein neues DOM-Element isoliert werden können. Zum Beispiel kann der Rand auf diese Weise verändert werden. -Manchmal müssen Sie jedoch das zugrunde liegende DOM-Element als Ziel festlegen. For instance, you want to change the border of the Button. The Button component defines its own styles. CSS-Vererbung hilft hier nicht. Um das Problem zu umgehen, haben Sie zwei Möglichkeiten: +Manchmal müssen Sie jedoch das zugrunde liegende DOM-Element als Ziel festlegen. As an example, you may want to change the border of the Button. The Button component defines its own styles. CSS-Vererbung hilft hier nicht. To workaround the problem, you can use the [`sx`](/system/basics/#the-sx-prop) prop directly on the child if it is a Material-UI component. -1. Verwenden Sie [`React.cloneElement()`](https://reactjs.org/docs/react-api.html#cloneelement) +```diff +- +- +- ++ +``` -Die Box-Komponente verfügt über eine `clone`-Eigenschaft, um die Verwendung der Klonelementmethode von React zu ermöglichen. +For non-Material-UI components, use the `component` prop. -{{"demo": "pages/components/box/BoxClone.js", "defaultCodeOpen": true }} +```diff +- +- +- ++Save +``` -2. Verwenden Sie Render Eigenschaften +## API -Die Box-Kinder akzeptieren eine Render-Funktion als Eigenschaft. Sie können den `className` herausziehen. +```jsx +import Box from '@material-ui/core/Box'; +``` -{{"demo": "pages/components/box/BoxRenderProps.js", "defaultCodeOpen": true }} +| Name | Typ | Standard | Beschreibung | +|:---------------------------------------- |:----------------------------------------------------------------------------------------------------------------------------- |:--------------------------------------- |:-------------------------------------------------------------------------------------------------------------------------- | +| children | node
    | | Box Render-Funktion oder Knoten. | +| component | union: string |
     func |
     object
    | 'div' | Die für den Wurzelknoten verwendete Komponente. Entweder ein String, um ein DOM-Element zu verwenden oder eine Komponente. | +| sx | object | {} | Accepts all system properties, as well as any valid CSS properties. | -> ⚠️ Die CSS-Spezifität hängt von der Importreihenfolge ab. Wenn Sie garantieren wollen, dass der Stil der wrapped Komponente überschrieben wird, müssen Sie die Box zuletzt importieren. +## System props -## API +As a CSS utility component, the `Box` also supports all [`system`](/system/properties/) properties. You can use them as prop directly on the component. For instance, a margin-top: ```jsx -import Box from '@material-ui/core/Box'; + ``` - -| Name | Typ | Standard | Beschreibung | -|:------------------------------------------------------- |:----------------------------------------------------------------------------------------------------------------------------- |:--------------------------------------- |:-------------------------------------------------------------------------------------------------------------------------- | -| children * | union: node |
     func
    | | Box Render-Funktion oder Knoten. | -| clone | bool | false | Wenn `true`, werden die untergeordnete DOM-Elemente der Box recycelt. Es verwendet intern `React.cloneElement`. | -| component | union: string |
     func |
     object
    | 'div' | Die für den Wurzelknoten verwendete Komponente. Entweder ein String, um ein DOM-Element zu verwenden oder eine Komponente. | -| sx | object | {} | Accepts all system properties, as well as any valid CSS properties. | diff --git a/docs/src/pages/components/box/box-es.md b/docs/src/pages/components/box/box-es.md index 83f0db309bd3bd..a3d747df6f5de8 100644 --- a/docs/src/pages/components/box/box-es.md +++ b/docs/src/pages/components/box/box-es.md @@ -7,7 +7,7 @@ githubLabel: 'component: Box'

    El componente Box sirve como una envoltura para la mayoría de las necesidades CSS.

    -El componente Box recoge [todas las funciones de estilo](/system/basics/#all-inclusive) que están expuesta en `@material-ui/system`. El componente Box recoge [todas las funciones de estilo](/system/basics/#all-inclusive) que están expuesta en `@material-ui/system`. +El componente Box recoge [todas las funciones de estilo](/system/basics/#all-inclusive) que están expuesta en `@material-ui/system`. [La función de estilo de la paleta](/system/palette/). @@ -15,7 +15,7 @@ El componente Box recoge [todas las funciones de estilo](/system/basics/#all-inc [La función de estilo de la paleta](/system/palette/). -## The sx prop +## The `sx` prop All system properties are available via the `sx` prop. In addition, this prop allows you to specify any other CSS rules you may need. Here's an example of how you can use it: @@ -29,31 +29,40 @@ El componente Box envuelve su componente. Crea un nuevo elemento DOM, un `
    ` Esto funciona muy bien cuando los cambios se pueden aislar a un nuevo elemento DOM. Por ejemplo, puede cambiar el margen de esta manera. -Sin embargo, a veces tienes que apuntar al elemento DOM subyacente. For instance, you want to change the border of the Button. The Button component defines its own styles. La herencia por CSS no ayuda. Para solucionar el problema, tiene dos opciones: +Sin embargo, a veces tienes que apuntar al elemento DOM subyacente. For instance, you want to change the border of the Button. The Button component defines its own styles. La herencia por CSS no ayuda. To workaround the problem, you can use the [`sx`](/system/basics/#the-sx-prop) prop directly on the child if it is a Material-UI component. -1. Utilice [`React.cloneElement ()`](https://reactjs.org/docs/react-api.html#cloneelement) +```diff +- +- +- ++ +``` El componente Box tiene una propiedad `clone` para permitir el uso del método de elemento clon de React. -{{"demo": "pages/components/box/BoxClone.js", "defaultCodeOpen": true }} +```diff +- +- +- ++Save +``` -2. Use props de render +## API -Los elementos hijo de Box aceptan una función props de render. Puede extraer el `className`. +```jsx +import Box from '@material-ui/core/Box'; +``` -{{"demo": "pages/components/box/BoxRenderProps.js", "defaultCodeOpen": true }} +| Nombre | Tipo | Por defecto | Descripción | +|:------------------------------------------- |:----------------------------------------------------------------------------------------------------------------------------- |:--------------------------------------- |:-------------------------------------------------------------------------------------------------------- | +| hijos * | node
    | | Función de render de Box o nodo. | +| component | union: string |
     func |
     object
    | 'div' | El componente utilizado para el nodo raíz. Ya sea un 'string' para usar un elemento DOM o un componente. | +| sx | object | {} | Accepts all system properties, as well as any valid CSS properties. | -> ⚠️ La especificidad de CSS se basa en el orden de importación. Si desea la garantía de que se anulará el estilo del componente envuelto, debe importar el cuadro al final. +## System props -## API +As a CSS utility component, the `Box` also supports all [`system`](/system/properties/) properties. You can use them as prop directly on the component. For instance, a margin-top: ```jsx -import Box from '@material-ui/core/Box'; + ``` - -| Nombre | Tipo | Por defecto | Descripción | -|:---------------------------------------------------- |:----------------------------------------------------------------------------------------------------------------------------- |:--------------------------------------- |:-------------------------------------------------------------------------------------------------------- | -| hijos * | union: node |
     func
    | | Función de render de Box o nodo. | -| clone | bool | false | Si `true`, el Box reciclará su elemento DOM secundario. Está usando `React.cloneElement` internamente. | -| component | union: string |
     func |
     object
    | 'div' | El componente utilizado para el nodo raíz. Ya sea un 'string' para usar un elemento DOM o un componente. | -| sx | object | {} | Accepts all system properties, as well as any valid CSS properties. | diff --git a/docs/src/pages/components/box/box-fr.md b/docs/src/pages/components/box/box-fr.md index 4b415226a5b487..73fa5f50d533f7 100644 --- a/docs/src/pages/components/box/box-fr.md +++ b/docs/src/pages/components/box/box-fr.md @@ -1,5 +1,5 @@ --- -title: React Box component +title: Composant React Box githubLabel: 'component: Box' --- @@ -7,7 +7,7 @@ githubLabel: 'component: Box'

    Le composant Box sert de composant de wrapper pour la plupart des besoins de l'utilitaire CSS.

    -Le composant Box contiens [toutes les fonctions de style](/system/basics/#all-inclusive) qui sont exposées dans `@material-ui/system`. Le composant Box contiens [toutes les fonctions de style](/system/basics/#all-inclusive) qui sont exposées dans `@material-ui/system`. +Le composant Box contiens [toutes les fonctions de style](/system/basics/#all-inclusive) qui sont exposées dans `@material-ui/system`. {{"component": "modules/components/ComponentLinkHeader.js", "design": false}} @@ -15,45 +15,54 @@ Le composant Box contiens [toutes les fonctions de style](/system/basics/#all-in [La palette](/system/palette/) de style fonction. -## The sx prop +## The `sx` prop -All system properties are available via the `sx` prop. In addition, this prop allows you to specify any other CSS rules you may need. Here's an example of how you can use it: +All system properties are available via the `sx` prop. In addition, this prop allows you to specify any other CSS rules you may need. Voici un exemple de la façon dont vous pouvez l'utiliser : {{"demo": "pages/components/box/BoxSx.js", "defaultCodeOpen": true }} ## Remplacer les composants Material-UI -Le composant Box enveloppe votre composant. It creates a new DOM element, a `
    ` by default that can be changed with the `component` property. Disons que vous voulez utiliser un `` à la place : +Le composant Box enveloppe votre composant. Il crée un nouvel élément DOM, un `
    ` par défaut qui peut être modifié avec la propriété `component`. Disons que vous voulez utiliser un `` à la place : {{"demo": "pages/components/box/BoxComponent.js", "defaultCodeOpen": true }} Cela fonctionne très bien quand les changements peuvent être isolés dans un nouvel élément DOM. Par exemple, vous pouvez changer la marge de cette façon. -Cependant, vous devez parfois cibler l'élément DOM sous-jacent. Cependant, vous devez parfois cibler l'élément DOM sous-jacent. For instance, you want to change the border of the Button. L'héritage CSS n'aide pas. Pour contourner le problème, vous avez deux options : +Cependant, vous devez parfois cibler l'élément DOM sous-jacent. For instance, you want to change the border of the Button. Le composant Button définit ses propres styles. L'héritage CSS n'aide pas. To workaround the problem, you can use the [`sx`](/system/basics/#the-sx-prop) prop directly on the child if it is a Material-UI component. -1. Utilisez [`React.cloneElement()`](https://reactjs.org/docs/react-api.html#cloneelement) +```diff +- +- +- ++ +``` The Box component has a `clone` property to enable the usage of the clone element method of React. -{{"demo": "pages/components/box/BoxClone.js", "defaultCodeOpen": true }} +```diff +- +- +- ++Save +``` -2. Utiliser les props de rendu +## API -Les enfants de la boîte acceptent une fonction de rendu des props. Vous pouvez retirer le `className`. +```jsx +import Box from '@material-ui/core/Box'; +``` -{{"demo": "pages/components/box/BoxRenderProps.js", "defaultCodeOpen": true }} +| Nom | Type | Défaut | Description | +|:---------------------------------------------- |:----------------------------------------------------------------------------------------------------------------------------- |:--------------------------------------- |:---------------------------------------------------------------------------------------------------------------------- | +| children * | node
    | | Fonction de rendu ou noeud de la boîte. | +| component | union: string |
     func |
     object
    | 'div' | Le composant utilisé pour le noeud racine. Soit une chaîne de caractères pour utiliser un élément DOM ou un composant. | +| sx | object | {} | Accepte toutes les propriétés du système, ainsi que toutes les propriétés CSS valides. | -> ⚠ La spécificité CSS dépend de l'ordre d'importation. Si vous voulez la garantie que le style du composant enveloppé sera surchargé, vous devez importer le Box en dernier. +## System props -## API +As a CSS utility component, the `Box` also supports all [`system`](/system/properties/) properties. You can use them as prop directly on the component. For instance, a margin-top: ```jsx -import Box from '@material-ui/core/Box'; + ``` - -| Nom | Type | Défaut | Description | -|:------------------------------------------------------- |:----------------------------------------------------------------------------------------------------------------------------- |:--------------------------------------- |:---------------------------------------------------------------------------------------------------------------------- | -| children * | union: node |
     func
    | | Fonction de rendu ou noeud de la boîte. | -| clone | bool | false | Si `true`, la boîte recycle son élément DOM enfant. Il utilise `React.cloneElement` en interne. | -| component | union: string |
     func |
     object
    | 'div' | Le composant utilisé pour le noeud racine. Soit une chaîne de caractères pour utiliser un élément DOM ou un composant. | -| sx | object | {} | Accepts all system properties, as well as any valid CSS properties. | diff --git a/docs/src/pages/components/box/box-ja.md b/docs/src/pages/components/box/box-ja.md index 0352af83be86e2..a1cba5e0cbb091 100644 --- a/docs/src/pages/components/box/box-ja.md +++ b/docs/src/pages/components/box/box-ja.md @@ -1,5 +1,5 @@ --- -title: React Box component +title: React Box コンポーネント githubLabel: 'component: Box' --- @@ -7,17 +7,17 @@ githubLabel: 'component: Box'

    Boxコンポーネントは、CSSユーティリティーのほとんどのニーズに対応するラッパーコンポーネントとして機能します

    -Boxコンポーネントは、`@material-ui/system`で公開される[すべてのスタイル関数](/system/basics/#all-inclusive) をパッケージ化します。 It's created using the [`styled()`](/styles/api/#styled-style-function-component) function of `@material-ui/core/styles`. It's created using the [`styled()`](/styles/api/#styled-style-function-component) function of `@material-ui/core/styles`. +Boxコンポーネントは、`@material-ui/system`で公開される[すべてのスタイル関数](/system/basics/#all-inclusive) をパッケージ化します。 [The palette](/system/palette/) style関数。 ## 例 -[The palette](/system/palette/) style関数。 +[palette](/system/palette/) style関数。 -## The sx prop +## The `sx` prop -All system properties are available via the `sx` prop. In addition, this prop allows you to specify any other CSS rules you may need. Here's an example of how you can use it: +All system properties are available via the [`sx` prop](/system/basics/#the-sx-prop). In addition, the `sx` prop allows you to specify any other CSS rules you may need. 使用方法の例を次に示します。 {{"demo": "pages/components/box/BoxSx.js", "defaultCodeOpen": true }} @@ -27,33 +27,42 @@ The Box componentは、コンポーネントをラップします。 新しいDO {{"demo": "pages/components/box/BoxComponent.js", "defaultCodeOpen": true }} -これは、新しいDOM要素に分離する変更の場合に非常に有効です。 たとえば、この方法で余白を変更できます。 たとえば、この方法で余白を変更できます。 たとえば、この方法で余白を変更できます。 たとえば、この方法で余白を変更できます。 たとえば、この方法で余白を変更できます。 +これは、新しいDOM要素に分離する変更の場合に非常に有効です。 たとえば、この方法で余白を変更できます。 -ただし、場合によっては基礎となるDOM要素をターゲットにする必要があります。 For instance, you want to change the border of the Button. The Button component defines its own styles. CSS継承は役に立ちません。 この問題を回避するには、次の2つの方法があります。 +ただし、場合によっては基礎となるDOM要素をターゲットにする必要があります。 As an example, you may want to change the border of the Button. しかしButtonコンポーネントは独自のスタイルを定義しています。 CSS継承は役に立ちません。 To workaround the problem, you can use the [`sx`](/system/basics/#the-sx-prop) prop directly on the child if it is a Material-UI component. -1. [`React.cloneElement()`](https://reactjs.org/docs/react-api.html#cloneelement)を使う +```diff +- +- +- ++ +``` -ボックスの子は、レンダープロップス機能を受け入れます `className`を取り出すことができます。 +For non-Material-UI components, use the `component` prop. -{{"demo": "pages/components/box/BoxClone.js", "defaultCodeOpen": true }} +```diff +- +- +- ++Save +``` -2. Render propsを使う +## API -ボックスの子は、レンダープロップス機能を受け入れます `className`を取り出すことができます。 +```jsx +import Box from '@material-ui/core/Box'; +``` -{{"demo": "pages/components/box/BoxRenderProps.js", "defaultCodeOpen": true }} +| Name | Type | Default | Description | +|:---------------------------------------- |:----------------------------------------------------------------------------------------------------------------------------- |:--------------------------------------- |:--------------------------------------------- | +| children | node
    | | ボックスレンダー関数またはノード。 | +| component | union: string |
     func |
     object
    | 'div' | ルートノードに使用されるコンポーネント。 DOM要素またはコンポーネントを使用する文字列。 | +| sx | object | {} | すべてのシステムプロパティと有効な CSS プロパティを受け入れます。 | -> CSSの仕様は、インポート順序に依存します。 ラップされたコンポーネントのスタイルが確実にオーバーライドされるようにするには、最後にボックスをインポートする必要があります。 +## System props -## API +As a CSS utility component, the `Box` also supports all [`system`](/system/properties/) properties. You can use them as prop directly on the component. For instance, a margin-top: ```jsx -import Box from '@material-ui/core/Box'; + ``` - -| Name | Type | Default | Description | -|:------------------------------------------------------- |:----------------------------------------------------------------------------------------------------------------------------- |:--------------------------------------- |:------------------------------------------------------------------- | -| children * | union: node |
     func
    | | ボックスレンダー関数またはノード。 | -| clone | bool | false | `true`の場合、ボックスはその子DOM要素をリサイクルします。 内部的には`React.cloneElement`です。 | -| component | union: string |
     func |
     object
    | 'div' | ルートノードに使用されるコンポーネント。 DOM要素またはコンポーネントを使用する文字列。 | -| sx | object | {} | Accepts all system properties, as well as any valid CSS properties. | diff --git a/docs/src/pages/components/box/box-pt.md b/docs/src/pages/components/box/box-pt.md index a1ba3429053871..b7cefdd547daf3 100644 --- a/docs/src/pages/components/box/box-pt.md +++ b/docs/src/pages/components/box/box-pt.md @@ -7,7 +7,7 @@ githubLabel: 'component: Box'

    O componente Box serve como um componente encapsulador (wrapper) para a auxiliar na maioria das necessidades de uso com CSS.

    -O component Box compõe [todas as funções de estilo](/system/basics/#all-inclusive) que são expostas no `@material-ui/system`. O component Box compõe [todas as funções de estilo](/system/basics/#all-inclusive) que são expostas no `@material-ui/system`. +O component Box compõe [todas as funções de estilo](/system/basics/#all-inclusive) que são expostas no `@material-ui/system`. [A paleta](/system/palette/) com funções de estilo. @@ -15,9 +15,9 @@ O component Box compõe [todas as funções de estilo](/system/basics/#all-inclu [A paleta](/system/palette/) com funções de estilo. -## A propriedade sx +## A propriedade `sx` -Todas as propriedades do sistema estão disponíveis através da propriedade `sx`. Além disso, esta propriedade permite que você especifique quaisquer outras regras CSS que você possa precisar. Aqui está um exemplo de como você pode usá-la: +All system properties are available via the [`sx` prop](/system/basics/#the-sx-prop). In addition, the `sx` prop allows you to specify any other CSS rules you may need. Aqui está um exemplo de como você pode usá-la: {{"demo": "pages/components/box/BoxSx.js", "defaultCodeOpen": true }} @@ -29,31 +29,40 @@ O componente Box envolve seu componente. Ele cria um novo elemento DOM, uma ` +- +-
    ++ +``` -O componente Box tem uma propriedade `clone` para permitir o uso do método de clonar elemento do React. +For non-Material-UI components, use the `component` prop. -{{"demo": "pages/components/box/BoxClone.js", "defaultCodeOpen": true }} +```diff +- +- +- ++Save +``` -2. Use a função de renderização com propriedades +## API -Os elementos filhos de Box aceitam uma função de renderização com propriedades. Você pode então extrair o `className`. +```jsx +import Box from '@material-ui/core/Box'; +``` -{{"demo": "pages/components/box/BoxRenderProps.js", "defaultCodeOpen": true }} +| Nome | Tipo | Padrão | Descrição | +|:---------------------------------------- |:----------------------------------------------------------------------------------------------------------------------------- |:--------------------------------------- |:--------------------------------------------------------------------------------------- | +| children | node
    | | Função de renderização do Box ou nó. | +| component | union: string |
     func |
     object
    | 'div' | O componente usado como nó raiz. Ou uma string para usar um elemento DOM ou componente. | +| sx | object | {} | Aceita todas as propriedades do sistema, bem como quaisquer propriedades CSS válidas. | -> ⚠️ A especificidade do CSS depende da ordem de importação. Se você quer garantir que o estilo do componente encapsulado seja substituído, você precisa importar o Box por último. +## System props -## API +As a CSS utility component, the `Box` also supports all [`system`](/system/properties/) properties. You can use them as prop directly on the component. For instance, a margin-top: ```jsx -import Box from '@material-ui/core/Box'; + ``` - -| Nome | Tipo | Padrão | Descrição | -|:------------------------------------------------------- |:----------------------------------------------------------------------------------------------------------------------------- |:--------------------------------------- |:---------------------------------------------------------------------------------------------------- | -| children * | union: node |
     func
    | | Função de renderização do Box ou nó. | -| clone | bool | false | Se `true`, o box irá recriar seu elemento DOM filho. Ele irá usar `React.cloneElement` internamente. | -| component | union: string |
     func |
     object
    | 'div' | O componente usado como nó raiz. Ou uma string para usar um elemento DOM ou componente. | -| sx | object | {} | Aceita todas as propriedades do sistema, bem como quaisquer propriedades CSS válidas. | diff --git a/docs/src/pages/components/box/box-ru.md b/docs/src/pages/components/box/box-ru.md index 09c52db221363d..98697743b40267 100644 --- a/docs/src/pages/components/box/box-ru.md +++ b/docs/src/pages/components/box/box-ru.md @@ -7,7 +7,7 @@ githubLabel: 'component: Box'

    Box компонент используется как обертка компонента для большинства используемых CSS свойств.

    -The Box component packages [all the style functions](/system/basics/#all-inclusive) that are exposed in `@material-ui/system`. The Box component packages [all the style functions](/system/basics/#all-inclusive) that are exposed in `@material-ui/system`. +The Box component packages [all the style functions](/system/basics/#all-inclusive) that are exposed in `@material-ui/system`. {{"component": "modules/components/ComponentLinkHeader.js", "design": false}} @@ -15,45 +15,54 @@ The Box component packages [all the style functions](/system/basics/#all-inclusi [The palette](/system/palette/) style function. -## The sx prop +## The `sx` prop -All system properties are available via the `sx` prop. In addition, this prop allows you to specify any other CSS rules you may need. Here's an example of how you can use it: +All system properties are available via the [`sx` prop](/system/basics/#the-sx-prop). In addition, the `sx` prop allows you to specify any other CSS rules you may need. Вот пример того, как вы можете использовать его: {{"demo": "pages/components/box/BoxSx.js", "defaultCodeOpen": true }} ## Переопределение Material-UI компонентов -Box компонент оборачивает ваш компонент. Он создает новый DOM элемент, это `
    ` по умолчанию, хотя это можно изменить свойством `component`. Например если вы хотите использовать`` взамен: +Box компонент оборачивает ваш компонент. Он создает новый DOM элемент: `
    ` по умолчанию, который можно изменить свойством `component`. Например если вы хотите использовать`` взамен: {{"demo": "pages/components/box/BoxComponent.js", "defaultCodeOpen": true }} Это работает превосходно когда изменения могут быть изолированы в новый DOM элемент. Для сущности, вы можете изменить margin(внешний отступ) таким образом. -Тем не менее, иногда вам нужно ориентироваться на базовый элемент DOM. For instance, you want to change the border of the Button. The Button component defines its own styles. Наследование CSS не помогает. Чтобы обойти проблему, у вас есть два варианта: +Тем не менее, иногда вам нужно ориентироваться на базовый элемент DOM. As an example, you may want to change the border of the Button. Этот компонент определяет свои собственные стили. Наследование CSS не помогает. To workaround the problem, you can use the [`sx`](/system/basics/#the-sx-prop) prop directly on the child if it is a Material-UI component. -1. Использовать [`React.cloneElement()`](https://reactjs.org/docs/react-api.html#cloneelement) +```diff +- +- +- ++ +``` -Компонент Box имеет свойство `clone`, которое позволяет использовать метод clone element из React. +For non-Material-UI components, use the `component` prop. -{{"demo": "pages/components/box/BoxClone.js", "defaultCodeOpen": true }} +```diff +- +- +- ++Save +``` -2. Используйте render свойства +## API -The Box children accepts a render props function. You can pull out the `className`. +```jsx +import Box from '@material-ui/core/Box'; +``` -{{"demo": "pages/components/box/BoxRenderProps.js", "defaultCodeOpen": true }} +| Имя | Тип | По-умолчанию | Описание | +|:---------------------------------------- |:----------------------------------------------------------------------------------------------------------------------------- |:--------------------------------------- |:------------------------------------------------------------------------------------------ | +| children | node
    | | Box render function or node. | +| component | union: string |
     func |
     object
    | 'div' | The component used for the root node. Either a string to use a DOM element or a component. | +| sx | object | {} | Принимает все системные свойства, а также все допустимые CSS-свойства. | -> ⚠️ The CSS specificity relies on the import order. If you want the guarantee that the wrapped component's style will be overridden, you need to import the Box last. +## System props -## API +As a CSS utility component, the `Box` also supports all [`system`](/system/properties/) properties. You can use them as prop directly on the component. For instance, a margin-top: ```jsx -import Box from '@material-ui/core/Box'; + ``` - -| Имя | Тип | По-умолчанию | Описание | -|:------------------------------------------------------- |:----------------------------------------------------------------------------------------------------------------------------- |:--------------------------------------- |:----------------------------------------------------------------------------------------------------- | -| children * | union: node |
     func
    | | Box render function or node. | -| clone | bool | false | If `true`, the box will recycle its children DOM element. It's using `React.cloneElement` internally. | -| component | union: string |
     func |
     object
    | 'div' | The component used for the root node. Either a string to use a DOM element or a component. | -| sx | object | {} | Accepts all system properties, as well as any valid CSS properties. | diff --git a/docs/src/pages/components/box/box-zh.md b/docs/src/pages/components/box/box-zh.md index 73c3651498aee9..620e52ad67ec1e 100644 --- a/docs/src/pages/components/box/box-zh.md +++ b/docs/src/pages/components/box/box-zh.md @@ -7,7 +7,7 @@ githubLabel: 'component: Box'

    对于大多数 CSS 实用程序来说,Box 组件能够作为一个包装组件来使用。

    -在`@material-ui/system`中,您可以找到所述 Box 组件包的 [所有的样式功能](/system/basics/#all-inclusive)。 它是使用 `@material-ui/core/styles` 的 `styled()` 函数创建的。 +在`@material-ui/system`中,您可以找到所述 Box 组件包的 [所有的样式功能](/system/basics/#all-inclusive)。 {{"component": "modules/components/ComponentLinkHeader.js", "design": false}} @@ -15,9 +15,9 @@ githubLabel: 'component: Box' 查看[调色板](/system/palette/)样式功能。 -## sx 属性 +## `sx` 属性 -所有系统属性都可以 通过 `sx` 属性来获取。 此外,该属性也允许你指定所需要的其他 CSS 规则。 下面是一个如何使用的示例: +All system properties are available via the [`sx` prop](/system/basics/#the-sx-prop). In addition, the `sx` prop allows you to specify any other CSS rules you may need. 下面是一个如何使用的示例: {{"demo": "pages/components/box/BoxSx.js", "defaultCodeOpen": true }} @@ -29,31 +29,40 @@ Box 组件能够封装您的组件。 它创建了一个新的 DOM 元素,默 当所需的更改与新的 DOM 元素分开时比较有效。 例如,您可以使用这个方法来更改边距。 -但是,有时您必须针对到底层的 DOM 元素。 但是,有时您必须针对到底层的 DOM 元素。 例如,你想要改变按钮的边框样式。 所以使用 CSS 继承是于事无补的。 要解决此问题,您有以下两种选择: +但是,有时您必须针对到底层的 DOM 元素。 As an example, you may want to change the border of the Button. 但是按钮组件已经定义自己的样式。 所以使用 CSS 继承是于事无补的。 To workaround the problem, you can use the [`sx`](/system/basics/#the-sx-prop) prop directly on the child if it is a Material-UI component. -1. 使用 [`React.cloneElement()`](https://reactjs.org/docs/react-api.html#cloneelement) +```diff +- +- +- ++ +``` -Box 组件有一个 `clone` 的属性,通过它您可以使用 React 克隆元素的方法。 +For non-Material-UI components, use the `component` prop. -{{"demo": "pages/components/box/BoxClone.js", "defaultCodeOpen": true }} +```diff +- +- +- ++Save +``` -2. 使用 render props +## API -您可以在 Box 的子组件中使用 render props 的函数。 您可以不用 `className`。 +```jsx +import Box from '@material-ui/core/Box'; +``` -{{"demo": "pages/components/box/BoxRenderProps.js", "defaultCodeOpen": true }} +| 名称 | 类型 | 默认值 | 描述 | +|:---------------------------------------- |:----------------------------------------------------------------------------------------------------------------------------- |:--------------------------------------- |:------------------------------------------ | +| children | node
    | | Box 渲染函数或者返回节点。 | +| component | union: string |
     func |
     object
    | 'div' | component 用于根节点。 可以是一个使用 DOM 元素或者一个组件的字符串。 | +| sx | object | {} | 接受所有系统属性,以及任何有效的 CSS 属性。 | -> ⚠️CSS 的优先级依赖于导入的顺序。 如果您希望确保覆写包装组件的样式,则需要在最后才导入 Box。 +## System props -## API +As a CSS utility component, the `Box` also supports all [`system`](/system/properties/) properties. You can use them as prop directly on the component. For instance, a margin-top: ```jsx -import Box from '@material-ui/core/Box'; + ``` - -| 名称 | 类型 | 默认值 | 描述 | -|:---------------------------------------------------------- |:----------------------------------------------------------------------------------------------------------------------------- |:--------------------------------------- |:-------------------------------------------------------------- | -| children \* | union: node |
     func
    | | Box 渲染函数或者返回节点。 | -| clone | bool | false | 如果设置为 `true`,box 将会重复利用其子 DOM 元素。 它在内部使用 `React.cloneElement`。 | -| component | union: string |
     func |
     object
    | 'div' | component 用于根节点。 可以是一个使用 DOM 元素或者一个组件的字符串。 | -| sx | object | {} | 接受所有系统属性,以及任何有效的 CSS 属性。 | diff --git a/docs/src/pages/components/breadcrumbs/breadcrumbs-de.md b/docs/src/pages/components/breadcrumbs/breadcrumbs-de.md index 13e3c698f6531e..fb8e37e5fef11e 100644 --- a/docs/src/pages/components/breadcrumbs/breadcrumbs-de.md +++ b/docs/src/pages/components/breadcrumbs/breadcrumbs-de.md @@ -13,7 +13,7 @@ waiAria: 'https://www.w3.org/TR/wai-aria-practices/#breadcrumb' ## Einfache Breadcrumbs -{{"demo": "pages/components/breadcrumbs/SimpleBreadcrumbs.js"}} +{{"demo": "pages/components/breadcrumbs/BasicBreadcrumbs.js"}} ## Active last breadcrumb @@ -23,7 +23,7 @@ Keep the last breadcrumb interactive. ## Benutzerdefiniertes Trennzeichen -In den folgenden Beispielen werden zwei textbasierte Trennzeichen und ein SVG-Icon verwendet. +In the following examples, we are using two string separators and an SVG icon. {{"demo": "pages/components/breadcrumbs/CustomSeparator.js"}} diff --git a/docs/src/pages/components/breadcrumbs/breadcrumbs-fr.md b/docs/src/pages/components/breadcrumbs/breadcrumbs-fr.md index d688a44b0b69cc..6881111da0ed32 100644 --- a/docs/src/pages/components/breadcrumbs/breadcrumbs-fr.md +++ b/docs/src/pages/components/breadcrumbs/breadcrumbs-fr.md @@ -1,5 +1,5 @@ --- -title: React Breadcrumbs component +title: Composant React Breadcrumbs components: Breadcrumbs, Link, Typography githubLabel: 'component: Breadcrumbs' waiAria: 'https://www.w3.org/TR/wai-aria-practices/#breadcrumb' diff --git a/docs/src/pages/components/breadcrumbs/breadcrumbs-ja.md b/docs/src/pages/components/breadcrumbs/breadcrumbs-ja.md index 3a21a4db49bbf9..b60254b33a3cb6 100644 --- a/docs/src/pages/components/breadcrumbs/breadcrumbs-ja.md +++ b/docs/src/pages/components/breadcrumbs/breadcrumbs-ja.md @@ -1,29 +1,29 @@ --- -title: React Breadcrumbs component +title: React Breadcrumbs コンポーネント components: Breadcrumbs, Link, Typography githubLabel: 'component: Breadcrumbs' waiAria: 'https://www.w3.org/TR/wai-aria-practices/#breadcrumb' --- -# Breadcrumbs +# Breadcrumbs (パンくずリスト)

    Breadcrumbsを使用すると、値の範囲から選択できます。

    {{"component": "modules/components/ComponentLinkHeader.js"}} -## シンプルなbreadcurmbs +## シンプルな breadcurmbs -{{"demo": "pages/components/breadcrumbs/SimpleBreadcrumbs.js"}} +{{"demo": "pages/components/breadcrumbs/BasicBreadcrumbs.js"}} -## Active last breadcrumb +## 最後のbreadcurmbsをアクティブにする -Keep the last breadcrumb interactive. +最後のbreadcrumbをインタラクティブな状態にします。 {{"demo": "pages/components/breadcrumbs/ActiveLastBreadcrumb.js"}} ## カスタムセパレーター (Custom separator) -次の例では、2つの文字列セパレータとSVGアイコンを使用しています。 +In the following examples, we are using two string separators and an SVG icon. {{"demo": "pages/components/breadcrumbs/CustomSeparator.js"}} @@ -37,7 +37,7 @@ Keep the last breadcrumb interactive. ## カスタマイズされた breadcrumbs -コンポーネントのカスタマイズ例を次に示します。 詳細については、 [overrides documentation page](/customization/how-to-customize/)を参照してください。 +コンポーネントのカスタマイズ例を次に示します。 詳細については、 [こちら](/customization/how-to-customize/)を参照してください。 {{"demo": "pages/components/breadcrumbs/CustomizedBreadcrumbs.js"}} diff --git a/docs/src/pages/components/breadcrumbs/breadcrumbs-pt.md b/docs/src/pages/components/breadcrumbs/breadcrumbs-pt.md index 6ae3650d61fa8a..c3c7fa1e10383a 100644 --- a/docs/src/pages/components/breadcrumbs/breadcrumbs-pt.md +++ b/docs/src/pages/components/breadcrumbs/breadcrumbs-pt.md @@ -13,7 +13,7 @@ waiAria: 'https://www.w3.org/TR/wai-aria-practices/#breadcrumb' ## Navegação estrutural simples -{{"demo": "pages/components/breadcrumbs/SimpleBreadcrumbs.js"}} +{{"demo": "pages/components/breadcrumbs/BasicBreadcrumbs.js"}} ## Último caminho ativo @@ -23,7 +23,7 @@ Mantendo o último caminho de navegação interativo. ## Separador customizado -No exemplo a seguir, nós usamos duas strings separadoras, e um ícone SVG. +In the following examples, we are using two string separators and an SVG icon. {{"demo": "pages/components/breadcrumbs/CustomSeparator.js"}} diff --git a/docs/src/pages/components/breadcrumbs/breadcrumbs-ru.md b/docs/src/pages/components/breadcrumbs/breadcrumbs-ru.md index 2542e0f60d6cb4..9708199ac48365 100644 --- a/docs/src/pages/components/breadcrumbs/breadcrumbs-ru.md +++ b/docs/src/pages/components/breadcrumbs/breadcrumbs-ru.md @@ -13,7 +13,7 @@ waiAria: 'https://www.w3.org/TR/wai-aria-practices/#breadcrumb' ## Простые хлебные крошки -{{"demo": "pages/components/breadcrumbs/SimpleBreadcrumbs.js"}} +{{"demo": "pages/components/breadcrumbs/BasicBreadcrumbs.js"}} ## Active last breadcrumb @@ -23,7 +23,7 @@ Keep the last breadcrumb interactive. ## Пользовательский разделитель -В следующих примерах мы используем два строковых разделителя и SVG иконку. +In the following examples, we are using two string separators and an SVG icon. {{"demo": "pages/components/breadcrumbs/CustomSeparator.js"}} @@ -37,7 +37,7 @@ Keep the last breadcrumb interactive. ## Пользовательские хлебные крошки -Ниже находится пример кастомизации компонента. You can learn more about this in the [overrides documentation page](/customization/how-to-customize/). +Ниже находится пример кастомизации компонента. Вы можете узнать об этом больше [в документации по переопределению свойств](/customization/how-to-customize/). {{"demo": "pages/components/breadcrumbs/CustomizedBreadcrumbs.js"}} diff --git a/docs/src/pages/components/breadcrumbs/breadcrumbs-zh.md b/docs/src/pages/components/breadcrumbs/breadcrumbs-zh.md index 5f5b0d97c23f86..1d6021ae1b3fa2 100644 --- a/docs/src/pages/components/breadcrumbs/breadcrumbs-zh.md +++ b/docs/src/pages/components/breadcrumbs/breadcrumbs-zh.md @@ -13,7 +13,7 @@ waiAria: 'https://www.w3.org/TR/wai-aria-practices/#breadcrumb' ## 简单的面包屑导航 -{{"demo": "pages/components/breadcrumbs/SimpleBreadcrumbs.js"}} +{{"demo": "pages/components/breadcrumbs/BasicBreadcrumbs.js"}} ## 激活最后一个面包屑导航 @@ -23,7 +23,7 @@ waiAria: 'https://www.w3.org/TR/wai-aria-practices/#breadcrumb' ## 自定义分隔符 -在以下的示例中,我们使用了两个字符串分隔符和一个 SVG 图标。 +In the following examples, we are using two string separators and an SVG icon. {{"demo": "pages/components/breadcrumbs/CustomSeparator.js"}} diff --git a/docs/src/pages/components/button-group/button-group-de.md b/docs/src/pages/components/button-group/button-group-de.md index d2beaa0a973c4f..7ba89dcead81e1 100644 --- a/docs/src/pages/components/button-group/button-group-de.md +++ b/docs/src/pages/components/button-group/button-group-de.md @@ -1,5 +1,5 @@ --- -title: React ButtonGroup component +title: React ButtonGroup Komponente components: Button, ButtonGroup githubLabel: 'component: ButtonGroup' --- @@ -12,25 +12,31 @@ githubLabel: 'component: ButtonGroup' ## Basic button group -The standard Button variants are supported. +The buttons can be grouped by wrapping them with the `ButtonGroup` component. They need to be immediate children. {{"demo": "pages/components/button-group/BasicButtonGroup.js"}} +## Button variants + +All the standard button variants are supported. + +{{"demo": "pages/components/button-group/VariantButtonGroup.js"}} + ## Größen und Farben -The `size` and `color` props can be used to control the appearance of the ButtonGroup. +The `size` and `color` props can be used to control the appearance of the button group. {{"demo": "pages/components/button-group/GroupSizesColors.js"}} ## Vertikale Gruppe -The ButtonGroup can be displayed veritcally using the `orientation` prop. +The button group can be displayed vertically using the `orientation` prop. {{"demo": "pages/components/button-group/GroupOrientation.js"}} ## Split button -`ButtonGroup` can also be used to create a split button. Ein Dropdown kann verwendet werden um die Button-Aktion zu ändern (wie im unteren Beispiel gezeigt) oder die Aktion direkt zu aktivieren. +`ButtonGroup` can also be used to create a split button. The dropdown can change the button action (as in this example) or be used to immediately trigger a related action. {{"demo": "pages/components/button-group/SplitButton.js"}} diff --git a/docs/src/pages/components/button-group/button-group-es.md b/docs/src/pages/components/button-group/button-group-es.md index 4f39382d45bedd..d7992869a32991 100644 --- a/docs/src/pages/components/button-group/button-group-es.md +++ b/docs/src/pages/components/button-group/button-group-es.md @@ -1,5 +1,5 @@ --- -title: React ButtonGroup component +title: Componente ButtonGroup de React components: Button, ButtonGroup githubLabel: 'component: ButtonGroup' --- @@ -12,7 +12,7 @@ githubLabel: 'component: ButtonGroup' ## Grupos de botones básicos -The standard Button variants are supported. +The buttons can be grouped by wrapping them with the `ButtonGroup` component. They need to be immediate children. {{"demo": "pages/components/button-group/BasicButtonGroup.js"}} @@ -20,11 +20,17 @@ The standard Button variants are supported. The `size` and `color` props can be used to control the appearance of the ButtonGroup. +{{"demo": "pages/components/button-group/VariantButtonGroup.js"}} + +## Tamaños y colores + +The ButtonGroup can be displayed veritcally using the `orientation` prop. + {{"demo": "pages/components/button-group/GroupSizesColors.js"}} ## Grupo Vertical -The ButtonGroup can be displayed veritcally using the `orientation` prop. +The button group can be displayed vertically using the `orientation` prop. {{"demo": "pages/components/button-group/GroupOrientation.js"}} diff --git a/docs/src/pages/components/button-group/button-group-fr.md b/docs/src/pages/components/button-group/button-group-fr.md index 699481c98963b8..9449cb386d6364 100644 --- a/docs/src/pages/components/button-group/button-group-fr.md +++ b/docs/src/pages/components/button-group/button-group-fr.md @@ -1,5 +1,5 @@ --- -title: React ButtonGroup component +title: Groupe de Boutons components: Button, ButtonGroup githubLabel: 'component: ButtonGroup' --- @@ -12,7 +12,7 @@ githubLabel: 'component: ButtonGroup' ## Groupe de boutons de base -The standard Button variants are supported. +The buttons can be grouped by wrapping them with the `ButtonGroup` component. They need to be immediate children. {{"demo": "pages/components/button-group/BasicButtonGroup.js"}} @@ -20,11 +20,17 @@ The standard Button variants are supported. The `size` and `color` props can be used to control the appearance of the ButtonGroup. +{{"demo": "pages/components/button-group/VariantButtonGroup.js"}} + +## Tailles et couleurs + +The ButtonGroup can be displayed veritcally using the `orientation` prop. + {{"demo": "pages/components/button-group/GroupSizesColors.js"}} ## Groupe vertical -The ButtonGroup can be displayed veritcally using the `orientation` prop. +The button group can be displayed vertically using the `orientation` prop. {{"demo": "pages/components/button-group/GroupOrientation.js"}} diff --git a/docs/src/pages/components/button-group/button-group-ja.md b/docs/src/pages/components/button-group/button-group-ja.md index 3f85fb1b9c1a7d..68aaaa52ce8c14 100644 --- a/docs/src/pages/components/button-group/button-group-ja.md +++ b/docs/src/pages/components/button-group/button-group-ja.md @@ -1,5 +1,5 @@ --- -title: React ButtonGroup component +title: React ButtonGroup コンポーネント components: Button, ButtonGroup githubLabel: 'component: ButtonGroup' --- @@ -12,25 +12,31 @@ githubLabel: 'component: ButtonGroup' ## 基本的なbutton group -The standard Button variants are supported. +The buttons can be grouped by wrapping them with the `ButtonGroup` component. They need to be immediate children. {{"demo": "pages/components/button-group/BasicButtonGroup.js"}} +## Button variants + +All the standard button variants are supported. + +{{"demo": "pages/components/button-group/VariantButtonGroup.js"}} + ## サイズと色 -The `size` and `color` props can be used to control the appearance of the ButtonGroup. +The `size` and `color` props can be used to control the appearance of the button group. {{"demo": "pages/components/button-group/GroupSizesColors.js"}} ## 縦のグループ -The ButtonGroup can be displayed veritcally using the `orientation` prop. +The button group can be displayed vertically using the `orientation` prop. {{"demo": "pages/components/button-group/GroupOrientation.js"}} ## Split button -`ButtonGroup` で分割したボタンを作成することも可能です。 この例のようにドロップダウンでボタンの動作を変更することも、関連する動作をすぐに起動するために使用することもできます。 この例のようにドロップダウンでボタンの動作を変更することも、関連する動作をすぐに起動するために使用することもできます。 +`ButtonGroup` で分割したボタンを作成することも可能です。 この例のようにドロップダウンでボタンの動作を変更することも、関連する動作をすぐに起動するために使用することもできます。 The dropdown can change the button action (as in this example) or be used to immediately trigger a related action. {{"demo": "pages/components/button-group/SplitButton.js"}} diff --git a/docs/src/pages/components/button-group/button-group-pt.md b/docs/src/pages/components/button-group/button-group-pt.md index 29f71f7d0a0379..84910acacb5e3c 100644 --- a/docs/src/pages/components/button-group/button-group-pt.md +++ b/docs/src/pages/components/button-group/button-group-pt.md @@ -12,25 +12,31 @@ githubLabel: 'component: ButtonGroup' ## Grupo de botões básico -As variações padrão de botão são suportadas. +The buttons can be grouped by wrapping them with the `ButtonGroup` component. They need to be immediate children. {{"demo": "pages/components/button-group/BasicButtonGroup.js"}} +## Button variants + +All the standard button variants are supported. + +{{"demo": "pages/components/button-group/VariantButtonGroup.js"}} + ## Tamanhos e cores -As propriedades `size` e `color` podem ser usadas para controlar a aparência do ButtonGroup. +The `size` and `color` props can be used to control the appearance of the button group. {{"demo": "pages/components/button-group/GroupSizesColors.js"}} ## Grupo vertical -O ButtonGroup pode ser exibido verticalmente usando a propriedade `orientation`. +The button group can be displayed vertically using the `orientation` prop. {{"demo": "pages/components/button-group/GroupOrientation.js"}} ## Botão dividido -`ButtonGroup` também pode ser usado para criar um botão dividido. A lista suspensa pode alterar a ação do botão (como neste exemplo), ou ser usada para acionar imediatamente uma ação relacionada. +`ButtonGroup` também pode ser usado para criar um botão dividido. The dropdown can change the button action (as in this example) or be used to immediately trigger a related action. {{"demo": "pages/components/button-group/SplitButton.js"}} diff --git a/docs/src/pages/components/button-group/button-group-ru.md b/docs/src/pages/components/button-group/button-group-ru.md index ce9966ac823256..edf60d6530f5ad 100644 --- a/docs/src/pages/components/button-group/button-group-ru.md +++ b/docs/src/pages/components/button-group/button-group-ru.md @@ -12,25 +12,31 @@ githubLabel: 'component: ButtonGroup' ## Базовые свойства кнопок -The standard Button variants are supported. +The buttons can be grouped by wrapping them with the `ButtonGroup` component. They need to be immediate children. {{"demo": "pages/components/button-group/BasicButtonGroup.js"}} +## Button variants + +All the standard button variants are supported. + +{{"demo": "pages/components/button-group/VariantButtonGroup.js"}} + ## Sizes and colors -The `size` and `color` props can be used to control the appearance of the ButtonGroup. +The `size` and `color` props can be used to control the appearance of the button group. {{"demo": "pages/components/button-group/GroupSizesColors.js"}} ## Vertical group -The ButtonGroup can be displayed veritcally using the `orientation` prop. +The button group can be displayed vertically using the `orientation` prop. {{"demo": "pages/components/button-group/GroupOrientation.js"}} ## Split button -`ButtonGroup` can also be used to create a split button. Выпадающий список может изменить действие кнопки (как в этом примере), или использоваться для немедленного вызова действия. +`ButtonGroup` can also be used to create a split button. The dropdown can change the button action (as in this example) or be used to immediately trigger a related action. {{"demo": "pages/components/button-group/SplitButton.js"}} diff --git a/docs/src/pages/components/button-group/button-group-zh.md b/docs/src/pages/components/button-group/button-group-zh.md index a539cb3e4a7e59..acb413160d1178 100644 --- a/docs/src/pages/components/button-group/button-group-zh.md +++ b/docs/src/pages/components/button-group/button-group-zh.md @@ -12,25 +12,31 @@ githubLabel: '组件:按钮组' ## Basic button group 基本的按钮组 -支持基本的按钮变量。 +The buttons can be grouped by wrapping them with the `ButtonGroup` component. They need to be immediate children. {{"demo": "pages/components/button-group/BasicButtonGroup.js"}} +## Button variants + +All the standard button variants are supported. + +{{"demo": "pages/components/button-group/VariantButtonGroup.js"}} + ## 大小和颜色 -`size` 和 `color` 属性可以用于控制按钮组的外观。 +The `size` and `color` props can be used to control the appearance of the button group. {{"demo": "pages/components/button-group/GroupSizesColors.js"}} ## Vertical group 垂直组 -按钮组可以使用 `orientation` 属性来垂直显示。 +The button group can be displayed vertically using the `orientation` prop. {{"demo": "pages/components/button-group/GroupOrientation.js"}} ## Split button 分体式按钮 -`按钮组组件`也可用于创建分体式按钮。 下拉列表可以用于更改按钮相关的操作(如本例所示),或者用于立即触发一个相关的操作。 +`按钮组组件`也可用于创建分体式按钮。 The dropdown can change the button action (as in this example) or be used to immediately trigger a related action. {{"demo": "pages/components/button-group/SplitButton.js"}} diff --git a/docs/src/pages/components/buttons/ColorButtons.js b/docs/src/pages/components/buttons/ColorButtons.js index a5457fd0956e17..5a5a6a50b83b69 100644 --- a/docs/src/pages/components/buttons/ColorButtons.js +++ b/docs/src/pages/components/buttons/ColorButtons.js @@ -6,11 +6,11 @@ export default function ColorButtons() { return ( :not(style)': { m: 1 } }}> - - ); diff --git a/docs/src/pages/components/buttons/ColorButtons.tsx b/docs/src/pages/components/buttons/ColorButtons.tsx index a5457fd0956e17..5a5a6a50b83b69 100644 --- a/docs/src/pages/components/buttons/ColorButtons.tsx +++ b/docs/src/pages/components/buttons/ColorButtons.tsx @@ -6,11 +6,11 @@ export default function ColorButtons() { return ( :not(style)': { m: 1 } }}> - - ); diff --git a/docs/src/pages/components/buttons/IconButtonColors.js b/docs/src/pages/components/buttons/IconButtonColors.js new file mode 100644 index 00000000000000..2fd45873a1f1e0 --- /dev/null +++ b/docs/src/pages/components/buttons/IconButtonColors.js @@ -0,0 +1,17 @@ +import React from 'react'; +import Box from '@material-ui/core/Box'; +import IconButton from '@material-ui/core/IconButton'; +import Fingerprint from '@material-ui/icons/Fingerprint'; + +export default function IconButtonColors() { + return ( + + + + + + + + + ); +} diff --git a/docs/src/pages/components/buttons/IconButtonColors.tsx b/docs/src/pages/components/buttons/IconButtonColors.tsx new file mode 100644 index 00000000000000..2fd45873a1f1e0 --- /dev/null +++ b/docs/src/pages/components/buttons/IconButtonColors.tsx @@ -0,0 +1,17 @@ +import React from 'react'; +import Box from '@material-ui/core/Box'; +import IconButton from '@material-ui/core/IconButton'; +import Fingerprint from '@material-ui/icons/Fingerprint'; + +export default function IconButtonColors() { + return ( + + + + + + + + + ); +} diff --git a/docs/src/pages/components/buttons/LoadingButtonsTransition.js b/docs/src/pages/components/buttons/LoadingButtonsTransition.js index cfd949c2f36d37..71dc13c99941f6 100644 --- a/docs/src/pages/components/buttons/LoadingButtonsTransition.js +++ b/docs/src/pages/components/buttons/LoadingButtonsTransition.js @@ -28,8 +28,13 @@ export default function LoadingButtonsTransition() { } label="Loading" /> - - Submit + + disabled - - Submit + + disabled ` element: +1. **Nur CSS**. You can remove the pointer-events style on the disabled state of the ` + ``` Notez que la documentation [évite](/guides/api/#native-properties) de mentionner les props natifs (il y en a beaucoup) dans la section API des composants. -## Bouton de téléchargement +## Couleur -{{"demo": "pages/components/buttons/UploadButtons.js"}} +{{"demo": "pages/components/buttons/ColorButtons.js"}} + +In addition to using the default button colors, you can add custom ones, or disable any you don't need. See the [Adding new colors](/customization/palette/#adding-new-colors) example for more info. ## Tailles @@ -69,13 +72,17 @@ Fancy larger or smaller buttons? Use the `size` property. {{"demo": "pages/components/buttons/ButtonSizes.js"}} +## Bouton de téléchargement + +{{"demo": "pages/components/buttons/UploadButtons.js"}} + ## Boutons avec icônes et libellés -Sometimes you might want to have icons for certain buttons to enhance the UX of the application as we recognize logos more easily than plain text. Par exemple, si vous avez un bouton de suppression, vous pouvez l’étiqueter avec une icône de poubelle. +Parfois vous aimeriez avoir des icônes pour certains boutons afin d'améliorer l'UX de l'application, car nous reconnaissons plus facilement les logos que le texte brut. Par exemple, si vous avez un bouton de suppression, vous pouvez l’étiqueter avec une icône de poubelle. {{"demo": "pages/components/buttons/IconLabelButtons.js"}} -## Icon button +## Boutons avec icône Les boutons d'icônes se trouvent généralement dans les barres d'applications et les barres d'outils. @@ -83,6 +90,12 @@ Les icônes sont également appropriées pour les boutons de bascule qui permett {{"demo": "pages/components/buttons/IconButtons.js"}} +### Tailles + +Pour ajuster la taille des boutons, utilisez la propriété `size`. + +{{"demo": "pages/components/buttons/IconButtonSizes.js"}} + ## Boutons personnalisés Here are some examples of customizing the component. Vous pouvez en savoir plus dans la [page de documentation des overrides](/customization/how-to-customize/). @@ -91,27 +104,25 @@ Here are some examples of customizing the component. Vous pouvez en savoir plus 🎨 Si vous cherchez de l'inspiration, vous pouvez consulter les [exemples de personnalisation de MUI Treasury](https://mui-treasury.com/styles/button). -## Boutons complexes +## Boutons personnalisés -The loading buttons can show loading state and disable interactions. +Les boutons de chargement peuvent afficher l'état de celui-ci et désactiver les interactions. {{"demo": "pages/components/buttons/LoadingButtons.js"}} -Toggle the switch to see the transition between the different states. +Activer/désactiver le commutateur pour voir la transition entre les différents états. {{"demo": "pages/components/buttons/LoadingButtonsTransition.js"}} -## Complex buttons +## Boutons complexes -Les boutons texte, les boutons contained, les bouton d'action flottante et les boutons icône sont tous basés sur le composant `ButtonBase`. You can take advantage of this lower-level component to build custom interactions. +Les boutons texte, les boutons contained, les bouton d'action flottante et les boutons icône sont tous basés sur le composant `ButtonBase`. Vous pouvez profiter de ce composant de niveau inférieur pour construire des interactions personnalisées. {{"demo": "pages/components/buttons/ButtonBase.js"}} ## Bibliothèque de routage tierce -Un cas d'utilisation courant est d'utiliser le bouton pour déclencher la navigation vers une nouvelle page. Un cas d'utilisation courant est d'utiliser le bouton pour déclencher la navigation vers une nouvelle page. Cependant, pour certains focus polyfills `ButtonBase` requiert le nœud DOM du composant fourni. Pour ce faire, associez une référence au composant et attendez-vous à ce que le composant transmette cette référence au noeud DOM sous-jacent. Given that many of the interactive components rely on `ButtonBase`, you should be able to take advantage of it everywhere. - -Voici un exemple d'intégration [avec react-router](/guides/composition/#button). +One frequent use case is to perform navigation on the client only, without an HTTP round-trip to the server. Le composant `ButtonBase` fournit la propriété `composante` pour gérer ce cas d'utilisation. Voici un [guide plus détaillé](/guides/routing/#button). ## Limites @@ -121,7 +132,7 @@ Le composant ButtonBase définit `pointer-événements : none;` sur les boutons Si vous souhaitez utiliser `non-autorisé`, vous avez deux options : -1. **CSS seulement**. Vous pouvez supprimer le style d'événements du pointeur sur l'état désactivé de l'élément ` - - Subscribe + + Subscribe To subscribe to this website, please enter your email address here. We diff --git a/docs/src/pages/components/dialogs/FormDialog.tsx b/docs/src/pages/components/dialogs/FormDialog.tsx index e10a47a8b91b48..67973da527c79c 100644 --- a/docs/src/pages/components/dialogs/FormDialog.tsx +++ b/docs/src/pages/components/dialogs/FormDialog.tsx @@ -23,8 +23,8 @@ export default function FormDialog() { - - Subscribe + + Subscribe To subscribe to this website, please enter your email address here. We diff --git a/docs/src/pages/components/dialogs/MaxWidthDialog.js b/docs/src/pages/components/dialogs/MaxWidthDialog.js index f125ae51ef527d..6270abf7cd0a78 100644 --- a/docs/src/pages/components/dialogs/MaxWidthDialog.js +++ b/docs/src/pages/components/dialogs/MaxWidthDialog.js @@ -44,9 +44,8 @@ export default function MaxWidthDialog() { maxWidth={maxWidth} open={open} onClose={handleClose} - aria-labelledby="max-width-dialog-title" > - Optional sizes + Optional sizes You can set my maximum width and whether to adapt or not. diff --git a/docs/src/pages/components/dialogs/MaxWidthDialog.tsx b/docs/src/pages/components/dialogs/MaxWidthDialog.tsx index 97ff275134ab2e..15080d80c612db 100644 --- a/docs/src/pages/components/dialogs/MaxWidthDialog.tsx +++ b/docs/src/pages/components/dialogs/MaxWidthDialog.tsx @@ -44,9 +44,8 @@ export default function MaxWidthDialog() { maxWidth={maxWidth} open={open} onClose={handleClose} - aria-labelledby="max-width-dialog-title" > - Optional sizes + Optional sizes You can set my maximum width and whether to adapt or not. diff --git a/docs/src/pages/components/dialogs/SimpleDialog.js b/docs/src/pages/components/dialogs/SimpleDialog.js index 72c19813bcc124..5250b4b7508beb 100644 --- a/docs/src/pages/components/dialogs/SimpleDialog.js +++ b/docs/src/pages/components/dialogs/SimpleDialog.js @@ -27,8 +27,8 @@ function SimpleDialog(props) { }; return ( - - Set backup account + + Set backup account {emails.map((email) => ( handleListItemClick(email)} key={email}> diff --git a/docs/src/pages/components/dialogs/SimpleDialog.tsx b/docs/src/pages/components/dialogs/SimpleDialog.tsx index 6e21fe9c3a1096..c07281e14714e7 100644 --- a/docs/src/pages/components/dialogs/SimpleDialog.tsx +++ b/docs/src/pages/components/dialogs/SimpleDialog.tsx @@ -32,8 +32,8 @@ function SimpleDialog(props: SimpleDialogProps) { }; return ( - - Set backup account + + Set backup account {emails.map((email) => ( handleListItemClick(email)} key={email}> diff --git a/docs/src/pages/components/dialogs/dialogs-fr.md b/docs/src/pages/components/dialogs/dialogs-fr.md index dcb565a7e4b93d..e37542435cfc52 100644 --- a/docs/src/pages/components/dialogs/dialogs-fr.md +++ b/docs/src/pages/components/dialogs/dialogs-fr.md @@ -1,5 +1,5 @@ --- -title: React Dialog component +title: Composent React Dialog components: Dialog, DialogTitle, DialogContent, DialogContentText, DialogActions, Slide githubLabel: 'component: Dialog' materialDesign: https://material.io/components/dialogs @@ -41,7 +41,7 @@ N'utiliser les alertes de la barre de titre que pour les situations à haut risq Si un titre est requis: - Utilisez une question ou une déclaration claire avec une explication dans la zone de contenu, telle que "Effacer le stockage USB?". -- Avoid apologies, ambiguity, or questions, such as "Warning!" or "Are you sure?" +- Évitez l'utilisation de Dialog pour des questions telles que « Avertissement ! » ou "Êtes-vous sûr ?" {{"demo": "pages/components/dialogs/AlertDialog.js"}} @@ -71,7 +71,7 @@ La boîte de dialogue a un bouton de fermeture ajouté pour faciliter l'utilisat ## Tailles en option -Vous pouvez définir une largeur maximale dans la boîte de dialogue à l’aide de la valeur `maxWidth`, associée à la valeur `fullWidth`. Lorsque la propriété `fullWidth` est définie sur true, la boîte de dialogue s'adapte en fonction de la valeur `maxWidth`. +Vous pouvez définir une largeur maximale dans la boîte de dialogue à l’aide de la valeur `maxWidth`, associée à la valeur `fullWidth`. Lorsque la propriété `fullWidth` est définie à `true`, le Dialog s'adapte en fonction de la valeur `maxWidth`. {{"demo": "pages/components/dialogs/MaxWidthDialog.js"}} @@ -94,9 +94,9 @@ function MyComponent() { ## Dialogues de confirmation -Les dialogues de confirmation demandent aux utilisateurs de confirmer explicitement leur choix avant la validation d'une option. For example, users can listen to multiple ringtones but only make a final selection upon touching "OK". +Les dialogues de confirmation demandent aux utilisateurs de confirmer explicitement leur choix avant la validation d'une option. Par exemple dans le cas suivant, les utilisateurs peuvent écouter plusieurs sonneries, mais au final, ils peuvent seulement sélectionner une seule option en appuyant sur 'OK'. -Touching "Cancel" in a confirmation dialog, or pressing Back, cancels the action, discards any changes, and closes the dialog. +Appuyer sur “Annuler” dans un Dialog de confirmation, cela va annuler l'action, annuler les modifications et fermer le Dialog. {{"demo": "pages/components/dialogs/ConfirmationDialog.js"}} @@ -108,7 +108,7 @@ Vous pouvez créer une boîte de dialogue déplaçable à l’aide de [react-dra ## Défiler de longues contenu -When dialogs become too long for the user's viewport or device, they scroll. +Lorsque les Dialogs deviennent trop longues pour la fenêtre ou l'écran d'utilisateur, ils peuvent être défilés. - `scroll=paper` le contenu de la boîte de dialogue défile dans l'élément de papier. - `scroll=body` le contenu de la boîte de dialogue défile dans l'élément body. @@ -119,7 +119,7 @@ Essayez la démo ci-dessous pour voir ce que nous voulons dire: ## Performances -Suivez la [section de performance de la Modal](/components/modal/#performance). +Suivez la section de performance du [ Modal](/components/modal/#performance). ## Limites diff --git a/docs/src/pages/components/dialogs/dialogs-ja.md b/docs/src/pages/components/dialogs/dialogs-ja.md index b8742acbacab69..2bcdf3a0e2fb97 100644 --- a/docs/src/pages/components/dialogs/dialogs-ja.md +++ b/docs/src/pages/components/dialogs/dialogs-ja.md @@ -1,5 +1,5 @@ --- -title: React Dialog component +title: React Dialog コンポーネント components: Dialog, DialogTitle, DialogContent, DialogContentText, DialogActions, Slide githubLabel: 'component: Dialog' materialDesign: https://material.io/components/dialogs @@ -10,7 +10,7 @@ waiAria: 'https://www.w3.org/TR/wai-aria-practices/#dialog_modal'

    ダイアログは、タスクについてユーザーに通知します。重要な情報を含める、決定を求める、または複数のタスクを伴うことができます。

    -[ダイアログ](https://material.io/design/components/dialogs.html) は、重要な情報を提供したり決定を求めたりするために、アプリのコンテンツの前に表示される [モーダル](/components/modal/) ウィンドウの一種です。 ダイアログは表示されるとアプリのすべての機能を無効にし、確認、却下、または必要な操作が行われるまで画面に表示されたままになります。 +Dialogは、重要な情報を提供したり決定を求めたりするために、アプリのコンテンツの前に表示される [モーダル](/components/modal/) ウィンドウの一種です。 ダイアログは表示されるとアプリのすべての機能を無効にし、確認、却下、または必要な操作が行われるまで画面に表示されたままになります。 ダイアログは意図的に中断されるので、慎重にに使用する必要があります。 @@ -41,7 +41,7 @@ waiAria: 'https://www.w3.org/TR/wai-aria-practices/#dialog_modal' タイトルは必須入力です。 - 「USBストレージを消去しますか?」など、内容領域に明確な質問や説明を入力します。 -- Avoid apologies, ambiguity, or questions, such as "Warning!" or "Are you sure?" +- 「警告」や「よろしいですか」などの謝罪、あいまいさ、または質問を避けます。 {{"demo": "pages/components/dialogs/AlertDialog.js"}} @@ -59,7 +59,7 @@ waiAria: 'https://www.w3.org/TR/wai-aria-practices/#dialog_modal' ## Customized dialogs -コンポーネントのカスタマイズ例を次に示します。 詳細については、 [overrides documentation page](/customization/how-to-customize/)を参照してください。 +コンポーネントのカスタマイズ例を次に示します。 詳細については、 [こちら](/customization/how-to-customize/)を参照してください。 ダイアログボックスには、操作性を高めるために閉じるボタンが追加されています。 @@ -94,21 +94,21 @@ function MyComponent() { ## 確認ダイアログ -確認ダイアログでは、オプションを確定する前にユーザーが選択内容を明示的に確認する必要があります。 For example, users can listen to multiple ringtones but only make a final selection upon touching "OK". +確認ダイアログでは、オプションを確定する前にユーザーが選択内容を明示的に確認する必要があります。 たとえば、着信音選択ダイアログでユーザーはさまざまな着信音を聞くことができますが、「OK」ボタンをクリックした後にのみ、選択が完了したことを意味します。 -Touching "Cancel" in a confirmation dialog, or pressing Back, cancels the action, discards any changes, and closes the dialog. +確認ダイアログで「キャンセル」をタッチするか、「戻る」を押して操作をキャンセルすると、変更を破棄してダイアログを閉じます。 {{"demo": "pages/components/dialogs/ConfirmationDialog.js"}} ## ドラッグ可能なダイアログ -[react-draggable](https://github.com/mzabriskie/react-draggable)を使用して、ドラッグ可能なダイアログを作成できます。 [react-draggable](https://github.com/mzabriskie/react-draggable)を使用して、ドラッグ可能なダイアログを作成できます。 これを行うには、インポートした`Draggable`コンポーネントを `Dialog` コンポーネントの`PaperComponent` として渡します。 これによりダイアログ全体がドラッグ可能になります。 これによりダイアログ全体がドラッグ可能になります。 これを行うには、インポートした`Draggable`コンポーネントを `Dialog` コンポーネントの`PaperComponent` として渡します。 これによりダイアログ全体がドラッグ可能になります。 +[react-draggable](https://github.com/mzabriskie/react-draggable)を使用して、ドラッグ可能なダイアログを作成できます。 [react-draggable](https://github.com/mzabriskie/react-draggable)を使用して、ドラッグ可能なダイアログを作成できます。 これを行うには、インポートした`Draggable`コンポーネントを `Dialog` コンポーネントの`PaperComponent` として渡します。 これによりダイアログ全体がドラッグ可能になります。 これによりダイアログ全体がドラッグ可能になります。 [react-draggable](https://github.com/mzabriskie/react-draggable)を使用して、ドラッグ可能なダイアログを作成できます。 これを行うには、インポートした`Draggable`コンポーネントを `Dialog` コンポーネントの`PaperComponent` として渡します。 これによりダイアログ全体がドラッグ可能になります。 これによりダイアログ全体がドラッグ可能になります。 [react-draggable](https://github.com/mzabriskie/react-draggable)を使用して、ドラッグ可能なダイアログを作成できます。 これを行うには、インポートした`Draggable`コンポーネントを `Dialog` コンポーネントの`PaperComponent` として渡します。 これによりダイアログ全体がドラッグ可能になります。 これによりダイアログ全体がドラッグ可能になります。 [react-draggable](https://github.com/mzabriskie/react-draggable)を使用して、ドラッグ可能なダイアログを作成できます。 これを行うには、インポートした`Draggable`コンポーネントを `Dialog` コンポーネントの`PaperComponent` として渡します。 これによりダイアログ全体がドラッグ可能になります。 これによりダイアログ全体がドラッグ可能になります。 これを行うには、インポートした`Draggable`コンポーネントを `Dialog` コンポーネントの`PaperComponent` として渡します。 これによりダイアログ全体がドラッグ可能になります。 {{"demo": "pages/components/dialogs/DraggableDialog.js"}} ## 長いコンテンツをスクロールする -When dialogs become too long for the user's viewport or device, they scroll. +ビューポートやデバイスに対してダイアログが長くなりすぎると、スクロールします。 - `scroll=paper`: paper要素内でダイアログボックスの内容がスクロールします。 - `scroll=body`: ダイアログの内容がbody要素内をスクロールします。 @@ -119,7 +119,7 @@ When dialogs become too long for the user's viewport or device, they scroll. ## パフォーマンス -Follow the [Modal performance section](/components/modal/#performance). +[Modal performance セクション](/components/modal/#performance) に従ってください。 ## 制限事項 diff --git a/docs/src/pages/components/dialogs/dialogs-pt.md b/docs/src/pages/components/dialogs/dialogs-pt.md index db865b20a5f268..988d8f064b4723 100644 --- a/docs/src/pages/components/dialogs/dialogs-pt.md +++ b/docs/src/pages/components/dialogs/dialogs-pt.md @@ -1,5 +1,5 @@ --- -title: Componente React para Diálogos +title: Componente Diálogo para React components: Dialog, DialogTitle, DialogContent, DialogContentText, DialogActions, Slide githubLabel: 'component: Dialog' materialDesign: https://material.io/components/dialogs @@ -10,7 +10,7 @@ waiAria: 'https://www.w3.org/TR/wai-aria-practices/#dialog_modal'

    Diálogos informam aos usuários sobre uma tarefa e podem conter informações críticas, exigir decisões ou envolver várias tarefas.

    -Uma caixa de [Diálogo](https://material.io/design/components/dialogs.html) é um tipo de janela [modal](/components/modal/) que aparece na frente do conteúdo do aplicativo para fornecer informações críticas ou solicitar uma decisão. As caixas de diálogo desativam toda a funcionalidade do aplicativo quando elas são exibidas e permanecem na tela até que sejam confirmadas, rejeitadas ou que uma ação necessária tenha sido executada. +Um Diálogo é um tipo de janela [modal](/components/modal/) que aparece na frente do conteúdo do aplicativo para fornecer informações críticas ou solicitar uma decisão. As caixas de diálogo desativam toda a funcionalidade do aplicativo quando elas são exibidas e permanecem na tela até que sejam confirmadas, rejeitadas ou que uma ação necessária tenha sido executada. Os diálogos são intencionalmente interruptivos, então eles devem ser usados com moderação. @@ -108,7 +108,7 @@ Você pode criar um diálogo arrastável usando [react-draggable](https://github ## Rolagem de conteúdo longo -When dialogs become too long for the user's viewport or device, they scroll. +Quando diálogos ficam muito grandes para a tela do usuário ou dispositivo, a rolagem é habilitada. - `scroll=paper` o conteúdo do diálogo rola dentro do elemento. - `scroll=body` o conteúdo do diálogo rola dentro do corpo da página. @@ -119,7 +119,7 @@ Experimente a demonstração abaixo para ver o que queremos dizer: ## Performance -Siga a seção [Performance Modal](/components/modal/#performance). +Veja a seção [Performance Modal](/components/modal/#performance). ## Limitações diff --git a/docs/src/pages/components/dialogs/dialogs-ru.md b/docs/src/pages/components/dialogs/dialogs-ru.md index d117232ada3596..bb9d3f9f2e8140 100644 --- a/docs/src/pages/components/dialogs/dialogs-ru.md +++ b/docs/src/pages/components/dialogs/dialogs-ru.md @@ -59,7 +59,7 @@ Use title bar alerts only for high-risk situations, such as the potential loss o ## Индивидуальные диалоги -Ниже находится пример кастомизации компонента. You can learn more about this in the [overrides documentation page](/customization/how-to-customize/). +Ниже находится пример кастомизации компонента. Вы можете узнать об этом больше [в документации по переопределению свойств](/customization/how-to-customize/). Данный диалог имеет кнопку закрытия, добавленную для удобства использования. @@ -96,7 +96,7 @@ function MyComponent() { Диалоги подтверждения требуют, чтобы пользователи явно подтвердили свой выбор, прежде чем их выбор будет сохранен. For example, users can listen to multiple ringtones but only make a final selection upon touching "OK". -Touching "Cancel" in a confirmation dialog, or pressing Back, cancels the action, discards any changes, and closes the dialog. +Нажатие кнопки «Отмена» в диалоговом окне подтверждения или нажатие кнопки «Назад» отменяет действие и отменяет любые изменения, закрывая диалоговое окно. {{"demo": "pages/components/dialogs/ConfirmationDialog.js"}} diff --git a/docs/src/pages/components/dialogs/dialogs-zh.md b/docs/src/pages/components/dialogs/dialogs-zh.md index c582ef4598cdc8..f030bee3c91864 100644 --- a/docs/src/pages/components/dialogs/dialogs-zh.md +++ b/docs/src/pages/components/dialogs/dialogs-zh.md @@ -96,7 +96,7 @@ function MyComponent() { 确认型对话框明确要求用户在提交选项之前确认他们的选择。 举个例子,用户可以听到多种铃声,但是只有在点击 “OK” 按钮后才意味着完成了选择。 -Touching "Cancel" in a confirmation dialog, or pressing Back, cancels the action, discards any changes, and closes the dialog. +在确认对话框中点按“取消”或“返回(Back)”键,可取消操作,放弃任何更改,并关闭对话框。 {{"demo": "pages/components/dialogs/ConfirmationDialog.js"}} @@ -108,7 +108,7 @@ Touching "Cancel" in a confirmation dialog, or pressing Back, cancels the action ## 长内容滚动 -When dialogs become too long for the user's viewport or device, they scroll. +当对话框相对于用户的视口或设备来说太长时,它们就可以滚动。 - 使用 `scroll=paper`,对话框的内容能在 paper 元素中滚动。 - 使用 `scroll=body`,对话框的内容能在 body 元素中滚动。 @@ -119,7 +119,7 @@ When dialogs become too long for the user's viewport or device, they scroll. ## 性能 -参考 [模态框性能部分](/components/modal/#performance)。 +参考[对话框性能部分](/components/modal/#performance)。 ## 设计局限 diff --git a/docs/src/pages/components/dividers/dividers-de.md b/docs/src/pages/components/dividers/dividers-de.md index 69e3a6e5e7de5d..728e941aea6ce9 100644 --- a/docs/src/pages/components/dividers/dividers-de.md +++ b/docs/src/pages/components/dividers/dividers-de.md @@ -49,6 +49,12 @@ Sie können einen Trenner auch vertikal mit der `orientation` prop rendern. > Note the use of the `flexItem` prop to accommodate for the flex container. +### Vertical with variant middle + +You can also render a vertical divider with `variant="middle"`. + +{{"demo": "pages/components/dividers/VerticalDividerMiddle.js", "bg": true}} + ### Vertical with text You can also render a vertical divider with content. diff --git a/docs/src/pages/components/dividers/dividers-es.md b/docs/src/pages/components/dividers/dividers-es.md index 7589fdacc8c009..6b3d8e48338969 100644 --- a/docs/src/pages/components/dividers/dividers-es.md +++ b/docs/src/pages/components/dividers/dividers-es.md @@ -49,6 +49,12 @@ Puede también renderizar un divisor vertical usando la propiedad `orientation`. > Tenga en cuenta el uso del accesorio `flexItem` para acomodar al contenedor flex. +### Vertical with variant middle + +You can also render a vertical divider with `variant="middle"`. + +{{"demo": "pages/components/dividers/VerticalDividerMiddle.js", "bg": true}} + ### Vertical with text You can also render a vertical divider with content. diff --git a/docs/src/pages/components/dividers/dividers-fr.md b/docs/src/pages/components/dividers/dividers-fr.md index e7d6a809b05748..1ace47b0c448f1 100644 --- a/docs/src/pages/components/dividers/dividers-fr.md +++ b/docs/src/pages/components/dividers/dividers-fr.md @@ -1,5 +1,5 @@ --- -title: React Divider component +title: Composant React Divider components: Divider githubLabel: 'component: Divider' materialDesign: https://material.io/components/dividers @@ -35,22 +35,28 @@ Dans une liste, vous devez vous assurer que le `Divider` est rendu en tant que ` {{"demo": "pages/components/dividers/MiddleDividers.js", "bg": true}} -## Vertical Dividers +## Diviseurs avec texte -You can also render a divider with content. +Vous pouvez également rendre un séparateur avec le contenu. {{"demo": "pages/components/dividers/DividerText.js"}} -## Vertical divider +## Séparateurs verticaux Vous pouvez également rendre un séparateur verticalement en utilisant la propriété `orientation`. {{"demo": "pages/components/dividers/VerticalDividers.js", "bg": true}} -> Note the use of the `flexItem` prop to accommodate for the flex container. +> Notez l'utilisation de l'accessoire `flexItem` pour accueillir le conteneur flex. -### Vertical with text +### Vertical with variant middle -You can also render a vertical divider with content. +You can also render a vertical divider with `variant="middle"`. + +{{"demo": "pages/components/dividers/VerticalDividerMiddle.js", "bg": true}} + +### Vertical avec texte + +Vous pouvez également rendre un séparateur avec le contenu. {{"demo": "pages/components/dividers/VerticalDividerText.js"}} diff --git a/docs/src/pages/components/dividers/dividers-ja.md b/docs/src/pages/components/dividers/dividers-ja.md index 74a1276aea70cc..dee690c907eb1a 100644 --- a/docs/src/pages/components/dividers/dividers-ja.md +++ b/docs/src/pages/components/dividers/dividers-ja.md @@ -9,19 +9,19 @@ materialDesign: https://material.io/components/dividers

    Divider(区切り線) は、リストおよびレイアウトのコンテンツをグループ化する細い線です。

    -[Dividers](https://material.io/design/components/dividers.html) は、内容を明確なグループに分けます。 +Dividers は、内容を明確なグループに分けます。 {{"component": "modules/components/ComponentLinkHeader.js"}} ## List Dividers -Note the use of the `flexItem` prop to accommodate for the flex container. このDOM要素のレンダリングを節約するには、 `ListItem` コンポーネントの `divider` プロパティを使用します。 +Dividerはデフォルトで `
    ` としてレンダリングされることに注意してください。 このDOM要素のレンダリングを節約するには、 `ListItem` コンポーネントの `divider` プロパティを使用します。 {{"demo": "pages/components/dividers/ListDividers.js", "bg": true}} ## HTML5仕様 -In a list, you should ensure the `Divider` is rendered as an `
  • ` to match the HTML5 specification. 次の例は、これを実現する2つの方法を示しています。 +リストでは、HTML5の仕様に合うように、 `Divider` が `
  • ` としてレンダリングされていることを確認すべきです。 次の例は、これを実現する2つの方法を示しています。 ## Inset Dividers @@ -37,20 +37,26 @@ In a list, you should ensure the `Divider` is rendered as an `
  • ` to match the ## Vertical Dividers -You can also render a divider with content. +内容があるDividerを表示することもできます。 {{"demo": "pages/components/dividers/DividerText.js"}} ## Divider (区切り線) -You can also render a divider vertically using the `orientation` prop. +`orientation` プロパティを使用してDividerを垂直に表示することもできます。 {{"demo": "pages/components/dividers/VerticalDividers.js", "bg": true}} -> Note the use of the `flexItem` prop to accommodate for the flex container. +> flex コンテナに対応するために `flexItem` プロパティを使用することに注意してください。 -### Vertical with text +### Vertical with variant middle -You can also render a vertical divider with content. +You can also render a vertical divider with `variant="middle"`. + +{{"demo": "pages/components/dividers/VerticalDividerMiddle.js", "bg": true}} + +### テキスト付きの垂直Divider + +垂直Dividerを内容付きで表示することもできます。 {{"demo": "pages/components/dividers/VerticalDividerText.js"}} diff --git a/docs/src/pages/components/dividers/dividers-pt.md b/docs/src/pages/components/dividers/dividers-pt.md index 5a1d57fffff0c6..50326a67d638d7 100644 --- a/docs/src/pages/components/dividers/dividers-pt.md +++ b/docs/src/pages/components/dividers/dividers-pt.md @@ -49,6 +49,12 @@ Você pode renderizar um divisor vertical usando a propriedade `orientation`. > Observe o uso da propriedade `flexItem` para acomodar em um contêiner flexível. +### Vertical with variant middle + +You can also render a vertical divider with `variant="middle"`. + +{{"demo": "pages/components/dividers/VerticalDividerMiddle.js", "bg": true}} + ### Vertical com texto Você também pode renderizar um divisor vertical com conteúdo. diff --git a/docs/src/pages/components/dividers/dividers-ru.md b/docs/src/pages/components/dividers/dividers-ru.md index 27cd0fc6e0a53d..75c4062c8bbc22 100644 --- a/docs/src/pages/components/dividers/dividers-ru.md +++ b/docs/src/pages/components/dividers/dividers-ru.md @@ -27,7 +27,7 @@ In a list, you should ensure the `Divider` is rendered as an `
  • ` to match the {{"demo": "pages/components/dividers/InsetDividers.js", "bg": true}} -## Подтитульные разделлители +## Подтитульные разделители {{"demo": "pages/components/dividers/SubheaderDividers.js", "bg": true}} @@ -49,7 +49,13 @@ You can also render a divider vertically using the `orientation` prop. > Note the use of the `flexItem` prop to accommodate for the flex container. -### Vertical with text +### Vertical with variant middle + +You can also render a vertical divider with `variant="middle"`. + +{{"demo": "pages/components/dividers/VerticalDividerMiddle.js", "bg": true}} + +### Вертикальный с текстом You can also render a vertical divider with content. diff --git a/docs/src/pages/components/dividers/dividers-zh.md b/docs/src/pages/components/dividers/dividers-zh.md index 01ae3ce1b2439f..c43c4140623cb8 100644 --- a/docs/src/pages/components/dividers/dividers-zh.md +++ b/docs/src/pages/components/dividers/dividers-zh.md @@ -49,6 +49,12 @@ materialDesign: https://material.io/components/dividers > 请注意这其中使用了 `flexItem` 属性来适应 flex 容器。 +### Vertical with variant middle + +You can also render a vertical divider with `variant="middle"`. + +{{"demo": "pages/components/dividers/VerticalDividerMiddle.js", "bg": true}} + ### 垂直的文本分隔线 你也可以使用文本内容来渲染垂直的分隔线。 diff --git a/docs/src/pages/components/drawers/drawers-de.md b/docs/src/pages/components/drawers/drawers-de.md index 97bffbb6effd10..14687adb45ce36 100644 --- a/docs/src/pages/components/drawers/drawers-de.md +++ b/docs/src/pages/components/drawers/drawers-de.md @@ -68,7 +68,7 @@ More details in the [Modal performance section](/components/modal/#performance). ## Responsive Navigationsleiste -Die `Hidden` Responsive-Hilfskomponente ermöglicht die Anzeige verschiedener Leistentypen in Abhängigkeit von der Bildschirmbreite. Eine `temporäre` Leiste wird für kleine Bildschirme angezeigt, während eine `permanente` Leiste für breitere Bildschirme angezeigt wird. +You can use the `temporary` variant to display a drawer for small screens and `permanent` for a drawer for wider screens. {{"demo": "pages/components/drawers/ResponsiveDrawer.js", "iframe": true}} diff --git a/docs/src/pages/components/drawers/drawers-es.md b/docs/src/pages/components/drawers/drawers-es.md index 0884fc08a0b025..99d85ee94baf05 100644 --- a/docs/src/pages/components/drawers/drawers-es.md +++ b/docs/src/pages/components/drawers/drawers-es.md @@ -68,7 +68,7 @@ More details in the [Modal performance section](/components/modal/#performance). ## Drawer responsivo -El componente utilitario responsivo `Hidden` permite mostrar diferentes tipos de cajones dependiendo del ancho de la pantalla. Un Drawer `temporary` se muestra para pantallas pequeñas mientras que un Drawer `permanent` se muestra para pantallas mas anchas. +You can use the `temporary` variant to display a drawer for small screens and `permanent` for a drawer for wider screens. {{"demo": "pages/components/drawers/ResponsiveDrawer.js", "iframe": true}} diff --git a/docs/src/pages/components/drawers/drawers-fr.md b/docs/src/pages/components/drawers/drawers-fr.md index 25aca551692046..a51c6d159a788e 100644 --- a/docs/src/pages/components/drawers/drawers-fr.md +++ b/docs/src/pages/components/drawers/drawers-fr.md @@ -1,5 +1,5 @@ --- -title: React Drawer component +title: Composant React Drawer components: Drawer, SwipeableDrawer githubLabel: 'component: Drawer' materialDesign: https://material.io/components/navigation-drawer @@ -9,31 +9,31 @@ materialDesign: https://material.io/components/navigation-drawer

    Les tiroirs de navigation permettent d'accéder aux destinations de votre application. Les feuilles latérales sont des surfaces contenant du contenu supplémentaire ancré au bord gauche ou droit de l'écran.

    -[Navigation drawers](https://material.io/design/components/navigation-drawer.html) (or "sidebars") provide access to destinations and app functionality, such as switching accounts. They can either be permanently on-screen or controlled by a navigation menu icon. +[Navigation drawers](https://material.io/design/components/navigation-drawer.html) (or "sidebars") permettent d'accéder aux destinations et aux fonctionnalités de l'application, telles que le changement de compte. Ils peuvent être : soit affichés en permanence à l'écran, soit contrôlés par une une icône de menu de navigation -[Side sheets](https://material.io/design/components/sheets-side.html) are supplementary surfaces primarily used on tablet and desktop. +[Side sheets](https://material.io/design/components/sheets-side.html) (appelé: "Les feuilles latérales") sont des surfaces supplémentaires principalement utilisées sur les tablettes et les ordinateurs de bureau. {{"component": "modules/components/ComponentLinkHeader.js"}} ## Tiroir temporaire -Temporary navigation drawers can toggle open or closed. Closed by default, the drawer opens temporarily above all other content until a section is selected. +Les drawers de navigation temporaire peuvent activer l'ouverture ou la fermeture. Fermés par défaut, le drawer s'ouvre temporairement au dessus de tout autre contenu jusqu'à qu'une section soit sélectionnée. -The Drawer can be cancelled by clicking the overlay or pressing the Esc key. It closes when an item is selected, handled by controlling the `open` prop. +Le drawer peut être annulé en cliquant ailleurs dans la zone sombre ou en appuyant sur la touche Échap. Il se ferme quand un élément est sélectionné et est géré par le contrôle de la propriété `open`. {{"demo": "pages/components/drawers/TemporaryDrawer.js"}} -### Swipeable +### Swipeable (glissable) You can make the drawer swipeable with the `SwipeableDrawer` component. -This component comes with a 2 kB gzipped payload overhead. Some low-end mobile devices won't be able to follow the fingers at 60 FPS. You can use the `disableBackdropTransition` property to help. +Ce composant est livré avec une charge utile gzip de 2 kB. Certains appareils mobiles bas de gamme ne peuvent pas suivre les doigts à 60 FPS. Vous pouvez utiliser le prop `disableBackdropTransition` pour vous aider. {{"demo": "pages/components/drawers/SwipeableTemporaryDrawer.js"}} -The following properties are used in this documentation website for optimal usability of the component: +Les propriétés suivantes sont utilisées dans la documentation du site pour une utilisation optimale du composant: -- iOS is hosted on high-end devices. The performance will be good enough. The backdrop transition can be enabled without dropping frames. +- iOS est hébergé sur des appareils haut de gamme. The performance will be good enough. The backdrop transition can be enabled without dropping frames. - iOS has a "swipe to go back" feature that interferes with the discovery feature, so discovery has to be disabled. ```jsx @@ -43,17 +43,17 @@ const iOS = ; ``` -### Swipeable edge +### Bord glissant -You can configure the `SwipeableDrawer` to have a visible edge when closed. +Vous pouvez configurer le `SwipeableDrawer` pour avoir un bord visible lorsqu'il est fermé. -If you are on a desktop, you can toggle the drawer with the "OPEN" button. If you are on mobile, you can open the demo in CodeSandbox ("edit" icon) and swipe. +Si vous êtes sur un bureau, vous pouvez basculer le tiroir avec le bouton "OUVERT". Si vous êtes sur mobile, vous pouvez ouvrir la démo dans CodeSandbox (icône "modifier") et glisser. {{"demo": "pages/components/drawers/SwipeableEdgeDrawer.js", "iframe": true, "height": 400, "maxWidth": 300}} -### Keep mounted +### Garder monté -To ensure a temporary drawer is not unmounted, specify the `ModalProps` prop like: +Pour vous assurer qu'un tiroir temporaire n'est pas démonté, spécifiez la prop `ModalProps` comme : ```jsx ``` -More details in the [Modal performance section](/components/modal/#performance). +Plus de détails dans la [section Performances modales](/components/modal/#performance). -## Responsive drawer +## Tiroir adaptatif -The `Hidden` responsive helper component allows showing different types of drawer depending on the screen width. A `temporary` drawer is shown for small screens while a `permanent` drawer is shown for wider screens. +A `temporary` drawer is shown for small screens while a `permanent` drawer is shown for wider screens. {{"demo": "pages/components/drawers/ResponsiveDrawer.js", "iframe": true}} @@ -94,9 +94,9 @@ The mini variant is recommended for apps sections that need quick selection acce ## Tiroir permanent -Permanent navigation drawers are always visible and pinned to the left edge, at the same elevation as the content or background. They cannot be closed. +Les tiroirs de navigation permanents sont toujours visibles et épinglés au bord gauche, à la même altitude que le contenu ou l'arrière-plan. Ils ne peuvent pas être fermés. -Applications axées sur la consommation d'informations utilisant une hiérarchie de gauche à droite. +Les tiroirs de navigation permanents sont les **recommandés par défaut pour le bureau**. ### Navigation pleine hauteur diff --git a/docs/src/pages/components/drawers/drawers-ja.md b/docs/src/pages/components/drawers/drawers-ja.md index 078cd6731f8400..c9d4447895d047 100644 --- a/docs/src/pages/components/drawers/drawers-ja.md +++ b/docs/src/pages/components/drawers/drawers-ja.md @@ -9,7 +9,7 @@ materialDesign: https://material.io/components/navigation-drawer

    ナビゲーションドロワー(Drawer) を使用すると、App内の目的地にアクセスできます。 サイドシートは、画面の左端または右端にアンカーされた補足コンテンツを含むサーフェスです。

    -[ナビゲーション・ドロワー](https://material.io/design/components/navigation-drawer.html)(または「サイドバー」)は、目的地へのアクセスとアカウントの切り替えなどのアプリケーション機能を提供します。 これらは、画面上で永続的に表示することも、ナビゲーション・メニュー・アイコンで制御することもできます。 +ナビゲーション・ドロワー(または「サイドバー」)は、目的地へのアクセスとアカウントの切り替えなどのアプリケーション機能を提供します。 これらは、画面上で永続的に表示することも、ナビゲーション・メニュー・アイコンで制御することもできます。 [サイドシート](https://material.io/design/components/sheets-side.html) は、主にタブレットやデスクトップで使用される補助サーフェスです。 @@ -33,8 +33,8 @@ materialDesign: https://material.io/components/navigation-drawer このドキュメントのWebサイトでは、コンポーネントの操作性を最適化するために、次のプロパティが使用されています。 -- iOSはハイエンドデバイスでホストされています。 iOSはハイエンドデバイスでホストされています。 The backdrop transition can be enabled without dropping frames. 性能は十分良いでしょう。 -- iOS has a "swipe to go back" feature that interferes with the discovery feature, so discovery has to be disabled. +- iOSはハイエンドデバイスでホストされています。 背景トランジションはフレームが落ちることなしに有効にできます。 性能は十分良いでしょう。 +- iOSには、ディスカバリー機能を妨害する「スワイプして戻る」機能があるため、ディスカバリーを無効にする必要があります。 ```jsx const iOS = @@ -43,17 +43,17 @@ const iOS = ; ``` -### Swipeable edge +### スワイプ可能なエッジ -You can configure the `SwipeableDrawer` to have a visible edge when closed. +`SwipeableDrawer` を閉じたときにエッジが表示されるように設定することができます。 -If you are on a desktop, you can toggle the drawer with the "OPEN" button. If you are on mobile, you can open the demo in CodeSandbox ("edit" icon) and swipe. +デスクトップでは、「OPEN」ボタンでドロワーを切り替えることができます。 モバイルでは、CodeSandbox(編集アイコン)でデモを開き、スワイプできます。 {{"demo": "pages/components/drawers/SwipeableEdgeDrawer.js", "iframe": true, "height": 400, "maxWidth": 300}} -### Keep mounted +### マウントしたままにする -To ensure a temporary drawer is not unmounted, specify the `ModalProps` prop like: +一時的な引き出しがアンマウントされないようにするには、 `ModalProps` のプロパティを次のように指定します。 ```jsx ``` -More details in the [Modal performance section](/components/modal/#performance). +詳細については、 [Modal performance section](/components/modal/#performance) を参照してください。 ## レスポンシブなドロワー -`Hidden`対応ヘルパーコンポーネントを使用すると、画面の幅に応じてさまざまな種類のドロワーを表示できます。 小さな画面では `temporary` ドロワーが表示され、大きな画面では `permanent` ドロワーが表示されます。 +You can use the `temporary` variant to display a drawer for small screens and `permanent` for a drawer for wider screens. {{"demo": "pages/components/drawers/ResponsiveDrawer.js", "iframe": true}} @@ -96,7 +96,7 @@ More details in the [Modal performance section](/components/modal/#performance). 固定ナビゲーションdrawersは常に表示され、コンテンツまたは背景と同じ高さの左端に固定されます。 それらを閉じることはできません。 -アプリケーションは、左から右への階層を使用する情報消費に重点を置いていました。 +固定ドロワーは、**デスクトップ**で推奨されるデフォルトです。 ### Full-height navigation(フルハイトナビゲーション) diff --git a/docs/src/pages/components/drawers/drawers-pt.md b/docs/src/pages/components/drawers/drawers-pt.md index d88fb1a25cb8dc..a5685d361aee70 100644 --- a/docs/src/pages/components/drawers/drawers-pt.md +++ b/docs/src/pages/components/drawers/drawers-pt.md @@ -1,5 +1,5 @@ --- -title: Componente React Drawer +title: Componente Drawer para React components: Drawer, SwipeableDrawer githubLabel: 'component: Drawer' materialDesign: https://material.io/components/navigation-drawer @@ -7,11 +7,11 @@ materialDesign: https://material.io/components/navigation-drawer # Drawer -

    A navegação por drawers fornece acessos para destinos dentro de sua aplicação. As folhas laterais são locais contendo o conteúdo suplementar que é ancorado do lado esquerdo ou direito da tela.

    +

    A navegação por drawers fornece acesso à partes dentro de sua aplicação. As seções laterais possuem o conteúdo suplementar que é vinculado do lado esquerdo ou direito da tela.

    -[Navegação por drawers](https://material.io/design/components/navigation-drawer.html) (ou "barras laterais") fornecem acesso a destinos e funcionalidades do aplicativo, como por exemplo, a mudança de usuário. Eles podem estar permanentemente na tela ou controlados por um ícone de menu de navegação. +A navegação por drawers (ou "barras laterais") fornecem acesso a partes e funcionalidades do aplicativo, como trocar de conta. Eles podem estar permanentemente na tela ou controlados por um ícone de menu de navegação. -[Folhas laterais](https://material.io/design/components/sheets-side.html) são superfícies complementares usadas principalmente em tablets e computadores. +[Seções laterais](https://material.io/design/components/sheets-side.html) são áreas complementares usadas principalmente em tablets e computadores. {{"component": "modules/components/ComponentLinkHeader.js"}} @@ -43,11 +43,11 @@ const iOS = ; ``` -### Manter montado +### Borda deslizável -Para garantir que um drawer temporário não seja desmontado, especifique a propriedade `ModalProps` como: +Você pode configurar a propriedade `SwipeableDrawer` para visualizar uma borda quando o Drawer estiver fechado. -If you are on a desktop, you can toggle the drawer with the "OPEN" button. If you are on mobile, you can open the demo in CodeSandbox ("edit" icon) and swipe. +Se você estiver em uma área de trabalho, poderá alternar o drawer com o botão "OPEN". Se estiver pelo celular, abra a demonstração no CodeSandbox (ícone "editar") e deslizar. {{"demo": "pages/components/drawers/SwipeableEdgeDrawer.js", "iframe": true, "height": 400, "maxWidth": 300}} @@ -68,7 +68,7 @@ Mais detalhes na [seção de desempenho Modal](/components/modal/#performance). ## Drawer responsivo -O componente responsivo `Hidden` auxilia na exibição de diferentes tipos de drawer, dependendo da largura da tela. Um drawer `temporary` é exibido para telas pequenas enquanto um drawer `permanent` é exibido para telas maiores. +You can use the `temporary` variant to display a drawer for small screens and `permanent` for a drawer for wider screens. {{"demo": "pages/components/drawers/ResponsiveDrawer.js", "iframe": true}} diff --git a/docs/src/pages/components/drawers/drawers-ru.md b/docs/src/pages/components/drawers/drawers-ru.md index e2a62aaac0ce1a..0e394044fcb9b0 100644 --- a/docs/src/pages/components/drawers/drawers-ru.md +++ b/docs/src/pages/components/drawers/drawers-ru.md @@ -68,7 +68,7 @@ More details in the [Modal performance section](/components/modal/#performance). ## Приспосабливающаяся панель -Адапивный дизайн может быть достигнут использованием компонента `Hidden`. `cкрытая` панель может быть показана для экранов с небольшим разрешением, тогда как `вполне видимая` панель будет показана на широких экранах. +You can use the `temporary` variant to display a drawer for small screens and `permanent` for a drawer for wider screens. {{"demo": "pages/components/drawers/ResponsiveDrawer.js", "iframe": true}} diff --git a/docs/src/pages/components/drawers/drawers-zh.md b/docs/src/pages/components/drawers/drawers-zh.md index 438c47a997bdf3..ad2c4c2fc22438 100644 --- a/docs/src/pages/components/drawers/drawers-zh.md +++ b/docs/src/pages/components/drawers/drawers-zh.md @@ -47,7 +47,7 @@ const iOS = 你可以使用 `ModalProps` 属性来确保临时抽屉不会被卸载,就像这样: -If you are on a desktop, you can toggle the drawer with the "OPEN" button. If you are on mobile, you can open the demo in CodeSandbox ("edit" icon) and swipe. +如果你使用的是桌面设备,那么可以点击 "OPEN" 按钮来切换抽屉的显示。 如果你使用的设备是手机,那么可以在 CodeSandbox(“编辑”图标)中打开该演示,并尝试滑动抽屉。 {{"demo": "pages/components/drawers/SwipeableEdgeDrawer.js", "iframe": true, "height": 400, "maxWidth": 300}} @@ -68,7 +68,7 @@ If you are on a desktop, you can toggle the drawer with the "OPEN" button. If yo ## 响应式的抽屉 -利用` Hidden `这个响应式的辅助组件,可以根据屏幕宽度显示不同类型的抽屉。 屏幕尺寸较小的时候会显示 `temporary` 抽屉,而更宽的屏幕则显示 `permanent` 抽屉。 +You can use the `temporary` variant to display a drawer for small screens and `permanent` for a drawer for wider screens. {{"demo": "pages/components/drawers/ResponsiveDrawer.js", "iframe": true}} @@ -96,7 +96,7 @@ If you are on a desktop, you can toggle the drawer with the "OPEN" button. If yo 永久抽屉始终可见并固定在左侧,与内容或背景位于同一高度。 他们无法被关闭。 -推荐在 **桌面环境上默认** 使用永久抽屉。 +推荐在**桌面环境上默认**使用永久抽屉。 ### 全高导航栏 diff --git a/docs/src/pages/components/floating-action-button/floating-action-button-de.md b/docs/src/pages/components/floating-action-button/floating-action-button-de.md index 76a27076a2e260..bec4087e2bb22c 100644 --- a/docs/src/pages/components/floating-action-button/floating-action-button-de.md +++ b/docs/src/pages/components/floating-action-button/floating-action-button-de.md @@ -21,10 +21,12 @@ Verwenden Sie eine FAB nur, wenn dies für die Darstellung der Hauptaktion eines ## Size -Use the `size` prop for larger or smaller floating action buttons. +By default, the size is `large`. Use the `size` prop for smaller floating action buttons. {{"demo": "pages/components/floating-action-button/FloatingActionButtonSize.js"}} +{{"demo": "pages/components/floating-action-button/FloatingActionButtonExtendedSize.js"}} + ## Animation Der floating-action-button, wird standardmäßig als expandierendes Material auf dem Bildschirm animiert. diff --git a/docs/src/pages/components/floating-action-button/floating-action-button-es.md b/docs/src/pages/components/floating-action-button/floating-action-button-es.md index 5d43b6fa8e5794..c24a0223e2db82 100644 --- a/docs/src/pages/components/floating-action-button/floating-action-button-es.md +++ b/docs/src/pages/components/floating-action-button/floating-action-button-es.md @@ -21,10 +21,12 @@ Sólo usa un FAB si es la forma más adecuada de presentar la acción principal ## Tamaño -Usa el `tamaño` para botones de acción flotante más grandes o más pequeños. +By default, the size is `large`. Use the `size` prop for smaller floating action buttons. {{"demo": "pages/components/floating-action-button/FloatingActionButtonSize.js"}} +{{"demo": "pages/components/floating-action-button/FloatingActionButtonExtendedSize.js"}} + ## Animación El botón de acción flotante se anima en la pantalla como una pieza de material en expansión, por defecto. diff --git a/docs/src/pages/components/floating-action-button/floating-action-button-fr.md b/docs/src/pages/components/floating-action-button/floating-action-button-fr.md index ff0cd6ddc68daf..db13205eb2eedd 100644 --- a/docs/src/pages/components/floating-action-button/floating-action-button-fr.md +++ b/docs/src/pages/components/floating-action-button/floating-action-button-fr.md @@ -1,5 +1,5 @@ --- -title: React Fab component +title: Composant React Fab components: Fab githubLabel: 'component: Fab' materialDesign: https://material.io/components/buttons-floating-action-button @@ -9,22 +9,24 @@ materialDesign: https://material.io/components/buttons-floating-action-button

    A floating action button (FAB) performs the primary, or most common, action on a screen.

    -A [floating action button](https://material.io/design/components/buttons-floating-action-button.html) appears in front of all screen content, typically as a circular shape with an icon in its center. Il existe deux types de FAB: régulier et étendu. +Un [bouton d'action flottant](https://material.io/design/components/buttons-floating-action-button.html) apparaît devant tout le contenu de l'écran, généralement sous la forme d'une forme circulaire avec une icône en son centre. Il existe deux types de FAB: régulier et étendu. -Utilisez un FAB uniquement si c'est le moyen le plus approprié pour présenter l'action principale d'un écran. Only use a FAB if it is the most suitable way to present a screen's primary action. +N'utilisez un FAB que s'il s'agit de la manière la plus appropriée de présenter l'action principale d'un écran. Un seul composant est recommandé par écran pour représenter l'action la plus courante. {{"component": "modules/components/ComponentLinkHeader.js"}} -## Floating Action Button +## FAB de base {{"demo": "pages/components/floating-action-button/FloatingActionButtons.js"}} ## Size -Use the `size` prop for larger or smaller floating action buttons. +By default, the size is `large`. Use the `size` prop for larger or smaller floating action buttons. {{"demo": "pages/components/floating-action-button/FloatingActionButtonSize.js"}} +Le bouton d'action flottante s'anime sur l'écran en tant que matériau en expansion, par défaut. + ## Animation Le bouton d'action flottante s'anime sur l'écran en tant que matériau en expansion, par défaut. diff --git a/docs/src/pages/components/floating-action-button/floating-action-button-ja.md b/docs/src/pages/components/floating-action-button/floating-action-button-ja.md index b09a2dc4948652..bc1bece8084788 100644 --- a/docs/src/pages/components/floating-action-button/floating-action-button-ja.md +++ b/docs/src/pages/components/floating-action-button/floating-action-button-ja.md @@ -9,28 +9,30 @@ materialDesign: https://material.io/components/buttons-floating-action-button

    A floating action button (FAB) performs the primary, or most common, action on a screen.

    -A [floating action button](https://material.io/design/components/buttons-floating-action-button.html) appears in front of all screen content, typically as a circular shape with an icon in its center. FABには次の二つのタイプがあります: regular extended +フローティング アクションボタンは、すべての画面コンテンツの全面に表示されます。通常は、中央にアイコンが付いた円の形状です。 FABには次の二つのタイプがあります: regular extended -Only one component is recommended per screen to represent the most common action. Only use a FAB if it is the most suitable way to present a screen's primary action. +画面の最も主要なアクションのための最も適切な方法である場合にのみ、FABを使用してください。 最も頻出なアクションであることを示すために、画面ごとに1つのみ配置することが推奨されます。 {{"component": "modules/components/ComponentLinkHeader.js"}} -## Floating Action Button +## 基本的なFAB {{"demo": "pages/components/floating-action-button/FloatingActionButtons.js"}} ## Size -Use the `size` prop for larger or smaller floating action buttons. +By default, the size is `large`. Use the `size` prop for smaller floating action buttons. {{"demo": "pages/components/floating-action-button/FloatingActionButtonSize.js"}} +{{"demo": "pages/components/floating-action-button/FloatingActionButtonExtendedSize.js"}} + ## Animation デフォルトでは、フローティングアクションボタンは、拡大する素材として画面上にアニメーション表示されます。 複数の横方向の画面(タブ付き画面など)にまたがるフローティングアクションボタンは、一時的に消えてから、アクションが変わると再表示されます。 -これを実現するにはズームトランジションを使用できます。 これを実現するにはズームトランジションを使用できます。 これを実現するにはズームトランジションを使用できます。 これを実現するにはズームトランジションを使用できます。 終了アニメーションと入力アニメーションの両方が同時にトリガーされるため、新しいフローティングアクションボタンのアニメーションが開始される前に終了するように`enterDelay`を使用します。 +これを実現するにはズームトランジションを使用できます。 終了アニメーションと入力アニメーションの両方が同時にトリガーされるため、新しいフローティングアクションボタンのアニメーションが開始される前に終了するように` enterDelay `を使用することに注意してください。 {{"demo": "pages/components/floating-action-button/FloatingActionButtonZoom.js", "bg": true}} diff --git a/docs/src/pages/components/floating-action-button/floating-action-button-pt.md b/docs/src/pages/components/floating-action-button/floating-action-button-pt.md index 30f9e8a66fdda0..65ae72826dffbc 100644 --- a/docs/src/pages/components/floating-action-button/floating-action-button-pt.md +++ b/docs/src/pages/components/floating-action-button/floating-action-button-pt.md @@ -21,10 +21,12 @@ Use um BAF apenas se for a maneira mais adequada para apresentar a ação princi ## Tamanho -Use a propriedade `size` para aumentar ou diminuir botões de ação flutuante. +By default, the size is `large`. Use the `size` prop for smaller floating action buttons. {{"demo": "pages/components/floating-action-button/FloatingActionButtonSize.js"}} +{{"demo": "pages/components/floating-action-button/FloatingActionButtonExtendedSize.js"}} + ## Animação O botão de ação flutuante anima na tela como uma parte expansiva do material, por padrão. diff --git a/docs/src/pages/components/floating-action-button/floating-action-button-ru.md b/docs/src/pages/components/floating-action-button/floating-action-button-ru.md index b7b3cd792810ea..5bb3e7ae0d082e 100644 --- a/docs/src/pages/components/floating-action-button/floating-action-button-ru.md +++ b/docs/src/pages/components/floating-action-button/floating-action-button-ru.md @@ -21,10 +21,12 @@ A [floating action button](https://material.io/design/components/buttons-floatin ## Size -Use the `size` prop for larger or smaller floating action buttons. +By default, the size is `large`. Use the `size` prop for smaller floating action buttons. {{"demo": "pages/components/floating-action-button/FloatingActionButtonSize.js"}} +{{"demo": "pages/components/floating-action-button/FloatingActionButtonExtendedSize.js"}} + ## Animation По умолчанию анимация кнопки с плавающим действием на экране является расширяющейся. diff --git a/docs/src/pages/components/floating-action-button/floating-action-button-zh.md b/docs/src/pages/components/floating-action-button/floating-action-button-zh.md index 33b6e1f0a21364..1e2b22798e2835 100644 --- a/docs/src/pages/components/floating-action-button/floating-action-button-zh.md +++ b/docs/src/pages/components/floating-action-button/floating-action-button-zh.md @@ -21,10 +21,12 @@ Only use a FAB if it is the most suitable way to present a screen's primary acti ## Size 大小 -您可以使用 `size` 属性来控制浮动操作按钮的大小。 +By default, the size is `large`. Use the `size` prop for smaller floating action buttons. {{"demo": "pages/components/floating-action-button/FloatingActionButtonSize.js"}} +{{"demo": "pages/components/floating-action-button/FloatingActionButtonExtendedSize.js"}} + ## Animation 动画 默认情况下,浮动操作按钮会以展开一片区域的动画在屏幕上出现。 diff --git a/docs/src/pages/components/grid/grid-de.md b/docs/src/pages/components/grid/grid-de.md index 42bc153804eaf3..9fc8eec48636bd 100644 --- a/docs/src/pages/components/grid/grid-de.md +++ b/docs/src/pages/components/grid/grid-de.md @@ -28,14 +28,6 @@ Das Rastersystem wird mit der `Grid-` Komponente implementiert: Wenn Sie **neu sind oder Flexbox nicht gut kennen**, empfehlen wir Ihnen, dies zu lesen: [CSS-Tricks Flexbox](https://css-tricks.com/snippets/css/a-guide-to-flexbox/). -## Abstände - -Das responsive Raster konzentriert sich auf konsistente Abstandsbreiten und nicht auf die Spaltenbreite. Die Ränder und Spalten des Materialdesigns folgen einem Grundraster aus **8px** Quadraten. The `spacing` prop value is an integer between 0 and 10 inclusive. Standardmäßig folgt der Abstand zwischen zwei Rasterelementen einer linearen Funktion: `output(spacing) = spacing * 8px`, z. B. `spacing={2}` erzeugt eine Lücke von 16px. - -Diese Ausgabetransformationsfunktion kann durch [Verwendung des Themes](/customization/spacing/) angepasst werden. - -{{"demo": "pages/components/grid/SpacingGrid.js", "bg": true}} - ## Fluides Raster Flüssige Raster verwenden Spalten, die den Inhalt skalieren und verkleinern. A fluid grid's layout can use breakpoints to determine if the layout needs to change dramatically. @@ -46,16 +38,51 @@ Column widths are integer values between 1 and 12; they apply at any breakpoint A value given to a breakpoint applies to all the other breakpoints wider than it (unless overridden, as you can read later in this page). For example, `xs={12}` sizes a component to occupy the whole viewport width regardless of its size. -{{"demo": "pages/components/grid/CenteredGrid.js", "bg": true}} +{{"demo": "pages/components/grid/BasicGrid.js", "bg": true}} ### Raster mit Rasterpunkten -Für einige Spalten sind mehrere Breiten definiert, wodurch sich das Layout am definierten Rasterpunkten ändert. Width values given to larger breakpoints override those given to smaller breakpoints. +Components may have multiple widths defined, causing the layout to change at the defined breakpoint. Width values given to larger breakpoints override those given to smaller breakpoints. For example, `xs={12} sm={6}` sizes a component to occupy half of the viewport width (6 columns) when viewport width is [600 or more pixels](/customization/breakpoints/#default-breakpoints). For smaller viewports, the component fills all 12 available columns. {{"demo": "pages/components/grid/FullWidthGrid.js", "bg": true}} +## Abstände + +To control space between children, use the `spacing` prop. The spacing value can be any positive number, including decimals and any string. The prop is converted into a CSS property using the [`theme.spacing()`](/customization/spacing/) helper. + +{{"demo": "pages/components/grid/SpacingGrid.js", "bg": true}} + +## Responsive values + +You can switch the props' value based on the active breakpoint. For instance, we can implement the ["recommended"](https://material.io/design/layout/responsive-layout-grid.html) responsive layout grid of Material Design. + +{{"demo": "pages/components/grid/ResponsiveGrid.js", "bg": true}} + +Responsive values is supported by: + +- `columns` +- `columnSpacing` +- `direction` +- `rowSpacing` +- `spacing` +- all the [other props](#system-props) of the system + +> ⚠️ When using a responsive `columns` prop, each grid item needs its corresponding breakpoint. For instance, this is not working. The grid item misses the value for `md`: +> +> ```jsx +> +> +> > +> ``` + +### Row & column spacing + +The `rowSpacing` and `columnSpacing` props allow for specifying the row and column gaps independently. It's similar to the `row-gap` and `column-gap` properties of [CSS Grid](/system/grid/#row-gap-amp-column-gap). + +{{"demo": "pages/components/grid/RowAndColumnSpacing.js", "bg": true}} + ## Interaktive Liste Nachfolgend finden Sie eine interaktive Demo, mit der Sie die visuellen Ergebnisse der verschiedenen Einstellungen untersuchen können: @@ -64,21 +91,21 @@ Nachfolgend finden Sie eine interaktive Demo, mit der Sie die visuellen Ergebnis ## Automatisches Layout -The Auto-layout makes the *items* equitably share the available space. That also means you can set the width of one *item* and the others will automatically resize around it. +The Auto-layout makes the _items_ equitably share the available space. That also means you can set the width of one _item_ and the others will automatically resize around it. {{"demo": "pages/components/grid/AutoGrid.js", "bg": true}} ## Komplexes Raster -Die folgende Demo folgt nicht der Material Design-Spezifikation, sondern zeigt, wie das Raster zum Erstellen komplexer Layouts verwendet werden kann. +The following demo doesn't follow the Material Design guidelines, but illustrates how the grid can be used to build complex layouts. {{"demo": "pages/components/grid/ComplexGrid.js", "bg": true}} ## Verschachteltes Raster -The `container` and `item` properties are two independent booleans. Sie können kombiniert werden. +The `container` and `item` props are two independent booleans; they can be combined to allow a Grid component to be both a flex container and child. -> Ein Flex **container** ist die Box, die von einem Element mit einer berechneten Anzeige von `flex` oder `Iinline-flex`. In-Flow-Kinder eines Flex-Containers heißen Flex **Elemente** und werden mit dem Flex-Layout-Modell angeordnet. +> A flex **container** is the box generated by an element with a computed display of `flex` or `inline-flex`. In-flow children of a flex container are called flex **items** and are laid out using the flex layout model. https://www.w3.org/TR/css-flexbox-1/#box-model @@ -92,26 +119,17 @@ https://www.w3.org/TR/css-flexbox-1/#box-model If you need to do such, remove one of the props. -## Einschränkungen +## Columns -### Negative Abstände +You can change the default number of columns (12) with the `columns` prop. -Es gibt eine Einschränkung beim negativen Rand, den wir verwenden, um den Abstand zwischen den Elementen zu implementieren. Ein horizontaler Bildlauf wird angezeigt, wenn ein negativer Rand weiter als `` geht. Es gibt 3 verfügbare Problemumgehungen: +{{"demo": "pages/components/grid/ColumnsGrid.js", "bg": true}} -1. Nicht die Abstands-Funktion benutzen und den Abstand in Anzeigeraum `spacing={0}` (Standard) setzen. -2. Anwenden von Paddings auf das übergeordnete Element, wobei mindestens der halbe Abstand auf das untergeordnete Element angewendet wird: +## Einschränkungen - ```jsx - -
    - - //... - -
    - - ``` +### Negative Abstände -3. Hinzufügen von `overflow-x: hidden;` zum Elternteil. +The spacing between items is implemented with a negative margin. This might lead to unexpected behaviors. For instance, to apply a background color, you need to apply `display: flex;` to the parent. ### white-space: nowrap; @@ -122,7 +140,7 @@ The initial setting on flex items is `min-width: auto`. It's causing a positioni ``` -In order for the item to stay within the container you need to set `min-width: 0`. In order for the item to stay within the container you need to set `min-width: 0`. +In order for the item to stay within the container you need to set `min-width: 0`. In practice, you can set the `zeroMinWidth` prop: ```jsx @@ -139,6 +157,14 @@ They define the number of grids the component will use for a given breakpoint. T ## CSS-Raster Layout -Die Material-UI bietet selbst keine CSS-Grid-Funktionalität. Wie Sie jedoch unten sehen, können Sie CSS-Grid einfach zum Layout Ihrer Seiten hinzufügen. +The `Grid` component is using CSS flexbox internally. But as seen below, you can easily use [the system](/system/grid/) and CSS Grid to layout your pages. {{"demo": "pages/components/grid/CSSGrid.js", "bg": true}} + +## System props + +As a CSS utility component, the `Grid` supports all [`system`](/system/properties/) properties. You can use them as props directly on the component. For instance, a padding: + +```jsx + +``` diff --git a/docs/src/pages/components/grid/grid-es.md b/docs/src/pages/components/grid/grid-es.md index ef79386058467b..bbb4f200ea8a25 100644 --- a/docs/src/pages/components/grid/grid-es.md +++ b/docs/src/pages/components/grid/grid-es.md @@ -1,5 +1,5 @@ --- -title: React Grid component +title: Bloques de elementos de texto components: Grid githubLabel: 'component: Grid' materialDesign: https://material.io/design/layout/understanding-layout.html @@ -28,34 +28,61 @@ El sistema de cuadrícula se implementa con el componente `Grid`: **Si recién comienzas y no estás familiarizado con flexbox **, te recomendamos leer la siguiente guía [CSS-Tricks flexbox](https://css-tricks.com/snippets/css/a-guide-to-flexbox/). -## Espaciado - -La cuadrícula responsive se centra en anchos de espaciado coherentes, en lugar de en el ancho de columna. Los márgenes y columnas de Material Design siguen una cuadrícula con línea-base cuadrada de **8dp**. La propiedad de espaciado es un número entero entre 0 y 10 inclusive. Por defecto, el espaciado entre dos elementos de la cuadrícula sigue una función lineal: `output(spacing)= spacing * 8px`, por ejemplo, `spacing={2}` crea un espacio de 16px. - -Esta función de transformación de la salida se puede personalizar [usando el tema](/customization/spacing/). - -{{"demo": "pages/components/grid/SpacingGrid.js", "bg": true}} - ## Grids fluidos El fluid grid usa columnas que escalan y redimensionan el contenido. A fluid grid's layout can use breakpoints to determine if the layout needs to change dramatically. ### Grid básica -Los anchos de las columnas son valores enteros entre 1 y 12; se aplican en cualquier punto de interrupción e indican cuántas columnas están ocupadas por el componente. +Column widths are integer values between 1 and 12; they apply at any breakpoint and indicate how many columns are occupied by the component. -Un valor dado a un breakpoint se aplica a todos los demás breakpoints más anchos que él (a menos que se sobreescriba, como se puede leer despues en esta página). Por ejemplo, `xs={12}` escala un componente para ocupar el ancho de toda la vista independientemente de su tamaño. +A value given to a breakpoint applies to all the other breakpoints wider than it (unless overridden, as you can read later in this page). For example, `xs={12}` sizes a component to occupy the whole viewport width regardless of its size. -{{"demo": "pages/components/grid/CenteredGrid.js", "bg": true}} +{{"demo": "pages/components/grid/BasicGrid.js", "bg": true}} ### Grid con breakpoints -Algunas columnas tienen varios anchos definidos, causando que el layout cambie en el correspondiente breakpoint definido. Los valores de ancho, dados a breakpoints más grandes, anulan los dados breakpoints más pequeños. +Components may have multiple widths defined, causing the layout to change at the defined breakpoint. Width values given to larger breakpoints override those given to smaller breakpoints. -Por ejemplo, `xs={12} sm={6}` escala un componente para ocupar la mitad del ancho de la vista (6 columnas) cuando el ancho de la vista es [600 o más píxeles](/customization/breakpoints/#default-breakpoints). Para viweports mas pequeños, el componente rellena las 12 columnas disponibles. +For example, `xs={12} sm={6}` sizes a component to occupy half of the viewport width (6 columns) when viewport width is [600 or more pixels](/customization/breakpoints/#default-breakpoints). For smaller viewports, the component fills all 12 available columns. {{"demo": "pages/components/grid/FullWidthGrid.js", "bg": true}} +## Espaciado + +To control space between children, use the `spacing` prop. The spacing value can be any positive number, including decimals and any string. The prop is converted into a CSS property using the [`theme.spacing()`](/customization/spacing/) helper. + +{{"demo": "pages/components/grid/SpacingGrid.js", "bg": true}} + +## Responsive values + +You can switch the props' value based on the active breakpoint. For instance, we can implement the ["recommended"](https://material.io/design/layout/responsive-layout-grid.html) responsive layout grid of Material Design. + +{{"demo": "pages/components/grid/ResponsiveGrid.js", "bg": true}} + +Responsive values is supported by: + +- `columns` +- `columnSpacing` +- `direction` +- `rowSpacing` +- `spacing` +- all the [other props](#system-props) of the system + +> ⚠️ When using a responsive `columns` prop, each grid item needs its corresponding breakpoint. For instance, this is not working. The grid item misses the value for `md`: +> +> ```jsx +> +> +> > +> ``` + +### Row & column spacing + +The `rowSpacing` and `columnSpacing` props allow for specifying the row and column gaps independently. It's similar to the `row-gap` and `column-gap` properties of [CSS Grid](/system/grid/#row-gap-amp-column-gap). + +{{"demo": "pages/components/grid/RowAndColumnSpacing.js", "bg": true}} + ## Explora Debajo de esta línea hay una demostración interactiva que permite explorar el resultado visual de las distintas configuraciones: @@ -64,21 +91,21 @@ Debajo de esta línea hay una demostración interactiva que permite explorar el ## Auto-layout -El Auto-layout (autodiseño) hace que los *items* compartan el espacio disponible equitativamente. Esto también quiere decir que puede establecer el ancho de un *item* y los otro se dimensionarán a partir de él. +The Auto-layout makes the _items_ equitably share the available space. That also means you can set the width of one _item_ and the others will automatically resize around it. {{"demo": "pages/components/grid/AutoGrid.js", "bg": true}} ## Grid Compleja -El siguiente ejemplo no sigue las directrices de Material Design, pero ilustra cómo el grid puede ser usado para dar forma a layouts complejas. +The following demo doesn't follow the Material Design guidelines, but illustrates how the grid can be used to build complex layouts. {{"demo": "pages/components/grid/ComplexGrid.js", "bg": true}} ## Grid Anidada -Las propiedades `container` y `item` son booleaneas e independientes. Pueden ser combinadas. +The `container` and `item` props are two independent booleans; they can be combined to allow a Grid component to be both a flex container and child. -> Un **contenedor** de flex es la caja generada por un elemento con la propiedad computada display con el valor de `flex` o `inline-flex`. Los hijos en el flujo de un contenedor flex se denominan flex **items** y se establecen mediante el modelo de layout flex. +> A flex **container** is the box generated by an element with a computed display of `flex` or `inline-flex`. In-flow children of a flex container are called flex **items** and are laid out using the flex layout model. https://www.w3.org/TR/css-flexbox-1/#box-model @@ -92,26 +119,17 @@ https://www.w3.org/TR/css-flexbox-1/#box-model If you need to do such, remove one of the props. -## Limitaciones +## Columns -### Margen negativo +You can change the default number of columns (12) with the `columns` prop. -Existe una limitación con el margen negativo que utilizamos para implementar el espaciado entre los elementos. Un scroll horizontal aparecerá si un margen negativo va más allá del ``. Hay 3 soluciones disponibles: +{{"demo": "pages/components/grid/ColumnsGrid.js", "bg": true}} -1. No usar la función de espaciado e implementarla en el espacio de usuario `spacing={0}` (por defecto). -2. Aplicar padding al padre con al menos la mitad del valor de espaciado aplicado al hijo: +## Limitaciones - ```jsx - -
    - - //... - -
    - - ``` +### Margen negativo -3. Añadiendo `overflow-x: hidden;` al padre. +The spacing between items is implemented with a negative margin. This might lead to unexpected behaviors. For instance, to apply a background color, you need to apply `display: flex;` to the parent. ### white-space: nowrap; @@ -122,7 +140,7 @@ La configuración inicial en los elementos flex es `min-width: auto`. Esto causa ``` -Para que el item permanezca dentro del contenedor necesita establecer `min-width: 0`. Para que el item permanezca dentro del contenedor necesita establecer `min-width: 0`. +Para que el item permanezca dentro del contenedor necesita establecer `min-width: 0`. In practice, you can set the `zeroMinWidth` prop: ```jsx @@ -139,6 +157,14 @@ They define the number of grids the component will use for a given breakpoint. T ## CSS Grid Layout -Material-UI doesn't provide any CSS Grid functionality itself, but as seen below you can easily use CSS Grid to layout your pages. +The `Grid` component is using CSS flexbox internally. But as seen below, you can easily use [the system](/system/grid/) and CSS Grid to layout your pages. {{"demo": "pages/components/grid/CSSGrid.js", "bg": true}} + +## System props + +As a CSS utility component, the `Grid` supports all [`system`](/system/properties/) properties. You can use them as props directly on the component. For instance, a padding: + +```jsx + +``` diff --git a/docs/src/pages/components/grid/grid-fr.md b/docs/src/pages/components/grid/grid-fr.md index 5ba4bbe561fa5d..1bec84a766775c 100644 --- a/docs/src/pages/components/grid/grid-fr.md +++ b/docs/src/pages/components/grid/grid-fr.md @@ -1,5 +1,5 @@ --- -title: React Grid component +title: React Grid composant components: Grid githubLabel: 'component: Grid' materialDesign: https://material.io/design/layout/understanding-layout.html @@ -9,36 +9,28 @@ materialDesign: https://material.io/design/layout/understanding-layout.html

    Le composant responsive Grid de Material Design s'adapte à la taille et à l'orientation de l'écran, garantissant ainsi la cohérence entre les différents agencements.

    -[Grid](https://material.io/design/layout/responsive-layout-grid.html) créé une cohérence visuelle entre les agencements tout en permettant une certaine flexibilité à travers une grande variété de modèles. Material Design's responsive UI is based on a 12-column grid layout. +Le [Grid](https://material.io/design/layout/responsive-layout-grid.html) créé une cohérence visuelle entre les éléments tout en permettant une certaine flexibilité à travers une grande variété de mise en page. L’UI responsive de Material Design est basée sur un Grid de 12 colonnes. {{"component": "modules/components/ComponentLinkHeader.js"}} -> ⚠️ The `Grid` component shouldn't be confused with a data grid; it is closer to a layout grid. For a data grid head to [the `DataGrid` component](/components/data-grid/). +> ⚠️ Le composant `Grille` ne doit pas être confondu avec une grille de données ; il est plus proche d'une grille de mise en page. For a data grid head to [the `DataGrid` component](/components/data-grid/). ## Comment ça marche Le système de grille est implémenté avec le composant `Grid`: -- It uses [CSS's Flexible Box module](https://www.w3.org/TR/css-flexbox-1/) for high flexibility. +- Cela utilise [le module flexible de CSS](https://www.w3.org/TR/css-flexbox-1/) pour une grande flexibilité. - Il y a deux types de mise en page : *conteneurs* et *éléments*. -- Item widths are set in percentages, so they're always fluid and sized relative to their parent element. +- La largeur d'un élément est définie en pourcentage, cela veut dire qu'ils sont toujours souples et dimensionnés par rapport à leur élément parent. - Les éléments ont un rembourrage (padding) pour créer l'espacement entre les éléments individuels. - Il existe cinq points de rupture de grille: xs, sm, md, lg et xl. -- Integer values can be given to each breakpoint, indicating how many of the 12 available columns are occupied by the component when the viewport width satisfies the [breakpoint contraints](/customization/breakpoints/#default-breakpoints). +- Les valeurs type nombre peuvent être données à chaque points de rupture indiquant combien de colonnes parmi les 12 colonnes disponibles sont occupées par le composant lorsque la largeur de la zone d’affichage a assez des [contraintes de point de rupture](/customization/breakpoints/#default-breakpoints). -Si vous êtes **nouveau ou peu familiers avec FlexBox**, nous vous encourageons à lire ce guide [CSS-Tricks flexbox](https://css-tricks.com/snippets/css/a-guide-to-flexbox/). - -## Ecartement - -La grille responsive se concentre sur les largeurs d'espacement cohérentes plutôt que sur la largeur des colonnes. Les marges du Material Design et les colonnes suivent un grille carrée de **8px**. The `spacing` prop value is an integer between 0 and 10 inclusive. Par défaut, l'espacement entre deux éléments de la grille suit une fonction linéaire: `sortie (espacement) = espacement * 8px`, par exemple `espacement ={2}` crée un intervalle large de 16px. - -Cette fonction de transformation de sortie peut être personnalisée [à l'aide du thème](/customization/spacing/). - -{{"demo": "pages/components/grid/SpacingGrid.js", "bg": true}} +Si vous êtes **nouveau ou peu familiers avec FlexBox**, nous vous encourageons à lire ce guide [CSS-Tricks FlexBox ](https://css-tricks.com/snippets/css/a-guide-to-flexbox/). ## Les grilles fluides -Fluid grids use columns that scale and resize content. A fluid grid's layout can use breakpoints to determine if the layout needs to change dramatically. +Les grilles fluides utilisent des colonnes qui mettent à l'échelle et redimensionnent le contenu. A fluid grid's layout can use breakpoints to determine if the layout needs to change dramatically. ### Grille de base @@ -48,7 +40,7 @@ A value given to a breakpoint applies to all the other breakpoints wider than it {{"demo": "pages/components/grid/CenteredGrid.js", "bg": true}} -### Grille avec points d'arrêt +### Grid avec des points de rupture Plusieurs colonnes ont plusieurs largeurs définies, ce qui entraîne une modification de la présentation au point de rupture défini. Width values given to larger breakpoints override those given to smaller breakpoints. @@ -56,6 +48,44 @@ For example, `xs={12} sm={6}` sizes a component to occupy half of the viewport w {{"demo": "pages/components/grid/FullWidthGrid.js", "bg": true}} +## Ecartement + +To control space between children, use the `spacing` prop. The spacing value can be any positive number, including decimals and any string. Cette fonction de transformation de sortie peut être personnalisée [à l'aide du thème](/customization/spacing/). + +{{"demo": "pages/components/grid/SpacingGrid.js", "bg": true}} + +## Responsive values + +You can switch the props' value based on the active breakpoint. For instance, we can implement the ["recommended"](https://material.io/design/layout/responsive-layout-grid.html) responsive layout grid of Material Design. + +Vous trouverez ci-dessous une démo interactive vous permettant d'explorer les résultats visuels des différents paramètres: + +Responsive values is supported by: + +- `columns` +- `columnSpacing` +- `direction` +- `rowSpacing` +- `spacing` +- all the [other props](#system-props) of the system + +> ⚠️ When using a responsive `columns` prop, each grid item needs its corresponding breakpoint. For instance, this is not working. The grid item misses the value for `md`: +> +> ```jsx +> +>
    +> +> //... +>
    +>
    +> ``` + +### Marge négative + +The `rowSpacing` and `columnSpacing` props allow for specifying the row and column gaps independently. It's similar to the `row-gap` and `column-gap` properties of [CSS Grid](/system/grid/#row-gap-amp-column-gap). + +{{"demo": "pages/components/grid/RowAndColumnSpacing.js", "bg": true}} + ## Interactif Vous trouverez ci-dessous une démo interactive vous permettant d'explorer les résultats visuels des différents paramètres: @@ -70,7 +100,7 @@ The Auto-layout makes the *items* equitably share the available space. That also ## Grille complexe -La démo suivante ne suit pas la spécification Material Design, mais illustre comment la grille peut être utilisée pour créer des mises en page complexes. +The following demo doesn't follow the Material Design guidelines, but illustrates how the grid can be used to build complex layouts. {{"demo": "pages/components/grid/ComplexGrid.js", "bg": true}} @@ -92,26 +122,17 @@ https://www.w3.org/TR/css-flexbox-1/#box-model If you need to do such, remove one of the props. -## Limites +## Columns -### Marge négative +You can change the default number of columns (12) with the `columns` prop. -Il existe une limitation à la marge négative utilisée pour mettre en œuvre l'espacement entre les éléments. Un défilement horizontal apparaîtra si une marge négative dépasse le ``. Il existe 3 alternatives: +{{"demo": "pages/components/grid/ColumnsGrid.js", "bg": true}} -1. Ne pas utiliser la fonctionnalité d'espacement et l'implémenter dans l'espace utilisateur `spacing={0}` (par défaut). -2. Appliquer un rembourrage (padding) au parent avec au moins la moitié de la valeur d'espacement appliquée à l'enfant: +## Limites - ```jsx - -
    - - //... - -
    - - ``` +### Marge négative -3. Ajouter `overflow-x: hidden;` au parent. +Il existe une limitation à la marge négative utilisée pour mettre en œuvre l'espacement entre les éléments. This might lead to unexpected behaviors. For instance, to apply a background color, you need to apply `display: flex;` to the parent. ### white-space: nowrap; @@ -122,7 +143,7 @@ La configuration initiale sur les éléments flex est `min-width: auto`. Cela pr ``` -In order for the item to stay within the container you need to set `min-width: 0`. In order for the item to stay within the container you need to set `min-width: 0`. +In order for the item to stay within the container you need to set `min-width: 0`. In practice, you can set the `zeroMinWidth` prop: ```jsx @@ -137,8 +158,16 @@ The `xs`, `sm`, `md`, `lg`, and `xl` props are **not supported** within `directi They define the number of grids the component will use for a given breakpoint. They are intended to control **width** using `flex-basis` in `row` containers but they will impact height in `column` containers. If used, these props may have undesirable effects on the height of the `Grid` item elements. -## CSS Grid Layout +## Disposition de la grille CSS -Material-UI ne fournit aucune fonctionnalité de grille CSS, mais comme illustré ci-dessous, vous pouvez facilement utiliser CSS Grid pour mettre en page vos pages. +The `Grid` component is using CSS flexbox internally. But as seen below, you can easily use [the system](/system/grid/) and CSS Grid to layout your pages. {{"demo": "pages/components/grid/CSSGrid.js", "bg": true}} + +## System props + +As a CSS utility component, the `Grid` supports all [`system`](/system/properties/) properties. You can use them as props directly on the component. For instance, a padding: + +```jsx + +``` diff --git a/docs/src/pages/components/grid/grid-ja.md b/docs/src/pages/components/grid/grid-ja.md index 16bd663d6d5cf0..24f98b1a0777d0 100644 --- a/docs/src/pages/components/grid/grid-ja.md +++ b/docs/src/pages/components/grid/grid-ja.md @@ -9,7 +9,7 @@ materialDesign: https://material.io/design/layout/understanding-layout.html

    Material Designのレスポンシブレイアウトグリッドは、画面サイズと向きに適応し、レイアウト間の一貫性を保証します。

    -[grid](https://material.io/design/layout/responsive-layout-grid.html) は、レイアウト間の視覚的な一貫性を実現しながら、さまざまなデザインでの柔軟性を可能にします。 Material Design's responsive UI is based on a 12-column grid layout. +[Grid](https://material.io/design/layout/responsive-layout-grid.html) は、レイアウト間の視覚的な一貫性を実現しながら、さまざまなデザインでの柔軟性を可能にします。 Material DesignのレスポンシブUIは、12列のグリッドレイアウトに基づいています。 {{"component": "modules/components/ComponentLinkHeader.js"}} @@ -19,23 +19,15 @@ materialDesign: https://material.io/design/layout/understanding-layout.html グリッドシステムは `Grid` コンポーネントで実装されています。 -- It uses [CSS's Flexible Box module](https://www.w3.org/TR/css-flexbox-1/) for high flexibility. -- レイアウトには* containers * と * items*の2種類あります 。 -- Item widths are set in percentages, so they're always fluid and sized relative to their parent element. +- 高い柔軟性のために [CSSのFlexible Boxモジュール](https://www.w3.org/TR/css-flexbox-1/) を使用します。 +- _containers_ と _items_ の2種類のレイアウトがあります 。 +- アイテムの幅はパーセンテージで設定されているので、それらは常に親要素に対して流動的になり、相対的に大きさが決まります。 - アイテムには、個々のアイテム間の間隔を空けるための余白があります。 - xs、sm、md、lg、およびxlの5つのグリッドブレークポイントがあります。 -- Integer values can be given to each breakpoint, indicating how many of the 12 available columns are occupied by the component when the viewport width satisfies the [breakpoint contraints](/customization/breakpoints/#default-breakpoints). +- 各ブレークポイントに整数の値を与えることができます。 ビューポートの幅が[ブレークポイントの制約](/customization/breakpoints/#default-breakpoints)を満たしたときに、利用可能な12列のうちどれだけの列がコンポーネントによって占められるかを示します。 **flexboxに不慣れ**な場合、 [CSS-Tricks flexbox](https://css-tricks.com/snippets/css/a-guide-to-flexbox/) を読むことをおすすめします。 -## Spacing - -レスポンシブグリッドは、列幅ではなく、一貫した間隔幅に焦点を当てています。 材料設計の余白と列は **8px** の四角いベースライングリッドに従います。 The `spacing` prop value is an integer between 0 and 10 inclusive. デフォルトでは、2つの格子項目間の間隔が線形関数に従う: `output(spacing) = spacing * 8px`、例えば `spacing={2}`では16pxに広いギャップを作成します。 - -この出力変換関数は、[テーマを使う](/customization/spacing/)ことでカスタマイズできます。 - -{{"demo": "pages/components/grid/SpacingGrid.js", "bg": true}} - ## Fluid grids Fluid gridsでは、コンテンツの尺度とサイズを変更する列を使用します。 A fluid grid's layout can use breakpoints to determine if the layout needs to change dramatically. @@ -46,16 +38,51 @@ Column widths are integer values between 1 and 12; they apply at any breakpoint A value given to a breakpoint applies to all the other breakpoints wider than it (unless overridden, as you can read later in this page). For example, `xs={12}` sizes a component to occupy the whole viewport width regardless of its size. -{{"demo": "pages/components/grid/CenteredGrid.js", "bg": true}} +{{"demo": "pages/components/grid/BasicGrid.js", "bg": true}} ### ブレークポイント付きGrid -一部の列では複数の幅が定義されているため、定義されたブレークポイントでレイアウトが変更されます。 Width values given to larger breakpoints override those given to smaller breakpoints. +Components may have multiple widths defined, causing the layout to change at the defined breakpoint. Width values given to larger breakpoints override those given to smaller breakpoints. For example, `xs={12} sm={6}` sizes a component to occupy half of the viewport width (6 columns) when viewport width is [600 or more pixels](/customization/breakpoints/#default-breakpoints). For smaller viewports, the component fills all 12 available columns. {{"demo": "pages/components/grid/FullWidthGrid.js", "bg": true}} +## Spacing + +To control space between children, use the `spacing` prop. The spacing value can be any positive number, including decimals and any string. The prop is converted into a CSS property using the [`theme.spacing()`](/customization/spacing/) helper. + +{{"demo": "pages/components/grid/SpacingGrid.js", "bg": true}} + +## Responsive values + +You can switch the props' value based on the active breakpoint. For instance, we can implement the ["recommended"](https://material.io/design/layout/responsive-layout-grid.html) responsive layout grid of Material Design. + +{{"demo": "pages/components/grid/ResponsiveGrid.js", "bg": true}} + +Responsive values is supported by: + +- `columns` +- `columnSpacing` +- `direction` +- `rowSpacing` +- `spacing` +- all the [other props](#system-props) of the system + +> ⚠️ When using a responsive `columns` prop, each grid item needs its corresponding breakpoint. For instance, this is not working. The grid item misses the value for `md`: +> +> ```jsx +> +> +> > +> ``` + +### Row & column spacing + +The `rowSpacing` and `columnSpacing` props allow for specifying the row and column gaps independently. It's similar to the `row-gap` and `column-gap` properties of [CSS Grid](/system/grid/#row-gap-amp-column-gap). + +{{"demo": "pages/components/grid/RowAndColumnSpacing.js", "bg": true}} + ## インタラクティブ 以下は、さまざまな設定の視覚的な結果を調べることができるインタラクティブなデモです。 @@ -64,21 +91,21 @@ For example, `xs={12} sm={6}` sizes a component to occupy half of the viewport w ## 自動レイアウト -自動レイアウトにより、 *items* が使用可能なスペースを均等に共有します。 それはまた、あなたが1つの *item* 幅を設定することができ、他のものはそれの周りに自動的にサイズ変更されることを意味します。 +The Auto-layout makes the _items_ equitably share the available space. That also means you can set the width of one _item_ and the others will automatically resize around it. {{"demo": "pages/components/grid/AutoGrid.js", "bg": true}} ## 複雑なグリッド -以下のデモは、Material Designには従っていませんが、グリッドを使用して複雑なレイアウトを構築する方法を示しています。 +The following demo doesn't follow the Material Design guidelines, but illustrates how the grid can be used to build complex layouts. {{"demo": "pages/components/grid/ComplexGrid.js", "bg": true}} ## Nested Grid -`container`プロパティと`item`プロパティは、それぞれ独立したブール値です。 それらは組み合わせることができます。 +The `container` and `item` props are two independent booleans; they can be combined to allow a Grid component to be both a flex container and child. -> Flex ** container ** は、 `flex` または `inline-flex`を持つ要素によって生成されたボックスです。 フレックスコンテナのインフローの子は、flex ** items ** と呼ばれ、flexレイアウトモデルを使用してレイアウトされます。 +> A flex **container** is the box generated by an element with a computed display of `flex` or `inline-flex`. In-flow children of a flex container are called flex **items** and are laid out using the flex layout model. https://www.w3.org/TR/css-flexbox-1/#box-model @@ -92,26 +119,17 @@ https://www.w3.org/TR/css-flexbox-1/#box-model If you need to do such, remove one of the props. -## 制限事項 +## Columns -### Negative margin +You can change the default number of columns (12) with the `columns` prop. -項目間の間隔を実装するために使用する負のマージンには1つ制限があります。 項目間の間隔を実装するために使用する負のマージンには1つ制限があります。 負のマージンが ``を超えると水平スクロールが表示されます。 回避策は3つあります。 回避策は3つあります。 +{{"demo": "pages/components/grid/ColumnsGrid.js", "bg": true}} -1. スペーシング機能を使用し、ユーザ空間でそれを実装していない `spacing ={0}` (デフォルト)。 -2. 子に適用された間隔値の少なくとも半分を使用して、親にパディングを適用します。 +## 制限事項 - ```jsx - -
    - - //... - -
    - - ``` +### Negative margin -3. `overflow-x: hidden;`を親に追加する +The spacing between items is implemented with a negative margin. This might lead to unexpected behaviors. For instance, to apply a background color, you need to apply `display: flex;` to the parent. ### white-space: nowrap; @@ -122,7 +140,7 @@ If you need to do such, remove one of the props. ``` -アイテムがコンテナ内に収まるようにするには、 `min-width:0`を設定する必要があります。 アイテムがコンテナ内に収まるようにするには、 `min-width:0`を設定する必要があります。 +アイテムがコンテナ内に収まるようにするには、 `min-width:0`を設定する必要があります。 In practice, you can set the `zeroMinWidth` prop: ```jsx @@ -139,6 +157,14 @@ They define the number of grids the component will use for a given breakpoint. T ## CSS Grid Layout -Material-UI自体はCSSグリッド機能自体を提供しませんが、以下に示すように、CSSグリッドを使用してページをレイアウトすることは簡単にできます。 +The `Grid` component is using CSS flexbox internally. But as seen below, you can easily use [the system](/system/grid/) and CSS Grid to layout your pages. {{"demo": "pages/components/grid/CSSGrid.js", "bg": true}} + +## System props + +As a CSS utility component, the `Grid` supports all [`system`](/system/properties/) properties. You can use them as props directly on the component. For instance, a padding: + +```jsx + +``` diff --git a/docs/src/pages/components/grid/grid-pt.md b/docs/src/pages/components/grid/grid-pt.md index 96c0cc9173089b..0f8a1554cac622 100644 --- a/docs/src/pages/components/grid/grid-pt.md +++ b/docs/src/pages/components/grid/grid-pt.md @@ -9,7 +9,7 @@ materialDesign: https://material.io/design/layout/understanding-layout.html

    O leiaute responsivo da grade do Material Design se adapta ao tamanho e orientação da tela, garantindo a consistência entre leiautes.

    -Uma [grade](https://material.io/design/layout/responsive-layout-grid.html) cria consistência visual entre leiautes, enquanto permite flexibilidade em uma ampla variedade de projetos. Material Design's responsive UI is based on a 12-column grid layout. +Uma [grade](https://material.io/design/layout/responsive-layout-grid.html) cria consistência visual entre leiautes, enquanto permite flexibilidade em uma ampla variedade de projetos. A UI responsiva do Material Design é baseada em uma grade de 12 colunas. {{"component": "modules/components/ComponentLinkHeader.js"}} @@ -19,42 +19,79 @@ Uma [grade](https://material.io/design/layout/responsive-layout-grid.html) cria O sistema de grade é implementado com o componente `Grid`: -- It uses [CSS's Flexible Box module](https://www.w3.org/TR/css-flexbox-1/) for high flexibility. +- Ela usa [o módulo CSS de box flexível](https://www.w3.org/TR/css-flexbox-1/) para alta flexibilidade. - Existem dois tipos de leiautes: *contêineres* e *itens*. -- Item widths are set in percentages, so they're always fluid and sized relative to their parent element. +- Larguras de itens são definidas em porcentagens, desse modo são sempre fluidas e dimensionadas de acordo os seus elementos pai. - Itens têm preenchimento para criar o espaçamento entre itens individuais. - Existem cinco pontos de quebra (breakpoints) na grade: xs, sm, md, lg e xl. - Valores inteiros podem ser dados para cada ponto de quebra, indicando quantas das 12 colunas disponíveis são ocupadas pelo componente quando a largura da área de exibição satisfaz as [restrições de ponto de quebra](/customization/breakpoints/#default-breakpoints). Se você é **novo ou não está familiarizado com o flexbox**, nós recomendamos você a ler este [guia do Flexbox CSS-Tricks](https://css-tricks.com/snippets/css/a-guide-to-flexbox/). -## Espaçamento +## Grades fluídas + +As grades fluídas usam colunas que dimensionam e redimensionam o conteúdo. Uma disposição fluida de malha pode usar pontos de ruptura para determinar se precisa mudar drasticamente. + +### Grade básica -A grade responsiva se concentra em larguras de espaçamento consistentes, em vez de largura de coluna. As margens e colunas do Material Design seguem uma grade de linha de base quadrada de **8px**. A propriedade de espaçamento é um inteiro entre 0 e 10. Por padrão, o espaçamento entre dois itens de grade segue uma função linear: `output(spacing) = spacing * 8px`, por exemplo, `spacing={2}` cria um espaçamento de 16px. +As larguras das colunas é representada por um numero inteiro que varia de 1 a 12. Podemos aplica-las a qualquer ponto de ruptura para indicar quantas colunas são ocupadas pelo componente. + +Um valor aplicado a um ponto de ruptura se aplica a todos os outros pontos maiores, a menos que seja alterado, como será visto posteriormente nesta página. Por exemplo nesse trecho ` xs={12} ` definimos que o componente ocupará toda a largura da tela, independente do tamanho da tela. + +{{"demo": "pages/components/grid/BasicGrid.js", "bg": true}} + +### Grade com pontos de quebra + +Podemos definir várias larguras para os componentes, resultando em um leiaute que muda de acordo com o ponto de ruptura. Width values given to larger breakpoints override those given to smaller breakpoints. + +Aqui por exemplo `xs={12} sm={6}` define que o componente ocupará metade da largura da tela (6 colunas) em um dispositivo com resolução de 600px pra cima. Já para dispositivos menores, o componente vai tomar todas as 12 colunas.

    + +{{"demo": "pages/components/grid/FullWidthGrid.js", "bg": true}} + + + +## Espaçamento -Esta função de transformação de saída pode ser customizada [usando o tema](/customization/spacing/). +Para controlar o espaço entre os filhos, use a prop ` spacing ` O valor do espaçamento pode ser qualquer numero positivo, incluindo decimais e até strings (cadeia de caracteres) As props são convertidas em css usando o auxiliar [`theme.spacing()`](/customization/spacing/) {{"demo": "pages/components/grid/SpacingGrid.js", "bg": true}} -## Grades fluídas -As grades fluídas usam colunas que dimensionam e redimensionam o conteúdo. A fluid grid's layout can use breakpoints to determine if the layout needs to change dramatically. -### Grade básica +## Valores responsivos -A largura das colunas são valores inteiros entre 1 e 12; eles se aplicam em qualquer ponto de quebra e indicam a quantidade de colunas ocupadas pelo componente. +Podemos ativar as props de acordo com ponto de ruptura ativo Por exemplo, podemos implementar o leiaute responsivo do Material Design ["recommended"](https://material.io/design/layout/responsive-layout-grid.html) -Um valor dado a um ponto de quebra, aplica-se a todos os outros pontos de quebra mais amplos do que ele (a menos que substituído, como você pode ler mais tarde nesta página). Por exemplo, `xs={12}` dimensiona o componente para ocupar toda a largura da área de exibição independente do seu tamanho. +{{"demo": "pages/components/grid/ResponsiveGrid.js", "bg": true}} -{{"demo": "pages/components/grid/CenteredGrid.js", "bg": true}} +Valores responsivos são suportados por: -### Grade com pontos de quebra +- `colunas` +- `espaçoDeColuna` +- `direção` +- `espaçoDeLinha` +- `spacing` +- todas as outras propriedades do sistema [other props](#system-props) -Algumas colunas têm várias larguras definidas, fazendo com que o leiaute seja alterado no ponto de interrupção definido. Os valores de largura dados para pontos de quebra maiores, substituem aqueles dados a pontos de quebra menores. -Por exemplo, `xs={12} sm={6}` dimensiona o componente para ocupar metade da área de exibição (6 colunas), quando a largura da área de exibição é de [600 ou mais pixels](/customization/breakpoints/#default-breakpoints). Para áreas de exibição menores, o componente preenche todas as 12 colunas disponíveis. -{{"demo": "pages/components/grid/FullWidthGrid.js", "bg": true}} +> ⚠️ Quando Usamos a prop de código responsivo `colunas `, cada item da manha precisa de seu correspondente ponto de ruptura. Por exemplo, este não está funcionando Os itens da malha precisa de seu valor para ` md` (ponto médio) +> +> ```jsx +> +> +> > +> ``` + + + +### Row & column spacing + +As props ` rowSpacing` e `columnSpacing` nos permite especificar os espaços entre linhas e entre colunas de forma independente. É similar as propriedades `row-gap` e `column-gap` da [Malha CSS](/system/grid/#row-gap-amp-column-gap). + +{{"demo": "pages/components/grid/RowAndColumnSpacing.js", "bg": true}} + + ## Interativo @@ -62,83 +99,115 @@ Abaixo está uma demonstração interativa que permite explorar os resultados vi {{"demo": "pages/components/grid/InteractiveGrid.js", "hideToolbar": true, "bg": true}} + + ## Leiaute Automático -O leiaute automático faz com que os *items* compartilhem equitativamente o espaço disponível. Isso também significa que você pode definir a largura de um *item* e os outros automaticamente se redimensionarão em torno dele. +O leiaute automático faz com que o espaço disponível seja compartilhado de forma proporcional _items_ Isso também quer dizer que podemos definir que a largura de um _item_ se ajustará automaticamente ao redor dele {{"demo": "pages/components/grid/AutoGrid.js", "bg": true}} + + ## Grade Complexa -A demonstração a seguir não segue a especificação do Material Design, mas ilustra como a grade pode ser usada para criar leiautes complexos. +A demo a seguir não segue as normas do Material Design mas ilustra bem como a malha pode ser usada para criar layouts complexos {{"demo": "pages/components/grid/ComplexGrid.js", "bg": true}} + + ## Grade Aninhada -As propriedades `container` e `item` são boleanas e independentes. Elas podem ser combinados. +As props `container` e `item` são buleanas independentes; Podemo ser combinados para permitir que um componente Grid seja tanto um contêiner flex como um filho (item do contêiner) -> Um **container** flex é a caixa gerada por um elemento com uma exibição definida por `flex` ou `inline-flex`. Os filhos em um fluxo de um container flex são chamados de flex **items** e são dispostos usando o modelo de leiaute flex (flex layout). + + +> A flex **container** is the box generated by an element with a computed display of `flex` or `inline-flex`. In-flow children of a flex container are called flex **items** and are laid out using the flex layout model. https://www.w3.org/TR/css-flexbox-1/#box-model {{"demo": "pages/components/grid/NestedGrid.js", "bg": true}} -⚠️ Definindo uma largura explícita para um elemento de grade que é um contêiner flexível, item flexível e tem espaçamento ao mesmo tempo, tem um comportamento inesperado, evite fazendo isto: +⚠️ Defining an explicit width to a Grid element that is flex container, flex item, and has spacing at the same time lead to unexpected behavior, avoid doing it: + + ```jsx ``` -Se você precisar fazer isso, remova uma das propriedades. + +If you need to do such, remove one of the props. + + + +## Colunas + +You can change the default number of columns (12) with the `columns` prop. + +{{"demo": "pages/components/grid/ColumnsGrid.js", "bg": true}} + + ## Limitações -### Margem negativa -Há uma limitação com a margem negativa que usamos para implementar o espaçamento entre itens. Uma barra de rolagem horizontal irá aparecer se uma margem negativa vai além do ``. Existem 3 soluções disponíveis: -1. Não usar o recurso de espaçamento e implementá-lo no espaço do usuário `spacing={0}` (Padrão). -2. Aplicando padding ao pai com pelo menos metade do valor de espaçamento aplicado ao filho: +### Margem negativa + +The spacing between items is implemented with a negative margin. This might lead to unexpected behaviors. For instance, to apply a background color, you need to apply `display: flex;` to the parent. - ```jsx - -
    - - //... - -
    - - ``` -3. Adicionando `overflow-x: hidden;` para o pai. ### white-space: nowrap; A configuração inicial em itens flexíveis é `min-width: auto`. Isto causa um conflito de posicionamento quando os elementos filhos estão usando `white-space: nowrap`. Você pode enfrentar o problema com: + + ```jsx ``` -Para que o item permaneça dentro do contêiner, você precisa definir `min-width: 0`. Para que o item permaneça dentro do contêiner, você precisa definir `min-width: 0`. + +Para que o item permaneça dentro do contêiner, você precisa definir `min-width: 0`. In practice, you can set the `zeroMinWidth` prop: + + ```jsx ``` + {{"demo": "pages/components/grid/AutoGridNoWrap.js", "bg": true}} + + ### direction: column | column-reverse -As propriedades `xs`, `sm`, `md`, `lg`, e `xl` **não são suportadas** com containers `direction="column"` e `direction="column-reverse"`. +The `xs`, `sm`, `md`, `lg`, and `xl` props are **not supported** within `direction="column"` and `direction="column-reverse"` containers. + +They define the number of grids the component will use for a given breakpoint. They are intended to control **width** using `flex-basis` in `row` containers but they will impact height in `column` containers. If used, these props may have undesirable effects on the height of the `Grid` item elements. + -Elas definem o número de grades que o componente usará para um determinado ponto de quebra. Elas destinam-se a controlar a **largura** usando `flex-basis` em contêineres `row`, mas elas irão impactar a altura em contêineres `column`. Se usadas, essas propriedades podem ter efeitos indesejáveis na altura dos elementos do item `Grid`. ## Leiaute de Grade CSS -Material-UI não fornece nenhuma funcionalidade CSS de Grade, mas como pode ser visto abaixo, você pode facilmente usar leiaute de Grade CSS em suas páginas. +The `Grid` component is using CSS flexbox internally. But as seen below, you can easily use [the system](/system/grid/) and CSS Grid to layout your pages. {{"demo": "pages/components/grid/CSSGrid.js", "bg": true}} + + + +## System props + +As a CSS utility component, the `Grid` supports all [`system`](/system/properties/) properties. You can use them as props directly on the component. For instance, a padding: + + + +```jsx + +``` diff --git a/docs/src/pages/components/grid/grid-ru.md b/docs/src/pages/components/grid/grid-ru.md index 8e11a05191326f..bbecb2dadbab83 100644 --- a/docs/src/pages/components/grid/grid-ru.md +++ b/docs/src/pages/components/grid/grid-ru.md @@ -9,7 +9,7 @@ materialDesign: https://material.io/design/layout/understanding-layout.html

    Сетка адаптивного макета Material Design адаптируется к размеру экрана и ориентации, обеспечивая согласованность макетов.

    -[Сетка](https://material.io/design/layout/responsive-layout-grid.html) создает визуальную согласованность между макетами, позволяя гибко адаптироваться к разнообразным дизайнам. Material Design's responsive UI is based on a 12-column grid layout. +[Сетка](https://material.io/design/layout/responsive-layout-grid.html) создает визуальную согласованность между макетами, позволяя гибко адаптироваться к разнообразным дизайнам. Адаптивный пользовательский интерфейс Material Design основан на сетке с 12 колонками. {{"component": "modules/components/ComponentLinkHeader.js"}} @@ -19,22 +19,14 @@ materialDesign: https://material.io/design/layout/understanding-layout.html Система сетки реализована с помощью компонента `Grid`: -- It uses [CSS's Flexible Box module](https://www.w3.org/TR/css-flexbox-1/) for high flexibility. -- Существует два типа макетов: *контейнеры* и *элементы*. -- Item widths are set in percentages, so they're always fluid and sized relative to their parent element. +- Она использует [модуль Flexible Box CSS](https://www.w3.org/TR/css-flexbox-1/) для повышенной гибкости. +- Существует два типа макетов: *containers* и *items*. +- Ширина item задается в процентах, поэтому они всегда гибко изменяют свой размер относительно родительского элемента. - Элементы имеют отступы для создания промежутков между отдельными элементами. - Существует пять контрольных точек прерывания сетки: xs, sm, md, lg и xl. -- Integer values can be given to each breakpoint, indicating how many of the 12 available columns are occupied by the component when the viewport width satisfies the [breakpoint contraints](/customization/breakpoints/#default-breakpoints). +- Каждой точке останова (breakpoint) могут быть присвоены целые значения, указывая сколько из 12 доступных столбцов занято компонентом, когда ширина видимости соответствует [breakpoint constants](/customization/breakpoints/#default-breakpoints) (константе breakpoint). -Если вы **слабо знакомы (или совсем незнакомы) с Flexbox**, мы рекомендуем Вам прочитать это руководство [CSS-трюки Flexbox](https://css-tricks.com/snippets/css/a-guide-to-flexbox/). - -## Интервал - -Смысл адаптивной сетки не в равной ширине столбцов, а в равной ширине интервалов между ними. В Material Design величина отступов и ширина столбцов привязаны к базовой сетке с шагом в **8px**. Свойство `spacing` может принимать целочисленные значения от 0 до 10 включительно. По умолчанию расстояние между соседними элементами (GridItem) задано линейной функцией: `output(spacing) = spacing * 8px`, т.е. `spacing={2}` устанавливает значение интервала 16px. - -Поведение функции `output` можно изменить, [отредактировав тему](/customization/spacing/). - -{{"demo": "pages/components/grid/SpacingGrid.js", "bg": true}} +Если вы **слабо знакомы (или совсем незнакомы) с Flexbox**, мы рекомендуем Вам прочитать это руководство [CSS-Tricks Flexbox](https://css-tricks.com/snippets/css/a-guide-to-flexbox/). ## Адаптивные сетки @@ -46,9 +38,9 @@ Column widths are integer values between 1 and 12; they apply at any breakpoint A value given to a breakpoint applies to all the other breakpoints wider than it (unless overridden, as you can read later in this page). For example, `xs={12}` sizes a component to occupy the whole viewport width regardless of its size. -{{"demo": "pages/components/grid/CenteredGrid.js", "bg": true}} +{{"demo": "pages/components/grid/BasicGrid.js", "bg": true}} -### Сетка с точками прерывания +### Сетка с несколькими breakpoints Components may have multiple widths defined, causing the layout to change at the defined breakpoint. Width values given to larger breakpoints override those given to smaller breakpoints. @@ -56,6 +48,41 @@ For example, `xs={12} sm={6}` sizes a component to occupy half of the viewport w {{"demo": "pages/components/grid/FullWidthGrid.js", "bg": true}} +## Интервал + +To control space between children, use the `spacing` prop. The spacing value can be any positive number, including decimals and any string. The prop is converted into a CSS property using the [`theme.spacing()`](/customization/spacing/) helper. + +{{"demo": "pages/components/grid/SpacingGrid.js", "bg": true}} + +## Responsive values + +You can switch the props' value based on the active breakpoint. For instance, we can implement the ["recommended"](https://material.io/design/layout/responsive-layout-grid.html) responsive layout grid of Material Design. + +{{"demo": "pages/components/grid/ResponsiveGrid.js", "bg": true}} + +Responsive values is supported by: + +- `columns` +- `columnSpacing` +- `direction` +- `rowSpacing` +- `spacing` +- all the [other props](#system-props) of the system + +> ⚠️ When using a responsive `columns` prop, each grid item needs its corresponding breakpoint. For instance, this is not working. The grid item misses the value for `md`: +> +> ```jsx +> +> +> > +> ``` + +### Row & column spacing + +The `rowSpacing` and `columnSpacing` props allow for specifying the row and column gaps independently. It's similar to the `row-gap` and `column-gap` properties of [CSS Grid](/system/grid/#row-gap-amp-column-gap). + +{{"demo": "pages/components/grid/RowAndColumnSpacing.js", "bg": true}} + ## Интерактивность Ниже приведен интерактивный пример, который демонстрирует результаты различных настроек сетки: @@ -64,21 +91,21 @@ For example, `xs={12} sm={6}` sizes a component to occupy half of the viewport w ## Авто-разметка -Автоматическая разметка позволяет *элементам* равномерно распределяться по всему доступному пространству. Это также означает, что вы можете установить ширину одного *элемента* и остальные автоматически изменят свои размеры вокруг него. +The Auto-layout makes the _items_ equitably share the available space. That also means you can set the width of one _item_ and the others will automatically resize around it. {{"demo": "pages/components/grid/AutoGrid.js", "bg": true}} ## Сложная сетка -Следующая демонстрация не соответствует спецификации Material Design, но иллюстрирует, как сетка может использоваться для создания сложных макетов. +The following demo doesn't follow the Material Design guidelines, but illustrates how the grid can be used to build complex layouts. {{"demo": "pages/components/grid/ComplexGrid.js", "bg": true}} ## Вложенная сетка -Свойства `container` и `item` - это два независимых логических значения. Они могут быть объединены. +The `container` and `item` props are two independent booleans; they can be combined to allow a Grid component to be both a flex container and child. -> Flex **контейнер** представляет собой блок, созданный элементом с вычисляемым свойством display `flex` или `inline-flex`. Дочерние элементы flex контейнера называются flex **элементы** и размещаются используя flex-модель. +> A flex **container** is the box generated by an element with a computed display of `flex` or `inline-flex`. In-flow children of a flex container are called flex **items** and are laid out using the flex layout model. https://www.w3.org/TR/css-flexbox-1/#box-model @@ -92,26 +119,17 @@ https://www.w3.org/TR/css-flexbox-1/#box-model If you need to do such, remove one of the props. -## Ограничения +## Столбцы -### Отрицательный margin +You can change the default number of columns (12) with the `columns` prop. -Есть одно ограничение с отрицательным margin, которое мы используем для добавления расстояния между элементами. Появится горизонтальная прокрутка, если отрицательный margin выходит за пределы ``. Существует 3 обходных пути, чтобы избежать этого: +{{"demo": "pages/components/grid/ColumnsGrid.js", "bg": true}} -1. Не использовать отступы и не реализовывать их в пространстве пользователя. `spacing={0}` (по умолчанию). -2. Применение внутренних отступов (padding) к родителю с использованием, как минимум, половины значения отступа, имеющегося у дочернего элемента: +## Ограничения - ```jsx - -
    - - //... - -
    - - ``` +### Отрицательный margin -3. Добавление `overflow-x: hidden;` к родителю. +The spacing between items is implemented with a negative margin. This might lead to unexpected behaviors. For instance, to apply a background color, you need to apply `display: flex;` to the parent. ### white-space: nowrap; @@ -122,7 +140,7 @@ If you need to do such, remove one of the props. ``` -Чтобы элемент оставался в контейнере, необходимо установить `min-width: 0`. Чтобы элемент оставался в контейнере, необходимо установить `min-width: 0`. +Чтобы элемент оставался в контейнере, необходимо установить `min-width: 0`. In practice, you can set the `zeroMinWidth` prop: ```jsx @@ -133,12 +151,20 @@ If you need to do such, remove one of the props. ### direction: column | column-reverse -Свойства `xs`, `sm`, `md`, `lg`, и `xl` **не поддерживаются** внутри контейнеров с `direction="column"` и `direction="column-reverse"`. +The `xs`, `sm`, `md`, `lg`, and `xl` props are **not supported** within `direction="column"` and `direction="column-reverse"` containers. -Определяют количество клеток, которое компонент будет использовать для данной точки останова. Они предназначены для контроля **ширины** с помощью `flex-basis` в `row`-контейнерах, но в `column`-контейнерах они повлияют на высоту. При использовании этих свойств возможен побочный эффект в виде изменения высоты `Grid`-ячеек. +They define the number of grids the component will use for a given breakpoint. They are intended to control **width** using `flex-basis` in `row` containers but they will impact height in `column` containers. If used, these props may have undesirable effects on the height of the `Grid` item elements. -## Макет CSS Grid +## CSS макет сетки -Material-UI сам по себе не предоставляет никакой функциональности CSS Grid, но, как видно ниже, вы можете легко использовать CSS Grid в макете страницы. +The `Grid` component is using CSS flexbox internally. But as seen below, you can easily use [the system](/system/grid/) and CSS Grid to layout your pages. {{"demo": "pages/components/grid/CSSGrid.js", "bg": true}} + +## System props + +As a CSS utility component, the `Grid` supports all [`system`](/system/properties/) properties. You can use them as props directly on the component. For instance, a padding: + +```jsx + +``` diff --git a/docs/src/pages/components/grid/grid-zh.md b/docs/src/pages/components/grid/grid-zh.md index 587a8938ed622b..b098786ee25446 100644 --- a/docs/src/pages/components/grid/grid-zh.md +++ b/docs/src/pages/components/grid/grid-zh.md @@ -9,7 +9,7 @@ materialDesign: https://material.io/design/layout/understanding-layout.html

    Material Design 响应式布局的栅格可适应屏幕大小和方向,确保布局在不同尺寸之间的一致性。

    -[Grid 栅格组件](https://material.io/design/layout/responsive-layout-grid.html) 能确保不同布局间的视觉层面的舒适感,同时在众多不同设计中保持灵活性。 Material Design's responsive UI is based on a 12-column grid layout. +[Grid 栅格组件](https://material.io/design/layout/responsive-layout-grid.html) 能确保不同布局间的视觉层面的舒适感,同时在众多不同设计中保持灵活性。 Material Design 基于 12 列的网格布局来做到 UI 的响应式。 {{"component": "modules/components/ComponentLinkHeader.js"}} @@ -19,43 +19,70 @@ materialDesign: https://material.io/design/layout/understanding-layout.html 栅格系统是通过 `Grid` 组件实现的: -- It uses [CSS's Flexible Box module](https://www.w3.org/TR/css-flexbox-1/) for high flexibility. +- 它使用 [CSS 弹性盒子模块](https://www.w3.org/TR/css-flexbox-1/) 来做到高度灵活。 - 它有两种类型的布局: _containers_ , _items_。 -- Item widths are set in percentages, so they're always fluid and sized relative to their parent element. +- 每项的宽度是按百分比设置的,所以它们的大小总是相对于它们的父元素流动。 - 子项目(items)使用内边距来保持和其他块(items)的间距。 - 其中五个断点可供使用:xs,sm,md,lg 和 xl。 - 你可以为每个断点提供整数值,表示当视口宽度满足 [断点约束](/customization/breakpoints/#default-breakpoints) 时,12 个可用列中有多少列被组件占用。 若你对 **flexbox 不太熟悉**,我们建议你阅读 [CSS-Tricks flexbox](https://css-tricks.com/snippets/css/a-guide-to-flexbox/) 手册。 -## Spacing 间距 - -响应式栅格布局追求块与块之间统一的间距,而非块本身的宽度。 Material design 外边距(margins)和列(columns)都遵循了一个 **8px** 的方块形基线栅格。 你可以将 `spacing` 的属性值设置为一个在 0 到 10 之间的整数 默认情况下,两个栅格块(item)之间的间距遵循一个线性函数。`output(spacing) = spacing * 8px`,例如:`spacing={2}` 将会创建一个 16px 宽的间隙。 - -通过[使用主题](/customization/spacing/),该变换函数的输出是可定制的。 - -{{"demo": "pages/components/grid/SpacingGrid.js", "bg": true}} - ## Fluid grids 流式网格 流式网格可以通过列(column)来缩放和调整内容的大小。 A fluid grid's layout can use breakpoints to determine if the layout needs to change dramatically. ### 基本栅格 -每一列的宽度是 1 到 12 之间的整数值;它们适用于任何断点,并且表明了组件占用多少列。 +Column widths are integer values between 1 and 12; they apply at any breakpoint and indicate how many columns are occupied by the component. -你可以给定一个断点值来应用于比它更宽的所有其他断点(除非被覆盖,你可以在本页的后面部分阅读被覆盖后的行为)。 例如,无论组件的大小如何,`xs={12}` 都会占据整个视口的宽度。 +A value given to a breakpoint applies to all the other breakpoints wider than it (unless overridden, as you can read later in this page). For example, `xs={12}` sizes a component to occupy the whole viewport width regardless of its size. -{{"demo": "pages/components/grid/CenteredGrid.js", "bg": true}} +{{"demo": "pages/components/grid/BasicGrid.js", "bg": true}} ### 有断点的栅格 -组件可能会定义多种宽度,这会导致布局会根据事先定义的断点(breakpoint)来改变其宽度。 你可以给较大断点指定宽度值。那么它会覆盖给较小断点指定的宽度值。 +Components may have multiple widths defined, causing the layout to change at the defined breakpoint. Width values given to larger breakpoints override those given to smaller breakpoints. -例如,`xs={12} sm={6}` 表示当视口宽度为 [600 或更多像素](/customization/breakpoints/#default-breakpoints) 时,将组件的大小调整为占据视口宽度的一半(6列)。 对于较小的视口,该组件将填充所有 12 个可用的列。 +For example, `xs={12} sm={6}` sizes a component to occupy half of the viewport width (6 columns) when viewport width is [600 or more pixels](/customization/breakpoints/#default-breakpoints). For smaller viewports, the component fills all 12 available columns. {{"demo": "pages/components/grid/FullWidthGrid.js", "bg": true}} +## Spacing 间距 + +To control space between children, use the `spacing` prop. The spacing value can be any positive number, including decimals and any string. The prop is converted into a CSS property using the [`theme.spacing()`](/customization/spacing/) helper. + +{{"demo": "pages/components/grid/SpacingGrid.js", "bg": true}} + +## 响应式的值 + +You can switch the props' value based on the active breakpoint. For instance, we can implement the ["recommended"](https://material.io/design/layout/responsive-layout-grid.html) responsive layout grid of Material Design. + +{{"demo": "pages/components/grid/ResponsiveGrid.js", "bg": true}} + +Responsive values is supported by: + +- `columns` +- `columnSpacing` +- `direction` +- `rowSpacing` +- `spacing` +- all the [other props](#system-props) of the system + +> ⚠️ When using a responsive `columns` prop, each grid item needs its corresponding breakpoint. For instance, this is not working. The grid item misses the value for `md`: +> +> ```jsx +> +> +> > +> ``` + +### Row & column spacing + +The `rowSpacing` and `columnSpacing` props allow for specifying the row and column gaps independently. It's similar to the `row-gap` and `column-gap` properties of [CSS Grid](/system/grid/#row-gap-amp-column-gap). + +{{"demo": "pages/components/grid/RowAndColumnSpacing.js", "bg": true}} + ## 交互式 下面是一个交互式的演示,你也可以探索不同设置下的视觉结果: @@ -64,21 +91,21 @@ materialDesign: https://material.io/design/layout/understanding-layout.html ## 自适应布局 -自适应布局让 _块(items)_ 平均地使用空间。 这也意味着你可以显式设置一个 _块(item)_ 的宽度,而使其他项的大小自动进行调整。 +The Auto-layout makes the _items_ equitably share the available space. That also means you can set the width of one _item_ and the others will automatically resize around it. {{"demo": "pages/components/grid/AutoGrid.js", "bg": true}} ## 复杂的栅格 -以下的演示不遵循 Material Design 规范,但说明了如何使用栅格构建复杂的布局。 +The following demo doesn't follow the Material Design guidelines, but illustrates how the grid can be used to build complex layouts. {{"demo": "pages/components/grid/ComplexGrid.js", "bg": true}} ## 嵌套栅格 -`容器(container)` 和 `块(item)` 属性分别是两个独立的布尔值。 它们可以组合起来使用,使 Grid 组件既是一个 flex 容器,又是一个子容器。 +The `container` and `item` props are two independent booleans; they can be combined to allow a Grid component to be both a flex container and child. -> 通过将计算过的将 `flex` 或 `inline-flex` 的显示赋予给一个元素,你可以生成一个 flex 的 **容器(container )** 。 Flex 容器(container)的流入子容器称为 flex ** 项(items**), 它们的布局基于 flex 布局模型。 +> A flex **container** is the box generated by an element with a computed display of `flex` or `inline-flex`. In-flow children of a flex container are called flex **items** and are laid out using the flex layout model. https://www.w3.org/TR/css-flexbox-1/#box-model @@ -92,26 +119,17 @@ https://www.w3.org/TR/css-flexbox-1/#box-model If you need to do such, remove one of the props. -## 设计局限 +## 列 -### 负边距 +You can change the default number of columns (12) with the `columns` prop. -当我们使用负边距来实现项目之间的间距的时候,会有一个限制。 如果负边距超出``元素,则会出现水平滚动。 我们提供了 3 种解决方案: +{{"demo": "pages/components/grid/ColumnsGrid.js", "bg": true}} -1. 不使用 spacing 的特性,并且在用户层面设置成`spacing={0}`。 -2. 将间距(padding)应用于父级元素,并且将至少一半的间距值赋予子级元素: +## 设计局限 - ```jsx - -
    - - //... - -
    - - ``` +### 负边距 -3. 在父元素上添加 `overflow-x: hidden;`。 +The spacing between items is implemented with a negative margin. This might lead to unexpected behaviors. For instance, to apply a background color, you need to apply `display: flex;` to the parent. ### white-space: nowrap; @@ -122,7 +140,7 @@ If you need to do such, remove one of the props. ``` -若想让子项继续在容器内展示,您需要设置 `min-width: 0`。 若想让子项继续在容器内展示,您需要设置 `min-width: 0`。 +若想让子项继续在容器内展示,您需要设置 `min-width: 0`。 In practice, you can set the `zeroMinWidth` prop: ```jsx @@ -133,12 +151,20 @@ If you need to do such, remove one of the props. ### direction: column | column-reverse -`direction="column"` 和 `direction="column-reverse"` 的容器**不支持**和断点有关的 `xs`, `sm`, `md`, `lg`,以及 `xl` 这几个属性。 +The `xs`, `sm`, `md`, `lg`, and `xl` props are **not supported** within `direction="column"` and `direction="column-reverse"` containers. -它们决定在某个断点下组件占几个网格。 它们是为了在 `row` 容器中使用 `flex-basis` 来控制 **width**,但这样做会影响 `column` 容器的高度。 如果使用这些属性,可能会对 `Grid` 块元素的高度产生副作用。 +They define the number of grids the component will use for a given breakpoint. They are intended to control **width** using `flex-basis` in `row` containers but they will impact height in `column` containers. If used, these props may have undesirable effects on the height of the `Grid` item elements. ## CSS 栅格布局 -Material-UI 本身不提供任何 CSS Grid 功能,但如下所示,您可以轻松使用 CSS Grid 来布局您的页面。 +The `Grid` component is using CSS flexbox internally. But as seen below, you can easily use [the system](/system/grid/) and CSS Grid to layout your pages. {{"demo": "pages/components/grid/CSSGrid.js", "bg": true}} + +## System props + +As a CSS utility component, the `Grid` supports all [`system`](/system/properties/) properties. You can use them as props directly on the component. For instance, a padding: + +```jsx + +``` diff --git a/docs/src/pages/components/icons/SvgIconsColor.js b/docs/src/pages/components/icons/SvgIconsColor.js index 9087b220ada225..440d9e92c68863 100644 --- a/docs/src/pages/components/icons/SvgIconsColor.js +++ b/docs/src/pages/components/icons/SvgIconsColor.js @@ -1,6 +1,6 @@ import * as React from 'react'; import Box from '@material-ui/core/Box'; -import { green } from '@material-ui/core/colors'; +import { pink } from '@material-ui/core/colors'; import SvgIcon from '@material-ui/core/SvgIcon'; function HomeIcon(props) { @@ -23,9 +23,10 @@ export default function SvgIconsColor() { + - + ); } diff --git a/docs/src/pages/components/icons/SvgIconsColor.tsx b/docs/src/pages/components/icons/SvgIconsColor.tsx index 4639155bc42887..1cdfa9436084a8 100644 --- a/docs/src/pages/components/icons/SvgIconsColor.tsx +++ b/docs/src/pages/components/icons/SvgIconsColor.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; import Box from '@material-ui/core/Box'; -import { green } from '@material-ui/core/colors'; +import { pink } from '@material-ui/core/colors'; import SvgIcon, { SvgIconProps } from '@material-ui/core/SvgIcon'; function HomeIcon(props: SvgIconProps) { @@ -23,9 +23,10 @@ export default function SvgIconsColor() { + - + ); } diff --git a/docs/src/pages/components/icons/icons-de.md b/docs/src/pages/components/icons/icons-de.md index a53cc7f48ecd45..cd58fe581ba013 100644 --- a/docs/src/pages/components/icons/icons-de.md +++ b/docs/src/pages/components/icons/icons-de.md @@ -17,7 +17,7 @@ Material-UI provides icons support in three ways: ## Material Icons -Material Design has standardized over 1,100 official icons, each in five different "themes" (see below). For each SVG icon, we export the respective React component from the @material-ui/icons package. You can [search the full list of these icons](/components/material-icons/). +Google has created over 1,700 official Material icons, each in five different "themes" (see below). For each SVG icon, we export the respective React component from the @material-ui/icons package. You can [search the full list of these icons](/components/material-icons/). ### Installation @@ -70,7 +70,7 @@ Each Material icon also has a "theme": Filled (default), Outlined, Rounded, Two- - Twotone theme is exported as `@material-ui/icons/DeleteTwoTone`, - Sharp theme is exported as `@material-ui/icons/DeleteSharp`. -> Note: The Material Design specification names the icons using "snake_case" naming (for example `delete_forever`, `add_a_photo`), while `@material-ui/icons` exports the respective icons using "PascalCase" naming (for example `DeleteForever`, `AddAPhoto`). There are three exceptions to this naming rule: `3d_rotation` exported as `ThreeDRotation`, `4k` exported as `FourK`, and `360` exported as `ThreeSixty`. +> Note: The Material Design guidelines name the icons using "snake_case" naming (for example `delete_forever`, `add_a_photo`), while `@material-ui/icons` exports the respective icons using "PascalCase" naming (for example `DeleteForever`, `AddAPhoto`). There are three exceptions to this naming rule: `3d_rotation` exported as `ThreeDRotation`, `4k` exported as `FourK`, and `360` exported as `ThreeSixty`. {{"demo": "pages/components/icons/SvgMaterialIcons.js"}} @@ -247,16 +247,20 @@ Then, you can use the two-tone font directly: Note that the Font Awesome icons weren't designed like the Material Design icons (compare the two previous demos). The fa icons are cropped to use all the space available. You can adjust for this with a global override: ```js -import IconButton from '@material-ui/core/IconButton'; -import SvgIcon from '@material-ui/core/SvgIcon'; - -// ... - - - - - - +const theme = createTheme({ + components: { + MuiIcon: { + styleOverrides: { + root: { + // Match 24px = 3 * 2 + 1.125 * 16 + boxSizing: 'content-box', + padding: 3, + fontSize: '1.125rem', + }, + }, + }, + }, +}); ``` {{"demo": "pages/components/icons/FontAwesomeIconSize.js"}} @@ -304,24 +308,14 @@ import SvgIcon from '@material-ui/core/SvgIcon'; You need to provide a text alternative that is only visible to assistive technologies. ```jsx +import Box from '@material-ui/core/Box'; import Icon from '@material-ui/core/Icon'; import { visuallyHidden } from '@material-ui/utils'; -import { makeStyles } from '@material-ui/core/styles'; - -const classes = makeStyles({ visuallyHidden })(); // ... -import Icon from '@material-ui/core/Icon'; -import Typography from '@material-ui/core/Typography'; - -// ... - -add_circle -Erstellen Sie einen Benutzer - add_circle -Erstellen Sie einen Benutzer +Create a user ``` #### Referenz diff --git a/docs/src/pages/components/icons/icons-es.md b/docs/src/pages/components/icons/icons-es.md index 61ac722097dff0..d840a6b30d9147 100644 --- a/docs/src/pages/components/icons/icons-es.md +++ b/docs/src/pages/components/icons/icons-es.md @@ -17,7 +17,7 @@ Material-UI da soporte para iconos de tres maneras: ## Material Icons -Material Design has standardized over 1,100 official icons, each in five different "themes" (see below). For each SVG icon, we export the respective React component from the @material-ui/icons package. Puedes [buscar la lista completa de estos iconos](/components/material-icons/). +Google has created over 1,700 official Material icons, each in five different "themes" (see below). For each SVG icon, we export the respective React component from the @material-ui/icons package. Puedes [buscar la lista completa de estos iconos](/components/material-icons/). ### Instalación @@ -70,7 +70,7 @@ Each Material icon also has a "theme": Filled (default), Outlined, Rounded, Two- - El tema Twotone se exporta como `@material-ui/icons/DeleteTwoTone`, - El tema Sharp se exporta como `@material-ui/icons/DeleteSharp`. -> Nota: La especificación de Material Design nombra los iconos usando el nombre "snake_case" (por ejemplo `delete_forever`, `add_a_photo`), mientras `@material-ui/icons` exporta los iconos respectivos usando el nombre "PascalCase" (por ejemplo `DeleteForever`, `AddAPhoto`). Hay tres excepciones a esta regla de nomenclatura: `3d_rotation` exportada como `ThreeDRotation`, `4k` exportado como `FourK`, y `360` exportado como `ThreeSixty`. +> Note: The Material Design guidelines name the icons using "snake_case" naming (for example `delete_forever`, `add_a_photo`), while `@material-ui/icons` exports the respective icons using "PascalCase" naming (for example `DeleteForever`, `AddAPhoto`). Hay tres excepciones a esta regla de nomenclatura: `3d_rotation` exportada como `ThreeDRotation`, `4k` exportado como `FourK`, y `360` exportado como `ThreeSixty`. {{"demo": "pages/components/icons/SvgMaterialIcons.js"}} @@ -308,16 +308,14 @@ import SvgIcon from '@material-ui/core/SvgIcon'; You need to provide a text alternative that is only visible to assistive technologies. ```jsx +import Box from '@material-ui/core/Box'; import Icon from '@material-ui/core/Icon'; import { visuallyHidden } from '@material-ui/utils'; -import { makeStyles } from '@material-ui/core/styles'; - -const classes = makeStyles({ visuallyHidden })(); // ... add_circle -Crear ususario +Create a user ``` #### Referencia diff --git a/docs/src/pages/components/icons/icons-fr.md b/docs/src/pages/components/icons/icons-fr.md index 4a8adf74d14c99..28aee3f644887b 100644 --- a/docs/src/pages/components/icons/icons-fr.md +++ b/docs/src/pages/components/icons/icons-fr.md @@ -15,9 +15,9 @@ Material-UI provides icons support in three ways: 1. With the [SvgIcon](#svgicon) component, a React wrapper for custom SVG icons. 1. With the [Icon](#icon-font-icons) component, a React wrapper for custom font icons. -## Icônes Material +## Icônes de Material -Material Design has standardized over 1,100 official icons, each in five different "themes" (see below). For each SVG icon, we export the respective React component from the @material-ui/icons package. You can [search the full list of these icons](/components/material-icons/). +For each SVG icon, we export the respective React component from the @material-ui/icons package. Material Design has standardized over 1,100 official icons, each in five different "themes" (see below). You can [search the full list of these icons](/components/material-icons/). ### Installation @@ -31,16 +31,16 @@ npm install @material-ui/icons yarn add @material-ui/icons ``` -These components use the Material-UI `SvgIcon` component to render the SVG path for each icon, and so have a peer-dependency on `@materialui/core`. +Ces composants utilisent le composant Material-UI `SvgIcon` pour afficher le chemin SVG pour chaque icône, et ont donc une dépendance sur `@materialui/core`. -If you aren't already using Material-UI in your project, you can add it with: +Si vous n'utilisez pas déjà Material-UI dans votre projet, vous pouvez l'ajouter avec: ```sh -// avec npm -npm install @material-ui/core +// Avec npm +npm install @material-ui/core@next -// avec yarn -yarn add @material-ui/core +// Avec yarn +yarn add @material-ui/core@next ``` ### Utilisation @@ -60,9 +60,9 @@ Import icons using one of these two options: import { AccessAlarm, ThreeDRotation } from '@material-ui/icons'; ``` -The safest for bundle size is Option 1, but some developers prefer Option 2. Make sure you follow the [minimizing bundle size guide](/guides/minimizing-bundle-size/#option-2) before using the second approach. +La plus sûre pour la taille des packages est l'option 1, mais certains développeurs préfèrent l'option 2. Make sure you follow the [minimizing bundle size guide](/guides/minimizing-bundle-size/#option-2) before using the second approach. -Each Material icon also has a "theme": Filled (default), Outlined, Rounded, Two-tone, and Sharp. To import the icon component with a theme other than the default, append the theme name to the icon name. For example `@material-ui/icons/Delete` icon with: +Chaque icône de Material a également un "thème" : Configuré (par défaut), `Outlined`, `Rounded`, `Two-tone`, et `Sharp`. Pour importer le composant d'icône avec un autre thème que celui par défaut, ajoutez le nom du thème au nom de l'icône. For example `@material-ui/icons/Delete` icon with: - Filled theme (default) is exported as `@material-ui/icons/Delete`, - Outlined theme is exported as `@material-ui/icons/DeleteOutlined`, @@ -76,13 +76,13 @@ Each Material icon also has a "theme": Filled (default), Outlined, Rounded, Two- ### Test -For testing purposes, each icon exposed from `@material-ui/icons` has a `data-testid` attribute with the name of the icon. Par exemple: +Pour tester les fins, chaque icône importée de `@material-ui/icons` a un attribut `data-testid` avec le nom de l'icône. Par exemple: ```jsx import DeleteIcon from '@material-ui/icons/Delete'; ``` -has the following attribute once mounted: +a l'attribut suivant une fois monté : ```html @@ -90,10 +90,10 @@ has the following attribute once mounted: ## SvgIcon -If you need a custom SVG icon (not available in the [Material Icons](/components/material-icons/)) you can use the `SvgIcon` wrapper. This component extends the native `` element: +Si vous avez besoin d'une icône SVG personnalisée (non disponible dans les [icônes Material](/components/material-icons/)), vous pouvez utiliser le wrapper `SvgIcon`. This component extends the native `` element: - It comes with built-in accessibility. -- SVG elements should be scaled for a 24x24px viewport so that the resulting icon can be used as is, or included as a child for other Material-UI components that use icons. (This can be customized with the `viewBox` attribute). +- Les éléments de type SVG doivent être mis à l'échelle pour une affichage de 24x24px afin que l'icône puisse être utilisée telle quelle, ou inclus en tant qu'enfant pour d'autres composants Material-UI qui utilisent des icônes. (This can be customized with the `viewBox` attribute). - By default, the component inherits the current color. Optionally, you can apply one of the theme colors using the `color` prop. ```jsx @@ -131,7 +131,7 @@ import StarIcon from './star.svg'; ``` -It's also possible to use it with "url-loader" or "file-loader". This is the approach used by Create React App. +It's also possible to use it with "url-loader" or "file-loader". C'est l'approche utilisée pour une application créée par React App. ```jsx // webpack.config.js @@ -148,7 +148,7 @@ import { ReactComponent as StarIcon } from './star.svg'; ### createSvgIcon -The `createSvgIcon` utility component is used to create the [Material icons](#material-icons). It can be used to wrap an SVG path with an SvgIcon component. +La fonction `createSvgIcon` est utilisé pour créer les [icônes Material](#material-icons). Il peut être utilisé pour envelopper le chemin SVG avec un composant `SvgIcon`. ```jsx const HomeIcon = createSvgIcon( @@ -161,19 +161,19 @@ const HomeIcon = createSvgIcon( ### Font Awesome -If you find that there are layout issues when using FontAwesomeIcon from `@fortawesome/react-fontawesome`, you can try passing the Font Awesome SVG data directly to SvgIcon. +Si vous trouvez qu'il y a des problèmes de mise en page lors de l'utilisation de `FontAwesomeIcon` de `@fortawesome/react-fontawesome`, vous pouvez essayer de passer les données SVG Font Awesome directement à `SvgIcon`. -[Font Awesome](https://fontawesome.com/icons) Peut être utilisé avec le composant `Icon` comme suit: +Ci-dessous est une comparaison du composant `FontAwesomeIcon` et d'un composant `SvgIcon` encapsulé. {{"demo": "pages/components/icons/FontAwesomeSvgIconDemo.js"}} -FontAwesomeIcon's `fullWidth` prop can also be used to approximate the correct dimensions, but it isn't perfect. +La propriété `fullWidth` de `FontAwesomeicon` peut également être utilisée pour approximer les bonnes dimensions, mais elle n'est pas parfaite. -### Icônes de police Material +### Autres bibliothèques #### MDI -[materialdesignicons.com](https://materialdesignicons.com/) provides over 2,000 icons. For the wanted icon, copy the SVG `path` they provide, and use it as the child of the `SvgIcon` component, or with `createSvgIcon()`. +[materialdesignicons.com](https://materialdesignicons.com/) provides over 2,000 icons. Pour l'icône souhaitée, copiez le chemin (`path`) de SVG qu'ils fournissent, et l'utiliser comme fils du composant `SvgIcon` ou avec la fonction `createSvgIcon()`. Note: [mdi-material-ui](https://github.com/TeamWertarbyte/mdi-material-ui) has already wrapped each of these SVG icons with the `SvgIcon` component, so you don't have to do it yourself. @@ -191,7 +191,7 @@ Par défaut, une icône héritera de la couleur de texte actuelle. Vous pouvez ### Icônes de police Material -`Icon` will by default set the correct base class name for the Material Icons font (filled variant). All you need to do is load the font, for instance, via Google Web Fonts: +`Icon` définira par défaut le nom de la classe de base pour la police des icônes de Material grace à la propriété `variant`. Tout ce que vous avez à faire est de charger la police, par exemple, via Google Web Fonts : ```html @@ -199,9 +199,9 @@ Par défaut, une icône héritera de la couleur de texte actuelle. Vous pouvez {{"demo": "pages/components/icons/Icons.js"}} -### Custom font +### Police personnalisée -For other fonts, you can customize the baseline class name using the `baseClassName` prop. For instance, you can display two-tone icons with Material Design: +Pour les autres polices, vous pouvez personnaliser le nom de la classe de base en utilisant la propriété `baseClassName`. Par exemple, vous pouvez afficher des icônes two-tone avec Material Design: ```jsx import Icon from '@material-ui/core/Icon'; @@ -209,15 +209,15 @@ import Icon from '@material-ui/core/Icon'; ; ``` {{"demo": "pages/components/icons/TwoToneIcons.js"}} -#### Global base class name +#### Nom global de la classe de base -Modifying the `baseClassName` prop for each component usage is repetitive. You can change the default prop globally with the theme +La modification de la propriété `baseClassName` pour chaque utilisation du composant est répétitive. Vous pouvez changer la propriété par défaut via le thème ```js const theme = createTheme({ @@ -232,7 +232,7 @@ const theme = createTheme({ }); ``` -Then, you can use the two-tone font directly: +Ensuite, vous pouvez utiliser la police de tow-tone directement : ```jsx add_circle @@ -240,11 +240,11 @@ Then, you can use the two-tone font directly: ### Font Awesome -[Font Awesome](https://fontawesome.com/icons) can be used with the `Icon` component as follows: +La police [Font Awesome](https://fontawesome.com/icons) peut être utilisée avec la composante `Icon` comme suit : {{"demo": "pages/components/icons/FontAwesomeIcon.js"}} -Note that the Font Awesome icons weren't designed like the Material Design icons (compare the two previous demos). The fa icons are cropped to use all the space available. You can adjust for this with a global override: +Notez que les icônes Font Awesome n'ont pas été conçues comme les icônes Material Design (comparer les deux démos précédentes). Les icônes de fa (Font Awesome) sont recadrées pour utiliser tout l'espace disponible. Vous pouvez ajuster pour cela avec une substitution globale : ```js const theme = createTheme({ @@ -267,28 +267,28 @@ const theme = createTheme({ ## Font vs SVG. Which approach to use? -Both approaches work fine, however there are some subtle differences, especially in terms of performance and rendering quality. Whenever possible SVG is preferred as it allows code splitting, supports more icons, and renders faster and better. +Les deux approches fonctionnent bien, cependant il y a des différences subtiles, en particulier en termes de performance et de qualité d'affichage. Dans la mesure du possible, SVG est préféré car il permet le fractionnement de code, supporte plus d'icônes, et rend plus rapidement et mieux. -For more details, take a look at [why GitHub migrated from font icons to SVG icons](https://github.blog/2016-02-22-delivering-octicons-with-svg/). +Pour plus de détails, jetez un œil à [pourquoi GitHub a migré des icônes de police vers les icônes SVG](https://github.blog/2016-02-22-delivering-octicons-with-svg/). ## Accessibilité -Icons can convey all sorts of meaningful information, so it's important to ensure they are accessible where appropriate. There are two use cases you'll want to consider: +Les icônes peuvent transmettre toutes sortes d'informations significatives, il est donc important de assurer qu'elles soient accessibles dans le cas échéant. Il y a deux cas d'utilisation que vous deviez considérer : -- **Decorative icons** that are only being used for visual or branding reinforcement. S'ils étaient supprimés de la page, les utilisateurs comprendraient toujours et pourraient utiliser votre page. -- **Semantic icons** are ones that you're using to convey meaning, rather than just pure decoration. This includes icons without text next to them that are used as interactive controls — buttons, form elements, toggles, etc. +- **Icônes décoratives** qui ne sont utilisées que pour le renforcement visuel ou de marque. S'ils étaient supprimés de la page, les utilisateurs comprendraient toujours et pourraient utiliser votre page. +- **Les Icônes sémantiques** sont celles que vous utilisez pour transmettre du sens, plutôt que de simples décorations. Ceci inclut les icônes sans texte à côté d'elles qui sont utilisées comme contrôles interactifs — boutons, éléments de formulaire, toggles, etc. -### Decorative icons +### Icônes décoratives -If your icons are purely decorative, you're already done! The `aria-hidden=true` attribute is added so that your icons are properly accessible (invisible). +Si vos icônes sont purement décoratives, vous avez déjà fini ! The `aria-hidden=true` attribute is added so that your icons are properly accessible (invisible). -### Semantic icons +### Icônes sémantiques -#### Semantic SVG icons +#### Icônes sémantiques type SVG -You should include the `titleAccess` prop with a meaningful value. The `role="img"` attribute and the `` element are added so that your icons are correctly accessible. +Vous devez inclure la propriété `titleAccess` avec une valeur significative. L'attribut `role="img"` et l'élément `` sont ajoutés pour que vos icônes soient correctement accessibles. -In the case of focusable interactive elements, for example when used with an icon button, you can use the `aria-label` prop: +Dans le cas d'éléments interactifs ciblables, par exemple lorsqu'il est utilisé avec un bouton d'icône, vous pouvez utiliser la propriété `aria-label`: ```jsx import IconButton from '@material-ui/core/IconButton'; @@ -303,9 +303,9 @@ import SvgIcon from '@material-ui/core/SvgIcon'; </IconButton> ``` -#### Semantic font icons +#### Icônes de polices sémantiques -You need to provide a text alternative that is only visible to assistive technologies. +Vous devez fournir une alternative de texte qui n'est visible que pour les technologies d'assistance. ```jsx import Icon from '@material-ui/core/Icon'; diff --git a/docs/src/pages/components/icons/icons-ja.md b/docs/src/pages/components/icons/icons-ja.md index 6e229018ccc6f6..c89174241486ca 100644 --- a/docs/src/pages/components/icons/icons-ja.md +++ b/docs/src/pages/components/icons/icons-ja.md @@ -17,35 +17,36 @@ Material-UIはアイコンについて、3種類の提供方法をサポート ## マテリアルアイコン(Material Icons) -Material Design has standardized over 1,100 official icons, each in five different "themes" (see below). For each SVG icon, we export the respective React component from the @material-ui/icons package. [これらのアイコンの一覧を検索](/components/material-icons/)することが出来ます。 +Google has created over 1,700 official Material icons, each in five different "themes" (see below). SVGアイコンは、`@material-ui/icons` パッケージでReactコンポーネントとしてそれぞれエクスポートされています。 [これらのアイコンの一覧を検索](/components/material-icons/)することが出来ます。 ### インストール 次を使用して、プロジェクトディレクトリにパッケージをインストールします。 ```sh -// with npm -npm install @material-ui/icons +// npmの場合 +npm install @material-ui/icons@next -// with yarn -yarn add @material-ui/icons +// yarnの場合 +yarn add @material-ui/icons@next ``` -These components use the Material-UI `SvgIcon` component to render the SVG path for each icon, and so have a peer-dependency on `@materialui/core`. +これらのコンポーネントはMaterial-UIの `SvgIcon` コンポーネントを使用してそれぞれのアイコンを表示するため、`@materialui/core` をpeer-dependencyに持っています。 -If you aren't already using Material-UI in your project, you can add it with: +プロジェクトでまだMaterial-UIを使用していない場合は、次のコマンドでインストールできます: ```sh // npmの場合 -npm install @material-ui/core +npm install @material-ui/core@next // yarnの場合 -yarn add @material-ui/core +yarn add @material-ui/core@next + ``` ### 使い方 -Import icons using one of these two options: +次の2つの選択肢のいずれかを使用してアイコンをインポートします。 - Option 1: @@ -60,29 +61,29 @@ Import icons using one of these two options: import { AccessAlarm, ThreeDRotation } from '@material-ui/icons'; ``` -The safest for bundle size is Option 1, but some developers prefer Option 2. Make sure you follow the [minimizing bundle size guide](/guides/minimizing-bundle-size/#option-2) before using the second approach. +バンドルサイズの面で最も安全なのはOption 1ですが、一部の開発者はOption 2を好みます。 2番目の方法を使用する前に [minimizing bundle size guide](/guides/minimizing-bundle-size/#option-2) に従ってください。 -Each Material icon also has a "theme": Filled (default), Outlined, Rounded, Two-tone, and Sharp. To import the icon component with a theme other than the default, append the theme name to the icon name. For example `@material-ui/icons/Delete` icon with: +各マテリアルアイコンには「テーマ」があります。Filled(デフォルト)、Outline、Rounded、Two-tone、そしてSharpです。 デフォルト以外のテーマでアイコンコンポーネントをインポートするには、アイコン名にテーマ名を追加します。 例えば `@material-ui/icons/Delete` アイコンには次のものが含まれます: -- Filled theme (default) is exported as `@material-ui/icons/Delete`, -- Outlined theme is exported as `@material-ui/icons/DeleteOutlined`, -- Rounded theme is exported as `@material-ui/icons/DeleteRounded`, -- Twotone theme is exported as `@material-ui/icons/DeleteTwoTone`, -- Sharp theme is exported as `@material-ui/icons/DeleteSharp`. +- `@material-ui/icons/Delete` としてエクスポートされた Filled テーマ(デフォルト) +- `@material-ui/icons/DeleteOutlined` としてエクスポートされた Outlinedテーマ +- `@material-ui/icons/DeleteRounded` としてエクスポートされた Roundedテーマ +- `@material-ui/icons/DeleteTwoTone` としてエクスポートされた Twotone テーマ +- `@material-ui/icons/DeleteSharp` としてエクスポートされた Sharpテーマ -> Note: The Material Design specification names the icons using "snake_case" naming (for example `delete_forever`, `add_a_photo`), while `@material-ui/icons` exports the respective icons using "PascalCase" naming (for example `DeleteForever`, `AddAPhoto`). There are three exceptions to this naming rule: `3d_rotation` exported as `ThreeDRotation`, `4k` exported as `FourK`, and `360` exported as `ThreeSixty`. +> Note: The Material Design guidelines name the icons using "snake_case" naming (for example `delete_forever`, `add_a_photo`), while `@material-ui/icons` exports the respective icons using "PascalCase" naming (for example `DeleteForever`, `AddAPhoto`). There are three exceptions to this naming rule: `3d_rotation` exported as `ThreeDRotation`, `4k` exported as `FourK`, and `360` exported as `ThreeSixty`. {{"demo": "pages/components/icons/SvgMaterialIcons.js"}} ### テスト -For testing purposes, each icon exposed from `@material-ui/icons` has a `data-testid` attribute with the name of the icon. 例えば: +テストの目的で、 `@material-ui/icons` で公開された各アイコンには、アイコンの名前を持つ `data-testid` 属性があります。 例えば: ```jsx import DeleteIcon from '@material-ui/icons/Delete'; ``` -has the following attribute once mounted: +は次の属性を持っています ```html <svg data-testid="DeleteIcon"></svg> @@ -90,7 +91,7 @@ has the following attribute once mounted: ## SvgIcon -If you need a custom SVG icon (not available in the [Material Icons](/components/material-icons/)) you can use the `SvgIcon` wrapper. This component extends the native `<svg>` element: +カスタム SVG アイコンが必要な場合 ( [Material Icons](/components/material-icons/)にない場合) は、 `SvgIcon` ラッパーを使用できます。 This component extends the native `<svg>` element: - It comes with built-in accessibility. - SVG elements should be scaled for a 24x24px viewport so that the resulting icon can be used as is, or included as a child for other Material-UI components that use icons. (This can be customized with the `viewBox` attribute). @@ -114,7 +115,7 @@ function HomeIcon(props) { {{"demo": "pages/components/icons/SvgIconsSize.js"}} -### Component prop +### Component プロパティ You can use the `SvgIcon` wrapper even if your icons are saved in the `.svg` format. [svgr](https://github.com/smooth-code/svgr) has loaders to import SVG files and use them as React components. For example, with webpack: @@ -163,7 +164,7 @@ const HomeIcon = createSvgIcon( If you find that there are layout issues when using FontAwesomeIcon from `@fortawesome/react-fontawesome`, you can try passing the Font Awesome SVG data directly to SvgIcon. -[Font Awesome](https://fontawesome.com/icons) は、 `Icon` コンポーネントとともに、次のように使用することができます。 +以下は、`FontAwesomeIcon`コンポーネントとラップされた`SvgIcon`コンポーネントの比較です。 {{"demo": "pages/components/icons/FontAwesomeSvgIconDemo.js"}} @@ -187,11 +188,11 @@ import Icon from '@material-ui/core/Icon'; <Icon>star</Icon> ``` -デフォルトでは、アイコンは現在のテキストの色を継承します。 デフォルトでは、アイコンは現在のテキストの色を継承します。 デフォルトでは、アイコンは現在のテキストの色を継承します。 必要に応じて、テーマの色特性のいずれかを使用して、アイコンの色を設定することができます。: `primary`, `secondary`, `action`, `error` & `disabled`. デフォルトでは、アイコンは現在のテキストの色を継承します。 デフォルトでは、アイコンは現在のテキストの色を継承します。 必要に応じて、テーマの色特性のいずれかを使用して、アイコンの色を設定することができます。: `primary`, `secondary`, `action`, `error` & `disabled`. +デフォルトでは、アイコンは現在のテキストの色を継承します。 必要に応じて、テーマの色のプロパティのいずれかを使用して、アイコンの色を設定することができます。`primary`, `secondary`, `action`, `error`, `disabled` です。 ### Font Material icons -`Icon` will by default set the correct base class name for the Material Icons font (filled variant). All you need to do is load the font, for instance, via Google Web Fonts: +`Icon` はデフォルトで、Material Iconsフォント(Filled)に正しいベースクラス名を設定します。 あなたがしなければいけないことは例えばGoogle Web Fontsなどからフォントをロードすることだけです。 ```html <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" /> @@ -199,9 +200,9 @@ import Icon from '@material-ui/core/Icon'; {{"demo": "pages/components/icons/Icons.js"}} -### Custom font +### カスタムフォント -For other fonts, you can customize the baseline class name using the `baseClassName` prop. For instance, you can display two-tone icons with Material Design: +他のフォントを使用する場合、 `baseClassName` プロパティを使用してベースラインクラス名をカスタマイズできます。 たとえば、two-toneのMaterial Designアイコンを表示できます。 ```jsx import Icon from '@material-ui/core/Icon'; @@ -240,11 +241,11 @@ Then, you can use the two-tone font directly: ### Font Awesome -[Font Awesome](https://fontawesome.com/icons) can be used with the `Icon` component as follows: +[Font Awesome](https://fontawesome.com/icons) は `Icon` コンポーネントで以下のように使用できます: {{"demo": "pages/components/icons/FontAwesomeIcon.js"}} -Note that the Font Awesome icons weren't designed like the Material Design icons (compare the two previous demos). The fa icons are cropped to use all the space available. You can adjust for this with a global override: +Font AwesomeのアイコンはMaterial Designのアイコンのようにデザインされていない(前の2つのデモと比較して)ことに注意してください。 faアイコンは、利用可能なすべてのスペースを使用するようにトリミングされます。 これはグローバルオーバーライドで調整できます。 ```js const theme = createTheme({ @@ -265,30 +266,30 @@ const theme = createTheme({ {{"demo": "pages/components/icons/FontAwesomeIconSize.js"}} -## Font vs SVG どのアプローチを使用しますか? どのアプローチを使用しますか? どのアプローチを使用しますか? どのアプローチを使用しますか? +## Font vs SVG どのアプローチを使用しますか? -Both approaches work fine, however there are some subtle differences, especially in terms of performance and rendering quality. Whenever possible SVG is preferred as it allows code splitting, supports more icons, and renders faster and better. +どちらの方法でも問題なく動作しますが、特にパフォーマンスとレンダリング品質の点で、わずかな違いがいくつかあります。 コード分割を可能にし、より多くのアイコンをサポートし、より速くより良くレンダリングするので、可能な限りSVGが優先されます。 -For more details, take a look at [why GitHub migrated from font icons to SVG icons](https://github.blog/2016-02-22-delivering-octicons-with-svg/). +詳しくは、[why GitHub migrated from font icons to SVG icons](https://github.blog/2016-02-22-delivering-octicons-with-svg/)をご覧ください。 ## アクセシビリティ -Icons can convey all sorts of meaningful information, so it's important to ensure they are accessible where appropriate. There are two use cases you'll want to consider: +アイコンはあらゆる種類の有意義な情報を伝えることができるので、適切な場所にアクセスできるようにすることが重要です。 考慮するユースケースが2つあります。 -- **Decorative icons** that are only being used for visual or branding reinforcement. それらがページから削除された場合でも、ユーザーはあなたのページを理解して使用することができます。 -- **Semantic icons** are ones that you're using to convey meaning, rather than just pure decoration. This includes icons without text next to them that are used as interactive controls — buttons, form elements, toggles, etc. +- **装飾アイコン** は、視覚的またはブランド強化のためにのみ使用されています。 それらがページから削除された場合でも、ユーザーはあなたのページを理解して使用することができます。 +- **セマンティックアイコン** は、単なる装飾ではなく、意味を伝えるためのものです。 これには、ボタン、フォーム要素、トグルなど、インタラクティブコントロールとして使用されるテキストのないアイコンが含まれます。 -### Decorative icons +### 装飾アイコン -If your icons are purely decorative, you're already done! 他のフォントの場合、Iconコンポーネントの `className` プロパティを使用して クラス名を指定する必要があります。 +アイコンが純粋に装飾的なものであれば、他にすることはありません。 他のフォントの場合、Iconコンポーネントの `className` プロパティを使用して クラス名を指定する必要があります。 -### Semantic icons +### セマンティックアイコン -#### Semantic SVG icons +#### セマンティックSVGアイコン -You should include the `titleAccess` prop with a meaningful value. The `role="img"` attribute and the `<title>` element are added so that your icons are correctly accessible. +`titleAccess` プロパティに意味のある値を含める必要があります。 正しいアクセシビリティのために、`role="img"` 属性と `<title>` 要素が追加されます。 -In the case of focusable interactive elements, for example when used with an icon button, you can use the `aria-label` prop: +アイコンボタンと一緒に使用したときのようにフォーカス可能なインタラクティブ要素の場合は、 `aria-label` プロパティを使用できます。 ```jsx import IconButton from '@material-ui/core/IconButton'; @@ -303,21 +304,19 @@ import SvgIcon from '@material-ui/core/SvgIcon'; </IconButton> ``` -#### Semantic font icons +#### セマンティックフォントアイコン -You need to provide a text alternative that is only visible to assistive technologies. +支援技術にのみ表示される代替テキストを提供する必要があります。 ```jsx +import Box from '@material-ui/core/Box'; import Icon from '@material-ui/core/Icon'; import { visuallyHidden } from '@material-ui/utils'; -import { makeStyles } from '@material-ui/core/styles'; - -const classes = makeStyles({ visuallyHidden })(); // ... <Icon>add_circle</Icon> -<Typography variant="srOnly">Create a user</Typography> +<Box component="span" sx={visuallyHidden}>Create a user</Box> ``` #### リファレンス diff --git a/docs/src/pages/components/icons/icons-pt.md b/docs/src/pages/components/icons/icons-pt.md index 617878ac9071d0..f26f791efdce99 100644 --- a/docs/src/pages/components/icons/icons-pt.md +++ b/docs/src/pages/components/icons/icons-pt.md @@ -17,7 +17,7 @@ Material-UI fornece suporte de ícones de três maneiras: ## Ícones Material -O Material Design padronizou mais de 1.100 ícones oficiais, cada um em cinco "temas" diferentes (veja abaixo). Para cada ícone SVG, exportamos o respectivo componente React do pacote @material-ui/icons. Você pode [pesquisar na lista completa destes ícones](/components/material-icons/). +Google has created over 1,700 official Material icons, each in five different "themes" (see below). Para cada ícone SVG, exportamos o respectivo componente React do pacote @material-ui/icons. Você pode [pesquisar na lista completa destes ícones](/components/material-icons/). ### Instalação @@ -70,7 +70,7 @@ Cada ícone Material também tem um "tema": Filled (padrão), Outlined, Rounded, - Tema Two tone (dois tons) é exportado como `@material-ui/icons/DeleteTwoTone`, - Tema Sharp (pontiagudo) é exportado como `@material-ui/icons/DeleteSharp`. -> Nota: A especificação Material Design nomeia os ícones usando a nomeação "snake_case" (por exemplo, `delete_forever`, `add_a_photo`), enquanto `@material-ui/icons` exporta os respectivos ícones usando a nomeação "PascalCase" (por exemplo `DeleteForever`, `AddAPhoto`). Há três exceções a essa regra de nomenclatura: `3d_rotation` exportado como `ThreeDRotation`, `4k` exportado como `FourK`e `360` exportado como `ThreeSixty`. +> Note: The Material Design guidelines name the icons using "snake_case" naming (for example `delete_forever`, `add_a_photo`), while `@material-ui/icons` exports the respective icons using "PascalCase" naming (for example `DeleteForever`, `AddAPhoto`). Há três exceções a essa regra de nomenclatura: `3d_rotation` exportado como `ThreeDRotation`, `4k` exportado como `FourK`e `360` exportado como `ThreeSixty`. {{"demo": "pages/components/icons/SvgMaterialIcons.js"}} @@ -224,7 +224,7 @@ const theme = createTheme({ components: { MuiIcon: { defaultProps: { - // Substitui o valor padrão `material-icons`. + // Replace the `material-icons` default value. baseClassName: 'material-icons-two-tone', }, }, @@ -252,7 +252,7 @@ const theme = createTheme({ MuiIcon: { styleOverrides: { root: { - // Corresponde 24px = 3 * 2 + 1.125 * 16 + // Match 24px = 3 * 2 + 1.125 * 16 boxSizing: 'content-box', padding: 3, fontSize: '1.125rem', @@ -273,7 +273,7 @@ Para maiores detalhes, dê uma olhada no [porque o GitHub migrou ícones de font ## Acessibilidade -Icons can convey all sorts of meaningful information, so it's important to ensure they are accessible where appropriate. There are two use cases you'll want to consider: +Ícones podem transmitir todos os tipos de informações significativas, então é importante garantir que eles estejam apropriadamente acessíveis. Há dois casos de uso que você deve considerar: - **Ícones decorativos** que são usados apenas para reforço visual ou de marca. Se eles forem removidos da página, os usuários ainda entenderiam e poderiam usar sua página. - **Semantic icons** are ones that you're using to convey meaning, rather than just pure decoration. Isso inclui ícones sem texto ao lado deles que são usados como controles interativos — botões, elementos de forma, toggles, etc. @@ -308,16 +308,14 @@ import SvgIcon from '@material-ui/core/SvgIcon'; Você precisa fornecer um texto alternativo que só seja visível para tecnologia assistiva. ```jsx +import Box from '@material-ui/core/Box'; import Icon from '@material-ui/core/Icon'; import { visuallyHidden } from '@material-ui/utils'; -import { makeStyles } from '@material-ui/core/styles'; - -const classes = makeStyles({ visuallyHidden })(); // ... <Icon>add_circle</Icon> -<Typography variant="srOnly">Crie um usuário</Typography> +<Box component="span" sx={visuallyHidden}>Create a user</Box> ``` #### Referência diff --git a/docs/src/pages/components/icons/icons-ru.md b/docs/src/pages/components/icons/icons-ru.md index 462671292dab06..87dfcbab900cfb 100644 --- a/docs/src/pages/components/icons/icons-ru.md +++ b/docs/src/pages/components/icons/icons-ru.md @@ -17,7 +17,7 @@ Material-UI обеспечивает поддержку иконок тремя ## Material Иконки -Material Design has standardized over 1,100 official icons, each in five different "themes" (see below). For each SVG icon, we export the respective React component from the @material-ui/icons package. Вы можете [найти полный список этих иконок здесь](/components/material-icons/). +Google has created over 1,700 official Material icons, each in five different "themes" (see below). For each SVG icon, we export the respective React component from the @material-ui/icons package. Вы можете [найти полный список этих иконок здесь](/components/material-icons/). ### Инструкция по установке @@ -36,10 +36,10 @@ These components use the Material-UI `SvgIcon` component to render the SVG path If you aren't already using Material-UI in your project, you can add it with: ```sh -// with npm +// для npm npm install @material-ui/core -// with yarn +// для yarn yarn add @material-ui/core ``` @@ -70,7 +70,7 @@ Each Material icon also has a "theme": Filled (default), Outlined, Rounded, Two- - Twotone theme is exported as `@material-ui/icons/DeleteTwoTone`, - Sharp theme is exported as `@material-ui/icons/DeleteSharp`. -> Note: The Material Design specification names the icons using "snake_case" naming (for example `delete_forever`, `add_a_photo`), while `@material-ui/icons` exports the respective icons using "PascalCase" naming (for example `DeleteForever`, `AddAPhoto`). There are three exceptions to this naming rule: `3d_rotation` exported as `ThreeDRotation`, `4k` exported as `FourK`, and `360` exported as `ThreeSixty`. +> Note: The Material Design guidelines name the icons using "snake_case" naming (for example `delete_forever`, `add_a_photo`), while `@material-ui/icons` exports the respective icons using "PascalCase" naming (for example `DeleteForever`, `AddAPhoto`). There are three exceptions to this naming rule: `3d_rotation` exported as `ThreeDRotation`, `4k` exported as `FourK`, and `360` exported as `ThreeSixty`. {{"demo": "pages/components/icons/SvgMaterialIcons.js"}} @@ -308,16 +308,14 @@ import SvgIcon from '@material-ui/core/SvgIcon'; You need to provide a text alternative that is only visible to assistive technologies. ```jsx +import Box from '@material-ui/core/Box'; import Icon from '@material-ui/core/Icon'; import { visuallyHidden } from '@material-ui/utils'; -import { makeStyles } from '@material-ui/core/styles'; - -const classes = makeStyles({ visuallyHidden })(); // ... <Icon>add_circle</Icon> -<Typography variant="srOnly">Создать пользователя</Typography> +<Box component="span" sx={visuallyHidden}>Create a user</Box> ``` #### Справка diff --git a/docs/src/pages/components/icons/icons-zh.md b/docs/src/pages/components/icons/icons-zh.md index 2932077c389467..92936c414e7934 100644 --- a/docs/src/pages/components/icons/icons-zh.md +++ b/docs/src/pages/components/icons/icons-zh.md @@ -17,7 +17,7 @@ Material-UI 通过以下三种方式来支持图标的使用: ## Material Icons -Google 已经创建了 1300 多个官方的 Material icons,每个图标都有5种不同的“主题”(见下文)。 对于每个 SVG 图标,我们从 `@material-ui/icons` 包中导出相应的 React 组件。 您可以 [搜索完整的图标列表](/components/material-icons/)。 +Google has created over 1,700 official Material icons, each in five different "themes" (see below). 对于每个 SVG 图标,我们从 `@material-ui/icons` 包中导出相应的 React 组件。 您可以 [搜索完整的图标列表](/components/material-icons/)。 ### 安装 @@ -70,7 +70,7 @@ yarn add @material-ui/core@next - 导出为 Twotone 主题:`@material-ui/icons/DeleteTwoTone `, - 导出为 Sharp 主题:`@material-ui/icons/DeleteSharp `, -> 友情提示:Material Design 在命名图标的时候遵循了 “snake_case” 变量命名法(例如,`delete_forever` 和 `add_a_photo`),而 `@material-ui/icons` 则使用 “PascalCase” 来命名导出的相应图标(例如,`DeleteForever` 以及 `AddAPhoto`)。 并且此命名规则有三个特例:`3d_rotation` 导出为 `ThreeDRotation`,`4k` 导出为 `FourK`,以及 `360` 导出为 `ThreeSixty`。 +> Note: The Material Design guidelines name the icons using "snake_case" naming (for example `delete_forever`, `add_a_photo`), while `@material-ui/icons` exports the respective icons using "PascalCase" naming (for example `DeleteForever`, `AddAPhoto`). 并且此命名规则有三个特例:`3d_rotation` 导出为 `ThreeDRotation`,`4k` 导出为 `FourK`,以及 `360` 导出为 `ThreeSixty`。 {{"demo": "pages/components/icons/SvgMaterialIcons.js"}} @@ -224,7 +224,7 @@ const theme = createTheme({ components: { MuiIcon: { defaultProps: { - // 替换 `material-icons` 的默认值。 + // Replace the `material-icons` default value. baseClassName: 'material-icons-two-tone', }, }, @@ -252,7 +252,7 @@ const theme = createTheme({ MuiIcon: { styleOverrides: { root: { - // 匹配 24px = 3 * 2 + 1.125 * 16 + // Match 24px = 3 * 2 + 1.125 * 16 boxSizing: 'content-box', padding: 3, fontSize: '1.125rem', @@ -273,14 +273,14 @@ const theme = createTheme({ ## 无障碍设计 -Icons can convey all sorts of meaningful information, so it's important to ensure they are accessible where appropriate. There are two use cases you'll want to consider: There are two use cases you'll want to consider: +图标可以传达各种有意义的信息,所以确保它们在适当的地方可以被无障碍访问是很重要的。 下面是两个你需要考虑到的用例: -- **装饰性图标** 仅用于增强视觉或强调品牌。 即使将它们从页面中移除,用户仍然可以理解并能够使用整个界面。 -- **Semantic icons** are ones that you're using to convey meaning, rather than just pure decoration. 这包含了没有文字辅助说明的图标,这些图标一般被用作在交互式控件中 — 按钮、表单元素、切换按钮等。 这包含了没有文字辅助说明的图标,这些图标一般被用作在交互式控件中 — 按钮、表单元素、切换按钮等。 +- **装饰性图标**仅用于增强视觉或强调品牌。 即使将它们从页面中移除,用户仍然可以理解并能够使用整个界面。 +- **语义图标**指你用来传达意义的图标,而不仅仅是纯粹的装饰。 这包含了没有文字辅助说明的图标,这些图标一般被用作在交互式控件中 — 按钮、表单元素、切换按钮等。 ### 装饰性图标 -If your icons are purely decorative, you're already done! 而添加 `aria-hidden=true` 属性可以让你的图标变成正确的且可访问的(隐形的)。 +如果你的图标纯粹是装饰性的,那么已经大功告成了! 而添加 `aria-hidden=true` 属性可以让你的图标变成正确的且可访问的(隐形的)。 ### 语义图标 @@ -308,16 +308,14 @@ import SvgIcon from '@material-ui/core/SvgIcon'; 你需要提供一个只有辅助技术才能看到的文本替代方案: ```jsx +import Box from '@material-ui/core/Box'; import Icon from '@material-ui/core/Icon'; import { visuallyHidden } from '@material-ui/utils'; -import { makeStyles } from '@material-ui/core/styles'; - -const classes = makeStyles({ visuallyHidden })(); // ... <Icon>add_circle</Icon> -<span className={classes.visuallyHidden}>创建一个用户</span> +<Box component="span" sx={visuallyHidden}>Create a user</Box> ``` #### 参考 diff --git a/docs/src/pages/components/image-list/image-list-fr.md b/docs/src/pages/components/image-list/image-list-fr.md index 56135d44bf21a9..667e20c489a840 100644 --- a/docs/src/pages/components/image-list/image-list-fr.md +++ b/docs/src/pages/components/image-list/image-list-fr.md @@ -1,60 +1,60 @@ --- -title: Composant React Grid List +title: Composant React Image List components: ImageList, ImageListItem, ImageListItemBar materialDesign: https://material.io/components/image-lists githubLabel: 'component: ImageList' --- -# Grid list +# Liste d'images -<p class="description">Les listes de grille affichent une collection d'images dans une grille organisée.</p> +<p class="description">Les listes d'images affichent une collection d'images dans une grille organisée.</p> -[Les listes de grille](https://material.io/design/components/image-lists.html) représentent une collection d'éléments dans un motif répété. Ils aident à améliorer la compréhension visuelle du contenu qu'ils contiennent. +Les listes d'images représentent une collection d'éléments dans un motif répété. Ils aident à améliorer la compréhension visuelle du contenu qu'ils contiennent. {{"component": "modules/components/ComponentLinkHeader.js"}} -## Grid list contenant uniquement des images +## Liste d'images standard -Standard image lists are best for items of equal importance. They have a uniform container size, ratio, and spacing. +Les listes d'images standard sont idéales pour les éléments d'égale importance. Ils ont une taille, un rapport et un espacement de conteneur uniformes. {{"demo": "pages/components/image-list/StandardImageList.js"}} -## Grid list avec barres de titre +## Liste d'images matelassées -Quilted image lists emphasize certain items over others in a collection. They create hierarchy using varied container sizes and ratios. +Les listes d'images matelassées mettent en valeur certains éléments par rapport à d'autres dans une collection. Ils créent une hiérarchie en utilisant des tailles et des ratios de conteneurs variés. {{"demo": "pages/components/image-list/QuiltedImageList.js"}} -## Grid List sur une ligne +## Liste d'images tissées -Woven image lists use alternating container ratios to create a rhythmic layout. A woven image list is best for browsing peer content. +Les listes d'images tissées utilisent des ratios de conteneurs alternés pour créer une mise en page rythmique. Une liste d'images tissées est idéale pour parcourir le contenu des pairs. {{"demo": "pages/components/image-list/WovenImageList.js"}} -## Grid list avancée +## Liste d'images avancée -Masonry image lists use dynamically sized container heights that reflect the aspect ratio of each image. This image list is best used for browsing uncropped peer content. +Les listes d'images avancées utilisent des hauteurs de conteneurs de taille dynamique qui reflètent le rapport hauteur/largeur de chaque image. Cette liste d'images est mieux utilisée pour parcourir le contenu de pairs non rogné. {{"demo": "pages/components/image-list/MasonryImageList.js"}} -## Image list with title bars +## Liste d'images avec barres de titre Cet exemple illustre l'utilisation de `ImageListItemBar` pour ajouter une superposition à chaque `ImageListItem`. La superposition peut accueillir un `titre`, `sous - titre` et une action secondaire - dans cet exemple un `IconButton`. {{"demo": "pages/components/image-list/TitlebarImageList.js"}} -### Title bar below image (standard) +### Barre de titre sous l'image (standard) -The title bar can be placed below the image. +La barre de titre peut être placée sous l'image. {{"demo": "pages/components/image-list/TitlebarBelowImageList.js"}} -### Title bar below image (masonry) +### Barre de titre sous l'image (avancé) {{"demo": "pages/components/image-list/TitlebarBelowMasonryImageList.js"}} -## Custom image list +## Liste d'images personnalisée -Les tuiles ont une barre de titre personnalisée, placée en haut et avec un dégradé personnalisé `titleBackground`. L'action secondaire `IconButton` est positionnée sur la gauche. Les tuiles ont une barre de titre personnalisée, placée en haut et avec un dégradé personnalisé `titleBackground`. +Dans cet exemple, les éléments ont une barre de titre personnalisée, positionnée en haut et avec un dégradé `titleBackground` personnalisé. L'action secondaire `IconButton` est positionnée sur la gauche. La prop `gap` est utilisée pour ajuster l'écart entre les éléments. {{"demo": "pages/components/image-list/CustomImageList.js", "defaultCodeOpen": false}} diff --git a/docs/src/pages/components/image-list/image-list-ja.md b/docs/src/pages/components/image-list/image-list-ja.md index bf9619e588a423..ef1332dd24edce 100644 --- a/docs/src/pages/components/image-list/image-list-ja.md +++ b/docs/src/pages/components/image-list/image-list-ja.md @@ -9,51 +9,51 @@ githubLabel: 'component: ImageList' <p class="description">グリッドリストは、整理されたグリッドで画像のコレクションを表示します。</p> -[グリッドリスト](https://material.io/design/components/image-lists.html) は、繰り返しパターンの項目の集まりを表します。 それらは、保持するコンテンツの視覚的理解を改善するのに役立ちます。 +画像リストは、繰り返しパターンの項目の集まりを表します。 それらは、保持するコンテンツの視覚的理解を改善するのに役立ちます。 {{"component": "modules/components/ComponentLinkHeader.js"}} ## 画像のみのGrid list -Standard image lists are best for items of equal importance. They have a uniform container size, ratio, and spacing. +標準的な画像リストは、同じ重要度の項目のリストに最適です。 均一なコンテナーの大きさ、比率、および間隔を持ちます。 {{"demo": "pages/components/image-list/StandardImageList.js"}} -## タイトルバー付きのGrid list +## ステッチ状の(Quilted)画像リスト -Quilted image lists emphasize certain items over others in a collection. They create hierarchy using varied container sizes and ratios. +ステッチ状の画像リスト特定のアイテムをコレクション内の他のアイテムより強調します。 さまざまなコンテナサイズと比率によって階層構造が作られます。 {{"demo": "pages/components/image-list/QuiltedImageList.js"}} -## Single line Grid list 単一行グリッドリスト +## 織り込み(Woven)画像リスト -Woven image lists use alternating container ratios to create a rhythmic layout. A woven image list is best for browsing peer content. +織り込みイメージリストでは、交互のコンテナ比を使用して律動的なレイアウトを作成します。 織り込み画像リストは、ペアのコンテンツを閲覧するのに最適です。 {{"demo": "pages/components/image-list/WovenImageList.js"}} -## 高度なグリッドリスト +## 積み上げ(Masonary)画像リスト -Masonry image lists use dynamically sized container heights that reflect the aspect ratio of each image. This image list is best used for browsing uncropped peer content. +積み上げ画像リストは、各画像のアスペクト比を反映した動的なコンテナの高さを使用します。 この画像リストは、トリミングされていないペアのコンテンツ閲覧に最適です。 {{"demo": "pages/components/image-list/MasonryImageList.js"}} -## Image list with title bars +## タイトルバー付き画像リスト この例は、 `ImageListItemBar` を使用して、各 `ImageListItem`オーバーレイを追加する方法を示しています。 オーバーレイには、 `title`, `subtitle` および副次的アクション例えば`IconButton`を含めることができます。 {{"demo": "pages/components/image-list/TitlebarImageList.js"}} -### Title bar below image (standard) +### 画像の下にタイトルバー(標準) -The title bar can be placed below the image. +タイトルバーは画像の下に配置できます。 {{"demo": "pages/components/image-list/TitlebarBelowImageList.js"}} -### Title bar below image (masonry) +### 画像の下にタイトルバー(積み上げ) {{"demo": "pages/components/image-list/TitlebarBelowMasonryImageList.js"}} -## Custom image list +## カスタム画像リスト タイルには、上部にカスタムのタイトルバーがあり、カスタムのグラデーション`titleBackground`があります。 セカンダリアクション `IconButton` は左側に配置されます。 タイルには、上部にカスタムのタイトルバーがあり、カスタムのグラデーション`titleBackground`があります。 diff --git a/docs/src/pages/components/links/links-de.md b/docs/src/pages/components/links/links-de.md index 10d6a5dc3acf7f..b0ac41d98db2f1 100644 --- a/docs/src/pages/components/links/links-de.md +++ b/docs/src/pages/components/links/links-de.md @@ -36,16 +36,14 @@ When you use `target="_blank"` with Links, it is [recommended](https://developer ## Drittanbieter-Routing Bibliothek -One common use case is to perform navigation on the client only, without an HTTP round-trip to the server. Die `Link`- Komponente bietet eine Eigenschaft für diesen Anwendungsfall: `component`. - -Hier ist ein [Integrationsbeispiel mit react-router](/guides/composition/#link). +One frequent use case is to perform navigation on the client only, without an HTTP round-trip to the server. Die `Link`- Komponente bietet eine Eigenschaft für diesen Anwendungsfall: `component`. Here is a [more detailed guide](/guides/routing/#link). ## Barrierefreiheit (WAI-ARIA: https://www.w3.org/TR/wai-aria-practices/#link) - Vermeide generische Beschreibungen wie "Hier klicken" oder "Gehe zu" beim Erstellen eines Links. Verwende stattdessen [spezifische Beschreibungen](https://developers.google.com/web/tools/lighthouse/audits/descriptive-link-text). -- For the best user experience, links should stand out from the text on the page. +- For the best user experience, links should stand out from the text on the page. Sie können zum Beispiel das Standardverhalten `underline="dauerhaft"` beibehalten - Wenn ein Link keinen sinnvollen href hat, [sollte ein `<button>` Element verwendet werden](https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/anchor-is-valid.md). {{"demo": "pages/components/links/ButtonLink.js"}} diff --git a/docs/src/pages/components/links/links-es.md b/docs/src/pages/components/links/links-es.md index 0afd7a6abb33b6..52020f73920538 100644 --- a/docs/src/pages/components/links/links-es.md +++ b/docs/src/pages/components/links/links-es.md @@ -36,16 +36,14 @@ When you use `target="_blank"` with Links, it is [recommended](https://developer ## Librería externa de routing -Un uso comun es realizar la navegacion solo en el cliente, sin realizar el viaje HTTP Ida-Vuelta al servidor. The `Link` component provides a property to handle this use case: `component`. - -Here is an [integration example with react-router](/guides/composition/#link). +One frequent use case is to perform navigation on the client only, without an HTTP round-trip to the server. The `Link` component provides a property to handle this use case: `component`. Here is a [more detailed guide](/guides/routing/#link). ## Accesibilidad (WAI-ARIA: https://www.w3.org/TR/wai-aria-practices/#link) - Al proporcionar el contenido del enlace, evitar descripciones genéricas como "haga clic aquí" o "ir a". En su lugar, utilice [descripciones específicas](https://developers.google.com/web/tools/lighthouse/audits/descriptive-link-text). -- Para una mejor experiencia de usuario, los enlaces deben sobresalir del texto en la página. +- Para una mejor experiencia de usuario, los enlaces deben sobresalir del texto en la página. For instance, you can keep the default `underline="always"` behavior. - Si un enlace no tiene un significativo href, [se debe representarse mediante un `<button>` elemento](https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/anchor-is-valid.md). {{"demo": "pages/components/links/ButtonLink.js"}} diff --git a/docs/src/pages/components/links/links-fr.md b/docs/src/pages/components/links/links-fr.md index 32f23acc2b4c06..54a2dbde753b6c 100644 --- a/docs/src/pages/components/links/links-fr.md +++ b/docs/src/pages/components/links/links-fr.md @@ -10,20 +10,20 @@ waiAria: 'https://www.w3.org/TR/wai-aria-practices/#link' {{"component": "modules/components/ComponentLinkHeader.js"}} -## Simple links +## Liens de base -The Link component is built on top of the [Typography](/api/typography/) component. You can leverage its properties. +Le composant Link est construit au-dessus du composant [Typography](/api/typography/), ce qui signifie que vous pouvez utiliser ses props. {{"demo": "pages/components/links/Links.js"}} -However, the Link component has different default properties than the Typography component: +Cependant, le composant Link a des accessoires par défaut différents de ceux du composant Typography : - `color="primary"` as the link needs to stand out. - `variant="inherit"` as the link will, most of the time, be used as a child of a Typography component. -## Underline +## Souligner -The `underline` prop can be used to set the underline behavior. The default is `hover`. +La prop `underline` peut être utilisée pour définir le comportement de soulignement. La valeur par défaut est `hover`. {{"demo": "pages/components/links/UnderlineLink.js"}} @@ -32,20 +32,18 @@ The `underline` prop can be used to set the underline behavior. The default is ` When you use `target="_blank"` with Links, it is [recommended](https://developers.google.com/web/tools/lighthouse/audits/noopener) to always set `rel="noopener"` or `rel="noreferrer"` when linking to third party content. - `rel="noopener"` prevents the new page from being able to access the `window.opener` property and ensures it runs in a separate process. Without this, the target page can potentially redirect your page to a malicious URL. -- `rel="noreferrer"` has the same effect, but also prevents the *Referer* header from being sent to the new page. ⚠️ Removing the referrer header will affect analytics. +- `rel="noreferrer"` a le même effet, mais empêche également l'en-tête _Referer_ d'être envoyé à la nouvelle page. ⚠️ Removing the referrer header will affect analytics. ## Bibliothèque de routage tierce -One common use case is to perform navigation on the client only, without an HTTP round-trip to the server. The `Link` component provides a property to handle this use case: `component`. - -Here is an [integration example with react-router](/guides/composition/#link). +One frequent use case is to perform navigation on the client only, without an HTTP round-trip to the server. Le composant `Link` fournit la propriété `component` pour gérer ce cas d'utilisation. Here is a [more detailed guide](/guides/routing/#link). ## Accessibilité (WAI-ARIA: https://www.w3.org/TR/wai-aria-practices/#link) - When providing the content for the link, avoid generic descriptions like "click here" or "go to". Instead, use [specific descriptions](https://developers.google.com/web/tools/lighthouse/audits/descriptive-link-text). -- For the best user experience, links should stand out from the text on the page. +- For the best user experience, links should stand out from the text on the page. For instance, you can keep the default `underline="always"` behavior. - If a link doesn't have a meaningful href, [it should be rendered using a `<button>` element](https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/anchor-is-valid.md). {{"demo": "pages/components/links/ButtonLink.js"}} diff --git a/docs/src/pages/components/links/links-ja.md b/docs/src/pages/components/links/links-ja.md index 661d35a9e1e5cc..48b76da934612e 100644 --- a/docs/src/pages/components/links/links-ja.md +++ b/docs/src/pages/components/links/links-ja.md @@ -31,21 +31,19 @@ The `underline` prop can be used to set the underline behavior. The default is ` リンクで `target="_blank"` を使用する場合は、サードパーティのコンテンツにリンクする際に、`rel="noopener"` または`rel="noreferrer"`を必ず設定することを[推奨します。](https://developers.google.com/web/tools/lighthouse/audits/noopener) -- `rel="noopener"` は、新しいページがにアクセスできないように`window.opener`プロパティを使用し、別のプロセスで実行されるようにします。 これがないと、ターゲットページがページを悪意のあるURLにリダイレクトする可能性があります。 これがないと、ターゲットページがページを悪意のあるURLにリダイレクトする可能性があります。 これがないと、ターゲットページがページを悪意のあるURLにリダイレクトする可能性があります。 これがないと、ターゲットページがページを悪意のあるURLにリダイレクトする可能性があります。 これがないと、ターゲットページがページを悪意のあるURLにリダイレクトする可能性があります。 +- `rel="noopener"` は、新しいページがにアクセスできないように`window.opener`プロパティを使用し、別のプロセスで実行されるようにします。 これがないと、ターゲットページがページを悪意のあるURLにリダイレクトする可能性があります。 - `rel="noreferrer"` は同じ効果を持ちますが、*Referer* ヘッダーが新しいページに送信されなくなります。 ⚠️リファラーヘッダーを削除すると、分析に影響します。 ## サードパーティ製ルーティングライブラリ -最も一般的な使い方として、HTTPによるサーバ経由のページ遷移をおこなわず、クライアントのみで遷移解決する時などに使われます。 `Link` コンポーネントには、このユースケースを処理するためのプロパティが用意されています。 :`component` - -こちらは [react-routerとの統合例](/guides/composition/#link). +One frequent use case is to perform navigation on the client only, without an HTTP round-trip to the server. `Link` コンポーネントには、このユースケースを処理するためのプロパティが用意されています。 :`component` Here is a [more detailed guide](/guides/routing/#link). ## アクセシビリティ (WAI-ARIA: https://www.w3.org/TR/wai-aria-practices/#link) -- リンクのコンテンツを提供するときは、「ここをクリック」や「移動」などの一般的な説明は避けてください。 リンクのコンテンツを提供するときは、「ここをクリック」や「移動」などの一般的な説明は避けてください。 リンクのコンテンツを提供するときは、「ここをクリック」や「移動」などの一般的な説明は避けてください。 代わりに、 [特定の説明](https://developers.google.com/web/tools/lighthouse/audits/descriptive-link-text)使用します。 -- 最高のユーザーエクスペリエンスを得るには、ページ上のテキストからリンクを目立たせる必要があります。 +- リンクのコンテンツを提供するときは、「ここをクリック」や「移動」などの一般的な説明は避けてください。 代わりに、 [特定の説明](https://developers.google.com/web/tools/lighthouse/audits/descriptive-link-text)使用します。 +- 最高のユーザーエクスペリエンスを得るには、ページ上のテキストからリンクを目立たせる必要があります。 For instance, you can keep the default `underline="always"` behavior. - リンクに意味のあるhrefがない場合、[`<button>`要素を使用してレンダリングする必要があります。](https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/anchor-is-valid.md) {{"demo": "pages/components/links/ButtonLink.js"}} diff --git a/docs/src/pages/components/links/links-pt.md b/docs/src/pages/components/links/links-pt.md index 8d2743ad661a57..eae2a11a6208f6 100644 --- a/docs/src/pages/components/links/links-pt.md +++ b/docs/src/pages/components/links/links-pt.md @@ -36,16 +36,14 @@ Quando você usa `target="_blank"` com Links, é [recomendado](https://developer ## Biblioteca de roteamento de terceiros -Uma situação comum é executar a navegação apenas no lado do cliente, sem uma ida e volta HTTP ao servidor. O componente `Link` fornece uma propriedade para lidar com este caso: `component`. - -Aqui está um [exemplo de integração com react-router](/guides/composition/#link). +One frequent use case is to perform navigation on the client only, without an HTTP round-trip to the server. O componente `Link` fornece uma propriedade para lidar com este caso: `component`. Here is a [more detailed guide](/guides/routing/#link). ## Acessibilidade (WAI-ARIA: https://www.w3.org/TR/wai-aria-practices/#link) - Ao fornecer o conteúdo para o link, evite descrições genéricas como "clique aqui" ou "vá para". Em vez disso, use [descrições específicas](https://developers.google.com/web/tools/lighthouse/audits/descriptive-link-text). -- Para a melhor experiência do usuário, os links devem se destacar do texto na página. +- Para a melhor experiência do usuário, os links devem se destacar do texto na página. For instance, you can keep the default `underline="always"` behavior. - Se o link não tem um href significativo, [ele deve ser renderizado usando um elemento `<button>`](https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/anchor-is-valid.md). {{"demo": "pages/components/links/ButtonLink.js"}} diff --git a/docs/src/pages/components/links/links-ru.md b/docs/src/pages/components/links/links-ru.md index 12e5bb6b129c41..06f6164e6469d6 100644 --- a/docs/src/pages/components/links/links-ru.md +++ b/docs/src/pages/components/links/links-ru.md @@ -36,16 +36,14 @@ When you use `target="_blank"` with Links, it is [recommended](https://developer ## Сторонняя библиотека маршрутизации -One common use case is to perform navigation on the client only, without an HTTP round-trip to the server. The `Link` component provides a property to handle this use case: `component`. - -Here is an [integration example with react-router](/guides/composition/#link). +One frequent use case is to perform navigation on the client only, without an HTTP round-trip to the server. The `Link` component provides a property to handle this use case: `component`. Here is a [more detailed guide](/guides/routing/#link). ## Доступность (WAI-ARIA: https://www.w3.org/TR/wai-aria-practices/#link) - When providing the content for the link, avoid generic descriptions like "click here" or "go to". Instead, use [specific descriptions](https://developers.google.com/web/tools/lighthouse/audits/descriptive-link-text). -- For the best user experience, links should stand out from the text on the page. +- For the best user experience, links should stand out from the text on the page. For instance, you can keep the default `underline="always"` behavior. - If a link doesn't have a meaningful href, [it should be rendered using a `<button>` element](https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/anchor-is-valid.md). {{"demo": "pages/components/links/ButtonLink.js"}} diff --git a/docs/src/pages/components/links/links-zh.md b/docs/src/pages/components/links/links-zh.md index 7fd2f986fe50b3..84ceca254b4c1b 100644 --- a/docs/src/pages/components/links/links-zh.md +++ b/docs/src/pages/components/links/links-zh.md @@ -36,16 +36,14 @@ waiAria: 'https://www.w3.org/TR/wai-aria-practices/#link' ## Third-party routing library(第三方路由库) -一种常见的用例是仅在客户端上执行导航,而无需通过 HTTP 往返服务器。 针对这种用法,`Link` 组件了提供 `component` 属性来适配它。 - -这有一个 [与 react-router 交互的例子](/guides/composition/#link)。 +One frequent use case is to perform navigation on the client only, without an HTTP round-trip to the server. 针对这种用法,`Link` 组件了提供 `component` 属性来适配它。 Here is a [more detailed guide](/guides/routing/#link). ## 无障碍设计 (WAI-ARIA: https://www.w3.org/TR/wai-aria-practices/#link) - 当提供链接对应的内容时,避免使用泛泛的描述,比如“点击这里”或“跳转”之类。 相反的,请使用 [具体详细的描述](https://developers.google.com/web/tools/lighthouse/audits/descriptive-link-text)说明。 -- 为了获得最佳的用户体验,链接应该从页面上的文字中脱颖而出。 +- 为了获得最佳的用户体验,链接应该从页面上的文字中脱颖而出。 For instance, you can keep the default `underline="always"` behavior. - 如果一个链接没有赋予一个有意义的 href 值,[它应该加载成一个`<按钮>`元素](https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/anchor-is-valid.md)。 {{"demo": "pages/components/links/ButtonLink.js"}} diff --git a/docs/src/pages/components/lists/lists-de.md b/docs/src/pages/components/lists/lists-de.md index cb4cc0da1fdb97..d2f185bc8b7877 100644 --- a/docs/src/pages/components/lists/lists-de.md +++ b/docs/src/pages/components/lists/lists-de.md @@ -1,6 +1,6 @@ --- title: React List component -components: Collapse, Divider, List, ListItem, ListItemAvatar, ListItemIcon, ListItemSecondaryAction, ListItemText, ListSubheader +components: Collapse, Divider, List, ListItem, ListItemButton, ListItemAvatar, ListItemIcon, ListItemSecondaryAction, ListItemText, ListSubheader githubLabel: 'component: List' materialDesign: https://material.io/components/lists --- @@ -13,27 +13,19 @@ materialDesign: https://material.io/components/lists {{"component": "modules/components/ComponentLinkHeader.js"}} -## Einfache Liste +## Basic List -{{"demo": "pages/components/lists/SimpleList.js", "bg": true}} +{{"demo": "pages/components/lists/BasicList.js", "bg": true}} Das letzte Element der vorherigen Demo zeigt, wie Sie einen Link rendern können: ```jsx -function ListItemLink(props) { - return <ListItem button component="a" {...props} />; -} - -//... - -function ListItemLink(props) { - return <ListItem button component="a" {...props} />; -} - -//... +<ListItemButton component="a" href="#simple-list"> + <ListItemText primary="Spam" /> +</ListItemButton> ``` -Nach diesem Abschnitt der Dokumentation finden Sie eine [Demo mit React Router](/guides/composition/#react-router). +You can find a [demo with React Router following this section](/guides/routing/#list) of the documentation. ## Verschachtelte Liste @@ -79,11 +71,9 @@ Der Schalter ist die sekundäre Aktion und ein separates Ziel. {{"demo": "pages/components/lists/SwitchListSecondary.js", "bg": true}} -## Liste mit angehefteter Kopfzeile - -Nach dem Scrollen bleiben angeheftete Kopfzeilen am oberen Bildschirmrand fixiert, bis sie von der nächsten Kopfzeile aus dem Bildschirm gedrückt werden. +## Sticky subheader -This feature relies on CSS sticky positioning. Unfortunately it's [not implemented](https://caniuse.com/#search=sticky) by all the supported browsers. It defaults to `disableSticky` when not supported. +Nach dem Scrollen bleiben angeheftete Kopfzeilen am oberen Bildschirmrand fixiert, bis sie von der nächsten Kopfzeile aus dem Bildschirm gedrückt werden. This feature relies on CSS sticky positioning. (⚠️ no IE 11 support) {{"demo": "pages/components/lists/PinnedSubheaderList.js", "bg": true}} @@ -107,6 +97,12 @@ Im folgenden Beispiel zeigen wir wie Sie [react-window](https://github.com/bvaug Wenn diese Bibliothek Ihren Anwendungsfall nicht abdeckt, sollten Sie [react-virtualized](https://github.com/bvaughn/react-virtualized) und Alternativen wie [react-virtuoso](https://github.com/petyosi/react-virtuoso) in Betracht ziehen. The use of [react-window](https://github.com/bvaughn/react-window) when possible is encouraged. +## Customized List + +Hier einige Beispiele zum Anpassen der Komponente. Mehr dazu erfahren Sie auf der [Überschreibungsdokumentationsseite](/customization/how-to-customize/). + +{{"demo": "pages/components/lists/CustomizedList.js"}} + ## Individuelle Anpassung 🎨 Wenn Sie nach Inspiration suchen, sehen sie sich [MUI Treasury's Anpassungs-Beispiele](https://mui-treasury.com/styles/list-item) an. diff --git a/docs/src/pages/components/lists/lists-es.md b/docs/src/pages/components/lists/lists-es.md index 45c4b88a10043e..f61385bdb692f8 100644 --- a/docs/src/pages/components/lists/lists-es.md +++ b/docs/src/pages/components/lists/lists-es.md @@ -1,6 +1,6 @@ --- title: React List component -components: Collapse, Divider, List, ListItem, ListItemAvatar, ListItemIcon, ListItemSecondaryAction, ListItemText, ListSubheader +components: Collapse, Divider, List, ListItem, ListItemButton, ListItemAvatar, ListItemIcon, ListItemSecondaryAction, ListItemText, ListSubheader githubLabel: 'component: List' materialDesign: https://material.io/components/lists --- @@ -13,27 +13,19 @@ Las [listas](https://material.io/design/components/lists.html) son un grupo cont {{"component": "modules/components/ComponentLinkHeader.js"}} -## Lista Simple +## Basic List -{{"demo": "pages/components/lists/SimpleList.js", "bg": true}} +{{"demo": "pages/components/lists/BasicList.js", "bg": true}} El último elemento del demo anterior muestra cómo se puede representar un enlace: ```jsx -function ListItemLink(props) { - return <ListItem button component="a" {...props} />; -} - -//... - -function ListItemLink(props) { - return <ListItem button component="a" {...props} />; -} - -//... +<ListItemButton component="a" href="#simple-list"> + <ListItemText primary="Spam" /> +</ListItemButton> ``` -Hay una demostración [usando React Router siguiendo esta sección](/guides/composition/#react-router) de la documentación. +You can find a [demo with React Router following this section](/guides/routing/#list) of the documentation. ## Lista Anidada @@ -79,11 +71,9 @@ El switch es la acción secundaria y un objetivo separado. {{"demo": "pages/components/lists/SwitchListSecondary.js", "bg": true}} -## Lista de Subencabezados Fijados - -Al desplazarse, los subencabezados permanecen anclados en la parte superior de la pantalla hasta que el siguiente subencabezado los saque de la pantalla. +## Sticky subheader -Esta característica se basa en el posicionamiento sticky de CSS. Desafortunadamente, [no está implementado](https://caniuse.com/#search=sticky) por todos los navegadores compatibles. El valor por defecto soportado es `disableSticky` cuando el navegador no provee el soporte. +Al desplazarse, los subencabezados permanecen anclados en la parte superior de la pantalla hasta que el siguiente subencabezado los saque de la pantalla. Esta característica se basa en el posicionamiento sticky de CSS. (⚠️ no IE 11 support) {{"demo": "pages/components/lists/PinnedSubheaderList.js", "bg": true}} @@ -107,6 +97,12 @@ En el siguiente ejemplo se demuestra como usar [react-window](https://github.com If this library doesn't cover your use case, you should consider using [react-virtualized](https://github.com/bvaughn/react-virtualized), then alternatives like [react-virtuoso](https://github.com/petyosi/react-virtuoso). The use of [react-window](https://github.com/bvaughn/react-window) when possible is encouraged. +## Customized List + +Here are some examples of customizing the component. Puedes aprender más sobre esto en la [sección Personalizando Componentes de la documentación](/customization/how-to-customize/). + +{{"demo": "pages/components/lists/CustomizedList.js"}} + ## Personalización 🎨 Si estás buscando inspiración, puedes mirar [los ejemplos de MUI Treasury](https://mui-treasury.com/styles/list-item). diff --git a/docs/src/pages/components/lists/lists-fr.md b/docs/src/pages/components/lists/lists-fr.md index cc3684a013680d..57799183e1d27e 100644 --- a/docs/src/pages/components/lists/lists-fr.md +++ b/docs/src/pages/components/lists/lists-fr.md @@ -1,5 +1,5 @@ --- -title: React List component +title: Composant React List components: Collapse, Divider, List, ListItem, ListItemAvatar, ListItemIcon, ListItemSecondaryAction, ListItemText, ListSubheader githubLabel: 'component: List' materialDesign: https://material.io/components/lists @@ -20,17 +20,9 @@ materialDesign: https://material.io/components/lists Le dernier élément de la démonstration précédente montre comment vous pouvez créer un lien: ```jsx -function ListItemLink(props) { - return <ListItem button component="a" {...props} />; -} - -//... - -function ListItemLink(props) { - return <ListItem button component="a" {...props} />; -} - -//... +<ListItemButton component="a" href="#simple-list"> + <ListItemText primary="Spam" /> +</ListItemButton> ``` Vous pouvez trouver une [démonstration avec la bibliothèque React Router en suivant cette section](/guides/composition/#react-router) de la documentation. @@ -81,19 +73,17 @@ Le commutateur (switch) est l'action secondaire et une cible distincte. ## Épingler les sous-entêtes -Lors du défilement, les sous-en-têtes restent épinglés en haut de l'écran jusqu'à ce qu'ils soient déplacés en dehors de l'écran par le prochain en-tête. - -This feature relies on CSS sticky positioning. Unfortunately it's [not implemented](https://caniuse.com/#search=sticky) by all the supported browsers. It defaults to `disableSticky` when not supported. +Lors du défilement, les sous-en-têtes restent épinglés en haut de l'écran jusqu'à ce qu'ils soient déplacés en dehors de l'écran par le prochain en-tête. This feature relies on CSS sticky positioning. (⚠️ no IE 11 support) {{"demo": "pages/components/lists/PinnedSubheaderList.js", "bg": true}} -## Inset List Item +## Élément de la liste d'entrée (inset) The `inset` prop enables a list item that does not have a leading icon or avatar to align correctly with items that do. {{"demo": "pages/components/lists/InsetList.js", "bg": true}} -## Liste virtualisée +## Liste sans gouttière When rendering a list within a component that defines its own gutters, `ListItem` gutters can be disabled with `disableGutters`. @@ -109,4 +99,10 @@ If this library doesn't cover your use case, you should consider using [react-vi ## Personnalisation +Here are some examples of customizing the component. Vous pouvez en savoir plus dans la [page de documentation des overrides](/customization/how-to-customize/). + +🎨 Si vous cherchez de l'inspiration, vous pouvez consulter les [exemples de personnalisation de MUI Treasury](https://mui-treasury.com/styles/list-item). + +## Personnalisation + 🎨 Si vous cherchez de l'inspiration, vous pouvez consulter les [exemples de personnalisation de MUI Treasury](https://mui-treasury.com/styles/list-item). diff --git a/docs/src/pages/components/lists/lists-ja.md b/docs/src/pages/components/lists/lists-ja.md index fb84f4b9e03222..27751dd4664a06 100644 --- a/docs/src/pages/components/lists/lists-ja.md +++ b/docs/src/pages/components/lists/lists-ja.md @@ -1,6 +1,6 @@ --- -title: React List component -components: Collapse, Divider, List, ListItem, ListItemAvatar, ListItemIcon, ListItemSecondaryAction, ListItemText, ListSubheader +title: Reactリストコンポーネント +components: Collapse, Divider, List, ListItem, ListItemButton, ListItemAvatar, ListItemIcon, ListItemSecondaryAction, ListItemText, ListSubheader githubLabel: 'component: List' materialDesign: https://material.io/components/lists --- @@ -9,31 +9,23 @@ materialDesign: https://material.io/components/lists <p class="description">Listは、テキストまたは画像が連続する垂直方向の索引です。</p> -[List](https://material.io/design/components/lists.html) は、テキストまたは画像が連続するまとまりです。 それらは、アイコンとテキストで表される主要または補足的なアクションを含む項目で構成されています。 +リストはテキストや画像を一覧表示するものです。 それらは、アイコンとテキストで表される主要または補足的なアクションを含む項目で構成されています。 {{"component": "modules/components/ComponentLinkHeader.js"}} -## シンプルなList +## Basic List -{{"demo": "pages/components/lists/SimpleList.js", "bg": true}} +{{"demo": "pages/components/lists/BasicList.js", "bg": true}} 上のデモの最後の項目は、リンクを表示方法を示しています。 ```jsx -function ListItemLink(props) { - return <ListItem button component="a" {...props} />; -} - -//... - -function ListItemLink(props) { - return <ListItem button component="a" {...props} />; -} - -//... +<ListItemButton component="a" href="#simple-list"> + <ListItemText primary="Spam" /> +</ListItemButton> ``` -ドキュメントには[このセクションに続くReact Routerを用いたデモ](/guides/composition/#react-router)があります。 +You can find a [demo with React Router following this section](/guides/routing/#list) of the documentation. ## ネストしたList @@ -55,7 +47,7 @@ function ListItemLink(props) { ## Listの項目の整列 -3行以上を表示するときは、項目の配置を変更する必要があり、`alignItems="flex-start"`プロパティを設定してください。 +項目内に3行以上を表示するときは、項目の配置を変更する必要があります。`alignItems` プロパティを "flex-start" に設定してください。 {{"demo": "pages/components/lists/AlignItemsList.js", "bg": true}} @@ -65,7 +57,7 @@ function ListItemLink(props) { Checkboxは、主要なアクションまたは補助的なアクションのどちらかになります。 -チェックボックスは、リストアイテムのプライマリアクションおよび状態インジケータです。 The comment button is a secondary action and a separate target. チェックボックスは、リストアイテムのプライマリアクションおよび状態インジケータです。 The comment button is a secondary action and a separate target. +チェックボックスは、リストアイテムのプライマリアクションおよび状態インジケータです。 チェックボックスは、リストアイテムのプライマリアクションおよび状態インジケータです。 The comment button is a secondary action and a separate target. {{"demo": "pages/components/lists/CheckboxList.js", "bg": true}} @@ -79,21 +71,19 @@ Switchは補助的なアクションであり異なるターゲットです。 {{"demo": "pages/components/lists/SwitchListSecondary.js", "bg": true}} -## ピン止めされたサブヘッダー付きList - -スクロールする上で、サブヘッダーは次のサブヘッダーによって画面から押し出されるまで画面の上部に固定されたままになります。 +## Sticky subheader -この機能はCSSのSticky positioningに依存しています。 この機能はCSSのSticky positioningに依存しています。 この機能はCSSのSticky positioningに依存しています。 Unfortunately it's [not implemented](https://caniuse.com/#search=sticky) by all the supported browsers. この機能はCSSのSticky positioningに依存しています。 この機能はCSSのSticky positioningに依存しています。 Unfortunately it's [not implemented](https://caniuse.com/#search=sticky) by all the supported browsers. It defaults to `disableSticky` when not supported. +スクロールする上で、サブヘッダーは次のサブヘッダーによって画面から押し出されるまで画面の上部に固定されたままになります。 この機能はCSSのSticky positioningに依存しています。 この機能はCSSのSticky positioningに依存しています。 この機能はCSSのSticky positioningに依存しています。 Unfortunately it's [not implemented](https://caniuse.com/#search=sticky) by all the supported browsers. (⚠️ no IE 11 support) {{"demo": "pages/components/lists/PinnedSubheaderList.js", "bg": true}} -## Inset List Item +## ピン留めリスト項目 The `inset` prop enables a list item that does not have a leading icon or avatar to align correctly with items that do. {{"demo": "pages/components/lists/InsetList.js", "bg": true}} -## Gutterless list +## Gutterless リスト When rendering a list within a component that defines its own gutters, `ListItem` gutters can be disabled with `disableGutters`. @@ -101,11 +91,17 @@ When rendering a list within a component that defines its own gutters, `ListItem ## Virtualized List -次の例では、 `リスト` コンポーネントで [react-window](https://github.com/bvaughn/react-window) を使用する方法を示します。 これは200行をレンダリングし、より多くを簡単に処理できます。 仮想化はパフォーマンスの問題に役立ちます。 これは200行をレンダリングし、より多くを簡単に処理できます。 仮想化はパフォーマンスの問題に役立ちます。 これは200行をレンダリングし、より多くを簡単に処理できます。 仮想化はパフォーマンスの問題に役立ちます。 これは200行をレンダリングし、より多くを簡単に処理できます。 仮想化はパフォーマンスの問題に役立ちます。 +次の例では、 `リスト` コンポーネントで [react-window](https://github.com/bvaughn/react-window) を使用する方法を示します。 これは200行をレンダリングし、より多くを簡単に処理できます。 仮想化はパフォーマンスの問題に役立ちます。 {{"demo": "pages/components/lists/VirtualizedList.js", "bg": true}} -このライブラリがあなたのユースケースをカバーしていない場合は、 [react-virtualized](https://github.com/bvaughn/react-virtualized)、次に [react-virtuoso](https://github.com/petyosi/react-virtuoso)ような代替を使用することを検討する必要があります。 このライブラリがあなたのユースケースをカバーしていない場合は、 [react-virtualized](https://github.com/bvaughn/react-virtualized)、次に [react-virtuoso](https://github.com/petyosi/react-virtuoso)ような代替を使用することを検討する必要があります。 このライブラリがあなたのユースケースをカバーしていない場合は、 [react-virtualized](https://github.com/bvaughn/react-virtualized)、次に [react-virtuoso](https://github.com/petyosi/react-virtuoso)ような代替を使用することを検討する必要があります。 このライブラリがあなたのユースケースをカバーしていない場合は、 [react-virtualized](https://github.com/bvaughn/react-virtualized)、次に [react-virtuoso](https://github.com/petyosi/react-virtuoso)ような代替を使用することを検討する必要があります。 このライブラリがあなたのユースケースをカバーしていない場合は、 [react-virtualized](https://github.com/bvaughn/react-virtualized)、次に [react-virtuoso](https://github.com/petyosi/react-virtuoso)ような代替を使用することを検討する必要があります。 The use of [react-window](https://github.com/bvaughn/react-window) when possible is encouraged. +The use of [react-window](https://github.com/bvaughn/react-window) when possible is encouraged. このライブラリがあなたのユースケースをカバーしていない場合は、 [react-virtualized](https://github.com/bvaughn/react-virtualized)、次に [react-virtuoso](https://github.com/petyosi/react-virtuoso)ような代替を使用することを検討する必要があります。 このライブラリがあなたのユースケースをカバーしていない場合は、 [react-virtualized](https://github.com/bvaughn/react-virtualized)、次に [react-virtuoso](https://github.com/petyosi/react-virtuoso)ような代替を使用することを検討する必要があります。 このライブラリがあなたのユースケースをカバーしていない場合は、 [react-virtualized](https://github.com/bvaughn/react-virtualized)、次に [react-virtuoso](https://github.com/petyosi/react-virtuoso)ような代替を使用することを検討する必要があります。 このライブラリがあなたのユースケースをカバーしていない場合は、 [react-virtualized](https://github.com/bvaughn/react-virtualized)、次に [react-virtuoso](https://github.com/petyosi/react-virtuoso)ような代替を使用することを検討する必要があります。 The use of [react-window](https://github.com/bvaughn/react-window) when possible is encouraged. + +## Customized List + +コンポーネントのカスタマイズの例を次に示します。 詳細については、 [こちら](/customization/how-to-customize/)を参照してください。 + +{{"demo": "pages/components/lists/CustomizedList.js"}} ## カスタマイズ diff --git a/docs/src/pages/components/lists/lists-pt.md b/docs/src/pages/components/lists/lists-pt.md index 9522f412d42b0e..fbbaa8bd1ceabc 100644 --- a/docs/src/pages/components/lists/lists-pt.md +++ b/docs/src/pages/components/lists/lists-pt.md @@ -1,6 +1,6 @@ --- title: Componente React Lista -components: Collapse, Divider, List, ListItem, ListItemAvatar, ListItemIcon, ListItemSecondaryAction, ListItemText, ListSubheader +components: Collapse, Divider, List, ListItem, ListItemButton, ListItemAvatar, ListItemIcon, ListItemSecondaryAction, ListItemText, ListSubheader githubLabel: 'component: List' materialDesign: https://material.io/components/lists --- @@ -13,27 +13,19 @@ materialDesign: https://material.io/components/lists {{"component": "modules/components/ComponentLinkHeader.js"}} -## Lista Simples +## Basic List -{{"demo": "pages/components/lists/SimpleList.js", "bg": true}} +{{"demo": "pages/components/lists/BasicList.js", "bg": true}} O último item da demonstração anterior mostra como você pode renderizar um link: ```jsx -function ListItemLink(props) { - return <ListItem button component="a" {...props} />; -} - -//... - -function ListItemLink(props) { - return <ListItem button component="a" {...props} />; -} - -//... +<ListItemButton component="a" href="#simple-list"> + <ListItemText primary="Spam" /> +</ListItemButton> ``` -Você pode encontrar uma [demonstração com React Router seguindo esta seção](/guides/composition/#react-router) da documentação. +You can find a [demo with React Router following this section](/guides/routing/#list) of the documentation. ## Lista Aninhada @@ -79,23 +71,21 @@ O interruptor é uma ação secundária, sem interferir com o estado do item da {{"demo": "pages/components/lists/SwitchListSecondary.js", "bg": true}} -## Lista com subtítulo fixado - -Após a rolagem, os subtítulos permanecem fixos na parte superior da tela até serem empurrados para fora da área de visualização pelo próximo subtítulo. +## Sticky subheader -Esse recurso depende do posicionamento fixo do CSS. Infelizmente, [não é implementado](https://caniuse.com/#search=sticky) por todos os navegadores. O padrão é `disableSticky` quando não é suportado. +Após a rolagem, os subtítulos permanecem fixos na parte superior da tela até serem empurrados para fora da área de visualização pelo próximo subtítulo. Esse recurso depende do posicionamento fixo do CSS. (⚠️ no IE 11 support) {{"demo": "pages/components/lists/PinnedSubheaderList.js", "bg": true}} ## Item de lista encaixado -A propriedade `inset` habilita um item de lista, que não tenha um ícone principal ou um avatar, para alinhar corretamente os itens que possuem. +The `inset` prop enables a list item that does not have a leading icon or avatar to align correctly with items that do. {{"demo": "pages/components/lists/InsetList.js", "bg": true}} ## Lista sem espaçamentos -Ao renderizar uma lista dentro de um componente que define seus próprios espaços, o espaçamento do `ListItem` pode ser desabilitado com `disableGutters`. +When rendering a list within a component that defines its own gutters, `ListItem` gutters can be disabled with `disableGutters`. {{"demo": "pages/components/lists/GutterlessList.js", "bg": true}} @@ -107,6 +97,12 @@ No exemplo a seguir, nós demonstramos como usar a biblioteca [react-window](htt O uso da biblioteca [react-window](https://github.com/bvaughn/react-window), quando possível, é recomendado. Se no seu caso esta biblioteca não resolver, você deve considerar o uso de [react-virtualized](https://github.com/bvaughn/react-virtualized), e em seguida, como alternativa [react-virtuoso](https://github.com/petyosi/react-virtuoso). +## Customized List + +Aqui estão alguns exemplos de customização do componente. Você pode aprender mais sobre isso na [página de documentação de sobrescritas](/customization/how-to-customize/). + +{{"demo": "pages/components/lists/CustomizedList.js"}} + ## Customização 🎨 Se você está procurando inspiração, você pode verificar [os exemplos de customização de MUI Treasury](https://mui-treasury.com/styles/list-item). diff --git a/docs/src/pages/components/lists/lists-ru.md b/docs/src/pages/components/lists/lists-ru.md index 7c93388ca89ec3..e71fde990ee4d6 100644 --- a/docs/src/pages/components/lists/lists-ru.md +++ b/docs/src/pages/components/lists/lists-ru.md @@ -1,6 +1,6 @@ --- title: Компонент React List -components: Collapse, Divider, List, ListItem, ListItemAvatar, ListItemIcon, ListItemSecondaryAction, ListItemText, ListSubheader +components: Collapse, Divider, List, ListItem, ListItemButton, ListItemAvatar, ListItemIcon, ListItemSecondaryAction, ListItemText, ListSubheader githubLabel: 'component: List' materialDesign: https://material.io/components/lists --- @@ -13,27 +13,19 @@ materialDesign: https://material.io/components/lists {{"component": "modules/components/ComponentLinkHeader.js"}} -## Простой список +## Basic List -{{"demo": "pages/components/lists/SimpleList.js", "bg": true}} +{{"demo": "pages/components/lists/BasicList.js", "bg": true}} Последний элемент предыдущего примера показывает, как вы можете отрисовать ссылку: ```jsx -function ListItemLink(props) { - return <ListItem button component="a" {...props} />; -} - -//... - -function ListItemLink(props) { - return <ListItem button component="a" {...props} />; -} - -//... +<ListItemButton component="a" href="#simple-list"> + <ListItemText primary="Spam" /> +</ListItemButton> ``` -Вы можете [посмотреть демо с React Router](/guides/composition/#react-router). +You can find a [demo with React Router following this section](/guides/routing/#list) of the documentation. ## Вложенный список @@ -79,11 +71,9 @@ Switch является второстепенным действием. {{"demo": "pages/components/lists/SwitchListSecondary.js", "bg": true}} -## Закрепленный подзаголовок - -При прокрутке подзаголовки остаются закрепленными в верхней части экрана, пока следующий подзаголовок не оттеснит предыдущий. +## Sticky subheader -This feature relies on CSS sticky positioning. Unfortunately it's [not implemented](https://caniuse.com/#search=sticky) by all the supported browsers. It defaults to `disableSticky` when not supported. +При прокрутке подзаголовки остаются закрепленными в верхней части экрана, пока следующий подзаголовок не оттеснит предыдущий. This feature relies on CSS sticky positioning. (⚠️ no IE 11 support) {{"demo": "pages/components/lists/PinnedSubheaderList.js", "bg": true}} @@ -107,6 +97,12 @@ In the following example, we demonstrate how to use [react-window](https://githu If this library doesn't cover your use case, you should consider using [react-virtualized](https://github.com/bvaughn/react-virtualized), then alternatives like [react-virtuoso](https://github.com/petyosi/react-virtuoso). The use of [react-window](https://github.com/bvaughn/react-window) when possible is encouraged. +## Customized List + +Ниже находятся примеры кастомизации компонента. Вы можете узнать об этом больше [в документации по переопределению свойств](/customization/how-to-customize/). + +{{"demo": "pages/components/lists/CustomizedList.js"}} + ## Кастомизация 🎨 If you are looking for inspiration, you can check [MUI Treasury's customization examples](https://mui-treasury.com/styles/list-item). diff --git a/docs/src/pages/components/lists/lists-zh.md b/docs/src/pages/components/lists/lists-zh.md index 09b2b374d26b85..1289e90fb4af6a 100644 --- a/docs/src/pages/components/lists/lists-zh.md +++ b/docs/src/pages/components/lists/lists-zh.md @@ -1,6 +1,6 @@ --- title: React List(列表)组件 -components: Collapse, Divider, List, ListItem, ListItemAvatar, ListItemIcon, ListItemSecondaryAction, ListItemText, ListSubheader +components: Collapse, Divider, List, ListItem, ListItemButton, ListItemAvatar, ListItemIcon, ListItemSecondaryAction, ListItemText, ListSubheader githubLabel: 'component: List' materialDesign: https://material.io/components/lists --- @@ -13,25 +13,19 @@ materialDesign: https://material.io/components/lists {{"component": "modules/components/ComponentLinkHeader.js"}} -## 简易列表 +## Basic List -{{"demo": "pages/components/lists/SimpleList.js", "bg": true}} +{{"demo": "pages/components/lists/BasicList.js", "bg": true}} 上一个样例的最后一个子集展示了如何渲染一个链接: ```jsx -function ListItemLink(props) { - return <ListItem button component="a" {...props} />; -} - -//... - -<ListItemLink href="#simple-list"> +<ListItemButton component="a" href="#simple-list"> <ListItemText primary="Spam" /> -</ListItemLink>; +</ListItemButton> ``` -你可以从这里查看 [React Router与文档此部分结合使用的相关样例](/guides/composition/#react-router)。 +You can find a [demo with React Router following this section](/guides/routing/#list) of the documentation. ## 嵌套列表 @@ -77,23 +71,21 @@ function ListItemLink(props) { {{"demo": "pages/components/lists/SwitchListSecondary.js", "bg": true}} -## 固定的副标题列表 - -在滚动列表时,子标题保持固定在屏幕的顶端,直到被下一个子标题推离屏幕。 +## Sticky subheader -此性能由 CSS sticky 位置实现。 可惜的是,这一功能并未在我们支持的所有浏览器中 [实现](https://caniuse.com/#search=sticky) 。 若浏览器不支持,则默认使用 `disableSticky`。 +在滚动列表时,子标题保持固定在屏幕的顶端,直到被下一个子标题推离屏幕。 此性能由 CSS sticky 位置实现。 (⚠️ no IE 11 support) {{"demo": "pages/components/lists/PinnedSubheaderList.js", "bg": true}} ## 对齐列表项 -`inset` 属性可以让没有前导(leading)图标或头像的列表项与有前导图标或头像的项正确对齐。 +The `inset` prop enables a list item that does not have a leading icon or avatar to align correctly with items that do. {{"demo": "pages/components/lists/InsetList.js", "bg": true}} ## 没有边距的列表 -当在一个定义了边距(gutters)的组件中渲染列表时,可以通过 `disableGutters` 来禁用 `ListItem` 的边距。 +When rendering a list within a component that defines its own gutters, `ListItem` gutters can be disabled with `disableGutters`. {{"demo": "pages/components/lists/GutterlessList.js", "bg": true}} @@ -105,6 +97,12 @@ function ListItemLink(props) { 我们鼓励尽可能使用 [react-window](https://github.com/bvaughn/react-window)。 如果这个库不包括你的用例,你应该考虑使用 [react-virtualized](https://github.com/bvaughn/react-virtualized),然后使用 [react-virtuoso](https://github.com/petyosi/react-virtuoso)等替代品。 +## Customized List + +你可以参考以下一些例子来自定义组件。 您可以在 [重写文档页面](/customization/how-to-customize/) 中了解更多有关此内容的信息。 + +{{"demo": "pages/components/lists/CustomizedList.js"}} + ## Customization 个性化 🎨 如果您还在寻找灵感,您可以看看 [MUI Treasury 特别定制的一些例子](https://mui-treasury.com/styles/list-item)。 diff --git a/docs/src/pages/components/material-icons/SearchIcons.js b/docs/src/pages/components/material-icons/SearchIcons.js index dc8d69f63eea46..ae5feaadbee42a 100644 --- a/docs/src/pages/components/material-icons/SearchIcons.js +++ b/docs/src/pages/components/material-icons/SearchIcons.js @@ -245,13 +245,7 @@ const DialogDetails = React.memo(function DialogDetails(props) { }; return ( - <Dialog - fullWidth - maxWidth="sm" - open={open} - onClose={handleClose} - aria-labelledby="icon-dialog-title" - > + <Dialog fullWidth maxWidth="sm" open={open} onClose={handleClose}> {selectedIcon ? ( <React.Fragment> <DialogTitle disableTypography> @@ -266,7 +260,6 @@ const DialogDetails = React.memo(function DialogDetails(props) { component="h2" variant="h6" className={classes.title} - id="icon-dialog-title" onClick={handleClick(1)} > {selectedIcon.importName} diff --git a/docs/src/pages/components/material-icons/material-icons-de.md b/docs/src/pages/components/material-icons/material-icons-de.md index 791b32dd7cdab3..1f04c32424b5db 100644 --- a/docs/src/pages/components/material-icons/material-icons-de.md +++ b/docs/src/pages/components/material-icons/material-icons-de.md @@ -8,12 +8,12 @@ githubLabel: 'icons' # Material Icons -<p class="description">1,100+ React Material icons ready to use from the official website.</p> +<p class="description">1,700+ React Material icons ready to use from the official website.</p> -The following npm package, [@material-ui/icons](https://www.npmjs.com/package/@material-ui/icons), includes the 1,100+ official [Material icons](https://material.io/tools/icons/?style=baseline) converted to [`SvgIcon`](/api/svg-icon/) components. +The following npm package, [@material-ui/icons](https://www.npmjs.com/package/@material-ui/icons), includes the 1,700+ official [Material icons](https://fonts.google.com/icons) converted to [`SvgIcon`](/api/svg-icon/) components. {{"component": "modules/components/ComponentLinkHeader.js"}} {{"demo": "pages/components/material-icons/SearchIcons.js", "hideToolbar": true, "bg": true}} -ℹ️ The search supports synonyms. Try searching for "hamburger", or "logout". +ℹ️ The search supports synonyms. Try searching for "hamburger" or "logout". diff --git a/docs/src/pages/components/material-icons/material-icons-es.md b/docs/src/pages/components/material-icons/material-icons-es.md index 1cab60074b8f76..9874e0bc7daab2 100644 --- a/docs/src/pages/components/material-icons/material-icons-es.md +++ b/docs/src/pages/components/material-icons/material-icons-es.md @@ -8,12 +8,12 @@ githubLabel: 'iconos' # Material Icons -<p class="description">Más de 1,100 iconos de Material React listos para usar desde el sitio web oficial.</p> +<p class="description">1,700+ React Material icons ready to use from the official website.</p> -El siguiente paquete npm, [@material-ui/icons](https://www.npmjs.com/package/@material-ui/icons), incluye más de 1,100 [Material icons](https://material.io/tools/icons/?style=baseline) oficiales convertidos a componentes [`SvgIcon`](/api/svg-icon/). +The following npm package, [@material-ui/icons](https://www.npmjs.com/package/@material-ui/icons), includes the 1,700+ official [Material icons](https://fonts.google.com/icons) converted to [`SvgIcon`](/api/svg-icon/) components. {{"component": "modules/components/ComponentLinkHeader.js"}} {{"demo": "pages/components/material-icons/SearchIcons.js", "hideToolbar": true, "bg": true}} -ℹ️ La búsqueda admite sinónimos. Intente buscar "hamburger" o "logout". +ℹ️ La búsqueda admite sinónimos. Try searching for "hamburger" or "logout". diff --git a/docs/src/pages/components/material-icons/material-icons-ja.md b/docs/src/pages/components/material-icons/material-icons-ja.md index 8df6bd2f014bb8..1cdca732f69644 100644 --- a/docs/src/pages/components/material-icons/material-icons-ja.md +++ b/docs/src/pages/components/material-icons/material-icons-ja.md @@ -8,12 +8,12 @@ githubLabel: 'icons' # マテリアルアイコン(Material Icons) -<p class="description">1,100+ React Material icons ready to use from the official website.</p> +<p class="description">1,700+ React Material icons ready to use from the official website.</p> -The following npm package, [@material-ui/icons](https://www.npmjs.com/package/@material-ui/icons), includes the 1,100+ official [Material icons](https://material.io/tools/icons/?style=baseline) converted to [`SvgIcon`](/api/svg-icon/) components. +The following npm package, [@material-ui/icons](https://www.npmjs.com/package/@material-ui/icons), includes the 1,700+ official [Material icons](https://fonts.google.com/icons) converted to [`SvgIcon`](/api/svg-icon/) components. {{"component": "modules/components/ComponentLinkHeader.js"}} {{"demo": "pages/components/material-icons/SearchIcons.js", "hideToolbar": true, "bg": true}} -ℹ️ 同義語の検索をサポートしています。 "hamburger"や"logout"で検索してみてください。 +ℹ️ 同義語の検索をサポートしています。 Try searching for "hamburger" or "logout". diff --git a/docs/src/pages/components/material-icons/material-icons-pt.md b/docs/src/pages/components/material-icons/material-icons-pt.md index 7d70b0b015900d..9a397b9e45f406 100644 --- a/docs/src/pages/components/material-icons/material-icons-pt.md +++ b/docs/src/pages/components/material-icons/material-icons-pt.md @@ -8,12 +8,12 @@ githubLabel: 'ícones' # Ícones Material -<p class="description">Mais de 1.100 ícones React, oficiais do Material e prontos para uso.</p> +<p class="description">1,700+ React Material icons ready to use from the official website.</p> -O pacote npm a seguir, [@material-ui/icons](https://www.npmjs.com/package/@material-ui/icons), inclui os mais de 1,100 [Ícones Material](https://material.io/tools/icons/?style=baseline) oficiais, convertidos para componentes [`SvgIcon`](/api/svg-icon/). +The following npm package, [@material-ui/icons](https://www.npmjs.com/package/@material-ui/icons), includes the 1,700+ official [Material icons](https://fonts.google.com/icons) converted to [`SvgIcon`](/api/svg-icon/) components. {{"component": "modules/components/ComponentLinkHeader.js"}} {{"demo": "pages/components/material-icons/SearchIcons.js", "hideToolbar": true, "bg": true}} -ℹ️ A pesquisa suporta sinônimos. Tente procurar por "hamburger" ou "logout". +ℹ️ A pesquisa suporta sinônimos. Try searching for "hamburger" or "logout". diff --git a/docs/src/pages/components/material-icons/material-icons-ru.md b/docs/src/pages/components/material-icons/material-icons-ru.md index 82b55d822a061a..d8047bd47f6ee5 100644 --- a/docs/src/pages/components/material-icons/material-icons-ru.md +++ b/docs/src/pages/components/material-icons/material-icons-ru.md @@ -8,12 +8,12 @@ githubLabel: 'иконки' # Material Иконки -<p class="description">1,100+ React Material icons ready to use from the official website.</p> +<p class="description">1,700+ React Material icons ready to use from the official website.</p> -The following npm package, [@material-ui/icons](https://www.npmjs.com/package/@material-ui/icons), includes the 1,100+ official [Material icons](https://material.io/tools/icons/?style=baseline) converted to [`SvgIcon`](/api/svg-icon/) components. +The following npm package, [@material-ui/icons](https://www.npmjs.com/package/@material-ui/icons), includes the 1,700+ official [Material icons](https://fonts.google.com/icons) converted to [`SvgIcon`](/api/svg-icon/) components. {{"component": "modules/components/ComponentLinkHeader.js"}} {{"demo": "pages/components/material-icons/SearchIcons.js", "hideToolbar": true, "bg": true}} -ℹ️ The search supports synonyms. Try searching for "hamburger", or "logout". +ℹ️ The search supports synonyms. Try searching for "hamburger" or "logout". diff --git a/docs/src/pages/components/material-icons/material-icons-zh.md b/docs/src/pages/components/material-icons/material-icons-zh.md index 6100c09db7b8de..5795ea7013973e 100644 --- a/docs/src/pages/components/material-icons/material-icons-zh.md +++ b/docs/src/pages/components/material-icons/material-icons-zh.md @@ -8,12 +8,12 @@ githubLabel: 'package: icons' # Material 图标 -<p class="description">你可以在我们的官方网站上使用超过 1,300 个 React Material icons。</p> +<p class="description">你可以在我们的官方网站上使用超过 1,700 个 React Material 图标。</p> -[@material-ui/icons](https://www.npmjs.com/package/@material-ui/icons) 这个 npm 包包含了 1,300 多个已经被转换成 [`SvgIcon`](/api/svg-icon/) 的官方 [Material icons](https://material.io/tools/icons/?style=baseline) 。 +The following npm package, [@material-ui/icons](https://www.npmjs.com/package/@material-ui/icons), includes the 1,700+ official [Material icons](https://fonts.google.com/icons) converted to [`SvgIcon`](/api/svg-icon/) components. {{"component": "modules/components/ComponentLinkHeader.js"}} {{"demo": "pages/components/material-icons/SearchIcons.js", "hideToolbar": true, "bg": true}} -ℹ️ 我们的搜索也支持同义词。 你可以尝试搜索 "hamburger" 或 "logout"。 +ℹ️ 我们的搜索也支持同义词。 Try searching for "hamburger" or "logout". diff --git a/docs/src/pages/components/menus/menus-de.md b/docs/src/pages/components/menus/menus-de.md index d54b487d55bcd1..a7e88295ed5417 100644 --- a/docs/src/pages/components/menus/menus-de.md +++ b/docs/src/pages/components/menus/menus-de.md @@ -22,11 +22,11 @@ Durch die Auswahl einer Option wird die Option sofort übernommen und das Menü **Begriffserklärung**: Im Gegensatz zu einfachen Menüs können einfache Dialogfelder zusätzliche Details in Bezug auf die für ein Listenelement verfügbaren Optionen enthalten oder Navigations- oder orthogonale Aktionen in Bezug auf die primäre Aufgabe bereitstellen. Although they can display the same content, simple menus are preferred over simple dialogs because simple menus are less disruptive to the user's current context. -{{"demo": "pages/components/menus/SimpleMenu.js"}} +{{"demo": "pages/components/menus/BasicMenu.js"}} ## Selected menu -Bei der Elementauswahl versuchen einfache Menüs beim Öffnen, das aktuell ausgewählte Menüelement mit dem Ankerelement vertikal auszurichten, und der ursprüngliche Fokus wird auf das ausgewählte Menüelement gesetzt. Das aktuell ausgewählte Menüelement wird mit der Eigenschaft `selected` (von [ListItem](/api/list-item/)) festgelegt. Um ein ausgewähltes Menüelement zu verwenden, ohne den anfänglichen Fokus oder die vertikale Positionierung des Menüs zu beeinflussen, setzen Sie die Eigenschaft `variant` auf `menu`. +If used for item selection, when opened, simple menus places the initial focus on the selected menu item. Das aktuell ausgewählte Menüelement wird mit der Eigenschaft `selected` (von [ListItem](/api/list-item/)) festgelegt. To use a selected menu item without impacting the initial focus, set the `variant` prop to "menu". {{"demo": "pages/components/menus/SimpleListMenu.js"}} diff --git a/docs/src/pages/components/menus/menus-es.md b/docs/src/pages/components/menus/menus-es.md index a2fa3a272ff3f9..77648d6440458e 100644 --- a/docs/src/pages/components/menus/menus-es.md +++ b/docs/src/pages/components/menus/menus-es.md @@ -22,11 +22,11 @@ Elegir una opción debiera inmediatamente confirmar la opción y cerrar el menú **Desambiguación**: En contraste con los menús simples, los diálogos simples pueden presentar detalles adicionales a las opciones disponibles para un ítem de lista o proveer acciones de navegación u ortogonales relacionadas a la tarea primaria. Although they can display the same content, simple menus are preferred over simple dialogs because simple menus are less disruptive to the user's current context. -{{"demo": "pages/components/menus/SimpleMenu.js"}} +{{"demo": "pages/components/menus/BasicMenu.js"}} ## Selected menu -If used for item selection, when opened, simple menus attempt to vertically align the currently selected menu item with the anchor element, and the initial focus will be placed on the selected menu item. El elemento de menú actualmente seleccionado se establece usando la propiedad `selected` (de [ListItem](/api/list-item/)). To use a selected menu item without impacting the initial focus or the vertical positioning of the menu, set the `variant` property to `menu`. +If used for item selection, when opened, simple menus places the initial focus on the selected menu item. El elemento de menú actualmente seleccionado se establece usando la propiedad `selected` (de [ListItem](/api/list-item/)). To use a selected menu item without impacting the initial focus, set the `variant` prop to "menu". {{"demo": "pages/components/menus/SimpleListMenu.js"}} diff --git a/docs/src/pages/components/menus/menus-fr.md b/docs/src/pages/components/menus/menus-fr.md index 006877f4fa6253..955c96505073c5 100644 --- a/docs/src/pages/components/menus/menus-fr.md +++ b/docs/src/pages/components/menus/menus-fr.md @@ -1,5 +1,5 @@ --- -title: React Menu component +title: Composant React Menu components: Menu, MenuItem, MenuList, ClickAwayListener, Popover, Popper githubLabel: 'component: Menu' materialDesign: https://material.io/components/menus @@ -10,29 +10,29 @@ waiAria: 'https://www.w3.org/TR/wai-aria-practices/#menubutton' <p class="description">Les menus affichent une liste de choix sur des surfaces temporaires.</p> -A menu displays a list of choices on a temporary surface. Il apparaît lorsque l'utilisateur interagit avec un bouton ou un autre contrôle. +Un [Menu](https://material.io/design/components/menus.html) affiche une liste de choix sur une surface temporaire. Il apparaît lorsque l'utilisateur interagit avec un bouton ou un autre contrôle. {{"component": "modules/components/ComponentLinkHeader.js"}} -## Basic menu +## Menu de base -A basic menu opens over the anchor element by default (this option can be [changed](#menu-positioning) via props). When close to a screen edge, a basic menu vertically realigns to make sure that all menu items are completely visible. +Un menu de base s'ouvre par défaut sur l'élément d'ancrage (cette option peut [ être modifiée ](#menu-positioning) via les accessoires). Lorsqu'ils sont près du bord de l'écran, les menus simples se réalignent verticalement afin que tous les éléments du menu soient visibles. Le choix d'une option doit idéalement être validé immédiatement et fermer le menu. -**Désambiguïsation**: Contrairement aux menus simples, les boîtes de dialogue simples peuvent présenter des détails supplémentaires relatifs aux options disponibles pour un élément de la liste ou proposer des actions de navigation ou orthogonales liées à la tâche principale. Although they can display the same content, simple menus are preferred over simple dialogs because simple menus are less disruptive to the user's current context. +**Désambiguïsation**: Contrairement aux menus simples, les boîtes de dialogue simples peuvent présenter des détails supplémentaires relatifs aux options disponibles pour un élément de la liste ou proposer des actions de navigation ou orthogonales liées à la tâche principale. Bien qu'ils puissent afficher le même contenu, les menus simples sont préférables aux simples dialogues, car les menus simples perturbent moins le contexte actuel de l'utilisateur. {{"demo": "pages/components/menus/SimpleMenu.js"}} -## Selected menu +## Menu sélectionné -S'ils sont utilisés pour la sélection d'élément, lorsqu'ils sont ouverts, les menus simples tentent d'aligner verticalement l'élément de menu actuellement sélectionné avec l'élément d'ancrage, et la mise au point initiale sera placée sur l'élément de menu sélectionné. L'élément de menu actuellement sélectionné est défini à l'aide de la propriété `selected` (à partir de [ListItem](/api/list-item/)). Pour utiliser un élément de menu sélectionné sans affecter la mise au point initiale ou le positionnement vertical du menu, définissez la propriété `variant` à `menu`. +L'élément de menu actuellement sélectionné est défini à l'aide de la propriété `selected` (à partir de [ListItem](/api/list-item/)). S'ils sont utilisés pour la sélection d'élément, lorsqu'ils sont ouverts, les menus simples tentent d'aligner verticalement l'élément de menu actuellement sélectionné avec l'élément d'ancrage, et la mise au point initiale sera placée sur l'élément de menu sélectionné. Pour utiliser un élément de menu sélectionné sans affecter la mise au point initiale ou le positionnement vertical du menu, définissez la propriété `variant` à `menu`. {{"demo": "pages/components/menus/SimpleListMenu.js"}} -## Positioned menu +## Menu positionné -Because the `Menu` component uses the `Popover` component to position itself, you can use the same [positioning props](/components/popover/#anchor-playground) to position it. For instance, you can display the menu below the anchor: +Parce que le composant `Menu` utilise le composant `Popover` pour se positionner, vous pouvez utiliser les mêmes [props de positionnement](/components/popover/#anchor-playground) pour le positionner. Par exemple, vous pouvez afficher le menu sous l'ancre : {{"demo": "pages/components/menus/PositionedMenu.js"}} @@ -44,7 +44,7 @@ La responsabilité principale du composant `MenuList` est de gérer le focus. {{"demo": "pages/components/menus/MenuListComposition.js", "bg": true}} -## Customized menu +## Menu personnalisé Voici un exemple de personnalisation du composant. Vous pouvez en savoir plus dans la [page de documentation des overrides](/customization/how-to-customize/). @@ -54,7 +54,7 @@ Le `MenuItem` est un wrapper autour de `ListItem` avec quelques styles suppléme 🎨 Si vous cherchez de l'inspiration, vous pouvez consulter les [exemples de personnalisation de MUI Treasury](https://mui-treasury.com/styles/menu). -## Max height menu +## Hauteur maximale du menu Si la hauteur d'un menu empêche l'affichage de tous les éléments du menu, le menu peut défiler en interne. diff --git a/docs/src/pages/components/menus/menus-ja.md b/docs/src/pages/components/menus/menus-ja.md index 89a92eaf46364a..a31306f8bebfba 100644 --- a/docs/src/pages/components/menus/menus-ja.md +++ b/docs/src/pages/components/menus/menus-ja.md @@ -1,5 +1,5 @@ --- -title: React Menu component +title: Reactメニューコンポーネント components: Menu, MenuItem, MenuList, ClickAwayListener, Popover, Popper githubLabel: 'component: Menu' materialDesign: https://material.io/components/menus @@ -10,59 +10,59 @@ waiAria: 'https://www.w3.org/TR/wai-aria-practices/#menubutton' <p class="description">メニューには、一時的なサーフェスの選択肢のリストが表示されます。</p> -A menu displays a list of choices on a temporary surface. ユーザーがボタンやその他のコントロールを操作すると表示されます。 +メニューコンポーネントは、画面に一時的に表示されるリストのコンポーネントです。 ユーザーがボタンやその他のコントロールを操作すると表示されます。 {{"component": "modules/components/ComponentLinkHeader.js"}} -## Basic menu +## 基本のメニューコンポーネント -A basic menu opens over the anchor element by default (this option can be [changed](#menu-positioning) via props). When close to a screen edge, a basic menu vertically realigns to make sure that all menu items are completely visible. +シンプルなメニューはデフォルトでアンカー要素の上に表示されます。 (プロパティによって設定を[変える](#menu-positioning)ことができます。) 画面の端に表示される場合、すべてのメニュー項目が表示されるよう、デフォルトのメニューは垂直方向に表示されます。 オプションを選択したら、そのオプションをすぐにコミットしてメニューを閉じるのが理想的です。 -**曖昧さ回避**: 単純なメニューとは対照的に、単純なダイアログでは、リスト項目で使用可能なオプションに関連する追加の詳細を表示したり、主要なタスクに関連するナビゲーションまたは直交アクションを提供することができます。 Although they can display the same content, simple menus are preferred over simple dialogs because simple menus are less disruptive to the user's current context. +**曖昧さ回避**: メニューとは違い、ダイアログでは、リスト項目で使用可能なオプションに関連する追加の詳細を表示したり、主要なタスクに関連するナビゲーションまたは直交アクションを提供することができます。 同じコンテンツを表示することはできますが、シンプルなダイアログよりもシンプルなメニューが好まれます。シンプルなメニューはユーザーの現在のコンテキストにとって破壊的ではないためです。 -{{"demo": "pages/components/menus/SimpleMenu.js"}} +{{"demo": "pages/components/menus/BasicMenu.js"}} -## Selected menu +## 選択されているメニュー -項目の選択に使用した場合、シンプルメニューを開くと、現在選択されているメニュー項目がアンカー要素に垂直に配置されます。 選択したメニュー項目に初期フォーカスが移ります。 The `MenuItem` is a wrapper around `ListItem` with some additional styles. 現在選択されているメニュー項目は、 `selected` プロパティ([ListItem](/api/list-item/))を使用して設定されます。 選択したメニュー項目を、初期フォーカスやメニューの縦位置に影響を与えずに使用するには、`variant`プロパティを `menu`に設定します。 +If used for item selection, when opened, simple menus places the initial focus on the selected menu item. 現在選択されているメニュー項目は、 `selected` プロパティ([ListItem](/api/list-item/))を使用して設定されます。 To use a selected menu item without impacting the initial focus, set the `variant` prop to "menu". {{"demo": "pages/components/menus/SimpleListMenu.js"}} -## Positioned menu +## 位置を決めたメニュー -Because the `Menu` component uses the `Popover` component to position itself, you can use the same [positioning props](/components/popover/#anchor-playground) to position it. For instance, you can display the menu below the anchor: +`Menu`コンポーネントは自信を配置するのに`Popover`コンポーネントを使用するため、配置のために同じ[配置プロパティ](/components/popover/#anchor-playground)を使うことができます。 たとえば、アンカーの下にメニューを表示できます。 {{"demo": "pages/components/menus/PositionedMenu.js"}} ## メニューリストの構成 -The `Menu` component uses the `Popover` component internally. However, you might want to use a different positioning strategy, or not blocking the scroll. For answering those needs, we expose a `MenuList` component that you can compose, with `Popper` in this example. +`Menu` コンポーネントは内部的に `Popover` コンポーネントを使用します。 しかし、別の配置方法を使ったり、スクロールをブロックしないようにしたいかもしれません。 そのようなニーズに応えるために、自身で構成できる `MenuList` コンポーネントを公開しています。次の例では`Popper`を使用しています。 -The primary responsibility of the `MenuList` component is to handle the focus. +`MenuList` コンポーネントの主な役割は、フォーカスを処理することです。 {{"demo": "pages/components/menus/MenuListComposition.js", "bg": true}} -## Customized menu +## カスタムメニュー -コンポーネントのカスタマイズ例を次に示します。 詳細については、 [overrides documentation page](/customization/how-to-customize/)を参照してください。 +コンポーネントのカスタマイズ例を次に示します。 詳細については、 [こちら](/customization/how-to-customize/)を参照してください。 {{"demo": "pages/components/menus/CustomizedMenus.js"}} -The `MenuItem` is a wrapper around `ListItem` with some additional styles. You can use the same list composition features with the `MenuItem` component: +`MenuItem` はいくつかの追加のスタイルを備えた `ListItem` のラッパーです。 `MenuItem` コンポーネントで同じリスト構成機能を使用できます: 🎨 インスピレーションを求めている場合は、 [MUI Treasury's customization examples](https://mui-treasury.com/styles/menu) を確認すると良いでしょう。 -## Max height menu +## 高さの最大値を決めたメニュー -If the height of a menu prevents all menu items from being displayed, the menu can scroll internally. +すべてのメニュー項目を表示しないようにメニューの高さを設定すると、メニューは内部でスクロールできるようになります。 {{"demo": "pages/components/menus/LongMenu.js"}} ## 制限事項 -There is [a flexbox bug](https://bugs.chromium.org/p/chromium/issues/detail?id=327437) that prevents `text-overflow: ellipsis` from working in a flexbox layout. You can use the `Typography` component with `noWrap` to workaround this issue: +`text-overflow: ellipsis`がflexbox layoutで動作しなくなる[fexboxのバグ](https://bugs.chromium.org/p/chromium/issues/detail?id=327437) があります。 `Typography` コンポーネントの `noWrap` を利用してこの問題を回避できます。 {{"demo": "pages/components/menus/TypographyMenu.js", "bg": true}} @@ -72,9 +72,9 @@ There is [a flexbox bug](https://bugs.chromium.org/p/chromium/issues/detail?id=3 {{"demo": "pages/components/menus/FadeMenu.js"}} -## Context menu +## コンテキストメニュー -Here is an example of a context menu. (Right click to open.) +コンテキストメニューの例を次に示します。 (右クリックで開きます。) {{"demo": "pages/components/menus/ContextMenu.js"}} diff --git a/docs/src/pages/components/menus/menus-pt.md b/docs/src/pages/components/menus/menus-pt.md index 3b7fcaae337c06..79b053da306587 100644 --- a/docs/src/pages/components/menus/menus-pt.md +++ b/docs/src/pages/components/menus/menus-pt.md @@ -22,11 +22,11 @@ Escolhendo uma opção deve confirmar imediatamente a opção e fechar o menu. **Desambiguação**: Em contraste com menus simples, uma caixa de diálogo simples pode apresentar detalhes adicionais relacionados às opções disponíveis para um item da lista ou fornecer navegação ou ações indiretas relacionada à tarefa principal. Although they can display the same content, simple menus are preferred over simple dialogs because simple menus are less disruptive to the user's current context. -{{"demo": "pages/components/menus/SimpleMenu.js"}} +{{"demo": "pages/components/menus/BasicMenu.js"}} ## Menu selecionado -Se usado para a seleção de itens, quando abertos, menus simples tentam alinhar verticalmente o item de menu atualmente selecionado com o elemento de âncora, e o foco inicial será colocado no item de menu selecionado. O item de menu atualmente selecionado é definido usando a propriedade`selected`(de [ListItem](/api/list-item/)). Para usar um item de menu selecionado sem afetar o foco inicial ou o posicionamento vertical do menu, defina a propriedade `variant` como `menu`. +If used for item selection, when opened, simple menus places the initial focus on the selected menu item. O item de menu atualmente selecionado é definido usando a propriedade`selected`(de [ListItem](/api/list-item/)). To use a selected menu item without impacting the initial focus, set the `variant` prop to "menu". {{"demo": "pages/components/menus/SimpleListMenu.js"}} diff --git a/docs/src/pages/components/menus/menus-ru.md b/docs/src/pages/components/menus/menus-ru.md index 56e8e9465e96fa..2e8b7d40f344da 100644 --- a/docs/src/pages/components/menus/menus-ru.md +++ b/docs/src/pages/components/menus/menus-ru.md @@ -22,11 +22,11 @@ A basic menu opens over the anchor element by default (this option can be [chang **Неточности:** В отличии от простых меню, простые диалоги могут содержать дополнительную информацию относительно опций, доступных для элемента списка или предоставлять навигационные или ортогональные действия, относящиеся к главной задаче. Although they can display the same content, simple menus are preferred over simple dialogs because simple menus are less disruptive to the user's current context. -{{"demo": "pages/components/menus/SimpleMenu.js"}} +{{"demo": "pages/components/menus/BasicMenu.js"}} ## Selected menu -If used for item selection, when opened, simple menus attempt to vertically align the currently selected menu item with the anchor element, and the initial focus will be placed on the selected menu item. The currently selected menu item is set using the `selected` property (from [ListItem](/api/list-item/)). To use a selected menu item without impacting the initial focus or the vertical positioning of the menu, set the `variant` property to `menu`. +If used for item selection, when opened, simple menus places the initial focus on the selected menu item. The currently selected menu item is set using the `selected` property (from [ListItem](/api/list-item/)). To use a selected menu item without impacting the initial focus, set the `variant` prop to "menu". {{"demo": "pages/components/menus/SimpleListMenu.js"}} @@ -46,7 +46,7 @@ The primary responsibility of the `MenuList` component is to handle the focus. ## Customized menu -Ниже находится пример кастомизации компонента. You can learn more about this in the [overrides documentation page](/customization/how-to-customize/). +Ниже находится пример кастомизации компонента. Вы можете узнать об этом больше [в документации по переопределению свойств](/customization/how-to-customize/). {{"demo": "pages/components/menus/CustomizedMenus.js"}} diff --git a/docs/src/pages/components/menus/menus-zh.md b/docs/src/pages/components/menus/menus-zh.md index 94e1edbfb027c2..5ceabc03359bed 100644 --- a/docs/src/pages/components/menus/menus-zh.md +++ b/docs/src/pages/components/menus/menus-zh.md @@ -20,13 +20,13 @@ waiAria: 'https://www.w3.org/TR/wai-aria-practices/#menubutton' 理想状态下,选择一个选项是会立刻执行此选项并且关闭整个菜单。 -**解疑**:与简单菜单不同,一个简单的对话框可以提供与列表项可用选项相关的额外细节,或提供与主要任务相关的导航或正交操作。 Although they can display the same content, simple menus are preferred over simple dialogs because simple menus are less disruptive to the user's current context. +**解疑**:与简单菜单不同,一个简单的对话框可以提供与列表项可用选项相关的额外细节,或提供与主要任务相关的导航或正交操作。 虽然它们都可以显示相同的内容,但是菜单组件比对话框组件更受欢迎,因为相比之下菜单组件对用户的干扰更小。 -{{"demo": "pages/components/menus/SimpleMenu.js"}} +{{"demo": "pages/components/menus/BasicMenu.js"}} ## 选择菜单 -若用于选项的选择,当打开简单菜单的时候,它会通过一个锚元素来尝试与当前被选择的菜单的选择项垂直对齐,而初始的焦点集中于被选中的那个选项。 通过 `selected` 属性(在[ListItem](/api/list-item/)中),您能够设置当前被选中的选项。 若想要使用一个已被选的项目,且不影响初始的焦点或者菜单的垂直位置,您可以设置一下”菜单“的 `variant` 属性。 +If used for item selection, when opened, simple menus places the initial focus on the selected menu item. 通过 `selected` 属性(在[ListItem](/api/list-item/)中),您能够设置当前被选中的选项。 To use a selected menu item without impacting the initial focus, set the `variant` prop to "menu". {{"demo": "pages/components/menus/SimpleListMenu.js"}} diff --git a/docs/src/pages/components/modal/modal-de.md b/docs/src/pages/components/modal/modal-de.md index 6f1b92561ff06c..bd6f444896440b 100644 --- a/docs/src/pages/components/modal/modal-de.md +++ b/docs/src/pages/components/modal/modal-de.md @@ -1,6 +1,6 @@ --- title: React Modal component -components: Modal +components: Modal, ModalUnstyled githubLabel: 'component: Modal' waiAria: 'https://www.w3.org/TR/wai-aria-practices/#dialog_modal' --- @@ -16,7 +16,6 @@ Die Komponente rendered seine `Kinder` - Knoten vor einer Hintergrund - Komponen - 🔐 Es deaktiviert das Blättern des Seiteninhalts, während es geöffnet ist. - The [WAI-ARIA authoring practices](https://www.w3.org/TR/wai-aria-practices/examples/dialog-modal/dialog.html) can help you set the initial focus on the most relevant element, based on your modal content. - ♿️ Fügt die entsprechenden ARIA-Rollen automatisch hinzu. -- 📦 [5 kB gzipped](/size-snapshot). Die Style-Funktion der [Palette](/system/palette/). @@ -29,20 +28,36 @@ Wenn Sie ein modales Dialogfeld erstellen, möchten Sie wahrscheinlich die [Dial - [Menu](/components/menus/) - [Popover](/components/popover/) -## Einfaches Modal +## Basic modal -This demo stacks Modals, but it is strongly discouraged to do so in practice. - -{{"demo": "pages/components/modal/SimpleModal.js"}} +{{"demo": "pages/components/modal/BasicModal.js"}} Notice that you can disable the outline (often blue or gold) with the `outline: 0` CSS property. +## Unstyled + +- 📦 [4.7 kB gzipped](https://bundlephobia.com/result?p=@material-ui/unstyled@next) + +The modal also comes with an unstyled version. It's ideal for doing heavy customizations and minimizing bundle size. + +```js +import ModalUnstyled from '@material-ui/unstyled/ModalUnstyled'; +``` + +{{"demo": "pages/components/modal/ModalUnstyled.js"}} + +## Nested modal + +Modals can be nested, for example a select within a dialog, but stacking of more than two modals, or any two modals with a backdrop is discouraged. + +{{"demo": "pages/components/modal/NestedModal.js"}} + ## Übergänge The open/close state of the modal can be animated with a transition component. This component should respect the following conditions: - Be a direct child descendent of the modal. -- Have an `in` prop. This corresponds to the open / close state. +- Have an `in` prop. This corresponds to the open/close state. - Call the `onEnter` callback prop when the enter transition starts. - Call the `onExited` callback prop when the exit transition is completed. These two callbacks allow the modal to unmount the child content when closed and fully transitioned. @@ -64,7 +79,7 @@ The content of modal is unmounted when closed. If you need to make the content a {{"demo": "pages/components/modal/KeepMountedModal.js", "defaultCodeOpen": false}} -Wie bei jeder Leistungsoptimierung ist dies keine Silberkugel. Stellen Sie sicher, dass Sie zuerst Engpässe erkennen und anschließend diese Optimierungsstrategien ausprobieren. +As with any performance optimization, this is not a silver bullet. Be sure to identify bottlenecks first, and then try out these optimization strategies. ## Server-seitiges Modal @@ -78,7 +93,7 @@ React [doesn't support](https://github.com/facebook/react/issues/13097) the [`cr The modal moves the focus back to the body of the component if the focus tries to escape it. -This is done for accessibility purposes, however, it might create issues. In the event the users need to interact with another part of the page, e.g. with a chatbot window, you can disable the behavior: +This is done for accessibility purposes. However, it might create issues. In the event the users need to interact with another part of the page, e.g. with a chatbot window, you can disable the behavior: ```jsx <Modal disableEnforceFocus /> diff --git a/docs/src/pages/components/modal/modal-es.md b/docs/src/pages/components/modal/modal-es.md index 4ddeb1050cccda..18216b43bdff99 100644 --- a/docs/src/pages/components/modal/modal-es.md +++ b/docs/src/pages/components/modal/modal-es.md @@ -1,6 +1,6 @@ --- title: React Modal component -components: Modal +components: Modal, ModalUnstyled githubLabel: 'component: Modal' waiAria: 'https://www.w3.org/TR/wai-aria-practices/#dialog_modal' --- @@ -16,7 +16,6 @@ The component renders its `children` node in front of a backdrop component. The - 🔐 It disables scrolling of the page content while open. - ♿️ It properly manages focus; moving to the modal content, and keeping it there until the modal is closed. - ♿️ Adds the appropriate ARIA roles automatically. -- 📦 [5 kB comprimido](/size-snapshot). [La función de estilo de la paleta](/system/palette/). @@ -29,20 +28,36 @@ If you are creating a modal dialog, you probably want to use the [Dialog](/compo - [Menu](/components/menus/) - [Popover](/components/popover/) -## Modal simple +## Basic modal -This demo stacks Modals, but it is strongly discouraged to do so in practice. - -{{"demo": "pages/components/modal/SimpleModal.js"}} +{{"demo": "pages/components/modal/BasicModal.js"}} Notice that you can disable the outline (often blue or gold) with the `outline: 0` CSS property. +## Unstyled + +- 📦 [4.7 kB comprimido](https://bundlephobia.com/result?p=@material-ui/unstyled@next) + +The modal also comes with an unstyled version. It's ideal for doing heavy customizations and minimizing bundle size. + +```js +import ModalUnstyled from '@material-ui/unstyled/ModalUnstyled'; +``` + +{{"demo": "pages/components/modal/ModalUnstyled.js"}} + +## Nested modal + +Modals can be nested, for example a select within a dialog, but stacking of more than two modals, or any two modals with a backdrop is discouraged. + +{{"demo": "pages/components/modal/NestedModal.js"}} + ## Transiciones The open/close state of the modal can be animated with a transition component. Este componente debe respetar las siguientes condiciones: - Ser un hijo directo del modal. -- Have an `in` prop. This corresponds to the open / close state. +- Have an `in` prop. This corresponds to the open/close state. - Call the `onEnter` callback prop when the enter transition starts. - Call the `onExited` callback prop when the exit transition is completed. These two callbacks allow the modal to unmount the child content when closed and fully transitioned. @@ -64,7 +79,7 @@ The content of modal is unmounted when closed. If you need to make the content a {{"demo": "pages/components/modal/KeepMountedModal.js", "defaultCodeOpen": false}} -Como en cualquier optimización de rendimiento esto no es una bala de plata. Be sure to identify bottlenecks first and then try out these optimization strategies. +As with any performance optimization, this is not a silver bullet. Be sure to identify bottlenecks first, and then try out these optimization strategies. ## Server-side modal @@ -78,7 +93,7 @@ React [doesn't support](https://github.com/facebook/react/issues/13097) the [`cr The modal moves the focus back to the body of the component if the focus tries to escape it. -This is done for accessibility purposes, however, it might create issues. In the event the users need to interact with another part of the page, e.g. with a chatbot window, you can disable the behavior: +This is done for accessibility purposes. However, it might create issues. In the event the users need to interact with another part of the page, e.g. with a chatbot window, you can disable the behavior: ```jsx <Modal disableEnforceFocus /> diff --git a/docs/src/pages/components/modal/modal-fr.md b/docs/src/pages/components/modal/modal-fr.md index e9a580949ca1be..287b2862c2ec75 100644 --- a/docs/src/pages/components/modal/modal-fr.md +++ b/docs/src/pages/components/modal/modal-fr.md @@ -1,6 +1,6 @@ --- -title: React Modal component -components: Modal +title: Composant React Modal +components: Modal, ModalUnstyled githubLabel: 'component: Modal' waiAria: 'https://www.w3.org/TR/wai-aria-practices/#dialog_modal' --- @@ -16,7 +16,6 @@ Le composant affiche ses nœuds `children` devant un composant d'arrière-plan. - 🔐 Désactive le scroll de la page quand elle est ouverte. - ♿️ Gère proprement le focus ; assure l'accessibilité au contenu de la modale jusqu'à sa fermeture. - ♿ Ajoute automatiquement les rôles ARIA appropriés. -- 📦 [5 kB gzippé](/size-snapshot). {{"component": "modules/components/ComponentLinkHeader.js", "design": false}} @@ -33,16 +32,32 @@ Si vous créez une boîte de dialogue modale, vous voudrez probablement utiliser This demo stacks Modals, but it is strongly discouraged to do so in practice. -{{"demo": "pages/components/modal/SimpleModal.js"}} - Notez que vous pouvez désactiver le contour (souvent bleu ou or) avec la propriété `outline : 0` CSS . +## Unstyled + +- Être un enfant descendant direct du modal. + +The modal also comes with an unstyled version. It's ideal for doing heavy customizations and minimizing bundle size. + +```js +import ModalUnstyled from '@material-ui/unstyled/ModalUnstyled'; +``` + +{{"demo": "pages/components/modal/ModalUnstyled.js"}} + +## Performances + +Modal a un support intégré pour [react-transition-group](https://github.com/reactjs/react-transition-group). + +{{"demo": "pages/components/modal/NestedModal.js"}} + ## Les transitions L'état ouvert/fermé de la modale peut être animé avec un composant de transition. Ce composant doit respecter les conditions suivantes : - Être un enfant descendant direct du modal. -- Avoir la propriété `in`. Correspond à l'état ouvert/fermé. +- Avoir la propriété `in`. This corresponds to the open/close state. - Appeler la propriété de callback `onEnter` lorsque la transition d'entrée démarre. - Appeler la propriété de callback `onExited` lorsque la transition de sortie est terminée. Ces deux fonctions de callback permettent à la modale de retirer le contenu enfant lorsqu'elle est fermée et que la transition est terminée. @@ -56,7 +71,7 @@ Alternativement, vous pouvez utiliser [react-spring](https://github.com/react-sp ## Performances -The content of modal is unmounted when closed. If you need to make the content available to search engines or render expensive component trees inside your modal while optimizing for interaction responsiveness it might be a good idea to change this default behavior by enabling the `keepMounted` prop: +Le contenu du modal est démonté lorsqu'il est fermé. If you need to make the content available to search engines or render expensive component trees inside your modal while optimizing for interaction responsiveness it might be a good idea to change this default behavior by enabling the `keepMounted` prop: ```jsx <Modal keepMounted /> @@ -78,7 +93,7 @@ React [doesn't support](https://github.com/facebook/react/issues/13097) the [`cr The modal moves the focus back to the body of the component if the focus tries to escape it. -This is done for accessibility purposes, however, it might create issues. In the event the users need to interact with another part of the page, e.g. with a chatbot window, you can disable the behavior: +This is done for accessibility purposes, however, it might create issues. However, it might create issues. In the event the users need to interact with another part of the page, e.g. with a chatbot window, you can disable the behavior: ```jsx <Modal disableEnforceFocus /> @@ -105,4 +120,4 @@ This is done for accessibility purposes, however, it might create issues. In the ``` - The [WAI-ARIA authoring practices](https://www.w3.org/TR/wai-aria-practices/examples/dialog-modal/dialog.html) can help you set the initial focus on the most relevant element, based on your modal content. -- Windows under a modal are **inert**. Keep in mind that a "modal window" overlays on either the primary window or another modal window. Keep in mind that a "modal window" overlays on either the primary window or another modal window. This might create [conflicting behaviors](#focus-trap). +- Windows under a modal are **inert**. Les fenêtres sous un modal sont **inertes**. Keep in mind that a "modal window" overlays on either the primary window or another modal window. This might create [conflicting behaviors](#focus-trap). diff --git a/docs/src/pages/components/modal/modal-ja.md b/docs/src/pages/components/modal/modal-ja.md index 9911958e41fd6d..2333e1770244f7 100644 --- a/docs/src/pages/components/modal/modal-ja.md +++ b/docs/src/pages/components/modal/modal-ja.md @@ -1,6 +1,6 @@ --- title: React Modal component -components: Modal +components: Modal, ModalUnstyled githubLabel: 'component: Modal' waiAria: 'https://www.w3.org/TR/wai-aria-practices/#dialog_modal' --- @@ -16,33 +16,48 @@ waiAria: 'https://www.w3.org/TR/wai-aria-practices/#dialog_modal' - 🔐open開いている間、ページコンテンツのスクロールを無効にします。 - ♿️フォーカスを適切に管理します。モーダルコンテンツに移動 して、モーダルが閉じられるまでそこに保持します。 - ♿️適切なARIAロールを自動的に追加します。 -- [5 kB gzipped](/size-snapshot). [The palette](/system/palette/) style関数。 > **用語の注記**。 「モーダル」という用語は「ダイアログ」を意味するために使用されることがありますが、これは誤った呼び名です。 A modal window describes parts of a UI. 要素が[アプリケーションの他の部分との対話をブロックする場合](https://en.wikipedia.org/wiki/Modal_window)、その要素はモーダルであると見なされます。 -要素が[アプリケーションの他の部分との対話をブロックする場合](https://en.wikipedia.org/wiki/Modal_window)、その要素はモーダルであると見なされます。 This component should respect the following conditions: +要素が[アプリケーションの他の部分との対話をブロックする場合](https://en.wikipedia.org/wiki/Modal_window)、その要素はモーダルであると見なされます。 モーダルは、次のコンポーネントによって活用される低レベルの構成要素です。 - [Dialog](/components/dialogs/) - [Drawer](/components/drawers/) - [Menu](/components/menus/) - [Popover](/components/popover/) -## Simple modal +## Basic modal -This demo stacks Modals, but it is strongly discouraged to do so in practice. - -{{"demo": "pages/components/modal/SimpleModal.js"}} +{{"demo": "pages/components/modal/BasicModal.js"}} `アウトライン:0` CSSプロパティでアウトライン(多くの場合、青または金)を無効にできることに注意してください。 +## Unstyled + +- 📦 [4.7 kB gzipped](https://bundlephobia.com/result?p=@material-ui/unstyled@next) + +The modal also comes with an unstyled version. It's ideal for doing heavy customizations and minimizing bundle size. + +```js +import ModalUnstyled from '@material-ui/unstyled/ModalUnstyled'; +``` + +{{"demo": "pages/components/modal/ModalUnstyled.js"}} + +## Nested modal + +Modals can be nested, for example a select within a dialog, but stacking of more than two modals, or any two modals with a backdrop is discouraged. + +{{"demo": "pages/components/modal/NestedModal.js"}} + ## Transitions The open/close state of the modal can be animated with a transition component. This component should respect the following conditions: - Be a direct child descendent of the modal. -- `in`プロパティを持っています。 これは、オープン/クローズ状態に対応します。 +- `in`プロパティを持っています。 This corresponds to the open/close state. - Call the `onEnter` callback prop when the enter transition starts. - Call the `onExited` callback prop when the exit transition is completed. These two callbacks allow the modal to unmount the child content when closed and fully transitioned. @@ -56,7 +71,7 @@ Alternatively, you can use [react-spring](https://github.com/react-spring/react- ## パフォーマンス -The content of modal is unmounted when closed. If you need to make the content available to search engines or render expensive component trees inside your modal while optimizing for interaction responsiveness it might be a good idea to change this default behavior by enabling the `keepMounted` prop: +モーダルの内容は閉じたときにアンマウントされます。 インタラクションの応答性を最適化しつつ、コンテンツを検索エンジンで使用できるようにする必要がある場合や、モーダル内にリッチなコンポーネントツリーをレンダリングする必要がある場合は、 `keepMount` プロパティを有効にしてデフォルトの動作を変更すると良いでしょう。 ```jsx <Modal keepMounted /> @@ -64,7 +79,7 @@ The content of modal is unmounted when closed. If you need to make the content a {{"demo": "pages/components/modal/KeepMountedModal.js", "defaultCodeOpen": false}} -他のパフォーマンス最適化と同様、これは特効薬ではありません。 まずボトルネックを特定してから、これらの最適化戦略を試してください。 +As with any performance optimization, this is not a silver bullet. Be sure to identify bottlenecks first, and then try out these optimization strategies. ## Server-side modal @@ -78,7 +93,7 @@ React は、サーバー上の [`createPortal()`](https://reactjs.org/docs/p The modal moves the focus back to the body of the component if the focus tries to escape it. -This is done for accessibility purposes, however, it might create issues. In the event the users need to interact with another part of the page, e.g. with a chatbot window, you can disable the behavior: +This is done for accessibility purposes. However, it might create issues. In the event the users need to interact with another part of the page, e.g. with a chatbot window, you can disable the behavior: ```jsx <Modal disableEnforceFocus /> @@ -88,7 +103,7 @@ This is done for accessibility purposes, however, it might create issues. In the (WAI-ARIA: https://www.w3.org/TR/wai-aria-practices/#dialog_modal) -- **用語の注記**。 「モーダル」という用語は「ダイアログ」を意味するために使用されることがありますが、これは誤った呼び名です。 A modal window describes parts of a UI. 要素が[アプリケーションの他の部分との対話をブロックする場合](https://en.wikipedia.org/wiki/Modal_window)、その要素はモーダルであると見なされます。 +- モーダルタイトルを参照する `aria-labelledby = "id..."` `モーダル`に追加してください。 要素が[アプリケーションの他の部分との対話をブロックする場合](https://en.wikipedia.org/wiki/Modal_window)、その要素はモーダルであると見なされます。 ```jsx <Modal @@ -105,4 +120,4 @@ This is done for accessibility purposes, however, it might create issues. In the ``` - The [WAI-ARIA authoring practices](https://www.w3.org/TR/wai-aria-practices/examples/dialog-modal/dialog.html) can help you set the initial focus on the most relevant element, based on your modal content. -- Windows under a modal are **inert**. Keep in mind that a "modal window" overlays on either the primary window or another modal window. Keep in mind that a "modal window" overlays on either the primary window or another modal window. This might create [conflicting behaviors](#focus-trap). +- Keep in mind that a "modal window" overlays on either the primary window or another modal window. モーダルの下のウィンドウは **inert** です。 That is, users cannot interact with content outside an active modal window. This might create [conflicting behaviors](#focus-trap). diff --git a/docs/src/pages/components/modal/modal-pt.md b/docs/src/pages/components/modal/modal-pt.md index 0bb6bf86734553..71568ae9591860 100644 --- a/docs/src/pages/components/modal/modal-pt.md +++ b/docs/src/pages/components/modal/modal-pt.md @@ -1,6 +1,6 @@ --- title: Componente React Modal -components: Modal +components: Modal, ModalUnstyled githubLabel: 'component: Modal' waiAria: 'https://www.w3.org/TR/wai-aria-practices/#dialog_modal' --- @@ -16,7 +16,6 @@ O componente renderiza o conteúdo de seu `children` sobre um componente backdro - 🔐 Desativa a rolagem do conteúdo da página enquanto estiver aberto. - ♿️ Gerencia adequadamente o foco; movendo para o conteúdo modal, e mantendo-o lá até que o modal seja fechado. - ♿️ Adiciona as funções ARIA apropriadas automaticamente. -- 📦 [5 kB gzipped](/size-snapshot). [A paleta](/system/palette/) com funções de estilo. @@ -29,14 +28,30 @@ Se você está criando um diálogo modal, você provavelmente quer usar o compon - [Menu](/components/menus/) - [Popover](/components/popover/) -## Modal simples +## Basic modal -Esta demonstração acumula modais, mas é fortemente desencorajado a fazer isso na prática. - -{{"demo": "pages/components/modal/SimpleModal.js"}} +{{"demo": "pages/components/modal/BasicModal.js"}} Você pode desativar o contorno (muitas vezes azul ou ouro) com a propriedade CSS `outline: 0`. +## Unstyled + +- 📦 [4.7 kB gzipped](https://bundlephobia.com/result?p=@material-ui/unstyled@next) + +The modal also comes with an unstyled version. It's ideal for doing heavy customizations and minimizing bundle size. + +```js +import ModalUnstyled from '@material-ui/unstyled/ModalUnstyled'; +``` + +{{"demo": "pages/components/modal/ModalUnstyled.js"}} + +## Nested modal + +Modals can be nested, for example a select within a dialog, but stacking of more than two modals, or any two modals with a backdrop is discouraged. + +{{"demo": "pages/components/modal/NestedModal.js"}} + ## Transições O estado de aberto/fechado do modal pode ser animado com um componente de transição. Este componente deve respeitar as seguintes condições: @@ -64,7 +79,7 @@ O conteúdo do modal é desmontado quando fechado. Se você precisa disponibiliz {{"demo": "pages/components/modal/KeepMountedModal.js", "defaultCodeOpen": false}} -Como acontece com qualquer otimização de desempenho, isso não é uma bala de prata. Certifique-se de identificar gargalos primeiro e, em seguida, experimente essas estratégias de otimização. +As with any performance optimization, this is not a silver bullet. Be sure to identify bottlenecks first, and then try out these optimization strategies. ## Modal do lado do servidor @@ -78,7 +93,7 @@ React [não suporta](https://github.com/facebook/react/issues/13097) a API [`cre O modal move o foco de volta para o corpo do componente se o foco tentar escapar dele. -No entanto, isso é feito para fins de acessibilidade, e pode criar problemas. No caso de os usuários precisarem interagir com outra parte da página, por exemplo, com uma janela de chatbot, você pode desabilitar o comportamento: +This is done for accessibility purposes. However, it might create issues. No caso de os usuários precisarem interagir com outra parte da página, por exemplo, com uma janela de chatbot, você pode desabilitar o comportamento: ```jsx <Modal disableEnforceFocus /> diff --git a/docs/src/pages/components/modal/modal-ru.md b/docs/src/pages/components/modal/modal-ru.md index f382462845d0df..7a060bf2b1491f 100644 --- a/docs/src/pages/components/modal/modal-ru.md +++ b/docs/src/pages/components/modal/modal-ru.md @@ -1,6 +1,6 @@ --- title: Компонент React Modal -components: Modal +components: Modal, ModalUnstyled githubLabel: 'component: Modal' waiAria: 'https://www.w3.org/TR/wai-aria-practices/#dialog_modal' --- @@ -16,7 +16,6 @@ The component renders its `children` node in front of a backdrop component. The - 🔐 It disables scrolling of the page content while open. - ♿️ It properly manages focus; moving to the modal content, and keeping it there until the modal is closed. - ♿️ Adds the appropriate ARIA roles automatically. -- 5 [1 кБ в сжатом виде](/size-snapshot). {{"component": "modules/components/ComponentLinkHeader.js", "design": false}} @@ -29,20 +28,36 @@ If you are creating a modal dialog, you probably want to use the [Dialog](/compo - [Menu](/components/menus/) - [Popover](/components/popover/) -## Simple modal +## Basic modal -This demo stacks Modals, but it is strongly discouraged to do so in practice. - -{{"demo": "pages/components/modal/SimpleModal.js"}} +{{"demo": "pages/components/modal/BasicModal.js"}} Notice that you can disable the outline (often blue or gold) with the `outline: 0` CSS property. +## Unstyled + +- 📦 [4.7 kB gzipped](https://bundlephobia.com/result?p=@material-ui/unstyled@next) + +The modal also comes with an unstyled version. It's ideal for doing heavy customizations and minimizing bundle size. + +```js +import ModalUnstyled from '@material-ui/unstyled/ModalUnstyled'; +``` + +{{"demo": "pages/components/modal/ModalUnstyled.js"}} + +## Nested modal + +Modals can be nested, for example a select within a dialog, but stacking of more than two modals, or any two modals with a backdrop is discouraged. + +{{"demo": "pages/components/modal/NestedModal.js"}} + ## Переходы The open/close state of the modal can be animated with a transition component. This component should respect the following conditions: - Be a direct child descendent of the modal. -- Have an `in` prop. This corresponds to the open / close state. +- Have an `in` prop. This corresponds to the open/close state. - Call the `onEnter` callback prop when the enter transition starts. - Call the `onExited` callback prop when the exit transition is completed. These two callbacks allow the modal to unmount the child content when closed and fully transitioned. @@ -64,7 +79,7 @@ The content of modal is unmounted when closed. If you need to make the content a {{"demo": "pages/components/modal/KeepMountedModal.js", "defaultCodeOpen": false}} -Как и при любой оптимизации производительности, эта функция не панацея. Сначала идентифицируйте узкие места и лишь затем пытайтесь применить эти стратегии. +As with any performance optimization, this is not a silver bullet. Be sure to identify bottlenecks first, and then try out these optimization strategies. ## Server-side modal @@ -78,7 +93,7 @@ React [doesn't support](https://github.com/facebook/react/issues/13097) the [`cr The modal moves the focus back to the body of the component if the focus tries to escape it. -This is done for accessibility purposes, however, it might create issues. In the event the users need to interact with another part of the page, e.g. with a chatbot window, you can disable the behavior: +This is done for accessibility purposes. However, it might create issues. In the event the users need to interact with another part of the page, e.g. with a chatbot window, you can disable the behavior: ```jsx <Modal disableEnforceFocus /> diff --git a/docs/src/pages/components/modal/modal-zh.md b/docs/src/pages/components/modal/modal-zh.md index e8b79a8131a88b..6e6f5c099bfaed 100644 --- a/docs/src/pages/components/modal/modal-zh.md +++ b/docs/src/pages/components/modal/modal-zh.md @@ -1,6 +1,6 @@ --- title: React Modal(模态框)组件 -components: Modal +components: Modal, ModalUnstyled githubLabel: 'component: Modal' waiAria: 'https://www.w3.org/TR/wai-aria-practices/#dialog_modal' --- @@ -16,7 +16,6 @@ waiAria: 'https://www.w3.org/TR/wai-aria-practices/#dialog_modal' - 🔐 在模态框打开时禁用页面内容的滚动。 - ♿️ 它妥善管理焦点;移动到模态内容,并保持内容一直存在直到模态框关闭。 - ♿️ 自动添加适当的 ARIA 角色。 -- 📦 [5kB 的压缩包](/size-snapshot)。 {{"component": "modules/components/ComponentLinkHeader.js", "design": false}} @@ -29,14 +28,30 @@ waiAria: 'https://www.w3.org/TR/wai-aria-practices/#dialog_modal' - [Menu](/components/menus/) - [Popover](/components/popover/) -## 简单的模态框 +## Basic modal -这个演示可以堆叠模态框,但强烈不建议在实际操作中这样做。 - -{{"demo": "pages/components/modal/SimpleModal.js"}} +{{"demo": "pages/components/modal/BasicModal.js"}} 请注意,您可以通过 `outline: 0` 属性来禁用模态框的边缘(通常为蓝色或金色)。 +## Unstyled + +- 📦 [4.7kB 已压缩的包](https://bundlephobia.com/result?p=@material-ui/unstyled@next) + +The modal also comes with an unstyled version. It's ideal for doing heavy customizations and minimizing bundle size. + +```js +import ModalUnstyled from '@material-ui/unstyled/ModalUnstyled'; +``` + +{{"demo": "pages/components/modal/ModalUnstyled.js"}} + +## Nested modal + +Modals can be nested, for example a select within a dialog, but stacking of more than two modals, or any two modals with a backdrop is discouraged. + +{{"demo": "pages/components/modal/NestedModal.js"}} + ## 过渡动画 通过使用一个过渡组件,您可以给模态框的打开/关闭状态加上动画效果。 此组件应遵守以下条件: @@ -64,7 +79,7 @@ waiAria: 'https://www.w3.org/TR/wai-aria-practices/#dialog_modal' {{"demo": "pages/components/modal/KeepMountedModal.js", "defaultCodeOpen": false}} -不过对所有情况下的性能优化,这并不是灵丹妙药。 请您务必先确定性能的瓶颈所在,再考虑这些优化策略。 +As with any performance optimization, this is not a silver bullet. Be sure to identify bottlenecks first, and then try out these optimization strategies. ## 服务端渲染的模态框 @@ -78,7 +93,7 @@ React [不支持](https://github.com/facebook/react/issues/13097)服务端渲染 如果用户试图将焦点离开模态框,模态框会将丢失的焦点移回到组件的主体。 -这样做的目的是为了无障碍设计,但是可能会造成问题。 如果用户需要与页面的其他部分进行交互,例如当您需要使用聊天窗口时,那么就可以禁用该行为: +This is done for accessibility purposes. However, it might create issues. 如果用户需要与页面的其他部分进行交互,例如当您需要使用聊天窗口时,那么就可以禁用该行为: ```jsx <Modal disableEnforceFocus /> @@ -97,5 +112,5 @@ React [不支持](https://github.com/facebook/react/issues/13097)服务端渲染 </Modal> ``` -- 这篇 [WAI-ARIA authoring practices](https://www.w3.org/TR/wai-aria-practices/examples/dialog-modal/dialog.html) 里的方法可以根据你的模态窗口里的内容, 为最合适的元素设置初始焦点. +- 这篇 [WAI-ARIA authoring practices](https://www.w3.org/TR/wai-aria-practices/examples/dialog-modal/dialog.html) 里的方法帮助你通过模态窗口里的内容,为最相关的元素设置初始焦点。 - 请记住,“模态窗口” 覆盖在主窗口或者另一个模态窗口上。 一个模态框下的窗口都是 **(惰性的)inert** 。 也就是说,用户不能与当前处于活跃状态下的模态框之外的内容进行交互。 因为这可能会造成[冲突行为](#focus-trap)。 diff --git a/docs/src/pages/components/no-ssr/no-ssr-de.md b/docs/src/pages/components/no-ssr/no-ssr-de.md index f6ec32e70caa67..ee2e0d40241d3a 100644 --- a/docs/src/pages/components/no-ssr/no-ssr-de.md +++ b/docs/src/pages/components/no-ssr/no-ssr-de.md @@ -17,7 +17,7 @@ Diese Komponente kann in verschiedenen Situationen nützlich sein: Die Style-Funktion der [Palette](/system/palette/). -## Aufschiebung der Client-Seite +## Client-side deferring {{"demo": "pages/components/no-ssr/SimpleNoSsr.js"}} diff --git a/docs/src/pages/components/no-ssr/no-ssr-es.md b/docs/src/pages/components/no-ssr/no-ssr-es.md index 56c7c000214237..08bb0d00c5a3b9 100644 --- a/docs/src/pages/components/no-ssr/no-ssr-es.md +++ b/docs/src/pages/components/no-ssr/no-ssr-es.md @@ -17,7 +17,7 @@ Este componente puede ser útil en una variedad de situaciones: [La función de estilo de la paleta](/system/palette/). -## Aplazamiento del lado del cliente +## Client-side deferring {{"demo": "pages/components/no-ssr/SimpleNoSsr.js"}} diff --git a/docs/src/pages/components/no-ssr/no-ssr-ja.md b/docs/src/pages/components/no-ssr/no-ssr-ja.md index 98e759142acb8f..9cf61415c010c3 100644 --- a/docs/src/pages/components/no-ssr/no-ssr-ja.md +++ b/docs/src/pages/components/no-ssr/no-ssr-ja.md @@ -17,13 +17,13 @@ components: NoSsr [The palette](/system/palette/) style関数。 -## クライアント側の遅延 +## Client-side deferring {{"demo": "pages/components/no-ssr/SimpleNoSsr.js"}} ## フレーム延期 -中核となるNoSsrコンポーネントの目的は、レンダリングを **遅延することです**。 前のデモで示したように、これを使用して、サーバーからクライアントへのレンダリングを延期できます。 +根本的には、NoSsrコンポーネントの目的は、レンダリングを **遅延することです**。 前のデモで示したように、これを使用して、サーバーからクライアントへのレンダリングを延期できます。 ただし、これを使用して、クライアント自体内のレンダリングを延期することもできます。 子をレンダリングするには、 `defer` プロパティでスクリーンフレーム** を **待つことができます。 ただし、これを使用して、クライアント自体内のレンダリングを延期することもできます。 子をレンダリングするには、 `defer` プロパティでスクリーンフレーム** を **待つことができます。 Reactは1ではなく [2 commits](https://reactjs.org/docs/strict-mode.html#detecting-unexpected-side-effects) を行う。 diff --git a/docs/src/pages/components/no-ssr/no-ssr-pt.md b/docs/src/pages/components/no-ssr/no-ssr-pt.md index 3a244ac38f4410..285be8b254af3a 100644 --- a/docs/src/pages/components/no-ssr/no-ssr-pt.md +++ b/docs/src/pages/components/no-ssr/no-ssr-pt.md @@ -17,7 +17,7 @@ Esse componente pode ser útil em várias situações: [A paleta](/system/palette/) com funções de estilo. -## Adiamento do lado do cliente +## Client-side deferring {{"demo": "pages/components/no-ssr/SimpleNoSsr.js"}} diff --git a/docs/src/pages/components/no-ssr/no-ssr-ru.md b/docs/src/pages/components/no-ssr/no-ssr-ru.md index 90807e9fde2eca..4f71d1b0531482 100644 --- a/docs/src/pages/components/no-ssr/no-ssr-ru.md +++ b/docs/src/pages/components/no-ssr/no-ssr-ru.md @@ -17,7 +17,7 @@ components: NoSsr {{"component": "modules/components/ComponentLinkHeader.js", "design": false}} -## Отсрочка на стороне клиента +## Client-side deferring {{"demo": "pages/components/no-ssr/SimpleNoSsr.js"}} diff --git a/docs/src/pages/components/no-ssr/no-ssr-zh.md b/docs/src/pages/components/no-ssr/no-ssr-zh.md index 2a92b68eaafcf4..af39f3fe778367 100644 --- a/docs/src/pages/components/no-ssr/no-ssr-zh.md +++ b/docs/src/pages/components/no-ssr/no-ssr-zh.md @@ -17,7 +17,7 @@ components: NoSsr {{"component": "modules/components/ComponentLinkHeader.js", "design": false}} -## 客户端延迟 +## Client-side deferring {{"demo": "pages/components/no-ssr/SimpleNoSsr.js"}} diff --git a/docs/src/pages/components/pagination/pagination-de.md b/docs/src/pages/components/pagination/pagination-de.md index bd898ad27ac2b3..59c5dd7f61ffba 100644 --- a/docs/src/pages/components/pagination/pagination-de.md +++ b/docs/src/pages/components/pagination/pagination-de.md @@ -48,7 +48,7 @@ You can specify how many digits to display either side of current page with the ## `usePagination` -For advanced customization use cases, we expose a headless `usePagination()` hook. It accepts almost the same options as the Pagination component minus all the props related to the rendering of JSX. The Pagination component uses this hook internally. +For advanced customization use cases, a headless `usePagination()` hook is exposed. It accepts almost the same options as the Pagination component minus all the props related to the rendering of JSX. The Pagination component is built on this hook. ```jsx import { usePagination } from '@material-ui/core/Pagination'; diff --git a/docs/src/pages/components/pagination/pagination-es.md b/docs/src/pages/components/pagination/pagination-es.md index 76dc97ab36665b..35e584d9974b5d 100644 --- a/docs/src/pages/components/pagination/pagination-es.md +++ b/docs/src/pages/components/pagination/pagination-es.md @@ -1,5 +1,5 @@ --- -title: React Pagination component +title: Componente de Paginación de React components: Pagination, PaginationItem githubLabel: 'component: Pagination' --- @@ -48,7 +48,7 @@ Puede especificar cuántos dígitos mostrar en ambos lados de la página actual ## `usePagination` -For advanced customization use cases, we expose a headless `usePagination()` hook. It accepts almost the same options as the Pagination component minus all the props related to the rendering of JSX. The Pagination component uses this hook internally. +For advanced customization use cases, a headless `usePagination()` hook is exposed. It accepts almost the same options as the Pagination component minus all the props related to the rendering of JSX. The Pagination component is built on this hook. ```jsx import { usePagination } from '@material-ui/core/Pagination'; diff --git a/docs/src/pages/components/pagination/pagination-fr.md b/docs/src/pages/components/pagination/pagination-fr.md index e3e34dc3671dc8..9ed01792535140 100644 --- a/docs/src/pages/components/pagination/pagination-fr.md +++ b/docs/src/pages/components/pagination/pagination-fr.md @@ -1,5 +1,5 @@ --- -title: React Pagination component +title: Composant de pagination de React components: Pagination, PaginationItem githubLabel: 'component: Pagination' --- @@ -48,7 +48,7 @@ Vous pouvez spécifier le nombre de chiffres à afficher de chaque côté de la ## `usePagination` -For advanced customization use cases, we expose a headless `usePagination()` hook. Il accepte presque les mêmes options que le composant de Pagination moins tous les propriétés liés au rendu de JSX. Le composant de Pagination utilise ce hook en interne. +For advanced customization use cases, we expose a headless `usePagination()` hook. Il accepte presque les mêmes options que le composant de Pagination moins tous les propriétés liés au rendu de JSX. Il accepte presque les mêmes options que le composant de Pagination moins tous les propriétés liés au rendu de JSX. ```jsx import { usePagination } from '@material-ui/core/Pagination'; @@ -64,7 +64,7 @@ For the pagination of a large set of tabular data, you should use the `TablePagi {{"demo": "pages/components/pagination/TablePagination.js"}} -> ⚠️ Note that the `Pagination` page prop starts at 1 to match the requirement of including the value in the URL, while the `TablePagination` page prop stats at 0 to match the requirement of zero-based JavaScript arrays that comes with rendering a lot of tabular data. +> ⚠️ Notez que la propriété de la page `Pagination` commence à 1 pour correspondre à la condition d'inclure la valeur dans l'URL, alors que la page `TablePagination` affiche les statistiques de prop à 0 pour correspondre à l'exigence de tableaux JavaScript basés sur zéro qui sont fournis avec le rendu de beaucoup de données tabulaires. You can learn more about this use case in the [table section](/components/tables/#custom-pagination-options) of the documentation. diff --git a/docs/src/pages/components/pagination/pagination-ja.md b/docs/src/pages/components/pagination/pagination-ja.md index 48eef57279ab51..4b9952555b5fb6 100644 --- a/docs/src/pages/components/pagination/pagination-ja.md +++ b/docs/src/pages/components/pagination/pagination-ja.md @@ -6,7 +6,7 @@ githubLabel: 'component: Pagination' # Pagination -<p class="description">The Pagination component enables the user to select a specific page from a range of pages.</p> +<p class="description">Pagination コンポーネントにより、範囲から特定のページを選択できます。</p> {{"component": "modules/components/ComponentLinkHeader.js"}} @@ -28,11 +28,11 @@ githubLabel: 'component: Pagination' ## Button -You can optionally enable first-page and last-page buttons, or disable the previous-page and next-page buttons. +必要に応じて、最初のページと最後のページへのボタンを有効にしたり、前のページと次のページへのボタンを無効にしたりできます。 {{"demo": "pages/components/pagination/PaginationButtons.js"}} -## Pagination ranges +## ページネーションの範囲 You can specify how many digits to display either side of current page with the `siblingRange` prop, and adjacent to the start and end page number with the `boundaryRange` prop. @@ -48,7 +48,7 @@ You can specify how many digits to display either side of current page with the ## `usePagination` -For advanced customization use cases, we expose a headless `usePagination()` hook. It accepts almost the same options as the Pagination component minus all the props related to the rendering of JSX. The Pagination component uses this hook internally. +For advanced customization use cases, a headless `usePagination()` hook is exposed. It accepts almost the same options as the Pagination component minus all the props related to the rendering of JSX. The Pagination component is built on this hook. ```jsx import { usePagination } from '@material-ui/core/Pagination'; @@ -58,13 +58,13 @@ import { usePagination } from '@material-ui/core/Pagination'; ## Table pagination -The `Pagination` component was designed to paginate a list of arbitrary items when infinite loading isn't used. It's preferred in contexts where SEO is important, for instance, a blog. +`Pagination` コンポーネントは、無限ローディングが使用されない場合に任意のアイテムのリストをページネーションするように設計されています。 It's preferred in contexts where SEO is important, for instance, a blog. For the pagination of a large set of tabular data, you should use the `TablePagination` component. {{"demo": "pages/components/pagination/TablePagination.js"}} -> ⚠️ Note that the `Pagination` page prop starts at 1 to match the requirement of including the value in the URL, while the `TablePagination` page prop stats at 0 to match the requirement of zero-based JavaScript arrays that comes with rendering a lot of tabular data. +> 注意 `Pagination`ページプロパティは、URLに値を含むという要件に合わせるため1から始まります。一方、`TablePagination`ページプロパティは、たくさんの表形式データをレンダリングすることからゼロ基点であるJavaScript配列に合わせて0から始まります。 You can learn more about this use case in the [table section](/components/tables/#custom-pagination-options) of the documentation. diff --git a/docs/src/pages/components/pagination/pagination-pt.md b/docs/src/pages/components/pagination/pagination-pt.md index a064b5430e3f47..e262a6e3078a25 100644 --- a/docs/src/pages/components/pagination/pagination-pt.md +++ b/docs/src/pages/components/pagination/pagination-pt.md @@ -48,7 +48,7 @@ Você pode especificar quantos dígitos exibir a qualquer lado da página atual ## `usePagination` -Para casos avançados de uso de customização, nós expomos um hook sem dependência, `usePagination()`. Ele aceita quase as mesmas opções que o componente de paginação, menos todas as propriedades relacionadas à renderização de JSX. O componente de paginação usa este hook internamente. +For advanced customization use cases, a headless `usePagination()` hook is exposed. Ele aceita quase as mesmas opções que o componente de paginação, menos todas as propriedades relacionadas à renderização de JSX. The Pagination component is built on this hook. ```jsx import { usePagination } from '@material-ui/core/Pagination'; diff --git a/docs/src/pages/components/pagination/pagination-ru.md b/docs/src/pages/components/pagination/pagination-ru.md index 7177b92d21184d..0e6e94dd019fba 100644 --- a/docs/src/pages/components/pagination/pagination-ru.md +++ b/docs/src/pages/components/pagination/pagination-ru.md @@ -48,7 +48,7 @@ You can specify how many digits to display either side of current page with the ## `usePagination` -For advanced customization use cases, we expose a headless `usePagination()` hook. It accepts almost the same options as the Pagination component minus all the props related to the rendering of JSX. The Pagination component uses this hook internally. +For advanced customization use cases, a headless `usePagination()` hook is exposed. It accepts almost the same options as the Pagination component minus all the props related to the rendering of JSX. The Pagination component is built on this hook. ```jsx import { usePagination } from '@material-ui/core/Pagination'; diff --git a/docs/src/pages/components/pagination/pagination-zh.md b/docs/src/pages/components/pagination/pagination-zh.md index 3659ec3b2a783a..591a291123108c 100644 --- a/docs/src/pages/components/pagination/pagination-zh.md +++ b/docs/src/pages/components/pagination/pagination-zh.md @@ -48,7 +48,7 @@ githubLabel: 'component: Pagination' ## `usePagination` -对于高级自定义用例,我们暴露了一个 headless 的 `usePagination()` hook。 它支持的选项与分页组件大致相同,但不包括与 JSX 渲染有关的所有属性。 分页组件内部也使用此 hook。 +For advanced customization use cases, a headless `usePagination()` hook is exposed. 它支持的选项与分页组件大致相同,但不包括与 JSX 渲染有关的所有属性。 The Pagination component is built on this hook. ```jsx import { usePagination } from '@material-ui/core/Pagination'; diff --git a/docs/src/pages/components/paper/paper-de.md b/docs/src/pages/components/paper/paper-de.md index 684e98a16aefa4..a6566b92dd5b3e 100644 --- a/docs/src/pages/components/paper/paper-de.md +++ b/docs/src/pages/components/paper/paper-de.md @@ -21,3 +21,9 @@ The background of an application resembles the flat, opaque texture of a sheet o If you need an outlined surface, use the `variant` prop. {{"demo": "pages/components/paper/Variants.js", "bg": "inline"}} + +## Elevation + +The elevation can be used to establish a hierachy between other content. In practical terms, the elevation controls the size of the shadow applied to the surface. In dark mode, raising the elevation also makes the surface lighter. + +{{"demo": "pages/components/paper/Elevation.js", "bg": "inline"}} diff --git a/docs/src/pages/components/paper/paper-es.md b/docs/src/pages/components/paper/paper-es.md index 5efd6d402cf579..731e90c3796b6a 100644 --- a/docs/src/pages/components/paper/paper-es.md +++ b/docs/src/pages/components/paper/paper-es.md @@ -8,11 +8,11 @@ githubLabel: 'component: Paper' <p class="description">En Material Design, las propiedades físicas del papel son trasladadas a la pantalla. </p> -The background of an application resembles the flat, opaque texture of a sheet of paper, and an application's behavior mimics paper's ability to be re-sized, shuffled, and bound together in multiple sheets. +El fondo del elemento se asemeja a la textura plana y opaca de una hoja de papel e imita el comportamiento del papel para ser redimensionado, reorganizado y encuadernado en múltiples hojas. {{"component": "modules/components/ComponentLinkHeader.js"}} -## Papel básico +## Paper básico {{"demo": "pages/components/paper/SimplePaper.js", "bg": true}} @@ -21,3 +21,9 @@ The background of an application resembles the flat, opaque texture of a sheet o Si necesitas una superficie con bordes, usa la propiedad `variant`. {{"demo": "pages/components/paper/Variants.js", "bg": "inline"}} + +## Elevation + +The elevation can be used to establish a hierachy between other content. In practical terms, the elevation controls the size of the shadow applied to the surface. In dark mode, raising the elevation also makes the surface lighter. + +{{"demo": "pages/components/paper/Elevation.js", "bg": "inline"}} diff --git a/docs/src/pages/components/paper/paper-fr.md b/docs/src/pages/components/paper/paper-fr.md index 1b9c3c956ced46..7134270f39e0ac 100644 --- a/docs/src/pages/components/paper/paper-fr.md +++ b/docs/src/pages/components/paper/paper-fr.md @@ -1,5 +1,5 @@ --- -title: React Paper component +title: Composant papier React components: Paper githubLabel: 'component: Paper' --- @@ -8,11 +8,11 @@ githubLabel: 'component: Paper' <p class="description">Dans Material Design, les propriétés physiques du papier sont traduites à l'écran. </p> -The background of an application resembles the flat, opaque texture of a sheet of paper, and an application's behavior mimics paper's ability to be re-sized, shuffled, and bound together in multiple sheets. +L'arrière-plan d'une application ressemble à la texture plate et opaque d'une feuille de papier, et le comportement d'une application imite la capacité du papier à être redimensionné, mélangé et relié en plusieurs feuilles. {{"component": "modules/components/ComponentLinkHeader.js"}} -## Basic paper +## Papier de base {{"demo": "pages/components/paper/SimplePaper.js", "bg": true}} @@ -21,3 +21,9 @@ The background of an application resembles the flat, opaque texture of a sheet o If you need an outlined surface, use the `variant` prop. {{"demo": "pages/components/paper/Variants.js", "bg": "inline"}} + +## Elevation + +The elevation can be used to establish a hierachy between other content. In practical terms, the elevation controls the size of the shadow applied to the surface. In dark mode, raising the elevation also makes the surface lighter. + +{{"demo": "pages/components/paper/Elevation.js", "bg": "inline"}} diff --git a/docs/src/pages/components/paper/paper-ja.md b/docs/src/pages/components/paper/paper-ja.md index 35851cc6c4221a..e5a2d1916a7dc2 100644 --- a/docs/src/pages/components/paper/paper-ja.md +++ b/docs/src/pages/components/paper/paper-ja.md @@ -1,5 +1,5 @@ --- -title: React Paper component +title: Reactペーパーコンポーネント components: Paper githubLabel: 'component: Paper' --- @@ -8,11 +8,11 @@ githubLabel: 'component: Paper' <p class="description">マテリアルデザインでは、紙の物理的特性が画面に変換されます。 </p> -The background of an application resembles the flat, opaque texture of a sheet of paper, and an application's behavior mimics paper's ability to be re-sized, shuffled, and bound together in multiple sheets. +アプリケーションの背景に紙のような質感を与えます。 ペーパーコンポーネントは、サイズを変更したり、シャッフルしたり、複数の紙を表示するように扱うことができます。 {{"component": "modules/components/ComponentLinkHeader.js"}} -## バリアント +## 基本のペーパーコンポーネント {{"demo": "pages/components/paper/SimplePaper.js", "bg": true}} @@ -21,3 +21,9 @@ The background of an application resembles the flat, opaque texture of a sheet o If you need an outlined surface, use the `variant` prop. {{"demo": "pages/components/paper/Variants.js", "bg": "inline"}} + +## Elevation + +The elevation can be used to establish a hierachy between other content. In practical terms, the elevation controls the size of the shadow applied to the surface. In dark mode, raising the elevation also makes the surface lighter. + +{{"demo": "pages/components/paper/Elevation.js", "bg": "inline"}} diff --git a/docs/src/pages/components/paper/paper-pt.md b/docs/src/pages/components/paper/paper-pt.md index 239b6ca99e4e04..76a433b28ec460 100644 --- a/docs/src/pages/components/paper/paper-pt.md +++ b/docs/src/pages/components/paper/paper-pt.md @@ -8,7 +8,7 @@ githubLabel: 'component: Paper' <p class="description">No Material Design, as propriedades físicas de um papel são traduzidas para a tela. </p> -The background of an application resembles the flat, opaque texture of a sheet of paper, and an application's behavior mimics paper's ability to be re-sized, shuffled, and bound together in multiple sheets. +O fundo de uma aplicação se assemelha a textura lisa e opaca de uma folha de papel e o comportamento de uma aplicação imita a habilidade do papel de ser redimensionado, embaralhado e amontoado em várias folhas. {{"component": "modules/components/ComponentLinkHeader.js"}} @@ -21,3 +21,9 @@ The background of an application resembles the flat, opaque texture of a sheet o Se você precisar de uma superfície delineada, use a propriedade `variant`. {{"demo": "pages/components/paper/Variants.js", "bg": "inline"}} + +## Elevation + +The elevation can be used to establish a hierachy between other content. In practical terms, the elevation controls the size of the shadow applied to the surface. In dark mode, raising the elevation also makes the surface lighter. + +{{"demo": "pages/components/paper/Elevation.js", "bg": "inline"}} diff --git a/docs/src/pages/components/paper/paper-ru.md b/docs/src/pages/components/paper/paper-ru.md index d2ac53af151ab2..d2d6b8f4b15b97 100644 --- a/docs/src/pages/components/paper/paper-ru.md +++ b/docs/src/pages/components/paper/paper-ru.md @@ -21,3 +21,9 @@ The background of an application resembles the flat, opaque texture of a sheet o If you need an outlined surface, use the `variant` prop. {{"demo": "pages/components/paper/Variants.js", "bg": "inline"}} + +## Elevation + +The elevation can be used to establish a hierachy between other content. In practical terms, the elevation controls the size of the shadow applied to the surface. In dark mode, raising the elevation also makes the surface lighter. + +{{"demo": "pages/components/paper/Elevation.js", "bg": "inline"}} diff --git a/docs/src/pages/components/paper/paper-zh.md b/docs/src/pages/components/paper/paper-zh.md index 7b6bf591a580b7..0517ccd4dc245d 100644 --- a/docs/src/pages/components/paper/paper-zh.md +++ b/docs/src/pages/components/paper/paper-zh.md @@ -8,7 +8,7 @@ githubLabel: 'component: Paper' <p class="description">在 Material Design 中,我们在屏幕上展现了纸张的物理属性。 </p> -The background of an application resembles the flat, opaque texture of a sheet of paper, and an application's behavior mimics paper's ability to be re-sized, shuffled, and bound together in multiple sheets. +应用程序的背景类似于纸张的平坦、不透明的纹理,应用程序的行为模仿了纸张的能力,可以重新调整大小、洗牌和装订成多张纸。 {{"component": "modules/components/ComponentLinkHeader.js"}} @@ -21,3 +21,9 @@ The background of an application resembles the flat, opaque texture of a sheet o 如果你想要一个轮廓的曲面,你可以使用 `variant` 属性。 {{"demo": "pages/components/paper/Variants.js", "bg": "inline"}} + +## Elevation + +The elevation can be used to establish a hierachy between other content. In practical terms, the elevation controls the size of the shadow applied to the surface. In dark mode, raising the elevation also makes the surface lighter. + +{{"demo": "pages/components/paper/Elevation.js", "bg": "inline"}} diff --git a/docs/src/pages/components/pickers/pickers-de.md b/docs/src/pages/components/pickers/pickers-de.md index 7bb907ebb4edac..9f961b452fd210 100644 --- a/docs/src/pages/components/pickers/pickers-de.md +++ b/docs/src/pages/components/pickers/pickers-de.md @@ -1,5 +1,5 @@ --- -title: Date picker, Time picker React components +title: Datumsauswahl, Zeit Auswahl Reagieren Sie auf React Komponenten components: TextField githubLabel: 'component: DatePicker' materialDesign: https://material.io/components/date-pickers diff --git a/docs/src/pages/components/pickers/pickers-fr.md b/docs/src/pages/components/pickers/pickers-fr.md index a59da54e2a3b76..f0949d38e7d032 100644 --- a/docs/src/pages/components/pickers/pickers-fr.md +++ b/docs/src/pages/components/pickers/pickers-fr.md @@ -16,7 +16,7 @@ packageName: '@material-ui/lab' {{"component": "modules/components/ComponentLinkHeader.js"}} -## React components +## Composants réactifs {{"demo": "pages/components/pickers/MaterialUIPickers.js"}} @@ -24,19 +24,19 @@ packageName: '@material-ui/lab' ⚠️ La prise en charge des sélecteurs natifs par les navigateurs [n'est pas parfaite](https://caniuse.com/#feat=input-datetime). -### Date picker +### Sélecteur de date Exemple de sélecteur de date natif avec `type = "date"`. {{"demo": "pages/components/pickers/DatePickers.js"}} -### Date & Time picker +### Date et ; Sélecteur de temps Exemple de sélecteur de date natif avec `type = "datetime-local"`. {{"demo": "pages/components/pickers/DateAndTimePickers.js"}} -### Time picker +### Sélecteur de temps Exemple de sélecteur de temps natif avec `type = "time"`. diff --git a/docs/src/pages/components/pickers/pickers-ja.md b/docs/src/pages/components/pickers/pickers-ja.md index 7019761497d69d..f2622c2f3d9915 100644 --- a/docs/src/pages/components/pickers/pickers-ja.md +++ b/docs/src/pages/components/pickers/pickers-ja.md @@ -16,7 +16,7 @@ packageName: '@material-ui/lab' {{"component": "modules/components/ComponentLinkHeader.js"}} -## React components +## Reactコンポーネント {{"demo": "pages/components/pickers/MaterialUIPickers.js"}} @@ -24,19 +24,19 @@ packageName: '@material-ui/lab' ⚠ブラウザーによるネイティブ入力コントロールのサポート [は完全ではありません](https://caniuse.com/#feat=input-datetime)。 より充実したソリューションについては、 [@ material-ui / pickers](https://material-ui-pickers.dev/) をご覧ください。 より充実したソリューションについては、 [@ material-ui / pickers](https://material-ui-pickers.dev/) をご覧ください。 より充実したソリューションについては、 [@ material-ui / pickers](https://material-ui-pickers.dev/) をご覧ください。 より充実したソリューションについては、 [@ material-ui / pickers](https://material-ui-pickers.dev/) をご覧ください。 -### Date picker +### 日付のPicker A native datepicker example with `type="date"`. {{"demo": "pages/components/pickers/DatePickers.js"}} -### Date & Time picker +### 日付+時間のPicker `type="datetime-local"`を指定したネイティブの日付 & 時刻ピッカーの例。 {{"demo": "pages/components/pickers/DateAndTimePickers.js"}} -### Time picker +### 時間のPicker `type="time"`を指定したネイティブの時間ピッカーの例。 diff --git a/docs/src/pages/components/pickers/pickers-pt.md b/docs/src/pages/components/pickers/pickers-pt.md index fbadae94aeb99d..9559902a3a2926 100644 --- a/docs/src/pages/components/pickers/pickers-pt.md +++ b/docs/src/pages/components/pickers/pickers-pt.md @@ -24,19 +24,19 @@ packageName: '@material-ui/lab' ⚠️ O suporte dos navegadores aos controles de entrada nativos [não é perfeito](https://caniuse.com/#feat=input-datetime). -### Date picker +### Seletor de data Um exemplo de seletor de data nativo com `type="date"`. {{"demo": "pages/components/pickers/DatePickers.js"}} -### Date & Time picker +### Seletores Data & Hora Um exemplo de seletor de data & hora nativo com `type="datetime-local"`. {{"demo": "pages/components/pickers/DateAndTimePickers.js"}} -### Time picker +### Seletor de hora Um exemplo de seletor de hora nativo com `type="time"`. diff --git a/docs/src/pages/components/pickers/pickers-zh.md b/docs/src/pages/components/pickers/pickers-zh.md index dbf11213d1f406..b17f97e01df1d7 100644 --- a/docs/src/pages/components/pickers/pickers-zh.md +++ b/docs/src/pages/components/pickers/pickers-zh.md @@ -24,19 +24,19 @@ packageName: '@material-ui/lab' ⚠️ 浏览器支持的原生输入控件[并不是完美的](https://caniuse.com/#feat=input-datetime)。 -### Date picker +### 日期选择器 示例展示了当 `type="date"` 时的原生的日期选择器 。 {{"demo": "pages/components/pickers/DatePickers.js"}} -### Date & Time picker +### 日期和时间选择器 这个例子通过 `type="datetime-local"` 实现了原生的日期和时间选择器。 {{"demo": "pages/components/pickers/DateAndTimePickers.js"}} -### Time picker +### 时间选择器 这个例子通过 `type="time"` 实现了原生的时间选择器。 diff --git a/docs/src/pages/components/popover/popover-de.md b/docs/src/pages/components/popover/popover-de.md index 8ecab8184e2908..5c420112515d5b 100644 --- a/docs/src/pages/components/popover/popover-de.md +++ b/docs/src/pages/components/popover/popover-de.md @@ -1,5 +1,5 @@ --- -title: React Popover component +title: React Popover Komponenten components: Grow, Popover githubLabel: 'component: Popover' --- @@ -15,9 +15,9 @@ Wissenswertes zur Verwendung der Komponente `Popover`: Die Style-Funktion der [Palette](/system/palette/). -## Einfaches Popover +## Basic Popover -{{"demo": "pages/components/popover/SimplePopover.js" }} +{{"demo": "pages/components/popover/BasicPopover.js" }} ## Anker Spielplatz @@ -27,13 +27,13 @@ Verwenden Sie die Optionsfelder, um die Positionen des `AnkerOrigin` und des `Tr ## Maus Interaktionen -This demonstrates how to use the `Popover` component to implement a popover behavior based on the mouse over event. +This demo demonstrates how to use the `Popover` component and the mouseover event to achieve popover behavior. {{"demo": "pages/components/popover/MouseOverPopover.js"}} ## Ergänzende Projekte -Für fortgeschrittenere Anwendungsfälle können Ihnen folgende Projekte helfen: +For more advanced use cases, you might be able to take advantage of: ### PopupState-Helfer diff --git a/docs/src/pages/components/popover/popover-es.md b/docs/src/pages/components/popover/popover-es.md index 172a9e6c169ee5..d201ce08bd6ab5 100644 --- a/docs/src/pages/components/popover/popover-es.md +++ b/docs/src/pages/components/popover/popover-es.md @@ -15,9 +15,9 @@ Things to know when using the `Popover` component: [La función de estilo de la paleta](/system/palette/). -## Simple Popover +## Basic Popover -{{"demo": "pages/components/popover/SimplePopover.js" }} +{{"demo": "pages/components/popover/BasicPopover.js" }} ## Anchor playground @@ -27,13 +27,13 @@ Use the radio buttons to adjust the `anchorOrigin` and `transformOrigin` positio ## Mouse over interaction -This demonstrates how to use the `Popover` component to implement a popover behavior based on the mouse over event. +This demo demonstrates how to use the `Popover` component and the mouseover event to achieve popover behavior. {{"demo": "pages/components/popover/MouseOverPopover.js"}} ## Proyectos relacionados -Para usos más avanzados tal vez puedas aprovercharte de: +For more advanced use cases, you might be able to take advantage of: ### Ayudante PopupState diff --git a/docs/src/pages/components/popover/popover-fr.md b/docs/src/pages/components/popover/popover-fr.md index 994457ad34d731..32bb309ae55704 100644 --- a/docs/src/pages/components/popover/popover-fr.md +++ b/docs/src/pages/components/popover/popover-fr.md @@ -1,5 +1,5 @@ --- -title: React Popover component +title: Composant React Popover components: Grow, Popover githubLabel: 'component: Popover' --- diff --git a/docs/src/pages/components/popover/popover-ja.md b/docs/src/pages/components/popover/popover-ja.md index 9caa56d8191b96..9f7390c694e877 100644 --- a/docs/src/pages/components/popover/popover-ja.md +++ b/docs/src/pages/components/popover/popover-ja.md @@ -1,5 +1,5 @@ --- -title: React Popover component +title: React Popoverコンポーネント components: Grow, Popover githubLabel: 'component: Popover' --- @@ -15,9 +15,9 @@ githubLabel: 'component: Popover' [The palette](/system/palette/) style関数。 -## Simple Popover +## Basic Popover -{{"demo": "pages/components/popover/SimplePopover.js" }} +{{"demo": "pages/components/popover/BasicPopover.js" }} ## Anchor playground @@ -27,13 +27,13 @@ githubLabel: 'component: Popover' ## マウスオーバー操作 -This demonstrates how to use the `Popover` component to implement a popover behavior based on the mouse over event. +This demo demonstrates how to use the `Popover` component and the mouseover event to achieve popover behavior. {{"demo": "pages/components/popover/MouseOverPopover.js"}} ## 補完プロジェクト -より高度な使用例では、以下を利用できます。 +For more advanced use cases, you might be able to take advantage of: ### PopupState helper diff --git a/docs/src/pages/components/popover/popover-pt.md b/docs/src/pages/components/popover/popover-pt.md index b0b63aecc531eb..38b3cf20610aef 100644 --- a/docs/src/pages/components/popover/popover-pt.md +++ b/docs/src/pages/components/popover/popover-pt.md @@ -15,9 +15,9 @@ Coisas para saber ao usar o componente `Popover`: [A paleta](/system/palette/) com funções de estilo. -## Popover Simples +## Basic Popover -{{"demo": "pages/components/popover/SimplePopover.js" }} +{{"demo": "pages/components/popover/BasicPopover.js" }} ## Âncora - Exemplo interativo @@ -27,13 +27,13 @@ Use os botões de opção para ajustar as posições `anchorOrigin` e `transform ## Interação mouse em cima -Este exemplo demonstra como usar o componente `Popover` para implementar um comportamento popover baseado no evento mouse over. +This demo demonstrates how to use the `Popover` component and the mouseover event to achieve popover behavior. {{"demo": "pages/components/popover/MouseOverPopover.js"}} ## Projetos Complementares -Para situações de uso mais avançadas, você pode tirar proveito com: +For more advanced use cases, you might be able to take advantage of: ### PopupState helper diff --git a/docs/src/pages/components/popover/popover-ru.md b/docs/src/pages/components/popover/popover-ru.md index 15e9480a313c19..ed2f83896c95b0 100644 --- a/docs/src/pages/components/popover/popover-ru.md +++ b/docs/src/pages/components/popover/popover-ru.md @@ -15,9 +15,9 @@ Things to know when using the `Popover` component: {{"component": "modules/components/ComponentLinkHeader.js", "design": false}} -## Simple Popover +## Basic Popover -{{"demo": "pages/components/popover/SimplePopover.js" }} +{{"demo": "pages/components/popover/BasicPopover.js" }} ## Anchor playground @@ -27,13 +27,13 @@ Use the radio buttons to adjust the `anchorOrigin` and `transformOrigin` positio ## Mouse over interaction -This demonstrates how to use the `Popover` component to implement a popover behavior based on the mouse over event. +This demo demonstrates how to use the `Popover` component and the mouseover event to achieve popover behavior. {{"demo": "pages/components/popover/MouseOverPopover.js"}} ## Дополнительные проекты -Для более сложных вариантов использования вы можете воспользоваться: +For more advanced use cases, you might be able to take advantage of: ### PopupState helper diff --git a/docs/src/pages/components/popover/popover-zh.md b/docs/src/pages/components/popover/popover-zh.md index c559ac25dd0f4e..8c034a0afa601d 100644 --- a/docs/src/pages/components/popover/popover-zh.md +++ b/docs/src/pages/components/popover/popover-zh.md @@ -15,9 +15,9 @@ githubLabel: 'component: Popover' {{"component": "modules/components/ComponentLinkHeader.js", "design": false}} -## 简单的弹出框 +## Basic Popover -{{"demo": "pages/components/popover/SimplePopover.js" }} +{{"demo": "pages/components/popover/BasicPopover.js" }} ## 锚点(Anchor)测试 @@ -27,13 +27,13 @@ githubLabel: 'component: Popover' ## 鼠标悬停的交互事件 -这表明如何使用 `Popover` 组件,并展示了使用鼠标事件来实现弹出窗口的效果。 +This demo demonstrates how to use the `Popover` component and the mouseover event to achieve popover behavior. {{"demo": "pages/components/popover/MouseOverPopover.js"}} ## 补充项目 -对于更高级的用例,您可以利用: +For more advanced use cases, you might be able to take advantage of: ### PopupState helper diff --git a/docs/src/pages/components/popper/popper-fr.md b/docs/src/pages/components/popper/popper-fr.md index 600e8d4d7c3a14..715cc11b4238e0 100644 --- a/docs/src/pages/components/popper/popper-fr.md +++ b/docs/src/pages/components/popper/popper-fr.md @@ -1,5 +1,5 @@ --- -title: React Popper component +title: Composant React Popper components: Popper githubLabel: 'component: Popper' --- @@ -10,7 +10,7 @@ githubLabel: 'component: Popper' Some important features of the `Popper` component: -- 🕷 Popper relies on the 3rd party library ([Popper.js](https://github.com/popperjs/popper-core)) for perfect positioning. +- 🕷 Popper s'appuie sur la bibliothèque tierce ([Popper.js](https://github.com/popperjs/popper-core)) pour un positionnement parfait. - 💄 It's an alternative API to react-popper. It aims for simplicity. - 📦 [8 kB gzippé](/size-snapshot). - The children is [`Portal`](/components/portal/) to the body of the document to avoid rendering problems. You can disable this behavior with `disablePortal`. @@ -40,7 +40,7 @@ Alternativement, vous pouvez utiliser [react-spring](https://github.com/react-sp {{"demo": "pages/components/popper/SpringPopper.js"}} -## Positioned popper +## Popper positionné {{"demo": "pages/components/popper/PositionedPopper.js"}} @@ -48,9 +48,9 @@ Alternativement, vous pouvez utiliser [react-spring](https://github.com/react-sp {{"demo": "pages/components/popper/ScrollPlayground.js", "hideToolbar": true, "bg": true}} -## Virtual element +## Élément virtuel -The `anchorEl` property can be a reference to a fake DOM element. You need to create an object shaped like the [`VirtualElement`](https://popper.js.org/docs/v2/virtual-elements/). +La valeur de la propriété `anchorEl` peut être une référence à un élément DOM faux. Vous devez créer un objet formé comme le [`VirtualElement`](https://popper.js.org/docs/v2/virtual-elements/). Highlight part of the text to see the popper: diff --git a/docs/src/pages/components/popper/popper-ja.md b/docs/src/pages/components/popper/popper-ja.md index 15339662c3418a..872778061e87a8 100644 --- a/docs/src/pages/components/popper/popper-ja.md +++ b/docs/src/pages/components/popper/popper-ja.md @@ -1,26 +1,26 @@ --- -title: React Popper component +title: React Popperコンポーネント components: Popper githubLabel: 'component: Popper' --- # Popper -<p class="description">Popperを使用すると、一部のコンテンツを別のコンテンツの上に表示できます。 これは、react-popperの代替です。 これは、react-popperの代替API です。 シンプルさを目指しています。</p> +<p class="description">Popperを使用すると、一部のコンテンツを別のコンテンツの上に表示できます。 これは、react-popperの代替です。</p> `Popper` コンポーネントのいくつかの重要な機能: -- Popperは、サードパーティのライブラリ([Popper.js](https://github.com/popperjs/popper-core))を使用して、最適な配置を行います。 -- これは、react-popperの代替API です。 シンプルさを目指しています。 シンプルさを目指しています。 シンプルさを目指しています。 シンプルさを目指しています。 -- 📦 [8 kB gzipped](/size-snapshot). +- Popperは、サードパーティのライブラリ([Popper.js](https://github.com/popperjs/popper-core))を使います。 +- これは、react-popperの代替API です。 シンプルさを目指しています。 +- 📦 [gzip形式のファイル(8 kB)](/size-snapshot). - レンダリングの問題を回避するため、子はドキュメントの本文に対して [`Portal`](/components/portal/)となります。 `disablePortal`この動作を無効にできます。 `disablePortal`この動作を無効にできます。 `disablePortal`この動作を無効にできます。 `disablePortal`この動作を無効にできます。 `disablePortal`この動作を無効にできます。 `disablePortal`この動作を無効にできます。 -- スクロールは、 [`Popover`](/components/popover/)コンポーネントのようにブロックされません。 ポッパーの配置は、ビューポートの利用可能な領域で更新されます。 ポッパーの配置は、ビューポートの利用可能な領域で更新されます。 -- クリックしても `Popper` コンポーネントは非表示になりません。 クリックしても `Popper` コンポーネントは非表示になりません。 この動作が必要な場合は、 [`ClickAwayListener`](/components/click-away-listener/) 使用することができます - [メニュードキュメンテーションセクション](/components/menus/#menulist-composition)例を参照してください。 クリックしても `Popper` コンポーネントは非表示になりません。 この動作が必要な場合は、 [`ClickAwayListener`](/components/click-away-listener/) 使用することができます - [メニュードキュメンテーションセクション](/components/menus/#menulist-composition)例を参照してください。 クリックしても `Popper` コンポーネントは非表示になりません。 この動作が必要な場合は、 [`ClickAwayListener`](/components/click-away-listener/) 使用することができます - [メニュードキュメンテーションセクション](/components/menus/#menulist-composition)例を参照してください。 クリックしても `Popper` コンポーネントは非表示になりません。 この動作が必要な場合は、 [`ClickAwayListener`](/components/click-away-listener/) 使用することができます - [メニュードキュメンテーションセクション](/components/menus/#menulist-composition)例を参照してください。 クリックしても `Popper` コンポーネントは非表示になりません。 この動作が必要な場合は、 [`ClickAwayListener`](/components/click-away-listener/) 使用することができます - [メニュードキュメンテーションセクション](/components/menus/#menulist-composition)例を参照してください。 +- スクロールは、 [`Popover`](/components/popover/)コンポーネントのようにブロックされません。 ポッパーの配置は、ビューポートの利用可能な領域で更新されます。 +- クリックしても `Popper` コンポーネントは非表示になりません。 クリックしても `Popper` コンポーネントは非表示になりません。 この動作が必要な場合は、 [`ClickAwayListener`](/components/click-away-listener/) 使用することができます - [メニュードキュメンテーションセクション](/components/menus/#menulist-composition)例を参照してください。 クリックしても `Popper` コンポーネントは非表示になりません。 この動作が必要な場合は、 [`ClickAwayListener`](/components/click-away-listener/) 使用することができます - [メニュードキュメンテーションセクション](/components/menus/#menulist-composition)例を参照してください。 クリックしても `Popper` コンポーネントは非表示になりません。 この動作が必要な場合は、 [`ClickAwayListener`](/components/click-away-listener/) 使用することができます - [メニュードキュメンテーションセクション](/components/menus/#menulist-composition)例を参照してください。 クリックしても `Popper` コンポーネントは非表示になりません。 この動作が必要な場合は、 [`ClickAwayListener`](/components/click-away-listener/) 使用することができます - [メニュードキュメンテーションセクション](/components/menus/#menulist-composition)例を参照してください。 この動作が必要な場合は、 [`ClickAwayListener`](/components/click-away-listener/) 使用することができます - [メニュードキュメンテーションセクション](/components/menus/#menulist-composition)例を参照してください。 - `anchorEl` は、新しい `Popper.js` インスタンスを作成するための参照オブジェクトとして渡されます。 [The palette](/system/palette/) style関数。 -## シンプルポッパー +## 基本のPopper {{"demo": "pages/components/popper/SimplePopper.js"}} @@ -30,7 +30,7 @@ The open/close state of the popper can be animated with a render prop child and - Be a direct child descendent of the popper. - Call the `onEnter` callback prop when the enter transition starts. -- Call the `onExited` callback prop when the exit transition is completed. Call the `onExited` callback prop when the exit transition is completed. +- Call the `onExited` callback prop when the exit transition is completed. These two callbacks allow the popper to unmount the child content when closed and fully transitioned. Popper has built-in support for [react-transition-group](https://github.com/reactjs/react-transition-group). @@ -40,7 +40,7 @@ Alternatively, you can use [react-spring](https://github.com/react-spring/react- {{"demo": "pages/components/popper/SpringPopper.js"}} -## Positioned popper +## 定位置に表示されるPopper {{"demo": "pages/components/popper/PositionedPopper.js"}} @@ -48,9 +48,9 @@ Alternatively, you can use [react-spring](https://github.com/react-spring/react- {{"demo": "pages/components/popper/ScrollPlayground.js", "hideToolbar": true, "bg": true}} -## Virtual element +## 仮想Element -`anchorEl` プロパティは、偽のDOM要素への参照することができます。 You need to create an object shaped like the [`VirtualElement`](https://popper.js.org/docs/v2/virtual-elements/). +`anchorEl` プロパティは、仮想のDOM要素を参照することができます。 [`VirtualElement`](https://popper.js.org/docs/v2/virtual-elements/)のようなオブジェクトを作成する必要があります。 テキストの一部をハイライトして、ポップヒントを表示します。 diff --git a/docs/src/pages/components/portal/portal-de.md b/docs/src/pages/components/portal/portal-de.md index 3fabeccd9a6498..0dc936a2a37874 100644 --- a/docs/src/pages/components/portal/portal-de.md +++ b/docs/src/pages/components/portal/portal-de.md @@ -8,8 +8,6 @@ githubLabel: 'component: Portal' <p class="description">The portal component renders its children into a new "subtree" outside of current DOM hierarchy.</p> -- 📦 [1.3 kB gzipped](/size-snapshot) - Die untergeordneten Elemente der Portalkomponente werden an den angegebenen `Container` angehängt. Die Komponente wird intern von den Komponenten [`Modal`](/components/modal/) und [`Popper`](/components/popper/) benutzt. Die Style-Funktion der [Palette](/system/palette/). @@ -21,3 +19,13 @@ Die Style-Funktion der [Palette](/system/palette/). ## Server-side React [doesn't support](https://github.com/facebook/react/issues/13097) the [`createPortal()`](https://reactjs.org/docs/portals.html) API on the server. You have to wait for the client-side hydration to see the children. + +## Unstyled + +- 📦 [970 B gzipped](https://bundlephobia.com/result?p=@material-ui/unstyled@next) + +As the component does not have any styles, it also comes with the unstyled package. + +```js +import Portal from '@material-ui/unstyled/Portal'; +``` diff --git a/docs/src/pages/components/portal/portal-es.md b/docs/src/pages/components/portal/portal-es.md index f48648ddc9f611..adde351d447a12 100644 --- a/docs/src/pages/components/portal/portal-es.md +++ b/docs/src/pages/components/portal/portal-es.md @@ -8,8 +8,6 @@ githubLabel: 'component: Portal' <p class="description">El componente portal renderiza sus hijos en un nuevo "subárbol" fuera de la jerarquía actual de DOM.</p> -- 📦 [1.3 kB comprimido](/size-snapshot) - Los hijos del componente portal se añadirán al `container` especificado. El componente es utilizado internamente por los componentes [`Modal`](/components/modal/) y [`Popper`](/components/popper/). [La función de estilo de la paleta](/system/palette/). @@ -21,3 +19,13 @@ Los hijos del componente portal se añadirán al `container` especificado. El co ## Lado del servidor React [doesn't support](https://github.com/facebook/react/issues/13097) the [`createPortal()`](https://reactjs.org/docs/portals.html) API on the server. Hay que esperar a que la hidratación del lado del cliente vea a los children. + +## Unstyled + +- 📦 [970 B gzipped](https://bundlephobia.com/result?p=@material-ui/unstyled@next) + +As the component does not have any styles, it also comes with the unstyled package. + +```js +import Portal from '@material-ui/unstyled/Portal'; +``` diff --git a/docs/src/pages/components/portal/portal-fr.md b/docs/src/pages/components/portal/portal-fr.md index ea5fd97d669407..9a840834e9ca4f 100644 --- a/docs/src/pages/components/portal/portal-fr.md +++ b/docs/src/pages/components/portal/portal-fr.md @@ -1,5 +1,5 @@ --- -title: React Portal component +title: Composant React Portal components: Portal githubLabel: 'component: Portal' --- @@ -8,8 +8,6 @@ githubLabel: 'component: Portal' <p class="description">The portal component renders its children into a new "subtree" outside of current DOM hierarchy.</p> -- 📦 [1.3 kB gzippé](/size-snapshot) - Les enfants du composant Portal seront ajoutés au `container` fournit. Ce composant est utilisé en interne par les composants [`Modal`](/components/modal/) et [`Popper`](/components/popper/). {{"component": "modules/components/ComponentLinkHeader.js", "design": false}} @@ -20,4 +18,14 @@ Les enfants du composant Portal seront ajoutés au `container` fournit. Ce compo ## Server-side -React [doesn't support](https://github.com/facebook/react/issues/13097) the [`createPortal()`](https://reactjs.org/docs/portals.html) API on the server. You have to wait for the client-side hydration to see the children. +React [doesn't support](https://github.com/facebook/react/issues/13097) the [`createPortal()`](https://reactjs.org/docs/portals.html) API on the server. Il faut attendre l'hydratation côté client pour voir les enfants. + +## Unstyled + +- 📦 [1.3 kB gzippé](/size-snapshot) + +As the component does not have any styles, it also comes with the unstyled package. + +```js +import Portal from '@material-ui/unstyled/Portal'; +``` diff --git a/docs/src/pages/components/portal/portal-ja.md b/docs/src/pages/components/portal/portal-ja.md index 2bbc6450dfe410..dcaad26abb20a2 100644 --- a/docs/src/pages/components/portal/portal-ja.md +++ b/docs/src/pages/components/portal/portal-ja.md @@ -1,5 +1,5 @@ --- -title: React Portal component +title: React Portalコンポーネント components: Portal githubLabel: 'component: Portal' --- @@ -8,9 +8,7 @@ githubLabel: 'component: Portal' <p class="description">The portal component renders its children into a new "subtree" outside of current DOM hierarchy.</p> -- 📦 [1.3 kB gzipped](/size-snapshot) - -ポータルコンポーネントの子は、指定された `コンテナ` 追加されます。 ポータルコンポーネントの子は、指定された `コンテナ` 追加されます。 コンポーネントは、 [`Modal`](/components/modal/) および [`Popper`](/components/popper/) コンポーネントによって内部的に使用されます。 ポータルコンポーネントの子は、指定された `コンテナ` 追加されます。 コンポーネントは、 [`Modal`](/components/modal/) および [`Popper`](/components/popper/) コンポーネントによって内部的に使用されます。 ポータルコンポーネントの子は、指定された `コンテナ` 追加されます。 コンポーネントは、 [`Modal`](/components/modal/) および [`Popper`](/components/popper/) コンポーネントによって内部的に使用されます。 +ポータルコンポーネントの子は、指定された `container` 追加されます。 コンポーネントは、 [`Modal`](/components/modal/) および [`Popper`](/components/popper/) コンポーネントによって内部的に使用されます。 [The palette](/system/palette/) style関数。 @@ -20,4 +18,14 @@ githubLabel: 'component: Portal' ## Server-side -React は、サーバー上の [`createPortal()`](https://reactjs.org/docs/portals.html) APIを[サポートしません。](https://github.com/facebook/react/issues/13097) In order to display the modal, you need to disable the portal feature with the `disablePortal` prop: In order to display the modal, you need to disable the portal feature with the `disablePortal` prop: In order to display the modal, you need to disable the portal feature with the `disablePortal` prop: In order to display the modal, you need to disable the portal feature with the `disablePortal` prop: In order to display the modal, you need to disable the portal feature with the `disablePortal` prop: </a> 子要素を見るために、クライアントのハイドレーションを待つ必要があります。 +React は、サーバー上の [`createPortal()`](https://reactjs.org/docs/portals.html) APIを[サポートしません。](https://github.com/facebook/react/issues/13097) In order to display the modal, you need to disable the portal feature with the `disablePortal` prop: In order to display the modal, you need to disable the portal feature with the `disablePortal` prop: In order to display the modal, you need to disable the portal feature with the `disablePortal` prop: In order to display the modal, you need to disable the portal feature with the `disablePortal` prop: In order to display the modal, you need to disable the portal feature with the `disablePortal` prop: 子要素を見るには、クライアント側のhydrationを待つ必要があります。 + +## Unstyled + +- 📦 [970 B gzipped](https://bundlephobia.com/result?p=@material-ui/unstyled@next) + +As the component does not have any styles, it also comes with the unstyled package. + +```js +import Portal from '@material-ui/unstyled/Portal'; +``` diff --git a/docs/src/pages/components/portal/portal-pt.md b/docs/src/pages/components/portal/portal-pt.md index 4f1da942ecc8a0..ab92affe6cee76 100644 --- a/docs/src/pages/components/portal/portal-pt.md +++ b/docs/src/pages/components/portal/portal-pt.md @@ -8,8 +8,6 @@ githubLabel: 'component: Portal' <p class="description">O componente portal renderiza seus elementos filho em uma nova "subárvore" fora da hierarquia do DOM atual.</p> -- 📦 [1.3 kB gzipped](/size-snapshot) - O filho do componente portal será adicionado ao `container` especificado. O componente é usado internamente pelos componentes [`Modal`](/components/modal/) e [`Popper`](/components/popper/). [A paleta](/system/palette/) com funções de estilo. @@ -21,3 +19,13 @@ O filho do componente portal será adicionado ao `container` especificado. O com ## Do lado do servidor React [não suporta](https://github.com/facebook/react/issues/13097) a API [`createPortal()`](https://pt-br.reactjs.org/docs/portals.html) no servidor. Você deve esperar pelo lado do cliente fazer a hidratação para ver o filho. + +## Unstyled + +- 📦 [970 B gzipped](https://bundlephobia.com/result?p=@material-ui/unstyled@next) + +As the component does not have any styles, it also comes with the unstyled package. + +```js +import Portal from '@material-ui/unstyled/Portal'; +``` diff --git a/docs/src/pages/components/portal/portal-ru.md b/docs/src/pages/components/portal/portal-ru.md index 2aa93a0c0a9e4d..3d2d90ec56f083 100644 --- a/docs/src/pages/components/portal/portal-ru.md +++ b/docs/src/pages/components/portal/portal-ru.md @@ -8,8 +8,6 @@ githubLabel: 'component: Portal' <p class="description">The portal component renders its children into a new "subtree" outside of current DOM hierarchy.</p> -- 📦 [1.3 kB gzipped](/size-snapshot) - Дочерние элементы портала будут добавлены внутрь элемента, указанного в свойстве `container`. Портал используется внутри компонентов [`Modal`](/components/modal/) и [`Popper`](/components/popper/). {{"component": "modules/components/ComponentLinkHeader.js", "design": false}} @@ -21,3 +19,13 @@ githubLabel: 'component: Portal' ## Server-side React [doesn't support](https://github.com/facebook/react/issues/13097) the [`createPortal()`](https://reactjs.org/docs/portals.html) API on the server. You have to wait for the client-side hydration to see the children. + +## Unstyled + +- 📦 [970 B gzipped](https://bundlephobia.com/result?p=@material-ui/unstyled@next) + +As the component does not have any styles, it also comes with the unstyled package. + +```js +import Portal from '@material-ui/unstyled/Portal'; +``` diff --git a/docs/src/pages/components/portal/portal-zh.md b/docs/src/pages/components/portal/portal-zh.md index 8e9640ec16868f..51c44713501ed8 100644 --- a/docs/src/pages/components/portal/portal-zh.md +++ b/docs/src/pages/components/portal/portal-zh.md @@ -8,8 +8,6 @@ githubLabel: 'component: Portal' <p class="description">传送门组件将其子节点渲染到当前 DOM 结构之外的新 "子类树" 当中。</p> -- 📦 [1.3kB 已压缩的包](/size-snapshot) - 传送门组件的子节点将被添加到指定的 `container` 中。 [`Modal`](/components/modal/) 和 [`Popper`](/components/popper/) 组件内部都是用了该组件。 {{"component": "modules/components/ComponentLinkHeader.js", "design": false}} @@ -21,3 +19,13 @@ githubLabel: 'component: Portal' ## 服务器端 React [不支持](https://github.com/facebook/react/issues/13097)服务端渲染的 [`createPortal()`](https://reactjs.org/docs/portals.html) API。 您必须等到客户端的注水渲染(hydration)之后才能见到子节点。 + +## Unstyled + +- 📦 [970 B gzipped](https://bundlephobia.com/result?p=@material-ui/unstyled@next) + +As the component does not have any styles, it also comes with the unstyled package. + +```js +import Portal from '@material-ui/unstyled/Portal'; +``` diff --git a/docs/src/pages/components/progress/CircularColor.js b/docs/src/pages/components/progress/CircularColor.js index 3f33b7d4a1efbc..855deb343c0fb4 100644 --- a/docs/src/pages/components/progress/CircularColor.js +++ b/docs/src/pages/components/progress/CircularColor.js @@ -4,8 +4,9 @@ import CircularProgress from '@material-ui/core/CircularProgress'; export default function CircularColor() { return ( - <Stack sx={{ color: 'warning.main' }} spacing={2} direction="row"> + <Stack sx={{ color: 'grey.500' }} spacing={2} direction="row"> <CircularProgress color="secondary" /> + <CircularProgress color="success" /> <CircularProgress color="inherit" /> </Stack> ); diff --git a/docs/src/pages/components/progress/CircularColor.tsx b/docs/src/pages/components/progress/CircularColor.tsx index 3f33b7d4a1efbc..855deb343c0fb4 100644 --- a/docs/src/pages/components/progress/CircularColor.tsx +++ b/docs/src/pages/components/progress/CircularColor.tsx @@ -4,8 +4,9 @@ import CircularProgress from '@material-ui/core/CircularProgress'; export default function CircularColor() { return ( - <Stack sx={{ color: 'warning.main' }} spacing={2} direction="row"> + <Stack sx={{ color: 'grey.500' }} spacing={2} direction="row"> <CircularProgress color="secondary" /> + <CircularProgress color="success" /> <CircularProgress color="inherit" /> </Stack> ); diff --git a/docs/src/pages/components/progress/LinearColor.js b/docs/src/pages/components/progress/LinearColor.js index a1a228a3c0aa44..cdae0b6b390e79 100644 --- a/docs/src/pages/components/progress/LinearColor.js +++ b/docs/src/pages/components/progress/LinearColor.js @@ -4,8 +4,9 @@ import LinearProgress from '@material-ui/core/LinearProgress'; export default function LinearColor() { return ( - <Stack sx={{ width: '100%', color: 'warning.main' }} spacing={2}> + <Stack sx={{ width: '100%', color: 'grey.500' }} spacing={2}> <LinearProgress color="secondary" /> + <LinearProgress color="success" /> <LinearProgress color="inherit" /> </Stack> ); diff --git a/docs/src/pages/components/progress/LinearColor.tsx b/docs/src/pages/components/progress/LinearColor.tsx index a1a228a3c0aa44..cdae0b6b390e79 100644 --- a/docs/src/pages/components/progress/LinearColor.tsx +++ b/docs/src/pages/components/progress/LinearColor.tsx @@ -4,8 +4,9 @@ import LinearProgress from '@material-ui/core/LinearProgress'; export default function LinearColor() { return ( - <Stack sx={{ width: '100%', color: 'warning.main' }} spacing={2}> + <Stack sx={{ width: '100%', color: 'grey.500' }} spacing={2}> <LinearProgress color="secondary" /> + <LinearProgress color="success" /> <LinearProgress color="inherit" /> </Stack> ); diff --git a/docs/src/pages/components/progress/progress-de.md b/docs/src/pages/components/progress/progress-de.md index d94a18d8d544da..bf0031d827dacf 100644 --- a/docs/src/pages/components/progress/progress-de.md +++ b/docs/src/pages/components/progress/progress-de.md @@ -24,6 +24,10 @@ materialDesign: https://material.io/components/progress-indicators {{"demo": "pages/components/progress/CircularIndeterminate.js"}} +### Circular color + +{{"demo": "pages/components/progress/CircularColor.js"}} + ### Circular determinate {{"demo": "pages/components/progress/CircularDeterminate.js"}} @@ -42,6 +46,10 @@ materialDesign: https://material.io/components/progress-indicators {{"demo": "pages/components/progress/LinearIndeterminate.js"}} +### Linear color + +{{"demo": "pages/components/progress/LinearColor.js"}} + ### Linear determinate {{"demo": "pages/components/progress/LinearDeterminate.js"}} @@ -111,9 +119,9 @@ If you need to perform 30 re-renders per second or more, we recommend disabling } ``` -### IE11 +### IE 11 -The circular progress component animation on IE11 is degraded. The stroke dash animation is not working (equivalent to `disableShrink`) and the circular animation wobbles. You can solve the latter with: +The circular progress component animation on IE 11 is degraded. The stroke dash animation is not working (equivalent to `disableShrink`) and the circular animation wobbles. You can solve the latter with: ```css .MuiCircularProgress-indeterminate { diff --git a/docs/src/pages/components/progress/progress-es.md b/docs/src/pages/components/progress/progress-es.md index ef3e58d79dba63..1761c807f01125 100644 --- a/docs/src/pages/components/progress/progress-es.md +++ b/docs/src/pages/components/progress/progress-es.md @@ -24,6 +24,10 @@ Los indicadores **determinados** muestran cuánto durará una operación. {{"demo": "pages/components/progress/CircularIndeterminate.js"}} +### Circular color + +{{"demo": "pages/components/progress/CircularColor.js"}} + ### Circular determinate {{"demo": "pages/components/progress/CircularDeterminate.js"}} @@ -42,6 +46,10 @@ Los indicadores **determinados** muestran cuánto durará una operación. {{"demo": "pages/components/progress/LinearIndeterminate.js"}} +### Linear color + +{{"demo": "pages/components/progress/LinearColor.js"}} + ### Linear determinate {{"demo": "pages/components/progress/LinearDeterminate.js"}} @@ -111,9 +119,9 @@ If you need to perform 30 re-renders per second or more, we recommend disabling } ``` -### IE11 +### IE 11 -The circular progress component animation on IE11 is degraded. The stroke dash animation is not working (equivalent to `disableShrink`) and the circular animation wobbles. You can solve the latter with: +The circular progress component animation on IE 11 is degraded. The stroke dash animation is not working (equivalent to `disableShrink`) and the circular animation wobbles. You can solve the latter with: ```css .MuiCircularProgress-indeterminate { diff --git a/docs/src/pages/components/progress/progress-fr.md b/docs/src/pages/components/progress/progress-fr.md index e72736c1e69a16..58dd2928dbadff 100644 --- a/docs/src/pages/components/progress/progress-fr.md +++ b/docs/src/pages/components/progress/progress-fr.md @@ -11,20 +11,24 @@ materialDesign: '<a href="https://material.io/design/components/progress-indicat Les [Indicateurs de progression](https://material.io/design/components/progress-indicators.html) informent les utilisateurs de l'état des processus en cours, tels que le chargement d'une application, la soumission d'un formulaire ou la progression des mises à jour. -- **Determinate** circular indicators fill the invisible, circular track with color, as the indicator moves from 0 to 360 degrees. +- Les indicateurs **déterminés** indiquent la durée d'une opération. - **Indeterminate** circular indicators grow and shrink in size while moving along the invisible track. -Les indicateurs **déterminés** indiquent la durée d'une opération. +Les animations des composants s'appuient sur CSS autant que possible pour fonctionner avant même que le JavaScript soit chargé. {{"component": "modules/components/ComponentLinkHeader.js"}} ## Circular -### Circular indeterminate +### Circulaire indéterminée {{"demo": "pages/components/progress/CircularIndeterminate.js"}} -### Circular determinate +### Circular color + +{{"demo": "pages/components/progress/CircularColor.js"}} + +### Circulaire déterminée {{"demo": "pages/components/progress/CircularDeterminate.js"}} @@ -36,13 +40,17 @@ Les indicateurs **déterminés** indiquent la durée d'une opération. {{"demo": "pages/components/progress/CircularWithValueLabel.js"}} -## Linear +## Barre de progression linéaire -### Linear indeterminate +### Linéaire indéterminée {{"demo": "pages/components/progress/LinearIndeterminate.js"}} -### Linear determinate +### Linear color + +{{"demo": "pages/components/progress/LinearColor.js"}} + +### Linéaire déterminée {{"demo": "pages/components/progress/LinearDeterminate.js"}} @@ -75,7 +83,7 @@ function Progress(props) { } ``` -## Customized progress +## Barres de progression personnalisée Here are some examples of customizing the component. Vous pouvez en savoir plus dans la [page de documentation des overrides](/customization/how-to-customize/). @@ -89,7 +97,7 @@ Il y a [3 limites importantes](https://www.nngroup.com/articles/response-times-3 ## Limites -### High CPU load +### Charge CPU élevée Under heavy load, you might lose the stroke dash animation or see random CircularProgress ring widths. You should run processor intensive operations in a web worker or by batch in order not to block the main rendering thread. @@ -99,11 +107,11 @@ When it's not possible, you can leverage the `disableShrink` property to mitigat {{"demo": "pages/components/progress/CircularUnderLoad.js"}} -### High frequency updates +### Mises à jour haute fréquence -The `LinearProgress` uses a transition on the CSS transform property to provide a smooth update between different values. The default transition duration is 200ms. In the event a parent component updates the `value` prop too quickly, you will at least experience a 200ms delay between the re-render and the progress bar fully updated. +Le `LinearProgress` utilise une transition sur la propriété de transformation CSS pour fournir une mise à jour lisse entre différentes valeurs. La durée de transition par défaut est de 200ms. Dans le cas où le composant parent met à jour la propriété `value` trop rapidement, vous aurez au moins un délai de 200ms entre le rendu (affichage) et la barre de progression complètement mise à jour. -If you need to perform 30 re-renders per second or more, we recommend disabling the transition: +Si vous devez effectuer 30 affichages par seconde ou plus, nous vous recommandons de désactiver la transition : ```css .MuiLinearProgress-bar { @@ -113,7 +121,7 @@ If you need to perform 30 re-renders per second or more, we recommend disabling ### IE11 -The circular progress component animation on IE11 is degraded. The stroke dash animation is not working (equivalent to `disableShrink`) and the circular animation wobbles. You can solve the latter with: +The circular progress component animation on IE11 is degraded. L'animation du tableau de bord des traits ne fonctionne pas (équivalent à `disableShrink`) et à l'animation circulaire. Vous pouvez résoudre ce dernier avec : ```css .MuiCircularProgress-indeterminate { diff --git a/docs/src/pages/components/progress/progress-ja.md b/docs/src/pages/components/progress/progress-ja.md index 90d0f38e696a4e..e6d5c289ceac27 100644 --- a/docs/src/pages/components/progress/progress-ja.md +++ b/docs/src/pages/components/progress/progress-ja.md @@ -9,12 +9,12 @@ materialDesign: https://material.io/components/progress-indicators <p class="description">一般にスピナーと呼ばれる進行状況インジケータは、指定されていない待機時間を表したり、プロセスの長さを表示します。</p> -[進行状況インジケータ](https://material.io/design/components/progress-indicators.html) 、アプリの読み込み、フォームの送信、更新の保存など、進行中のプロセスのステータスについてユーザーに通知します。 +進行状況インジケータは 、アプリの読み込み、フォームの送信、更新の保存など、進行中のプロセスのステータスをユーザーに通知します。 -- **Determinate** 円形インジケーターは、インジケーターが0から360度に移動するときに、見えない円形のトラックを色で塗りつぶします。 +- **Determinate** インジケーターは、操作にかかる時間を表示します。 - **Indeterminate**インジケータは、不特定の待機時間を視覚化します。 -**Determinate** インジケータは、操作にかかる時間を表示します。 +Componentのアニメーションは、JavaScript が読み込まれる前でも可能な限り動作するよう、CSS に依存しています。 {{"component": "modules/components/ComponentLinkHeader.js"}} @@ -24,6 +24,10 @@ materialDesign: https://material.io/components/progress-indicators {{"demo": "pages/components/progress/CircularIndeterminate.js"}} +### Circular color + +{{"demo": "pages/components/progress/CircularColor.js"}} + ### Circular determinate {{"demo": "pages/components/progress/CircularDeterminate.js"}} @@ -42,6 +46,10 @@ materialDesign: https://material.io/components/progress-indicators {{"demo": "pages/components/progress/LinearIndeterminate.js"}} +### Linear color + +{{"demo": "pages/components/progress/LinearColor.js"}} + ### Linear determinate {{"demo": "pages/components/progress/LinearDeterminate.js"}} @@ -59,12 +67,12 @@ materialDesign: https://material.io/components/progress-indicators 進捗コンポーネントは、0〜100の範囲の値を受け入れます。 これにより、これらがデフォルトの最小値/最大値であるスクリーンリーダーユーザーの作業が簡素化されます。 ただし、場合によっては、値がこの範囲外のデータソースを使用している場合があります。 範囲内の値を0〜100のスケールに簡単に変換する方法は次のとおりです。 ```jsx -// MIN = Minimum expected value -// MAX = Maximium expected value -// Function to normalise the values (MIN / MAX could be integrated) +// MIN = 最小値 +// MAX = 最大値 +// 値を正規化する関数(MIN / MAX が積分される) const normalise = value => (value - MIN) * 100 / (MAX - MIN); -// Example component that utilizes the `normalise` function at the point of render. +// レンダリング時に「正規化」関数を使うComponentの例です function Progress(props) { return ( <React.Fragment> @@ -77,7 +85,7 @@ function Progress(props) { ## Customized progress -コンポーネントのカスタマイズの例を次に示します。 詳細については、 [overrides documentation page](/customization/how-to-customize/)を参照してください。 +コンポーネントのカスタマイズの例を次に示します。 詳細については、 [こちら](/customization/how-to-customize/)を参照してください。 {{"demo": "pages/components/progress/CustomizedProgressBars.js", "defaultCodeOpen": false}} @@ -89,17 +97,17 @@ function Progress(props) { ## 制限事項 -### High CPU load +### CPU負荷が高い場合 -負荷が高いと、ストロークダッシュアニメーションが失われるか、ランダムなCircularProgressリング幅が表示される場合があります。 メインレンダリングスレッドをブロックしないように、プロセッサを集中的に使用する操作をWebワーカーで、またはバッチで実行する必要があります。 +負荷が高いと、ストロークダッシュアニメーションが失われるか、ランダムな幅の `CircularProgress`が表示される場合があります。 メインレンダリングスレッドをブロックしないように、プロセッサを集中的に使用する操作をWebワーカーで、またはバッチで実行する必要があります。 ![heavy load](/static/images/progress/heavy-load.gif) -不可能な場合は、 `disableShrink` プロパティを活用して問題を軽減できます。 不可能な場合は、 `disableShrink` プロパティを活用して問題を軽減できます。 [この問題](https://github.com/mui-org/material-ui/issues/10327)参照してください。 不可能な場合は、 `disableShrink` プロパティを活用して問題を軽減できます。 [この問題](https://github.com/mui-org/material-ui/issues/10327)参照してください。 +不可能な場合は、 `disableShrink` プロパティを設定して問題を軽減できます。 [この問題](https://github.com/mui-org/material-ui/issues/10327)参照してください。 {{"demo": "pages/components/progress/CircularUnderLoad.js"}} -### High frequency updates +### 高頻度な更新 The `LinearProgress` uses a transition on the CSS transform property to provide a smooth update between different values. The default transition duration is 200ms. In the event a parent component updates the `value` prop too quickly, you will at least experience a 200ms delay between the re-render and the progress bar fully updated. @@ -111,9 +119,9 @@ If you need to perform 30 re-renders per second or more, we recommend disabling } ``` -### IE11 +### IE 11 -The circular progress component animation on IE11 is degraded. The stroke dash animation is not working (equivalent to `disableShrink`) and the circular animation wobbles. You can solve the latter with: +The circular progress component animation on IE 11 is degraded. The stroke dash animation is not working (equivalent to `disableShrink`) and the circular animation wobbles. You can solve the latter with: ```css .MuiCircularProgress-indeterminate { diff --git a/docs/src/pages/components/progress/progress-pt.md b/docs/src/pages/components/progress/progress-pt.md index ce197fa4bb64fe..8e790f04791bab 100644 --- a/docs/src/pages/components/progress/progress-pt.md +++ b/docs/src/pages/components/progress/progress-pt.md @@ -24,6 +24,10 @@ Indicador **determinado** mostra quanto tempo uma operação vai demorar. {{"demo": "pages/components/progress/CircularIndeterminate.js"}} +### Circular color + +{{"demo": "pages/components/progress/CircularColor.js"}} + ### Circular determinado {{"demo": "pages/components/progress/CircularDeterminate.js"}} @@ -42,6 +46,10 @@ Indicador **determinado** mostra quanto tempo uma operação vai demorar. {{"demo": "pages/components/progress/LinearIndeterminate.js"}} +### Linear color + +{{"demo": "pages/components/progress/LinearColor.js"}} + ### Linear determinado {{"demo": "pages/components/progress/LinearDeterminate.js"}} @@ -109,9 +117,9 @@ Se você precisar executar 30 renderizações por segundo ou mais, recomendamos Indicadores de <a href="https://material.io/design/components/progress-indicators.html#linear-progress-indicators">progresso linear</a>. ``` -### IE11 +### IE 11 -A animação do componente de progresso circular no IE11 é degradada. A animação do traço não está funcionando (equivalente a `disableShrink`) e a animação circular oscila. Você pode resolver o último com: +The circular progress component animation on IE 11 is degraded. A animação do traço não está funcionando (equivalente a `disableShrink`) e a animação circular oscila. Você pode resolver o último com: ```css . MuiCircularProgress-indeterminate { diff --git a/docs/src/pages/components/progress/progress-ru.md b/docs/src/pages/components/progress/progress-ru.md index a4e9d943dc65fe..ac1451b56b73c6 100644 --- a/docs/src/pages/components/progress/progress-ru.md +++ b/docs/src/pages/components/progress/progress-ru.md @@ -24,6 +24,10 @@ materialDesign: https://material.io/components/progress-indicators {{"demo": "pages/components/progress/CircularIndeterminate.js"}} +### Circular color + +{{"demo": "pages/components/progress/CircularColor.js"}} + ### Circular determinate {{"demo": "pages/components/progress/CircularDeterminate.js"}} @@ -42,6 +46,10 @@ materialDesign: https://material.io/components/progress-indicators {{"demo": "pages/components/progress/LinearIndeterminate.js"}} +### Linear color + +{{"demo": "pages/components/progress/LinearColor.js"}} + ### Linear determinate {{"demo": "pages/components/progress/LinearDeterminate.js"}} @@ -77,7 +85,7 @@ function Progress(props) { ## Customized progress -Ниже находятся примеры кастомизации компонента. You can learn more about this in the [overrides documentation page](/customization/how-to-customize/). +Ниже находятся примеры кастомизации компонента. Вы можете узнать об этом больше [в документации по переопределению свойств](/customization/how-to-customize/). {{"demo": "pages/components/progress/CustomizedProgressBars.js", "defaultCodeOpen": false}} @@ -111,9 +119,9 @@ If you need to perform 30 re-renders per second or more, we recommend disabling } ``` -### IE11 +### IE 11 -С анимацией компонента circular progress в IE11 возникают проблемы. Анимация пунктирным контуром не работает (соответсвует `disableShrink`) и круговая анимация идет рывками. Последняя проблема может быть решена: +С анимацией компонента circular progress на IE 11 возникают проблемы. Анимация пунктирным контуром не работает (соответсвует `disableShrink`) и круговая анимация идет рывками. Последняя проблема может быть решена: ```css .MuiCircularProgress-indeterminate { diff --git a/docs/src/pages/components/progress/progress-zh.md b/docs/src/pages/components/progress/progress-zh.md index 53085041203cd5..a018a5b2f268eb 100644 --- a/docs/src/pages/components/progress/progress-zh.md +++ b/docs/src/pages/components/progress/progress-zh.md @@ -24,6 +24,10 @@ materialDesign: https://material.io/components/progress-indicators {{"demo": "pages/components/progress/CircularIndeterminate.js"}} +### Circular color + +{{"demo": "pages/components/progress/CircularColor.js"}} + ### 定量的环形进度条 {{"demo": "pages/components/progress/CircularDeterminate.js"}} @@ -42,6 +46,10 @@ materialDesign: https://material.io/components/progress-indicators {{"demo": "pages/components/progress/LinearIndeterminate.js"}} +### Linear color + +{{"demo": "pages/components/progress/LinearColor.js"}} + ### 定量的线性进度条 {{"demo": "pages/components/progress/LinearDeterminate.js"}} @@ -111,7 +119,7 @@ function Progress(props) { } ``` -### IE11 +### IE 11 IE 11 上的循环进度组件动画会退化。 Stroke dash 动画将不起作用(相当于`disableShrink`),并且 circular 动画将会抖动。 你可以通过以下方式来解决后者: diff --git a/docs/src/pages/components/radio-buttons/ColorRadioButtons.js b/docs/src/pages/components/radio-buttons/ColorRadioButtons.js index 2f753c96e916eb..b0e9caff297142 100644 --- a/docs/src/pages/components/radio-buttons/ColorRadioButtons.js +++ b/docs/src/pages/components/radio-buttons/ColorRadioButtons.js @@ -1,5 +1,5 @@ import * as React from 'react'; -import { green } from '@material-ui/core/colors'; +import { pink } from '@material-ui/core/colors'; import Radio from '@material-ui/core/Radio'; export default function ColorRadioButtons() { @@ -21,13 +21,14 @@ export default function ColorRadioButtons() { <div> <Radio {...controlProps('a')} /> <Radio {...controlProps('b')} color="secondary" /> - <Radio {...controlProps('c')} color="default" /> + <Radio {...controlProps('c')} color="success" /> + <Radio {...controlProps('d')} color="default" /> <Radio - {...controlProps('d')} + {...controlProps('e')} sx={{ - color: green[800], + color: pink[800], '&.Mui-checked': { - color: green[600], + color: pink[600], }, }} /> diff --git a/docs/src/pages/components/radio-buttons/ColorRadioButtons.tsx b/docs/src/pages/components/radio-buttons/ColorRadioButtons.tsx index facc2b479e852b..692a13ba57328a 100644 --- a/docs/src/pages/components/radio-buttons/ColorRadioButtons.tsx +++ b/docs/src/pages/components/radio-buttons/ColorRadioButtons.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import { green } from '@material-ui/core/colors'; +import { pink } from '@material-ui/core/colors'; import Radio from '@material-ui/core/Radio'; export default function ColorRadioButtons() { @@ -21,13 +21,14 @@ export default function ColorRadioButtons() { <div> <Radio {...controlProps('a')} /> <Radio {...controlProps('b')} color="secondary" /> - <Radio {...controlProps('c')} color="default" /> + <Radio {...controlProps('c')} color="success" /> + <Radio {...controlProps('d')} color="default" /> <Radio - {...controlProps('d')} + {...controlProps('e')} sx={{ - color: green[800], + color: pink[800], '&.Mui-checked': { - color: green[600], + color: pink[600], }, }} /> diff --git a/docs/src/pages/components/radio-buttons/radio-buttons-de.md b/docs/src/pages/components/radio-buttons/radio-buttons-de.md index 845d547fd2968e..551e3cd261e567 100644 --- a/docs/src/pages/components/radio-buttons/radio-buttons-de.md +++ b/docs/src/pages/components/radio-buttons/radio-buttons-de.md @@ -16,13 +16,23 @@ Bei Optionsschaltflächen sollte die am häufigsten verwendete Option standardm {{"component": "modules/components/ComponentLinkHeader.js"}} -## RadioGroup +## Radio group `RadioGroup` ist ein hilfreicher Wrapper zur Gruppierung von `Optionsfelder` Komponenten, der eine einfachere API und den richtigen Zugriff der Tastatur auf die Gruppe bietet. {{"demo": "pages/components/radio-buttons/RadioButtonsGroup.js"}} -To lay out the buttons horizontally, set the `row` prop: `<RadioGroup row />`. +### Direction + +To lay out the buttons horizontally, set the `row` prop: + +{{"demo": "pages/components/radio-buttons/RowRadioButtonsGroup.js"}} + +### Controlled + +You can control the radio with the `value` and `onChange` props: + +{{"demo": "pages/components/radio-buttons/ControlledRadioButtonsGroup.js"}} ## Standalone radio buttons @@ -30,6 +40,16 @@ To lay out the buttons horizontally, set the `row` prop: `<RadioGroup row />`. {{"demo": "pages/components/radio-buttons/RadioButtons.js"}} +## Size + +Use the `size` prop or customize the font size of the svg icons to change the size of the radios. + +{{"demo": "pages/components/radio-buttons/SizeRadioButtons.js"}} + +## Farbe (Color) + +{{"demo": "pages/components/radio-buttons/ColorRadioButtons.js"}} + ## Etikettenplatzierung You can change the placement of the label with the `FormControlLabel` component's `labelPlacement` prop: @@ -63,11 +83,11 @@ For advanced customization use cases, a `useRadioGroup()` hook is exposed. It re #### Rückgabewerte -`value` (_Object_): +`value` (_object_): -- `value.name` (_String_ [optional]): The name used to reference the value of the control. -- `value.onChange` (_Void_ [optional]): Callback fired when a radio button is selected. -- `value.value` (_Any_ [optional]): Value of the selected radio button. +- `value.name` (_string_ [optional]): The name used to reference the value of the control. +- `value.onChange` (_func_ [optional]): Callback fired when a radio button is selected. +- `value.value` (_any_ [optional]): Value of the selected radio button. #### Beispiel @@ -85,7 +105,7 @@ For advanced customization use cases, a `useRadioGroup()` hook is exposed. It re - Wenn ein Label nicht verwendet werden kann, muss der Eingabekomponente ein Attribut direkt hinzugefügt werden. In diesem Fall können Sie das zusätzliche Attribut (z. B. `aria-label`, `aria-labelby`, `title`) über die Eigenschaft `inputProps` anwenden. ```jsx -<RadioButton +<Radio value="radioA" inputProps={{ 'aria-label': 'Radio A', diff --git a/docs/src/pages/components/radio-buttons/radio-buttons-es.md b/docs/src/pages/components/radio-buttons/radio-buttons-es.md index f0a28040e5eb2f..7753d2607716fd 100644 --- a/docs/src/pages/components/radio-buttons/radio-buttons-es.md +++ b/docs/src/pages/components/radio-buttons/radio-buttons-es.md @@ -16,13 +16,23 @@ Radio buttons should have the most commonly used option selected by default. {{"component": "modules/components/ComponentLinkHeader.js"}} -## RadioGroup +## Radio group `RadioGroup` is a helpful wrapper used to group `Radio` components that provides an easier API, and proper keyboard accessibility to the group. {{"demo": "pages/components/radio-buttons/RadioButtonsGroup.js"}} -Para poner los botones de forma horizontal, establezca el `fila` prop: `<RadioGroup row />`. +### Direction + +To lay out the buttons horizontally, set the `row` prop: + +{{"demo": "pages/components/radio-buttons/RowRadioButtonsGroup.js"}} + +### Controlled + +You can control the radio with the `value` and `onChange` props: + +{{"demo": "pages/components/radio-buttons/ControlledRadioButtonsGroup.js"}} ## Standalone radio buttons @@ -30,6 +40,16 @@ Para poner los botones de forma horizontal, establezca el `fila` prop: `<RadioGr {{"demo": "pages/components/radio-buttons/RadioButtons.js"}} +## Tamaño + +Use the `size` prop or customize the font size of the svg icons to change the size of the radios. + +{{"demo": "pages/components/radio-buttons/SizeRadioButtons.js"}} + +## Color + +{{"demo": "pages/components/radio-buttons/ColorRadioButtons.js"}} + ## Ubicación de Etiqueta Usted puede cambiar la ubicación de la etiqueta con el `FormControlLabel` del componente `labelPlacement` prop: @@ -63,11 +83,11 @@ For advanced customization use cases, a `useRadioGroup()` hook is exposed. It re #### Regresa -`value` (_Object_): +`value` (_object_): -- `value.name` (_String_ [optional]): The name used to reference the value of the control. -- `value.onChange` (_Void_ [optional]): Callback fired when a radio button is selected. -- `value.value` (_Any_ [optional]): Value of the selected radio button. +- `value.name` (_string_ [optional]): The name used to reference the value of the control. +- `value.onChange` (_func_ [optional]): Callback fired when a radio button is selected. +- `value.value` (_any_ [optional]): Value of the selected radio button. #### Ejemplo @@ -85,7 +105,7 @@ For advanced customization use cases, a `useRadioGroup()` hook is exposed. It re - Cuando no se puede usar una etiqueta, es necesario agregar un atributo directamente al componente de entrada. En este caso, puede aplicar el atributo adicional (por ejemplo, `aria-label`, `aria-labelledby`, `title`) a través de la propiedad `inputProps`. ```jsx -<RadioButton +<Radio value="radioA" inputProps={{ 'aria-label': 'Radio A', diff --git a/docs/src/pages/components/radio-buttons/radio-buttons-fr.md b/docs/src/pages/components/radio-buttons/radio-buttons-fr.md index 2b5878e0090f4e..79101e4fe82b0e 100644 --- a/docs/src/pages/components/radio-buttons/radio-buttons-fr.md +++ b/docs/src/pages/components/radio-buttons/radio-buttons-fr.md @@ -10,7 +10,7 @@ waiAria: 'https://www.w3.org/TR/wai-aria-practices/#radiobutton' <p class="description">Les radios buttons permettent a l'utilisateur de sélectionner un choix parmi un ensemble de choix.</p> -Ici [buttons radio](https://material.io/design/components/selection-controls.html#radio-buttons) toutes les options. Si les options disponibles peuvent être réduites, envisagez d'utiliser un menu déroulant, car il utilise moins d'espace disponibles. +Utilisez les cases d’option lorsque l’utilisateur a besoin de voir toutes les options disponibles. Si les options disponibles peuvent être réduites, envisagez d'utiliser un menu déroulant, car il utilise moins d'espace disponibles. Généralement, les cases d'option doivent avoir l'option la plus utilisée sélectionnée par défaut. @@ -22,14 +22,34 @@ Généralement, les cases d'option doivent avoir l'option la plus utilisée sél {{"demo": "pages/components/radio-buttons/RadioButtonsGroup.js"}} +### Direction + To lay out the buttons horizontally, set the `row` prop: `<RadioGroup row />`. +{{"demo": "pages/components/radio-buttons/RowRadioButtonsGroup.js"}} + +### Checkbox personnalisée + +You can control the radio with the `value` and `onChange` props: + +{{"demo": "pages/components/radio-buttons/ControlledRadioButtonsGroup.js"}} + ## Standalone radio buttons `Radio` can also be used standalone, without the RadioGroup wrapper. {{"demo": "pages/components/radio-buttons/RadioButtons.js"}} +## Size + +Use the `size` prop or customize the font size of the svg icons to change the size of the radios. + +{{"demo": "pages/components/radio-buttons/SizeRadioButtons.js"}} + +## Couleur + +{{"demo": "pages/components/radio-buttons/ColorRadioButtons.js"}} + ## Emplacement du label You can change the placement of the label with the `FormControlLabel` component's `labelPlacement` prop: @@ -50,7 +70,7 @@ Voici un exemple de personnalisation du composant. Vous pouvez en savoir plus da ## `useRadioGroup` -For advanced customization use cases, a `useRadioGroup()` hook is exposed. It returns the context value of the parent radio group. The Radio component uses this hook internally. +Pour les cas d'utilisation de personnalisation avancée, utilisez la fonction `useRadioGroup()`. Cela retourne la valeur de contexte du groupe radio parent. Le composant Radio utilise ce hook en interne. ### API diff --git a/docs/src/pages/components/radio-buttons/radio-buttons-ja.md b/docs/src/pages/components/radio-buttons/radio-buttons-ja.md index a450d42202e695..8cf9c98cd8959f 100644 --- a/docs/src/pages/components/radio-buttons/radio-buttons-ja.md +++ b/docs/src/pages/components/radio-buttons/radio-buttons-ja.md @@ -16,13 +16,23 @@ waiAria: 'https://www.w3.org/TR/wai-aria-practices/#radiobutton' {{"component": "modules/components/ComponentLinkHeader.js"}} -## RadioGroup +## Radio group `RadioGroup` は、 `Radio` コンポーネントをグループ化するのに使用される便利なラッパーで、より簡単なAPIと、グループへの適切なキーボードアクセシビリティを提供します。 {{"demo": "pages/components/radio-buttons/RadioButtonsGroup.js"}} -To lay out the buttons horizontally, set the `row` prop: `<RadioGroup row />`. +### 方向 + +To lay out the buttons horizontally, set the `row` prop: + +{{"demo": "pages/components/radio-buttons/RowRadioButtonsGroup.js"}} + +### Controlled + +You can control the radio with the `value` and `onChange` props: + +{{"demo": "pages/components/radio-buttons/ControlledRadioButtonsGroup.js"}} ## Standalone radio buttons @@ -30,6 +40,16 @@ To lay out the buttons horizontally, set the `row` prop: `<RadioGroup row />`. {{"demo": "pages/components/radio-buttons/RadioButtons.js"}} +## Size + +Use the `size` prop or customize the font size of the svg icons to change the size of the radios. + +{{"demo": "pages/components/radio-buttons/SizeRadioButtons.js"}} + +## カラー + +{{"demo": "pages/components/radio-buttons/ColorRadioButtons.js"}} + ## ラベルの配置 You can change the placement of the label with the `FormControlLabel` component's `labelPlacement` prop: @@ -44,13 +64,13 @@ In general, radio buttons should have a value selected by default. If this is no ## カスタマイズされたラジオ -コンポーネントのカスタマイズ例を次に示します。 詳細については、 [overrides documentation page](/customization/how-to-customize/)を参照してください。 +コンポーネントのカスタマイズ例を次に示します。 詳細については、 [こちら](/customization/how-to-customize/)を参照してください。 {{"demo": "pages/components/radio-buttons/CustomizedRadios.js"}} ## `useRadioGroup` -For advanced customization use cases, a `useRadioGroup()` hook is exposed. It returns the context value of the parent radio group. The Radio component uses this hook internally. +高度なカスタマイズのユースケース向けに、 `useRadioGroup()` フックが公開されています。 これは親のラジオボタングループのコンテキスト値を返します。 Radioコンポーネントは内部でこのフックを使用します。 ### API @@ -63,11 +83,11 @@ For advanced customization use cases, a `useRadioGroup()` hook is exposed. It re #### 戻り値 -`value` (_Object_): +`value` (_object_): -- `value.name` (_String_ [optional]): The name used to reference the value of the control. -- `value.onChange` (_Void_ [optional]): Callback fired when a radio button is selected. -- `value.value` (_Any_ [optional]): Value of the selected radio button. +- `value.name` (_string_ [optional]): コントロールの値を参照するために使用される名前。 +- `value.onChange` (_func_ [optional]): Callback fired when a radio button is selected. +- `value.value` (_any_ [optional]): 選択したラジオボタンの値。 #### 例 @@ -75,17 +95,17 @@ For advanced customization use cases, a `useRadioGroup()` hook is exposed. It re ## When to use -- [Checkboxと Radio Buttons](https://www.nngroup.com/articles/checkboxes-vs-radio-buttons/) +- [Checkboxと Radio Button](https://www.nngroup.com/articles/checkboxes-vs-radio-buttons/) ## アクセシビリティ (WAI-ARIA: https://www.w3.org/TR/wai-aria-practices/#radiobutton) -- ラジオボタン、チェックボックス、スイッチなどのすべてのフォームコントロールにラベルを付ける必要があります。 ほとんどの場合、 `<label>` 要素([FormControlLabel](/api/form-control-label/))を使用して行われます。 ラジオボタン、チェックボックス、スイッチなどのすべてのフォームコントロールにラベルを付ける必要があります。 ほとんどの場合、 `<label>` 要素([FormControlLabel](/api/form-control-label/))を使用して行われます。 ラジオボタン、チェックボックス、スイッチなどのすべてのフォームコントロールにラベルを付ける必要があります。 ほとんどの場合、 `<label>` 要素([FormControlLabel](/api/form-control-label/))を使用して行われます。 ラジオボタン、チェックボックス、スイッチなどのすべてのフォームコントロールにラベルを付ける必要があります。 ほとんどの場合、 `<label>` 要素([FormControlLabel](/api/form-control-label/))を使用して行われます。 -- ラベルを使用できない場合は、入力コンポーネントに直接属性を追加する必要があります。 ラベルを使用できない場合は、入力コンポーネントに直接属性を追加する必要があります。 この場合、追加の属性(例: `aria-label`, `aria-labelledby`, `title`)を経由して `inputProps` プロパティを追加します。 ラベルを使用できない場合は、入力コンポーネントに直接属性を追加する必要があります。 この場合、追加の属性(例: `aria-label`, `aria-labelledby`, `title`)を経由して `inputProps` プロパティを追加します。 ラベルを使用できない場合は、入力コンポーネントに直接属性を追加する必要があります。 ラベルを使用できない場合は、入力コンポーネントに直接属性を追加する必要があります。 この場合、追加の属性(例: `aria-label`, `aria-labelledby`, `title`)を経由して `inputProps` プロパティを追加します。 ラベルを使用できない場合は、入力コンポーネントに直接属性を追加する必要があります。 この場合、追加の属性(例: `aria-label`, `aria-labelledby`, `title`)を経由して `inputProps` プロパティを追加します。 ラベルを使用できない場合は、入力コンポーネントに直接属性を追加する必要があります。 この場合、追加の属性(例: `aria-label`, `aria-labelledby`, `title`)を経由して `inputProps` プロパティを追加します。 +- ラジオボタン、チェックボックス、スイッチなどのすべてのフォームコントロールにラベルを付ける必要があります。 ほとんどの場合、 `<label>` 要素([FormControlLabel](/api/form-control-label/))を使用して行われます。 +- ラベルを使用できない場合は、入力コンポーネントに直接属性を追加する必要があります。 この場合、追加の属性(例: `aria-label`, `aria-labelledby`, `title`)を経由して `inputProps` プロパティを追加します。 ```jsx -<RadioButton +<Radio value="radioA" inputProps={{ 'aria-label': 'Radio A', diff --git a/docs/src/pages/components/radio-buttons/radio-buttons-pt.md b/docs/src/pages/components/radio-buttons/radio-buttons-pt.md index 3ec9f4e1c9eea1..7af4f941483bec 100644 --- a/docs/src/pages/components/radio-buttons/radio-buttons-pt.md +++ b/docs/src/pages/components/radio-buttons/radio-buttons-pt.md @@ -16,13 +16,23 @@ Os botões de opção devem ter a opção comum e mais usada selecionada por pad {{"component": "modules/components/ComponentLinkHeader.js"}} -## RadioGroup +## Radio group O componente `RadioGroup` é um wrapper utilizado para agrupar componentes `Radio`, fornece uma API mais simples e adequada para a acessibilidade por teclado. {{"demo": "pages/components/radio-buttons/RadioButtonsGroup.js"}} -Para demonstrar os botões horizontalmente, defina a propriedade `row`: `<RadioGroup row />`. +### Direção + +To lay out the buttons horizontally, set the `row` prop: + +{{"demo": "pages/components/radio-buttons/RowRadioButtonsGroup.js"}} + +### Controlled + +You can control the radio with the `value` and `onChange` props: + +{{"demo": "pages/components/radio-buttons/ControlledRadioButtonsGroup.js"}} ## Botões de opção independentes @@ -30,6 +40,16 @@ O componente `Radio` também pode ser usado de forma independente, sem o wrapper {{"demo": "pages/components/radio-buttons/RadioButtons.js"}} +## Tamanho + +Use the `size` prop or customize the font size of the svg icons to change the size of the radios. + +{{"demo": "pages/components/radio-buttons/SizeRadioButtons.js"}} + +## Cor + +{{"demo": "pages/components/radio-buttons/ColorRadioButtons.js"}} + ## Posicionamento do rótulo Você pode alterar o posicionamento do rótulo com o componente `FormControlLabel` na propriedade `labelPlacement`: @@ -60,11 +80,11 @@ import { useRadioGroup } from '@material-ui/core/RadioGroup'; #### Retornos -`value` (_Object_): +`value` (_object_): -- `value.name` (_String_ [opcional]): O nome usado para fazer referência ao valor do controle. -- `value.onChange` (_Void_ [opcional]): Callback disparado quando um botão de opção é selecionado. -- `value.value` (_Any_ [opcional]): Valor do botão de opção selecionado. +- `value.name` (_string_ [opcional]): O nome usado para fazer referência ao valor do controle. +- `value.onChange` (_func_ [optional]): Callback fired when a radio button is selected. +- `value.value` (_any_ [opcional]): Valor do botão de opção selecionado. #### Exemplo @@ -82,8 +102,10 @@ import { useRadioGroup } from '@material-ui/core/RadioGroup'; - Quando um rótulo não pode ser usado, é necessário adicionar um atributo diretamente no componente de entrada. Nesse caso você pode aplicar um atributo adicional (por exemplo, `aria-label`,`aria-labelledby`, `title`) através da propriedade `inputProps`. ```jsx -<RadioButton +<Radio value="radioA" - inputProps={{ 'aria-label': 'Radio A' }} + inputProps={{ + 'aria-label': 'Radio A', + }} /> ``` diff --git a/docs/src/pages/components/radio-buttons/radio-buttons-ru.md b/docs/src/pages/components/radio-buttons/radio-buttons-ru.md index 0203a7dd0befb5..d49101e212fa1a 100644 --- a/docs/src/pages/components/radio-buttons/radio-buttons-ru.md +++ b/docs/src/pages/components/radio-buttons/radio-buttons-ru.md @@ -16,13 +16,23 @@ Use [radio buttons](https://material.io/design/components/selection-controls.htm {{"component": "modules/components/ComponentLinkHeader.js"}} -## RadioGroup +## Radio group `RadioGroup` - это полезная обертка, используемая для группировки `компонентов Radio`, она обеспечивает более простой API и управление с клавиатуры. {{"demo": "pages/components/radio-buttons/RadioButtonsGroup.js"}} -To lay out the buttons horizontally, set the `row` prop: `<RadioGroup row />`. +### Direction + +To lay out the buttons horizontally, set the `row` prop: + +{{"demo": "pages/components/radio-buttons/RowRadioButtonsGroup.js"}} + +### Controlled + +You can control the radio with the `value` and `onChange` props: + +{{"demo": "pages/components/radio-buttons/ControlledRadioButtonsGroup.js"}} ## Standalone radio buttons @@ -30,6 +40,16 @@ To lay out the buttons horizontally, set the `row` prop: `<RadioGroup row />`. {{"demo": "pages/components/radio-buttons/RadioButtons.js"}} +## Size + +Use the `size` prop or customize the font size of the svg icons to change the size of the radios. + +{{"demo": "pages/components/radio-buttons/SizeRadioButtons.js"}} + +## Цвет + +{{"demo": "pages/components/radio-buttons/ColorRadioButtons.js"}} + ## Расположение метки You can change the placement of the label with the `FormControlLabel` component's `labelPlacement` prop: @@ -44,7 +64,7 @@ In general, radio buttons should have a value selected by default. If this is no ## Customized radios -Ниже находится пример кастомизации компонента. You can learn more about this in the [overrides documentation page](/customization/how-to-customize/). +Ниже находится пример кастомизации компонента. Вы можете узнать об этом больше [в документации по переопределению свойств](/customization/how-to-customize/). {{"demo": "pages/components/radio-buttons/CustomizedRadios.js"}} @@ -63,11 +83,11 @@ For advanced customization use cases, a `useRadioGroup()` hook is exposed. It re #### Возвращает -`value` (_Object_): +`value` (_object_): -- `value.name` (_String_ [optional]): The name used to reference the value of the control. -- `value.onChange` (_Void_ [optional]): Callback fired when a radio button is selected. -- `value.value` (_Any_ [optional]): Value of the selected radio button. +- `value.name` (_string_ [optional]): The name used to reference the value of the control. +- `value.onChange` (_func_ [optional]): Callback fired when a radio button is selected. +- `value.value` (_any_ [optional]): Value of the selected radio button. #### Пример @@ -75,7 +95,7 @@ For advanced customization use cases, a `useRadioGroup()` hook is exposed. It re ## Бесплатно -- [Чекбоксы. Radio Buttons (радиокнопки) ](https://www.nngroup.com/articles/checkboxes-vs-radio-buttons/) +- [Checkboxes или Radio Buttons](https://www.nngroup.com/articles/checkboxes-vs-radio-buttons/) ## Доступность @@ -85,7 +105,7 @@ For advanced customization use cases, a `useRadioGroup()` hook is exposed. It re - Когда метка не может быть использована, необходимо добавить атрибут непосредственно на поле ввода. В этом случае можно применить дополнительный атрибут (например, `aria-label`, `aria-labelledby`, `title`) через свойство `inputProps`. ```jsx -<RadioButton +<Radio value="radioA" inputProps={{ 'aria-label': 'Radio A', diff --git a/docs/src/pages/components/radio-buttons/radio-buttons-zh.md b/docs/src/pages/components/radio-buttons/radio-buttons-zh.md index 7947af4fb13e2f..29ff8a9337a370 100644 --- a/docs/src/pages/components/radio-buttons/radio-buttons-zh.md +++ b/docs/src/pages/components/radio-buttons/radio-buttons-zh.md @@ -16,13 +16,23 @@ waiAria: 'https://www.w3.org/TR/wai-aria-practices/#radiobutton' {{"component": "modules/components/ComponentLinkHeader.js"}} -## RadioGroup 单选框组 +## Radio group `RadioGroup` 适用于一组 `Radio`,它提供相对简单的 API 并且能够使用键盘对该 RadioGroup 进行控制。 {{"demo": "pages/components/radio-buttons/RadioButtonsGroup.js"}} -要横向布置按钮,请将 `row` 属性设置为:`<RadioGroup row />`。 +### 方向 + +To lay out the buttons horizontally, set the `row` prop: + +{{"demo": "pages/components/radio-buttons/RowRadioButtonsGroup.js"}} + +### Controlled + +You can control the radio with the `value` and `onChange` props: + +{{"demo": "pages/components/radio-buttons/ControlledRadioButtonsGroup.js"}} ## Standalone radio buttons 独立的单选框按钮 @@ -30,6 +40,16 @@ waiAria: 'https://www.w3.org/TR/wai-aria-practices/#radiobutton' {{"demo": "pages/components/radio-buttons/RadioButtons.js"}} +## Size 大小 + +Use the `size` prop or customize the font size of the svg icons to change the size of the radios. + +{{"demo": "pages/components/radio-buttons/SizeRadioButtons.js"}} + +## Color 颜色 + +{{"demo": "pages/components/radio-buttons/ColorRadioButtons.js"}} + ## 标签放置 你可以用 `FormControlLabel` 组件的 `labelPlacement` 属性来改变标签的位置。 @@ -60,11 +80,11 @@ import { useRadioGroup } from '@material-ui/core/RadioGroup'; #### 返回结果 -`value` (_Object_): +`value` (_object_): -- `value.name` (_String_ [optional]):用于引用控件值的名称。 -- `value.onChange` (_Void_ [optional]):当单选框被选中时会触发的回调。 -- `value.value` (_Any_ [optional]):所被选定的单选框的值。 +- `value.name` (_string_ [optional]):用于引用控件值的名称。 +- `value.onChange` (_func_ [optional]): Callback fired when a radio button is selected. +- `value.value` (_any_ [optional]):所被选定的单选框的值。 #### 示例 @@ -82,7 +102,7 @@ import { useRadioGroup } from '@material-ui/core/RadioGroup'; - 如果无法使用标签,您则必须在输入组件中直接添加属性。 在这种情况下,您可以经由 `inputProps` 属性,来附着一些额外的属性(例如 `arial-label`,`aria-labelledby`,`title`)。 ```jsx -<RadioButton +<Radio value="radioA" inputProps={{ 'aria-label': 'Radio A', diff --git a/docs/src/pages/components/rating/rating-de.md b/docs/src/pages/components/rating/rating-de.md index d477659a570ff3..748e4193627ae9 100644 --- a/docs/src/pages/components/rating/rating-de.md +++ b/docs/src/pages/components/rating/rating-de.md @@ -1,5 +1,5 @@ --- -title: React Rating component +title: React Rating Komponente components: Bewertung githubLabel: 'component: Rating' waiAria: 'https://www.w3.org/WAI/tutorials/forms/custom-controls/#a-star-rating' @@ -7,15 +7,15 @@ waiAria: 'https://www.w3.org/WAI/tutorials/forms/custom-controls/#a-star-rating' # Bewertung -<p class="description">Ratings provide insight regarding others' opinions and experiences, and can allow the user to submit a rating of their own.</p> +<p class="description">Bewertungen geben Einblicke in die Meinungen und Erfahrungen anderer und können es dem Benutzer ermöglichen, eine eigene Bewertung abzugeben.</p> {{"component": "modules/components/ComponentLinkHeader.js"}} -## Basic rating +## Grundbewertung {{"demo": "pages/components/rating/BasicRating.js"}} -## Rating precision +## Bewertungspräzision The rating can display any float number with the `value` prop. Use the `precision` prop to define the minimum increment value change allowed. @@ -23,22 +23,28 @@ The rating can display any float number with the `value` prop. Use the `precisio ## Hover feedback -You can display a label on hover to help the user pick the correct rating value. Die Demo verwendet die `onChangeActive` Prop. +Sie können ein Etikett mit dem Mauszeiger anzeigen, um dem Benutzer bei der Auswahl des richtigen Bewertungswerts zu helfen. Die Demo verwendet die `onChangeActive` Prop. {{"demo": "pages/components/rating/HoverRating.js"}} ## Größen -For larger or smaller ratings use the `size` prop. +Für Größeren oder kleinerem Bewertungen benutze `size` prop. {{"demo": "pages/components/rating/RatingSize.js"}} -## Customized rating +## Benutzerdefinierte Bewertung Hier einige Beispiele zum Anpassen der Komponente. Mehr dazu erfahren Sie auf der [Überschreibungsdokumentationsseite](/customization/how-to-customize/). {{"demo": "pages/components/rating/CustomizedRating.js"}} +## Radio group + +The rating is implemented with a radio group, set `highlightSelectedOnly` to restore the natural behavior. + +{{"demo": "pages/components/rating/RadioGroupRating.js"}} + ## Barrierefreiheit ([WAI tutorial](https://www.w3.org/WAI/tutorials/forms/custom-controls/#a-star-rating)) diff --git a/docs/src/pages/components/rating/rating-es.md b/docs/src/pages/components/rating/rating-es.md index e5a7f93db5eb80..2c180c2000af48 100644 --- a/docs/src/pages/components/rating/rating-es.md +++ b/docs/src/pages/components/rating/rating-es.md @@ -39,6 +39,12 @@ Here are some examples of customizing the component. Puedes aprender más sobre {{"demo": "pages/components/rating/CustomizedRating.js"}} +## Radio group + +The rating is implemented with a radio group, set `highlightSelectedOnly` to restore the natural behavior. + +{{"demo": "pages/components/rating/RadioGroupRating.js"}} + ## Accesibilidad ([tutorial WAI](https://www.w3.org/WAI/tutorials/forms/custom-controls/#a-star-rating)) diff --git a/docs/src/pages/components/rating/rating-fr.md b/docs/src/pages/components/rating/rating-fr.md index 8075a681041dde..a50c063ce18d69 100644 --- a/docs/src/pages/components/rating/rating-fr.md +++ b/docs/src/pages/components/rating/rating-fr.md @@ -1,5 +1,5 @@ --- -title: React Rating component +title: Composant d'évaluation de réaction components: Rating (Notation) githubLabel: 'component: Rating' waiAria: 'https://www.w3.org/WAI/tutorials/forms/custom-controls/#a-star-rating' @@ -7,15 +7,15 @@ waiAria: 'https://www.w3.org/WAI/tutorials/forms/custom-controls/#a-star-rating' # Rating (Notation) -<p class="description">Ratings provide insight regarding others' opinions and experiences, and can allow the user to submit a rating of their own.</p> +<p class="description">Les évaluations donnent un aperçu des opinions et des expériences des autres et peuvent permettre à l'utilisateur de soumettre sa propre évaluation.</p> {{"component": "modules/components/ComponentLinkHeader.js"}} -## Basic rating +## Évaluation de base {{"demo": "pages/components/rating/BasicRating.js"}} -## Rating precision +## Précision de notation The rating can display any float number with the `value` prop. Use the `precision` prop to define the minimum increment value change allowed. @@ -23,40 +23,46 @@ The rating can display any float number with the `value` prop. Use the `precisio ## Hover feedback -You can display a label on hover to help the user pick the correct rating value. The demo uses the `onChangeActive` prop. +Vous pouvez afficher une étiquette au survol pour aider l'utilisateur à choisir la bonne valeur d'évaluation. The demo uses the `onChangeActive` prop. {{"demo": "pages/components/rating/HoverRating.js"}} ## Tailles -For larger or smaller ratings use the `size` prop. +Pour des notes plus grandes ou plus petites, utilisez la propriété `size`. {{"demo": "pages/components/rating/RatingSize.js"}} -## Customized rating +## Évaluation personnalisée Here are some examples of customizing the component. Vous pouvez en savoir plus dans la [page de documentation des overrides](/customization/how-to-customize/). {{"demo": "pages/components/rating/CustomizedRating.js"}} +## RadioGroup + +The rating is implemented with a radio group, set `highlightSelectedOnly` to restore the natural behavior. + +L'accessibilité de ce composant repose sur les points suivants : + ## Accessibilité -([WAI tutorial](https://www.w3.org/WAI/tutorials/forms/custom-controls/#a-star-rating)) +([Tutoriel WAI](https://www.w3.org/WAI/tutorials/forms/custom-controls/#a-star-rating)) L'accessibilité de ce composant repose sur les points suivants : -- A radio group with its fields visually hidden. It contains six radio buttons, one for each star, and another for 0 stars that is checked by default. Be sure to provide a value for the `name` prop that is unique to the parent form. -- Labels for the radio buttons containing actual text (“1 Star”, “2 Stars”, …). Be sure to provide a suitable function to the `getLabelText` prop when the page is in a language other than English. You can use the [included locales](https://material-ui.com/guides/localization/), or provide your own. -- A visually distinct appearance for the rating icons. By default, the rating component uses both a difference of color and shape (filled and empty icons) to indicate the value. In the event that you are using color as the only means to indicate the value, the information should also be also displayed as text, as in this demo. This is important to match [success Criterion 1.4.1](https://www.w3.org/TR/WCAG21/#use-of-color) of WCAG2.1. +- Un groupe radio avec ses champs visuellement cachés. Il contient six boutons radio, un pour chaque étoile et un autre pour 0 étoile coché par défaut. Assurez-vous de fournir une valeur pour la propriété `name` qui est unique au formulaire parent. +- Libellés des boutons radio contenant du texte réel (« 1 étoile », « 2 étoiles », …). Assurez-vous de fournir une fonction appropriée à la prop `getLabelText` lorsque la page est dans une langue autre que l'anglais. Vous pouvez utiliser les [locales incluses](https://material-ui.com/guides/localization/) ou fournir les vôtres. +- Une apparence visuellement distincte pour les icônes de notation. Par défaut, le composant d'évaluation utilise à la fois une différence de couleur et de forme (icônes pleines et vides) pour indiquer la valeur. Dans le cas où vous utilisez la couleur comme seul moyen d'indiquer la valeur, les informations doivent également être affichées sous forme de texte, comme dans cette démo. Ceci est important pour correspondre au [critère de réussite 1.4.1](https://www.w3.org/TR/WCAG21/#use-of-color) des WCAG2.1. {{"demo": "pages/components/rating/TextRating.js"}} ### ARIA -The read only rating has a role of "img", and an aria-label that describes the displayed rating. +La note en lecture seule a un rôle de "img", et une aria-label qui décrit la note affichée. ### Clavier -Because the rating component uses radio buttons, keyboard interaction follows the native browser behavior. Tab will focus the current rating, and cursor keys control the selected rating. +Étant donné que le composant d'évaluation utilise des boutons radio, l'interaction du clavier suit le comportement natif du navigateur. L'onglet se concentrera sur la note actuelle et les touches de curseur contrôlent la note sélectionnée. -The read only rating is not focusable. +La note en lecture seule n'est pas focalisable. diff --git a/docs/src/pages/components/rating/rating-ja.md b/docs/src/pages/components/rating/rating-ja.md index 92d5173a9a0870..ff961d8cbc4f9e 100644 --- a/docs/src/pages/components/rating/rating-ja.md +++ b/docs/src/pages/components/rating/rating-ja.md @@ -1,5 +1,5 @@ --- -title: React Rating component +title: Reactレーティングコンポーネント components: レート githubLabel: 'component: Rating' waiAria: 'https://www.w3.org/WAI/tutorials/forms/custom-controls/#a-star-rating' @@ -7,11 +7,11 @@ waiAria: 'https://www.w3.org/WAI/tutorials/forms/custom-controls/#a-star-rating' # レート -<p class="description">Ratings provide insight regarding others' opinions and experiences, and can allow the user to submit a rating of their own.</p> +<p class="description">レーティングコンポーネントは、ユーザーの意見や評価を反映するためのコンポーネントです。</p> {{"component": "modules/components/ComponentLinkHeader.js"}} -## Basic rating +## 基本のレーティングコンポーネント {{"demo": "pages/components/rating/BasicRating.js"}} @@ -35,10 +35,16 @@ For larger or smaller ratings use the `size` prop. ## Customized rating -コンポーネントのカスタマイズの例を次に示します。 詳細については、 [overrides documentation page](/customization/how-to-customize/)を参照してください。 +コンポーネントのカスタマイズの例を次に示します。 詳細については、 [こちら](/customization/how-to-customize/)を参照してください。 {{"demo": "pages/components/rating/CustomizedRating.js"}} +## Radio group + +The rating is implemented with a radio group, set `highlightSelectedOnly` to restore the natural behavior. + +{{"demo": "pages/components/rating/RadioGroupRating.js"}} + ## アクセシビリティ ([WAI tutorial](https://www.w3.org/WAI/tutorials/forms/custom-controls/#a-star-rating)) diff --git a/docs/src/pages/components/rating/rating-pt.md b/docs/src/pages/components/rating/rating-pt.md index 9e91c552fdd969..d03c6dc561bbe1 100644 --- a/docs/src/pages/components/rating/rating-pt.md +++ b/docs/src/pages/components/rating/rating-pt.md @@ -7,7 +7,7 @@ waiAria: 'https://www.w3.org/WAI/tutorials/forms/custom-controls/#a-star-rating' # Avaliação -<p class="description">Ratings provide insight regarding others' opinions and experiences, and can allow the user to submit a rating of their own.</p> +<p class="description">Avaliações fornecem informações sobre as opiniões e experiências dos outros e permitem que o usuário envie sua própria avaliação.</p> {{"component": "modules/components/ComponentLinkHeader.js"}} @@ -39,6 +39,12 @@ Aqui estão alguns exemplos de customização do componente. Você pode aprender {{"demo": "pages/components/rating/CustomizedRating.js"}} +## Radio group + +The rating is implemented with a radio group, set `highlightSelectedOnly` to restore the natural behavior. + +{{"demo": "pages/components/rating/RadioGroupRating.js"}} + ## Acessibilidade ([WAI tutorial](https://www.w3.org/WAI/tutorials/forms/custom-controls/#a-star-rating)) diff --git a/docs/src/pages/components/rating/rating-ru.md b/docs/src/pages/components/rating/rating-ru.md index 407f811cc786af..587fc6a942bda1 100644 --- a/docs/src/pages/components/rating/rating-ru.md +++ b/docs/src/pages/components/rating/rating-ru.md @@ -7,15 +7,15 @@ waiAria: 'https://www.w3.org/WAI/tutorials/forms/custom-controls/#a-star-rating' # Rating -<p class="description">Ratings provide insight regarding others' opinions and experiences, and can allow the user to submit a rating of their own.</p> +<p class="description">Рейтинги дают представление о мнении и опыте других и позволяют пользователю дать собственную оценку.</p> {{"component": "modules/components/ComponentLinkHeader.js"}} -## Basic rating +## Базовый рейтинг {{"demo": "pages/components/rating/BasicRating.js"}} -## Rating precision +## Точность рейтинга The rating can display any float number with the `value` prop. Use the `precision` prop to define the minimum increment value change allowed. @@ -23,29 +23,35 @@ The rating can display any float number with the `value` prop. Use the `precisio ## Hover feedback -You can display a label on hover to help the user pick the correct rating value. The demo uses the `onChangeActive` prop. +Вы можете показать lable при наведении курсора, чтобы помочь пользователю выбрать правильное значение рейтинга. The demo uses the `onChangeActive` prop. {{"demo": "pages/components/rating/HoverRating.js"}} ## Размеры -For larger or smaller ratings use the `size` prop. +Для больших или меньших рейтингов используйте prop `size`. {{"demo": "pages/components/rating/RatingSize.js"}} -## Customized rating +## Настраиваемые кнопки -Ниже находятся примеры кастомизации компонента. You can learn more about this in the [overrides documentation page](/customization/how-to-customize/). +Ниже находятся примеры кастомизации компонента. Вы можете узнать об этом больше [в документации по переопределению свойств](/customization/how-to-customize/). {{"demo": "pages/components/rating/CustomizedRating.js"}} +## Radio group + +The rating is implemented with a radio group, set `highlightSelectedOnly` to restore the natural behavior. + +{{"demo": "pages/components/rating/RadioGroupRating.js"}} + ## Доступность -([WAI tutorial](https://www.w3.org/WAI/tutorials/forms/custom-controls/#a-star-rating)) +([WAI Учебник](https://www.w3.org/WAI/tutorials/forms/custom-controls/#a-star-rating)) Доступность этого компонента зависит от: -- A radio group with its fields visually hidden. It contains six radio buttons, one for each star, and another for 0 stars that is checked by default. Be sure to provide a value for the `name` prop that is unique to the parent form. +- Скрыта ли визуально группа radio-кнопок. Rating содержит шесть radio-кнопок, по одному для каждой звёздочки, а ещё одна для 0 звёзд, которые проверяются по умолчанию. Не забудьте предоставить значение для prop `name`, который уникален для родительской формы. - Labels for the radio buttons containing actual text (“1 Star”, “2 Stars”, …). Be sure to provide a suitable function to the `getLabelText` prop when the page is in a language other than English. You can use the [included locales](https://material-ui.com/guides/localization/), or provide your own. - A visually distinct appearance for the rating icons. By default, the rating component uses both a difference of color and shape (filled and empty icons) to indicate the value. In the event that you are using color as the only means to indicate the value, the information should also be also displayed as text, as in this demo. This is important to match [success Criterion 1.4.1](https://www.w3.org/TR/WCAG21/#use-of-color) of WCAG2.1. diff --git a/docs/src/pages/components/rating/rating-zh.md b/docs/src/pages/components/rating/rating-zh.md index b41109d7ba4b82..0cc52706bce61c 100644 --- a/docs/src/pages/components/rating/rating-zh.md +++ b/docs/src/pages/components/rating/rating-zh.md @@ -7,7 +7,8 @@ waiAria: 'https://www.w3.org/WAI/tutorials/forms/custom-controls/#a-star-rating' # Rating 评分 -<p class="description">Ratings provide insight regarding others' opinions and experiences, and can allow the user to submit a rating of their own.</p> +<p class="description">评分组件可以让用户深入了解他人的意见和经验,也可以让用户提交自己的评价。 +</p> {{"component": "modules/components/ComponentLinkHeader.js"}} @@ -39,6 +40,12 @@ waiAria: 'https://www.w3.org/WAI/tutorials/forms/custom-controls/#a-star-rating' {{"demo": "pages/components/rating/CustomizedRating.js"}} +## Radio group + +The rating is implemented with a radio group, set `highlightSelectedOnly` to restore the natural behavior. + +{{"demo": "pages/components/rating/RadioGroupRating.js"}} + ## 无障碍设计 ([WAI 教程](https://www.w3.org/WAI/tutorials/forms/custom-controls/#a-star-rating)) diff --git a/docs/src/pages/components/selects/selects-de.md b/docs/src/pages/components/selects/selects-de.md index 3bf3f034485572..3d052828ecdf55 100644 --- a/docs/src/pages/components/selects/selects-de.md +++ b/docs/src/pages/components/selects/selects-de.md @@ -24,9 +24,9 @@ If you are looking for more advanced features, like combobox, multiselect, autoc ## Eigenschaften -The Select component is implemented as a custom `<input>` element of the [InputBase](/api/input-base/). It extends the [text field components](/components/text-fields) sub-components, either the [Input](/api/input/), [FilledInput](/api/filled-input/), or [OutlinedInput](/api/outlined-input/), depending on the variant selected. It shares the same styles and many of the same props. Refer to the respective component's API page for details. +The Select component is implemented as a custom `<input>` element of the [InputBase](/api/input-base/). It extends the [text field components](/components/text-fields) sub-components, either the [OutlinedInput](/api/outlined-input/), [Input](/api/input/), or [FilledInput](/api/filled-input/), depending on the variant selected. It shares the same styles and many of the same props. Refer to the respective component's API page for details. -### Filled and outlined variants +### Filled and standard variants {{"demo": "pages/components/selects/NativeSelects.js"}} @@ -56,7 +56,7 @@ Die `TextField` Wrapper-Komponente ist ein vollständiges Formularsteuerelement, Hier einige Beispiele zum Anpassen der Komponente. Mehr dazu erfahren Sie auf der [Überschreibungsdokumentationsseite](/customization/how-to-customize/). -Der erste Schritt besteht darin, die `InputBase` Komponente zu formatieren. Anschließend können Sie es entweder direkt als Textfeld verwenden oder der Eigenschaft select `input` zuweisen, um ein Feld `select` zu erhalten. +Der erste Schritt besteht darin, die `InputBase` Komponente zu formatieren. Anschließend können Sie es entweder direkt als Textfeld verwenden oder der Eigenschaft select `input` zuweisen, um ein Feld `select` zu erhalten. Notice that the `"standard"` variant is easier to customize, since it does not wrap the contents in a `fieldset`/`legend` markup. {{"demo": "pages/components/selects/CustomizedSelects.js"}} @@ -94,7 +94,7 @@ Alternatively a `TextField` with an `id` and `label` creates the proper markup a ## Gruppierung -Während es von der Material Design-Spezifikation nicht empfohlen wird, können Sie eine Auswahl innerhalb eines Dialogfelds verwenden. +While it's discouraged by the Material Design guidelines, you can use a select inside a dialog. {{"demo": "pages/components/selects/DialogSelect.js"}} diff --git a/docs/src/pages/components/selects/selects-es.md b/docs/src/pages/components/selects/selects-es.md index 895813767e3939..a8e72e823fd0b5 100644 --- a/docs/src/pages/components/selects/selects-es.md +++ b/docs/src/pages/components/selects/selects-es.md @@ -24,9 +24,9 @@ If you are looking for more advanced features, like combobox, multiselect, autoc ## Props -The Select component is implemented as a custom `<input>` element of the [InputBase](/api/input-base/). It extends the [text field components](/components/text-fields) sub-components, either the [Input](/api/input/), [FilledInput](/api/filled-input/), or [OutlinedInput](/api/outlined-input/), depending on the variant selected. It shares the same styles and many of the same props. Refer to the respective component's API page for details. +The Select component is implemented as a custom `<input>` element of the [InputBase](/api/input-base/). It extends the [text field components](/components/text-fields) sub-components, either the [OutlinedInput](/api/outlined-input/), [Input](/api/input/), or [FilledInput](/api/filled-input/), depending on the variant selected. It shares the same styles and many of the same props. Refer to the respective component's API page for details. -### Filled and outlined variants +### Filled and standard variants {{"demo": "pages/components/selects/NativeSelects.js"}} @@ -56,7 +56,7 @@ El componente `TextField` es un control de formulario completo, incluyendo una e Here are some examples of customizing the component. Puedes aprender más sobre esto en la [sección Personalizando Componentes de la documentación](/customization/how-to-customize/). -The first step is to style the `InputBase` component. El componente `TextField` es un control de formulario completo, incluyendo una etiqueta, el campo de texto y texto de ayuda. +The first step is to style the `InputBase` component. El componente `TextField` es un control de formulario completo, incluyendo una etiqueta, el campo de texto y texto de ayuda. Notice that the `"standard"` variant is easier to customize, since it does not wrap the contents in a `fieldset`/`legend` markup. {{"demo": "pages/components/selects/CustomizedSelects.js"}} @@ -94,7 +94,7 @@ Alternatively a `TextField` with an `id` and `label` creates the proper markup a ## With a dialog -While it's discouraged by the Material Design specification, you can use a select inside a dialog. +While it's discouraged by the Material Design guidelines, you can use a select inside a dialog. {{"demo": "pages/components/selects/DialogSelect.js"}} diff --git a/docs/src/pages/components/selects/selects-fr.md b/docs/src/pages/components/selects/selects-fr.md index c1dd56d5b5fdd0..168c9c82382f17 100644 --- a/docs/src/pages/components/selects/selects-fr.md +++ b/docs/src/pages/components/selects/selects-fr.md @@ -1,5 +1,5 @@ --- -title: React Select component +title: Composant React Select components: Select, NativeSelect githubLabel: 'component: Select' --- @@ -24,25 +24,25 @@ If you are looking for more advanced features, like combobox, multiselect, autoc ## Props -The Select component is implemented as a custom `<input>` element of the [InputBase](/api/input-base/). It extends the [text field components](/components/text-fields) sub-components, either the [Input](/api/input/), [FilledInput](/api/filled-input/), or [OutlinedInput](/api/outlined-input/), depending on the variant selected. It shares the same styles and many of the same props. Refer to the respective component's API page for details. +Le composant Select est implémenté en tant qu'élément `<input>` personnalisé de la [InputBase](/api/input-base/). It extends the [text field components](/components/text-fields) sub-components, either the [Input](/api/input/), [FilledInput](/api/filled-input/), or [OutlinedInput](/api/outlined-input/), depending on the variant selected. Il partage les mêmes styles et bon nombre des mêmes accessoires. Reportez-vous à la page API du composant respectif pour plus de détails. ### Filled and outlined variants {{"demo": "pages/components/selects/NativeSelects.js"}} -### Labels and helper text +### Étiquettes et texte d'aide {{"demo": "pages/components/selects/SelectLabels.js"}} -### Auto width +### Largeur automatique {{"demo": "pages/components/selects/SelectAutoWidth.js"}} -### Other props +### D'autres accessoires {{"demo": "pages/components/selects/SelectOtherProps.js"}} -## Text Fields (Champs de texte) +## Sélection native As the user experience can be improved on mobile using the native select of the platform, we allow such pattern. @@ -56,15 +56,15 @@ Le composant d'encapsulation `TextField` est un contrôle de formulaire complet Here are some examples of customizing the component. Vous pouvez en savoir plus dans la [page de documentation des overrides](/customization/how-to-customize/). -The first step is to style the `InputBase` component. Le composant d'encapsulation `TextField` est un contrôle de formulaire complet comprenant une étiquette, une entrée et un texte d'aide. +The first step is to style the `InputBase` component. Une fois qu'il est stylisé, vous pouvez soit l'utiliser directement comme champ de texte, soit le fournir à la propriété select `input` pour avoir un champ `select`. Notice that the `"standard"` variant is easier to customize, since it does not wrap the contents in a `fieldset`/`legend` markup. {{"demo": "pages/components/selects/CustomizedSelects.js"}} 🎨 Si vous cherchez de l'inspiration, vous pouvez consulter les [exemples de personnalisation de MUI Treasury](https://mui-treasury.com/styles/select). -## Controlled Open Select +## Sélection multiple -The `Select` component can handle multiple selections. The `Select` component can handle multiple selections. +The `Select` component can handle multiple selections. Il est activé avec la prop `multiple`. Like with the single selection, you can pull out the new value by accessing `event.target.value` in the `onChange` callback. It's always an array. @@ -72,7 +72,7 @@ Like with the single selection, you can pull out the new value by accessing `eve {{"demo": "pages/components/selects/MultipleSelect.js"}} -### Checkmarks +### Coches {{"demo": "pages/components/selects/MultipleSelectCheckmarks.js"}} @@ -80,19 +80,19 @@ Like with the single selection, you can pull out the new value by accessing `eve Alternatively a `TextField` with an `id` and `label` creates the proper markup and ids for you: -### Placeholder +### Espace réservé {{"demo": "pages/components/selects/MultipleSelectPlaceholder.js"}} -### Native +### Originaire de {{"demo": "pages/components/selects/MultipleSelectNative.js"}} -## Avec un dialogue +## Sélection ouverte contrôlée {{"demo": "pages/components/selects/ControlledOpenSelect.js"}} -## With a dialog +## Avec un dialogue Bien que cela soit découragé par la spécification Material Design, vous pouvez utiliser une sélection dans une boîte de dialogue. diff --git a/docs/src/pages/components/selects/selects-ja.md b/docs/src/pages/components/selects/selects-ja.md index 2eb9e3bf49cb48..d75bd1bb606780 100644 --- a/docs/src/pages/components/selects/selects-ja.md +++ b/docs/src/pages/components/selects/selects-ja.md @@ -20,13 +20,13 @@ githubLabel: 'component: Select' 選択コンポーネントはネイティブの `<select>` 要素に入れ替えられます。 -コンボボックス、複数選択、自動補完、非同期、作成可能のサポートといったさらに高度な機能をお探しなら、[`Autocomplete`コンポーネント](/components/autocomplete/)を参照してください。 It's meant to be an improved version of the "react-select" and "downshift" packages. "react-select"と"downshift"というパッケージの改良版であることを意識しています。 +コンボボックス、複数選択、自動補完、非同期、作成可能のサポートといったさらに高度な機能をお探しなら、[`Autocomplete`コンポーネント](/components/autocomplete/)を参照してください。 "react-select"と"downshift"というパッケージの改良版であることを意識しています。 ## Props -The Select component is implemented as a custom `<input>` element of the [InputBase](/api/input-base/). It extends the [text field components](/components/text-fields) sub-components, either the [Input](/api/input/), [FilledInput](/api/filled-input/), or [OutlinedInput](/api/outlined-input/), depending on the variant selected. It shares the same styles and many of the same props. Refer to the respective component's API page for details. +Select コンポーネントは [InputBase](/api/input-base/) のカスタム `<input>`要素として実装されています。 It extends the [text field components](/components/text-fields) sub-components, either the [OutlinedInput](/api/outlined-input/), [Input](/api/input/), or [FilledInput](/api/filled-input/), depending on the variant selected. It shares the same styles and many of the same props. Refer to the respective component's API page for details. -### Filled and outlined variants +### Filled and standard variants {{"demo": "pages/components/selects/NativeSelects.js"}} @@ -56,9 +56,9 @@ The Select component is implemented as a custom `<input>` element of the [InputB ## カスタマイズされた選択 -コンポーネントのカスタマイズの例を次に示します。 詳細については、 [overrides documentation page](/customization/how-to-customize/)を参照してください。 +コンポーネントのカスタマイズの例を次に示します。 詳細については、 [こちら](/customization/how-to-customize/)を参照してください。 -To properly label your `Select` input you need an extra element with an `id` that contains a label. スタイルを設定したら、テキストフィールドとして直接使用するか、select `input` プロパティに提供して、 `select` フィールドを作成できます。 +最初のステップは、 `InputBase` コンポーネントのスタイル設定です。 スタイルを設定したら、テキストフィールドとして直接使用するか、select `input` プロパティに提供して、 `select` フィールドを作成できます。 Notice that the `"standard"` variant is easier to customize, since it does not wrap the contents in a `fieldset`/`legend` markup. {{"demo": "pages/components/selects/CustomizedSelects.js"}} @@ -68,7 +68,7 @@ To properly label your `Select` input you need an extra element with an `id` tha ## 制御開選択 -To properly label your `Select` input you need an extra element with an `id` that contains a label. To properly label your `Select` input you need an extra element with an `id` that contains a label. +`Select` コンポーネントは、複数の選択を処理できます。 To properly label your `Select` input you need an extra element with an `id` that contains a label. 単一選択の場合と同様に、 `onChange` コールバックで `event.target.value` にアクセスすることにより、新しい値を引き出すことができます。 常に配列です。 常に配列です。 常に配列です。 常に配列です。 常に配列です。 常に配列です。 @@ -112,7 +112,7 @@ Alternatively a `TextField` with an `id` and `label` creates the proper markup a ## With a dialog -Material Designの仕様では推奨されていませんが、ダイアログ内でselectを使用できます。 +While it's discouraged by the Material Design guidelines, you can use a select inside a dialog. {{"demo": "pages/components/selects/DialogSelect.js"}} diff --git a/docs/src/pages/components/selects/selects-pt.md b/docs/src/pages/components/selects/selects-pt.md index d1ff9246028709..dd331fec8aba73 100644 --- a/docs/src/pages/components/selects/selects-pt.md +++ b/docs/src/pages/components/selects/selects-pt.md @@ -24,9 +24,9 @@ Se você estiver procurando por recursos mais avançados, como combobox, seleç ## Propriedades -The Select component is implemented as a custom `<input>` element of the [InputBase](/api/input-base/). It extends the [text field components](/components/text-fields) sub-components, either the [Input](/api/input/), [FilledInput](/api/filled-input/), or [OutlinedInput](/api/outlined-input/), depending on the variant selected. It shares the same styles and many of the same props. Refer to the respective component's API page for details. +O componente seleção é implementado como um elemento `<input>` personalizado do [InputBase](/api/input-base/). It extends the [text field components](/components/text-fields) sub-components, either the [OutlinedInput](/api/outlined-input/), [Input](/api/input/), or [FilledInput](/api/filled-input/), depending on the variant selected. Ele compartilha os mesmos estilos e muitas das mesmas propriedades. Consulte a página da API do respectivo componente para obter detalhes. -### Variantes filled e outlined +### Filled and standard variants {{"demo": "pages/components/selects/SelectVariants.js"}} @@ -56,7 +56,7 @@ O componente wrapper `TextField` é um controle de formulário completo, incluin Aqui estão alguns exemplos de customização do componente. Você pode aprender mais sobre isso na [página de documentação de sobrescritas](/customization/how-to-customize/). -O primeiro passo é estilizar o componente `InputBase`. Uma vez estilizado, você pode usá-lo diretamente como um campo de texto ou fornecê-lo à propriedade `input` da seleção para ter um campo `select`. +O primeiro passo é estilizar o componente `InputBase`. Uma vez estilizado, você pode usá-lo diretamente como um campo de texto ou fornecê-lo à propriedade `input` da seleção para ter um campo `select`. Notice that the `"standard"` variant is easier to customize, since it does not wrap the contents in a `fieldset`/`legend` markup. {{"demo": "pages/components/selects/CustomizedSelects.js"}} @@ -94,7 +94,7 @@ Como na seleção única, você pode extrair o novo valor acessando `event.targe ## Com um diálogo -Embora não seja recomendado pela especificação do Material Design, você pode usar uma seleção dentro de um diálogo. +While it's discouraged by the Material Design guidelines, you can use a select inside a dialog. {{"demo": "pages/components/selects/DialogSelect.js"}} diff --git a/docs/src/pages/components/selects/selects-ru.md b/docs/src/pages/components/selects/selects-ru.md index f5e148ca8cd9c9..1118c4c0659d55 100644 --- a/docs/src/pages/components/selects/selects-ru.md +++ b/docs/src/pages/components/selects/selects-ru.md @@ -24,9 +24,9 @@ githubLabel: 'component: Select' ## Props -The Select component is implemented as a custom `<input>` element of the [InputBase](/api/input-base/). It extends the [text field components](/components/text-fields) sub-components, either the [Input](/api/input/), [FilledInput](/api/filled-input/), or [OutlinedInput](/api/outlined-input/), depending on the variant selected. It shares the same styles and many of the same props. Refer to the respective component's API page for details. +The Select component is implemented as a custom `<input>` element of the [InputBase](/api/input-base/). It extends the [text field components](/components/text-fields) sub-components, either the [OutlinedInput](/api/outlined-input/), [Input](/api/input/), or [FilledInput](/api/filled-input/), depending on the variant selected. It shares the same styles and many of the same props. Refer to the respective component's API page for details. -### Filled and outlined variants +### Filled and standard variants {{"demo": "pages/components/selects/SelectVariants.js"}} @@ -54,9 +54,9 @@ The Select component is implemented as a custom `<input>` element of the [InputB ## Кастомизированные списки -Ниже находятся примеры кастомизации компонента. You can learn more about this in the [overrides documentation page](/customization/how-to-customize/). +Ниже находятся примеры кастомизации компонента. Вы можете узнать об этом больше [в документации по переопределению свойств](/customization/how-to-customize/). -Чтобы правильно подписать ваш элемент `Select`, вам потребуется дополнительный элемент со свойством `id`. После стилизации, вы можете использовать компонент напрямую как текстовое поле, либо передать его в компонент `Select`, свойством `input`. +Чтобы правильно подписать ваш элемент `Select`, вам потребуется дополнительный элемент со свойством `id`. После стилизации, вы можете использовать компонент напрямую как текстовое поле, либо передать его в компонент `Select`, свойством `input`. Notice that the `"standard"` variant is easier to customize, since it does not wrap the contents in a `fieldset`/`legend` markup. {{"demo": "pages/components/selects/CustomizedSelects.js"}} @@ -94,7 +94,7 @@ The Select component is implemented as a custom `<input>` element of the [InputB ## Группировка -Хоть это и не приветствуется спецификацией Material Design, вы можете использовать список внутри диалогового окна. +While it's discouraged by the Material Design guidelines, you can use a select inside a dialog. {{"demo": "pages/components/selects/DialogSelect.js"}} diff --git a/docs/src/pages/components/selects/selects-zh.md b/docs/src/pages/components/selects/selects-zh.md index cbb34d729fe584..c92d24f1a9296b 100644 --- a/docs/src/pages/components/selects/selects-zh.md +++ b/docs/src/pages/components/selects/selects-zh.md @@ -10,7 +10,7 @@ githubLabel: 'component: Select' {{"component": "modules/components/ComponentLinkHeader.js"}} -## 简单的选择器 +## 基础的选择器 我们通常将菜单(Menus)放置在其所点击的元素上,这样的话能够确保当前选定的菜单项显示在点击的元素之上。 @@ -24,9 +24,9 @@ Select 组件的设计原理是和一个原生的 `<select>` 元素能够互相 ## 属性 -The Select component is implemented as a custom `<input>` element of the [InputBase](/api/input-base/). It extends the [text field components](/components/text-fields) sub-components, either the [Input](/api/input/), [FilledInput](/api/filled-input/), or [OutlinedInput](/api/outlined-input/), depending on the variant selected. It shares the same styles and many of the same props. Refer to the respective component's API page for details. It extends the [text field components](/components/text-fields) sub-components, either the [Input](/api/input/), [FilledInput](/api/filled-input/), or [OutlinedInput](/api/outlined-input/), depending on the variant selected. It shares the same styles and many of the same props. Refer to the respective component's API page for details. +选择器组件是通过自定义 [InputBase](/api/input-base/) 的 `<input>` 元素来实现的。 It extends the [text field components](/components/text-fields) sub-components, either the [OutlinedInput](/api/outlined-input/), [Input](/api/input/), or [FilledInput](/api/filled-input/), depending on the variant selected. 它有着相同的样式和许多相同的属性。 详情请参阅相应组件的 API 文档。 -### 填充(Filled)和描边(outlined)变量 +### Filled and standard variants {{"demo": "pages/components/selects/SelectVariants.js"}} @@ -56,7 +56,7 @@ The Select component is implemented as a custom `<input>` element of the [InputB 你可以参考以下一些例子来自定义组件。 您可以在 [重写文档页面](/customization/how-to-customize/) 中了解更多有关此内容的信息。 -首先,需要设置 `InputBase` 组件的样式。 一旦设置好了样式,您就可以直接将其用作文本字段,也可以将其作为一个 `select` 字段提供给 select 组件的 `input` 属性。 +首先,需要设置 `InputBase` 组件的样式。 一旦设置好了样式,您就可以直接将其用作文本字段,也可以将其作为一个 `select` 字段提供给 select 组件的 `input` 属性。 Notice that the `"standard"` variant is easier to customize, since it does not wrap the contents in a `fieldset`/`legend` markup. {{"demo": "pages/components/selects/CustomizedSelects.js"}} @@ -94,7 +94,7 @@ The Select component is implemented as a custom `<input>` element of the [InputB ## 与对话框组件(Dialog)一起使用 -虽然 Material Design 的规范不鼓励这样做,但您还是可以在对话框组件中使用选择器。 +While it's discouraged by the Material Design guidelines, you can use a select inside a dialog. {{"demo": "pages/components/selects/DialogSelect.js"}} diff --git a/docs/src/pages/components/skeleton/skeleton-de.md b/docs/src/pages/components/skeleton/skeleton-de.md index 6b3e69df510f42..3b34070b4ec382 100644 --- a/docs/src/pages/components/skeleton/skeleton-de.md +++ b/docs/src/pages/components/skeleton/skeleton-de.md @@ -74,6 +74,12 @@ loading ? ( {{"demo": "pages/components/skeleton/SkeletonChildren.js", "defaultCodeOpen": false}} +## Farbe (Color) + +The color of the component can be customized by changing its `background-color` CSS property. This is especially useful when on a black background (as the skeleton will otherwise be invisible). + +{{"demo": "pages/components/skeleton/SkeletonColor.js", "bg": "inline"}} + ## Barrierefreiheit Skeleton screens provide an alternative to the traditional spinner method. Rather than showing an abstract widget, skeleton screens create anticipation of what is to come and reduce cognitive load. diff --git a/docs/src/pages/components/skeleton/skeleton-es.md b/docs/src/pages/components/skeleton/skeleton-es.md index 17eab2f5abda04..69f26731017fd7 100644 --- a/docs/src/pages/components/skeleton/skeleton-es.md +++ b/docs/src/pages/components/skeleton/skeleton-es.md @@ -74,6 +74,12 @@ loading ? ( {{"demo": "pages/components/skeleton/SkeletonChildren.js", "defaultCodeOpen": false}} +## Color + +The color of the component can be customized by changing its `background-color` CSS property. This is especially useful when on a black background (as the skeleton will otherwise be invisible). + +{{"demo": "pages/components/skeleton/SkeletonColor.js", "bg": "inline"}} + ## Accesibilidad Skeleton screens provide an alternative to the traditional spinner method. Rather than showing an abstract widget, skeleton screens create anticipation of what is to come and reduce cognitive load. diff --git a/docs/src/pages/components/skeleton/skeleton-fr.md b/docs/src/pages/components/skeleton/skeleton-fr.md index 976c6e201a75e8..9c3f43c46f3f4d 100644 --- a/docs/src/pages/components/skeleton/skeleton-fr.md +++ b/docs/src/pages/components/skeleton/skeleton-fr.md @@ -1,5 +1,5 @@ --- -title: React Skeleton component +title: Composant React Skeleton components: Skeleton (Squelette) githubLabel: 'component: Skeleton' --- @@ -8,13 +8,13 @@ githubLabel: 'component: Skeleton' <p class="description">Display a placeholder preview of your content before the data gets loaded to reduce load-time frustration.</p> -The data for your components might not be immediately available. The data for your components might not be immediately available. It feels like things are happening immediately, then the information is incrementally displayed on the screen (Cf. [Avoid The Spinner](https://www.lukew.com/ff/entry.asp?1797)). +The data for your components might not be immediately available. Vous pouvez améliorer la réactivité perçue de la page en utilisant des Skeletons. It feels like things are happening immediately, then the information is incrementally displayed on the screen (Cf. [Avoid The Spinner](https://www.lukew.com/ff/entry.asp?1797)). {{"component": "modules/components/ComponentLinkHeader.js"}} ## Utilisation -The component is designed to be used **directly in your components**. Par exemple: +Le composant est conçu pour être utilisé **directement dans vos composants**. Par exemple: ```jsx {item ? ( @@ -32,7 +32,7 @@ The component supports 3 shape variants. ## Animations -By default, the skeleton pulsate, but you can change the animation for a wave or disable it entirely. +Par défaut, c'est le Skeleton Pulsates, mais vous pouvez changer l'animation en une vague ou la désactiver entièrement. {{"demo": "pages/components/skeleton/Animations.js"}} @@ -68,16 +68,22 @@ loading {{"demo": "pages/components/skeleton/SkeletonChildren.js", "defaultCodeOpen": false}} +## Couleur + +The color of the component can be customized by changing its `background-color` CSS property. This is especially useful when on a black background (as the skeleton will otherwise be invisible). + +{{"demo": "pages/components/skeleton/SkeletonColor.js", "bg": "inline"}} + ## Accessibilité -Skeleton screens provide an alternative to the traditional spinner method. Rather than showing an abstract widget, skeleton screens create anticipation of what is to come and reduce cognitive load. +Les écrans de Skeleton offrent une alternative à la méthode traditionnelle. Rather than showing an abstract widget, skeleton screens create anticipation of what is to come and reduce cognitive load. The background color of the skeleton uses the least amount of luminance to be visible in good conditions (good ambient light, good screen, no visual impairments). ### ARIA -None. +Aucune. ### Clavier -The skeleton is not focusable. +Le Skeleton n'est pas concentrable. diff --git a/docs/src/pages/components/skeleton/skeleton-ja.md b/docs/src/pages/components/skeleton/skeleton-ja.md index dfe0ac4ad44dd8..f3cb66ff056f17 100644 --- a/docs/src/pages/components/skeleton/skeleton-ja.md +++ b/docs/src/pages/components/skeleton/skeleton-ja.md @@ -1,5 +1,5 @@ --- -title: React Skeleton component +title: React Skeleton コンポーネント components: Skeleton githubLabel: 'component: Skeleton' --- @@ -8,7 +8,7 @@ githubLabel: 'component: Skeleton' <p class="description">データがロードされる前にコンテンツのプレースホルダープレビューを表示して、ロード時のフラストレーションを軽減します。</p> -コンポーネントのデータがすぐに利用できない場合があります。 コンポーネントのデータがすぐに利用できない場合があります。 すぐに物事が発生しているように感じ、情報が画面に徐々に表示されます(Cf. [Avoid The Spinner](https://www.lukew.com/ff/entry.asp?1797)). +コンポーネントのデータがすぐに利用できない場合があります。 スケルトンを使用することで、ページの認知応答性を向上させることができます。 すぐに物事が発生しているように感じ、情報が画面に徐々に表示されます(Cf. [Avoid The Spinner](https://www.lukew.com/ff/entry.asp?1797)). {{"component": "modules/components/ComponentLinkHeader.js"}} @@ -32,7 +32,7 @@ The component supports 3 shape variants. ## Animations -By default, the skeleton pulsate, but you can change the animation for a wave or disable it entirely. +デフォルトでは、スケルトンパルサーが表示されますが、アニメーションを波に変更したり、完全に無効にしたりできます。 {{"demo": "pages/components/skeleton/Animations.js"}} @@ -68,9 +68,15 @@ loading {{"demo": "pages/components/skeleton/SkeletonChildren.js", "defaultCodeOpen": false}} +## カラー + +The color of the component can be customized by changing its `background-color` CSS property. This is especially useful when on a black background (as the skeleton will otherwise be invisible). + +{{"demo": "pages/components/skeleton/SkeletonColor.js", "bg": "inline"}} + ## アクセシビリティ -Skeleton screens provide an alternative to the traditional spinner method. Rather than showing an abstract widget, skeleton screens create anticipation of what is to come and reduce cognitive load. +スケルトンスクリーンは、従来のスピナー方法に代わるものです。 Rather than showing an abstract widget, skeleton screens create anticipation of what is to come and reduce cognitive load. The background color of the skeleton uses the least amount of luminance to be visible in good conditions (good ambient light, good screen, no visual impairments). @@ -80,4 +86,4 @@ None. ### Keyboard -The skeleton is not focusable. +スケルトンはフォーカス可能ではありません。 diff --git a/docs/src/pages/components/skeleton/skeleton-pt.md b/docs/src/pages/components/skeleton/skeleton-pt.md index 2ed0e4952b3e6d..2a23f635f883eb 100644 --- a/docs/src/pages/components/skeleton/skeleton-pt.md +++ b/docs/src/pages/components/skeleton/skeleton-pt.md @@ -68,6 +68,12 @@ loading {{"demo": "pages/components/skeleton/SkeletonChildren.js", "defaultCodeOpen": false}} +## Cor + +The color of the component can be customized by changing its `background-color` CSS property. This is especially useful when on a black background (as the skeleton will otherwise be invisible). + +{{"demo": "pages/components/skeleton/SkeletonColor.js", "bg": "inline"}} + ## Acessibilidade Telas com skeleton fornecem uma alternativa aos métodos tradicionais de feedback. Em vez de mostrar um resumo abstrato na tela, telas com skeleton criam uma expectativa do que está por vir, reduzindo a sensação cognitiva do processo de carregamento. diff --git a/docs/src/pages/components/skeleton/skeleton-ru.md b/docs/src/pages/components/skeleton/skeleton-ru.md index 80e4ac551219c3..6696e032a5b029 100644 --- a/docs/src/pages/components/skeleton/skeleton-ru.md +++ b/docs/src/pages/components/skeleton/skeleton-ru.md @@ -68,6 +68,12 @@ loading {{"demo": "pages/components/skeleton/SkeletonChildren.js", "defaultCodeOpen": false}} +## Цвет + +The color of the component can be customized by changing its `background-color` CSS property. This is especially useful when on a black background (as the skeleton will otherwise be invisible). + +{{"demo": "pages/components/skeleton/SkeletonColor.js", "bg": "inline"}} + ## Доступность Skeleton screens provide an alternative to the traditional spinner method. Rather than showing an abstract widget, skeleton screens create anticipation of what is to come and reduce cognitive load. diff --git a/docs/src/pages/components/skeleton/skeleton-zh.md b/docs/src/pages/components/skeleton/skeleton-zh.md index 2608825538dd25..df753ce87f3179 100644 --- a/docs/src/pages/components/skeleton/skeleton-zh.md +++ b/docs/src/pages/components/skeleton/skeleton-zh.md @@ -79,6 +79,12 @@ loading ? ( {{"demo": "pages/components/skeleton/SkeletonChildren.js", "defaultCodeOpen": false}} +## Color 颜色 + +The color of the component can be customized by changing its `background-color` CSS property. This is especially useful when on a black background (as the skeleton will otherwise be invisible). + +{{"demo": "pages/components/skeleton/SkeletonColor.js", "bg": "inline"}} + ## 无障碍设计 骨架屏的动画可以代替传统转圈动画的加载方式。 骨架屏不是一个抽象的小部件,而是提供一个对未来事件的预期,来减少人们的认知负荷。 diff --git a/docs/src/pages/components/slider/slider-de.md b/docs/src/pages/components/slider/slider-de.md index 8205c5d8c4cd5a..a22ab3c05db31d 100644 --- a/docs/src/pages/components/slider/slider-de.md +++ b/docs/src/pages/components/slider/slider-de.md @@ -12,8 +12,6 @@ waiAria: 'https://www.w3.org/TR/wai-aria-practices/#slider' [Schieberegler](https://material.io/design/components/sliders.html) spiegeln einen Wertebereich entlang einer Leiste wider, aus dem Benutzer einen einzelnen Wert auswählen können. Sie sind ideal zum Anpassen von Einstellungen wie Lautstärke, Helligkeit oder Anwenden von Bildfiltern. -- 📦 [22 kB gzipped](/size-snapshot) (but only +8 kB when used together with other Material-UI components). - {{"component": "modules/components/ComponentLinkHeader.js"}} ## Kontinuierliche Schieberegler @@ -22,11 +20,15 @@ Continuous sliders allow users to select a value along a subjective range. {{"demo": "pages/components/slider/ContinuousSlider.js"}} -## Discrete sliders +## Größen + +For smaller slider, use the prop `size="small"`. -Discrete sliders can be adjusted to a specific value by referencing its value indicator. By order of demos: +{{"demo": "pages/components/slider/SliderSizes.js"}} + +## Discrete sliders -You can generate a mark for each step with `marks={true}`. +Discrete sliders can be adjusted to a specific value by referencing its value indicator. You can generate a mark for each step with `marks={true}`. {{"demo": "pages/components/slider/DiscreteSlider.js"}} @@ -60,18 +62,32 @@ The slider can be used to set the start and end of a range by supplying an array {{"demo": "pages/components/slider/RangeSlider.js"}} +### Minimum distance + +You can enforce a minimum distance between values in the `onChange` event handler. By default, when you move the pointer over a thumb while dragging another thumb, the active thumb will swap to the hovered thumb. You can disable this behavior with the `disableSwap` prop. If you want the range to shift when reaching minimum distance, you can utilize the `activeThumb` parameter in `onChange`. + +{{"demo": "pages/components/slider/MinimumDistanceSlider.js"}} + ## Slider with input field -In this example an input allows a discrete value to be set. +In this example, an input allows a discrete value to be set. {{"demo": "pages/components/slider/InputSlider.js"}} +## Farbe (Color) + +{{"demo": "pages/components/slider/ColorSlider.js"}} + ## Benutzerdefinierte Auswahl -Hier einige Beispiele zum Anpassen der Komponente. You can learn more about this in the [overrides documentation page](/customization/how-to-customize/). +Hier einige Beispiele zum Anpassen der Komponente. Weitere Informationen hierzu finden Sie auf der [Dokumentationsseite zu Overrides](/customization/how-to-customize/). {{"demo": "pages/components/slider/CustomizedSlider.js"}} +### Music player + +{{"demo": "pages/components/slider/MusicPlayerSlider.js"}} + ## Vertical sliders {{"demo": "pages/components/slider/VerticalSlider.js"}} @@ -106,7 +122,17 @@ In the following demo, the value _x_ represents the value _2^x_. Increasing _x_ {{"demo": "pages/components/slider/NonLinearSlider.js"}} -## Unstyled slider +## Unstyled + +<!-- #default-branch-switch --> + +- 📦 [5.6 kB gzipped](https://bundlephobia.com/result?p=@material-ui/unstyled@next) + +The slider also comes with an unstyled version. It's ideal for doing heavy customizations and minimizing bundle size. + +```js +import SliderUnstyled from '@material-ui/unstyled/SliderUnstyled'; +``` {{"demo": "pages/components/slider/UnstyledSlider.js"}} @@ -118,3 +144,15 @@ The component handles most of the work necessary to make it accessible. Sie müs - Each thumb has a user-friendly label (`aria-label`, `aria-labelledby` or `getAriaLabel` prop). - Each thumb has a user-friendly text for its current value. This is not required if the value matches the semantics of the label. You can change the name with the `getAriaValueText` or `aria-valuetext` prop. + +## Einschränkungen + +### IE 11 + +The slider's value label is not centered in IE 11. The alignement is not handled to make customizations easier with the lastest browsers. You can solve the issue with: + +```css +.MuiSlider-valueLabel { + left: calc(-50% - 4px); +} +``` diff --git a/docs/src/pages/components/slider/slider-es.md b/docs/src/pages/components/slider/slider-es.md index 818c4cb7c34e72..d64a80e9c8fa49 100644 --- a/docs/src/pages/components/slider/slider-es.md +++ b/docs/src/pages/components/slider/slider-es.md @@ -12,8 +12,6 @@ waiAria: 'https://www.w3.org/TR/wai-aria-practices/#slider' [Sliders](https://material.io/design/components/sliders.html) reflect a range of values along a bar, from which users may select a single value. Son ideales para ajustar ajustes como volumen, brillo o aplicación de filtros de imagen. -- 📦 [22 kB gzipped](/size-snapshot) (pero solo +8 kB cuando se usa junto con otros componentes de Material-UI). - {{"component": "modules/components/ComponentLinkHeader.js"}} ## Deslizadores continuos @@ -22,11 +20,15 @@ Los deslizadores continuos permiten a los usuarios seleccionar un valor a lo lar {{"demo": "pages/components/slider/ContinuousSlider.js"}} -## Deslizadores discretos +## Tamaños + +For smaller slider, use the prop `size="small"`. -Los deslizadores discretos pueden ser ajustados a un valor específico haciendo referencia a su indicador de valor. Por orden de demos: +{{"demo": "pages/components/slider/SliderSizes.js"}} + +## Deslizadores discretos -Puedes generar una marca para cada paso con `marks={true}`. +Los deslizadores discretos pueden ser ajustados a un valor específico haciendo referencia a su indicador de valor. Puedes generar una marca para cada paso con `marks={true}`. {{"demo": "pages/components/slider/DiscreteSlider.js"}} @@ -60,18 +62,32 @@ The slider can be used to set the start and end of a range by supplying an array {{"demo": "pages/components/slider/RangeSlider.js"}} +### Minimum distance + +You can enforce a minimum distance between values in the `onChange` event handler. By default, when you move the pointer over a thumb while dragging another thumb, the active thumb will swap to the hovered thumb. You can disable this behavior with the `disableSwap` prop. If you want the range to shift when reaching minimum distance, you can utilize the `activeThumb` parameter in `onChange`. + +{{"demo": "pages/components/slider/MinimumDistanceSlider.js"}} + ## Deslizador con campo de entrada -In this example an input allows a discrete value to be set. +In this example, an input allows a discrete value to be set. {{"demo": "pages/components/slider/InputSlider.js"}} +## Color + +{{"demo": "pages/components/slider/ColorSlider.js"}} + ## Deslizadores personalizados Here are some examples of customizing the component. Puedes aprender más sobre esto en la [sección Personalizando Componentes de la documentación](/customization/how-to-customize/). {{"demo": "pages/components/slider/CustomizedSlider.js"}} +### Music player + +{{"demo": "pages/components/slider/MusicPlayerSlider.js"}} + ## Deslizadores verticales {{"demo": "pages/components/slider/VerticalSlider.js"}} @@ -106,7 +122,17 @@ In the following demo, the value _x_ represents the value _2^x_. Increasing _x_ {{"demo": "pages/components/slider/NonLinearSlider.js"}} -## Slider sin estilo +## Unstyled + +<!-- #default-branch-switch --> + +- 📦 [5.6 kB comprimido](https://bundlephobia.com/result?p=@material-ui/unstyled@next) + +The slider also comes with an unstyled version. It's ideal for doing heavy customizations and minimizing bundle size. + +```js +import SliderUnstyled from '@material-ui/unstyled/SliderUnstyled'; +``` {{"demo": "pages/components/slider/UnstyledSlider.js"}} @@ -118,3 +144,15 @@ The component handles most of the work necessary to make it accessible. However, - Each thumb has a user-friendly label (`aria-label`, `aria-labelledby` or `getAriaLabel` prop). - Each thumb has a user-friendly text for its current value. This is not required if the value matches the semantics of the label. You can change the name with the `getAriaValueText` or `aria-valuetext` prop. + +## Limitaciones + +### IE 11 + +The slider's value label is not centered in IE 11. The alignement is not handled to make customizations easier with the lastest browsers. You can solve the issue with: + +```css +.MuiSlider-valueLabel { + left: calc(-50% - 4px); +} +``` diff --git a/docs/src/pages/components/slider/slider-fr.md b/docs/src/pages/components/slider/slider-fr.md index 8a26dd980b92a5..13b2ab5c4c6509 100644 --- a/docs/src/pages/components/slider/slider-fr.md +++ b/docs/src/pages/components/slider/slider-fr.md @@ -1,5 +1,5 @@ --- -title: React Slider component +title: Composant React Sider components: Slider, SliderUnstyled githubLabel: 'component: Slider' materialDesign: https://material.io/components/sliders @@ -12,8 +12,6 @@ waiAria: 'https://www.w3.org/TR/wai-aria-practices/#slider' [Les curseurs](https://material.io/design/components/sliders.html) reflètent une plage de valeurs sur une barre, à partir de laquelle les utilisateurs peuvent sélectionner une seule valeur. Ils sont idéaux pour ajuster des paramètres tels que le volume, la luminosité ou l'application de filtres d'images. -- 📦 [22 kB gzipped](/size-snapshot) (but only +8 kB when used together with other Material-UI components). - {{"component": "modules/components/ComponentLinkHeader.js"}} ## Continuous sliders @@ -22,11 +20,15 @@ Continuous sliders allow users to select a value along a subjective range. {{"demo": "pages/components/slider/ContinuousSlider.js"}} -## Discrete sliders +## Tailles -Discrete sliders can be adjusted to a specific value by referencing its value indicator. By order of demos: +For smaller slider, use the prop `size="small"`. + +{{"demo": "pages/components/slider/SliderSizes.js"}} + +## Discrete sliders -You can generate a mark for each step with `marks={true}`. +Discrete sliders can be adjusted to a specific value by referencing its value indicator. You can generate a mark for each step with `marks={true}`. {{"demo": "pages/components/slider/DiscreteSlider.js"}} @@ -60,25 +62,39 @@ The slider can be used to set the start and end of a range by supplying an array {{"demo": "pages/components/slider/RangeSlider.js"}} -## Slider with input field +### Minimum distance + +You can enforce a minimum distance between values in the `onChange` event handler. By default, when you move the pointer over a thumb while dragging another thumb, the active thumb will swap to the hovered thumb. You can disable this behavior with the `disableSwap` prop. If you want the range to shift when reaching minimum distance, you can utilize the `activeThumb` parameter in `onChange`. In this example an input allows a discrete value to be set. +## Slider with input field + +In this example, an input allows a discrete value to be set. + {{"demo": "pages/components/slider/InputSlider.js"}} +## Couleur + +{{"demo": "pages/components/slider/ColorSlider.js"}} + ## Curseurs personnalisés Here are some examples of customizing the component. Vous pouvez en apprendre plus à ce sujet dans la [page de documentation](/customization/how-to-customize/). {{"demo": "pages/components/slider/CustomizedSlider.js"}} +### Lecteur de musique + +{{"demo": "pages/components/slider/MusicPlayerSlider.js"}} + ## Vertical sliders {{"demo": "pages/components/slider/VerticalSlider.js"}} -**WARNING**: Chrome, Safari and newer Edge versions i.e. any browser based on WebKit exposes `<Slider orientation="vertical" />` as horizontal ([chromium issue #1158217](https://bugs.chromium.org/p/chromium/issues/detail?id=1158217)). By applying `-webkit-appearance: slider-vertical;` the slider is exposed as vertical. +**AVERTISSEMENT** : Chrome, Safari et les versions plus récentes d'Edge, c'est-à-dire que tout navigateur basé sur WebKit expose `<Slider orientation="vertical" />` comme horizontal ([problème de chrome #1158217](https://bugs.chromium.org/p/chromium/issues/detail?id=1158217)). En appliquant la propriété `-webkit-appearance: slider-vertical;` le curseur est exposé comme vertical. -However, by applying `-webkit-appearance: slider-vertical;` keyboard navigation for horizontal keys (<kbd class="key">Arrow Left</kbd>, <kbd class="key">Arrow Right</kbd>) is reversed ([chromium issue #1162640](https://bugs.chromium.org/p/chromium/issues/detail?id=1162640)). Usually, up and right should increase and left and down should decrease the value. If you apply `-webkit-appearance` you could prevent keyboard navigation for horizontal arrow keys for a truly vertical slider. This might be less confusing to users compared to a change in direction. +En appliquant la propriétés `-webkit-appearance: slider-vertical;` la navigation au clavier pour les touches horizontales (<kbd class="key">flèche gauche</kbd>, <kbd class="key">flèche droite</kbd>) est inversée ([problème de chrome #1162640](https://bugs. chromium.org/p/chromium/issues/detail?id=1162640)). Habituellement, haut et droite devrait augmenter, gauche et bas devrait diminuer la valeur. Si vous appliquez `-webkit-appearance` vous pouvez empêcher la navigation du clavier pour les touches fléchées horizontales pour un curseur vraiment vertical. Cela peut être moins déroutant pour les utilisateurs par rapport à un changement de direction. {{"demo": "pages/components/slider/VerticalAccessibleSlider.js"}} @@ -102,11 +118,21 @@ The track can be inverted with `track="inverted"`. You can use the `scale` prop to represent the `value` on a different scale. -In the following demo, the value _x_ represents the value _2^x_. Increasing _x_ by one increases the represented value by factor _2_. +Dans la démo suivante, la valeur _x_ représente la valeur _2^x_. Chaque augmentation de _x_ est multiplié par _2_ pour chaque nouvelle valeur. {{"demo": "pages/components/slider/NonLinearSlider.js"}} -## Unstyled slider +## Unstyled + +<!-- #default-branch-switch --> + +- 📦 [22 kB gzipped](/size-snapshot) (but only +8 kB when used together with other Material-UI components). + +The slider also comes with an unstyled version. It's ideal for doing heavy customizations and minimizing bundle size. + +```js +import SliderUnstyled from '@material-ui/unstyled/SliderUnstyled'; +``` {{"demo": "pages/components/slider/UnstyledSlider.js"}} @@ -118,3 +144,15 @@ The component handles most of the work necessary to make it accessible. However, - Each thumb has a user-friendly label (`aria-label`, `aria-labelledby` or `getAriaLabel` prop). - Each thumb has a user-friendly text for its current value. This is not required if the value matches the semantics of the label. You can change the name with the `getAriaValueText` or `aria-valuetext` prop. + +## Limites + +### IE11 + +Le libellé de la valeur du curseur n'est pas centré dans IE 11. L'alignement n'est pas géré pour faciliter la personnalisation avec les derniers navigateurs. Vous pouvez résoudre ce problème avec: + +```css +.MuiSlider-valueLabel { + left: calc(-50% - 4px); +} +``` diff --git a/docs/src/pages/components/slider/slider-ja.md b/docs/src/pages/components/slider/slider-ja.md index 61bc08eea65206..826ccef5f5a80e 100644 --- a/docs/src/pages/components/slider/slider-ja.md +++ b/docs/src/pages/components/slider/slider-ja.md @@ -10,9 +10,7 @@ waiAria: 'https://www.w3.org/TR/wai-aria-practices/#slider' <p class="description">スライダーを使用すると、ユーザーは値の範囲から選択できます。</p> -[Sliders](https://material.io/design/components/sliders.html) reflect a range of values along a bar, from which users may select a single value. ボリューム、輝度などの設定を調整したり、画像フィルターを適用したりするのに理想的です。 - -- 📦 [22 kB gzipped](/size-snapshot) (but only +8 kB when used together with other Material-UI components). +[Sliders](https://material.io/design/components/sliders.html) reflect a range of values along a bar, from which users may select a single value. 音量、明るさ、画像フィルタの適用などの設定を調整するのに最適です。 {{"component": "modules/components/ComponentLinkHeader.js"}} @@ -22,11 +20,15 @@ waiAria: 'https://www.w3.org/TR/wai-aria-practices/#slider' {{"demo": "pages/components/slider/ContinuousSlider.js"}} -## 個別のスライダー +## サイズ + +小さいスライダーの場合は、`size="small"` を設定してください。 -個別のスライダーは、値インジケーターを参照することで特定の値に調整できます。 デモ順: +{{"demo": "pages/components/slider/SliderSizes.js"}} + +## 個別のスライダー -`marks={true}`で各ステップのマークを生成できます。 +個別のスライダーは、値インジケーターを参照することで特定の値に調整できます。 `marks={true}`で各ステップのマークを生成できます。 {{"demo": "pages/components/slider/DiscreteSlider.js"}} @@ -44,7 +46,7 @@ waiAria: 'https://www.w3.org/TR/wai-aria-practices/#slider' ### Restricted values -選択可能な値を、 `marks` prop with `step ={null}`で、提供される値に制限できます。 +`step={null}` を追加すると、選択可能な値を `marks` プロパティで指定した値に制限できます。 {{"demo": "pages/components/slider/DiscreteSliderValues.js"}} @@ -56,27 +58,41 @@ waiAria: 'https://www.w3.org/TR/wai-aria-practices/#slider' ## Range slider -The slider can be used to set the start and end of a range by supplying an array of values to the `value` prop. +スライダーを使用して、 `value` プロパティに値の配列を供給することで、範囲の開始と終了を設定できます。 {{"demo": "pages/components/slider/RangeSlider.js"}} +### Minimum distance + +`onChange` イベントハンドラー内の値の範囲を最小にするように強制できます。 デフォルトでは、あるつまみをドラッグしている途中に、別のつまみにポインタを移動すると、アクティブなつまみとホバリングしたつまみが入れ替わります。 `disableTouchListener` プロパティでこの機能を無効にできます。 最小距離に達した場合でも範囲を移動させたい場合は、 `onChange` で `activeThumb` パラメータを使います。 + +{{"demo": "pages/components/slider/MinimumDistanceSlider.js"}} + ## Slider with input field -In this example an input allows a discrete value to be set. +この例では、入力によって離散値を設定することができます。 {{"demo": "pages/components/slider/InputSlider.js"}} +## カラー + +{{"demo": "pages/components/slider/ColorSlider.js"}} + ## Customized sliders -コンポーネントのカスタマイズの例を次に示します。 詳細については、 [オーバーライドドキュメントページ](/customization/how-to-customize/)ご覧ください。 +コンポーネントのカスタマイズの例を次に示します。 詳細については、 [オーバーライドについてのドキュメント](/customization/how-to-customize/) を参照してください。 {{"demo": "pages/components/slider/CustomizedSlider.js"}} +### 音楽プレーヤー + +{{"demo": "pages/components/slider/MusicPlayerSlider.js"}} + ## 垂直スライダー {{"demo": "pages/components/slider/VerticalSlider.js"}} -**WARNING**: Chrome, Safari and newer Edge versions i.e. any browser based on WebKit exposes `<Slider orientation="vertical" />` as horizontal ([chromium issue #1158217](https://bugs.chromium.org/p/chromium/issues/detail?id=1158217)). By applying `-webkit-appearance: slider-vertical;` the slider is exposed as vertical. +**警告**: Chrome, Safari、および新しいEdgeバージョンなど WebKitをベースにしたすべてのブラウザでは、** ** `<Slider orientation="vertical" />` 水平方向([chromium issue #1158217](https://bugs.chromium.org/p/chromium/issues/detail?id=1158217) )に公開されます。 By applying `-webkit-appearance: slider-vertical;` the slider is exposed as vertical. However, by applying `-webkit-appearance: slider-vertical;` keyboard navigation for horizontal keys (<kbd class="key">Arrow Left</kbd>, <kbd class="key">Arrow Right</kbd>) is reversed ([chromium issue #1162640](https://bugs.chromium.org/p/chromium/issues/detail?id=1162640)). Usually, up and right should increase and left and down should decrease the value. If you apply `-webkit-appearance` you could prevent keyboard navigation for horizontal arrow keys for a truly vertical slider. This might be less confusing to users compared to a change in direction. @@ -84,29 +100,39 @@ However, by applying `-webkit-appearance: slider-vertical;` keyboard navigation ## Track -The track shows the range available for user selection. +Trackは、ユーザーが選択可能な範囲を表示します。 ### Removed track -The track can be turned off with `track={false}`. +`track={false}` でTrackをオフにできます。 {{"demo": "pages/components/slider/TrackFalseSlider.js"}} ### Inverted track -The track can be inverted with `track="inverted"`. +`track="inverted"` でTrackを反転できます。 {{"demo": "pages/components/slider/TrackInvertedSlider.js"}} ## Non-linear scale -You can use the `scale` prop to represent the `value` on a different scale. +`scale` プロパティを使用して、異なるスケールの `value` を表すことができます。 In the following demo, the value _x_ represents the value _2^x_. Increasing _x_ by one increases the represented value by factor _2_. {{"demo": "pages/components/slider/NonLinearSlider.js"}} -## Unstyled slider +## Unstyled + +<!-- #default-branch-switch --> + +- 📦 [5.6 kB gzipped](https://bundlephobia.com/result?p=@material-ui/unstyled@next) + +The slider also comes with an unstyled version. It's ideal for doing heavy customizations and minimizing bundle size. + +```js +import SliderUnstyled from '@material-ui/unstyled/SliderUnstyled'; +``` {{"demo": "pages/components/slider/UnstyledSlider.js"}} @@ -114,7 +140,19 @@ In the following demo, the value _x_ represents the value _2^x_. Increasing _x_ (WAI-ARIA: https://www.w3.org/TR/wai-aria-practices/#slider) -コンポーネントは、アクセス可能にするために必要なほとんどの作業を処理します。 ただし、次の点を確認する必要があります。 ただし、次の点を確認する必要があります。 ただし、次の点を確認する必要があります。 +コンポーネントは、アクセス可能にするために必要なほとんどの作業を処理します。 ただし、次の点を確認する必要があります。 + +- それぞれのつまみがユーザーフレンドリーなラベル(`aria-label`, `aria-labelledby` または `getAriaLabel` プロパティ)を持っていること +- それぞれのつまみが、現在の値をユーザーフレンドリーなテキストで示していること。 値がラベルのセマンティクスと一致する場合、これは必要ありません。 この名前は、 `getAriaValueText`または`aria-valuetext`プロパティを使用して変更できます。 + +## 制限事項 + +### IE 11 + +The slider's value label is not centered in IE 11. The alignement is not handled to make customizations easier with the lastest browsers. You can solve the issue with: -- Each thumb has a user-friendly label (`aria-label`, `aria-labelledby` or `getAriaLabel` prop). -- Each thumb has a user-friendly text for its current value. 値がラベルのセマンティクスと一致する場合、これは必要ありません。 この名前は、 `getAriaValueText`または`aria-valuetext`プロパティを使用して変更できます。 +```css +.MuiSlider-valueLabel { + left: calc(-50% - 4px); +} +``` diff --git a/docs/src/pages/components/slider/slider-pt.md b/docs/src/pages/components/slider/slider-pt.md index 67fdc79f857cb3..3c189edb2b92df 100644 --- a/docs/src/pages/components/slider/slider-pt.md +++ b/docs/src/pages/components/slider/slider-pt.md @@ -12,8 +12,6 @@ waiAria: 'https://www.w3.org/TR/wai-aria-practices/#slider' [Sliders](https://material.io/design/components/sliders.html) refletem um intervalo de valores ao longo de uma barra, a partir do qual os usuários podem selecionar um único valor. Eles são ideais para ajustar configurações como volume, brilho ou aplicação de filtros de imagem. -- 📦 [22 kB gzipped](/size-snapshot) (mas apenas +8 kB quando usado junto com outros componentes de Material-UI). - {{"component": "modules/components/ComponentLinkHeader.js"}} ## Sliders contínuos @@ -22,11 +20,15 @@ Os sliders contínuos permitem que os usuários selecionem um valor ao longo de {{"demo": "pages/components/slider/ContinuousSlider.js"}} -## Sliders discretos +## Tamanhos + +For smaller slider, use the prop `size="small"`. -Os sliders discretos podem ser ajustados para um valor específico, fazendo referência ao seu indicador de valor. Por ordem de demonstrações: +{{"demo": "pages/components/slider/SliderSizes.js"}} + +## Sliders discretos -Você pode gerar uma marca para cada etapa com `marks={true}`. +Os sliders discretos podem ser ajustados para um valor específico, fazendo referência ao seu indicador de valor. Você pode gerar uma marca para cada etapa com `marks={true}`. {{"demo": "pages/components/slider/DiscreteSlider.js"}} @@ -60,23 +62,37 @@ O slider pode ser usado para definir o início e o fim de um intervalo, fornecen {{"demo": "pages/components/slider/RangeSlider.js"}} +### Minimum distance + +You can enforce a minimum distance between values in the `onChange` event handler. By default, when you move the pointer over a thumb while dragging another thumb, the active thumb will swap to the hovered thumb. You can disable this behavior with the `disableSwap` prop. If you want the range to shift when reaching minimum distance, you can utilize the `activeThumb` parameter in `onChange`. + +{{"demo": "pages/components/slider/MinimumDistanceSlider.js"}} + ## Slider com campo de entrada -Neste exemplo, um campo de entrada permite que um valor seja definido. +In this example, an input allows a discrete value to be set. {{"demo": "pages/components/slider/InputSlider.js"}} +## Cor + +{{"demo": "pages/components/slider/ColorSlider.js"}} + ## Sliders customizados Aqui estão alguns exemplos de customização do componente. Você pode aprender mais sobre isso na [página de documentação de sobrescritas](/customization/how-to-customize/). {{"demo": "pages/components/slider/CustomizedSlider.js"}} +### Music player + +{{"demo": "pages/components/slider/MusicPlayerSlider.js"}} + ## Sliders verticais {{"demo": "pages/components/slider/VerticalSlider.js"}} -**WARNING**: Chrome, Safari and newer Edge versions i.e. any browser based on WebKit exposes `<Slider orientation="vertical" />` as horizontal ([chromium issue #1158217](https://bugs.chromium.org/p/chromium/issues/detail?id=1158217)). By applying `-webkit-appearance: slider-vertical;` the slider is exposed as vertical. +**AVISO**: versões do Chrome, Safari e do Edge mais recente, ou seja, qualquer navegador baseado no WebKit exibe `<Slider orientation="vertical" />` horizontal ([de chromium issue #1158217](https://bugs.chromium.org/p/chromium/issues/detail?id=1158217)). Aplicando-se `-webkit-appearance: slider-vertical;` o slider é exibido vertical. However, by applying `-webkit-appearance: slider-vertical;` keyboard navigation for horizontal keys (<kbd class="key">Arrow Left</kbd>, <kbd class="key">Arrow Right</kbd>) is reversed ([chromium issue #1162640](https://bugs.chromium.org/p/chromium/issues/detail?id=1162640)). Usually, up and right should increase and left and down should decrease the value. If you apply `-webkit-appearance` you could prevent keyboard navigation for horizontal arrow keys for a truly vertical slider. This might be less confusing to users compared to a change in direction. @@ -106,7 +122,17 @@ Na seguinte demonstração, o valor _x_ representa o valor _2^x_. Acrescentar em {{"demo": "pages/components/slider/NonLinearSlider.js"}} -## Slider sem estilo +## Unstyled + +<!-- #default-branch-switch --> + +- 📦 [5.6 kB gzipped](https://bundlephobia.com/result?p=@material-ui/unstyled@next) + +The slider also comes with an unstyled version. It's ideal for doing heavy customizations and minimizing bundle size. + +```js +import SliderUnstyled from '@material-ui/unstyled/SliderUnstyled'; +``` {{"demo": "pages/components/slider/UnstyledSlider.js"}} @@ -118,3 +144,15 @@ O componente lida com a maior parte do trabalho necessário para torná-lo acess - Cada marcador possua propriedades de rótulo amigável para o usuário (`aria-label`, `aria-labelledby` ou `getAriaLabel`). - Cada marcador tenha um texto amigável para o seu valor atual. Isso não é necessário se o valor corresponder ao rótulo exibido no slider. Você pode alterar o nome com as propriedades `getAriaValueText` ou `aria-valuetext`. + +## Limitações + +### IE 11 + +The slider's value label is not centered in IE 11. The alignement is not handled to make customizations easier with the lastest browsers. You can solve the issue with: + +```css +.MuiSlider-valueLabel { + left: calc(-50% - 4px); +} +``` diff --git a/docs/src/pages/components/slider/slider-ru.md b/docs/src/pages/components/slider/slider-ru.md index 32f7bf327677bd..742bece6c1774f 100644 --- a/docs/src/pages/components/slider/slider-ru.md +++ b/docs/src/pages/components/slider/slider-ru.md @@ -12,8 +12,6 @@ waiAria: 'https://www.w3.org/TR/wai-aria-practices/#slider' [Sliders](https://material.io/design/components/sliders.html) reflect a range of values along a bar, from which users may select a single value. They are ideal for adjusting settings such as volume, brightness, or applying image filters. -- 📦 [22 kB gzipped](/size-snapshot) (but only +8 kB when used together with other Material-UI components). - {{"component": "modules/components/ComponentLinkHeader.js"}} ## Continuous sliders @@ -22,11 +20,15 @@ Continuous sliders allow users to select a value along a subjective range. {{"demo": "pages/components/slider/ContinuousSlider.js"}} -## Discrete sliders +## Размеры + +For smaller slider, use the prop `size="small"`. -Discrete sliders can be adjusted to a specific value by referencing its value indicator. By order of demos: +{{"demo": "pages/components/slider/SliderSizes.js"}} + +## Discrete sliders -You can generate a mark for each step with `marks={true}`. +Discrete sliders can be adjusted to a specific value by referencing its value indicator. You can generate a mark for each step with `marks={true}`. {{"demo": "pages/components/slider/DiscreteSlider.js"}} @@ -60,18 +62,32 @@ The slider can be used to set the start and end of a range by supplying an array {{"demo": "pages/components/slider/RangeSlider.js"}} +### Minimum distance + +You can enforce a minimum distance between values in the `onChange` event handler. By default, when you move the pointer over a thumb while dragging another thumb, the active thumb will swap to the hovered thumb. You can disable this behavior with the `disableSwap` prop. If you want the range to shift when reaching minimum distance, you can utilize the `activeThumb` parameter in `onChange`. + +{{"demo": "pages/components/slider/MinimumDistanceSlider.js"}} + ## Slider with input field -In this example an input allows a discrete value to be set. +In this example, an input allows a discrete value to be set. {{"demo": "pages/components/slider/InputSlider.js"}} +## Цвет + +{{"demo": "pages/components/slider/ColorSlider.js"}} + ## Customized sliders Ниже находятся примеры кастомизации компонента. You can learn more about this in the [overrides documentation page](/customization/how-to-customize/). {{"demo": "pages/components/slider/CustomizedSlider.js"}} +### Music player + +{{"demo": "pages/components/slider/MusicPlayerSlider.js"}} + ## Vertical sliders {{"demo": "pages/components/slider/VerticalSlider.js"}} @@ -106,7 +122,17 @@ In the following demo, the value _x_ represents the value _2^x_. Increasing _x_ {{"demo": "pages/components/slider/NonLinearSlider.js"}} -## Unstyled slider +## Unstyled + +<!-- #default-branch-switch --> + +- 📦 [5.6 kB gzipped](https://bundlephobia.com/result?p=@material-ui/unstyled@next) + +The slider also comes with an unstyled version. It's ideal for doing heavy customizations and minimizing bundle size. + +```js +import SliderUnstyled from '@material-ui/unstyled/SliderUnstyled'; +``` {{"demo": "pages/components/slider/UnstyledSlider.js"}} @@ -118,3 +144,15 @@ The component handles most of the work necessary to make it accessible. However, - Each thumb has a user-friendly label (`aria-label`, `aria-labelledby` or `getAriaLabel` prop). - Each thumb has a user-friendly text for its current value. This is not required if the value matches the semantics of the label. You can change the name with the `getAriaValueText` or `aria-valuetext` prop. + +## Ограничения + +### IE 11 + +The slider's value label is not centered in IE 11. The alignement is not handled to make customizations easier with the lastest browsers. You can solve the issue with: + +```css +.MuiSlider-valueLabel { + left: calc(-50% - 4px); +} +``` diff --git a/docs/src/pages/components/slider/slider-zh.md b/docs/src/pages/components/slider/slider-zh.md index 31160351179c00..171d08c7dc0fcb 100644 --- a/docs/src/pages/components/slider/slider-zh.md +++ b/docs/src/pages/components/slider/slider-zh.md @@ -12,8 +12,6 @@ waiAria: 'https://www.w3.org/TR/wai-aria-practices/#slider' 滑块反映了一根条上的一系列值,用户可以从中选择单个值。 它们通常适用于调节一些设置,譬如调节设备音量、调整屏幕亮度,或者改变图像的滤镜。 -- 📦 [22 kB 压缩大小](/size-snapshot) (但与其他 Material-UI 组件使用时只有+8 kB)。 - {{"component": "modules/components/ComponentLinkHeader.js"}} ## 连续滑块(Continuous sliders) @@ -22,11 +20,15 @@ waiAria: 'https://www.w3.org/TR/wai-aria-practices/#slider' {{"demo": "pages/components/slider/ContinuousSlider.js"}} -## 间续滑块(Discrete sliders) +## 尺寸 + +For smaller slider, use the prop `size="small"`. -用户可以通过参考其值指示器,来将间续滑块调整为某一特定值。 以下是一些案例: +{{"demo": "pages/components/slider/SliderSizes.js"}} + +## 间续滑块(Discrete sliders) -通过设置 `marks={true}`,你可以针对每个步骤产生一个标记(mark)。 +用户可以通过参考其值指示器,来将间续滑块调整为某一特定值。 通过设置 `marks={true}`,你可以针对每个步骤产生一个标记(mark)。 {{"demo": "pages/components/slider/DiscreteSlider.js"}} @@ -60,25 +62,39 @@ waiAria: 'https://www.w3.org/TR/wai-aria-practices/#slider' {{"demo": "pages/components/slider/RangeSlider.js"}} +### Minimum distance + +You can enforce a minimum distance between values in the `onChange` event handler. By default, when you move the pointer over a thumb while dragging another thumb, the active thumb will swap to the hovered thumb. You can disable this behavior with the `disableSwap` prop. If you want the range to shift when reaching minimum distance, you can utilize the `activeThumb` parameter in `onChange`. + +{{"demo": "pages/components/slider/MinimumDistanceSlider.js"}} + ## 带输入框的滑块组件 -在这个例子中,我们允许给输入框设置一个离散值。 +In this example, an input allows a discrete value to be set. {{"demo": "pages/components/slider/InputSlider.js"}} +## Color 颜色 + +{{"demo": "pages/components/slider/ColorSlider.js"}} + ## 自定义滑块 你可以参考以下一些例子来自定义组件。 您可以在 [重写文档页面](/customization/how-to-customize/) 中了解更多有关此内容的信息。 {{"demo": "pages/components/slider/CustomizedSlider.js"}} +### Music player + +{{"demo": "pages/components/slider/MusicPlayerSlider.js"}} + ## 纵向滑块 {{"demo": "pages/components/slider/VerticalSlider.js"}} -**WARNING**: Chrome, Safari and newer Edge versions i.e. any browser based on WebKit exposes `<Slider orientation="vertical" />` as horizontal ([chromium issue #1158217](https://bugs.chromium.org/p/chromium/issues/detail?id=1158217)). By applying `-webkit-appearance: slider-vertical;` the slider is exposed as vertical. +**警告**: Chrome、Safari 和较新的 Edge 版本,即任何基于 WebKit 的浏览器都会将 `<Slider orientation="vertical" />` 暴露为水平状态([chromium 问题 #1158217](https://bugs.chromium.org/p/chromium/issues/detail?id=1158217))。 通过应用 `-webkit-appearance: slider-vertical;` 将滑块显示为垂直。 -However, by applying `-webkit-appearance: slider-vertical;` keyboard navigation for horizontal keys (<kbd class="key">Arrow Left</kbd>, <kbd class="key">Arrow Right</kbd>) is reversed ([chromium issue #1162640](https://bugs.chromium.org/p/chromium/issues/detail?id=1162640)). Usually, up and right should increase and left and down should decrease the value. If you apply `-webkit-appearance` you could prevent keyboard navigation for horizontal arrow keys for a truly vertical slider. This might be less confusing to users compared to a change in direction. +然而,应用 `-webkit-appearance: slider-vertical;` 之后会导致水平键的键盘导航(<kbd class="key">向左箭头</kbd>,<kbd class="key">向右箭头</kbd>)被反转([chromium 问题 #1162640](https://bugs.chromium.org/p/chromium/issues/detail?id=1162640))。 通常情况下,向上、向右应增加,向左、向下应减少数值。 如果你应用 `-webkit-appearance`,那么就可以阻止键盘导航水平方向键的功能,以实现真正的垂直滑块。 与改变方向相比,这可能会减少用户的困惑。 {{"demo": "pages/components/slider/VerticalAccessibleSlider.js"}} @@ -106,7 +122,17 @@ However, by applying `-webkit-appearance: slider-vertical;` keyboard navigation {{"demo": "pages/components/slider/NonLinearSlider.js"}} -## 无样式的滑块 +## Unstyled + +<!-- #default-branch-switch --> + +- 📦 [5.6kB 已压缩的包](https://bundlephobia.com/result?p=@material-ui/unstyled@next) + +The slider also comes with an unstyled version. It's ideal for doing heavy customizations and minimizing bundle size. + +```js +import SliderUnstyled from '@material-ui/unstyled/SliderUnstyled'; +``` {{"demo": "pages/components/slider/UnstyledSlider.js"}} @@ -118,3 +144,15 @@ However, by applying `-webkit-appearance: slider-vertical;` keyboard navigation - 每个滑块都带有一个方便用户的标签(`aria-label`、`aria-labelledby` 或 `getAriaLabel` 属性)。 - 每一个滑块的当前值都有一个方便用户阅读的文字。 如果值与标签的语义相匹配的话,则不需要此操作。 你可以通过`getAriaValueText` 或者 `aria-valuetext` 属性来更改名字。 + +## 设计局限 + +### IE 11 + +The slider's value label is not centered in IE 11. The alignement is not handled to make customizations easier with the lastest browsers. You can solve the issue with: + +```css +.MuiSlider-valueLabel { + left: calc(-50% - 4px); +} +``` diff --git a/docs/src/pages/components/snackbars/snackbars-de.md b/docs/src/pages/components/snackbars/snackbars-de.md index 08c1fc8c94fd66..814c1b2a1a2576 100644 --- a/docs/src/pages/components/snackbars/snackbars-de.md +++ b/docs/src/pages/components/snackbars/snackbars-de.md @@ -76,11 +76,11 @@ Für fortgeschrittenere Anwendungsfälle können Ihnen folgende Projekte helfen: ### notistack -![stars](https://img.shields.io/github/stars/iamhosseindhv/notistack.svg?style=social&label=Stars) ![npm downloads](https://img.shields.io/npm/dm/notistack.svg) +![sterne](https://img.shields.io/github/stars/iamhosseindhv/notistack.svg?style=social&label=Stars) ![npm downloads](https://img.shields.io/npm/dm/notistack.svg) -This example demonstrates how to use [notistack](https://github.com/iamhosseindhv/notistack). notistack has an **imperative API** that makes it easy to display snackbars, without having to handle their open/close state. It also enables you to **stack** them on top of one another (although this is discouraged by the Material Design specification). +This example demonstrates how to use [notistack](https://github.com/iamhosseindhv/notistack). notistack has an **imperative API** that makes it easy to display snackbars, without having to handle their open/close state. It also enables you to **stack** them on top of one another (although this is discouraged by the Material Design guidelines). -{{"demo": "pages/components/snackbars/IntegrationNotistack.js", "defaultCodeOpen": false}} +TODO: Add example once notistack is compatible with v5 or replace with [#1824](https://github.com/mui-org/material-ui/issues/1824). ## Barrierefreiheit diff --git a/docs/src/pages/components/snackbars/snackbars-es.md b/docs/src/pages/components/snackbars/snackbars-es.md index beec3584a47d50..4728f1fa384ace 100644 --- a/docs/src/pages/components/snackbars/snackbars-es.md +++ b/docs/src/pages/components/snackbars/snackbars-es.md @@ -78,9 +78,9 @@ Para usos más avanzados tal vez puedas aprovercharte de: ![estrellas](https://img.shields.io/github/stars/iamhosseindhv/notistack.svg?style=social&label=Stars) ![descargas npm](https://img.shields.io/npm/dm/notistack.svg) -Este ejemplo demuestra cómo usar [notistack](https://github.com/iamhosseindhv/notistack). notistack has an **imperative API** that makes it easy to display snackbars, without having to handle their open/close state. It also enables you to **stack** them on top of one another (although this is discouraged by the Material Design specification). +Este ejemplo demuestra cómo usar [notistack](https://github.com/iamhosseindhv/notistack). notistack has an **imperative API** that makes it easy to display snackbars, without having to handle their open/close state. It also enables you to **stack** them on top of one another (although this is discouraged by the Material Design guidelines). -{{"demo": "pages/components/snackbars/IntegrationNotistack.js", "defaultCodeOpen": false}} +TODO: Add example once notistack is compatible with v5 or replace with [#1824](https://github.com/mui-org/material-ui/issues/1824). ## Accesibilidad diff --git a/docs/src/pages/components/snackbars/snackbars-fr.md b/docs/src/pages/components/snackbars/snackbars-fr.md index 36d370ce3a28a2..bf3f195dc0c7ef 100644 --- a/docs/src/pages/components/snackbars/snackbars-fr.md +++ b/docs/src/pages/components/snackbars/snackbars-fr.md @@ -1,5 +1,5 @@ --- -title: React Snackbar component +title: Composant React Snackbar components: Snackbar, SnackbarContent githubLabel: 'component: Snackbar' materialDesign: https://material.io/components/snackbars @@ -8,9 +8,9 @@ waiAria: 'https://www.w3.org/TR/wai-aria-1.1/#alert' # Snackbar -<p class="description">Snackbars provide brief messages about app processes. The component is also known as a toast.</p> +<p class="description">Les snackbars fournissent de brèves notifications. The component is also known as a toast.</p> -[Snackbars](https://material.io/design/components/snackbars.html) inform users of a process that an app has performed or will perform. They appear temporarily, towards the bottom of the screen. They shouldn't interrupt the user experience, and they don't require user input to disappear. +Snackbars informe les utilisateurs d'une information qu'une application a effectué ou va effectuer. They appear temporarily, towards the bottom of the screen. Ils ne devraient pas interrompre l'expérience de l'utilisateur, et ne nécessitent pas de saisie de l'utilisateur pour disparaître. Snackbars contain a single line of text directly related to the operation performed. They may contain a text action, but no icons. You can use them to display notifications. @@ -78,7 +78,7 @@ Pour des cas d'utilisation plus avancés, vous pourrez peut-être tirer parti de ![stars](https://img.shields.io/github/stars/iamhosseindhv/notistack.svg?style=social&label=Stars) ![npm downloads](https://img.shields.io/npm/dm/notistack.svg) -This example demonstrates how to use [notistack](https://github.com/iamhosseindhv/notistack). notistack has an **imperative API** that makes it easy to display snackbars, without having to handle their open/close state. It also enables you to **stack** them on top of one another (although this is discouraged by the Material Design specification). +This example demonstrates how to use [notistack](https://github.com/iamhosseindhv/notistack). notistack a une API **impérative** qui facilite l'affichage de snackbars, sans avoir à gérer leur état d'ouverture/fermeture. It also enables you to **stack** them on top of one another (although this is discouraged by the Material Design specification). {{"demo": "pages/components/snackbars/IntegrationNotistack.js", "defaultCodeOpen": false}} diff --git a/docs/src/pages/components/snackbars/snackbars-ja.md b/docs/src/pages/components/snackbars/snackbars-ja.md index 8bb276cf75b0e2..44da46a8c577e9 100644 --- a/docs/src/pages/components/snackbars/snackbars-ja.md +++ b/docs/src/pages/components/snackbars/snackbars-ja.md @@ -28,7 +28,7 @@ Google Keepのスナックバーの動作を再現することを目的とした ## カスタマイズされたスナックバー -コンポーネントのカスタマイズの例を次に示します。 詳細については、 [overrides documentation page](/customization/how-to-customize/)を参照してください。 +コンポーネントのカスタマイズの例を次に示します。 詳細については、 [こちら](/customization/how-to-customize/)を参照してください。 {{"demo": "pages/components/snackbars/CustomizedSnackbars.js"}} @@ -78,9 +78,9 @@ In wide layouts, snackbars can be left-aligned or center-aligned if they are con ![Stars](https://img.shields.io/github/stars/iamhosseindhv/notistack.svg?style=social&label=Stars) ![npmダウンロード](https://img.shields.io/npm/dm/notistack.svg) -This example demonstrates how to use [notistack](https://github.com/iamhosseindhv/notistack). notistack has an **imperative API** that makes it easy to display snackbars, without having to handle their open/close state. It also enables you to **stack** them on top of one another (although this is discouraged by the Material Design specification). +This example demonstrates how to use [notistack](https://github.com/iamhosseindhv/notistack). notistack has an **imperative API** that makes it easy to display snackbars, without having to handle their open/close state. It also enables you to **stack** them on top of one another (although this is discouraged by the Material Design guidelines). -{{"demo": "pages/components/snackbars/IntegrationNotistack.js", "defaultCodeOpen": false}} +TODO: Add example once notistack is compatible with v5 or replace with [#1824](https://github.com/mui-org/material-ui/issues/1824). ## アクセシビリティ diff --git a/docs/src/pages/components/snackbars/snackbars-pt.md b/docs/src/pages/components/snackbars/snackbars-pt.md index 29098ec13ba7a5..b6583446aaf05f 100644 --- a/docs/src/pages/components/snackbars/snackbars-pt.md +++ b/docs/src/pages/components/snackbars/snackbars-pt.md @@ -78,9 +78,9 @@ Para situações de uso mais avançadas, você pode tirar proveito com: ![estrelas](https://img.shields.io/github/stars/iamhosseindhv/notistack.svg?style=social&label=Stars) ![npm downloads](https://img.shields.io/npm/dm/notistack.svg) -Este exemplo demonstra como usar com [notistack](https://github.com/iamhosseindhv/notistack). notistack tem uma **API imperativa** que facilita a exibição de snackbars, sem ter que lidar com seu estado de aberto/fechado. Também permite que você **empilhe** eles em cima um do outro (embora isso não seja recomendado pela especificação do Material Design). +Este exemplo demonstra como usar com [notistack](https://github.com/iamhosseindhv/notistack). notistack tem uma **API imperativa** que facilita a exibição de snackbars, sem ter que lidar com seu estado de aberto/fechado. It also enables you to **stack** them on top of one another (although this is discouraged by the Material Design guidelines). -{{"demo": "pages/components/snackbars/IntegrationNotistack.js", "defaultCodeOpen": false}} +TODO: Add example once notistack is compatible with v5 or replace with [#1824](https://github.com/mui-org/material-ui/issues/1824). ## Acessibilidade diff --git a/docs/src/pages/components/snackbars/snackbars-ru.md b/docs/src/pages/components/snackbars/snackbars-ru.md index 14b3f734e4832b..41b1b48727cca0 100644 --- a/docs/src/pages/components/snackbars/snackbars-ru.md +++ b/docs/src/pages/components/snackbars/snackbars-ru.md @@ -28,7 +28,7 @@ A basic snackbar that aims to reproduce Google Keep's snackbar behavior. ## Customized snackbars -Ниже находятся примеры кастомизации компонента. You can learn more about this in the [overrides documentation page](/customization/how-to-customize/). +Ниже находятся примеры кастомизации компонента. Вы можете узнать об этом больше [в документации по переопределению свойств](/customization/how-to-customize/). {{"demo": "pages/components/snackbars/CustomizedSnackbars.js"}} @@ -78,9 +78,9 @@ Snackbars should appear above FABs (on mobile). ![stars](https://img.shields.io/github/stars/iamhosseindhv/notistack.svg?style=social&label=Stars) ![npm downloads](https://img.shields.io/npm/dm/notistack.svg) -This example demonstrates how to use [notistack](https://github.com/iamhosseindhv/notistack). notistack has an **imperative API** that makes it easy to display snackbars, without having to handle their open/close state. It also enables you to **stack** them on top of one another (although this is discouraged by the Material Design specification). +This example demonstrates how to use [notistack](https://github.com/iamhosseindhv/notistack). notistack has an **imperative API** that makes it easy to display snackbars, without having to handle their open/close state. It also enables you to **stack** them on top of one another (although this is discouraged by the Material Design guidelines). -{{"demo": "pages/components/snackbars/IntegrationNotistack.js", "defaultCodeOpen": false}} +TODO: Add example once notistack is compatible with v5 or replace with [#1824](https://github.com/mui-org/material-ui/issues/1824). ## Доступность diff --git a/docs/src/pages/components/snackbars/snackbars-zh.md b/docs/src/pages/components/snackbars/snackbars-zh.md index 7248381faa2198..c4f0aabb7a5f1a 100644 --- a/docs/src/pages/components/snackbars/snackbars-zh.md +++ b/docs/src/pages/components/snackbars/snackbars-zh.md @@ -10,7 +10,7 @@ waiAria: 'https://www.w3.org/TR/wai-aria-1.1/#alert' <p class="description">消息条提供简短的通知信息。 该组件也被称为 toast。</p> -消息条将应用程序已执行或即将执行的进程通知给用户。 它们会从屏幕底部短暂地出现。 They shouldn't interrupt the user experience, and they don't require user input to disappear. +消息条将应用程序已执行或即将执行的进程通知给用户。 它们会从屏幕底部短暂地出现。 它们不应该打断用户体验,也不需要用户输入就能消失。 消息条包含了一行直接与所执行操作相关的文本。 它们可能包含一些文本操作,但并不会展示图标。 您也可以用他们展示通知。 @@ -78,9 +78,9 @@ waiAria: 'https://www.w3.org/TR/wai-aria-1.1/#alert' ![stars](https://img.shields.io/github/stars/iamhosseindhv/notistack.svg?style=social&label=Stars) ![npm下载](https://img.shields.io/npm/dm/notistack.svg) -以下例子演示了如何使用 [notistack](https://github.com/iamhosseindhv/notistack)。 notistack 有一个 **imperative API** 可以轻松地显示一串消息条,且无需处理其打开/关闭状态。 您也可以把它们 **堆叠** 在一起(尽管 Material Design 规范不鼓励这样做)。 +以下例子演示了如何使用 [notistack](https://github.com/iamhosseindhv/notistack)。 notistack 有一个 **imperative API** 可以轻松地显示一串消息条,且无需处理其打开/关闭状态。 It also enables you to **stack** them on top of one another (although this is discouraged by the Material Design guidelines). -{{"demo": "pages/components/snackbars/IntegrationNotistack.js", "defaultCodeOpen": false}} +TODO: Add example once notistack is compatible with v5 or replace with [#1824](https://github.com/mui-org/material-ui/issues/1824). ## 无障碍设计 diff --git a/docs/src/pages/components/speed-dial/speed-dial-de.md b/docs/src/pages/components/speed-dial/speed-dial-de.md index 6d1d097f5c3619..1b6c1eca7de8cc 100644 --- a/docs/src/pages/components/speed-dial/speed-dial-de.md +++ b/docs/src/pages/components/speed-dial/speed-dial-de.md @@ -2,7 +2,7 @@ title: React Speed Dial component components: SpeedDial, SpeedDialAction, SpeedDialIcon githubLabel: 'component: SpeedDial' -0: 'https://material.io/components/buttons-floating-action-button#types-of-transitions' +materialDesign: 'https://material.io/components/buttons-floating-action-button#types-of-transitions' waiAria: 'https://www.w3.org/TR/wai-aria-practices/#menubutton' --- @@ -20,6 +20,10 @@ Die schwebende Aktionstaste kann verwandte Aktionen anzeigen. {{"demo": "pages/components/speed-dial/BasicSpeedDial.js"}} +## Spielwiese + +{{"demo": "pages/components/speed-dial/PlaygroundSpeedDial.js"}} + ## Kundenspezifisches Schließsymbol Sie können ein alternatives Symbol für den geschlossenen und den geöffneten Zustand mit den `icon` und `openIcon` Eigenschaften der Komponente `SpeedDialIcon` bereitstellen. diff --git a/docs/src/pages/components/speed-dial/speed-dial-es.md b/docs/src/pages/components/speed-dial/speed-dial-es.md index 20209ac86e162a..e6ff692bbd8cb1 100644 --- a/docs/src/pages/components/speed-dial/speed-dial-es.md +++ b/docs/src/pages/components/speed-dial/speed-dial-es.md @@ -2,7 +2,7 @@ title: React Speed Dial component components: SpeedDial, SpeedDialAction, SpeedDialIcon githubLabel: 'component: SpeedDial' -0: 'https://material.io/components/buttons-floating-action-button#types-of-transitions' +materialDesign: 'https://material.io/components/buttons-floating-action-button#types-of-transitions' waiAria: 'https://www.w3.org/TR/wai-aria-practices/#menubutton' --- @@ -20,6 +20,10 @@ The floating action button can display related actions. {{"demo": "pages/components/speed-dial/BasicSpeedDial.js"}} +## Campo de pruebas + +{{"demo": "pages/components/speed-dial/PlaygroundSpeedDial.js"}} + ## Controlled speed dial You can provide an alternate icon for the closed and open states using the `icon` and `openIcon` props of the `SpeedDialIcon` component. diff --git a/docs/src/pages/components/speed-dial/speed-dial-fr.md b/docs/src/pages/components/speed-dial/speed-dial-fr.md index 79dcfd964c007e..1889961530e96a 100644 --- a/docs/src/pages/components/speed-dial/speed-dial-fr.md +++ b/docs/src/pages/components/speed-dial/speed-dial-fr.md @@ -1,8 +1,8 @@ --- -title: React Speed Dial component +title: Composant React Speed Dial components: SpeedDial, SpeedDialAction, SpeedDialIcon githubLabel: 'component: SpeedDial' -0: 'https://material.io/components/buttons-floating-action-button#types-of-transitions' +materialDesign: 'https://material.io/components/buttons-floating-action-button#types-of-transitions' waiAria: 'https://www.w3.org/TR/wai-aria-practices/#menubutton' --- @@ -20,12 +20,16 @@ The floating action button can display related actions. {{"demo": "pages/components/speed-dial/BasicSpeedDial.js"}} -## Controlled speed dial +## Playground You can provide an alternate icon for the closed and open states using the `icon` and `openIcon` props of the `SpeedDialIcon` component. +## Numérotation rapide contrôlée + The SpeedDialActions tooltips can be be displayed persistently so that users don't have to long-press in order to see the tooltip on touch devices. +You can provide an alternate icon for the closed and open states using the `icon` and `openIcon` props of the `SpeedDialIcon` component. + ## Custom close icon You can provide an alternate icon for the closed and open states using the `icon` and `openIcon` props of the `SpeedDialIcon` component. @@ -34,9 +38,9 @@ You can provide an alternate icon for the closed and open states using the `icon ## Persistent action tooltips -The SpeedDialActions tooltips can be displayed persistently so that users don't have to long-press to see the tooltip on touch devices. +Les info-bulles SpeedDialActions peuvent être affichées de manière persistante afin que les utilisateurs n'aient pas à appuyer longuement pour voir l'info-bulle sur les appareils tactiles. -It is enabled here across all devices for demo purposes, but in production it could use the `isTouch` logic to conditionally set the prop. +Il est activé ici sur tous les appareils à des fins de démonstration, mais en production, il pourrait utiliser la logique `isTouch` pour définir l'accessoire de manière conditionnelle. {{"demo": "pages/components/speed-dial/SpeedDialTooltipOpen.js"}} @@ -44,20 +48,20 @@ It is enabled here across all devices for demo purposes, but in production it co ### ARIA -#### Required +#### Obligatoire -- You should provide an `ariaLabel` for the speed dial component. -- You should provide a `tooltipTitle` for each speed dial action. +- Vous devez fournir un `ariaLabel` pour le composant de numérotation rapide. +- Vous devez fournir un `tooltipTitle` pour chaque action de numérotation rapide. -#### Provided +#### Fourni -- The Fab has `aria-haspopup`, `aria-expanded` and `aria-controls` attributes. -- The speed dial actions container has `role="menu"` and `aria-orientation` set according to the direction. -- The speed dial actions have `role="menuitem"`, and an `aria-describedby` attribute that references the associated tooltip. +- Le Fab a les attributs `aria-haspopup`, `aria-expanded` et `aria-controls`. +- Le conteneur d'actions de numérotation rapide a `role="menu"` et `aria-orientation` définis en fonction de la direction. +- Les actions de numérotation rapide ont `role="menuitem"`, et un attribut `aria-describedby` qui fait référence à l'info-bulle associée. ### Clavier -- The speed dial opens on focus. -- The Space and Enter keys trigger the selected speed dial action, and toggle the speed dial open state. -- The cursor keys move focus to the next or previous speed dial action. (Note that any cursor direction can be used initially to open the speed dial. This enables the expected behavior for the actual or perceived orientation of the speed dial, for example for a screen reader user who perceives the speed dial as a drop-down menu.) -- The Escape key closes the speed dial and, if a speed dial action was focused, returns focus to the Fab. +- Le cadran abrégé s'ouvre sur la mise au point. +- Les touches Espace et Entrée déclenchent l'action de numérotation rapide sélectionnée et basculent l'état ouvert de la numérotation rapide. +- Les touches du curseur déplacent le focus vers l'action de numérotation rapide suivante ou précédente. (Notez que n'importe quelle direction du curseur peut être utilisée initialement pour ouvrir la numérotation abrégée. Cela permet le comportement attendu pour l'orientation réelle ou perçue de la numérotation rapide, par exemple pour un utilisateur de lecteur d'écran qui perçoit la numérotation rapide comme un menu déroulant.) +- La touche Échap ferme la numérotation abrégée et, si une action de numérotation abrégée a été focalisée, renvoie la focalisation au Fab. diff --git a/docs/src/pages/components/speed-dial/speed-dial-ja.md b/docs/src/pages/components/speed-dial/speed-dial-ja.md index 4641df98bbf96c..1570f8672495bf 100644 --- a/docs/src/pages/components/speed-dial/speed-dial-ja.md +++ b/docs/src/pages/components/speed-dial/speed-dial-ja.md @@ -2,7 +2,7 @@ title: React Speed Dial component components: SpeedDial, SpeedDialAction, SpeedDialIcon githubLabel: 'component: SpeedDial' -0: 'https://material.io/components/buttons-floating-action-button#types-of-transitions' +materialDesign: 'https://material.io/components/buttons-floating-action-button#types-of-transitions' waiAria: 'https://www.w3.org/TR/wai-aria-practices/#menubutton' --- @@ -20,6 +20,10 @@ waiAria: 'https://www.w3.org/TR/wai-aria-practices/#menubutton' {{"demo": "pages/components/speed-dial/BasicSpeedDial.js"}} +## Playground + +{{"demo": "pages/components/speed-dial/PlaygroundSpeedDial.js"}} + ## カスタムcloseアイコン `SpeedDialIcon` コンポーネントの `アイコン` と `openIcon` props を使用して、閉じた状態と開いた状態の代替アイコンを提供できます。 diff --git a/docs/src/pages/components/speed-dial/speed-dial-pt.md b/docs/src/pages/components/speed-dial/speed-dial-pt.md index 64895ec0e60b20..70da8fc7daa578 100644 --- a/docs/src/pages/components/speed-dial/speed-dial-pt.md +++ b/docs/src/pages/components/speed-dial/speed-dial-pt.md @@ -2,7 +2,7 @@ title: Componente React Acesso Rápido components: SpeedDial, SpeedDialAction, SpeedDialIcon githubLabel: 'component: SpeedDial' -0: 'https://material.io/components/buttons-floating-action-button#types-of-transitions' +materialDesign: 'https://material.io/components/buttons-floating-action-button#types-of-transitions' waiAria: 'https://www.w3.org/TR/wai-aria-practices/#menubutton' --- @@ -20,6 +20,10 @@ O botão de ação flutuante pode exibir ações relacionadas. {{"demo": "pages/components/speed-dial/BasicSpeedDial.js"}} +## Área de exemplos + +{{"demo": "pages/components/speed-dial/PlaygroundSpeedDial.js"}} + ## Ícone de fechamento customizado Você pode fornecer um ícone alternativo para os estados de aberto e fechado usando as propriedades `icon` e `openIcon` do componente `SpeedDialIcon`. diff --git a/docs/src/pages/components/speed-dial/speed-dial-ru.md b/docs/src/pages/components/speed-dial/speed-dial-ru.md index 8353f642e4e6f8..d603a7bbc85395 100644 --- a/docs/src/pages/components/speed-dial/speed-dial-ru.md +++ b/docs/src/pages/components/speed-dial/speed-dial-ru.md @@ -2,7 +2,7 @@ title: React Speed Dial component components: SpeedDial, SpeedDialAction, SpeedDialIcon githubLabel: 'component: SpeedDial' -0: 'https://material.io/components/buttons-floating-action-button#types-of-transitions' +materialDesign: 'https://material.io/components/buttons-floating-action-button#types-of-transitions' waiAria: 'https://www.w3.org/TR/wai-aria-practices/#menubutton' --- @@ -20,6 +20,10 @@ waiAria: 'https://www.w3.org/TR/wai-aria-practices/#menubutton' {{"demo": "pages/components/speed-dial/BasicSpeedDial.js"}} +## Песочница + +{{"demo": "pages/components/speed-dial/PlaygroundSpeedDial.js"}} + ## Controlled speed dial You can provide an alternate icon for the closed and open states using the `icon` and `openIcon` props of the `SpeedDialIcon` component. diff --git a/docs/src/pages/components/speed-dial/speed-dial-zh.md b/docs/src/pages/components/speed-dial/speed-dial-zh.md index 2a2265e5d0619d..4676a87b6aa5d1 100644 --- a/docs/src/pages/components/speed-dial/speed-dial-zh.md +++ b/docs/src/pages/components/speed-dial/speed-dial-zh.md @@ -2,7 +2,7 @@ title: React Speed Dial(快速拨号)组件 components: SpeedDial, SpeedDialAction, SpeedDialIcon githubLabel: 'component: SpeedDial' -0: 'https://material.io/components/buttons-floating-action-button#types-of-transitions' +materialDesign: 'https://material.io/components/buttons-floating-action-button#types-of-transitions' waiAria: 'https://www.w3.org/TR/wai-aria-practices/#menubutton' --- @@ -20,6 +20,10 @@ waiAria: 'https://www.w3.org/TR/wai-aria-practices/#menubutton' {{"demo": "pages/components/speed-dial/BasicSpeedDial.js"}} +## 练习 + +{{"demo": "pages/components/speed-dial/PlaygroundSpeedDial.js"}} + ## 自定义关闭图标 您可以使用 `SpeedDialIcon` 组件的 `图标` 和 `openIcon` 道具 为关闭和打开状态提供备用图标。 diff --git a/docs/src/pages/components/stack/stack-de.md b/docs/src/pages/components/stack/stack-de.md new file mode 100644 index 00000000000000..7b2304b266414f --- /dev/null +++ b/docs/src/pages/components/stack/stack-de.md @@ -0,0 +1,51 @@ +--- +title: React Stack component +components: Stack +githubLabel: 'component: Stack' +--- + +# Stack + +<p class="description">The Stack component manages layout of immediate children along the vertical or horizontal axis with optional spacing and/or dividers between each child.</p> + +{{"component": "modules/components/ComponentLinkHeader.js"}} + +## Nutzung + +`Stack` is concerned with one-dimensional layouts, while [Grid](/components/grid/) that handles two-dimensional layouts. The default direction is `column` which stacks children vertically. + +{{"demo": "pages/components/stack/BasicStack.js", "bg": true}} + +To control space between children, use the `spacing` prop. The spacing value can be any number, including decimals and any string. The prop is converted into a CSS property using the [`theme.spacing()`](/customization/spacing/) helper. + +## Direction + +By default, `Stack` arranges items vertically in a `column`. However, the `direction` prop can be used to position items horizontally in a `row` as well. + +{{"demo": "pages/components/stack/DirectionStack.js", "bg": true}} + +## Trenner (Divider) + +Use the `divider` prop to insert an element between each child. This works particularly well with the [Divider](/components/divider/) component. + +{{"demo": "pages/components/stack/DividerStack.js", "bg": true}} + +## Responsive values + +You can switch the `direction` or `spacing` values based on the active breakpoint. + +{{"demo": "pages/components/stack/ResponsiveStack.js", "bg": true}} + +## Interaktive Liste + +Nachfolgend finden Sie eine interaktive Demo, mit der Sie die visuellen Ergebnisse der verschiedenen Einstellungen untersuchen können: + +{{"demo": "pages/components/stack/InteractiveStack.js", "hideToolbar": true, "bg": true}} + +## System props + +As a CSS utility component, the `Stack` supports all [`system`](/system/properties/) properties. You can use them as props directly on the component. For instance, a margin-top: + +```jsx +<Stack mt={2}> +``` diff --git a/docs/src/pages/components/stack/stack-es.md b/docs/src/pages/components/stack/stack-es.md new file mode 100644 index 00000000000000..bf3921c967a139 --- /dev/null +++ b/docs/src/pages/components/stack/stack-es.md @@ -0,0 +1,51 @@ +--- +title: React Stack component +components: Stack +githubLabel: 'component: Stack' +--- + +# Stack + +<p class="description">The Stack component manages layout of immediate children along the vertical or horizontal axis with optional spacing and/or dividers between each child.</p> + +{{"component": "modules/components/ComponentLinkHeader.js"}} + +## Implementación + +`Stack` is concerned with one-dimensional layouts, while [Grid](/components/grid/) that handles two-dimensional layouts. The default direction is `column` which stacks children vertically. + +{{"demo": "pages/components/stack/BasicStack.js", "bg": true}} + +To control space between children, use the `spacing` prop. The spacing value can be any number, including decimals and any string. The prop is converted into a CSS property using the [`theme.spacing()`](/customization/spacing/) helper. + +## Direction + +By default, `Stack` arranges items vertically in a `column`. However, the `direction` prop can be used to position items horizontally in a `row` as well. + +{{"demo": "pages/components/stack/DirectionStack.js", "bg": true}} + +## Divisores + +Use the `divider` prop to insert an element between each child. This works particularly well with the [Divider](/components/divider/) component. + +{{"demo": "pages/components/stack/DividerStack.js", "bg": true}} + +## Responsive values + +You can switch the `direction` or `spacing` values based on the active breakpoint. + +{{"demo": "pages/components/stack/ResponsiveStack.js", "bg": true}} + +## Explora + +Debajo de esta línea hay una demostración interactiva que permite explorar el resultado visual de las distintas configuraciones: + +{{"demo": "pages/components/stack/InteractiveStack.js", "hideToolbar": true, "bg": true}} + +## System props + +As a CSS utility component, the `Stack` supports all [`system`](/system/properties/) properties. You can use them as props directly on the component. For instance, a margin-top: + +```jsx +<Stack mt={2}> +``` diff --git a/docs/src/pages/components/stack/stack-fr.md b/docs/src/pages/components/stack/stack-fr.md new file mode 100644 index 00000000000000..a9b6358ba842b7 --- /dev/null +++ b/docs/src/pages/components/stack/stack-fr.md @@ -0,0 +1,51 @@ +--- +title: React Stack component +components: Stack +githubLabel: 'component: Stack' +--- + +# Stack + +<p class="description">The Stack component manages layout of immediate children along the vertical or horizontal axis with optional spacing and/or dividers between each child.</p> + +{{"component": "modules/components/ComponentLinkHeader.js"}} + +## Utilisation + +`Stack` is concerned with one-dimensional layouts, while [Grid](/components/grid/) that handles two-dimensional layouts. The default direction is `column` which stacks children vertically. + +{{"demo": "pages/components/stack/BasicStack.js", "bg": true}} + +To control space between children, use the `spacing` prop. The spacing value can be any number, including decimals and any string. Cette fonction de transformation de sortie peut être personnalisée [à l'aide du thème](/customization/spacing/). + +## Direction + +By default, `Stack` arranges items vertically in a `column`. However, the `direction` prop can be used to position items horizontally in a `row` as well. + +{{"demo": "pages/components/stack/DirectionStack.js", "bg": true}} + +## Dividers (Séparateurs) + +Use the `divider` prop to insert an element between each child. This works particularly well with the [Divider](/components/divider/) component. + +{{"demo": "pages/components/stack/DividerStack.js", "bg": true}} + +## Responsive values + +You can switch the `direction` or `spacing` values based on the active breakpoint. + +{{"demo": "pages/components/stack/ResponsiveStack.js", "bg": true}} + +## Interactif + +Vous trouverez ci-dessous une démo interactive vous permettant d'explorer les résultats visuels des différents paramètres: + +{{"demo": "pages/components/stack/InteractiveStack.js", "hideToolbar": true, "bg": true}} + +## System props + +As a CSS utility component, the `Stack` supports all [`system`](/system/properties/) properties. You can use them as props directly on the component. For instance, a margin-top: + +```jsx +<Stack mt={2}> +``` diff --git a/docs/src/pages/components/stack/stack-ja.md b/docs/src/pages/components/stack/stack-ja.md new file mode 100644 index 00000000000000..cd2d0b7198f552 --- /dev/null +++ b/docs/src/pages/components/stack/stack-ja.md @@ -0,0 +1,51 @@ +--- +title: React Stack component +components: Stack +githubLabel: 'component: Stack' +--- + +# Stack + +<p class="description">The Stack component manages layout of immediate children along the vertical or horizontal axis with optional spacing and/or dividers between each child.</p> + +{{"component": "modules/components/ComponentLinkHeader.js"}} + +## 使い方 + +`Stack` is concerned with one-dimensional layouts, while [Grid](/components/grid/) that handles two-dimensional layouts. The default direction is `column` which stacks children vertically. + +{{"demo": "pages/components/stack/BasicStack.js", "bg": true}} + +To control space between children, use the `spacing` prop. The spacing value can be any number, including decimals and any string. The prop is converted into a CSS property using the [`theme.spacing()`](/customization/spacing/) helper. + +## 方向 + +By default, `Stack` arranges items vertically in a `column`. However, the `direction` prop can be used to position items horizontally in a `row` as well. + +{{"demo": "pages/components/stack/DirectionStack.js", "bg": true}} + +## Dividers + +Use the `divider` prop to insert an element between each child. This works particularly well with the [Divider](/components/divider/) component. + +{{"demo": "pages/components/stack/DividerStack.js", "bg": true}} + +## Responsive values + +You can switch the `direction` or `spacing` values based on the active breakpoint. + +{{"demo": "pages/components/stack/ResponsiveStack.js", "bg": true}} + +## インタラクティブ + +以下は、さまざまな設定の視覚的な結果を調べることができるインタラクティブなデモです。 + +{{"demo": "pages/components/stack/InteractiveStack.js", "hideToolbar": true, "bg": true}} + +## System props + +As a CSS utility component, the `Stack` supports all [`system`](/system/properties/) properties. You can use them as props directly on the component. For instance, a margin-top: + +```jsx +<Stack mt={2}> +``` diff --git a/docs/src/pages/components/stack/stack-pt.md b/docs/src/pages/components/stack/stack-pt.md new file mode 100644 index 00000000000000..f7f1fc35950aa3 --- /dev/null +++ b/docs/src/pages/components/stack/stack-pt.md @@ -0,0 +1,51 @@ +--- +title: React Stack component +components: Stack +githubLabel: 'component: Stack' +--- + +# Stack + +<p class="description">The Stack component manages layout of immediate children along the vertical or horizontal axis with optional spacing and/or dividers between each child.</p> + +{{"component": "modules/components/ComponentLinkHeader.js"}} + +## Uso + +`Stack` is concerned with one-dimensional layouts, while [Grid](/components/grid/) that handles two-dimensional layouts. The default direction is `column` which stacks children vertically. + +{{"demo": "pages/components/stack/BasicStack.js", "bg": true}} + +Para controlar o espaço entre os filhos, use a prop ` spacing ` The spacing value can be any number, including decimals and any string. As props são convertidas em css usando o auxiliar [`theme.spacing()`](/customization/spacing/) + +## Direção + +By default, `Stack` arranges items vertically in a `column`. However, the `direction` prop can be used to position items horizontally in a `row` as well. + +{{"demo": "pages/components/stack/DirectionStack.js", "bg": true}} + +## Divisores + +Use the `divider` prop to insert an element between each child. This works particularly well with the [Divider](/components/divider/) component. + +{{"demo": "pages/components/stack/DividerStack.js", "bg": true}} + +## Valores responsivos + +You can switch the `direction` or `spacing` values based on the active breakpoint. + +{{"demo": "pages/components/stack/ResponsiveStack.js", "bg": true}} + +## Interativo + +Abaixo está uma demonstração interativa que permite explorar os resultados visuais das diferentes configurações: + +{{"demo": "pages/components/stack/InteractiveStack.js", "hideToolbar": true, "bg": true}} + +## System props + +As a CSS utility component, the `Stack` supports all [`system`](/system/properties/) properties. You can use them as props directly on the component. For instance, a margin-top: + +```jsx +<Stack mt={2}> +``` diff --git a/docs/src/pages/components/stack/stack-ru.md b/docs/src/pages/components/stack/stack-ru.md new file mode 100644 index 00000000000000..f99dfd4d593b9b --- /dev/null +++ b/docs/src/pages/components/stack/stack-ru.md @@ -0,0 +1,51 @@ +--- +title: React Stack component +components: Stack +githubLabel: 'component: Stack' +--- + +# Stack + +<p class="description">The Stack component manages layout of immediate children along the vertical or horizontal axis with optional spacing and/or dividers between each child.</p> + +{{"component": "modules/components/ComponentLinkHeader.js"}} + +## Использование + +`Stack` is concerned with one-dimensional layouts, while [Grid](/components/grid/) that handles two-dimensional layouts. The default direction is `column` which stacks children vertically. + +{{"demo": "pages/components/stack/BasicStack.js", "bg": true}} + +To control space between children, use the `spacing` prop. The spacing value can be any number, including decimals and any string. The prop is converted into a CSS property using the [`theme.spacing()`](/customization/spacing/) helper. + +## Direction + +By default, `Stack` arranges items vertically in a `column`. However, the `direction` prop can be used to position items horizontally in a `row` as well. + +{{"demo": "pages/components/stack/DirectionStack.js", "bg": true}} + +## Разделитель + +Use the `divider` prop to insert an element between each child. This works particularly well with the [Divider](/components/divider/) component. + +{{"demo": "pages/components/stack/DividerStack.js", "bg": true}} + +## Responsive values + +You can switch the `direction` or `spacing` values based on the active breakpoint. + +{{"demo": "pages/components/stack/ResponsiveStack.js", "bg": true}} + +## Интерактивность + +Ниже приведен интерактивный пример, который демонстрирует результаты различных настроек сетки: + +{{"demo": "pages/components/stack/InteractiveStack.js", "hideToolbar": true, "bg": true}} + +## System props + +As a CSS utility component, the `Stack` supports all [`system`](/system/properties/) properties. You can use them as props directly on the component. For instance, a margin-top: + +```jsx +<Stack mt={2}> +``` diff --git a/docs/src/pages/components/stack/stack-zh.md b/docs/src/pages/components/stack/stack-zh.md new file mode 100644 index 00000000000000..823f4fe1263f2f --- /dev/null +++ b/docs/src/pages/components/stack/stack-zh.md @@ -0,0 +1,51 @@ +--- +title: React Stack component +components: Stack +githubLabel: 'component: Stack' +--- + +# Stack + +<p class="description">The Stack component manages layout of immediate children along the vertical or horizontal axis with optional spacing and/or dividers between each child.</p> + +{{"component": "modules/components/ComponentLinkHeader.js"}} + +## 使用 + +`Stack` is concerned with one-dimensional layouts, while [Grid](/components/grid/) that handles two-dimensional layouts. The default direction is `column` which stacks children vertically. + +{{"demo": "pages/components/stack/BasicStack.js", "bg": true}} + +To control space between children, use the `spacing` prop. The spacing value can be any number, including decimals and any string. The prop is converted into a CSS property using the [`theme.spacing()`](/customization/spacing/) helper. + +## 方向 + +By default, `Stack` arranges items vertically in a `column`. However, the `direction` prop can be used to position items horizontally in a `row` as well. + +{{"demo": "pages/components/stack/DirectionStack.js", "bg": true}} + +## Dividers(分隔线) + +Use the `divider` prop to insert an element between each child. This works particularly well with the [Divider](/components/divider/) component. + +{{"demo": "pages/components/stack/DividerStack.js", "bg": true}} + +## 响应式的值 + +You can switch the `direction` or `spacing` values based on the active breakpoint. + +{{"demo": "pages/components/stack/ResponsiveStack.js", "bg": true}} + +## 交互式 + +下面是一个交互式的演示,你也可以探索不同设置下的视觉结果: + +{{"demo": "pages/components/stack/InteractiveStack.js", "hideToolbar": true, "bg": true}} + +## System props + +As a CSS utility component, the `Stack` supports all [`system`](/system/properties/) properties. You can use them as props directly on the component. For instance, a margin-top: + +```jsx +<Stack mt={2}> +``` diff --git a/docs/src/pages/components/steppers/steppers-de.md b/docs/src/pages/components/steppers/steppers-de.md index 7d7df3bc01a933..65a2bfc890b878 100644 --- a/docs/src/pages/components/steppers/steppers-de.md +++ b/docs/src/pages/components/steppers/steppers-de.md @@ -1,5 +1,5 @@ --- -title: React Stepper component +title: React Stepper Komponente components: MobileStepper, Step, StepButton, StepConnector, StepContent, StepIcon, StepLabel, Stepper githubLabel: 'component: Stepper' materialDesign: https://material.io/archive/guidelines/components/steppers.html @@ -11,7 +11,7 @@ materialDesign: https://material.io/archive/guidelines/components/steppers.html [Stepper](https://material.io/archive/guidelines/components/steppers.html) zeigen den Fortschritt durch eine Folge logischer und nummerierter Schritte an. Sie können auch zur Navigation verwendet werden. Steppers können eine vorübergehende Rückmeldung anzeigen, nachdem ein Schritt gespeichert wurde. -- **Types of Steps**: Editable, Non-editable, Mobile, Optional +- **Arten von Schritten**: Bearbeitbar, Nicht editierbar, Mobil, Optional - **Types of Steppers**: Horizontal, Vertical, Linear, Non-linear {{"component": "modules/components/ComponentLinkHeader.js"}} @@ -28,7 +28,7 @@ Horizontal steppers are ideal when the contents of one step depend on an earlier A linear stepper allows the user to complete the steps in sequence. -Der `Stepper` kann gesteuert werden, indem der aktuelle Schrittindex (auf Null basierend) als `activeStep` Eigenschaft übergeben wird. Die `Stepper-` Ausrichtung wird mithilfe der Eigenschaft `orientation` gesetzt. +Der `Stepper` kann gesteuert werden, indem der aktuelle Schrittindex (auf Null basierend) als `activeStep` Eigenschaft übergeben wird. Die `Stepper` Ausrichtung wird mithilfe der Eigenschaft `orientation` gesetzt. Dieses Beispiel zeigt auch die Verwendung eines optionalen Schritt durch setzten der `optional` Eigenschaft auf der zweiten `Step` Komponente. Beachten Sie, dass Sie selbst entscheiden müssen, wann ein optionaler Schritt übersprungen wird. Wenn Sie dies für einen bestimmten Schritt festgelegt haben, müssen Sie `complete={false}` setzten, um anzuzeigen, dass der Index des aktiven Schritts den optionalen Schritt überschritten hat, jedoch nicht wirklich abgeschlossen ist. @@ -38,7 +38,7 @@ Dieses Beispiel zeigt auch die Verwendung eines optionalen Schritt durch setzten Mit nichtlinearen Steppern können Benutzer an jedem Punkt einen mehrstufigen Fluss einsteigen. -Dieses Beispiel ähnelt dem regulären horizontalen Stepper, mit der Ausnahme, dass Schritte nicht mehr automatisch auf `=disabled={true}` basierend auf der Eigenschaft `activeStep` gesetzt werden. +Dieses Beispiel ähnelt dem regulären horizontalen Stepper, mit der Ausnahme, dass Schritte nicht mehr automatisch auf `disabled={true}` basierend auf der Eigenschaft `activeStep` gesetzt werden. The use of the `StepButton` here demonstrates clickable step labels, as well as setting the `completed` flag. However because steps can be accessed in a non-linear fashion, it's up to your own implementation to determine when all steps are completed (or even if they need to be completed). diff --git a/docs/src/pages/components/steppers/steppers-fr.md b/docs/src/pages/components/steppers/steppers-fr.md index 725a3b5fd3f4ba..f054c7f2d08679 100644 --- a/docs/src/pages/components/steppers/steppers-fr.md +++ b/docs/src/pages/components/steppers/steppers-fr.md @@ -1,5 +1,5 @@ --- -title: React Stepper component +title: Composant React Stepper components: MobileStepper, Step, StepButton, StepConnector, StepContent, StepIcon, StepLabel, Stepper githubLabel: 'component: Stepper' materialDesign: https://material.io/archive/guidelines/components/steppers.html @@ -9,92 +9,92 @@ materialDesign: https://material.io/archive/guidelines/components/steppers.html <p class="description">Steppers convey progress through numbered steps. It provides a wizard-like workflow.</p> -[Steppers](https://material.io/archive/guidelines/components/steppers.html) display progress through a sequence of logical and numbered steps. They may also be used for navigation. Steppers may display a transient feedback message after a step is saved. +Les Steppers affichent la progression à travers une séquence d'étapes logiques et numérotées. They may also be used for navigation. Steppers may display a transient feedback message after a step is saved. -- **Types of Steps**: Editable, Non-editable, Mobile, Optional -- **Types of Steppers**: Horizontal, Vertical, Linear, Non-linear +- **Types d’étapes**: Modifiable, Non éditable, Mobile, Optionnel +- **Types d'etapes**: Horizontal, vertical, linéaire, non linéaire {{"component": "modules/components/ComponentLinkHeader.js"}} -> **Note:** Steppers are no longer documented in the [Material Design guidelines](https://material.io/), but Material-UI will continue to support them. +> **Note:** les Steppers ne seront plus documenté dans le [Material Design guidelines](https://material.io/), mais Material-UI continue le support. -## Horizontal Stepper +## Stepper horizontale -Horizontal steppers are ideal when the contents of one step depend on an earlier step. +Les Steppers horizontales sont idéelles lorsque le contenu d'une étape dépend d'une étape antérieure. -{{"demo": "pages/components/steppers/HorizontalLinearStepper.js", "bg": true}} +Évitez d'utiliser des noms d'étapes longues dans les étapes horizontales. -### Linear +### Barre de progression linéaire -A linear stepper allows the user to complete the steps in sequence. +Un Steper linéaire permet à l'utilisateur de compléter les étapes en séquence. -The `Stepper` can be controlled by passing the current step index (zero-based) as the `activeStep` property. `Stepper` orientation is set using the `orientation` property. +La `Stepper` peut être contrôlée en passant l'indice d'étape actuel (basé sur zéro) en tant que propriété `activeStep`. L'orientation de `Stepper` est définie à l'aide de la prop `orientation`. -This example also shows the use of an optional step by placing the `optional` property on the second `Step` component. Note that it's up to you to manage when an optional step is skipped. Once you've determined this for a particular step you must set `completed={false}` to signify that even though the active step index has gone beyond the optional step, it's not actually complete. +Cet exemple montre également l'utilisation d'une Stepper facultative en plaçant la prop `optional` sur le deuxième composant `Step`. Note that it's up to you to manage when an optional step is skipped. Once you've determined this for a particular step you must set `completed={false}` to signify that even though the active step index has gone beyond the optional step, it's not actually complete. {{"demo": "pages/components/steppers/HorizontalLinearStepper.js"}} ### Non-linear -Non-linear steppers allow users to enter a multi-step flow at any point. +Les steppers non linéaires permettent à l'utilisateur d'entrer un flux multi-étapes à n'importe quel moment. -This example is similar to the regular horizontal stepper, except steps are no longer automatically set to `disabled={true}` based on the `activeStep` property. +Cet exemple est similaire à la stepper horizontale normale, excepté les étapes ne sont plus automatiquement définies à `disabled={true}` en se basant sur la prop `activeStep`. The use of the `StepButton` here demonstrates clickable step labels, as well as setting the `completed` flag. However because steps can be accessed in a non-linear fashion, it's up to your own implementation to determine when all steps are completed (or even if they need to be completed). {{"demo": "pages/components/steppers/HorizontalNonLinearStepper.js"}} -### Customized Stepper +### Libellé alternatif Labels can be placed below the step icon by setting the `alternativeLabel` prop on the `Stepper` component. {{"demo": "pages/components/steppers/HorizontalLinearAlternativeLabelStepper.js"}} -### Non-linear - Error Step +### Étape d'erreur {{"demo": "pages/components/steppers/HorizontalStepperWithError.js"}} -### Non-linear - Alternative Label +### Étape horizontale personnalisée Voici un exemple de personnalisation du composant. Vous pouvez en savoir plus dans la [page de documentation des overrides](/customization/how-to-customize/). {{"demo": "pages/components/steppers/CustomizedSteppers.js"}} -## Vertical Stepper +## Stepper verticale -Vertical steppers are designed for narrow screen sizes. They are ideal for mobile. All the features of the horizontal stepper can be implemented. +Les Steppers verticaux sont conçus pour les tailles d’écran étroites. Elles sont idéales pour les mobiles. Toutes les fonctionnalités de Stepper horizontale peuvent être implémentées. {{"demo": "pages/components/steppers/VerticalLinearStepper.js"}} ### Perfomance -The content of a step is unmounted when closed. If you need to make the content available to search engines or render expensive component trees inside your modal while optimizing for interaction responsiveness it might be a good idea to keep the step mounted with: +Le contenu d'un Stepper est démonté lorsqu'il est fermé. Si vous devez rendre le contenu disponible pour les moteurs de recherche ou afficher des arborescences de composants longs dans votre modal tout en optimisant la réactivité des interactions il peut être judicieux de modifier ce comportement par défaut en passant la propriété `keepMounted` : ```jsx <StepContent TransitionProps={{ unmountOnExit: false }} /> ``` -## Mobile Stepper +## Stepper de mobile -This component implements a compact stepper suitable for a mobile device. It has more limited functionality than the vertical stepper. See [mobile steps](https://material.io/archive/guidelines/components/steppers.html#steppers-types-of-steps) for its inspiration. +This component implements a compact stepper suitable for a mobile device. Il a plus de fonctionnalités limitées que le Stepper vertical. See [mobile steps](https://material.io/archive/guidelines/components/steppers.html#steppers-types-of-steps) for its inspiration. -The mobile stepper supports three variants to display progress through the available steps: text, dots, and progress. +Le Stepper mobile prend en charge trois variantes pour afficher la progression à travers les étapes disponibles : text, dots, et progress. ### Text -Use dots when the number of steps isn’t large. +L'étape actuelle et le nombre total d'étapes sont affichés sous forme de texte. {{"demo": "pages/components/steppers/TextMobileStepper.js", "bg": true}} -### Text with Carousel effect +### Texte avec effet de carrousel -This demo is very similar to the previous, the difference is the usage of [react-swipeable-views](https://github.com/oliviertassinari/react-swipeable-views) to make the transition of steps. +Cette démo utilise [react-swipeable-views](https://github.com/oliviertassinari/react-swipeable-views) pour créer un carrousel. {{"demo": "pages/components/steppers/SwipeableTextMobileStepper.js", "bg": true}} ### Dots -Use dots when the number of steps is small. +Utilisez des points lorsque le nombre d'étape est petit. {{"demo": "pages/components/steppers/DotsMobileStepper.js", "bg": true}} diff --git a/docs/src/pages/components/steppers/steppers-ja.md b/docs/src/pages/components/steppers/steppers-ja.md index 5d7a1bc2e3a53c..764d2c64c29052 100644 --- a/docs/src/pages/components/steppers/steppers-ja.md +++ b/docs/src/pages/components/steppers/steppers-ja.md @@ -5,9 +5,9 @@ githubLabel: 'component: Stepper' materialDesign: https://material.io/archive/guidelines/components/steppers.html --- -# Stepper(ステッパー) +# Stepper ステッパー -<p class="description">ステッパーは、番号の付いたステップを通して進捗を伝えます。 ウィザードのようなワークフローを提供します。 ウィザードのようなワークフローを提供します。</p> +<p class="description">ステッパーは、番号の付いたステップを通して進捗を伝えます。 ウィザードのようなワークフローを提供します。</p> [Steppers](https://material.io/archive/guidelines/components/steppers.html)は、一連の論理ステップと番号付きステップの進行状況を表示します。 ナビゲーションにも使用できます。 ステッパーは、ステップが保存された後に一時的なフィードバックメッセージを表示する場合があります。 @@ -30,7 +30,7 @@ Horizontal steppers are ideal when the contents of one step depend on an earlier `Stepper` は、現在のステップインデックス(ゼロベース)を `activeStep` プロパティとして渡すことで制御できます。 `<code>Stepper`方向は、 `orientation`プロパティを使用して設定されます。 -この例では、 `optional`プロパティを第2の`Step`コンポーネントに配置して、オプションの手順を使用する方法も示します。 オプションの手順がスキップされる場合の管理はユーザー次第です。 この例では、 `optional`プロパティを第2の`Step`コンポーネントに配置して、オプションの手順を使用する方法も示します。 オプションの手順がスキップされる場合の管理はユーザー次第です。 特定のステップでこれを決定したら、`completed={false}` を設定して、アクティブなステップインデックスがオプションのステップを超えていても、実際には完了していないことを示す必要があります。 +この例では、 `optional`プロパティを第2の`Step`コンポーネントに配置して、オプションの手順を使用する方法も示します。 オプションの手順がスキップされる場合の管理はユーザー次第です。 特定のステップでこれを決定したら、`completed={false}` を設定して、アクティブなステップインデックスがオプションのステップを超えていても、実際には完了していないことを示す必要があります。 {{"demo": "pages/components/steppers/HorizontalLinearStepper.js"}} @@ -56,7 +56,7 @@ The use of the `StepButton` here demonstrates clickable step labels, as well as ### Non-linear - Alternative Label -コンポーネントのカスタマイズ例を次に示します。 詳細については、 [overrides documentation page](/customization/how-to-customize/)を参照してください。 +コンポーネントのカスタマイズ例を次に示します。 詳細については、 [こちら](/customization/how-to-customize/)を参照してください。 {{"demo": "pages/components/steppers/CustomizedSteppers.js"}} @@ -76,7 +76,7 @@ The content of a step is unmounted when closed. If you need to make the content ## モバイルステッパー -このコンポーネントは、モバイルデバイスに適したコンパクトなステッパーを実装します。 このコンポーネントは、モバイルデバイスに適したコンパクトなステッパーを実装します。 このコンポーネントは、モバイルデバイスに適したコンパクトなステッパーを実装します。 その着想については、[mobile steps](https://material.io/archive/guidelines/components/steppers.html#steppers-types-of-steps)を参照してください。 It has more limited functionality than the vertical stepper. このコンポーネントは、モバイルデバイスに適したコンパクトなステッパーを実装します。 このコンポーネントは、モバイルデバイスに適したコンパクトなステッパーを実装します。 その着想については、[mobile steps](https://material.io/archive/guidelines/components/steppers.html#steppers-types-of-steps)を参照してください。 +このコンポーネントは、モバイルデバイスに適したコンパクトなステッパーを実装します。 It has more limited functionality than the vertical stepper. その着想については、[mobile steps](https://material.io/archive/guidelines/components/steppers.html#steppers-types-of-steps)を参照してください。 The mobile stepper supports three variants to display progress through the available steps: text, dots, and progress. diff --git a/docs/src/pages/components/steppers/steppers-ru.md b/docs/src/pages/components/steppers/steppers-ru.md index 15ada9613249ea..0d795da0ccb1c2 100644 --- a/docs/src/pages/components/steppers/steppers-ru.md +++ b/docs/src/pages/components/steppers/steppers-ru.md @@ -56,7 +56,7 @@ Labels can be placed below the step icon by setting the `alternativeLabel` prop ### Non-linear - Alternative Label -Ниже находится пример кастомизации компонента. You can learn more about this in the [overrides documentation page](/customization/how-to-customize/). +Ниже находится пример кастомизации компонента. Вы можете узнать об этом больше [в документации по переопределению свойств](/customization/how-to-customize/). {{"demo": "pages/components/steppers/CustomizedSteppers.js"}} diff --git a/docs/src/pages/components/steppers/steppers-zh.md b/docs/src/pages/components/steppers/steppers-zh.md index 3312a5217f5e79..ad74024c4c1fe7 100644 --- a/docs/src/pages/components/steppers/steppers-zh.md +++ b/docs/src/pages/components/steppers/steppers-zh.md @@ -68,7 +68,7 @@ materialDesign: https://material.io/archive/guidelines/components/steppers.html ### 文本 -The content of a step is unmounted when closed. If you need to make the content available to search engines or render expensive component trees inside your modal while optimizing for interaction responsiveness it might be a good idea to keep the step mounted with: +步骤内容将在关闭时自动卸载。 若您需要提供内容给搜索引擎,亦或是在您的模态框内渲染复杂的组件树,同时还要达到最佳的优化性能,您一般需要以下代码来装载模态框: ```jsx <StepContent TransitionProps={{ unmountOnExit: false }} /> diff --git a/docs/src/pages/components/switches/ColorSwitches.js b/docs/src/pages/components/switches/ColorSwitches.js index acc47bf12b4934..c4201937913d72 100644 --- a/docs/src/pages/components/switches/ColorSwitches.js +++ b/docs/src/pages/components/switches/ColorSwitches.js @@ -1,17 +1,17 @@ import * as React from 'react'; import { alpha, styled } from '@material-ui/core/styles'; -import { green } from '@material-ui/core/colors'; +import { pink } from '@material-ui/core/colors'; import Switch from '@material-ui/core/Switch'; const GreenSwitch = styled(Switch)(({ theme }) => ({ '& .MuiSwitch-switchBase.Mui-checked': { - color: green[600], + color: pink[600], '&:hover': { - backgroundColor: alpha(green[600], theme.palette.action.hoverOpacity), + backgroundColor: alpha(pink[600], theme.palette.action.hoverOpacity), }, }, '& .MuiSwitch-switchBase.Mui-checked + .MuiSwitch-track': { - backgroundColor: green[600], + backgroundColor: pink[600], }, })); @@ -22,6 +22,7 @@ export default function ColorSwitches() { <div> <Switch {...label} defaultChecked /> <Switch {...label} defaultChecked color="secondary" /> + <Switch {...label} defaultChecked color="warning" /> <Switch {...label} defaultChecked color="default" /> <GreenSwitch {...label} defaultChecked /> </div> diff --git a/docs/src/pages/components/switches/ColorSwitches.tsx b/docs/src/pages/components/switches/ColorSwitches.tsx index acc47bf12b4934..c4201937913d72 100644 --- a/docs/src/pages/components/switches/ColorSwitches.tsx +++ b/docs/src/pages/components/switches/ColorSwitches.tsx @@ -1,17 +1,17 @@ import * as React from 'react'; import { alpha, styled } from '@material-ui/core/styles'; -import { green } from '@material-ui/core/colors'; +import { pink } from '@material-ui/core/colors'; import Switch from '@material-ui/core/Switch'; const GreenSwitch = styled(Switch)(({ theme }) => ({ '& .MuiSwitch-switchBase.Mui-checked': { - color: green[600], + color: pink[600], '&:hover': { - backgroundColor: alpha(green[600], theme.palette.action.hoverOpacity), + backgroundColor: alpha(pink[600], theme.palette.action.hoverOpacity), }, }, '& .MuiSwitch-switchBase.Mui-checked + .MuiSwitch-track': { - backgroundColor: green[600], + backgroundColor: pink[600], }, })); @@ -22,6 +22,7 @@ export default function ColorSwitches() { <div> <Switch {...label} defaultChecked /> <Switch {...label} defaultChecked color="secondary" /> + <Switch {...label} defaultChecked color="warning" /> <Switch {...label} defaultChecked color="default" /> <GreenSwitch {...label} defaultChecked /> </div> diff --git a/docs/src/pages/components/switches/switches-de.md b/docs/src/pages/components/switches/switches-de.md index 6d33765e6a7036..7a44b638b0d5fe 100644 --- a/docs/src/pages/components/switches/switches-de.md +++ b/docs/src/pages/components/switches/switches-de.md @@ -15,14 +15,30 @@ materialDesign: 'https://material.io/components/selection-controls#switches' ## Basic switches -{{"demo": "pages/components/switches/Switches.js"}} +{{"demo": "pages/components/switches/BasicSwitches.js"}} -## Switch with FormControlLabel +## Kontrollkästchen mit FormGroup -`Switch` can be provided with a description thanks to the `FormControlLabel` component. +You can provide a label to the `Switch` thanks to the `FormControlLabel` component. {{"demo": "pages/components/switches/SwitchLabels.js"}} +## Size + +Use the `size` prop to change the size of the switch. + +{{"demo": "pages/components/switches/SwitchesSize.js"}} + +## Farbe (Color) + +{{"demo": "pages/components/switches/ColorSwitches.js"}} + +## Controlled + +You can control the switch with the `checked` and `onChange` props: + +{{"demo": "pages/components/switches/ControlledSwitches.js"}} + ## Schalter mit FormGroup `FormGroup` ist ein hilfreicher Wrapper zum Gruppieren von Auswahlsteuerungskomponenten, welcher eine einfachere API bietet. `FormGroup` ist ein hilfreicher Wrapper zum Gruppieren von Auswahlsteuerungskomponenten, welcher eine einfachere API bietet. (See: [When to use](#when-to-use)). @@ -37,12 +53,6 @@ Hier einige Beispiele zum Anpassen der Komponente. Mehr dazu erfahren Sie auf de 🎨 Wenn Sie nach Inspiration suchen, sehen sie sich [MUI Treasury's Anpassungs-Beispiele](https://mui-treasury.com/styles/switch) an. -## Größen - -Fancy smaller switches? Verwenden Sie die `size` Prop. - -{{"demo": "pages/components/switches/SwitchesSize.js"}} - ## Etikettenplatzierung Sie können die Platzierung des Etiketts ändern: diff --git a/docs/src/pages/components/switches/switches-es.md b/docs/src/pages/components/switches/switches-es.md index fa3f7b50d400b5..cce77aec32d9af 100644 --- a/docs/src/pages/components/switches/switches-es.md +++ b/docs/src/pages/components/switches/switches-es.md @@ -15,14 +15,30 @@ materialDesign: 'https://material.io/components/selection-controls#switches' ## Conmutadores Básicos -{{"demo": "pages/components/switches/Switches.js"}} +{{"demo": "pages/components/switches/BasicSwitches.js"}} -## Switch with FormControlLabel +## Checkbox con FormControlLabel -`Switch` can be provided with a description thanks to the `FormControlLabel` component. +You can provide a label to the `Switch` thanks to the `FormControlLabel` component. {{"demo": "pages/components/switches/SwitchLabels.js"}} +## Tamaño + +Use the `size` prop to change the size of the switch. + +{{"demo": "pages/components/switches/SwitchesSize.js"}} + +## Color + +{{"demo": "pages/components/switches/ColorSwitches.js"}} + +## Controlled + +You can control the switch with the `checked` and `onChange` props: + +{{"demo": "pages/components/switches/ControlledSwitches.js"}} + ## Switches with FormGroup `FormGroup` es un contenedor muy útil usado para agrupar componentes de controles de selección que proporciona una API más sencilla. However, you are encouraged you to use [Checkboxes](/components/checkboxes/) instead if multiple related controls are required. However, you are encouraged you to use [Checkboxes](/components/checkboxes/) instead if multiple related controls are required. @@ -37,12 +53,6 @@ Here are some examples of customizing the component. Puedes aprender más sobre 🎨 Si estás buscando inspiración, puedes mirar [los ejemplos de MUI Treasury](https://mui-treasury.com/styles/switch). -## Tamaños - -Fancy smaller switches? Use the `size` prop. - -{{"demo": "pages/components/switches/SwitchesSize.js"}} - ## Ubicación de Etiqueta Puede cambiar la ubicación de la etiqueta: diff --git a/docs/src/pages/components/switches/switches-fr.md b/docs/src/pages/components/switches/switches-fr.md index fbeb6763284ed3..62d439dc58c45e 100644 --- a/docs/src/pages/components/switches/switches-fr.md +++ b/docs/src/pages/components/switches/switches-fr.md @@ -1,5 +1,5 @@ --- -title: React Switch component +title: Composant React switch components: Switch, FormControl, FormGroup, FormLabel, FormControlLabel githubLabel: 'component: Switch' materialDesign: 'https://material.io/components/selection-controls#switches' @@ -9,7 +9,7 @@ materialDesign: 'https://material.io/components/selection-controls#switches' <p class="description">Switches toggle the state of a single setting on or off.</p> -[Switches](https://material.io/design/components/selection-controls.html#switches) are the preferred way to adjust settings on mobile. The option that the switch controls, as well as the state it's in, should be made clear from the corresponding inline label. +[Switches](https://material.io/design/components/selection-controls.html#switches) sont le moyen préféré pour ajuster les paramètres sur mobile. The option that the switch controls, as well as the state it's in, should be made clear from the corresponding inline label. L'option que le switch contrôle, ainsi que l'état dans lequel il se trouve, doivent être clairement indiqués à partir de l'étiquette en ligne correspondante. {{"component": "modules/components/ComponentLinkHeader.js"}} @@ -17,15 +17,31 @@ materialDesign: 'https://material.io/components/selection-controls#switches' {{"demo": "pages/components/switches/Switches.js"}} -## Switch with FormControlLabel +## Checkbox avec FormControlLabel `Switch` can be provided with a description thanks to the `FormControlLabel` component. {{"demo": "pages/components/switches/SwitchLabels.js"}} +## Size + +Fancy smaller switches? Use the `size` prop. + +{{"demo": "pages/components/switches/SwitchesSize.js"}} + +## Couleur + +{{"demo": "pages/components/switches/ColorSwitches.js"}} + +## Checkbox personnalisée + +You can control the switch with the `checked` and `onChange` props: + +🎨 Si vous cherchez de l'inspiration, vous pouvez consulter les [exemples de personnalisation de MUI Treasury](https://mui-treasury.com/styles/switch). + ## Switches with FormGroup -`FormGroup` est un wrapper utile utilisé pour regrouper les composants de contrôles de sélection et qui fournit une API plus simple. `FormGroup` est un wrapper utile utilisé pour regrouper les composants de contrôles de sélection et qui fournit une API plus simple. (See: [When to use](#when-to-use)). +`FormGroup` est un wrapper utile utilisé pour regrouper les composants de contrôles de sélection et qui fournit une API plus simple. Cependant, nous vous encourageons à utiliser des [cases à cocher](/components/checkboxes/) à la place si plusieurs switch sont requis. (See: [When to use](#when-to-use)). {{"demo": "pages/components/switches/SwitchesGroup.js"}} @@ -37,12 +53,6 @@ Here are some examples of customizing the component. Vous pouvez en savoir plus 🎨 Si vous cherchez de l'inspiration, vous pouvez consulter les [exemples de personnalisation de MUI Treasury](https://mui-treasury.com/styles/switch). -## Tailles - -Fancy smaller switches? Use the `size` prop. - -{{"demo": "pages/components/switches/SwitchesSize.js"}} - ## Emplacement du label Vous pouvez changer l'emplacement du label: diff --git a/docs/src/pages/components/switches/switches-ja.md b/docs/src/pages/components/switches/switches-ja.md index 766dfc84a1912a..14ccecd6c36923 100644 --- a/docs/src/pages/components/switches/switches-ja.md +++ b/docs/src/pages/components/switches/switches-ja.md @@ -15,14 +15,30 @@ materialDesign: 'https://material.io/components/selection-controls#switches' ## Basic switches -{{"demo": "pages/components/switches/Switches.js"}} +{{"demo": "pages/components/switches/BasicSwitches.js"}} -## Switch with FormControlLabel +## FormGroupのCheckbox -`Switch` can be provided with a description thanks to the `FormControlLabel` component. +You can provide a label to the `Switch` thanks to the `FormControlLabel` component. {{"demo": "pages/components/switches/SwitchLabels.js"}} +## Size + +Use the `size` prop to change the size of the switch. + +{{"demo": "pages/components/switches/SwitchesSize.js"}} + +## カラー + +{{"demo": "pages/components/switches/ColorSwitches.js"}} + +## Controlled + +You can control the switch with the `checked` and `onChange` props: + +{{"demo": "pages/components/switches/ControlledSwitches.js"}} + ## FormGroupを使用したスイッチ `FormGroup` は、より簡単なAPIを提供する選択コントロールコンポーネントをグループ化するために使用される便利なラッパーです。 `FormGroup` は、より簡単なAPIを提供する選択コントロールコンポーネントをグループ化するために使用される便利なラッパーです。 (See: [When to use](#when-to-use)). @@ -31,18 +47,12 @@ materialDesign: 'https://material.io/components/selection-controls#switches' ## カスタマイズされたスイッチ (Customized switches) -コンポーネントのカスタマイズの例を次に示します。 詳細については、 [overrides documentation page](/customization/how-to-customize/)を参照してください。 +コンポーネントのカスタマイズの例を次に示します。 詳細については、 [こちら](/customization/how-to-customize/)を参照してください。 {{"demo": "pages/components/switches/CustomizedSwitches.js"}} 🎨 インスピレーションを求めている場合は、 [MUI Treasury's customization examples](https://mui-treasury.com/styles/switch) を確認すると良いでしょう。 -## サイズ - -小型のスイッチが好きですか? `size`propを使用します。 - -{{"demo": "pages/components/switches/SwitchesSize.js"}} - ## ラベルの配置 ラベルの配置は自由に変更できます。 @@ -56,8 +66,8 @@ materialDesign: 'https://material.io/components/selection-controls#switches' ## アクセシビリティ - It will render an element with the `checkbox` role not `switch` role since this role isn't widely supported yet. Please test first if assistive technology of your target audience supports this role properly. Then you can change the role with `<Switch inputProps={{ role: 'switch' }}>` -- ラジオボタン、チェックボックス、スイッチなどのすべてのフォームコントロールにラベルを付ける必要があります。 ほとんどの場合、 `<label>` 要素([FormControlLabel](/api/form-control-label/))を使用して行われます。 ラジオボタン、チェックボックス、スイッチなどのすべてのフォームコントロールにラベルを付ける必要があります。 ほとんどの場合、 `<label>` 要素([FormControlLabel](/api/form-control-label/))を使用して行われます。 ラジオボタン、チェックボックス、スイッチなどのすべてのフォームコントロールにラベルを付ける必要があります。 ほとんどの場合、 `<label>` 要素([FormControlLabel](/api/form-control-label/))を使用して行われます。 ラジオボタン、チェックボックス、スイッチなどのすべてのフォームコントロールにラベルを付ける必要があります。 ほとんどの場合、 `<label>` 要素([FormControlLabel](/api/form-control-label/))を使用して行われます。 -- ラベルを使用できない場合は、入力コンポーネントに直接属性を追加する必要があります。 ラベルを使用できない場合は、入力コンポーネントに直接属性を追加する必要があります。 この場合、追加の属性(例: `aria-label`, `aria-labelledby`, `title`)を経由して `inputProps` プロパティを追加します。 ラベルを使用できない場合は、入力コンポーネントに直接属性を追加する必要があります。 この場合、追加の属性(例: `aria-label`, `aria-labelledby`, `title`)を経由して `inputProps` プロパティを追加します。 この場合、追加の属性(例: `aria-label`, `aria-labelledby`, `title`)を経由して `inputProps` プロパティを追加します。 +- ラジオボタン、チェックボックス、スイッチなどのすべてのフォームコントロールにラベルを付ける必要があります。 ほとんどの場合、 `<label>` 要素([FormControlLabel](/api/form-control-label/))を使用して行われます。 +- ラベルを使用できない場合は、入力コンポーネントに直接属性を追加する必要があります。 この場合、追加の属性(例: `aria-label`, `aria-labelledby`, `title`)を経由して `inputProps` プロパティを追加します。 ```jsx <Switch value="checkedA" inputProps={{ 'aria-label': 'Switch A' }} /> diff --git a/docs/src/pages/components/switches/switches-pt.md b/docs/src/pages/components/switches/switches-pt.md index afadd7260d54a4..4f6a33f917d49e 100644 --- a/docs/src/pages/components/switches/switches-pt.md +++ b/docs/src/pages/components/switches/switches-pt.md @@ -15,14 +15,30 @@ materialDesign: 'https://material.io/components/selection-controls#switches' ## Interruptores básicos -{{"demo": "pages/components/switches/Switches.js"}} +{{"demo": "pages/components/switches/BasicSwitches.js"}} -## Interruptores com FormControlLabel +## Caixas de seleção com FormGroup -O componente `Switch` pode ser fornecido com uma descrição graças ao componente `FormControlLabel`. +You can provide a label to the `Switch` thanks to the `FormControlLabel` component. {{"demo": "pages/components/switches/SwitchLabels.js"}} +## Tamanho + +Use the `size` prop to change the size of the switch. + +{{"demo": "pages/components/switches/SwitchesSize.js"}} + +## Cor + +{{"demo": "pages/components/switches/ColorSwitches.js"}} + +## Controlled + +You can control the switch with the `checked` and `onChange` props: + +{{"demo": "pages/components/switches/ControlledSwitches.js"}} + ## Interruptores com FormGroup `FormGroup` é usado para agrupar componentes de seleção para facilitar o uso da API. `FormGroup` é usado para agrupar componentes de seleção para facilitar o uso da API. (Veja: [Quando usar](#when-to-use)). @@ -37,12 +53,6 @@ Aqui estão alguns exemplos de customização do componente. Você pode aprender 🎨 Se você está procurando inspiração, você pode verificar [os exemplos de customização de MUI Treasury](https://mui-treasury.com/styles/switch). -## Tamanhos - -Gosta de interruptores menores? Use a propriedade `size`. - -{{"demo": "pages/components/switches/SwitchesSize.js"}} - ## Posicionamento do rótulo Você pode alterar o posicionamento do rótulo: diff --git a/docs/src/pages/components/switches/switches-ru.md b/docs/src/pages/components/switches/switches-ru.md index ba5c8c9c0ae31c..4ce5ebe0451fe5 100644 --- a/docs/src/pages/components/switches/switches-ru.md +++ b/docs/src/pages/components/switches/switches-ru.md @@ -15,14 +15,30 @@ materialDesign: 'https://material.io/components/selection-controls#switches' ## Основные переключатели -{{"demo": "pages/components/switches/Switches.js"}} +{{"demo": "pages/components/switches/BasicSwitches.js"}} -## Переключатель с FormControlLabel +## Checkbox with FormGroup (Чекбоксы с FormGroup) -`Switch` can be provided with a description thanks to the `FormControlLabel` component. +You can provide a label to the `Switch` thanks to the `FormControlLabel` component. {{"demo": "pages/components/switches/SwitchLabels.js"}} +## Size + +Use the `size` prop to change the size of the switch. + +{{"demo": "pages/components/switches/SwitchesSize.js"}} + +## Цвет + +{{"demo": "pages/components/switches/ColorSwitches.js"}} + +## Controlled + +You can control the switch with the `checked` and `onChange` props: + +{{"demo": "pages/components/switches/ControlledSwitches.js"}} + ## Переключатели с FormGroup `FormGroup` - это полезная обертка, используемая для группировки компонентов элементов управления выбором, она предоставляет более простой API. `FormGroup` - это полезная обертка, используемая для группировки компонентов элементов управления выбором, она предоставляет более простой API. (See: [When to use](#when-to-use)). @@ -31,18 +47,12 @@ materialDesign: 'https://material.io/components/selection-controls#switches' ## Кастомизация переключателей -Ниже находятся примеры кастомизации компонента. You can learn more about this in the [overrides documentation page](/customization/how-to-customize/). +Ниже находятся примеры кастомизации компонента. Вы можете узнать об этом больше [в документации по переопределению свойств](/customization/how-to-customize/). {{"demo": "pages/components/switches/CustomizedSwitches.js"}} 🎨 If you are looking for inspiration, you can check [MUI Treasury's customization examples](https://mui-treasury.com/styles/switch). -## Размеры - -Fancy smaller switches? Use the `size` prop. - -{{"demo": "pages/components/switches/SwitchesSize.js"}} - ## Расположение метки Расположение метки можно изменить: @@ -51,7 +61,7 @@ Fancy smaller switches? Use the `size` prop. ## Бесплатно -- [Чекбоксы. Switch (переключатели)](https://uxplanet.org/checkbox-vs-toggle-switch-7fc6e83f10b8) +- [Checkboxes или Switches](https://uxplanet.org/checkbox-vs-toggle-switch-7fc6e83f10b8) ## Доступность diff --git a/docs/src/pages/components/switches/switches-zh.md b/docs/src/pages/components/switches/switches-zh.md index 8c55553971ecbb..312139a8a98035 100644 --- a/docs/src/pages/components/switches/switches-zh.md +++ b/docs/src/pages/components/switches/switches-zh.md @@ -15,14 +15,30 @@ materialDesign: 'https://material.io/components/selection-controls#switches' ## 基本的开关 -{{"demo": "pages/components/switches/Switches.js"}} +{{"demo": "pages/components/switches/BasicSwitches.js"}} -## 带有 FormControlLabel 的开关 +## 标签 -借助 `FormControlLabel` 组件,`Switch`能够提供一些描述。 +You can provide a label to the `Switch` thanks to the `FormControlLabel` component. {{"demo": "pages/components/switches/SwitchLabels.js"}} +## Size 大小 + +Use the `size` prop to change the size of the switch. + +{{"demo": "pages/components/switches/SwitchesSize.js"}} + +## Color 颜色 + +{{"demo": "pages/components/switches/ColorSwitches.js"}} + +## Controlled + +You can control the switch with the `checked` and `onChange` props: + +{{"demo": "pages/components/switches/ControlledSwitches.js"}} + ## 带有 FormGroup 的开关 `FormGroup` 会提供相对简单的 API 对选择控件进行分组。 但是,如果需要操作多个相关的控件,我们鼓励您使用 [Checkboxes](/components/checkboxes/) 来代替它。 (参见: [何时使用](#when-to-use))。 @@ -37,12 +53,6 @@ materialDesign: 'https://material.io/components/selection-controls#switches' 🎨 如果您还在寻找灵感,您可以查看一下 [MUI Treasury 自定义的例子](https://mui-treasury.com/components/button)。 -## 尺寸 - -想用一些优雅的小开关? 试着使用 `size` 属性吧。 - -{{"demo": "pages/components/switches/SwitchesSize.js"}} - ## 标签放置 你可以更改标签的位置: diff --git a/docs/src/pages/components/tables/tables-de.md b/docs/src/pages/components/tables/tables-de.md index a9e9123d6feb9c..e86ad61c84e4c2 100644 --- a/docs/src/pages/components/tables/tables-de.md +++ b/docs/src/pages/components/tables/tables-de.md @@ -28,7 +28,9 @@ Eine Daten-Tabelle enthält oben eine Kopfzeile, welche die Spaltennamen auflist The `Table` component has a close mapping to the native `<table>` elements. This constraint makes building rich data tables challenging. -The [`DataGrid` component](/components/data-grid/) is designed for use-cases that are focused around handling a large amounts of tabular data. While it comes with a more rigid structure, in exchange, you gain more powerful features. +The [`DataGrid` component](/components/data-grid/) is designed for use-cases that are focused on handling large amounts of tabular data. While it comes with a more rigid structure, in exchange, you gain more powerful features. + +{{"demo": "pages/components/tables/DataTable.js", "bg": "inline"}} ## Einfache Tabelle @@ -72,9 +74,9 @@ Die Eigenschaft `Action` der Komponente `TablePagination` ermöglicht die Implem {{"demo": "pages/components/tables/CustomPaginationActionsTable.js", "bg": true}} -## Fixed header +## Sticky header -An example of a table with scrollable rows and fixed column headers. It leverages the `stickyHeader` prop.<br /> (⚠️ no IE11 support) +Here is an example of a table with scrollable rows and fixed column headers. It leverages the `stickyHeader` prop. (⚠️ no IE 11 support) {{"demo": "pages/components/tables/StickyHeadTable.js", "bg": true}} diff --git a/docs/src/pages/components/tables/tables-es.md b/docs/src/pages/components/tables/tables-es.md index 4bd4ba5c998125..aef90f195524e4 100644 --- a/docs/src/pages/components/tables/tables-es.md +++ b/docs/src/pages/components/tables/tables-es.md @@ -28,7 +28,9 @@ Una tabla de datos contiene una cabecera en la parte superior con los nombres de The `Table` component has a close mapping to the native `<table>` elements. This constraint makes building rich data tables challenging. -The [`DataGrid` component](/components/data-grid/) is designed for use-cases that are focused around handling a large amounts of tabular data. While it comes with a more rigid structure, in exchange, you gain more powerful features. +The [`DataGrid` component](/components/data-grid/) is designed for use-cases that are focused on handling large amounts of tabular data. While it comes with a more rigid structure, in exchange, you gain more powerful features. + +{{"demo": "pages/components/tables/DataTable.js", "bg": "inline"}} ## Tabla Sencilla @@ -72,9 +74,9 @@ El atributo `Action`del componente `TablePagination` permite implementar accione {{"demo": "pages/components/tables/CustomPaginationActionsTable.js", "bg": true}} -## Fixed header +## Sticky header -An example of a table with scrollable rows and fixed column headers. It leverages the `stickyHeader` prop.<br /> (⚠️ no IE11 support) +Here is an example of a table with scrollable rows and fixed column headers. It leverages the `stickyHeader` prop. (⚠️ no IE 11 support) {{"demo": "pages/components/tables/StickyHeadTable.js", "bg": true}} diff --git a/docs/src/pages/components/tables/tables-fr.md b/docs/src/pages/components/tables/tables-fr.md index 9abd31a14e1bc6..f94433b0ed2ea6 100644 --- a/docs/src/pages/components/tables/tables-fr.md +++ b/docs/src/pages/components/tables/tables-fr.md @@ -1,5 +1,5 @@ --- -title: React Table component +title: Composant React Table components: Table, TableBody, TableCell, TableContainer, TableFooter, TableHead, TablePagination, TableRow, TableSortLabel githubLabel: 'component: Table' waiAria: 'https://www.w3.org/TR/wai-aria-practices/#table' @@ -10,7 +10,7 @@ materialDesign: https://material.io/components/data-tables <p class="description">Tables display sets of data. They can be fully customized.</p> -Tables display information in a way that's easy to scan, so that users can look for patterns and insights. Ils peuvent être intégrés au contenu principal, tel que les cartes. They can include: +Les tables affichent des informations d'une manière facile à numériser, afin que les utilisateurs puissent rechercher des modèles et des aperçus. Ils peuvent être intégrés au contenu principal, tel que les cartes. Ils peuvent inclure : - Une visualisation correspondante - Menu principal @@ -18,7 +18,7 @@ Tables display information in a way that's easy to scan, so that users can look {{"component": "modules/components/ComponentLinkHeader.js"}} -## Structure +## Tableau de base Un exemple simple et sans fioritures. @@ -30,6 +30,8 @@ The `Table` component has a close mapping to the native `<table>` elements. This The [`DataGrid` component](/components/data-grid/) is designed for use-cases that are focused around handling a large amounts of tabular data. While it comes with a more rigid structure, in exchange, you gain more powerful features. +{{"demo": "pages/components/tables/DataTable.js", "bg": "inline"}} + ## Tableau simple Des cases à cocher doivent accompagner chaque ligne si l'utilisateur doit sélectionner ou manipuler des données. @@ -54,13 +56,13 @@ Voici un exemple de personnalisation du composant. Vous pouvez en savoir plus da It's possible to customise the options shown in the "Rows per page" select using the `rowsPerPageOptions` prop. You should either provide an array of: -- **numbers**, each number will be used for the option's label and value. +- **nombres**, chaque nombre sera utilisé pour l'étiquette et la valeur de l'option. ```jsx <TablePagination rowsPerPageOptions={[10, 50]} /> ``` -- **objects**, the `value` and `label` keys will be used respectively for the value and label of the option (useful for language strings such as 'All'). +- **objects**, `value`, et `label` des clés seront utilisées respectivement pour la valeur et l'étiquette de l'option (utile pour les chaînes de langue telles que 'Tout'). ```jsx <TablePagination rowsPerPageOptions={[10, 50, { value: -1, label: 'All' }]} /> @@ -74,13 +76,13 @@ La propriété `Action` du composant `TablePagination` permet l'implémentation ## Fixed header -An example of a table with scrollable rows and fixed column headers. It leverages the `stickyHeader` prop.<br /> (⚠️ no IE11 support) +An example of a table with scrollable rows and fixed column headers. It leverages the `stickyHeader` prop.<br /> (⚠️ no IE11 support) (⚠️ no IE 11 support) {{"demo": "pages/components/tables/StickyHeadTable.js", "bg": true}} -## Column grouping +## Regroupement de colonnes -You can group column headers by rendering multiple table rows inside a table head: +Vous pouvez regrouper les en-têtes de colonne en affichant plusieurs lignes de la table dans une tête de la table : ```jsx <TableHead> @@ -113,8 +115,8 @@ Dans l'exemple suivant, nous montrons comment utiliser [react-virtualized](https (WAI tutorial: https://www.w3.org/WAI/tutorials/tables/) -### Caption +### Légende -A caption functions like a heading for a table. Most screen readers announce the content of captions. Captions help users to find a table and understand what it's about and decide if they want to read it. +A caption functions like a heading for a table. Most screen readers announce the content of captions. Les légendes aident les utilisateurs à trouver une table et à comprendre ce dont il est question et à décider s'ils veulent la lire. {{"demo": "pages/components/tables/AcccessibleTable.js", "bg": true}} diff --git a/docs/src/pages/components/tables/tables-ja.md b/docs/src/pages/components/tables/tables-ja.md index 39beaffbcc0101..d119ef9fa808db 100644 --- a/docs/src/pages/components/tables/tables-ja.md +++ b/docs/src/pages/components/tables/tables-ja.md @@ -28,7 +28,9 @@ Data tableの上部には、列名をリストするヘッダー行があり、 The `Table` component has a close mapping to the native `<table>` elements. This constraint makes building rich data tables challenging. -The [`DataGrid` component](/components/data-grid/) is designed for use-cases that are focused around handling a large amounts of tabular data. While it comes with a more rigid structure, in exchange, you gain more powerful features. +The [`DataGrid` component](/components/data-grid/) is designed for use-cases that are focused on handling large amounts of tabular data. While it comes with a more rigid structure, in exchange, you gain more powerful features. + +{{"demo": "pages/components/tables/DataTable.js", "bg": "inline"}} ## Simple Table @@ -46,7 +48,7 @@ An example of a table with expandable rows, revealing more information. It utili ## Customized tables -コンポーネントのカスタマイズ例を次に示します。 詳細については、 [overrides documentation page](/customization/how-to-customize/)を参照してください。 +コンポーネントのカスタマイズ例を次に示します。 詳細については、 [こちら](/customization/how-to-customize/)を参照してください。 {{"demo": "pages/components/tables/CustomizedTables.js", "bg": true}} @@ -72,9 +74,9 @@ It's possible to customise the options shown in the "Rows per page" select using {{"demo": "pages/components/tables/CustomPaginationActionsTable.js", "bg": true}} -## 固定ヘッダー +## Sticky header -An example of a table with scrollable rows and fixed column headers. It leverages the `stickyHeader` prop.<br /> (⚠️ no IE11 support) +Here is an example of a table with scrollable rows and fixed column headers. It leverages the `stickyHeader` prop. (⚠️ no IE 11 support) {{"demo": "pages/components/tables/StickyHeadTable.js", "bg": true}} diff --git a/docs/src/pages/components/tables/tables-pt.md b/docs/src/pages/components/tables/tables-pt.md index dad2213a075260..f38f25156b2b63 100644 --- a/docs/src/pages/components/tables/tables-pt.md +++ b/docs/src/pages/components/tables/tables-pt.md @@ -28,7 +28,9 @@ Uma tabela de dados contém uma linha de cabeçalho no topo que lista os nomes d O componente `Table` tem um mapeamento próximo dos elementos nativos de `<table>`. Este requisito torna a construção de tabelas de dados ricas e desafiadora. -O [componente `DataGrid`](/components/data-grid/) é projetado para situações de uso que focam em torno da manipulação de uma grande quantidade de dados tabulares. Enquanto vem com uma estrutura mais rígida, em troca, você ganha recursos poderosos. +The [`DataGrid` component](/components/data-grid/) is designed for use-cases that are focused on handling large amounts of tabular data. Enquanto vem com uma estrutura mais rígida, em troca, você ganha recursos poderosos. + +{{"demo": "pages/components/tables/DataTable.js", "bg": "inline"}} ## Tabela Simples @@ -72,9 +74,9 @@ A propriedade `Action` do componente `TablePagination` permite a implementação {{"demo": "pages/components/tables/CustomPaginationActionsTable.js", "bg": true}} -## Cabeçalho fixo +## Sticky header -Um exemplo de uma tabela com linhas roláveis e cabeçalhos de coluna fixos. Ela se aproveita da propriedade `stickyHeader`.<br /> (⚠️ sem suporte no IE11) +Here is an example of a table with scrollable rows and fixed column headers. It leverages the `stickyHeader` prop. (⚠️ no IE 11 support) {{"demo": "pages/components/tables/StickyHeadTable.js", "bg": true}} diff --git a/docs/src/pages/components/tables/tables-ru.md b/docs/src/pages/components/tables/tables-ru.md index 78e4c32a6c1e15..56d404cd958f15 100644 --- a/docs/src/pages/components/tables/tables-ru.md +++ b/docs/src/pages/components/tables/tables-ru.md @@ -28,7 +28,9 @@ Tables display information in a way that's easy to scan, so that users can look The `Table` component has a close mapping to the native `<table>` elements. This constraint makes building rich data tables challenging. -The [`DataGrid` component](/components/data-grid/) is designed for use-cases that are focused around handling a large amounts of tabular data. While it comes with a more rigid structure, in exchange, you gain more powerful features. +The [`DataGrid` component](/components/data-grid/) is designed for use-cases that are focused on handling large amounts of tabular data. While it comes with a more rigid structure, in exchange, you gain more powerful features. + +{{"demo": "pages/components/tables/DataTable.js", "bg": "inline"}} ## Простая таблица @@ -46,7 +48,7 @@ The [`DataGrid` component](/components/data-grid/) is designed for use-cases tha ## Настраиваемые таблицы -Ниже находится пример кастомизации компонента. You can learn more about this in the [overrides documentation page](/customization/how-to-customize/). +Ниже находится пример кастомизации компонента. Вы можете узнать об этом больше [в документации по переопределению свойств](/customization/how-to-customize/). {{"demo": "pages/components/tables/CustomizedTables.js", "bg": true}} @@ -72,9 +74,9 @@ The [`DataGrid` component](/components/data-grid/) is designed for use-cases tha {{"demo": "pages/components/tables/CustomPaginationActionsTable.js", "bg": true}} -## Фиксированный заголовок +## Sticky header -Пример таблицы с прокручиваемыми строками и фиксированными заголовками столбцов. It leverages the `stickyHeader` prop.<br /> (⚠️ no IE11 support) +Here is an example of a table with scrollable rows and fixed column headers. It leverages the `stickyHeader` prop. (⚠️ no IE 11 support) {{"demo": "pages/components/tables/StickyHeadTable.js", "bg": true}} diff --git a/docs/src/pages/components/tables/tables-zh.md b/docs/src/pages/components/tables/tables-zh.md index b133ade478727d..809c5b6834b424 100644 --- a/docs/src/pages/components/tables/tables-zh.md +++ b/docs/src/pages/components/tables/tables-zh.md @@ -10,7 +10,7 @@ materialDesign: https://material.io/components/data-tables <p class="description">表格展示数据组。 它们是完全可以自定义的。</p> -Tables display information in a way that's easy to scan, so that users can look for patterns and insights. 表格可以被内嵌在主要内容中,如 卡片(cards)。 表格可以被内嵌在主要内容中,如 卡片(cards)。 它们可以包括: +表格以一种易于扫描的方式显示信息,以便用户洞察和寻找模型。 表格可以被内嵌在主要内容中,如 卡片(cards)。 它们可以包括: - 对应的可视化效果 - 导航 @@ -28,7 +28,9 @@ Tables display information in a way that's easy to scan, so that users can look `Table` 组件与原生 `<table>` 元素存在密切关联。 这种限制条件导致要构建丰富的数据表格会变得很有挑战性。 -[`DataGrid` 组件](/components/data-grid/) 专为需要处理大量表格数据的情况而设计。 虽然它的结构相比之下不够灵活,但是有失必有得,牺牲灵活性来换取更强大的功能。 +The [`DataGrid` component](/components/data-grid/) is designed for use-cases that are focused on handling large amounts of tabular data. 虽然它的结构相比之下不够灵活,但是有失必有得,牺牲灵活性来换取更强大的功能。 + +{{"demo": "pages/components/tables/DataTable.js", "bg": "inline"}} ## 紧凑型表格 @@ -52,7 +54,7 @@ Tables display information in a way that's easy to scan, so that users can look ### 自定义的分页选项 -通过 `rowsPerPageOptions` 属性,也可以自定义 "Rows per page" 显示的选择项。 你应该提供以下一种数组: +你也可以使用 `rowsPerPageOptions` 属性来自定义 "Rows per page" 显示的选择项。 你应该提供以下一种数组: - **数字(numbers)**,而每个数字用作为选择项的标签(label)和值(value)。 @@ -72,9 +74,9 @@ Tables display information in a way that's easy to scan, so that users can look {{"demo": "pages/components/tables/CustomPaginationActionsTable.js", "bg": true}} -## 固定表头 +## Sticky header -一个具有可滚动行和固定表头的表格示例。 它是利用 `stickyHeader` 属性 <br /> 实现的(不支持 IE11)。 +Here is an example of a table with scrollable rows and fixed column headers. It leverages the `stickyHeader` prop. (⚠️ no IE 11 support) {{"demo": "pages/components/tables/StickyHeadTable.js", "bg": true}} @@ -115,6 +117,6 @@ Tables display information in a way that's easy to scan, so that users can look ### Caption 字幕 -字幕能够充当表格的表头。 大多数屏幕阅读器能够宣读字幕的内容。 Captions help users to find a table and understand what it's about and decide if they want to read it. +字幕能够充当表格的表头。 大多数屏幕阅读器能够宣读字幕的内容。 标题可以帮助用户找到表格,了解表格的内容,决定是否要阅读。 {{"demo": "pages/components/tables/AcccessibleTable.js", "bg": true}} diff --git a/docs/src/pages/components/tabs/tabs-de.md b/docs/src/pages/components/tabs/tabs-de.md index 9b3e484d2d8745..5fde4fd28491fe 100644 --- a/docs/src/pages/components/tabs/tabs-de.md +++ b/docs/src/pages/components/tabs/tabs-de.md @@ -16,25 +16,35 @@ waiAria: 'https://www.w3.org/TR/wai-aria-practices/#tabpanel' ## Einfache Tabs -{{"demo": "pages/components/tabs/SimpleTabs.js", "bg": true}} +A basic example with tab panels. -{{"demo": "pages/components/tabs/BasicTabs.js", "bg": true}} +{{"demo": "pages/components/tabs/BasicTabs.js"}} -### Umbrechen von Tab Beschriftungen +## Experimental API + +`@material-ui/lab` offers utility components that inject props to implement accessible tabs following [WAI-ARIA authoring practices](https://www.w3.org/TR/wai-aria-practices/#tabpanel). + +{{"demo": "pages/components/tabs/LabTabs.js"}} + +## Umbrechen von Tab Beschriftungen -Lange Beschriftungen werden automatisch umgebrochen. Zu lange Beschriftungen sind allerdings nicht sichtbar und werden abgeschnitten (`overflow`). +Lange Beschriftungen werden automatisch umgebrochen. If the label is too long for the tab, it will overflow, and the text will not be visible. -{{"demo": "pages/components/tabs/TabsWrappedLabel.js", "bg": true}} +{{"demo": "pages/components/tabs/TabsWrappedLabel.js"}} -### Deaktivierter Tab +## Colored tab -Ein Tab kann durch die Eigenschaft `disabled` deaktiviert werden. +{{"demo": "pages/components/tabs/ColorTabs.js"}} -{{"demo": "pages/components/tabs/DisabledTabs.js", "bg": true}} +## Deaktivierter Tab + +A tab can be disabled by setting the `disabled` prop. + +{{"demo": "pages/components/tabs/DisabledTabs.js"}} ## Feste Tabs -Feste Tabs sollten mit einer begrenzten Anzahl von Tabs verwendet werden, und wenn eine gleichmäßige Platzierung das Muskelgedächtnis verbessert. +Fixed tabs should be used with a limited number of tabs, and when a consistent placement will aid muscle memory. ### Gesamte Breite @@ -74,7 +84,7 @@ If you want to make sure the buttons are always visible, you should customize th ### Scrolltasten verhindern -Left and right scroll buttons are never be presented with `scrollButtons={false}`. All scrolling must be initiated through user agent scrolling mechanisms (e.g. left/right swipe, shift-mousewheel, etc.) +Left and right scroll buttons are never be presented with `scrollButtons={false}`. All scrolling must be initiated through user agent scrolling mechanisms (e.g. left/right swipe, shift mouse wheel, etc.) {{"demo": "pages/components/tabs/ScrollableTabsButtonPrevent.js", "bg": true}} @@ -82,7 +92,7 @@ Left and right scroll buttons are never be presented with `scrollButtons={false} Hier ist ein Beispiel zum Anpassen der Komponente. Mehr dazu erfahren Sie auf der [Überschreibungsdokumentationsseite](/customization/how-to-customize/). -{{"demo": "pages/components/tabs/CustomizedTabs.js", "bg": true}} +{{"demo": "pages/components/tabs/CustomizedTabs.js"}} 🎨 Wenn Sie nach Inspiration suchen, sehen sie sich [MUI Treasury's Anpassungs-Beispiele](https://mui-treasury.com/styles/tabs/) an. @@ -94,19 +104,23 @@ Tab-Beschriftungen können entweder nur Symbole oder nur Text enthalten. Note that you can restore the scrollbar with `visibleScrollbar`. -## Nav-Tabs +## Nav tabs -Standardmäßig verwenden Registerkarten als `Button-` Element dargestellt, Sie können jedoch Ihr eigenes benutzerdefiniertes Tag oder Ihre eigene Komponente definieren. Here's an example of implementing tabbed navigation: +By default, tabs use a `button` element, but you can provide your custom tag or component. Here's an example of implementing tabbed navigation: -{{"demo": "pages/components/tabs/NavTabs.js", "bg": true}} +{{"demo": "pages/components/tabs/NavTabs.js"}} -## Symbol-Tabs +## Icon tabs Tab-Beschriftungen können entweder nur Symbole oder nur Text enthalten. -{{"demo": "pages/components/tabs/IconTabs.js", "bg": true}} +{{"demo": "pages/components/tabs/IconTabs.js"}} + +{{"demo": "pages/components/tabs/IconLabelTabs.js"}} + +## Drittanbieter-Routing Bibliothek -{{"demo": "pages/components/tabs/IconLabelTabs.js", "bg": true}} +One frequent use case is to perform navigation on the client only, without an HTTP round-trip to the server. The `Tab` component provides the `component` prop to handle this use case. Here is a [more detailed guide](/guides/routing/#tabs). ## Barrierefreiheit @@ -125,19 +139,18 @@ The components implement keyboard navigation using the "manual activation" behav #### Demo -The following two demos only differ in their keyboard navigation behavior. Focus a tab and navigate with arrow keys to notice the difference. +The following two demos only differ in their keyboard navigation behavior. Focus a tab and navigate with arrow keys to notice the difference, e.g. <kbd class="key">Arrow Left</kbd>. ```jsx /* Tabs where selection follows focus */ <Tabs selectionFollowsFocus /> -/* Tabs where each tab needs to be selected manually */ -<Tabs /> ``` -{{"demo": "pages/components/tabs/AccessibleTabs.js", "bg": true}} +{{"demo": "pages/components/tabs/AccessibleTabs1.js", "defaultCodeOpen": false}} -## Experimental API - -`@material-ui/lab` offers utility components that inject props to implement accessible tabs following [WAI-ARIA authoring practices](https://www.w3.org/TR/wai-aria-practices/#tabpanel). +```jsx +/* Tabs where each tab needs to be selected manually */ +<Tabs /> +``` -{{"demo": "pages/components/tabs/LabTabs.js", "bg": true}} +{{"demo": "pages/components/tabs/AccessibleTabs2.js", "defaultCodeOpen": false}} diff --git a/docs/src/pages/components/tabs/tabs-es.md b/docs/src/pages/components/tabs/tabs-es.md index f71d08f99a36e3..561d21afc46f2c 100644 --- a/docs/src/pages/components/tabs/tabs-es.md +++ b/docs/src/pages/components/tabs/tabs-es.md @@ -16,25 +16,35 @@ waiAria: 'https://www.w3.org/TR/wai-aria-practices/#tabpanel' ## Simple Tabs -{{"demo": "pages/components/tabs/SimpleTabs.js", "bg": true}} +A basic example with tab panels. -{{"demo": "pages/components/tabs/BasicTabs.js", "bg": true}} +{{"demo": "pages/components/tabs/BasicTabs.js"}} -### Wrapped Labels +## Experimental API + +`@material-ui/lab` offers utility components that inject props to implement accessible tabs following [WAI-ARIA authoring practices](https://www.w3.org/TR/wai-aria-practices/#tabpanel). + +{{"demo": "pages/components/tabs/LabTabs.js"}} + +## Wrapped Labels -Long labels will automatically wrap on tabs. If the label is too long for the tab, it will overflow and the text will not be visible. +Long labels will automatically wrap on tabs. If the label is too long for the tab, it will overflow, and the text will not be visible. -{{"demo": "pages/components/tabs/TabsWrappedLabel.js", "bg": true}} +{{"demo": "pages/components/tabs/TabsWrappedLabel.js"}} -### Disabled Tab +## Colored tab -A Tab can be disabled by setting `disabled` property. +{{"demo": "pages/components/tabs/ColorTabs.js"}} -{{"demo": "pages/components/tabs/DisabledTabs.js", "bg": true}} +## Disabled Tab + +A tab can be disabled by setting the `disabled` prop. + +{{"demo": "pages/components/tabs/DisabledTabs.js"}} ## Fixed Tabs -Fixed tabs should be used with a limited number of tabs and when consistent placement will aid muscle memory. +Fixed tabs should be used with a limited number of tabs, and when a consistent placement will aid muscle memory. ### Full width @@ -74,7 +84,7 @@ If you want to make sure the buttons are always visible, you should customize th ### Prevent Scroll Buttons -Left and right scroll buttons are never be presented with `scrollButtons={false}`. All scrolling must be initiated through user agent scrolling mechanisms (e.g. left/right swipe, shift-mousewheel, etc.) +Left and right scroll buttons are never be presented with `scrollButtons={false}`. All scrolling must be initiated through user agent scrolling mechanisms (e.g. left/right swipe, shift mouse wheel, etc.) {{"demo": "pages/components/tabs/ScrollableTabsButtonPrevent.js", "bg": true}} @@ -82,7 +92,7 @@ Left and right scroll buttons are never be presented with `scrollButtons={false} He aquí un ejemplo de personalización del componente. Puedes aprender más sobre esto en la [sección Personalizando Componentes de la documentación](/customization/how-to-customize/). -{{"demo": "pages/components/tabs/CustomizedTabs.js", "bg": true}} +{{"demo": "pages/components/tabs/CustomizedTabs.js"}} 🎨 Si estás buscando inspiración, puedes mirar [los ejemplos de MUI Treasury](https://mui-treasury.com/styles/tabs/). @@ -94,19 +104,23 @@ To make vertical tabs instead of default horizontal ones, there is `orientation= Note that you can restore the scrollbar with `visibleScrollbar`. -## Nav Tabs +## Nav tabs -By default tabs use a `button` element, but you can provide your own custom tag or component. Here's an example of implementing tabbed navigation: +By default, tabs use a `button` element, but you can provide your custom tag or component. Here's an example of implementing tabbed navigation: -{{"demo": "pages/components/tabs/NavTabs.js", "bg": true}} +{{"demo": "pages/components/tabs/NavTabs.js"}} -## Icon Tabs +## Icon tabs Tab labels may be either all icons or all text. -{{"demo": "pages/components/tabs/IconTabs.js", "bg": true}} +{{"demo": "pages/components/tabs/IconTabs.js"}} + +{{"demo": "pages/components/tabs/IconLabelTabs.js"}} + +## Librería externa de routing -{{"demo": "pages/components/tabs/IconLabelTabs.js", "bg": true}} +One frequent use case is to perform navigation on the client only, without an HTTP round-trip to the server. The `Tab` component provides the `component` prop to handle this use case. Here is a [more detailed guide](/guides/routing/#tabs). ## Accesibilidad @@ -125,19 +139,18 @@ The components implement keyboard navigation using the "manual activation" behav #### Demo -The following two demos only differ in their keyboard navigation behavior. Focus a tab and navigate with arrow keys to notice the difference. +The following two demos only differ in their keyboard navigation behavior. Focus a tab and navigate with arrow keys to notice the difference, e.g. <kbd class="key">Arrow Left</kbd>. ```jsx /* Tabs where selection follows focus */ <Tabs selectionFollowsFocus /> -/* Tabs where each tab needs to be selected manually */ -<Tabs /> ``` -{{"demo": "pages/components/tabs/AccessibleTabs.js", "bg": true}} +{{"demo": "pages/components/tabs/AccessibleTabs1.js", "defaultCodeOpen": false}} -## Experimental API - -`@material-ui/lab` offers utility components that inject props to implement accessible tabs following [WAI-ARIA authoring practices](https://www.w3.org/TR/wai-aria-practices/#tabpanel). +```jsx +/* Tabs where each tab needs to be selected manually */ +<Tabs /> +``` -{{"demo": "pages/components/tabs/LabTabs.js", "bg": true}} +{{"demo": "pages/components/tabs/AccessibleTabs2.js", "defaultCodeOpen": false}} diff --git a/docs/src/pages/components/tabs/tabs-fr.md b/docs/src/pages/components/tabs/tabs-fr.md index ae5291a534a6d0..44a3d4e30644b4 100644 --- a/docs/src/pages/components/tabs/tabs-fr.md +++ b/docs/src/pages/components/tabs/tabs-fr.md @@ -20,15 +20,15 @@ waiAria: 'https://www.w3.org/TR/wai-aria-practices/#tabpanel' {{"demo": "pages/components/tabs/BasicTabs.js", "bg": true}} -### Wrapped Labels +## Experimental API -Long labels will automatically wrap on tabs. If the label is too long for the tab, it will overflow and the text will not be visible. +`@material-ui/lab` offers utility components that inject props to implement accessible tabs following [WAI-ARIA authoring practices](https://www.w3.org/TR/wai-aria-practices/#tabpanel). {{"demo": "pages/components/tabs/TabsWrappedLabel.js", "bg": true}} -### Disabled Tab +## Scrollable Tabs -A Tab can be disabled by setting `disabled` property. +Long labels will automatically wrap on tabs. Long labels will automatically wrap on tabs. {{"demo": "pages/components/tabs/DisabledTabs.js", "bg": true}} @@ -36,6 +36,16 @@ A Tab can be disabled by setting `disabled` property. Fixed tabs should be used with a limited number of tabs and when consistent placement will aid muscle memory. +## Disabled Tab + +A Tab can be disabled by setting `disabled` property. + +{{"demo": "pages/components/tabs/LabTabs.js", "bg": true}} + +## Nav Tabs + +The `centered` property should be used for larger views. + ### Full width The `variant="fullWidth"` property should be used for smaller views. This demo also uses [react-swipeable-views](https://github.com/oliviertassinari/react-swipeable-views) to animate the Tab transition, and allowing tabs to be swiped on touch devices. @@ -48,15 +58,15 @@ The `centered` property should be used for larger views. {{"demo": "pages/components/tabs/CenteredTabs.js", "bg": true}} -## Scrollable Tabs +## Icon Tabs -### Automatic Scroll Buttons +### Forced Scroll Buttons Left and right scroll buttons will automatically be presented on desktop and hidden on mobile. (based on viewport width) {{"demo": "pages/components/tabs/ScrollableTabsButtonAuto.js", "bg": true}} -### Forced Scroll Buttons +### Prevent Scroll Buttons Left and right scroll buttons be presented (reserve space) regardless of the viewport width with `scrollButtons={true}` `allowScrollButtonsMobile`: @@ -72,7 +82,7 @@ If you want to make sure the buttons are always visible, you should customize th {{"demo": "pages/components/tabs/ScrollableTabsButtonVisible.js", "bg": true}} -### Prevent Scroll Buttons +### Automatic Scroll Buttons Left and right scroll buttons are never be presented with `scrollButtons={false}`. All scrolling must be initiated through user agent scrolling mechanisms (e.g. left/right swipe, shift-mousewheel, etc.) @@ -94,19 +104,23 @@ To make vertical tabs instead of default horizontal ones, there is `orientation= Note that you can restore the scrollbar with `visibleScrollbar`. -## Nav Tabs +## Nav tabs By default tabs use a `button` element, but you can provide your own custom tag or component. Here's an example of implementing tabbed navigation: -{{"demo": "pages/components/tabs/NavTabs.js", "bg": true}} +{{"demo": "pages/components/tabs/IconLabelTabs.js", "bg": true}} -## Icon Tabs +## Icon tabs Tab labels may be either all icons or all text. {{"demo": "pages/components/tabs/IconTabs.js", "bg": true}} -{{"demo": "pages/components/tabs/IconLabelTabs.js", "bg": true}} +{{"demo": "pages/components/tabs/NavTabs.js", "bg": true}} + +## Bibliothèque de routage tierce + +One frequent use case is to perform navigation on the client only, without an HTTP round-trip to the server. The `Tab` component provides the `component` prop to handle this use case. Here is a [more detailed guide](/guides/routing/#tabs). ## Accessibilité @@ -136,8 +150,9 @@ The following two demos only differ in their keyboard navigation behavior. Focus {{"demo": "pages/components/tabs/AccessibleTabs.js", "bg": true}} -## Experimental API - -`@material-ui/lab` offers utility components that inject props to implement accessible tabs following [WAI-ARIA authoring practices](https://www.w3.org/TR/wai-aria-practices/#tabpanel). +```jsx +/* Tabs where each tab needs to be selected manually */ +<Tabs /> +``` -{{"demo": "pages/components/tabs/LabTabs.js", "bg": true}} +{{"demo": "pages/components/tabs/AccessibleTabs2.js", "defaultCodeOpen": false}} diff --git a/docs/src/pages/components/tabs/tabs-ja.md b/docs/src/pages/components/tabs/tabs-ja.md index 924dbaf1bfe56d..1e8df3fc246f35 100644 --- a/docs/src/pages/components/tabs/tabs-ja.md +++ b/docs/src/pages/components/tabs/tabs-ja.md @@ -16,29 +16,39 @@ waiAria: 'https://www.w3.org/TR/wai-aria-practices/#tabpanel' ## シンプルなタブ -{{"demo": "pages/components/tabs/SimpleTabs.js", "bg": true}} +A basic example with tab panels. -{{"demo": "pages/components/tabs/BasicTabs.js", "bg": true}} +{{"demo": "pages/components/tabs/BasicTabs.js"}} -### ラップされたラベル +## Experimental API + +`@material-ui/lab` offers utility components that inject props to implement accessible tabs following [WAI-ARIA authoring practices](https://www.w3.org/TR/wai-aria-practices/#tabpanel). + +{{"demo": "pages/components/tabs/LabTabs.js"}} + +## ラップされたラベル -長いラベルはタブで自動的に折り返されます。 ラベルがタブに対して長すぎる場合、ラベルはオーバーフローし、テキストは表示されません。 長いラベルはタブで自動的に折り返されます。 ラベルがタブに対して長すぎる場合、ラベルはオーバーフローし、テキストは表示されません。 長いラベルはタブで自動的に折り返されます。 ラベルがタブに対して長すぎる場合、ラベルはオーバーフローし、テキストは表示されません。 長いラベルはタブで自動的に折り返されます。 ラベルがタブに対して長すぎる場合、ラベルはオーバーフローし、テキストは表示されません。 長いラベルはタブで自動的に折り返されます。 ラベルがタブに対して長すぎる場合、ラベルはオーバーフローし、テキストは表示されません。 長いラベルはタブで自動的に折り返されます。 ラベルがタブに対して長すぎる場合、ラベルはオーバーフローし、テキストは表示されません。 +長いラベルはタブで自動的に折り返されます。 If the label is too long for the tab, it will overflow, and the text will not be visible. -{{"demo": "pages/components/tabs/TabsWrappedLabel.js", "bg": true}} +{{"demo": "pages/components/tabs/TabsWrappedLabel.js"}} -### 無効タブ +## Colored tab -`disabled` プロパティを設定すると、タブを無効にできます。 +{{"demo": "pages/components/tabs/ColorTabs.js"}} -{{"demo": "pages/components/tabs/DisabledTabs.js", "bg": true}} +## 無効タブ + +A tab can be disabled by setting the `disabled` prop. + +{{"demo": "pages/components/tabs/DisabledTabs.js"}} ## 固定タブ -固定タブは、限られた数のタブで、一定の配置が筋肉の記憶に役立つ場合に使用します。 +Fixed tabs should be used with a limited number of tabs, and when a consistent placement will aid muscle memory. ### 最大幅 -小さいビューには、 `variant = "fullWidth"` プロパティを使用する必要があります。 小さいビューには、 `variant = "fullWidth"` プロパティを使用する必要があります。 小さいビューには、 `variant = "fullWidth"` プロパティを使用する必要があります。 このデモでは、 [react-swipeable-views](https://github.com/oliviertassinari/react-swipeable-views) を使用してタブの遷移をアニメーション化し、タッチデバイスでタブをスワイプできるようにします。 +小さいビューには、 `variant = "fullWidth"` プロパティを使用する必要があります。 このデモでは、 [react-swipeable-views](https://github.com/oliviertassinari/react-swipeable-views) を使用してタブの遷移をアニメーション化し、タッチデバイスでタブをスワイプできるようにします。 {{"demo": "pages/components/tabs/FullWidthTabs.js", "bg": true}} @@ -74,15 +84,15 @@ If you want to make sure the buttons are always visible, you should customize th ### スクロールボタンを防ぐ -Left and right scroll buttons are never be presented with `scrollButtons={false}`. 左右のスクロールボタンは表示されません。 左右のスクロールボタンは表示されません。 左右のスクロールボタンは表示されません。 左右のスクロールボタンは表示されません。 左右のスクロールボタンは表示されません。 すべてのスクロールは、ユーザーエージェントのスクロールメカニズム(たとえば、左右のスワイプ、Shift-マウスホイールなど。)を使用して開始する必要があります。 +Left and right scroll buttons are never be presented with `scrollButtons={false}`. All scrolling must be initiated through user agent scrolling mechanisms (e.g. left/right swipe, shift mouse wheel, etc.) {{"demo": "pages/components/tabs/ScrollableTabsButtonPrevent.js", "bg": true}} ## カスタマイズされたタブ -コンポーネントのカスタマイズ例を次に示します。 詳細については、 [overrides documentation page](/customization/how-to-customize/)を参照してください。 +コンポーネントのカスタマイズ例を次に示します。 詳細については、 [こちら](/customization/how-to-customize/)を参照してください。 -{{"demo": "pages/components/tabs/CustomizedTabs.js", "bg": true}} +{{"demo": "pages/components/tabs/CustomizedTabs.js"}} 🎨 インスピレーションを求めている場合は、 [MUI Treasury's customization examples](https://mui-treasury.com/styles/tabs/) を確認すると良いでしょう。 @@ -94,19 +104,23 @@ Left and right scroll buttons are never be presented with `scrollButtons={false} Note that you can restore the scrollbar with `visibleScrollbar`. -## ナビゲーションタブ +## Nav tabs -デフォルトでは、タブは `button`要素を使用しますが、独自のカスタムタグまたはコンポーネントを提供できます。 次に、タブナビゲーションを実装する例を示します。 次に、タブナビゲーションを実装する例を示します。 次に、タブナビゲーションを実装する例を示します。 次に、タブナビゲーションを実装する例を示します。 +By default, tabs use a `button` element, but you can provide your custom tag or component. 次に、タブナビゲーションを実装する例を示します。 -{{"demo": "pages/components/tabs/NavTabs.js", "bg": true}} +{{"demo": "pages/components/tabs/NavTabs.js"}} -## アイコンタブ +## Icon tabs タブラベルは、すべてアイコンまたはすべてテキストのいずれかです。 -{{"demo": "pages/components/tabs/IconTabs.js", "bg": true}} +{{"demo": "pages/components/tabs/IconTabs.js"}} + +{{"demo": "pages/components/tabs/IconLabelTabs.js"}} + +## サードパーティ製ルーティングライブラリ -{{"demo": "pages/components/tabs/IconLabelTabs.js", "bg": true}} +One frequent use case is to perform navigation on the client only, without an HTTP round-trip to the server. The `Tab` component provides the `component` prop to handle this use case. Here is a [more detailed guide](/guides/routing/#tabs). ## アクセシビリティ @@ -125,19 +139,18 @@ The components implement keyboard navigation using the "manual activation" behav #### Demo -The following two demos only differ in their keyboard navigation behavior. Focus a tab and navigate with arrow keys to notice the difference. +The following two demos only differ in their keyboard navigation behavior. Focus a tab and navigate with arrow keys to notice the difference, e.g. <kbd class="key">Arrow Left</kbd>. ```jsx /* Tabs where selection follows focus */ <Tabs selectionFollowsFocus /> -/* Tabs where each tab needs to be selected manually */ -<Tabs /> ``` -{{"demo": "pages/components/tabs/AccessibleTabs.js", "bg": true}} +{{"demo": "pages/components/tabs/AccessibleTabs1.js", "defaultCodeOpen": false}} -## Experimental API - -`@material-ui/lab` offers utility components that inject props to implement accessible tabs following [WAI-ARIA authoring practices](https://www.w3.org/TR/wai-aria-practices/#tabpanel). +```jsx +/* Tabs where each tab needs to be selected manually */ +<Tabs /> +``` -{{"demo": "pages/components/tabs/LabTabs.js", "bg": true}} +{{"demo": "pages/components/tabs/AccessibleTabs2.js", "defaultCodeOpen": false}} diff --git a/docs/src/pages/components/tabs/tabs-pt.md b/docs/src/pages/components/tabs/tabs-pt.md index 16775629b08014..8a194837d22074 100644 --- a/docs/src/pages/components/tabs/tabs-pt.md +++ b/docs/src/pages/components/tabs/tabs-pt.md @@ -16,25 +16,35 @@ As [abas](https://material.io/design/components/tabs.html) organizam e permitem ## Abas simples -{{"demo": "pages/components/tabs/SimpleTabs.js", "bg": true}} +A basic example with tab panels. -{{"demo": "pages/components/tabs/BasicTabs.js", "bg": true}} +{{"demo": "pages/components/tabs/BasicTabs.js"}} -### Rótulos com quebras +## API experimental + +O `@material-ui/lab` oferece componentes auxiliares que injetam propriedades para implementar abas acessíveis seguindo as [práticas de autoria da WAI-ARIA](https://www.w3.org/TR/wai-aria-practices/#tabpanel). + +{{"demo": "pages/components/tabs/LabTabs.js"}} -Os rótulos longos serão quebrados automaticamente nas abas. Se o rótulo for muito longo para a aba, ele irá exceder e o texto não ficará visível. +## Rótulos com quebras -{{"demo": "pages/components/tabs/TabsWrappedLabel.js", "bg": true}} +Os rótulos longos serão quebrados automaticamente nas abas. If the label is too long for the tab, it will overflow, and the text will not be visible. -### Aba desativada +{{"demo": "pages/components/tabs/TabsWrappedLabel.js"}} -Uma aba pode ser desabilitada definindo a propriedade `disabled`. +## Colored tab -{{"demo": "pages/components/tabs/DisabledTabs.js", "bg": true}} +{{"demo": "pages/components/tabs/ColorTabs.js"}} + +## Aba desativada + +A tab can be disabled by setting the `disabled` prop. + +{{"demo": "pages/components/tabs/DisabledTabs.js"}} ## Abas fixas -As abas fixas devem ser usadas com um número limitado de abas e quando o posicionamento consistente ajudar na memorização. +Fixed tabs should be used with a limited number of tabs, and when a consistent placement will aid muscle memory. ### Largura total @@ -74,7 +84,7 @@ Se você quiser certificar-se de que os botões são sempre visíveis, você dev ### Impedir botões de rolagem -Botões de rolagem da esquerda e direita nunca serão apresentados com `scrollButtons={false}`. Toda rolagem deve ser iniciada por meio de mecanismos de rolagem do agente do usuário (por exemplo, deslizar para a esquerda/direita, rolar scroll do mouse, etc.) +Botões de rolagem da esquerda e direita nunca serão apresentados com `scrollButtons={false}`. All scrolling must be initiated through user agent scrolling mechanisms (e.g. left/right swipe, shift mouse wheel, etc.) {{"demo": "pages/components/tabs/ScrollableTabsButtonPrevent.js", "bg": true}} @@ -82,7 +92,7 @@ Botões de rolagem da esquerda e direita nunca serão apresentados com `scrollBu Aqui está um exemplo de customização do componente. Você pode aprender mais sobre isso na [página de documentação de sobrescritas](/customization/how-to-customize/). -{{"demo": "pages/components/tabs/CustomizedTabs.js", "bg": true}} +{{"demo": "pages/components/tabs/CustomizedTabs.js"}} 🎨 Se você está procurando inspiração, você pode verificar [os exemplos de customização de MUI Treasury](https://mui-treasury.com/styles/tabs/). @@ -94,19 +104,23 @@ O rótulo das abas podem ser compostos apenas por ícones ou apenas por texto. Note que você pode restaurar a barra de rolagem com `visibleScrollbar`. -## Abas de navegação +## Nav tabs -Por padrão, as abas usam um elemento `button`, mas você pode fornecer sua própria tag customizada ou componente. Veja um exemplo de implementação da navegação por abas: +By default, tabs use a `button` element, but you can provide your custom tag or component. Veja um exemplo de implementação da navegação por abas: -{{"demo": "pages/components/tabs/NavTabs.js", "bg": true}} +{{"demo": "pages/components/tabs/NavTabs.js"}} -## Abas com ícones +## Icon tabs O rótulo das abas podem ser compostos apenas por ícones ou apenas por texto. -{{"demo": "pages/components/tabs/IconTabs.js", "bg": true}} +{{"demo": "pages/components/tabs/IconTabs.js"}} + +{{"demo": "pages/components/tabs/IconLabelTabs.js"}} -{{"demo": "pages/components/tabs/IconLabelTabs.js", "bg": true}} +## Biblioteca de roteamento de terceiros + +One frequent use case is to perform navigation on the client only, without an HTTP round-trip to the server. The `Tab` component provides the `component` prop to handle this use case. Here is a [more detailed guide](/guides/routing/#tabs). ## Acessibilidade @@ -121,23 +135,22 @@ Um exemplo para a implementação atual pode ser encontrado nas demonstrações ### Navegação por teclado -Os componentes implementam a navegação do teclado usando o comportamento de "ativação manual". Se você quiser mudar para o comportamento "seleção segue automaticamente o foco" você deve definir `selectionFollowsFocus` no componente `Tabs`. As práticas de autoria da WAI-ARIA têm um guia detalhado sobre [how to decide when to make selection automatically follow focus](https://www.w3.org/TR/wai-aria-practices/#kbd_selection_follows_focus). +Os componentes implementam a navegação do teclado usando o comportamento de "ativação manual". Se você quiser mudar para o comportamento "seleção segue automaticamente o foco" você deve definir `selectionFollowsFocus` no componente `Tabs`. As práticas de autoria da WAI-ARIA têm um guia detalhado sobre [como decidir quando fazer a seleção seguir automaticamente o foco](https://www.w3.org/TR/wai-aria-practices/#kbd_selection_follows_focus). #### Demonstração -As duas demonstrações seguintes diferem apenas no seu comportamento de navegação por teclado. Foque em uma aba e navegue com as teclas de seta para notar a diferença. +As duas demonstrações seguintes diferem apenas no seu comportamento de navegação por teclado. Focus a tab and navigate with arrow keys to notice the difference, e.g. <kbd class="key">Arrow Left</kbd>. ```jsx -/* Abas onde a seleção segue o foco */ +/* Tabs where selection follows focus */ <Tabs selectionFollowsFocus /> -/* Abas onde cada aba precisa ser selecionada manualmente */ -<Tabs /> ``` -{{"demo": "pages/components/tabs/AccessibleTabs.js", "bg": true}} - -## API experimental +{{"demo": "pages/components/tabs/AccessibleTabs1.js", "defaultCodeOpen": false}} -O `@material-ui/lab` oferece componentes auxiliares que injetam propriedades para implementar abas acessíveis seguindo as [práticas de autoria da WAI-ARIA](https://www.w3.org/TR/wai-aria-practices/#tabpanel). +```jsx +/* Tabs where each tab needs to be selected manually */ +<Tabs /> +``` -{{"demo": "pages/components/tabs/LabTabs.js", "bg": true}} +{{"demo": "pages/components/tabs/AccessibleTabs2.js", "defaultCodeOpen": false}} diff --git a/docs/src/pages/components/tabs/tabs-ru.md b/docs/src/pages/components/tabs/tabs-ru.md index ecbdf477db539f..68bc49f553e704 100644 --- a/docs/src/pages/components/tabs/tabs-ru.md +++ b/docs/src/pages/components/tabs/tabs-ru.md @@ -16,25 +16,35 @@ waiAria: 'https://www.w3.org/TR/wai-aria-practices/#tabpanel' ## Простые вкладки -{{"demo": "pages/components/tabs/SimpleTabs.js", "bg": true}} +A basic example with tab panels. -{{"demo": "pages/components/tabs/BasicTabs.js", "bg": true}} +{{"demo": "pages/components/tabs/BasicTabs.js"}} -### Wrapped Labels +## Experimental API + +`@material-ui/lab` offers utility components that inject props to implement accessible tabs following [WAI-ARIA authoring practices](https://www.w3.org/TR/wai-aria-practices/#tabpanel). + +{{"demo": "pages/components/tabs/LabTabs.js"}} + +## Wrapped Labels -Long labels will automatically wrap on tabs. If the label is too long for the tab, it will overflow and the text will not be visible. +Long labels will automatically wrap on tabs. If the label is too long for the tab, it will overflow, and the text will not be visible. -{{"demo": "pages/components/tabs/TabsWrappedLabel.js", "bg": true}} +{{"demo": "pages/components/tabs/TabsWrappedLabel.js"}} -### Отключённые вкладки +## Colored tab -Вкладка может быть отключена, установив параметр `disabled`. +{{"demo": "pages/components/tabs/ColorTabs.js"}} -{{"demo": "pages/components/tabs/DisabledTabs.js", "bg": true}} +## Отключённые вкладки + +A tab can be disabled by setting the `disabled` prop. + +{{"demo": "pages/components/tabs/DisabledTabs.js"}} ## Fixed Tabs -Fixed tabs should be used with a limited number of tabs and when consistent placement will aid muscle memory. +Fixed tabs should be used with a limited number of tabs, and when a consistent placement will aid muscle memory. ### Full width @@ -74,15 +84,15 @@ If you want to make sure the buttons are always visible, you should customize th ### Prevent Scroll Buttons -Left and right scroll buttons are never be presented with `scrollButtons={false}`. All scrolling must be initiated through user agent scrolling mechanisms (e.g. left/right swipe, shift-mousewheel, etc.) +Left and right scroll buttons are never be presented with `scrollButtons={false}`. All scrolling must be initiated through user agent scrolling mechanisms (e.g. left/right swipe, shift mouse wheel, etc.) {{"demo": "pages/components/tabs/ScrollableTabsButtonPrevent.js", "bg": true}} ## Customized tabs -Ниже находится пример кастомизации компонента. You can learn more about this in the [overrides documentation page](/customization/how-to-customize/). +Ниже находится пример кастомизации компонента. Вы можете узнать об этом больше [в документации по переопределению свойств](/customization/how-to-customize/). -{{"demo": "pages/components/tabs/CustomizedTabs.js", "bg": true}} +{{"demo": "pages/components/tabs/CustomizedTabs.js"}} 🎨 If you are looking for inspiration, you can check [MUI Treasury's customization examples](https://mui-treasury.com/styles/tabs/). @@ -94,19 +104,23 @@ To make vertical tabs instead of default horizontal ones, there is `orientation= Note that you can restore the scrollbar with `visibleScrollbar`. -## Nav Tabs +## Nav tabs -By default tabs use a `button` element, but you can provide your own custom tag or component. Here's an example of implementing tabbed navigation: +By default, tabs use a `button` element, but you can provide your custom tag or component. Here's an example of implementing tabbed navigation: -{{"demo": "pages/components/tabs/NavTabs.js", "bg": true}} +{{"demo": "pages/components/tabs/NavTabs.js"}} -## Icon Tabs +## Icon tabs Tab labels may be either all icons or all text. -{{"demo": "pages/components/tabs/IconTabs.js", "bg": true}} +{{"demo": "pages/components/tabs/IconTabs.js"}} + +{{"demo": "pages/components/tabs/IconLabelTabs.js"}} + +## Сторонняя библиотека маршрутизации -{{"demo": "pages/components/tabs/IconLabelTabs.js", "bg": true}} +One frequent use case is to perform navigation on the client only, without an HTTP round-trip to the server. The `Tab` component provides the `component` prop to handle this use case. Here is a [more detailed guide](/guides/routing/#tabs). ## Доступность @@ -125,19 +139,18 @@ The components implement keyboard navigation using the "manual activation" behav #### Demo -The following two demos only differ in their keyboard navigation behavior. Focus a tab and navigate with arrow keys to notice the difference. +The following two demos only differ in their keyboard navigation behavior. Focus a tab and navigate with arrow keys to notice the difference, e.g. <kbd class="key">Arrow Left</kbd>. ```jsx /* Tabs where selection follows focus */ <Tabs selectionFollowsFocus /> -/* Tabs where each tab needs to be selected manually */ -<Tabs /> ``` -{{"demo": "pages/components/tabs/AccessibleTabs.js", "bg": true}} +{{"demo": "pages/components/tabs/AccessibleTabs1.js", "defaultCodeOpen": false}} -## Experimental API - -`@material-ui/lab` offers utility components that inject props to implement accessible tabs following [WAI-ARIA authoring practices](https://www.w3.org/TR/wai-aria-practices/#tabpanel). +```jsx +/* Tabs where each tab needs to be selected manually */ +<Tabs /> +``` -{{"demo": "pages/components/tabs/LabTabs.js", "bg": true}} +{{"demo": "pages/components/tabs/AccessibleTabs2.js", "defaultCodeOpen": false}} diff --git a/docs/src/pages/components/tabs/tabs-zh.md b/docs/src/pages/components/tabs/tabs-zh.md index ba76ae1c089eb5..e92873fd454d08 100644 --- a/docs/src/pages/components/tabs/tabs-zh.md +++ b/docs/src/pages/components/tabs/tabs-zh.md @@ -16,25 +16,35 @@ waiAria: 'https://www.w3.org/TR/wai-aria-practices/#tabpanel' ## 基础选项卡 -A basic example with no frills. +A basic example with tab panels. -{{"demo": "pages/components/tabs/BasicTabs.js", "bg": true}} +{{"demo": "pages/components/tabs/BasicTabs.js"}} -### 包装的标签 +## 实验性的 API + +遵循 [WAI-ARIA 项目实践](https://www.w3.org/TR/wai-aria-practices/#tabpanel),`@material-ui/lab` 提供了工具集组件,该组件通过注入属性的方式来实现无障碍设计的选项卡。 + +{{"demo": "pages/components/tabs/LabTabs.js"}} -对于那些比较长的标签,它们会被自动包装成选项卡。 如果标签超出了选项卡的长度,它则会溢出,并且文本会隐藏。 +## 包装的标签 -{{"demo": "pages/components/tabs/TabsWrappedLabel.js", "bg": true}} +对于那些比较长的标签,它们会被自动包装成选项卡。 If the label is too long for the tab, it will overflow, and the text will not be visible. -### 禁用选项卡 +{{"demo": "pages/components/tabs/TabsWrappedLabel.js"}} -选项卡的 `disabled` 属性能将其设置为禁用状态。 +## Colored tab -{{"demo": "pages/components/tabs/DisabledTabs.js", "bg": true}} +{{"demo": "pages/components/tabs/ColorTabs.js"}} + +## 禁用选项卡 + +A tab can be disabled by setting the `disabled` prop. + +{{"demo": "pages/components/tabs/DisabledTabs.js"}} ## 固定的选项卡 -固定的选项卡应与定量的选项卡一起使用,而将它们整齐放置则会有助于用户的肌肉记忆。 +Fixed tabs should be used with a limited number of tabs, and when a consistent placement will aid muscle memory. ### 全宽 @@ -74,7 +84,7 @@ A basic example with no frills. ### 永久隐藏滚动按钮 -你可以使用 `scrollButtons={false}` 属性来永远隐藏左右的滚动按钮。 所有的滚动比如通过用户代理的滚动机制来发起(例如,左右滑动,移动鼠标滑轮等等)。 +你可以使用 `scrollButtons={false}` 属性来永远隐藏左右的滚动按钮。 All scrolling must be initiated through user agent scrolling mechanisms (e.g. left/right swipe, shift mouse wheel, etc.) {{"demo": "pages/components/tabs/ScrollableTabsButtonPrevent.js", "bg": true}} @@ -82,7 +92,7 @@ A basic example with no frills. 以下是自定义组件的一个示例。 您可以在 [重写文档页面](/customization/how-to-customize/) 中了解更多有关此内容的信息。 -{{"demo": "pages/components/tabs/CustomizedTabs.js", "bg": true}} +{{"demo": "pages/components/tabs/CustomizedTabs.js"}} 🎨 如果您还在寻找灵感,您可以看看 [MUI Treasury 特别定制的一些例子](https://mui-treasury.com/styles/tabs/)。 @@ -94,19 +104,23 @@ A basic example with no frills. 请注意,你可以使用 `visibleScrollbar` 来恢复显示滚动条。 -## 导航选项卡 +## Nav tabs -默认情况下,选项卡会使用 `按钮` 组件,但您也可以提供自定义的标签或组件。 下面是一个实现导航选项卡的例子: +By default, tabs use a `button` element, but you can provide your custom tag or component. 下面是一个实现导航选项卡的例子: -{{"demo": "pages/components/tabs/NavTabs.js", "bg": true}} +{{"demo": "pages/components/tabs/NavTabs.js"}} -## 图标选项卡 +## Icon tabs 选项卡的标签可以是所有的图标或者所有的文本。 -{{"demo": "pages/components/tabs/IconTabs.js", "bg": true}} +{{"demo": "pages/components/tabs/IconTabs.js"}} + +{{"demo": "pages/components/tabs/IconLabelTabs.js"}} -{{"demo": "pages/components/tabs/IconLabelTabs.js", "bg": true}} +## Third-party routing library(第三方路由库) + +One frequent use case is to perform navigation on the client only, without an HTTP round-trip to the server. The `Tab` component provides the `component` prop to handle this use case. Here is a [more detailed guide](/guides/routing/#tabs). ## 无障碍设计 @@ -121,23 +135,22 @@ A basic example with no frills. ### 键盘导航 -该组件使用“手动激活”的行为来实现键盘导航。 如果你想切换到“选择自动跟随焦点”(selection automatically follows focus)的行为,你必须将 `selectionFollowsFocus` 传递给 `Tabs` 组件。 WAI-ARIA 项目实践中对 [如何决定什么时候选择自动跟随焦点](https://www.w3.org/TR/wai-aria-practices/#kbd_selection_follows_focus) 进行了详细的指导。 +该组件使用“手动激活”的行为来实现键盘导航。 如果你想切换到“选择自动跟随焦点”(selection automatically follows focus)的行为,你必须将 `selectionFollowsFocus` 传递给 `Tabs` 组件。 WAI-ARIA 项目实践中有一个详细的指南关于 [how to decide when to make selection automatically follow focus](https://www.w3.org/TR/wai-aria-practices/#kbd_selection_follows_focus)。 #### 演示 -下面的两个演示只是在键盘导航行为上有所区别。 聚焦到其中一个选项卡,然后用方向键导航你就可以注意到其中的差异。 +下面的两个演示只是在键盘导航行为上有所区别。 Focus a tab and navigate with arrow keys to notice the difference, e.g. <kbd class="key">Arrow Left</kbd>. ```jsx -/* 那个跟随焦点的选项卡 */ +/* Tabs where selection follows focus */ <Tabs selectionFollowsFocus /> -/* 需要手动选择选项卡中的每一个选项 */ -<Tabs /> ``` -{{"demo": "pages/components/tabs/AccessibleTabs.js", "bg": true}} - -## 实验性的 API +{{"demo": "pages/components/tabs/AccessibleTabs1.js", "defaultCodeOpen": false}} -遵循 [WAI-ARIA 项目实践](https://www.w3.org/TR/wai-aria-practices/#tabpanel),`@material-ui/lab` 提供了工具集组件,该组件通过注入属性的方式来实现无障碍设计的选项卡。 +```jsx +/* Tabs where each tab needs to be selected manually */ +<Tabs /> +``` -{{"demo": "pages/components/tabs/LabTabs.js", "bg": true}} +{{"demo": "pages/components/tabs/AccessibleTabs2.js", "defaultCodeOpen": false}} diff --git a/docs/src/pages/components/text-fields/ColorTextFields.js b/docs/src/pages/components/text-fields/ColorTextFields.js index 105e10d7ac40f4..085bb9f0c86c3f 100644 --- a/docs/src/pages/components/text-fields/ColorTextFields.js +++ b/docs/src/pages/components/text-fields/ColorTextFields.js @@ -12,22 +12,13 @@ export default function ColorTextFields() { noValidate autoComplete="off" > + <TextField label="Outlined secondary" color="secondary" focused /> + <TextField label="Filled success" variant="filled" color="success" focused /> <TextField - id="outlined-secondary" - label="Outlined secondary" - color="secondary" - /> - <TextField - id="filled-secondary" - label="Filled secondary" - variant="filled" - color="secondary" - /> - <TextField - id="standard-secondary" - label="Standard secondary" - color="secondary" + label="Standard warning" variant="standard" + color="warning" + focused /> </Box> ); diff --git a/docs/src/pages/components/text-fields/ColorTextFields.tsx b/docs/src/pages/components/text-fields/ColorTextFields.tsx index 105e10d7ac40f4..085bb9f0c86c3f 100644 --- a/docs/src/pages/components/text-fields/ColorTextFields.tsx +++ b/docs/src/pages/components/text-fields/ColorTextFields.tsx @@ -12,22 +12,13 @@ export default function ColorTextFields() { noValidate autoComplete="off" > + <TextField label="Outlined secondary" color="secondary" focused /> + <TextField label="Filled success" variant="filled" color="success" focused /> <TextField - id="outlined-secondary" - label="Outlined secondary" - color="secondary" - /> - <TextField - id="filled-secondary" - label="Filled secondary" - variant="filled" - color="secondary" - /> - <TextField - id="standard-secondary" - label="Standard secondary" - color="secondary" + label="Standard warning" variant="standard" + color="warning" + focused /> </Box> ); diff --git a/docs/src/pages/components/text-fields/text-fields-de.md b/docs/src/pages/components/text-fields/text-fields-de.md index 002aea3ee97ab3..475870a8873303 100644 --- a/docs/src/pages/components/text-fields/text-fields-de.md +++ b/docs/src/pages/components/text-fields/text-fields-de.md @@ -13,11 +13,9 @@ materialDesign: https://material.io/components/text-fields {{"component": "modules/components/ComponentLinkHeader.js"}} -## TextField +## Basic TextField -Die `TextField` Wrapper-Komponente ist ein vollständiges Formularsteuerelement, das eine Beschriftung, Eingabe und Hilfetext enthält. - -It supports standard, outlined and filled styling. +The `TextField` wrapper component is a complete form control including a label, input, and help text. It comes with three variants: outlined (default), filled, and standard. {{"demo": "pages/components/text-fields/BasicTextFields.js"}} @@ -31,13 +29,13 @@ Standard form attributes are supported e.g. `required`, `disabled`, `type`, etc. ## Validierung -The `error` prop toggles the error state, the `helperText` prop can then be used to provide feedback to the user about the error. +The `error` prop toggles the error state. The `helperText` prop can then be used to provide feedback to the user about the error. {{"demo": "pages/components/text-fields/ValidationTextFields.js"}} ## Mehrzeilig -The `multiline` prop transforms the text field into a [textarea](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea) or a [TextareaAutosize](/components/textarea-autosize/). Unless the `rows` prop is set, the height of the text field dynamically matches its content (using [TextareaAutosize](/components/textarea-autosize/)). You can use the `rowsMin` and `rowsMax` props to bound it. +The `multiline` prop transforms the text field into a [textarea](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea) or a [TextareaAutosize](/components/textarea-autosize/). Unless the `rows` prop is set, the height of the text field dynamically matches its content (using [TextareaAutosize](/components/textarea-autosize/)). You can use the `minRows` and `maxRows` props to bound it. {{"demo": "pages/components/text-fields/MultilineTextFields.js"}} @@ -55,7 +53,7 @@ There are multiple ways to display an icon with a text field. ### Eingabeverzierungen -The main way is with an `InputAdornment`. Sie können beispielsweise eine Symbolschaltfläche verwenden, um das Kennwort ein- oder auszublenden. This can be used to add a prefix, a suffix or an action to an input. +The main way is with an `InputAdornment`. This can be used to add a prefix, a suffix, or an action to an input. This can be used to add a prefix, a suffix or an action to an input. {{"demo": "pages/components/text-fields/InputAdornments.js"}} @@ -69,15 +67,19 @@ The `filled` variant input height can be further reduced by rendering the label {{"demo": "pages/components/text-fields/TextFieldHiddenLabel.js"}} -## Layout +## Margin + +The `margin` prop can be used to alter the vertical spacing of the text field. Using `none` (default) doesn't apply margins to the `FormControl` whereas `dense` and `normal` do. + +{{"demo": "pages/components/text-fields/LayoutTextFields.js"}} -`dense` and `normal` alter other styles to meet the specification. `margin` prop can be used to alter the vertical spacing of inputs. Using `none` (default) will not apply margins to the `FormControl`, whereas `dense` and `normal` will. +## Gesamte Breite `fullWidth` can be used to make the input take up the full width of its container. -{{"demo": "pages/components/text-fields/LayoutTextFields.js"}} +{{"demo": "pages/components/text-fields/FullWidthTextField.js"}} -## Uncontrolled vs Controlled +## Uncontrolled vs. Controlled The component can be controlled or uncontrolled. @@ -87,7 +89,7 @@ The component can be controlled or uncontrolled. Das `Textfeld` besteht aus kleineren Komponenten ( [`FormControl`](/api/form-control/), [`Input`](/api/input/), [`FilledInput`](/api/filled-input/), [`InputLabel`](/api/input-label/), [`OutlinedInput`](/api/outlined-input/), und [`FormHelperText`](/api/form-helper-text/) ) welche Sie direkt nutzen können, um Ihre Formulareingaben erheblich anzupassen. -Möglicherweise haben Sie auch festgestellt, dass einige native HTML-Eingabeeigenschaften in der Komponente `TextField` fehlen. Das war Absicht. Die Komponente kümmert sich um die am häufigsten verwendeten Eigenschaften. Anschließend muss der Benutzer die darunter liegende Komponente verwenden, die in der folgenden Demo gezeigt wird. Sie können jedoch `inputProps` (und `InputProps`, `InputLabelProps` Eigenschaften) verwenden, wenn Sie einiges an Boilerplate vermeiden möchten. +Möglicherweise haben Sie auch festgestellt, dass einige native HTML-Eingabeeigenschaften in der Komponente `TextField` fehlen. Das war Absicht. The component takes care of the most used properties. Then, it's up to the user to use the underlying component shown in the following demo. Sie können jedoch `inputProps` (und `InputProps`, `InputLabelProps` Eigenschaften) verwenden, wenn Sie einiges an Boilerplate vermeiden möchten. {{"demo": "pages/components/text-fields/ComposedTextField.js"}} @@ -107,12 +109,47 @@ Hier einige Beispiele zum Anpassen der Komponente. Mehr dazu erfahren Sie auf de {{"demo": "pages/components/text-fields/CustomizedInputs.js"}} -Die Anpassung endet nicht bei CSS. Sie können Komposition verwenden, um benutzerdefinierte Komponenten zu erstellen und Ihrer App ein einzigartiges Gefühl zu verleihen. Nachfolgend ein Beispiel mit der [`InputBase`](/api/input-base/) Komponente, die von Google Maps inspiriert wurde. +Customization does not stop at CSS. You can use composition to build custom components and give your app a unique feel. Nachfolgend ein Beispiel mit der [`InputBase`](/api/input-base/) Komponente, die von Google Maps inspiriert wurde. {{"demo": "pages/components/text-fields/CustomizedInputBase.js", "bg": true}} 🎨 If you are looking for inspiration, you can check [MUI Treasury's customization examples](https://mui-treasury.com/styles/text-field). +## `useFormControl` + +For advanced customization use cases, a `useFormControl()` hook is exposed. This hook returns the context value of the parent `FormControl` component. + +**API** + +```jsx +import { useFormControl } from '@material-ui/core/FormControl'; +``` + +**Rückgabewerte** + +`value` (_object_): + +- `value.adornedStart` (_bool_): Indicate whether the child `Input` or `Select` component has a start adornment. +- `value.setAdornedStart` (_func_): Setter function for `adornedStart` state value. +- `value.color` (_string_): The theme color is being used, inherited from `FormControl` `color` prop . +- `value.disabled` (_bool_): Indicate whether the component is being displayed in a disabled state, inherited from `FormControl` `disabled` prop. +- `value.error` (_bool_): Indicate whether the component is being displayed in an error state, inherited from `FormControl` `error` prop +- `value.filled` (_bool_): Indicate whether input is filled +- `value.focused` (_bool_): Indicate whether the component and its children are being displayed in a focused state +- `value.fullWidth` (_bool_): Indicate whether the component is taking up the full width of its container, inherited from `FormControl` `fullWidth` prop +- `value.hiddenLabel` (_bool_): Indicate whether the label is being hidden, inherited from `FormControl` `hiddenLabel` prop +- `value.required` (_bool_): Indicate whether the label is indicating that the input is required input, inherited from the `FormControl` `required` prop +- `value.size` (_string_): The size of the component, inherited from the `FormControl` `size` prop +- `value.variant` (_string_): The variant is being used by the `FormControl` component and its children, inherited from `FormControl` `variant` prop +- `value.onBlur` (_func_): Should be called when the input is blurred +- `value.onFocus` (_func_): Should be called when the input is focused +- `value.onEmpty` (_func_): Should be called when the input is emptied +- `value.onFilled` (_func_): Should be called when the input is filled + +**Beispiel** + +{{"demo": "pages/components/text-fields/UseFormControl.js"}} + ## Einschränkungen ### Shrink @@ -135,13 +172,13 @@ oder ### Floating label -The floating label is absolutely positioned, it won't impact the layout of the page. You need to make sure that the input is larger than the label to display correctly. +The floating label is absolutely positioned. It won't impact the layout of the page. Make sure that the input is larger than the label to display correctly. ### type="number" Inputs of type="number" have potential usability issues: -- Allowing certain non-numeric characters ('e', '+', '-', '.') and silently discarding others and silently discarding others and silently discarding others +- Allowing certain non-numeric characters ('e', '+', '-', '.') and silently discarding others and silently discarding others and silently discarding others and silently discarding others - Wenn Sie die Komponente zusammenstellen: and more - see [this article](https://technology.blog.gov.uk/2020/02/24/why-the-gov-uk-design-system-team-changed-the-input-type-for-numbers/) by the GOV.UK Design System team for a more detailed explanation. @@ -233,7 +270,7 @@ In order for the text field to be accessible, **the input should be linked to th ## Ergänzende Projekte -Für fortgeschrittenere Anwendungsfälle können Ihnen folgende Projekte helfen: +For more advanced use cases, you might be able to take advantage of: - [mui-rff](https://github.com/lookfirst/mui-rff) Bindings for using Material-UI with [React Final Form](https://final-form.org/react). - [formik-material-ui](https://github.com/stackworx/formik-material-ui): Bindings for using Material-UI with [formik](https://jaredpalmer.com/formik). diff --git a/docs/src/pages/components/text-fields/text-fields-es.md b/docs/src/pages/components/text-fields/text-fields-es.md index 8cb84e531dca4f..c76649dd3e52ac 100644 --- a/docs/src/pages/components/text-fields/text-fields-es.md +++ b/docs/src/pages/components/text-fields/text-fields-es.md @@ -13,15 +13,13 @@ materialDesign: https://material.io/components/text-fields {{"component": "modules/components/ComponentLinkHeader.js"}} -## TextField +## Basic TextField -El componente `TextField` es un control de formulario completo, incluyendo una etiqueta, el campo de texto y texto de ayuda. - -Soporta estilos "Standard", "Outlined" y "Filled". +The `TextField` wrapper component is a complete form control including a label, input, and help text. It comes with three variants: outlined (default), filled, and standard. {{"demo": "pages/components/text-fields/BasicTextFields.js"}} -**Note:** The standard variant of the `TextField` is no longer documented in the [Material Design guidelines](https://material.io/) ([here's why](https://medium.com/google-design/the-evolution-of-material-designs-text-fields-603688b3fe03)), but Material-UI will continue to support it. +**Nota:** La variante estándar de `TextField` no esta mas documentada en [guía Material Design](https://material.io/) ([Aquí esta el por que](https://medium.com/google-design/the-evolution-of-material-designs-text-fields-603688b3fe03)), pero Material-UI continuara soportándolo. ## Propiedades del Form @@ -31,13 +29,13 @@ Standard form attributes are supported e.g. `required`, `disabled`, `type`, etc. ## Validación -The `error` prop toggles the error state, the `helperText` prop can then be used to provide feedback to the user about the error. +The `error` prop toggles the error state. The `helperText` prop can then be used to provide feedback to the user about the error. {{"demo": "pages/components/text-fields/ValidationTextFields.js"}} ## Multiline -The `multiline` prop transforms the text field into a [textarea](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea) or a [TextareaAutosize](/components/textarea-autosize/). Unless the `rows` prop is set, the height of the text field dynamically matches its content (using [TextareaAutosize](/components/textarea-autosize/)). You can use the `rowsMin` and `rowsMax` props to bound it. +The `multiline` prop transforms the text field into a [textarea](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea) or a [TextareaAutosize](/components/textarea-autosize/). Unless the `rows` prop is set, the height of the text field dynamically matches its content (using [TextareaAutosize](/components/textarea-autosize/)). You can use the `minRows` and `maxRows` props to bound it. {{"demo": "pages/components/text-fields/MultilineTextFields.js"}} @@ -55,7 +53,7 @@ There are multiple ways to display an icon with a text field. ### Adornos de campos de texto -The main way is with an `InputAdornment`. Por ejemplo, puedes usar un botón de icono para esconder o revelar una contraseña. This can be used to add a prefix, a suffix or an action to an input. +The main way is with an `InputAdornment`. This can be used to add a prefix, a suffix, or an action to an input. This can be used to add a prefix, a suffix or an action to an input. {{"demo": "pages/components/text-fields/InputAdornments.js"}} @@ -69,15 +67,19 @@ The `filled` variant input height can be further reduced by rendering the label {{"demo": "pages/components/text-fields/TextFieldHiddenLabel.js"}} -## Disposición +## Margin + +The `margin` prop can be used to alter the vertical spacing of the text field. Using `none` (default) doesn't apply margins to the `FormControl` whereas `dense` and `normal` do. + +{{"demo": "pages/components/text-fields/LayoutTextFields.js"}} -`dense` and `normal` alter other styles to meet the specification. `margin` prop can be used to alter the vertical spacing of inputs. Using `none` (default) will not apply margins to the `FormControl`, whereas `dense` and `normal` will. +## Full width `fullWidth` can be used to make the input take up the full width of its container. -{{"demo": "pages/components/text-fields/LayoutTextFields.js"}} +{{"demo": "pages/components/text-fields/FullWidthTextField.js"}} -## Uncontrolled vs Controlled +## Uncontrolled vs. Controlled The component can be controlled or uncontrolled. @@ -87,7 +89,7 @@ The component can be controlled or uncontrolled. El componente `TextField` incluye y usa subcomponentes ( [`FormControl`](/api/form-control/), [`Input`](/api/input/), [`FilledInput`](/api/filled-input/), [`InputLabel`](/api/input-label/), [`OutlinedInput`](/api/outlined-input/) y [`FormHelperText`](/api/form-helper-text/) ) que pueden ser usados directamente para personalizar campos de ingreso de texto de manera sustancial. -Puede que también hayas notado que algunas propiedades nativas de input HTML no están presentes en el componente `TextField`. Esto es a propósito. El componente se encarga de programar la mayoría de las propiedades más usadas, luego depende del usuario programar las propiedades que se muestran en la siguiente demo. Aun así, se puede utilizar `inputProps` (y las propiedades `InputProps` e `InputLabelProps`) para personalizar y evitar el código boilerplate. +Puede que también hayas notado que algunas propiedades nativas de input HTML no están presentes en el componente `TextField`. Esto es a propósito. The component takes care of the most used properties. Then, it's up to the user to use the underlying component shown in the following demo. Aun así, se puede utilizar `inputProps` (y las propiedades `InputProps` e `InputLabelProps`) para personalizar y evitar el código boilerplate. {{"demo": "pages/components/text-fields/ComposedTextField.js"}} @@ -107,12 +109,47 @@ Here are some examples of customizing the component. Puedes aprender más sobre {{"demo": "pages/components/text-fields/CustomizedInputs.js"}} -La personalización no se limita a usar CSS, también puedes usar una composición de componentes personalizados para darle a tu aplicación un estilo único. A continuación sigue un ejemplo del uso del componente [`InputBase`](/api/input-base/), inspirado por Google Maps. +Customization does not stop at CSS. You can use composition to build custom components and give your app a unique feel. A continuación sigue un ejemplo del uso del componente [`InputBase`](/api/input-base/), inspirado por Google Maps. {{"demo": "pages/components/text-fields/CustomizedInputBase.js", "bg": true}} 🎨 Si buscas un poco de inspiración, puedes visitar [MUI Treasury's ejemplos de customizacion](https://mui-treasury.com/styles/text-field). +## `useFormControl` + +For advanced customization use cases, a `useFormControl()` hook is exposed. This hook returns the context value of the parent `FormControl` component. + +**API** + +```jsx +import { useFormControl } from '@material-ui/core/FormControl'; +``` + +**Regresa** + +`value` (_object_): + +- `value.adornedStart` (_bool_): Indicate whether the child `Input` or `Select` component has a start adornment. +- `value.setAdornedStart` (_func_): Setter function for `adornedStart` state value. +- `value.color` (_string_): The theme color is being used, inherited from `FormControl` `color` prop . +- `value.disabled` (_bool_): Indicate whether the component is being displayed in a disabled state, inherited from `FormControl` `disabled` prop. +- `value.error` (_bool_): Indicate whether the component is being displayed in an error state, inherited from `FormControl` `error` prop +- `value.filled` (_bool_): Indicate whether input is filled +- `value.focused` (_bool_): Indicate whether the component and its children are being displayed in a focused state +- `value.fullWidth` (_bool_): Indicate whether the component is taking up the full width of its container, inherited from `FormControl` `fullWidth` prop +- `value.hiddenLabel` (_bool_): Indicate whether the label is being hidden, inherited from `FormControl` `hiddenLabel` prop +- `value.required` (_bool_): Indicate whether the label is indicating that the input is required input, inherited from the `FormControl` `required` prop +- `value.size` (_string_): The size of the component, inherited from the `FormControl` `size` prop +- `value.variant` (_string_): The variant is being used by the `FormControl` component and its children, inherited from `FormControl` `variant` prop +- `value.onBlur` (_func_): Should be called when the input is blurred +- `value.onFocus` (_func_): Should be called when the input is focused +- `value.onEmpty` (_func_): Should be called when the input is emptied +- `value.onFilled` (_func_): Should be called when the input is filled + +**Ejemplo** + +{{"demo": "pages/components/text-fields/UseFormControl.js"}} + ## Limitaciones ### Shrink @@ -135,13 +172,13 @@ o ### Floating label -The floating label is absolutely positioned, it won't impact the layout of the page. You need to make sure that the input is larger than the label to display correctly. +The floating label is absolutely positioned. It won't impact the layout of the page. Make sure that the input is larger than the label to display correctly. ### type="number" Inputs of type="number" have potential usability issues: -- Allowing certain non-numeric characters ('e', '+', '-', '.') and silently discarding others and silently discarding others and silently discarding others +- Allowing certain non-numeric characters ('e', '+', '-', '.') and silently discarding others and silently discarding others and silently discarding others and silently discarding others - Si se está componiendo el componente: and more - see [this article](https://technology.blog.gov.uk/2020/02/24/why-the-gov-uk-design-system-team-changed-the-input-type-for-numbers/) by the GOV. UK Design System team for a more detailed explanation. @@ -233,7 +270,7 @@ In order for the text field to be accessible, **the input should be linked to th ## Proyectos relacionados -Para usos más avanzados tal vez puedas aprovercharte de: +For more advanced use cases, you might be able to take advantage of: - [mui-rff](https://github.com/lookfirst/mui-rff) Bindings for using Material-UI with [React Final Form](https://final-form.org/react). - [formik-material-ui](https://github.com/stackworx/formik-material-ui): Bindings for using Material-UI with [formik](https://jaredpalmer.com/formik). diff --git a/docs/src/pages/components/text-fields/text-fields-fr.md b/docs/src/pages/components/text-fields/text-fields-fr.md index 5d77298e96d20e..a11152228b32a7 100644 --- a/docs/src/pages/components/text-fields/text-fields-fr.md +++ b/docs/src/pages/components/text-fields/text-fields-fr.md @@ -15,9 +15,7 @@ materialDesign: https://material.io/components/text-fields ## TextField -Le composant d'encapsulation `TextField` est un contrôle de formulaire complet comprenant une étiquette, une entrée et un texte d'aide. - -It supports standard, outlined and filled styling. +Le composant d'encapsulation `TextField` est un contrôle de formulaire complet comprenant une étiquette, une entrée et un texte d'aide. It comes with three variants: outlined (default), filled, and standard. {{"demo": "pages/components/text-fields/BasicTextFields.js"}} @@ -25,13 +23,13 @@ It supports standard, outlined and filled styling. ## Form props -Standard form attributes are supported e.g. `required`, `disabled`, `type`, etc. as well as a `helperText` which is used to give context about a field's input, such as how the input will be used. +**Note:** The standard variant of the `TextField` is no longer documented in the [Material Design guidelines](https://material.io/) ([here's why](https://medium.com/google-design/the-evolution-of-material-designs-text-fields-603688b3fe03)), but Material-UI will continue to support it. {{"demo": "pages/components/text-fields/FormPropsTextFields.js"}} ## Validation -The `error` prop toggles the error state, the `helperText` prop can then be used to provide feedback to the user about the error. +The `error` prop toggles the error state. The `error` prop toggles the error state, the `helperText` prop can then be used to provide feedback to the user about the error. {{"demo": "pages/components/text-fields/ValidationTextFields.js"}} @@ -55,7 +53,7 @@ There are multiple ways to display an icon with a text field. ### Ornements d'input -The main way is with an `InputAdornment`. Par exemple, vous pouvez utiliser un bouton icône pour masquer ou révéler le mot de passe. This can be used to add a prefix, a suffix or an action to an input. +The main way is with an `InputAdornment`. This can be used to add a prefix, a suffix or an action to an input. This can be used to add a prefix, a suffix or an action to an input. {{"demo": "pages/components/text-fields/InputAdornments.js"}} @@ -71,13 +69,17 @@ The `filled` variant input height can be further reduced by rendering the label ## Disposition -`dense` and `normal` alter other styles to meet the specification. `margin` prop can be used to alter the vertical spacing of inputs. Using `none` (default) will not apply margins to the `FormControl`, whereas `dense` and `normal` will. +`margin` prop can be used to alter the vertical spacing of inputs. Using `none` (default) will not apply margins to the `FormControl`, whereas `dense` and `normal` will. + +{{"demo": "pages/components/text-fields/LayoutTextFields.js"}} + +## Full width `fullWidth` can be used to make the input take up the full width of its container. -{{"demo": "pages/components/text-fields/LayoutTextFields.js"}} +{{"demo": "pages/components/text-fields/FullWidthTextField.js"}} -## Uncontrolled vs Controlled +## Composants The component can be controlled or uncontrolled. @@ -87,7 +89,7 @@ The component can be controlled or uncontrolled. `TextField` est composé d'éléments plus petits ( [`FormControl`](/api/form-control/), [`Input`](/api/input/), [`FilledInput`](/api/filled-input/), [`InputLabel`](/api/input-label/), [`OutlinedInput`](/api/outlined-input/), et [`FormHelperText`](/api/form-helper-text/) ) que vous pouvez utiliser directement pour personnaliser de manière significative vos entrées de formulaire. -Vous avez peut-être également remarqué que certaines propriétés d'entrée HTML natives sont absentes du composant `TextField`. C'est intentionnel. Le composant prend en charge les propriétés les plus utilisées, puis il appartient à l'utilisateur d'utiliser le composant sous-jacent présenté dans la démonstration suivante. Néanmoins, vous pouvez utiliser `inputProps` (et `InputProps`, `InputLabelProps` propriétés) pour aller plus vite. +Vous avez peut-être également remarqué que certaines propriétés d'entrée HTML natives sont absentes du composant `TextField`. C'est intentionnel. The component takes care of the most used properties. Le composant prend en charge les propriétés les plus utilisées, puis il appartient à l'utilisateur d'utiliser le composant sous-jacent présenté dans la démonstration suivante. Néanmoins, vous pouvez utiliser `inputProps` (et `InputProps`, `InputLabelProps` propriétés) pour aller plus vite. {{"demo": "pages/components/text-fields/ComposedTextField.js"}} @@ -107,12 +109,47 @@ Here are some examples of customizing the component. Vous pouvez en savoir plus {{"demo": "pages/components/text-fields/CustomizedInputs.js"}} -La personnalisation ne se limite pas aux CSS, vous pouvez utiliser la composition pour créer des composants personnalisés et donner à votre application une sensation unique. Voici un exemple utilisant le composant [`InputBase`](/api/input-base/), inspiré de Google Maps. +Customization does not stop at CSS. La personnalisation ne se limite pas aux CSS, vous pouvez utiliser la composition pour créer des composants personnalisés et donner à votre application une sensation unique. Voici un exemple utilisant le composant [`InputBase`](/api/input-base/), inspiré de Google Maps. {{"demo": "pages/components/text-fields/CustomizedInputBase.js", "bg": true}} 🎨 If you are looking for inspiration, you can check [MUI Treasury's customization examples](https://mui-treasury.com/styles/text-field). +## `useFormControl` + +For advanced customization use cases, a `useFormControl()` hook is exposed. This hook returns the context value of the parent `FormControl` component. + +**API** + +```jsx +import { useFormControl } from '@material-ui/core/FormControl'; +``` + +**Valeur de retour** + +`value` (_Object_): + +- Allowing certain non-numeric characters ('e', '+', '-', '.') and silently discarding others and silently discarding others and silently discarding others +- Si vous composez le composant: +- `value.color` (_string_): The theme color is being used, inherited from `FormControl` `color` prop . +- `value.disabled` (_bool_): Indicate whether the component is being displayed in a disabled state, inherited from `FormControl` `disabled` prop. +- `value.error` (_bool_): Indicate whether the component is being displayed in an error state, inherited from `FormControl` `error` prop +- `value.filled` (_bool_): Indicate whether input is filled +- `value.focused` (_bool_): Indicate whether the component and its children are being displayed in a focused state +- `value.fullWidth` (_bool_): Indicate whether the component is taking up the full width of its container, inherited from `FormControl` `fullWidth` prop +- `value.hiddenLabel` (_bool_): Indicate whether the label is being hidden, inherited from `FormControl` `hiddenLabel` prop +- `value.required` (_bool_): Indicate whether the label is indicating that the input is required input, inherited from the `FormControl` `required` prop +- `value.size` (_string_): The size of the component, inherited from the `FormControl` `size` prop +- `value.variant` (_string_): The variant is being used by the `FormControl` component and its children, inherited from `FormControl` `variant` prop +- `value.onBlur` (_func_): Should be called when the input is blurred +- `value.onFocus` (_func_): Should be called when the input is focused +- `value.onEmpty` (_func_): Should be called when the input is emptied +- `value.onFilled` (_func_): Should be called when the input is filled + +**Exemple** + +{{"demo": "pages/components/text-fields/UseFormControl.js"}} + ## Limites ### Shrink @@ -135,13 +172,13 @@ ou ### Floating label -The floating label is absolutely positioned, it won't impact the layout of the page. You need to make sure that the input is larger than the label to display correctly. +The floating label is absolutely positioned. The floating label is absolutely positioned, it won't impact the layout of the page. You need to make sure that the input is larger than the label to display correctly. ### type="number" Inputs of type="number" have potential usability issues: -- Allowing certain non-numeric characters ('e', '+', '-', '.') and silently discarding others and silently discarding others and silently discarding others +- Allowing certain non-numeric characters ('e', '+', '-', '.') and silently discarding others and silently discarding others and silently discarding others and silently discarding others - Si vous composez le composant: and more - see [this article](https://technology.blog.gov.uk/2020/02/24/why-the-gov-uk-design-system-team-changed-the-input-type-for-numbers/) by the GOV.UK Design System team for a more detailed explanation. diff --git a/docs/src/pages/components/text-fields/text-fields-ja.md b/docs/src/pages/components/text-fields/text-fields-ja.md index 3c680b4f3d1574..022654f20ac418 100644 --- a/docs/src/pages/components/text-fields/text-fields-ja.md +++ b/docs/src/pages/components/text-fields/text-fields-ja.md @@ -9,35 +9,33 @@ materialDesign: https://material.io/components/text-fields <p class="description">Text fieldを使用すると、ユーザーはテキストを入力および編集できます。</p> -[テキストフィールド](https://material.io/design/components/text-fields.html) 使用すると、ユーザーはUIにテキストを入力できます。 通常、フォームとダイアログに表示されます。 +テキストフィールドを使用すると、UIにテキストを入力できます。 通常、フォームとダイアログに表示されます。 {{"component": "modules/components/ComponentLinkHeader.js"}} -## TextField +## Basic TextField -`TextField` ラッパーコンポーネントは、ラベル、入力、およびヘルプテキストを含む完全なフォームコントロールです。 - -It supports standard, outlined and filled styling. +The `TextField` wrapper component is a complete form control including a label, input, and help text. It comes with three variants: outlined (default), filled, and standard. {{"demo": "pages/components/text-fields/BasicTextFields.js"}} -**Note:** The standard variant of the `TextField` is no longer documented in the [Material Design guidelines](https://material.io/) ([here's why](https://medium.com/google-design/the-evolution-of-material-designs-text-fields-603688b3fe03)), but Material-UI will continue to support it. +**注:** `TextField`のstandard variantは [Material Design guidelines](https://material.io/) に記載されなくなりましたが([理由はこちら](https://medium.com/google-design/the-evolution-of-material-designs-text-fields-603688b3fe03))、 Material-UI は引き続きサポートします。 ## Form props -Standard form attributes are supported e.g. `required`, `disabled`, `type`, etc. as well as a `helperText` which is used to give context about a field's input, such as how the input will be used. +標準的なフォームの属性がサポートされています(`required`, `disabled`, `type` など)。入力がどのように使用されるかなど、フィールドの入力に関するコンテキストを与えるために使用される `helperText` も同様です。 {{"demo": "pages/components/text-fields/FormPropsTextFields.js"}} -## Validation +## バリデーション -The `error` prop toggles the error state, the `helperText` prop can then be used to provide feedback to the user about the error. +The `error` prop toggles the error state. The `helperText` prop can then be used to provide feedback to the user about the error. {{"demo": "pages/components/text-fields/ValidationTextFields.js"}} ## Multiline -The `multiline` prop transforms the text field into a [textarea](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea) or a [TextareaAutosize](/components/textarea-autosize/). Unless the `rows` prop is set, the height of the text field dynamically matches its content (using [TextareaAutosize](/components/textarea-autosize/)). You can use the `rowsMin` and `rowsMax` props to bound it. +The `multiline` prop transforms the text field into a [textarea](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea) or a [TextareaAutosize](/components/textarea-autosize/). `rows` プロパティが設定されていない限り、テキストフィールドの高さはそのコンテンツと動的に一致します ( [TextareaAutosize](/components/textarea-autosize/) を使用します)。 You can use the `minRows` and `maxRows` props to bound it. {{"demo": "pages/components/text-fields/MultilineTextFields.js"}} @@ -55,31 +53,35 @@ There are multiple ways to display an icon with a text field. ### 入力装飾 (Input Adornments) -The main way is with an `InputAdornment`. たとえば、アイコンボタンを使用してパスワードを表示または非表示にすることができます。 たとえば、アイコンボタンを使用してパスワードを表示または非表示にすることができます。 たとえば、アイコンボタンを使用してパスワードを表示または非表示にすることができます。 たとえば、アイコンボタンを使用してパスワードを表示または非表示にすることができます。 たとえば、アイコンボタンを使用してパスワードを表示または非表示にすることができます。 This can be used to add a prefix, a suffix or an action to an input. +これを行う主な方法は `InputAdornment` です。 This can be used to add a prefix, a suffix, or an action to an input. たとえば、アイコンボタンを使用してパスワードを表示または非表示にすることができます。 {{"demo": "pages/components/text-fields/InputAdornments.js"}} ## サイズ -Fancy smaller inputs? `size`propを使用します。 +小さい入力欄が好きですか? `size`propを使用します。 {{"demo": "pages/components/text-fields/TextFieldSizes.js"}} -The `filled` variant input height can be further reduced by rendering the label outside of it. +`filled` スタイルの入力欄の高さは、ラベルを外側に表示することでさらに小さくできます。 {{"demo": "pages/components/text-fields/TextFieldHiddenLabel.js"}} -## レイアウト - -`dense` and `normal` alter other styles to meet the specification. `margin` prop can be used to alter the vertical spacing of inputs. Using `none` (default) will not apply margins to the `FormControl`, whereas `dense` and `normal` will. +## Margin -`fullWidth` can be used to make the input take up the full width of its container. +The `margin` prop can be used to alter the vertical spacing of the text field. Using `none` (default) doesn't apply margins to the `FormControl` whereas `dense` and `normal` do. {{"demo": "pages/components/text-fields/LayoutTextFields.js"}} -## Uncontrolled vs Controlled +## 最大幅 + +`fullWidth` を使用すると、入力欄の幅がコンテナ一杯になります。 + +{{"demo": "pages/components/text-fields/FullWidthTextField.js"}} + +## Uncontrolled vs. Controlled -The component can be controlled or uncontrolled. +制御されている(controlled)コンポーネントと制御されていない(uncontrolled)コンポーネントがあります。 {{"demo": "pages/components/text-fields/StateTextFields.js"}} @@ -87,7 +89,7 @@ The component can be controlled or uncontrolled. `TextField` は小さなコンポーネントから構成されています。( [`FormControl`](/api/form-control/)、 [`Input`](/api/input/)、 [`FilledInput`](/api/filled-input/)、 [`InputLabel`](/api/input-label/)、 [`OutlinedInput`](/api/outlined-input/)、 や [`FormHelperText`](/api/form-helper-text/)など )また、フォーム入力を大幅にカスタマイズするために直接活用できます。 -いくつかのネイティブHTML入力プロパティが `TextField` コンポーネントにないことに気づいたかもしれません。 これは故意です。 コンポーネントは最も使用されているプロパティの面倒を見ます、そしてそれは以下のデモで示される基本的なコンポーネントを使うことはユーザー次第です。 それでも、あなたは使用することができます `inputProps` (及び `InputProps`、 `InputLabelProps` あなたには、いくつかの決まり文句を避けたい場合はプロパティ)。 これは故意です。 コンポーネントは最も使用されているプロパティの面倒を見ます、そしてそれは以下のデモで示される基本的なコンポーネントを使うことはユーザー次第です。 それでも、あなたは使用することができます `inputProps` (及び `InputProps`、 `InputLabelProps` あなたには、いくつかの決まり文句を避けたい場合はプロパティ)。 これは故意です。 コンポーネントは最も使用されているプロパティの面倒を見ます、そしてそれは以下のデモで示される基本的なコンポーネントを使うことはユーザー次第です。 それでも、あなたは使用することができます `inputProps` (及び `InputProps`、 `InputLabelProps` あなたには、いくつかの決まり文句を避けたい場合はプロパティ)。 これは故意です。 コンポーネントは最も使用されているプロパティの面倒を見ます、そしてそれは以下のデモで示される基本的なコンポーネントを使うことはユーザー次第です。 それでも、あなたは使用することができます `inputProps` (及び `InputProps`、 `InputLabelProps` あなたには、いくつかの決まり文句を避けたい場合はプロパティ)。 これは故意です。 コンポーネントは最も使用されているプロパティの面倒を見ます、そしてそれは以下のデモで示される基本的なコンポーネントを使うことはユーザー次第です。 それでも、あなたは使用することができます `inputProps` (及び `InputProps`、 `InputLabelProps` あなたには、いくつかの決まり文句を避けたい場合はプロパティ)。 +いくつかのネイティブHTML入力プロパティが `TextField` コンポーネントにないことに気づいたかもしれません。 これは故意です。 The component takes care of the most used properties. Then, it's up to the user to use the underlying component shown in the following demo. それでも、あなたは使用することができます `inputProps` (及び `InputProps`、 `InputLabelProps` あなたには、いくつかの決まり文句を避けたい場合はプロパティ)。 {{"demo": "pages/components/text-fields/ComposedTextField.js"}} @@ -97,27 +99,62 @@ The component can be controlled or uncontrolled. ## カラー -The `color` prop changes the highlight color of the text field when focused. +`color` プロパティは入力欄がフォーカスされた時のハイライト色を変更します。 {{"demo": "pages/components/text-fields/ColorTextFields.js"}} ## カスタマイズされた入力 (Customized inputs) -コンポーネントのカスタマイズの例を次に示します。 詳細については、 [overrides documentation page](/customization/how-to-customize/)を参照してください。 +コンポーネントのカスタマイズの例を次に示します。 詳細については、 [こちら](/customization/how-to-customize/)を参照してください。 {{"demo": "pages/components/text-fields/CustomizedInputs.js"}} -カスタマイズはCSSにとどまりません。コンポジションを使用してカスタムコンポーネントを作成し、アプリに独特の雰囲気を与えることができます。 カスタマイズはCSSにとどまりません。コンポジションを使用してカスタムコンポーネントを作成し、アプリに独特の雰囲気を与えることができます。 以下は、Googleマップに触発された [`InputBase`](/api/input-base/) コンポーネントを使用した例です。 +Customization does not stop at CSS. You can use composition to build custom components and give your app a unique feel. 以下は、Googleマップに触発された [`InputBase`](/api/input-base/) コンポーネントを使用した例です。 {{"demo": "pages/components/text-fields/CustomizedInputBase.js", "bg": true}} 🎨 If you are looking for inspiration, you can check [MUI Treasury's customization examples](https://mui-treasury.com/styles/text-field). +## `useFormControl` + +For advanced customization use cases, a `useFormControl()` hook is exposed. This hook returns the context value of the parent `FormControl` component. + +**API** + +```jsx +import { useFormControl } from '@material-ui/core/FormControl'; +``` + +**戻り値** + +`value` (_object_): + +- `value.adornedStart` (_bool_): Indicate whether the child `Input` or `Select` component has a start adornment. +- `value.setAdornedStart` (_func_): Setter function for `adornedStart` state value. +- `value.color` (_string_): The theme color is being used, inherited from `FormControl` `color` prop . +- `value.disabled` (_bool_): Indicate whether the component is being displayed in a disabled state, inherited from `FormControl` `disabled` prop. +- `value.error` (_bool_): Indicate whether the component is being displayed in an error state, inherited from `FormControl` `error` prop +- `value.filled` (_bool_): Indicate whether input is filled +- `value.focused` (_bool_): Indicate whether the component and its children are being displayed in a focused state +- `value.fullWidth` (_bool_): Indicate whether the component is taking up the full width of its container, inherited from `FormControl` `fullWidth` prop +- `value.hiddenLabel` (_bool_): Indicate whether the label is being hidden, inherited from `FormControl` `hiddenLabel` prop +- `value.required` (_bool_): Indicate whether the label is indicating that the input is required input, inherited from the `FormControl` `required` prop +- `value.size` (_string_): The size of the component, inherited from the `FormControl` `size` prop +- `value.variant` (_string_): The variant is being used by the `FormControl` component and its children, inherited from `FormControl` `variant` prop +- `value.onBlur` (_func_): Should be called when the input is blurred +- `value.onFocus` (_func_): Should be called when the input is focused +- `value.onEmpty` (_func_): Should be called when the input is emptied +- `value.onFilled` (_func_): Should be called when the input is filled + +**例** + +{{"demo": "pages/components/text-fields/UseFormControl.js"}} + ## 制限事項 ### シュリンク -入力ラベルの「shrink」状態は必ずしも正しくありません。 入力が何かを表示しているとすぐに入力ラベルは縮小するはずです。 状況によっては、「shrink」状態(数値入力、日時入力、ストライプ入力)を判別できません。 重複があるかもしれません。 入力が何かを表示しているとすぐに入力ラベルは縮小するはずです。 状況によっては、「shrink」状態(数値入力、日時入力、ストライプ入力)を判別できません。 重複があるかもしれません。 入力が何かを表示しているとすぐに入力ラベルは縮小するはずです。 状況によっては、「shrink」状態(数値入力、日時入力、ストライプ入力)を判別できません。 重複があるかもしれません。 +入力ラベルの「shrink」状態は必ずしも正しくありません。 入力が何かを表示しているとすぐに入力ラベルは縮小するはずです。 状況によっては、「shrink」状態(数値入力、日時入力、ストライプ入力)を判別できません。 重複があるかもしれません。 ![シュリンク](/static/images/text-fields/shrink.png) @@ -135,40 +172,40 @@ The `color` prop changes the highlight color of the text field when focused. ### フローティングラベル -フローティングラベルは絶対位置に配置され、ページのレイアウトには影響しません。 正しく表示するには、入力がラベルよりも大きいことを確認する必要があります。 正しく表示するには、入力がラベルよりも大きいことを確認する必要があります。 正しく表示するには、入力がラベルよりも大きいことを確認する必要があります。 正しく表示するには、入力がラベルよりも大きいことを確認する必要があります。 正しく表示するには、入力がラベルよりも大きいことを確認する必要があります。 +The floating label is absolutely positioned. It won't impact the layout of the page. Make sure that the input is larger than the label to display correctly. ### type="number" -Inputs of type="number" have potential usability issues: +type="number" の入力欄には、使いやすさの面で問題がある可能性があります。 -- Allowing certain non-numeric characters ('e', '+', '-', '.') and silently discarding others -- コンポーネントを構成している場合は +- 特定の数字でない文字を許可する ('e', '+', '-', '.') また他の文字を破棄する +- 数値を増減するための機能は、偶発的な変更や通知しにくい変更を引き起こす可能性があります。 -and more - see [this article](https://technology.blog.gov.uk/2020/02/24/why-the-gov-uk-design-system-team-changed-the-input-type-for-numbers/) by the GOV.UK Design System team for a more detailed explanation. +詳細は、GOV.UK Design System チームのこちらの記事 [](https://technology.blog.gov.uk/2020/02/24/why-the-gov-uk-design-system-team-changed-the-input-type-for-numbers/) をご覧ください。 -For number validation, one viable alternative is to use the default input type="text" with the _pattern_ attribute, for example: +数値のバリデーションには、 _pattern_ 属性を持つデフォルトの input typr="text"を使用します。例えば、次のようにします。 ```jsx <TextField inputProps={{ inputMode: 'numeric', pattern: '[0-9]*' }} /> ``` -In the future, we might provide a [number input component](https://github.com/mui-org/material-ui/issues/19154). +将来的には、 [数値入力コンポーネント](https://github.com/mui-org/material-ui/issues/19154) を提供するかもしれません。 -### Helper text +### ヘルパーテキスト -The helper text prop affects the height of the text field. If two text fields are placed side by side, one with a helper text and one without, they will have different heights. For example: +helper textプロパティはテキストフィールドの高さに影響します。 ヘルパーテキストを持つテキストフィールドと持たないテキストフィールドを横に並べると、それらの高さが異なるようになります。 For example: {{"demo": "pages/components/text-fields/HelperTextMisaligned.js"}} -This can be fixed by passing a space character to the `helperText` prop: +これは `helperText` プロパティにスペースを渡すことで修正できます。 {{"demo": "pages/components/text-fields/HelperTextAligned.js"}} ## サードパーティの入力ライブラリとの統合 -サードパーティのライブラリを使って入力をフォーマットすることができます。 指定された入力コンポーネントは、 `inputRef` プロパティを処理する必要があります。 このプロパティは、次のインターフェイスを実装する値で呼び出す必要があります。 指定された入力コンポーネントは、 `inputRef` プロパティを処理する必要があります。 このプロパティは、次のインターフェイスを実装する値で呼び出す必要があります。 このプロパティは、次のインターフェイスを実装する値で呼び出す必要があります。 このプロパティは、次のインターフェイスを実装する値で呼び出す必要があります。 このプロパティは、次のインターフェイスを実装する値で呼び出す必要があります。 +サードパーティのライブラリを使って入力をフォーマットすることができます。 `inputComponent` プロパティを使用して、 `<input>` 要素のカスタム実装を提供する必要があります。 -次のデモでは、[react-text-mask](https://github.com/text-mask/text-mask) と[react-number-format](https://github.com/s-yadav/react-number-format)ライブラリを使用します。 同じ概念を [(たとえば、react-stripe-element)に適用することもできます](https://github.com/mui-org/material-ui/issues/16037)。 同じ概念を [(たとえば、react-stripe-element)に適用することもできます](https://github.com/mui-org/material-ui/issues/16037)。 同じ概念を [(たとえば、react-stripe-element)に適用することもできます](https://github.com/mui-org/material-ui/issues/16037)。 同じ概念を [(たとえば、react-stripe-element)に適用することもできます](https://github.com/mui-org/material-ui/issues/16037)。 同じ概念を [(たとえば、react-stripe-element)に適用することもできます](https://github.com/mui-org/material-ui/issues/16037)。 同じ概念を [(たとえば、react-stripe-element)に適用することもできます](https://github.com/mui-org/material-ui/issues/16037)。 +次のデモでは、[react-text-mask](https://github.com/text-mask/text-mask) と[react-number-format](https://github.com/s-yadav/react-number-format)ライブラリを使用します。 同じ概念を [(たとえば、react-stripe-element)に適用することもできます](https://github.com/mui-org/material-ui/issues/16037)。 {{"demo": "pages/components/text-fields/FormattedInputs.js"}} @@ -233,7 +270,7 @@ const MyInputComponent = React.forwardRef((props, ref) => { ## 補完プロジェクト -より高度な使用例では、以下を利用できます。 +For more advanced use cases, you might be able to take advantage of: - [mui-rff](https://github.com/lookfirst/mui-rff) Bindings for using Material-UI with [React Final Form](https://final-form.org/react). - [formik-material-ui](https://github.com/stackworx/formik-material-ui): Bindings for using Material-UI with [formik](https://jaredpalmer.com/formik). diff --git a/docs/src/pages/components/text-fields/text-fields-pt.md b/docs/src/pages/components/text-fields/text-fields-pt.md index 62ac1e1c84a252..a16b941bfd8dc0 100644 --- a/docs/src/pages/components/text-fields/text-fields-pt.md +++ b/docs/src/pages/components/text-fields/text-fields-pt.md @@ -13,11 +13,9 @@ materialDesign: https://material.io/components/text-fields {{"component": "modules/components/ComponentLinkHeader.js"}} -## TextField +## Basic TextField -O componente wrapper `TextField` é um controle de formulário completo, incluindo um rótulo, entrada e texto de ajuda. - -Ele suporta 3 variações: O estilo padrão, com contorno e preenchido. +The `TextField` wrapper component is a complete form control including a label, input, and help text. It comes with three variants: outlined (default), filled, and standard. {{"demo": "pages/components/text-fields/BasicTextFields.js"}} @@ -31,7 +29,7 @@ Standard form attributes are supported e.g. `required`, `disabled`, `type`, etc. ## Validação -A propriedade `error` habilita o estado de erro, e utilizando a propriedade `helperText` será fornecido um feedback ao usuário sobre o erro. +The `error` prop toggles the error state. The `helperText` prop can then be used to provide feedback to the user about the error. {{"demo": "pages/components/text-fields/ValidationTextFields.js"}} @@ -39,7 +37,7 @@ A propriedade `error` habilita o estado de erro, e utilizando a propriedade `hel A propriedade `multiline` transforma o `textfield` em um `<a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea">TextArea</a>. Unless the`rows`prop is set, the height of the text field dynamically matches its content (using [TextareaAutosize](/components/textarea-autosize/)). -You can use the`rowsMin`and`rowsMax` props to bound it. +You can use the <code>minRows` and `maxRows` props to bound it. {{"demo": "pages/components/text-fields/MultilineTextFields.js"}} @@ -57,7 +55,7 @@ Há muitas formas de incluir um ícone com um campo de texto. ### Adereços de campo -A forma principal é utilizando um componente `InputAdornment`. Estes podem ser usados para adicionar um prefixo, sufixo ou uma ação para um campo. Por exemplo, você pode usar um botão com ícone para ocultar ou revelar a senha. +A forma principal é utilizando um componente `InputAdornment`. This can be used to add a prefix, a suffix, or an action to an input. Por exemplo, você pode usar um botão com ícone para ocultar ou revelar a senha. {{"demo": "pages/components/text-fields/InputAdornments.js"}} @@ -71,15 +69,19 @@ A altura do campo na variante `filled` pode ser reduzida ainda mais ao renderiza {{"demo": "pages/components/text-fields/TextFieldHiddenLabel.js"}} -## Leiaute +## Margin + +The `margin` prop can be used to alter the vertical spacing of the text field. Using `none` (default) doesn't apply margins to the `FormControl` whereas `dense` and `normal` do. + +{{"demo": "pages/components/text-fields/LayoutTextFields.js"}} -A propriedade `margin` pode ser utilizada para alterar o espaçamento vertical dos campos. Usar `none` (padrão) não aplicará margens para o `FormControl`, enquanto `dense` e `normal` irá. As definições `dense` e `normal` altera outros estilos para atender a especificação. +## Largura total A propriedade `fullWidth` pode ser usada para fazer com que o campo ocupe a largura total de seu contêiner. -{{"demo": "pages/components/text-fields/LayoutTextFields.js"}} +{{"demo": "pages/components/text-fields/FullWidthTextField.js"}} -## Não controlado vs controlado +## Uncontrolled vs. Controlled O componente pode ser controlado ou não controlado. @@ -89,7 +91,7 @@ O componente pode ser controlado ou não controlado. O componente `TextField` é composto por componentes menores ([`FormControl`](/api/form-control/), [`Input`](/api/input/), [`FilledInput`](/api/filled-input/), [`InputLabel`](/api/input-label/), [`OutlinedInput`](/api/outlined-input/), e [`FormHelperText`](/api/form-helper-text/)) que você pode aproveitar diretamente para customizar significativamente os campos do seu formulário. -Você também pode ter notado que algumas propriedades de campo nativas do HTML input estão faltando no componente `TextField`. Isto é intencional. O componente cuida das propriedades mais usadas, depois cabe ao usuário, caso queira, usar o componente subjacente, como esta exibido na demonstração a seguir. Ainda, você pode usar `inputProps` (`InputProps` e `InputLabelProps`) se você quiser evitar algum boilerplate. +Você também pode ter notado que algumas propriedades de campo nativas do HTML input estão faltando no componente `TextField`. Isto é intencional. The component takes care of the most used properties. Then, it's up to the user to use the underlying component shown in the following demo. Ainda, você pode usar `inputProps` (`InputProps` e `InputLabelProps`) se você quiser evitar algum boilerplate. {{"demo": "pages/components/text-fields/ComposedTextField.js"}} @@ -109,12 +111,47 @@ Aqui estão alguns exemplos de customização do componente. Você pode aprender {{"demo": "pages/components/text-fields/CustomizedInputs.js"}} -A customização não para no CSS, você pode usar composição para criar componentes customizados e dar ao seu aplicativo uma sensação única. Abaixo há um exemplo usando o componente [`InputBase`](/api/input-base/), inspirado pelo Google Maps. +Customization does not stop at CSS. You can use composition to build custom components and give your app a unique feel. Abaixo há um exemplo usando o componente [`InputBase`](/api/input-base/), inspirado pelo Google Maps. {{"demo": "pages/components/text-fields/CustomizedInputBase.js", "bg": true}} 🎨 Se você está procurando inspiração, você pode verificar [os exemplos de customização de MUI Treasury](https://mui-treasury.com/styles/text-field). +## `useFormControl` + +For advanced customization use cases, a `useFormControl()` hook is exposed. This hook returns the context value of the parent `FormControl` component. + +**API** + +```jsx +import { useFormControl } from '@material-ui/core/FormControl'; +``` + +**Retornos** + +`value` (_object_): + +- `value.adornedStart` (_bool_): Indicate whether the child `Input` or `Select` component has a start adornment. +- `value.setAdornedStart` (_func_): Setter function for `adornedStart` state value. +- `value.color` (_string_): The theme color is being used, inherited from `FormControl` `color` prop . +- `value.disabled` (_bool_): Indicate whether the component is being displayed in a disabled state, inherited from `FormControl` `disabled` prop. +- `value.error` (_bool_): Indicate whether the component is being displayed in an error state, inherited from `FormControl` `error` prop +- `value.filled` (_bool_): Indicate whether input is filled +- `value.focused` (_bool_): Indicate whether the component and its children are being displayed in a focused state +- `value.fullWidth` (_bool_): Indicate whether the component is taking up the full width of its container, inherited from `FormControl` `fullWidth` prop +- `value.hiddenLabel` (_bool_): Indicate whether the label is being hidden, inherited from `FormControl` `hiddenLabel` prop +- `value.required` (_bool_): Indicate whether the label is indicating that the input is required input, inherited from the `FormControl` `required` prop +- `value.size` (_string_): The size of the component, inherited from the `FormControl` `size` prop +- `value.variant` (_string_): The variant is being used by the `FormControl` component and its children, inherited from `FormControl` `variant` prop +- `value.onBlur` (_func_): Should be called when the input is blurred +- `value.onFocus` (_func_): Should be called when the input is focused +- `value.onEmpty` (_func_): Should be called when the input is emptied +- `value.onFilled` (_func_): Should be called when the input is filled + +**Exemplo** + +{{"demo": "pages/components/text-fields/UseFormControl.js"}} + ## Limitações ### Shrink @@ -137,13 +174,13 @@ ou ### Rótulo flutuante -O rótulo flutuante está absolutamente posicionado, não afetará o leiaute da página. Você precisa ter certeza de que o componente de campo é maior do que o rótulo para a exibição correta. +The floating label is absolutely positioned. It won't impact the layout of the page. Make sure that the input is larger than the label to display correctly. ### type="number" Campos com type="number" tem problemas potenciais de usabilidade: -- Permitindo certos caracteres não numéricos ('e', '+', '-', '.') e silenciosamente descartando outros e silenciosamente descartando outros +- Permitindo certos caracteres não numéricos ('e', '+', '-', '.') e silenciosamente descartando outros e silenciosamente descartando outros e silenciosamente descartando outros - A funcionalidade de rolagem para incrementar/decrementar o número, pode causar alterações acidentais difíceis de notar e muito mais - consulte [este artigo](https://technology.blog.gov.uk/2020/02/24/why-the-gov-uk-design-system-team-changed-the-input-type-for-numbers/) da equipe GOV.UK Design System para obter uma explicação mais detalhada. @@ -235,7 +272,7 @@ Para que o campo de texto seja acessível, **a entrada deve estar vinculada ao r ## Projetos Complementares -Para situações de uso mais avançadas, você pode tirar proveito com: +For more advanced use cases, you might be able to take advantage of: - [react-hook-form](https://react-hook-form.com/): React hook para validação de formulários. - [formik-material-ui](https://github.com/stackworx/formik-material-ui): Bindings para usar Material-UI com [formik](https://jaredpalmer.com/formik). diff --git a/docs/src/pages/components/text-fields/text-fields-ru.md b/docs/src/pages/components/text-fields/text-fields-ru.md index 19d3607f5e8bb8..7bdd8f1aa209d2 100644 --- a/docs/src/pages/components/text-fields/text-fields-ru.md +++ b/docs/src/pages/components/text-fields/text-fields-ru.md @@ -13,11 +13,9 @@ materialDesign: https://material.io/components/text-fields {{"component": "modules/components/ComponentLinkHeader.js"}} -## TextField +## Basic TextField -`TextField` представляет собой полноценный элемент управления формы, включая метку (label), само поле ввода и вспомогательный текст. - -It supports standard, outlined and filled styling. +The `TextField` wrapper component is a complete form control including a label, input, and help text. It comes with three variants: outlined (default), filled, and standard. {{"demo": "pages/components/text-fields/BasicTextFields.js"}} @@ -31,13 +29,13 @@ Standard form attributes are supported e.g. `required`, `disabled`, `type`, etc. ## Validation -The `error` prop toggles the error state, the `helperText` prop can then be used to provide feedback to the user about the error. +The `error` prop toggles the error state. The `helperText` prop can then be used to provide feedback to the user about the error. {{"demo": "pages/components/text-fields/ValidationTextFields.js"}} ## Multiline -The `multiline` prop transforms the text field into a [textarea](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea) or a [TextareaAutosize](/components/textarea-autosize/). Unless the `rows` prop is set, the height of the text field dynamically matches its content (using [TextareaAutosize](/components/textarea-autosize/)). You can use the `rowsMin` and `rowsMax` props to bound it. +The `multiline` prop transforms the text field into a [textarea](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea) or a [TextareaAutosize](/components/textarea-autosize/). Unless the `rows` prop is set, the height of the text field dynamically matches its content (using [TextareaAutosize](/components/textarea-autosize/)). You can use the `minRows` and `maxRows` props to bound it. {{"demo": "pages/components/text-fields/MultilineTextFields.js"}} @@ -55,7 +53,7 @@ There are multiple ways to display an icon with a text field. ### Украшения поля ввода (Input) -The main way is with an `InputAdornment`. Например, вы можете использовать кнопку-иконку, чтобы скрыть или показать пароль. This can be used to add a prefix, a suffix or an action to an input. +The main way is with an `InputAdornment`. This can be used to add a prefix, a suffix, or an action to an input. This can be used to add a prefix, a suffix or an action to an input. {{"demo": "pages/components/text-fields/InputAdornments.js"}} @@ -69,15 +67,19 @@ The `filled` variant input height can be further reduced by rendering the label {{"demo": "pages/components/text-fields/TextFieldHiddenLabel.js"}} -## Расположение +## Margin + +The `margin` prop can be used to alter the vertical spacing of the text field. Using `none` (default) doesn't apply margins to the `FormControl` whereas `dense` and `normal` do. + +{{"demo": "pages/components/text-fields/LayoutTextFields.js"}} -`dense` and `normal` alter other styles to meet the specification. `margin` prop can be used to alter the vertical spacing of inputs. Using `none` (default) will not apply margins to the `FormControl`, whereas `dense` and `normal` will. +## Full width `fullWidth` can be used to make the input take up the full width of its container. -{{"demo": "pages/components/text-fields/LayoutTextFields.js"}} +{{"demo": "pages/components/text-fields/FullWidthTextField.js"}} -## Uncontrolled vs Controlled +## Uncontrolled vs. Controlled The component can be controlled or uncontrolled. @@ -87,7 +89,7 @@ The component can be controlled or uncontrolled. `TextField` состоит из более мелких компонентов ( [`FormControl`](/api/form-control/), [`Input`](/api/input/), [`FilledInput`](/api/filled-input/), [`InputLabel`](/api/input-label/), [`OutlinedInput`](/api/outlined-input/), и [`FormHelperText`](/api/form-helper-text/) ) которые вы можете использовать напрямую, чтобы значительно кастомизировать ваши поля ввода. -Вы также могли заметить, что некоторые нативные свойства ввода HTML отсутствуют в компоненте `TextField`. Это сделано специально. Компонент включает в себя наиболее часто используемые свойства, а для расширенного использования можно использовать базовый компонент, показанный в следующей демонстрации. Вы все еще можете использовать `inputProps` (и `свойства InputProps`, `InputLabelProps`), если хотите избежать излишнего кода. +Вы также могли заметить, что некоторые нативные свойства ввода HTML отсутствуют в компоненте `TextField`. Это сделано специально. The component takes care of the most used properties. Then, it's up to the user to use the underlying component shown in the following demo. Вы все еще можете использовать `inputProps` (и `свойства InputProps`, `InputLabelProps`), если хотите избежать излишнего кода. {{"demo": "pages/components/text-fields/ComposedTextField.js"}} @@ -103,16 +105,51 @@ The `color` prop changes the highlight color of the text field when focused. ## Кастомизированные поля ввода -Ниже находятся примеры кастомизации компонента. You can learn more about this in the [overrides documentation page](/customization/how-to-customize/). +Ниже находятся примеры кастомизации компонента. Вы можете узнать об этом больше [в документации по переопределению свойств](/customization/how-to-customize/). {{"demo": "pages/components/text-fields/CustomizedInputs.js"}} -Настройка не ограничивается CSS, вы можете использовать композицию для создания пользовательских компонентов и придать вашему приложению уникальный стиль. Ниже приведен пример использования компонента [`InputBase`](/api/input-base/), вдохновленный Google Maps. +Customization does not stop at CSS. You can use composition to build custom components and give your app a unique feel. Ниже приведен пример использования компонента [`InputBase`](/api/input-base/), вдохновленный Google Maps. {{"demo": "pages/components/text-fields/CustomizedInputBase.js", "bg": true}} 🎨 If you are looking for inspiration, you can check [MUI Treasury's customization examples](https://mui-treasury.com/styles/text-field). +## `useFormControl` + +For advanced customization use cases, a `useFormControl()` hook is exposed. This hook returns the context value of the parent `FormControl` component. + +**API** + +```jsx +import { useFormControl } from '@material-ui/core/FormControl'; +``` + +**Возвращает** + +`value` (_object_): + +- `value.adornedStart` (_bool_): Indicate whether the child `Input` or `Select` component has a start adornment. +- `value.setAdornedStart` (_func_): Setter function for `adornedStart` state value. +- `value.color` (_string_): The theme color is being used, inherited from `FormControl` `color` prop . +- `value.disabled` (_bool_): Indicate whether the component is being displayed in a disabled state, inherited from `FormControl` `disabled` prop. +- `value.error` (_bool_): Indicate whether the component is being displayed in an error state, inherited from `FormControl` `error` prop +- `value.filled` (_bool_): Indicate whether input is filled +- `value.focused` (_bool_): Indicate whether the component and its children are being displayed in a focused state +- `value.fullWidth` (_bool_): Indicate whether the component is taking up the full width of its container, inherited from `FormControl` `fullWidth` prop +- `value.hiddenLabel` (_bool_): Indicate whether the label is being hidden, inherited from `FormControl` `hiddenLabel` prop +- `value.required` (_bool_): Indicate whether the label is indicating that the input is required input, inherited from the `FormControl` `required` prop +- `value.size` (_string_): The size of the component, inherited from the `FormControl` `size` prop +- `value.variant` (_string_): The variant is being used by the `FormControl` component and its children, inherited from `FormControl` `variant` prop +- `value.onBlur` (_func_): Should be called when the input is blurred +- `value.onFocus` (_func_): Should be called when the input is focused +- `value.onEmpty` (_func_): Should be called when the input is emptied +- `value.onFilled` (_func_): Should be called when the input is filled + +**Пример** + +{{"demo": "pages/components/text-fields/UseFormControl.js"}} + ## Ограничения ### Сжатие @@ -135,13 +172,13 @@ The `color` prop changes the highlight color of the text field when focused. ### Плавающая метка -Плавающий ярлык абсолютно позиционируется, он не повлияет на макет страницы. Необходимо убедиться, что поле ввода больше, чем метка для корректного отображения. +The floating label is absolutely positioned. It won't impact the layout of the page. Make sure that the input is larger than the label to display correctly. ### type="number" Inputs of type="number" have potential usability issues: -- Allowing certain non-numeric characters ('e', '+', '-', '.') and silently discarding others and silently discarding others and silently discarding others +- Allowing certain non-numeric characters ('e', '+', '-', '.') and silently discarding others and silently discarding others and silently discarding others and silently discarding others - Если вы составляете компонент: and more - see [this article](https://technology.blog.gov.uk/2020/02/24/why-the-gov-uk-design-system-team-changed-the-input-type-for-numbers/) by the GOV.UK Design System team for a more detailed explanation. @@ -233,7 +270,7 @@ In order for the text field to be accessible, **the input should be linked to th ## Дополнительные проекты -Для более сложных вариантов использования вы можете воспользоваться: +For more advanced use cases, you might be able to take advantage of: - [mui-rff](https://github.com/lookfirst/mui-rff) Bindings for using Material-UI with [React Final Form](https://final-form.org/react). - [formik-material-ui](https://github.com/stackworx/formik-material-ui): Bindings for using Material-UI with [formik](https://jaredpalmer.com/formik). diff --git a/docs/src/pages/components/text-fields/text-fields-zh.md b/docs/src/pages/components/text-fields/text-fields-zh.md index 761988ecea4e95..a38dba9a9061a8 100644 --- a/docs/src/pages/components/text-fields/text-fields-zh.md +++ b/docs/src/pages/components/text-fields/text-fields-zh.md @@ -13,11 +13,9 @@ materialDesign: https://material.io/components/text-fields {{"component": "modules/components/ComponentLinkHeader.js"}} -## TextField +## Basic TextField -`TextField` wrapper 组件是一个完整的表单控件,它包括了标签,输入和帮助文本。 - -它支持 standard,outlined 和 filled 这几个样式。 +The `TextField` wrapper component is a complete form control including a label, input, and help text. It comes with three variants: outlined (default), filled, and standard. {{"demo": "pages/components/text-fields/BasicTextFields.js"}} @@ -25,19 +23,19 @@ materialDesign: https://material.io/components/text-fields ## Form props 表单的属性 -Standard form attributes are supported e.g. `required`, `disabled`, `type`, etc. as well as a `helperText` which is used to give context about a field's input, such as how the input will be used. +该组件支持标准的表单属性,例如 `required`、`disabled`、`type` 以及`helperText` 等,用于提供字段输入的上下文,例如输入的使用方式。 {{"demo": "pages/components/text-fields/FormPropsTextFields.js"}} ## 校验 -您可以使用 `error` 属性来切换错误的状态,同时也可以使用 `helperText` 属性来给用户提供错误的提示信息。 +The `error` prop toggles the error state. The `helperText` prop can then be used to provide feedback to the user about the error. {{"demo": "pages/components/text-fields/ValidationTextFields.js"}} ## 多行属性 -`multiline` 属性将文本字段转换为 [`<textarea>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea) 元素。 除非设置了 `rows` 属性,否则文本字段的高度会动态匹配其内容(使用 [TextareaAutosize](/components/textarea-autosize/) 时)。 你可以使用 `rowsMin` 和 `rowsMax` 属性来绑定它。 +`multiline` 属性将文本字段转换为 [`<textarea>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea) 元素。 除非设置了 `rows` 属性,否则文本字段的高度会动态匹配其内容(使用 [TextareaAutosize](/components/textarea-autosize/) 时)。 You can use the `minRows` and `maxRows` props to bound it. {{"demo": "pages/components/text-fields/MultilineTextFields.js"}} @@ -55,7 +53,7 @@ Standard form attributes are supported e.g. `required`, `disabled`, `type`, etc. ### 修饰输入框 -一个主流的方法是使用 `InputAdornment` 组件。 这些可用于向输入添加前缀、后缀或动作. 例如,可以用一个图标按钮来隐藏或者显示输入框里的密码。 +一个主流的方法是使用 `InputAdornment` 组件。 This can be used to add a prefix, a suffix, or an action to an input. 例如,可以用一个图标按钮来隐藏或者显示输入框里的密码。 {{"demo": "pages/components/text-fields/InputAdornments.js"}} @@ -69,15 +67,19 @@ Standard form attributes are supported e.g. `required`, `disabled`, `type`, etc. {{"demo": "pages/components/text-fields/TextFieldHiddenLabel.js"}} -## 布局 +## Margin + +The `margin` prop can be used to alter the vertical spacing of the text field. Using `none` (default) doesn't apply margins to the `FormControl` whereas `dense` and `normal` do. + +{{"demo": "pages/components/text-fields/LayoutTextFields.js"}} -通过使用 `margin` 属性,你可以改变输入框的垂直间距。 若您使用 `none` (默认选项),将不会在 `FormControl` 上添加间距, 相对来说,使用 `dense` 和 `normal` 会添加间距。 使用 ` dense ` 和 `normal` 会更改其他的样式,以符合规范。 +## 全宽 我们提供了`fullWidth` 属性,使用它的时候,输入框会占据整个容器的宽度。 -{{"demo": "pages/components/text-fields/LayoutTextFields.js"}} +{{"demo": "pages/components/text-fields/FullWidthTextField.js"}} -## 可控制的 vs 不可控制的 +## Uncontrolled vs. Controlled 你可以选择控制的组件,或者不受控的组件。 @@ -87,7 +89,7 @@ Standard form attributes are supported e.g. `required`, `disabled`, `type`, etc. `TextField` 是由一些较小的组件组成的 ( [`FormControl`](/api/form-control/), [`Input`](/api/input/), [`FilledInput`](/api/filled-input/), [`InputLabel`](/api/input-label/), [`OutlinedInput`](/api/outlined-input/), and [`FormHelperText`](/api/form-helper-text/) ) ,而你可以直接使用这些小的组件,来自定制你的表单域输入框。 -您可能注意到了, 和原生的 HTML input 组件相比,`TextField` 组件缺失了一些属性。 这是故意为之的。 该组件只负责处理最常用的一些属性,如果有需求,用户可以自行调用下面演示的一些组件。 但是同时, 为了避免过于模版化,您仍然可以使用 `inputProps` (和 `inputProps`, `InputLabelProps` 属性) 来控制原生组件的属性。 +您可能注意到了, 和原生的 HTML input 组件相比,`TextField` 组件缺失了一些属性。 这是故意为之的。 The component takes care of the most used properties. Then, it's up to the user to use the underlying component shown in the following demo. 但是同时, 为了避免过于模版化,您仍然可以使用 `inputProps` (和 `inputProps`, `InputLabelProps` 属性) 来控制原生组件的属性。 {{"demo": "pages/components/text-fields/ComposedTextField.js"}} @@ -107,12 +109,47 @@ Standard form attributes are supported e.g. `required`, `disabled`, `type`, etc. {{"demo": "pages/components/text-fields/CustomizedInputs.js"}} -自定义不会停留在CSS,您可以使用组合来构建自定义组件,让您的 app 独树一帜。 接下来的这个示例受到了 Google 地图的启发,它使用了 [`InputBase`](/api/input-base/) 组件。 +Customization does not stop at CSS. You can use composition to build custom components and give your app a unique feel. 接下来的这个示例受到了 Google 地图的启发,它使用了 [`InputBase`](/api/input-base/) 组件。 {{"demo": "pages/components/text-fields/CustomizedInputBase.js", "bg": true}} 🎨 如果您还在寻找灵感,您可以看看 [MUI Treasury 特别定制的一些例子](https://mui-treasury.com/styles/text-field)。 +## `useFormControl` + +For advanced customization use cases, a `useFormControl()` hook is exposed. This hook returns the context value of the parent `FormControl` component. + +**API** + +```jsx +import { useFormControl } from '@material-ui/core/FormControl'; +``` + +**返回结果** + +`value` (_object_): + +- `value.adornedStart` (_bool_): Indicate whether the child `Input` or `Select` component has a start adornment. +- `value.setAdornedStart` (_func_): Setter function for `adornedStart` state value. +- `value.color` (_string_): The theme color is being used, inherited from `FormControl` `color` prop . +- `value.disabled` (_bool_): Indicate whether the component is being displayed in a disabled state, inherited from `FormControl` `disabled` prop. +- `value.error` (_bool_): Indicate whether the component is being displayed in an error state, inherited from `FormControl` `error` prop +- `value.filled` (_bool_): Indicate whether input is filled +- `value.focused` (_bool_): Indicate whether the component and its children are being displayed in a focused state +- `value.fullWidth` (_bool_): Indicate whether the component is taking up the full width of its container, inherited from `FormControl` `fullWidth` prop +- `value.hiddenLabel` (_bool_): Indicate whether the label is being hidden, inherited from `FormControl` `hiddenLabel` prop +- `value.required` (_bool_): Indicate whether the label is indicating that the input is required input, inherited from the `FormControl` `required` prop +- `value.size` (_string_): The size of the component, inherited from the `FormControl` `size` prop +- `value.variant` (_string_): The variant is being used by the `FormControl` component and its children, inherited from `FormControl` `variant` prop +- `value.onBlur` (_func_): Should be called when the input is blurred +- `value.onFocus` (_func_): Should be called when the input is focused +- `value.onEmpty` (_func_): Should be called when the input is emptied +- `value.onFilled` (_func_): Should be called when the input is filled + +**示例** + +{{"demo": "pages/components/text-fields/UseFormControl.js"}} + ## 设计局限 ### 缩放 @@ -135,11 +172,11 @@ Standard form attributes are supported e.g. `required`, `disabled`, `type`, etc. ### 悬浮的标签 -悬浮的标签被定义了一个绝对的位置,这样的话,它将不会影响到页面的整体布局。 想要正确显示你的组件,你只要确保输入框的比输入标签大。 +The floating label is absolutely positioned. It won't impact the layout of the page. Make sure that the input is larger than the label to display correctly. ### type="number" -type="number" 的输入存在潜在的可用性问题: +type="number" 的输入存在潜在的可用性问题。 - 这将允许某些非数字字符('e', '+', '-', '.') 并且丢失其他字符 并且丢失其他字符 并且丢失其他字符 - 滚动增加/减少数字的功能可能会导致意外和难以察觉的变化。 @@ -156,7 +193,7 @@ type="number" 的输入存在潜在的可用性问题: ### 辅助文本 -辅助文本属性会影响文本字段的高度。 如果两个文本字段并排放置,一个有辅助文本,另一个没有,那么它们的高度就会不同。 例如: +助手文本属性会影响文本字段的高度。 如果两个文本字段并排放置,一个有辅助文本,另一个没有,那么它们的高度就会不同。 例如: {{"demo": "pages/components/text-fields/HelperTextMisaligned.js"}} @@ -233,7 +270,7 @@ const MyInputComponent = React.forwardRef((props, ref) => { ## 补充项目 -对于更高级的用例,您可以利用: +For more advanced use cases, you might be able to take advantage of: - [react-hook-form](https://react-hook-form.com/):用于表单验证的 React 钩子。 - [formik-material-ui](https://github.com/stackworx/formik-material-ui):用于 [formik](https://jaredpalmer.com/formik) 和 Material-UI 捆绑使用。 diff --git a/docs/src/pages/components/time-picker/time-picker-de.md b/docs/src/pages/components/time-picker/time-picker-de.md index a8b2108076c385..d4ae9a248f6f7b 100644 --- a/docs/src/pages/components/time-picker/time-picker-de.md +++ b/docs/src/pages/components/time-picker/time-picker-de.md @@ -1,6 +1,6 @@ --- title: React Time Picker component -components: TimePicker +components: DesktopTimePicker, MobileTimePicker, StaticTimePicker, TimePicker, ClockPicker githubLabel: 'component: TimePicker' packageName: '@material-ui/lab' materialDesign: https://material.io/components/time-pickers @@ -34,41 +34,53 @@ function App() { ## Basic usage -The time picker will automatically adjust to the locale's time setting, i.e. the 12-hour or 24-hour format. This can be controlled with `ampm` prop. +The date picker is rendered as a modal dialog on mobile, and a textbox with a popup on desktop. {{"demo": "pages/components/time-picker/BasicTimePicker.js"}} -## Lokalisierung +## Static mode -Use `LocalizationProvider` to change the date-engine locale that is used to render the time picker. Note that `am/pm` setting is switched automatically: +It's possible to render any time picker inline. This will enable building custom popover/modal containers. -{{"demo": "pages/components/time-picker/LocalizedTimePicker.js"}} +{{"demo": "pages/components/time-picker/StaticTimePickerDemo.js", "bg": true}} ## Responsiveness The time picker component is designed and optimized for the device it runs on. -- The "Mobile" version works best for touch devices and small screens. -- The "Desktop" version works best for mouse devices and large screens. +- The `MobileTimePicker` component works best for touch devices and small screens. +- The `DesktopTimePicker` component works best for mouse devices and large screens. -By default, the `TimePicker` component uses a `@media (pointer: fine)` media query to determine which version to use. This can be customized with the `desktopModeMediaQuery` prop. +By default, the `TimePicker` component renders the desktop version if the media query [`@media (pointer: fine)`](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/pointer) matches. This can be customized with the `desktopModeMediaQuery` prop. {{"demo": "pages/components/time-picker/ResponsiveTimePickers.js"}} -## Time validation +## Form props -{{"demo": "pages/components/time-picker/TimeValidationTimePicker.js"}} +The time picker component can be disabled or read-only. -## Static mode +{{"demo": "pages/components/time-picker/FormPropsTimePickers.js"}} -It's possible to render any picker inline. This will enable building custom popover/modal containers. +## Lokalisierung -{{"demo": "pages/components/time-picker/StaticTimePickerDemo.js", "bg": true}} +Use `LocalizationProvider` to change the date-engine locale that is used to render the time picker. The time picker will automatically adjust to the locale's time setting, i.e. the 12-hour or 24-hour format. This can be controlled with `ampm` prop. + +{{"demo": "pages/components/time-picker/LocalizedTimePicker.js"}} + +## Time validation + +{{"demo": "pages/components/time-picker/TimeValidationTimePicker.js"}} ## Landscape {{"demo": "pages/components/time-picker/StaticTimePickerLandscape.js", "bg": true}} +## Sub-components + +Some lower-level sub-components (`ClockPicker`) are also exported. These are rendered without a wrapper or outer logic (masked input, date values parsing and validation, etc.). + +{{"demo": "pages/components/time-picker/SubComponentsTimePickers.js"}} + ## Seconds The seconds input can be used for selection of a precise time point. diff --git a/docs/src/pages/components/time-picker/time-picker-es.md b/docs/src/pages/components/time-picker/time-picker-es.md index 8121f7dea65993..373ede9adbe2e5 100644 --- a/docs/src/pages/components/time-picker/time-picker-es.md +++ b/docs/src/pages/components/time-picker/time-picker-es.md @@ -1,6 +1,6 @@ --- title: React Time Picker component -components: TimePicker +components: DesktopTimePicker, MobileTimePicker, StaticTimePicker, TimePicker, ClockPicker githubLabel: 'component: TimePicker' packageName: '@material-ui/lab' materialDesign: https://material.io/components/time-pickers @@ -34,41 +34,53 @@ function App() { ## Basic usage -The time picker will automatically adjust to the locale's time setting, i.e. the 12-hour or 24-hour format. This can be controlled with `ampm` prop. +The date picker will be rendered as a modal dialog on mobile, and a textfield with a popover on desktop. {{"demo": "pages/components/time-picker/BasicTimePicker.js"}} -## Localización +## Static mode -Use `LocalizationProvider` to change the date-engine locale that is used to render the time picker. Note that `am/pm` setting is switched automatically: +It's possible to render any time picker inline. This will enable building custom popover/modal containers. -{{"demo": "pages/components/time-picker/LocalizedTimePicker.js"}} +{{"demo": "pages/components/time-picker/StaticTimePickerDemo.js", "bg": true}} ## Responsiveness The time picker component is designed and optimized for the device it runs on. -- The "Mobile" version works best for touch devices and small screens. -- The "Desktop" version works best for mouse devices and large screens. +- The `MobileTimePicker` component works best for touch devices and small screens. +- The `DesktopTimePicker` component works best for mouse devices and large screens. -By default, the `TimePicker` component uses a `@media (pointer: fine)` media query to determine which version to use. This can be customized with the `desktopModeMediaQuery` prop. +By default, the `TimePicker` component renders the desktop version if the media query [`@media (pointer: fine)`](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/pointer) matches. This can be customized with the `desktopModeMediaQuery` prop. {{"demo": "pages/components/time-picker/ResponsiveTimePickers.js"}} -## Time validation +## Propiedades del Form -{{"demo": "pages/components/time-picker/TimeValidationTimePicker.js"}} +The time picker component can be disabled or read-only. -## Static mode +{{"demo": "pages/components/time-picker/FormPropsTimePickers.js"}} -It's possible to render any picker inline. This will enable building custom popover/modal containers. +## Localización -{{"demo": "pages/components/time-picker/StaticTimePickerDemo.js", "bg": true}} +Use `LocalizationProvider` to change the date-engine locale that is used to render the time picker. The time picker will automatically adjust to the locale's time setting, i.e. the 12-hour or 24-hour format. This can be controlled with `ampm` prop. + +{{"demo": "pages/components/time-picker/LocalizedTimePicker.js"}} + +## Time validation + +{{"demo": "pages/components/time-picker/TimeValidationTimePicker.js"}} ## Landscape {{"demo": "pages/components/time-picker/StaticTimePickerLandscape.js", "bg": true}} +## Sub-components + +Some lower-level sub-components (`ClockPicker`) are also exported. These are rendered without a wrapper or outer logic (masked input, date values parsing and validation, etc.). + +{{"demo": "pages/components/time-picker/SubComponentsTimePickers.js"}} + ## Seconds The seconds input can be used for selection of a precise time point. diff --git a/docs/src/pages/components/time-picker/time-picker-fr.md b/docs/src/pages/components/time-picker/time-picker-fr.md index 681682feb91021..7936643f67a312 100644 --- a/docs/src/pages/components/time-picker/time-picker-fr.md +++ b/docs/src/pages/components/time-picker/time-picker-fr.md @@ -16,12 +16,12 @@ Time pickers allow the user to select a single time (in the hours:minutes format ## Requirements -This component relies on the date management library of your choice. It supports [date-fns](https://date-fns.org/), [luxon](https://moment.github.io/luxon/), [dayjs](https://github.com/iamkun/dayjs), [moment](https://momentjs.com/) and any other library via a public `dateAdapter` interface. +Ce composant compatible avec les bibliothèques de gestion des dates de votre choix. Il supporte [date-fns](https://date-fns.org/), [luxon](https://moment.github.io/luxon/), [dayjs](https://github.com/iamkun/dayjs), [moment](https://momentjs.com/) et toute autre bibliothèque via une interface publique `dateAdapter`. -Please install any of these libraries and set up the right date engine by wrapping your root (or the highest level you wish the pickers to be available) with `LocalizationProvider`: +Veuillez installer l'une de ces bibliothèques et configurer le bon moteur de date en enveloppant votre racine (ou le niveau le plus élevé que vous souhaitez que les sélecteurs soient disponibles) avec `LocalizationProvider`: ```jsx -// or @material-ui/lab/Adapter{DayJS,Luxon,Moment} or any valid date-io adapter +// ou @material-ui/lab/Adapter{DayJS,Luxon,Moment} ou tout adaptateur date-io valide import AdapterDateFns from '@material-ui/lab/AdapterDateFns'; import LocalizationProvider from '@material-ui/lab/LocalizationProvider'; @@ -32,43 +32,55 @@ function App() { } ``` -## Basic usage +## Utilisation de base -The time picker will automatically adjust to the locale's time setting, i.e. the 12-hour or 24-hour format. This can be controlled with `ampm` prop. +The date picker will be rendered as a modal dialog on mobile, and a textfield with a popover on desktop. {{"demo": "pages/components/time-picker/BasicTimePicker.js"}} -## Localisation +## Mode statique -Use `LocalizationProvider` to change the date-engine locale that is used to render the time picker. Note that `am/pm` setting is switched automatically: +It's possible to render any picker inline. This will enable building custom popover/modal containers. -{{"demo": "pages/components/time-picker/LocalizedTimePicker.js"}} +{{"demo": "pages/components/time-picker/StaticTimePickerDemo.js", "bg": true}} -## Responsiveness +## LA responsive UI The time picker component is designed and optimized for the device it runs on. - The "Mobile" version works best for touch devices and small screens. - The "Desktop" version works best for mouse devices and large screens. -By default, the `TimePicker` component uses a `@media (pointer: fine)` media query to determine which version to use. This can be customized with the `desktopModeMediaQuery` prop. +By default, the `TimePicker` component uses a `@media (pointer: fine)` media query to determine which version to use. Ceci peut être personnalisé avec la propriété `desktopModeMediaQuery`. {{"demo": "pages/components/time-picker/ResponsiveTimePickers.js"}} -## Time validation +## Form props -{{"demo": "pages/components/time-picker/TimeValidationTimePicker.js"}} +The time picker component can be disabled or read-only. -## Static mode +{{"demo": "pages/components/time-picker/FormPropsTimePickers.js"}} -It's possible to render any picker inline. This will enable building custom popover/modal containers. +## Localisation -{{"demo": "pages/components/time-picker/StaticTimePickerDemo.js", "bg": true}} +The time picker will automatically adjust to the locale's time setting, i.e. the 12-hour or 24-hour format. This can be controlled with `ampm` prop. + +{{"demo": "pages/components/time-picker/LocalizedTimePicker.js"}} + +## Time validation + +{{"demo": "pages/components/time-picker/TimeValidationTimePicker.js"}} ## Landscape {{"demo": "pages/components/time-picker/StaticTimePickerLandscape.js", "bg": true}} +## Sous-composants + +Some lower-level sub-components (`ClockPicker`) are also exported. Celles-ci sont affichées sans wrapper ou logique externe (l'input masqué et validation des valeurs de date, etc.). + +{{"demo": "pages/components/time-picker/SubComponentsTimePickers.js"}} + ## Seconds The seconds input can be used for selection of a precise time point. diff --git a/docs/src/pages/components/time-picker/time-picker-ja.md b/docs/src/pages/components/time-picker/time-picker-ja.md index d91082d7f2573b..9a2cb84c030a10 100644 --- a/docs/src/pages/components/time-picker/time-picker-ja.md +++ b/docs/src/pages/components/time-picker/time-picker-ja.md @@ -1,27 +1,27 @@ --- -title: React Time Picker component -components: TimePicker +title: React タイムピッカー・コンポーネント +components: DesktopTimePicker, MobileTimePicker, StaticTimePicker, TimePicker, ClockPicker githubLabel: 'component: TimePicker' packageName: '@material-ui/lab' materialDesign: https://material.io/components/time-pickers --- -# Time Picker +# タイムピッカー -<p class="description">Time pickers allow the user to select a single time.</p> +<p class="description">タイムピッカーを使うことでユーザーはある一つの時間を選択することができます。</p> -Time pickers allow the user to select a single time (in the hours:minutes format). The selected time is indicated by the filled circle at the end of the clock hand. +タイムピッカーを使うことでユーザーはある一つの時間(時間:分の形式)を選択することができます。 The selected time is indicated by the filled circle at the end of the clock hand. {{"component": "modules/components/ComponentLinkHeader.js"}} ## Requirements -This component relies on the date management library of your choice. It supports [date-fns](https://date-fns.org/), [luxon](https://moment.github.io/luxon/), [dayjs](https://github.com/iamkun/dayjs), [moment](https://momentjs.com/) and any other library via a public `dateAdapter` interface. +このコンポーネントはあなたが選択した日付管理ライブラリに依存します。 [date-fns](https://date-fns.org/)、 [luxon](https://moment.github.io/luxon/)、 [dayjs](https://github.com/iamkun/dayjs)、 [moment](https://momentjs.com/) とパブリックな `dateAdapter` インターフェイスを持っている他のライブラリをサポートしています。 -Please install any of these libraries and set up the right date engine by wrapping your root (or the highest level you wish the pickers to be available) with `LocalizationProvider`: +これらのライブラリのうちいずれかをインストールし、ルート(またはピッカーを使用できるようにする最高レベル)を`LocalizationProvider`でラップして、適切な日付エンジンを設定してください。 ```jsx -// or @material-ui/lab/Adapter{DayJS,Luxon,Moment} or any valid date-io adapter +// または @material-ui/lab/Adapter{DayJS,Luxon,Moment} や任意の有効な date-io アダプター import AdapterDateFns from '@material-ui/lab/AdapterDateFns'; import LocalizationProvider from '@material-ui/lab/LocalizationProvider'; @@ -32,43 +32,55 @@ function App() { } ``` -## Basic usage +## 基本的な用法 -The time picker will automatically adjust to the locale's time setting, i.e. the 12-hour or 24-hour format. This can be controlled with `ampm` prop. +The date picker is rendered as a modal dialog on mobile, and a textbox with a popup on desktop. {{"demo": "pages/components/time-picker/BasicTimePicker.js"}} -## Localization +## static モード -Use `LocalizationProvider` to change the date-engine locale that is used to render the time picker. Note that `am/pm` setting is switched automatically: +It's possible to render any time picker inline. This will enable building custom popover/modal containers. -{{"demo": "pages/components/time-picker/LocalizedTimePicker.js"}} +{{"demo": "pages/components/time-picker/StaticTimePickerDemo.js", "bg": true}} -## Responsiveness +## レスポンシブ対応 The time picker component is designed and optimized for the device it runs on. -- The "Mobile" version works best for touch devices and small screens. -- The "Desktop" version works best for mouse devices and large screens. +- The `MobileTimePicker` component works best for touch devices and small screens. +- The `DesktopTimePicker` component works best for mouse devices and large screens. -By default, the `TimePicker` component uses a `@media (pointer: fine)` media query to determine which version to use. This can be customized with the `desktopModeMediaQuery` prop. +By default, the `TimePicker` component renders the desktop version if the media query [`@media (pointer: fine)`](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/pointer) matches. これは `desktopModeMediaQuery` プロパティでカスタマイズできます。 {{"demo": "pages/components/time-picker/ResponsiveTimePickers.js"}} -## Time validation +## Form props -{{"demo": "pages/components/time-picker/TimeValidationTimePicker.js"}} +The time picker component can be disabled or read-only. + +{{"demo": "pages/components/time-picker/FormPropsTimePickers.js"}} -## Static mode +## Localization -It's possible to render any picker inline. This will enable building custom popover/modal containers. +Use `LocalizationProvider` to change the date-engine locale that is used to render the time picker. The time picker will automatically adjust to the locale's time setting, i.e. the 12-hour or 24-hour format. This can be controlled with `ampm` prop. -{{"demo": "pages/components/time-picker/StaticTimePickerDemo.js", "bg": true}} +{{"demo": "pages/components/time-picker/LocalizedTimePicker.js"}} + +## Time validation + +{{"demo": "pages/components/time-picker/TimeValidationTimePicker.js"}} ## Landscape {{"demo": "pages/components/time-picker/StaticTimePickerLandscape.js", "bg": true}} +## サブコンポーネント + +Some lower-level sub-components (`ClockPicker`) are also exported. これらはラッパーまたは外側ロジック(マスクされた入力、日付値の解析や検証など)なしでレンダリングされます。 + +{{"demo": "pages/components/time-picker/SubComponentsTimePickers.js"}} + ## Seconds The seconds input can be used for selection of a precise time point. diff --git a/docs/src/pages/components/time-picker/time-picker-pt.md b/docs/src/pages/components/time-picker/time-picker-pt.md index 2c9ea22b76c458..b7ac8e42863f5c 100644 --- a/docs/src/pages/components/time-picker/time-picker-pt.md +++ b/docs/src/pages/components/time-picker/time-picker-pt.md @@ -1,6 +1,6 @@ --- title: Componente React Seletor de hora -components: TimePicker +components: DesktopTimePicker, MobileTimePicker, StaticTimePicker, TimePicker, ClockPicker githubLabel: 'component: TimePicker' packageName: '@material-ui/lab' materialDesign: https://material.io/components/time-pickers @@ -34,41 +34,53 @@ function App() { ## Utilização Básica -O seletor de hora ajustará automaticamente à configuração de horário da localidade, ou seja, ao formato 12 horas ou 24 horas. Isso pode ser controlado com a propriedade `ampm`. +The date picker is rendered as a modal dialog on mobile, and a textbox with a popup on desktop. {{"demo": "pages/components/time-picker/BasicTimePicker.js"}} -## Localização +## Modo estático -Use `LocalizationProvider` para alterar a date-engine de localização que é usada para renderizar o seletor de hora. Observe que a configuração `am/pm` é trocada automaticamente: +It's possible to render any time picker inline. Isto permitirá construir contêineres customizados de popover/modal. -{{"demo": "pages/components/time-picker/LocalizedTimePicker.js"}} +{{"demo": "pages/components/time-picker/StaticTimePickerDemo.js", "bg": true}} ## Responsividade O componente seletor de hora é projetado e otimizado para o dispositivo em que ele é executado. -- A versão "móvel" funciona melhor para dispositivos de toque e telas pequenas. -- A versão "desktop" funciona melhor para dispositivos com mouse e telas grandes. +- The `MobileTimePicker` component works best for touch devices and small screens. +- The `DesktopTimePicker` component works best for mouse devices and large screens. -Por padrão, o componente `TimePicker` usa uma consulta de mídia `@media (pointer: fine)` para determinar qual versão usar. Isto pode ser customizado com a propriedade `desktopModeMediaQuery`. +By default, the `TimePicker` component renders the desktop version if the media query [`@media (pointer: fine)`](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/pointer) matches. Isto pode ser customizado com a propriedade `desktopModeMediaQuery`. {{"demo": "pages/components/time-picker/ResponsiveTimePickers.js"}} -## Validação de hora +## Propriedades de formulário -{{"demo": "pages/components/time-picker/TimeValidationTimePicker.js"}} +The time picker component can be disabled or read-only. -## Modo estático +{{"demo": "pages/components/time-picker/FormPropsTimePickers.js"}} -É possível renderizar qualquer seletor em linha. Isto permitirá construir contêineres customizados de popover/modal. +## Localização -{{"demo": "pages/components/time-picker/StaticTimePickerDemo.js", "bg": true}} +Use `LocalizationProvider` para alterar a date-engine de localização que é usada para renderizar o seletor de hora. O seletor de hora ajustará automaticamente à configuração de horário da localidade, ou seja, ao formato 12 horas ou 24 horas. Isso pode ser controlado com a propriedade `ampm`. + +{{"demo": "pages/components/time-picker/LocalizedTimePicker.js"}} + +## Validação de hora + +{{"demo": "pages/components/time-picker/TimeValidationTimePicker.js"}} ## Paisagem {{"demo": "pages/components/time-picker/StaticTimePickerLandscape.js", "bg": true}} +## Subcomponentes + +Some lower-level sub-components (`ClockPicker`) are also exported. Estes são renderizados sem estar encapsulado ou lógica exterior (campo com mascara, valores de data e validação, etc.). + +{{"demo": "pages/components/time-picker/SubComponentsTimePickers.js"}} + ## Segundos O campo de segundos pode ser usado para seleção de um ponto de tempo exato. diff --git a/docs/src/pages/components/time-picker/time-picker-ru.md b/docs/src/pages/components/time-picker/time-picker-ru.md index d358e429903993..cab2af547a4433 100644 --- a/docs/src/pages/components/time-picker/time-picker-ru.md +++ b/docs/src/pages/components/time-picker/time-picker-ru.md @@ -1,6 +1,6 @@ --- title: React Time Picker component -components: TimePicker +components: DesktopTimePicker, MobileTimePicker, StaticTimePicker, TimePicker, ClockPicker githubLabel: 'component: TimePicker' packageName: '@material-ui/lab' materialDesign: https://material.io/components/time-pickers @@ -16,9 +16,9 @@ Time pickers allow the user to select a single time (in the hours:minutes format ## Requirements -This component relies on the date management library of your choice. It supports [date-fns](https://date-fns.org/), [luxon](https://moment.github.io/luxon/), [dayjs](https://github.com/iamkun/dayjs), [moment](https://momentjs.com/) and any other library via a public `dateAdapter` interface. +Этот компонент опирается на выбранную Вами библиотеку управления датами. Поддерживает [date-fns](https://date-fns.org/), [luxon](https://moment.github.io/luxon/), [dayjs](https://github.com/iamkun/dayjs), [moment](https://momentjs.com/) и любую другую библиотеку с помощью публичного `dateAdapter` интерфейса. -Please install any of these libraries and set up the right date engine by wrapping your root (or the highest level you wish the pickers to be available) with `LocalizationProvider`: +Пожалуйста, установите любую из этих библиотек и настройте правильно механизм даты, обернув root (или самый высокий уровень, на котором вы хотели бы иметь доступ к pickers) с `LocalizationProvider`: ```jsx // or @material-ui/lab/Adapter{DayJS,Luxon,Moment} or any valid date-io adapter @@ -32,43 +32,55 @@ function App() { } ``` -## Basic usage +## Basic Usage (Основное использование) -The time picker will automatically adjust to the locale's time setting, i.e. the 12-hour or 24-hour format. This can be controlled with `ampm` prop. +The date picker is rendered as a modal dialog on mobile, and a textbox with a popup on desktop. {{"demo": "pages/components/time-picker/BasicTimePicker.js"}} -## Локализация +## Static mode (Статический режим) -Use `LocalizationProvider` to change the date-engine locale that is used to render the time picker. Note that `am/pm` setting is switched automatically: +It's possible to render any time picker inline. This will enable building custom popover/modal containers. -{{"demo": "pages/components/time-picker/LocalizedTimePicker.js"}} +{{"demo": "pages/components/time-picker/StaticTimePickerDemo.js", "bg": true}} ## Responsiveness The time picker component is designed and optimized for the device it runs on. -- The "Mobile" version works best for touch devices and small screens. -- The "Desktop" version works best for mouse devices and large screens. +- The `MobileTimePicker` component works best for touch devices and small screens. +- The `DesktopTimePicker` component works best for mouse devices and large screens. -By default, the `TimePicker` component uses a `@media (pointer: fine)` media query to determine which version to use. This can be customized with the `desktopModeMediaQuery` prop. +By default, the `TimePicker` component renders the desktop version if the media query [`@media (pointer: fine)`](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/pointer) matches. Его можно настроить с помощью `DesktopModeMediaQuery`. {{"demo": "pages/components/time-picker/ResponsiveTimePickers.js"}} -## Time validation +## Form props -{{"demo": "pages/components/time-picker/TimeValidationTimePicker.js"}} +The time picker component can be disabled or read-only. + +{{"demo": "pages/components/time-picker/FormPropsTimePickers.js"}} -## Static mode +## Локализация -It's possible to render any picker inline. This will enable building custom popover/modal containers. +Use `LocalizationProvider` to change the date-engine locale that is used to render the time picker. The time picker will automatically adjust to the locale's time setting, i.e. the 12-hour or 24-hour format. This can be controlled with `ampm` prop. -{{"demo": "pages/components/time-picker/StaticTimePickerDemo.js", "bg": true}} +{{"demo": "pages/components/time-picker/LocalizedTimePicker.js"}} + +## Time validation + +{{"demo": "pages/components/time-picker/TimeValidationTimePicker.js"}} ## Landscape {{"demo": "pages/components/time-picker/StaticTimePickerLandscape.js", "bg": true}} +## Sub-components (Подкомпоненты) + +Some lower-level sub-components (`ClockPicker`) are also exported. Они рендерятся без обёртки или внешней логики (masked input, date values parsing, validation, и т.д.). + +{{"demo": "pages/components/time-picker/SubComponentsTimePickers.js"}} + ## Seconds The seconds input can be used for selection of a precise time point. diff --git a/docs/src/pages/components/time-picker/time-picker-zh.md b/docs/src/pages/components/time-picker/time-picker-zh.md index 760f450bf9ed22..f8c6251f48cce7 100644 --- a/docs/src/pages/components/time-picker/time-picker-zh.md +++ b/docs/src/pages/components/time-picker/time-picker-zh.md @@ -1,6 +1,6 @@ --- title: React Time Picker(时间选择器)组件 -components: TimePicker +components: DesktopTimePicker, MobileTimePicker, StaticTimePicker, TimePicker, ClockPicker githubLabel: 'component: TimePicker' packageName: '@material-ui/lab' materialDesign: https://material.io/components/time-pickers @@ -8,9 +8,9 @@ materialDesign: https://material.io/components/time-pickers # Time Picker 时间选择器 -<p class="description">时间选择器允许用户选择单一的时间。</p> +<p class="description">时间选择器允许用户选择一个单独的时间。</p> -时间选择器允许用户选择一个单一的时间(小时:分钟格式)。 选定的时间由时针末端的填充圆圈表示。 +时间选择器允许用户选择一个单一的时间(格式为:小时:分钟)。 选定的时间由时针末端的填充圆圈表示。 {{"component": "modules/components/ComponentLinkHeader.js"}} @@ -34,41 +34,53 @@ function App() { ## 基本用法 -时间选择器会自动调整到当地的时间设置,即 12 小时或 24 小时格式。 这可以通过 `ampm` 属性来控制。 +The date picker is rendered as a modal dialog on mobile, and a textbox with a popup on desktop. {{"demo": "pages/components/time-picker/BasicTimePicker.js"}} -## Localization 本地化 +## 静态模式 -使用 `LocalizationProvider` 来改变用于渲染时间选择器的数据引擎的本地化。 请注意, `am/pm` 的设置是自动切换的: +It's possible to render any time picker inline. 这将启用自定义弹出提示/模态框的容器。 -{{"demo": "pages/components/time-picker/LocalizedTimePicker.js"}} +{{"demo": "pages/components/time-picker/StaticTimePickerDemo.js", "bg": true}} ## 响应式 时间选择器组件是为它运行的设备设计和优化。 -- “手机(Mobile)”版本最适合触控设备和小型屏幕。 -- “桌面(Mobile)”版本最适合鼠标设备和大型屏幕。 +- The `MobileTimePicker` component works best for touch devices and small screens. +- The `DesktopTimePicker` component works best for mouse devices and large screens. -默认情况下, `TimePicker` 组件使用 `@media (pointer: fine)` 媒体查询来确定使用哪个版本。 你也可以使用 `desktopModeMediaQuery` 属性来自定义它。 +By default, the `TimePicker` component renders the desktop version if the media query [`@media (pointer: fine)`](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/pointer) matches. 你也可以使用 `desktopModeMediaQuery` 属性来自定义它。 {{"demo": "pages/components/time-picker/ResponsiveTimePickers.js"}} -## 验证时间 +## Form props 表单的属性 -{{"demo": "pages/components/time-picker/TimeValidationTimePicker.js"}} +The time picker component can be disabled or read-only. -## 静态模式 +{{"demo": "pages/components/time-picker/FormPropsTimePickers.js"}} -可以将任何选择器内嵌渲染。 这将启用自定义弹出提示/模态框的容器。 +## Localization 本地化 -{{"demo": "pages/components/time-picker/StaticTimePickerDemo.js", "bg": true}} +使用 `LocalizationProvider` 来改变用于渲染时间选择器的数据引擎的本地化。 时间选择器会自动调整为当地时间,即 12 小时或 24 小时格式。 这可以通过 `ampm` 属性来控制。 + +{{"demo": "pages/components/time-picker/LocalizedTimePicker.js"}} + +## 验证时间 + +{{"demo": "pages/components/time-picker/TimeValidationTimePicker.js"}} ## 横屏 {{"demo": "pages/components/time-picker/StaticTimePickerLandscape.js", "bg": true}} +## 子组件 + +Some lower-level sub-components (`ClockPicker`) are also exported. 这些都是在没有包装器或外部逻辑(屏蔽输入、日期值解析和验证等)的情况下渲染的。 + +{{"demo": "pages/components/time-picker/SubComponentsTimePickers.js"}} + ## 秒 秒的输入可以用来选择一个精确的时间点。 diff --git a/docs/src/pages/components/timeline/ColorsTimeline.js b/docs/src/pages/components/timeline/ColorsTimeline.js index d0a3df04426834..5728427050c66f 100644 --- a/docs/src/pages/components/timeline/ColorsTimeline.js +++ b/docs/src/pages/components/timeline/ColorsTimeline.js @@ -9,32 +9,18 @@ import TimelineDot from '@material-ui/lab/TimelineDot'; export default function ColorsTimeline() { return ( <Timeline position="alternate"> - <TimelineItem> - <TimelineSeparator> - <TimelineDot /> - <TimelineConnector /> - </TimelineSeparator> - <TimelineContent>Eat</TimelineContent> - </TimelineItem> - <TimelineItem> - <TimelineSeparator> - <TimelineDot color="primary" /> - <TimelineConnector /> - </TimelineSeparator> - <TimelineContent>Code</TimelineContent> - </TimelineItem> <TimelineItem> <TimelineSeparator> <TimelineDot color="secondary" /> <TimelineConnector /> </TimelineSeparator> - <TimelineContent>Sleep</TimelineContent> + <TimelineContent>Secondary</TimelineContent> </TimelineItem> <TimelineItem> <TimelineSeparator> - <TimelineDot /> + <TimelineDot color="success" /> </TimelineSeparator> - <TimelineContent>Repeat</TimelineContent> + <TimelineContent>Success</TimelineContent> </TimelineItem> </Timeline> ); diff --git a/docs/src/pages/components/timeline/ColorsTimeline.tsx b/docs/src/pages/components/timeline/ColorsTimeline.tsx index d0a3df04426834..5728427050c66f 100644 --- a/docs/src/pages/components/timeline/ColorsTimeline.tsx +++ b/docs/src/pages/components/timeline/ColorsTimeline.tsx @@ -9,32 +9,18 @@ import TimelineDot from '@material-ui/lab/TimelineDot'; export default function ColorsTimeline() { return ( <Timeline position="alternate"> - <TimelineItem> - <TimelineSeparator> - <TimelineDot /> - <TimelineConnector /> - </TimelineSeparator> - <TimelineContent>Eat</TimelineContent> - </TimelineItem> - <TimelineItem> - <TimelineSeparator> - <TimelineDot color="primary" /> - <TimelineConnector /> - </TimelineSeparator> - <TimelineContent>Code</TimelineContent> - </TimelineItem> <TimelineItem> <TimelineSeparator> <TimelineDot color="secondary" /> <TimelineConnector /> </TimelineSeparator> - <TimelineContent>Sleep</TimelineContent> + <TimelineContent>Secondary</TimelineContent> </TimelineItem> <TimelineItem> <TimelineSeparator> - <TimelineDot /> + <TimelineDot color="success" /> </TimelineSeparator> - <TimelineContent>Repeat</TimelineContent> + <TimelineContent>Success</TimelineContent> </TimelineItem> </Timeline> ); diff --git a/docs/src/pages/components/timeline/timeline-de.md b/docs/src/pages/components/timeline/timeline-de.md index ee13c35b29f22a..81256e2a14c3b0 100644 --- a/docs/src/pages/components/timeline/timeline-de.md +++ b/docs/src/pages/components/timeline/timeline-de.md @@ -19,11 +19,11 @@ A basic timeline showing list of events. {{"demo": "pages/components/timeline/BasicTimeline.js"}} -## Right-aligned timeline +## Left-positioned timeline -The timeline can be positioned on the right side of the events. +The main content of the timeline can be positioned on the left side relative to the time axis. -{{"demo": "pages/components/timeline/RightAlignedTimeline.js"}} +{{"demo": "pages/components/timeline/LeftPositionedTimeline.js"}} ## Alternating timeline diff --git a/docs/src/pages/components/timeline/timeline-es.md b/docs/src/pages/components/timeline/timeline-es.md index e5bb95f701dcac..95c0cd8ae4256e 100644 --- a/docs/src/pages/components/timeline/timeline-es.md +++ b/docs/src/pages/components/timeline/timeline-es.md @@ -19,11 +19,11 @@ Una línea de tiempo básica que muestra una lista de eventos. {{"demo": "pages/components/timeline/BasicTimeline.js"}} -## Right-aligned timeline +## Left-positioned timeline -La línea de tiempo puede posicionarse en el lado derecho de los eventos. +The main content of the timeline can be positioned on the left side relative to the time axis. -{{"demo": "pages/components/timeline/RightAlignedTimeline.js"}} +{{"demo": "pages/components/timeline/LeftPositionedTimeline.js"}} ## Línea de tiempo alternativa diff --git a/docs/src/pages/components/timeline/timeline-fr.md b/docs/src/pages/components/timeline/timeline-fr.md index e1cdab87a3d885..681cff3132b41b 100644 --- a/docs/src/pages/components/timeline/timeline-fr.md +++ b/docs/src/pages/components/timeline/timeline-fr.md @@ -1,5 +1,5 @@ --- -title: React Timeline component +title: Composant React Timeline components: Timeline, TimelineItem, TimelineSeparator, TimelineDot, TimelineConnector, TimelineContent, TimelineOppositeContent githubLabel: 'component: Timeline' packageName: '@material-ui/lab' @@ -9,7 +9,7 @@ packageName: '@material-ui/lab' <p class="description">The timeline displays a list of events in chronological order.</p> -**Remarque :** Ce composant n'est pas documenté dans les [consignes de Material Design](https://material.io/), mais Material-UI le supporte. +**Remarque :** Ce composant n'est pas documenté dans les [Directives de conception des matériaux](https://material.io/), mais Material-UI le supporte. {{"component": "modules/components/ComponentLinkHeader.js"}} diff --git a/docs/src/pages/components/timeline/timeline-ja.md b/docs/src/pages/components/timeline/timeline-ja.md index bea92037ead790..0358ee9529b235 100644 --- a/docs/src/pages/components/timeline/timeline-ja.md +++ b/docs/src/pages/components/timeline/timeline-ja.md @@ -19,11 +19,11 @@ A basic timeline showing list of events. {{"demo": "pages/components/timeline/BasicTimeline.js"}} -## Right-aligned timeline +## Left-positioned timeline -The timeline can be positioned on the right side of the events. +The main content of the timeline can be positioned on the left side relative to the time axis. -{{"demo": "pages/components/timeline/RightAlignedTimeline.js"}} +{{"demo": "pages/components/timeline/LeftPositionedTimeline.js"}} ## Alternating timeline @@ -49,6 +49,6 @@ The timeline can display content on opposite sides. ## Customized timeline -コンポーネントのカスタマイズ例を次に示します。 詳細については、 [overrides documentation page](/customization/how-to-customize/)を参照してください。 +コンポーネントのカスタマイズ例を次に示します。 詳細については、 [こちら](/customization/how-to-customize/)を参照してください。 {{"demo": "pages/components/timeline/CustomizedTimeline.js"}} diff --git a/docs/src/pages/components/timeline/timeline-pt.md b/docs/src/pages/components/timeline/timeline-pt.md index cea03ed0116a0b..f470be4fab13c7 100644 --- a/docs/src/pages/components/timeline/timeline-pt.md +++ b/docs/src/pages/components/timeline/timeline-pt.md @@ -19,11 +19,11 @@ Uma linha do tempo básica mostrando a lista de eventos. {{"demo": "pages/components/timeline/BasicTimeline.js"}} -## Linha do tempo alinhada à direita +## Left-positioned timeline -A linha do tempo pode ser posicionada no lado direito dos eventos. +The main content of the timeline can be positioned on the left side relative to the time axis. -{{"demo": "pages/components/timeline/RightAlignedTimeline.js"}} +{{"demo": "pages/components/timeline/LeftPositionedTimeline.js"}} ## Linha do tempo alternada diff --git a/docs/src/pages/components/timeline/timeline-ru.md b/docs/src/pages/components/timeline/timeline-ru.md index 4bd38f57a29718..f60f720ea85590 100644 --- a/docs/src/pages/components/timeline/timeline-ru.md +++ b/docs/src/pages/components/timeline/timeline-ru.md @@ -19,11 +19,11 @@ A basic timeline showing list of events. {{"demo": "pages/components/timeline/BasicTimeline.js"}} -## Right-aligned timeline +## Left-positioned timeline -The timeline can be positioned on the right side of the events. +The main content of the timeline can be positioned on the left side relative to the time axis. -{{"demo": "pages/components/timeline/RightAlignedTimeline.js"}} +{{"demo": "pages/components/timeline/LeftPositionedTimeline.js"}} ## Alternating timeline @@ -49,6 +49,6 @@ The timeline can display content on opposite sides. ## Customized timeline -Ниже находится пример кастомизации компонента. You can learn more about this in the [overrides documentation page](/customization/how-to-customize/). +Ниже находится пример кастомизации компонента. Вы можете узнать об этом больше [в документации по переопределению свойств](/customization/how-to-customize/). {{"demo": "pages/components/timeline/CustomizedTimeline.js"}} diff --git a/docs/src/pages/components/timeline/timeline-zh.md b/docs/src/pages/components/timeline/timeline-zh.md index 383f951ac65e64..20ef172dd37e52 100644 --- a/docs/src/pages/components/timeline/timeline-zh.md +++ b/docs/src/pages/components/timeline/timeline-zh.md @@ -19,11 +19,11 @@ packageName: '@material-ui/lab' {{"demo": "pages/components/timeline/BasicTimeline.js"}} -## 向右对齐的时间线 +## Left-positioned timeline -您也可以将时间轴放置在事件的右侧。 +The main content of the timeline can be positioned on the left side relative to the time axis. -{{"demo": "pages/components/timeline/RightAlignedTimeline.js"}} +{{"demo": "pages/components/timeline/LeftPositionedTimeline.js"}} ## 交替的时间轴 diff --git a/docs/src/pages/components/timeline/timeline.md b/docs/src/pages/components/timeline/timeline.md index 8d04110834b2f7..53342117c139b4 100644 --- a/docs/src/pages/components/timeline/timeline.md +++ b/docs/src/pages/components/timeline/timeline.md @@ -33,7 +33,7 @@ The timeline can display the events on alternating sides. ## Color -The `TimelineDot` can appear in different colors. +The `TimelineDot` can appear in different colors from theme palette. {{"demo": "pages/components/timeline/ColorsTimeline.js"}} diff --git a/docs/src/pages/components/toggle-button/toggle-button-de.md b/docs/src/pages/components/toggle-button/toggle-button-de.md index 4ba7a316e4a826..bafa9c44121a59 100644 --- a/docs/src/pages/components/toggle-button/toggle-button-de.md +++ b/docs/src/pages/components/toggle-button/toggle-button-de.md @@ -17,7 +17,7 @@ Um Gruppen von verwandten [Schaltern](https://material.io/components/buttons#tog With exclusive selection, selecting one option deselects any other. -In this example text justification toggle buttons present options for left, center, right, and fully justified text (disabled), with only one item available for selection at a time. +In this example, text justification toggle buttons present options for left, center, right, and fully justified text (disabled), with only one item available for selection at a time. {{"demo": "pages/components/toggle-button/ToggleButtons.js"}} @@ -27,12 +27,16 @@ Multiple selection allows for logically-grouped options, like bold, italic, and {{"demo": "pages/components/toggle-button/ToggleButtonsMultiple.js"}} -## Größen +## Size -Fancy larger or smaller buttons? Verwende die Eigenschaft `size`. +For larger or smaller buttons, use the `size` prop. {{"demo": "pages/components/toggle-button/ToggleButtonSizes.js"}} +## Farbe (Color) + +{{"demo": "pages/components/toggle-button/ColorToggleButton.js"}} + ## Vertical buttons The buttons can be stacked vertically with the `orientation` prop set to "vertical". diff --git a/docs/src/pages/components/toggle-button/toggle-button-es.md b/docs/src/pages/components/toggle-button/toggle-button-es.md index 25739525b4d34e..5877a81d7ebddb 100644 --- a/docs/src/pages/components/toggle-button/toggle-button-es.md +++ b/docs/src/pages/components/toggle-button/toggle-button-es.md @@ -17,7 +17,7 @@ To emphasize groups of related [Toggle buttons](https://material.io/components/b With exclusive selection, selecting one option deselects any other. -In this example text justification toggle buttons present options for left, center, right, and fully justified text (disabled), with only one item available for selection at a time. +In this example, text justification toggle buttons present options for left, center, right, and fully justified text (disabled), with only one item available for selection at a time. {{"demo": "pages/components/toggle-button/ToggleButtons.js"}} @@ -27,12 +27,16 @@ Multiple selection allows for logically-grouped options, like bold, italic, and {{"demo": "pages/components/toggle-button/ToggleButtonsMultiple.js"}} -## Tamaños +## Tamaño -Botones más grandes o más pequeños? Usa la propiedad `size`. +For larger or smaller buttons, use the `size` prop. {{"demo": "pages/components/toggle-button/ToggleButtonSizes.js"}} +## Color + +{{"demo": "pages/components/toggle-button/ColorToggleButton.js"}} + ## Vertical buttons The buttons can be stacked vertically with the `orientation` prop set to "vertical". diff --git a/docs/src/pages/components/toggle-button/toggle-button-fr.md b/docs/src/pages/components/toggle-button/toggle-button-fr.md index abd17d92177135..dcdb6fcc1fa416 100644 --- a/docs/src/pages/components/toggle-button/toggle-button-fr.md +++ b/docs/src/pages/components/toggle-button/toggle-button-fr.md @@ -27,12 +27,16 @@ Multiple selection allows for logically-grouped options, like bold, italic, and {{"demo": "pages/components/toggle-button/ToggleButtonsMultiple.js"}} -## Tailles +## Size Fancy larger or smaller buttons? Use the `size` property. {{"demo": "pages/components/toggle-button/ToggleButtonSizes.js"}} +## Couleur + +{{"demo": "pages/components/toggle-button/ColorToggleButton.js"}} + ## Vertical buttons The buttons can be stacked vertically with the `orientation` prop set to "vertical". diff --git a/docs/src/pages/components/toggle-button/toggle-button-ja.md b/docs/src/pages/components/toggle-button/toggle-button-ja.md index f2d21eeee49ac6..0a52fd1765e1dd 100644 --- a/docs/src/pages/components/toggle-button/toggle-button-ja.md +++ b/docs/src/pages/components/toggle-button/toggle-button-ja.md @@ -13,35 +13,39 @@ materialDesign: 'https://material.io/components/buttons#toggle-button' {{"component": "modules/components/ComponentLinkHeader.js"}} -## Exclusive selection +## 排他的な選択 -With exclusive selection, selecting one option deselects any other. +exclusiveを使うと、いずれかのオプションを選択したとき、他のオプションの選択を解除します。 -In this example text justification toggle buttons present options for left, center, right, and fully justified text (disabled), with only one item available for selection at a time. +In this example, text justification toggle buttons present options for left, center, right, and fully justified text (disabled), with only one item available for selection at a time. {{"demo": "pages/components/toggle-button/ToggleButtons.js"}} -## Multiple selection +## 複数選択 -Multiple selection allows for logically-grouped options, like bold, italic, and underline, to have multiple options selected. +太字、斜体、下線などの論理的にグループ化された選択肢を複数選択することができます。 {{"demo": "pages/components/toggle-button/ToggleButtonsMultiple.js"}} -## サイズ +## Size -大きなボタンと小さなボタンがありますか? `size`プロパティを使用します。 +For larger or smaller buttons, use the `size` prop. {{"demo": "pages/components/toggle-button/ToggleButtonSizes.js"}} -## Vertical buttons +## カラー -The buttons can be stacked vertically with the `orientation` prop set to "vertical". +{{"demo": "pages/components/toggle-button/ColorToggleButton.js"}} + +## 垂直方向のボタン + +`orientation` プロパティを「vertical」に設定することで、ボタンを垂直に積み上げることができます。 {{"demo": "pages/components/toggle-button/VerticalToggleButtons.js"}} -## Enforce value set +## 値がセットされていることを強制する -If you want to enforce that at least one button must be active, you can adapt your handleChange function. +少なくとも1つのボタンが有効でなければならないことを強制する場合は、変更をハンドルする関数を作って適応できます。 ```jsx const handleFormat = (event, newFormats) => { @@ -63,9 +67,9 @@ const handleAlignment = (event, newAlignment) => { {{"demo": "pages/components/toggle-button/StandaloneToggleButton.js"}} -## Customized toggle button +## カスタマイズされたトグルボタン -コンポーネントのカスタマイズ例を次に示します。 詳細については、 [overrides documentation page](/customization/how-to-customize/)を参照してください。 +コンポーネントのカスタマイズ例を次に示します。 詳細については、 [こちら](/customization/how-to-customize/)を参照してください。 {{"demo": "pages/components/toggle-button/CustomizedDividers.js", "bg": true}} @@ -73,9 +77,9 @@ const handleAlignment = (event, newAlignment) => { ### ARIA -- ToggleButtonGroup has `role="group"`. You should provide an accessible label with `aria-label="label"`, `aria-labelledby="id"` or `<label>`. -- ToggleButton sets `aria-pressed="<bool>"` according to the button state. You should label each button with `aria-label`. +- ToggleButtonGroup には `role="group"` が付与されています。 `aria-label="label"`, `aria-labelledby="id"` または `<label>` でアクセシビリティのためにラベルを指定する必要があります。 +- ToggleButton は、ボタンの状態によって `aria-pressed="<bool>"` を設定します。 各ボタンに `aria-label` を付けてください。 ### Keyboard -At present, toggle buttons are in DOM order. Navigate between them with the tab key. The button behavior follows standard keyboard semantics. +現時点では、切り替えボタンは DOM の順序になっています。 タブキーでそれらの間を移動します。 ボタンの動作は標準的なキーボードセマンティクスに従います。 diff --git a/docs/src/pages/components/toggle-button/toggle-button-pt.md b/docs/src/pages/components/toggle-button/toggle-button-pt.md index d230d0563b25db..96b4d644a75156 100644 --- a/docs/src/pages/components/toggle-button/toggle-button-pt.md +++ b/docs/src/pages/components/toggle-button/toggle-button-pt.md @@ -17,7 +17,7 @@ Para enfatizar grupos de [botões de alternância](https://material.io/component Com seleção exclusiva, selecionar uma opção desseleciona qualquer outra. -Neste exemplo de justificativa de texto, temos opções de alternar os botões para a esquerda, centralizada, direita e texto totalmente justificado (desativado), com apenas um item disponível para seleção de cada vez. +In this example, text justification toggle buttons present options for left, center, right, and fully justified text (disabled), with only one item available for selection at a time. {{"demo": "pages/components/toggle-button/ToggleButtons.js"}} @@ -27,12 +27,16 @@ Múltipla seleção permite que opções logicamente agrupadas, como negrito, it {{"demo": "pages/components/toggle-button/ToggleButtonsMultiple.js"}} -## Tamanhos +## Tamanho -Gosta de botões maiores ou menores? Use a propriedade `size`. +For larger or smaller buttons, use the `size` prop. {{"demo": "pages/components/toggle-button/ToggleButtonSizes.js"}} +## Cor + +{{"demo": "pages/components/toggle-button/ColorToggleButton.js"}} + ## Botões verticais Os botões podem ser empilhados verticalmente com a propriedade `orientation` definida para "vertical". diff --git a/docs/src/pages/components/toggle-button/toggle-button-ru.md b/docs/src/pages/components/toggle-button/toggle-button-ru.md index dcb218ab87886d..81d3c644c7d930 100644 --- a/docs/src/pages/components/toggle-button/toggle-button-ru.md +++ b/docs/src/pages/components/toggle-button/toggle-button-ru.md @@ -17,7 +17,7 @@ To emphasize groups of related [Toggle buttons](https://material.io/components/b С исключительным выделением выбор одной опции снимает выделение с остальных. -В этом примере кнопки переключения представляют варианты выравнивания текста left, center, right и fully justified text (отключено), с возможностью выбора лишь одного элемента. +In this example, text justification toggle buttons present options for left, center, right, and fully justified text (disabled), with only one item available for selection at a time. {{"demo": "pages/components/toggle-button/ToggleButtons.js"}} @@ -27,12 +27,16 @@ To emphasize groups of related [Toggle buttons](https://material.io/components/b {{"demo": "pages/components/toggle-button/ToggleButtonsMultiple.js"}} -## Размеры +## Size -Fancy larger or smaller buttons? Use the `size` property. +For larger or smaller buttons, use the `size` prop. {{"demo": "pages/components/toggle-button/ToggleButtonSizes.js"}} +## Цвет + +{{"demo": "pages/components/toggle-button/ColorToggleButton.js"}} + ## Vertical buttons Кнопки можно выстроить вертикально задав свойству `orientation` значение "vertical". @@ -65,7 +69,7 @@ const handleAlignment = (event, newAlignment) => { ## Customized toggle button -Ниже находится пример кастомизации компонента. You can learn more about this in the [overrides documentation page](/customization/how-to-customize/). +Ниже находится пример кастомизации компонента. Вы можете узнать об этом больше [в документации по переопределению свойств](/customization/how-to-customize/). {{"demo": "pages/components/toggle-button/CustomizedDividers.js", "bg": true}} diff --git a/docs/src/pages/components/toggle-button/toggle-button-zh.md b/docs/src/pages/components/toggle-button/toggle-button-zh.md index dbe823796788fe..9667e8212c6272 100644 --- a/docs/src/pages/components/toggle-button/toggle-button-zh.md +++ b/docs/src/pages/components/toggle-button/toggle-button-zh.md @@ -17,7 +17,7 @@ materialDesign: 'https://material.io/components/buttons#toggle-button' 在唯一的选择中,选择一个选项就会取消其他的选择状态。 -在这个例子中,文本对齐切换按钮渲染了左、中、右和完全对齐文本(禁用)的选项,每次只有一个项目可供选择。 +In this example, text justification toggle buttons present options for left, center, right, and fully justified text (disabled), with only one item available for selection at a time. {{"demo": "pages/components/toggle-button/ToggleButtons.js"}} @@ -27,12 +27,16 @@ materialDesign: 'https://material.io/components/buttons#toggle-button' {{"demo": "pages/components/toggle-button/ToggleButtonsMultiple.js"}} -## 尺寸 +## Size 大小 -您想要一个大一点或者小一点的按钮吗? 我们提供了 `size` 这个属性供您调整。 +For larger or smaller buttons, use the `size` prop. {{"demo": "pages/components/toggle-button/ToggleButtonSizes.js"}} +## Color 颜色 + +{{"demo": "pages/components/toggle-button/ColorToggleButton.js"}} + ## 垂直排列的按钮 当 `orientation` 属性设置为 "vertical" 时,按钮可以变为垂直堆叠。 diff --git a/docs/src/pages/components/tooltips/tooltips-fr.md b/docs/src/pages/components/tooltips/tooltips-fr.md index cff649515fb6bf..1e4e445eba0ccf 100644 --- a/docs/src/pages/components/tooltips/tooltips-fr.md +++ b/docs/src/pages/components/tooltips/tooltips-fr.md @@ -109,9 +109,9 @@ You can enable the tooltip to follow the cursor by setting `followCursor={true}` {{"demo": "pages/components/tooltips/FollowCursorTooltips.js"}} -## Virtual element +## Élément virtuel -In the event you need to implement a custom placement, you can use the `anchorEl` prop: The value of the `anchorEl` prop can be a reference to a fake DOM element. You need to create an object shaped like the [`VirtualElement`](https://popper.js.org/docs/v2/virtual-elements/). +In the event you need to implement a custom placement, you can use the `anchorEl` prop: The value of the `anchorEl` prop can be a reference to a fake DOM element. Vous devez créer un objet formé comme le [`VirtualElement`](https://popper.js.org/docs/v2/virtual-elements/). {{"demo": "pages/components/tooltips/AnchorElTooltips.js"}} diff --git a/docs/src/pages/components/tooltips/tooltips-ja.md b/docs/src/pages/components/tooltips/tooltips-ja.md index ed47460181a48e..839435f38333b4 100644 --- a/docs/src/pages/components/tooltips/tooltips-ja.md +++ b/docs/src/pages/components/tooltips/tooltips-ja.md @@ -14,31 +14,31 @@ waiAria: 'https://www.w3.org/TR/wai-aria-practices/#tooltip' {{"component": "modules/components/ComponentLinkHeader.js"}} -## Simple Tooltips +## 基本的なツールチップ {{"demo": "pages/components/tooltips/BasicTooltip.js"}} -## Positioned tooltips +## ツールチップの配置 -`ツールチップ` は、12 **配置** 選択肢があります。 They don't have directional arrows; instead, they rely on motion emanating from the source to convey direction. +`Tooltip` には、12の**配置**の選択肢があります。 矢印はありません。その代わりに、方向を伝達するために発生元から発生するモーションがあります。 {{"demo": "pages/components/tooltips/PositionedTooltips.js"}} -## Customized tooltips +## カスタマイズされたツールチップ -コンポーネントのカスタマイズの例を次に示します。 詳細については、 [overrides documentation page](/customization/how-to-customize/)を参照してください。 +コンポーネントのカスタマイズの例を次に示します。 詳細については、 [こちら](/customization/how-to-customize/)を参照してください。 {{"demo": "pages/components/tooltips/CustomizedTooltips.js"}} -## Arrow tooltips +## 矢印付きツールチップ -You can use the `arrow` prop to give your tooltip an arrow indicating which element it refers to. +`arrow` プロパティを使用して、ツールチップがどの要素を参照するかを示す矢印を表示することできます。 {{"demo": "pages/components/tooltips/ArrowTooltips.js"}} ## Custom child element -ツールチップは、DOMイベントリスナーをその子要素に適用する必要があります。 ツールチップは、DOMイベントリスナーをその子要素に適用する必要があります。 If the child is a custom React element, you need to make sure that it spreads its properties to the underlying DOM element. If the child is a custom React element, you need to make sure that it spreads its properties to the underlying DOM element. +ツールチップは、DOMイベントリスナーをその子要素に適用する必要があります。 If the child is a custom React element, you need to make sure that it spreads its properties to the underlying DOM element. ```jsx const MyComponent = React.forwardRef(function MyComponent(props, ref) { @@ -55,19 +55,19 @@ const MyComponent = React.forwardRef(function MyComponent(props, ref) { 同様の概念は、[wrapping components](/guides/composition/#wrapping-components)ガイドにも記載されています。 -## Triggers +## トリガー ツールチップを表示するイベントのタイプを定義できます。 {{"demo": "pages/components/tooltips/TriggersTooltips.js"}} -## Controlled tooltips +## 制御された(controlled)ツールチップ `open`, `onOpen` and `onClose` の各プロパティを使用して、ツールチップの動作を制御できます。 {{"demo": "pages/components/tooltips/ControlledTooltips.js"}} -## Variable width +## 可変幅 既定では、`Tooltip`は長いテキストを折り返して読みやすくします。 @@ -75,15 +75,15 @@ const MyComponent = React.forwardRef(function MyComponent(props, ref) { ## インタラクティブ -Tooltips are interactive by default (to pass [WCAG 2.1 success criterion 1.4.13](https://www.w3.org/TR/WCAG21/#content-on-hover-or-focus)). ツールチップをインタラクティブにすることができます。 `leaveDelay` が期限切れになる前に、ユーザーがツールチップにカーソルを合わせても閉じません。 You can disable this behavior (thus failing the success criterion which is required to reach level AA) by passing `disableInteractive`. +ツールチップはデフォルトでインタラクティブです( [WCAG 2.1 Success Criterion 1.4.13](https://www.w3.org/TR/WCAG21/#content-on-hover-or-focus) を満たすため)。 ツールチップをインタラクティブにすることができます。 `leaveDelay` が期限切れになる前に、ユーザーがツールチップにカーソルを合わせても閉じません。 `disableInteractive`を渡すことで、この動作を無効にすることができます(したがって、レベルAAに到達するために必要な基準を満たさなくなります)。 {{"demo": "pages/components/tooltips/NonInteractiveTooltips.js"}} -## Disabled elements +## 無効な(disabled)要素 -デフォルトでは無効になっている要素`<button>`はユーザーの操作をトリガーしないため、 `Tooltip`は、ホバーなどの通常のイベントでアクティブになりません。 To accommodate disabled elements, add a simple wrapper element, such as a `span`. To accommodate disabled elements, add a simple wrapper element, such as a `span`. +デフォルトでは無効になっている要素`<button>`はユーザーの操作をトリガーしないため、 `Tooltip`は、ホバーなどの通常のイベントでアクティブになりません。 無効な要素に対応するには、 `span` のような単純なラッパー要素を追加します。 -> ⚠️ In order to work with Safari, you need at least one display block or flex item below the tooltip wrapper. +> ⚠️ Safariで動作するようにするため、ツールチップラッパーの下に少なくとも1つの表示ブロックまたはフレックスアイテムが必要です。 {{"demo": "pages/components/tooltips/DisabledTooltips.js"}} @@ -103,23 +103,23 @@ Tooltips are interactive by default (to pass [WCAG 2.1 success criterion 1.4.13] {{"demo": "pages/components/tooltips/TransitionsTooltips.js"}} -## Follow cursor +## カーソルに追従させる -You can enable the tooltip to follow the cursor by setting `followCursor={true}`. +`followCursor={true}` を設定して、ツールチップがカーソルに追従するようにできます。 {{"demo": "pages/components/tooltips/FollowCursorTooltips.js"}} -## Virtual element +## 仮想Element -In the event you need to implement a custom placement, you can use the `anchorEl` prop: The value of the `anchorEl` prop can be a reference to a fake DOM element. You need to create an object shaped like the [`VirtualElement`](https://popper.js.org/docs/v2/virtual-elements/). +In the event you need to implement a custom placement, you can use the `anchorEl` prop: The value of the `anchorEl` prop can be a reference to a fake DOM element. [`VirtualElement`](https://popper.js.org/docs/v2/virtual-elements/)のようなオブジェクトを作成する必要があります。 {{"demo": "pages/components/tooltips/AnchorElTooltips.js"}} ## 表示と非表示 -ツールチップは通常、ユーザーのマウスが要素の上に移動するとすぐに表示され、ユーザーのマウスが離れるとすぐに非表示になります。 ツールチップの表示または非表示の遅延は、上記のControlled Tooltipsデモに示すように、プロパティ `enterDelay` および `leaveDelay`を使用して追加できます。 ツールチップの表示または非表示の遅延は、上記のControlled Tooltipsデモに示すように、プロパティ `enterDelay` および `leaveDelay`を使用して追加できます。 +ツールチップは通常、ユーザーのマウスが要素の上に移動するとすぐに表示され、ユーザーのマウスが離れるとすぐに非表示になります。 ツールチップの表示または非表示の遅延は、上記のControlled Tooltipsデモに示すように、プロパティ `enterDelay` および `leaveDelay`を使用して追加できます。 -モバイルでは、ユーザーが要素を長押しして1500msの遅延後に非表示になると、ツールチップが表示されます。 `disableTouchListener` プロパティでこの機能を無効にできます。 モバイルでは、ユーザーが要素を長押しして1500msの遅延後に非表示になると、ツールチップが表示されます。 `disableTouchListener` プロパティでこの機能を無効にできます。 `disableTouchListener` プロパティでこの機能を無効にできます。 +モバイルでは、ユーザーが要素を長押しして1500msの遅延後に非表示になると、ツールチップが表示されます。 `disableTouchListener` プロパティでこの機能を無効にできます。 {{"demo": "pages/components/tooltips/DelayTooltips.js"}} @@ -127,7 +127,7 @@ In the event you need to implement a custom placement, you can use the `anchorEl (WAI-ARIA: https://www.w3.org/TR/wai-aria-practices/#tooltip) -By default, the tooltip only labels its child element. This is notably different from `title` which can either label **or** describe its child depending on whether the child already has a label. For example, in: +デフォルトでは、ツールチップはその子要素にのみラベル付けします。 This is notably different from `title` which can either label **or** describe its child depending on whether the child already has a label. For example, in: ```html <button title="some more information">A button</button> diff --git a/docs/src/pages/components/tooltips/tooltips-ru.md b/docs/src/pages/components/tooltips/tooltips-ru.md index 02ca77d716453a..7574858e1cbb06 100644 --- a/docs/src/pages/components/tooltips/tooltips-ru.md +++ b/docs/src/pages/components/tooltips/tooltips-ru.md @@ -26,7 +26,7 @@ The `Tooltip` has 12 **placements** choice. They don't have directional arrows; ## Настраиваемые подсказки -Ниже находятся примеры кастомизации компонента. You can learn more about this in the [overrides documentation page](/customization/how-to-customize/). +Ниже находятся примеры кастомизации компонента. Вы можете узнать об этом больше [в документации по переопределению свойств](/customization/how-to-customize/). {{"demo": "pages/components/tooltips/CustomizedTooltips.js"}} diff --git a/docs/src/pages/components/tooltips/tooltips-zh.md b/docs/src/pages/components/tooltips/tooltips-zh.md index b903be12615e6e..440b89f02856d0 100644 --- a/docs/src/pages/components/tooltips/tooltips-zh.md +++ b/docs/src/pages/components/tooltips/tooltips-zh.md @@ -20,7 +20,7 @@ waiAria: 'https://www.w3.org/TR/wai-aria-practices/#tooltip' ## 文字提示的位置 -`Tooltip` 有 12 个**位置** 选项。 They don't have directional arrows; instead, they rely on motion emanating from the source to convey direction. +`Tooltip` 有 12 个**位置** 选项。 它们没有方向箭头,而是依靠源头发出的运动来传递方向。 {{"demo": "pages/components/tooltips/PositionedTooltips.js"}} diff --git a/docs/src/pages/components/transitions/transitions-zh.md b/docs/src/pages/components/transitions/transitions-zh.md index dd025c89212d89..d139b58405847c 100644 --- a/docs/src/pages/components/transitions/transitions-zh.md +++ b/docs/src/pages/components/transitions/transitions-zh.md @@ -70,9 +70,9 @@ export default Main() { {{"demo": "pages/components/transitions/SimpleZoom.js", "bg": true}} -## TransitionGroup +## TransitionGroup 动画组 -To animate a component when it is mounted or unmounted, you can use the [`TransitionGroup`](https://reactcommunity.org/react-transition-group/transition-group) component from _react-transition-group_. As components are added or removed, the `in` prop is toggled automatically by `TransitionGroup`. As components are added or removed, the `in` prop is toggled automatically by `TransitionGroup`. +要在安装或卸载组件时对其进行动画处理,可以使用 _react-transition-group_ 中的 [`TransitionGroup`](https://reactcommunity.org/react-transition-group/transition-group) 组件。 当组件被添加或删除时,`in` 属性会被 `TransitionGroup` 自动切换。 {{"demo": "pages/components/transitions/TransitionGroupExample.js"}} @@ -84,7 +84,7 @@ To animate a component when it is mounted or unmounted, you can use the [`Transi - 当进入过渡时调用 `onEnter` 回调属性。 - 当退出过渡完成后应该调用 `onExited` 回调属性。 这两个回调属性保证了当在一个关闭的状态并展示完过渡动画时,才会移除子内容。 -For more information on creating a custom transition, visit the _react-transition-group_ [`Transition` documentation](http://reactcommunity.org/react-transition-group/transition). 你还可以访问一些组件的专用部分: 你还可以访问一些组件的专用部分: +For more information on creating a custom transition, visit the _react-transition-group_ [`Transition` documentation](http://reactcommunity.org/react-transition-group/transition). 你还可以访问一些组件的专用部分: 你还可以访问一些组件的专用部分: 你还可以访问一些组件的专用部分: - [Modal](/components/modal/#transitions) - [Dialog](/components/dialogs/#transitions) diff --git a/docs/src/pages/components/trap-focus/trap-focus-de.md b/docs/src/pages/components/trap-focus/trap-focus-de.md index f8e1677f8c8b4e..11b3ebe60768e0 100644 --- a/docs/src/pages/components/trap-focus/trap-focus-de.md +++ b/docs/src/pages/components/trap-focus/trap-focus-de.md @@ -12,9 +12,6 @@ TrapFocus is a component that manages focus for its descendants. This is useful When `open={true}` the trap is enabled, and pressing <kbd class="key">Tab</kbd> or <kbd><kbd class="key">Shift</kbd>+<kbd class="key">Tab</kbd></kbd> will rotate focus within the inner focusable elements of the component. -- 📦 [1.5 kB gzipped](https://material-ui.com/size-snapshot). -- ⚛️ Support portals - Die Style-Funktion der [Palette](/system/palette/). > ⚠️ The component is experimental and unstable. @@ -23,9 +20,19 @@ Die Style-Funktion der [Palette](/system/palette/). {{"demo": "pages/components/trap-focus/BasicTrapFocus.js"}} +## Unstyled + +- 📦 [2.0 kB gzipped](https://bundlephobia.com/result?p=@material-ui/unstyled@next) + +As the component does not have any styles, it also comes with the unstyled package. + +```js +import TrapFocus from '@material-ui/unstyled/Unstable_TrapFocus'; +``` + ## Disable enforce focus -Clicks within the focus trap behave normally; but clicks outside the focus trap are blocked. +Clicks within the focus trap behave normally, but clicks outside the focus trap are blocked. You can disable this behavior with the `disableEnforceFocus` prop. @@ -41,6 +48,6 @@ You can disable this behavior and make it lazy with the `disableAutoFocus` prop. ## Portal -The following demo uses the [`Portal`](/components/portal/) component to render a subset of the trap focus children into a new "subtree" outside of the current DOM hierarchy, so that they no longer form part of the focus loop. +The following demo uses the [`Portal`](/components/portal/) component to render a subset of the trap focus children into a new "subtree" outside of the current DOM hierarchy; so that they no longer form part of the focus loop. {{"demo": "pages/components/trap-focus/PortalTrapFocus.js"}} diff --git a/docs/src/pages/components/trap-focus/trap-focus-es.md b/docs/src/pages/components/trap-focus/trap-focus-es.md index f5fead0c6aa779..cd3788ab7809f9 100644 --- a/docs/src/pages/components/trap-focus/trap-focus-es.md +++ b/docs/src/pages/components/trap-focus/trap-focus-es.md @@ -12,9 +12,6 @@ TrapFocus is a component that manages focus for its descendants. This is useful When `open={true}` the trap is enabled, and pressing <kbd class="key">Tab</kbd> or <kbd><kbd class="key">Shift</kbd>+<kbd class="key">Tab</kbd></kbd> will rotate focus within the inner focusable elements of the component. -- 📦 [1.5 kB comprimido](https://material-ui.com/size-snapshot). -- ⚛️ Support portals - [La función de estilo de la paleta](/system/palette/). > ⚠️ The component is experimental and unstable. @@ -23,9 +20,19 @@ When `open={true}` the trap is enabled, and pressing <kbd class="key">Tab</kbd> {{"demo": "pages/components/trap-focus/BasicTrapFocus.js"}} +## Unstyled + +- 📦 [2.0 kB comprimido](https://bundlephobia.com/result?p=@material-ui/unstyled@next) + +As the component does not have any styles, it also comes with the unstyled package. + +```js +import TrapFocus from '@material-ui/unstyled/Unstable_TrapFocus'; +``` + ## Disable enforce focus -Clicks within the focus trap behave normally; but clicks outside the focus trap are blocked. +Clicks within the focus trap behave normally, but clicks outside the focus trap are blocked. You can disable this behavior with the `disableEnforceFocus` prop. @@ -41,6 +48,6 @@ You can disable this behavior and make it lazy with the `disableAutoFocus` prop. ## Portal -The following demo uses the [`Portal`](/components/portal/) component to render a subset of the trap focus children into a new "subtree" outside of the current DOM hierarchy, so that they no longer form part of the focus loop. +The following demo uses the [`Portal`](/components/portal/) component to render a subset of the trap focus children into a new "subtree" outside of the current DOM hierarchy; so that they no longer form part of the focus loop. {{"demo": "pages/components/trap-focus/PortalTrapFocus.js"}} diff --git a/docs/src/pages/components/trap-focus/trap-focus-fr.md b/docs/src/pages/components/trap-focus/trap-focus-fr.md index 42fb9f1060036d..7d560472b7a9c8 100644 --- a/docs/src/pages/components/trap-focus/trap-focus-fr.md +++ b/docs/src/pages/components/trap-focus/trap-focus-fr.md @@ -6,36 +6,43 @@ githubLabel: 'component: TrapFocus' # Trap Focus -<p class="description">Trap focus within a DOM node.</p> +<p class="description">Piéger le focus dans un nœud DOM.</p> -TrapFocus is a component that manages focus for its descendants. This is useful when implementing overlays such as modal dialogs, which should not allow the focus to escape while open. +TrapFocus est un composant qui gère le focus pour ses descendants. Ceci est utile lors de l'implémentation de superpositions telles que les dialogues modaux, qui ne devraient pas permettre au focus d'échapper pendant l'ouverture. -When `open={true}` the trap is enabled, and pressing <kbd class="key">Tab</kbd> or <kbd><kbd class="key">Shift</kbd>+<kbd class="key">Tab</kbd></kbd> will rotate focus within the inner focusable elements of the component. - -- 📦 [1,5 ko gzippé](https://material-ui.com/size-snapshot). -- ⚛️ Les portails d'assistance +Lorsque `open={true}` le piège est activé, et en appuyant sur <kbd class="key">Tab</kbd> ou <kbd><kbd class="key">Maj</kbd>+<kbd class="key">Tab</kbd></kbd> fera pivoter le focus à l'intérieur des éléments internes du composant. {{"component": "modules/components/ComponentLinkHeader.js", "design": false}} -> ⚠️ The component is experimental and unstable. +> ⚠️ Le composant est expérimental et instable. ## Exemple {{"demo": "pages/components/trap-focus/BasicTrapFocus.js"}} -## Disable enforce focus +## Unstyled + +- 📦 [1,5 ko gzippé](https://material-ui.com/size-snapshot). + +As the component does not have any styles, it also comes with the unstyled package. + +```js +import TrapFocus from '@material-ui/unstyled/Unstable_TrapFocus'; +``` + +## Désactiver le focus imposé -Clicks within the focus trap behave normally; but clicks outside the focus trap are blocked. +Clicks within the focus trap behave normally, but clicks outside the focus trap are blocked. -You can disable this behavior with the `disableEnforceFocus` prop. +Vous pouvez désactiver ce comportement avec la propriété `disableEnforceFocus`. {{"demo": "pages/components/trap-focus/DisableEnforceFocus.js"}} -## Lazy activation +## Activation paresseuse (lazy) -By default, the component moves the focus to its descendants as soon as it opens: `open={true}`. +Par défaut, la composante déplace le focus vers ses descendants dès qu'elle s'ouvre : `open={true}`. -You can disable this behavior and make it lazy with the `disableAutoFocus` prop. When auto focus is disabled, as in the demo below, the component only traps the focus once it gets focused. +Vous pouvez désactiver ce comportement et le rendre paresseux avec la propriété `disableAutoFocus`. Lorsque la mise au point automatique est désactivée, comme dans la démo ci-dessous, le composant ne piège le focus qu'une fois qu'il est mis au point. {{"demo": "pages/components/trap-focus/LazyTrapFocus.js"}} diff --git a/docs/src/pages/components/trap-focus/trap-focus-ja.md b/docs/src/pages/components/trap-focus/trap-focus-ja.md index 9cdc115ffc4d99..bcfea6083b6c7e 100644 --- a/docs/src/pages/components/trap-focus/trap-focus-ja.md +++ b/docs/src/pages/components/trap-focus/trap-focus-ja.md @@ -12,9 +12,6 @@ TrapFocus is a component that manages focus for its descendants. This is useful When `open={true}` the trap is enabled, and pressing <kbd class="key">Tab</kbd> or <kbd><kbd class="key">Shift</kbd>+<kbd class="key">Tab</kbd></kbd> will rotate focus within the inner focusable elements of the component. -- 📦 [1.5 kB gzipped](https://material-ui.com/size-snapshot). -- ⚛️ Support portals - [The palette](/system/palette/) style関数。 > ⚠️ The component is experimental and unstable. @@ -23,9 +20,19 @@ When `open={true}` the trap is enabled, and pressing <kbd class="key">Tab</kbd> {{"demo": "pages/components/trap-focus/BasicTrapFocus.js"}} +## Unstyled + +- 📦 [2.0 kB gzipped](https://bundlephobia.com/result?p=@material-ui/unstyled@next) + +As the component does not have any styles, it also comes with the unstyled package. + +```js +import TrapFocus from '@material-ui/unstyled/Unstable_TrapFocus'; +``` + ## Disable enforce focus -Clicks within the focus trap behave normally; but clicks outside the focus trap are blocked. +Clicks within the focus trap behave normally, but clicks outside the focus trap are blocked. You can disable this behavior with the `disableEnforceFocus` prop. @@ -41,6 +48,6 @@ You can disable this behavior and make it lazy with the `disableAutoFocus` prop. ## Portal -The following demo uses the [`Portal`](/components/portal/) component to render a subset of the trap focus children into a new "subtree" outside of the current DOM hierarchy, so that they no longer form part of the focus loop. +The following demo uses the [`Portal`](/components/portal/) component to render a subset of the trap focus children into a new "subtree" outside of the current DOM hierarchy; so that they no longer form part of the focus loop. {{"demo": "pages/components/trap-focus/PortalTrapFocus.js"}} diff --git a/docs/src/pages/components/trap-focus/trap-focus-pt.md b/docs/src/pages/components/trap-focus/trap-focus-pt.md index ab9a8e5f56d246..22c2990b83a42c 100644 --- a/docs/src/pages/components/trap-focus/trap-focus-pt.md +++ b/docs/src/pages/components/trap-focus/trap-focus-pt.md @@ -12,9 +12,6 @@ TrapFocus é um componente que gerencia o foco para seus descendentes. This is u When `open={true}` the trap is enabled, and pressing <kbd class="key">Tab</kbd> or <kbd><kbd class="key">Shift</kbd>+<kbd class="key">Tab</kbd></kbd> will rotate focus within the inner focusable elements of the component. -- 📦 [1.5 kB gzipped](https://material-ui.com/size-snapshot). -- ⚛️ Suporte para portais - [A paleta](/system/palette/) com funções de estilo. > ⚠️ O componente é experimental e instável. @@ -23,9 +20,19 @@ When `open={true}` the trap is enabled, and pressing <kbd class="key">Tab</kbd> {{"demo": "pages/components/trap-focus/BasicTrapFocus.js"}} +## Unstyled + +- 📦 [2.0 kB gzipped](https://bundlephobia.com/result?p=@material-ui/unstyled@next) + +As the component does not have any styles, it also comes with the unstyled package. + +```js +import TrapFocus from '@material-ui/unstyled/Unstable_TrapFocus'; +``` + ## Desabilitar o forçar foco -Cliques dentro do capturar foco se comportam normalmente; mas cliques fora do capturar foco estão bloqueados. +Clicks within the focus trap behave normally, but clicks outside the focus trap are blocked. Você pode desativar esse comportamento com a propriedade `disableEnforceFocus`. @@ -41,6 +48,6 @@ Você pode desabilitar esse comportamento e deixá-lo de forma tardia com a prop ## Portal -A demonstração a seguir usa o componente [`Portal`](/components/portal/)para renderizar um subconjunto de elementos filhos de captura de foco em uma nova "sub-árvore" fora da atual hierarquia do DOM, para que eles não façam mais parte do ciclo de foco. +The following demo uses the [`Portal`](/components/portal/) component to render a subset of the trap focus children into a new "subtree" outside of the current DOM hierarchy; so that they no longer form part of the focus loop. {{"demo": "pages/components/trap-focus/PortalTrapFocus.js"}} diff --git a/docs/src/pages/components/trap-focus/trap-focus-ru.md b/docs/src/pages/components/trap-focus/trap-focus-ru.md index 53f62dbae5f6e8..938522017b87f6 100644 --- a/docs/src/pages/components/trap-focus/trap-focus-ru.md +++ b/docs/src/pages/components/trap-focus/trap-focus-ru.md @@ -12,9 +12,6 @@ TrapFocus is a component that manages focus for its descendants. This is useful When `open={true}` the trap is enabled, and pressing <kbd class="key">Tab</kbd> or <kbd><kbd class="key">Shift</kbd>+<kbd class="key">Tab</kbd></kbd> will rotate focus within the inner focusable elements of the component. -- 1.5 [1 кБ в сжатом виде](https://material-ui.com/size-snapshot). -- ⚛️ Support portals - {{"component": "modules/components/ComponentLinkHeader.js", "design": false}} > ⚠️ The component is experimental and unstable. @@ -23,9 +20,19 @@ When `open={true}` the trap is enabled, and pressing <kbd class="key">Tab</kbd> {{"demo": "pages/components/trap-focus/BasicTrapFocus.js"}} +## Unstyled + +- 📦 [2.0 kB gzipped](https://bundlephobia.com/result?p=@material-ui/unstyled@next) + +As the component does not have any styles, it also comes with the unstyled package. + +```js +import TrapFocus from '@material-ui/unstyled/Unstable_TrapFocus'; +``` + ## Disable enforce focus -Clicks within the focus trap behave normally; but clicks outside the focus trap are blocked. +Clicks within the focus trap behave normally, but clicks outside the focus trap are blocked. You can disable this behavior with the `disableEnforceFocus` prop. @@ -41,6 +48,6 @@ You can disable this behavior and make it lazy with the `disableAutoFocus` prop. ## Portal -The following demo uses the [`Portal`](/components/portal/) component to render a subset of the trap focus children into a new "subtree" outside of the current DOM hierarchy, so that they no longer form part of the focus loop. +The following demo uses the [`Portal`](/components/portal/) component to render a subset of the trap focus children into a new "subtree" outside of the current DOM hierarchy; so that they no longer form part of the focus loop. {{"demo": "pages/components/trap-focus/PortalTrapFocus.js"}} diff --git a/docs/src/pages/components/trap-focus/trap-focus-zh.md b/docs/src/pages/components/trap-focus/trap-focus-zh.md index 8db593d142dd62..fa1275cb947c2f 100644 --- a/docs/src/pages/components/trap-focus/trap-focus-zh.md +++ b/docs/src/pages/components/trap-focus/trap-focus-zh.md @@ -8,12 +8,9 @@ githubLabel: 'component: TrapFocus' <p class="description">在 DOM 节点内捕获焦点。</p> -陷阱焦点是一个为其子节点管理焦点的组件。 This is useful when implementing overlays such as modal dialogs, which should not allow the focus to escape while open. +陷阱焦点是一个为其子节点管理焦点的组件。 这在实现遮罩层时很有用,比如模态对话框,它不应该允许在该组件打开时转移焦点。 -When `open={true}` the trap is enabled, and pressing <kbd class="key">Tab</kbd> or <kbd><kbd class="key">Shift</kbd>+<kbd class="key">Tab</kbd></kbd> will rotate focus within the inner focusable elements of the component. - -- 📦 [1.5kB 已压缩的包](https://material-ui.com/size-snapshot)。 -- ⚛️ 支持传送门组件 +当 `open={true}` 的陷阱被启用时,按下 <kbd class="key">Tab</kbd> 或 <kbd><kbd class="key">Shift</kbd>+<kbd class="key">Tab</kbd></kbd> 将在组件的内部可聚焦元素内旋转聚焦。 {{"component": "modules/components/ComponentLinkHeader.js", "design": false}} @@ -23,9 +20,19 @@ When `open={true}` the trap is enabled, and pressing <kbd class="key">Tab</kbd> {{"demo": "pages/components/trap-focus/BasicTrapFocus.js"}} +## Unstyled + +- 📦 [2.0kB 已压缩的包](https://bundlephobia.com/result?p=@material-ui/unstyled@next) + +As the component does not have any styles, it also comes with the unstyled package. + +```js +import TrapFocus from '@material-ui/unstyled/Unstable_TrapFocus'; +``` + ## 禁用强制对焦 -在焦点陷阱内的点击会正常进行,但在焦点陷阱外的点击会被阻止。 +Clicks within the focus trap behave normally, but clicks outside the focus trap are blocked. 你可以使用 `disableEnforceFocus` 属性来禁用此行为。 @@ -41,6 +48,6 @@ When `open={true}` the trap is enabled, and pressing <kbd class="key">Tab</kbd> ## Portal -下面的演示使用 [`Portal`](/components/portal/) 组件将陷阱焦点子集渲染到当前 DOM 层次结构之外的新“子树(subtree)”中,这样它们就不再是焦点循环的一部分。 +The following demo uses the [`Portal`](/components/portal/) component to render a subset of the trap focus children into a new "subtree" outside of the current DOM hierarchy; so that they no longer form part of the focus loop. {{"demo": "pages/components/trap-focus/PortalTrapFocus.js"}} diff --git a/docs/src/pages/components/tree-view/tree-view-ja.md b/docs/src/pages/components/tree-view/tree-view-ja.md index d96ba3c7846951..2d8f5adea3feab 100644 --- a/docs/src/pages/components/tree-view/tree-view-ja.md +++ b/docs/src/pages/components/tree-view/tree-view-ja.md @@ -20,7 +20,7 @@ packageName: '@material-ui/lab' ## 複数選択 -Tree views also support multi selection. +ツリー ビューでは、複数選択もサポートします。 {{"demo": "pages/components/tree-view/MultiSelectTreeView.js"}} diff --git a/docs/src/pages/components/typography/typography-de.md b/docs/src/pages/components/typography/typography-de.md index fa1ef58062e779..5e3d4860956570 100644 --- a/docs/src/pages/components/typography/typography-de.md +++ b/docs/src/pages/components/typography/typography-de.md @@ -74,19 +74,21 @@ Die Komponente Typografie verwendet die Eigenschaft `variantMapping` um eine UI- ```js const theme = createTheme({ - props: { + components: { MuiTypography: { - variantMapping: { - h1: 'h2', - h2: 'h2', - h3: 'h2', - h4: 'h2', - h5: 'h2', - h6: 'h2', - subtitle1: 'h2', - subtitle2: 'h2', - body1: 'span', - body2: 'span', + defaultProps: { + variantMapping: { + h1: 'h2', + h2: 'h2', + h3: 'h2', + h4: 'h2', + h5: 'h2', + h6: 'h2', + subtitle1: 'h2', + subtitle2: 'h2', + body1: 'span', + body2: 'span', + }, }, }, }, @@ -97,6 +99,14 @@ const theme = createTheme({ In addition to using the default typography variants, you can add custom ones, or disable any you don't need. See the [Adding & disabling variants](/customization/typography/#adding-amp-disabling-variants) example for more info. +## System props + +As a CSS utility component, the `Typography` supports all [`system`](/system/properties/) properties. You can use them as prop directly on the component. For instance, a margin-top: + +```jsx +<Typography mt={2}> +``` + ## Barrierefreiheit A few key factors to follow for an accessible typography: diff --git a/docs/src/pages/components/typography/typography-es.md b/docs/src/pages/components/typography/typography-es.md index e556dd23909d03..29d7daf7b9053f 100644 --- a/docs/src/pages/components/typography/typography-es.md +++ b/docs/src/pages/components/typography/typography-es.md @@ -74,19 +74,21 @@ The Typography component uses the `variantMapping` property to associate a UI va ```js const theme = createTheme({ - props: { + components: { MuiTypography: { - variantMapping: { - h1: 'h2', - h2: 'h2', - h3: 'h2', - h4: 'h2', - h5: 'h2', - h6: 'h2', - subtitle1: 'h2', - subtitle2: 'h2', - body1: 'span', - body2: 'span', + defaultProps: { + variantMapping: { + h1: 'h2', + h2: 'h2', + h3: 'h2', + h4: 'h2', + h5: 'h2', + h6: 'h2', + subtitle1: 'h2', + subtitle2: 'h2', + body1: 'span', + body2: 'span', + }, }, }, }, @@ -97,6 +99,14 @@ const theme = createTheme({ In addition to using the default typography variants, you can add custom ones, or disable any you don't need. See the [Adding & disabling variants](/customization/typography/#adding-amp-disabling-variants) example for more info. +## System props + +As a CSS utility component, the `Typography` supports all [`system`](/system/properties/) properties. You can use them as prop directly on the component. For instance, a margin-top: + +```jsx +<Typography mt={2}> +``` + ## Accesibilidad A few key factors to follow for an accessible typography: diff --git a/docs/src/pages/components/typography/typography-fr.md b/docs/src/pages/components/typography/typography-fr.md index bd2522ea436e8f..624104e9789efd 100644 --- a/docs/src/pages/components/typography/typography-fr.md +++ b/docs/src/pages/components/typography/typography-fr.md @@ -97,6 +97,14 @@ const theme = createTheme({ In addition to using the default typography variants, you can add custom ones, or disable any you don't need. See the [Adding & disabling variants](/customization/typography/#adding-amp-disabling-variants) example for more info. +## System props + +As a CSS utility component, the `Typography` supports all [`system`](/system/properties/) properties. You can use them as prop directly on the component. For instance, a margin-top: + +```jsx +<Typography mt={2}> +``` + ## Accessibilité A few key factors to follow for an accessible typography: diff --git a/docs/src/pages/components/typography/typography-ja.md b/docs/src/pages/components/typography/typography-ja.md index 4250872ae967f1..44f07a5fb6537f 100644 --- a/docs/src/pages/components/typography/typography-ja.md +++ b/docs/src/pages/components/typography/typography-ja.md @@ -52,7 +52,7 @@ The Typography component makes it easy to apply a default set of font weights an ## テーマ -状況によっては、 `Typography` コンポーネントを使用できない場合があります。 状況によっては、 `Typography` コンポーネントを使用できない場合があります。 状況によっては、 `Typography` コンポーネントを使用できない場合があります。 状況によっては、 `Typography` コンポーネントを使用できない場合があります。 状況によっては、 `Typography` コンポーネントを使用できない場合があります。 このテーマのe [`typography`](/customization/default-theme/?expand-path=$.typography)キーを活用できることを願っています。 状況によっては、 `Typography` コンポーネントを使用できない場合があります。 状況によっては、 `Typography` コンポーネントを使用できない場合があります。 状況によっては、 `Typography` コンポーネントを使用できない場合があります。 状況によっては、 `Typography` コンポーネントを使用できない場合があります。 このテーマのe [`typography`](/customization/default-theme/?expand-path=$.typography)キーを活用できることを願っています。 +状況によっては、 `Typography` コンポーネントを使用できない場合があります。 状況によっては、 `Typography` コンポーネントを使用できない場合があります。 状況によっては、 `Typography` コンポーネントを使用できない場合があります。 状況によっては、 `Typography` コンポーネントを使用できない場合があります。 状況によっては、 `Typography` コンポーネントを使用できない場合があります。 このテーマのe [`typography`](/customization/default-theme/?expand-path=$.typography)キーを活用できることを願っています。 このテーマのe [`typography`](/customization/default-theme/?expand-path=$.typography)キーを活用できることを願っています。 {{"demo": "pages/components/typography/TypographyTheme.js"}} @@ -74,19 +74,21 @@ Typographyコンポーネントは、 `variantMapping` プロパティを使用 ```js const theme = createTheme({ - props: { + components: { MuiTypography: { - variantMapping: { - h1: 'h2', - h2: 'h2', - h3: 'h2', - h4: 'h2', - h5: 'h2', - h6: 'h2', - subtitle1: 'h2', - subtitle2: 'h2', - body1: 'span', - body2: 'span', + defaultProps: { + variantMapping: { + h1: 'h2', + h2: 'h2', + h3: 'h2', + h4: 'h2', + h5: 'h2', + h6: 'h2', + subtitle1: 'h2', + subtitle2: 'h2', + body1: 'span', + body2: 'span', + }, }, }, }, @@ -97,6 +99,14 @@ const theme = createTheme({ In addition to using the default typography variants, you can add custom ones, or disable any you don't need. See the [Adding & disabling variants](/customization/typography/#adding-amp-disabling-variants) example for more info. +## System props + +As a CSS utility component, the `Typography` supports all [`system`](/system/properties/) properties. You can use them as prop directly on the component. For instance, a margin-top: + +```jsx +<Typography mt={2}> +``` + ## アクセシビリティ A few key factors to follow for an accessible typography: diff --git a/docs/src/pages/components/typography/typography-pt.md b/docs/src/pages/components/typography/typography-pt.md index 630a7bbcdeca1b..bb677f332f60dc 100644 --- a/docs/src/pages/components/typography/typography-pt.md +++ b/docs/src/pages/components/typography/typography-pt.md @@ -74,19 +74,21 @@ O componente de Tipografia (Typography) usa a propriedade `variantMapping` para ```js const theme = createTheme({ - props: { + components: { MuiTypography: { - variantMapping: { - h1: 'h2', - h2: 'h2', - h3: 'h2', - h4: 'h2', - h5: 'h2', - h6: 'h2', - subtitle1: 'h2', - subtitle2: 'h2', - body1: 'span', - body2: 'span', + defaultProps: { + variantMapping: { + h1: 'h2', + h2: 'h2', + h3: 'h2', + h4: 'h2', + h5: 'h2', + h6: 'h2', + subtitle1: 'h2', + subtitle2: 'h2', + body1: 'span', + body2: 'span', + }, }, }, }, @@ -97,6 +99,14 @@ const theme = createTheme({ In addition to using the default typography variants, you can add custom ones, or disable any you don't need. See the [Adding & disabling variants](/customization/typography/#adding-amp-disabling-variants) example for more info. +## System props + +As a CSS utility component, the `Typography` supports all [`system`](/system/properties/) properties. You can use them as prop directly on the component. For instance, a margin-top: + +```jsx +<Typography mt={2}> +``` + ## Acessibilidade Alguns fatores chave a seguir para uma tipografia acessível: diff --git a/docs/src/pages/components/typography/typography-ru.md b/docs/src/pages/components/typography/typography-ru.md index e3821f2fb47aaf..a9a8ccd92e2df4 100644 --- a/docs/src/pages/components/typography/typography-ru.md +++ b/docs/src/pages/components/typography/typography-ru.md @@ -74,19 +74,21 @@ The Typography component uses the `variantMapping` property to associate a UI va ```js const theme = createTheme({ - props: { + components: { MuiTypography: { - variantMapping: { - h1: 'h2', - h2: 'h2', - h3: 'h2', - h4: 'h2', - h5: 'h2', - h6: 'h2', - subtitle1: 'h2', - subtitle2: 'h2', - body1: 'span', - body2: 'span', + defaultProps: { + variantMapping: { + h1: 'h2', + h2: 'h2', + h3: 'h2', + h4: 'h2', + h5: 'h2', + h6: 'h2', + subtitle1: 'h2', + subtitle2: 'h2', + body1: 'span', + body2: 'span', + }, }, }, }, @@ -97,6 +99,14 @@ const theme = createTheme({ In addition to using the default typography variants, you can add custom ones, or disable any you don't need. See the [Adding & disabling variants](/customization/typography/#adding-amp-disabling-variants) example for more info. +## System props + +As a CSS utility component, the `Typography` supports all [`system`](/system/properties/) properties. You can use them as prop directly on the component. For instance, a margin-top: + +```jsx +<Typography mt={2}> +``` + ## Доступность Несколько ключевых факторов для доступности оформления: diff --git a/docs/src/pages/components/typography/typography-zh.md b/docs/src/pages/components/typography/typography-zh.md index b69f9a9abc69e5..d814f79a516844 100644 --- a/docs/src/pages/components/typography/typography-zh.md +++ b/docs/src/pages/components/typography/typography-zh.md @@ -61,7 +61,7 @@ import '@fontsource/roboto/700.css'; ## 改变语义元素 -文字铸排组件通过 `variantMapping` 属性关联了一种 UI 变体和某一种语义元素。 It's important to realize that the style of a typography component is independent from the semantic underlying element. +文字铸排组件通过 `variantMapping` 属性关联了一种 UI 变体和某一种语义元素。 重要的是要意识到排版组件的风格是独立于语义基础元素的。 - 使用 `component` 属性,您可以一次性改变底层元素的样式: @@ -99,9 +99,17 @@ const theme = createTheme({ }); ``` -## Adding & disabling variants +## 添加 & 禁用变体 -In addition to using the default typography variants, you can add custom ones, or disable any you don't need. In addition to using the default typography variants, you can add custom ones, or disable any you don't need. See the [Adding & disabling variants](/customization/typography/#adding-amp-disabling-variants) example for more info. +除了使用默认的排版变体外,你还可以添加自定义的排版,或者禁用任何你不需要的排版。 更多信息请参见 [添加 & 禁用变体](/customization/typography/#adding-amp-disabling-variants) 示例。 + +## System props + +As a CSS utility component, the `Typography` supports all [`system`](/system/properties/) properties. You can use them as prop directly on the component. For instance, a margin-top: + +```jsx +<Typography mt={2}> +``` ## 无障碍设计 diff --git a/docs/src/pages/components/use-media-query/use-media-query-de.md b/docs/src/pages/components/use-media-query/use-media-query-de.md index 6591d4d5df4ee2..58ee29ddce40c6 100644 --- a/docs/src/pages/components/use-media-query/use-media-query-de.md +++ b/docs/src/pages/components/use-media-query/use-media-query-de.md @@ -116,7 +116,7 @@ Try relying on client-side CSS media queries first. Zum Beispiel könnten Sie ve - [`<Box display>`](/system/display/#hiding-elements) - [`themes.breakpoints.up(x)`](/customization/breakpoints/#css-media-queries) -- or [`<Hidden implementation="css">`](/components/hidden/#css) +- or [`sx prop`](/system/basics/#heading-the-sx-prop) If none of the above alternatives are an option, you can proceed reading this section of the documentation. @@ -171,6 +171,7 @@ function handleRender(req, res) { } } } +} ``` {{"demo": "pages/components/use-media-query/ServerSide.js", "defaultCodeOpen": false}} @@ -189,13 +190,13 @@ Die Komponente höherer Ordnung `withWidth()` fügt die Bildschirmbreite der Sei #### Parameter -1. `query` (*String* | *Function*): A string representing the media query to handle or a callback function accepting the theme (in the context) that returns a string. -2. `options` (*Object* [optional]): +1. `query` (_string_ | _func_): A string representing the media query to handle or a callback function accepting the theme (in the context) that returns a string. +2. `options` (_object_ [optional]): -- `options.defaultMatches` (*Boolean* [optional]): Da `window.matchMedia()` auf dem Server nicht verfügbar ist, wird ein Standard Match zurückgegeben. Der Standardwert ist `false`. -- `options.matchMedia` (*Function* [optional]) You can provide your own implementation of *matchMedia*. This can be used for handling an iframe content window. -- `options.noSsr` (*Boolean* [optional]): Standardeinstellung ist `false`. To perform the server-side hydration, the hook needs to render twice. A first time with `false`, the value of the server, and a second time with the resolved value. Dieser Zyklus mit zwei Durchgängen ist mit einem Nachteil verbunden. Es ist langsamer. You can set this option to `true` if you are doing **client-side only** rendering. -- `options.ssrMatchMedia` (*Function* [optional]) You can provide your own implementation of *matchMedia* in a [server-side rendering context](#server-side-rendering). +- `options.defaultMatches` (_bool_ [optional]): As `window.matchMedia()` is unavailable on the server, we return a default matches during the first mount. Der Standardwert ist `false`. +- `options.matchMedia` (_func_ [optional]): You can provide your own implementation of _matchMedia_. This can be used for handling an iframe content window. +- `options.noSsr` (_bool_ [optional]): Defaults to `false`. To perform the server-side hydration, the hook needs to render twice. A first time with `false`, the value of the server, and a second time with the resolved value. Dieser Zyklus mit zwei Durchgängen ist mit einem Nachteil verbunden. Es ist langsamer. You can set this option to `true` if you are doing **client-side only** rendering. +- `options.ssrMatchMedia` (_func_ [optional]): You can provide your own implementation of _matchMedia_ in a [server-side rendering context](#server-side-rendering). Note: You can change the default options using the [`default props`](/customization/theme-components/#default-props) feature of the theme with the `MuiUseMediaQuery` key. diff --git a/docs/src/pages/components/use-media-query/use-media-query-es.md b/docs/src/pages/components/use-media-query/use-media-query-es.md index a3b554264ce933..1c89a9800f827d 100644 --- a/docs/src/pages/components/use-media-query/use-media-query-es.md +++ b/docs/src/pages/components/use-media-query/use-media-query-es.md @@ -116,7 +116,7 @@ Try relying on client-side CSS media queries first. For instance, you could use: - [`<Box display>`](/system/display/#hiding-elements) - [`themes.breakpoints.up(x)`](/customization/breakpoints/#css-media-queries) -- or [`<Hidden implementation="css">`](/components/hidden/#css) +- or [`sx prop`](/system/basics/#heading-the-sx-prop) If none of the above alternatives are an option, you can proceed reading this section of the documentation. @@ -188,13 +188,13 @@ The `withWidth()` higher-order component injects the screen width of the page. Y #### Argumentos -1. `query` (*String* | *Function*): A string representing the media query to handle or a callback function accepting the theme (in the context) that returns a string. +1. `query` (_string_ | _func_): A string representing the media query to handle or a callback function accepting the theme (in the context) that returns a string. 2. `options` (*Object* [optional]): -- `options.defaultMatches` (*Boolean* [optional]): As `window.matchMedia()` is unavailable on the server, we return a default matches during the first mount. The default value is `false`. -- `options.matchMedia` (*Function* [optional]) You can provide your own implementation of *matchMedia*. This can be used for handling an iframe content window. -- `options.noSsr` (*Boolean* [optional]): Default `false`. To perform the server-side hydration, the hook needs to render twice. A first time with `false`, the value of the server, and a second time with the resolved value. This double pass rendering cycle comes with a drawback. It's slower. You can set this option to `true` if you are doing **client-side only** rendering. -- `options.ssrMatchMedia` (*Function* [optional]) You can provide your own implementation of *matchMedia* in a [server-side rendering context](#server-side-rendering). +- `options.defaultMatches` (_bool_ [optional]): As `window.matchMedia()` is unavailable on the server, we return a default matches during the first mount. The default value is `false`. +- `options.matchMedia` (_func_ [optional]): You can provide your own implementation of _matchMedia_. This can be used for handling an iframe content window. +- `options.noSsr` (_bool_ [optional]): Defaults to `false`. To perform the server-side hydration, the hook needs to render twice. A first time with `false`, the value of the server, and a second time with the resolved value. This double pass rendering cycle comes with a drawback. It's slower. You can set this option to `true` if you are doing **client-side only** rendering. +- `options.ssrMatchMedia` (_func_ [optional]): You can provide your own implementation of _matchMedia_ in a [server-side rendering context](#server-side-rendering). Note: You can change the default options using the [`default props`](/customization/theme-components/#default-props) feature of the theme with the `MuiUseMediaQuery` key. diff --git a/docs/src/pages/components/use-media-query/use-media-query-ja.md b/docs/src/pages/components/use-media-query/use-media-query-ja.md index 6d5b1c9c9c8d78..2d13938baa36ac 100644 --- a/docs/src/pages/components/use-media-query/use-media-query-ja.md +++ b/docs/src/pages/components/use-media-query/use-media-query-ja.md @@ -18,7 +18,7 @@ githubLabel: 'hook: useMediaQuery' ## 単純なメディアクエリ -Finally, you need to provide an implementation of [matchMedia](https://developer.mozilla.org/en-US/docs/Web/API/Window/matchMedia) to the `useMediaQuery` with the previously guessed characteristics. Using [css-mediaquery](https://github.com/ericf/css-mediaquery) to emulate matchMedia is recommended. +フックの最初の引数にメディアクエリを提供する必要があります。 The media query string can be any valid CSS media query, e.g. [`'(prefers-color-scheme: dark)'`](/customization/palette/#user-preference). {{"demo": "pages/components/use-media-query/SimpleMediaQuery.js", "defaultCodeOpen": true}} @@ -116,7 +116,7 @@ Try relying on client-side CSS media queries first. たとえば、 - [`<Box display>`](/system/display/#hiding-elements) - [`themes.breakpoints.up(x)`](/customization/breakpoints/#css-media-queries) -- or [`<Hidden implementation="css">`](/components/hidden/#css) +- or [`sx prop`](/system/basics/#heading-the-sx-prop) If none of the above alternatives are an option, you can proceed reading this section of the documentation. @@ -159,7 +159,7 @@ Make sure you provide the same custom match media implementation to the client-s ## `withWidth()`からの移行 -`withWidth()`上位コンポーネントは、ページの画面幅を挿入します。 `useWidth` フックで同じ動作を再現できます: `withWidth()`上位コンポーネントは、ページの画面幅を挿入します。 `useWidth` フックで同じ動作を再現できます: `withWidth()`上位コンポーネントは、ページの画面幅を挿入します。 `useWidth` フックで同じ動作を再現できます: `withWidth()`上位コンポーネントは、ページの画面幅を挿入します。 `useWidth` フックで同じ動作を再現できます: `withWidth()`上位コンポーネントは、ページの画面幅を挿入します。 `useWidth` フックで同じ動作を再現できます: `withWidth()`上位コンポーネントは、ページの画面幅を挿入します。 `useWidth` フックで同じ動作を再現できます: +`withWidth()`上位コンポーネントは、ページの画面幅を挿入します。 `useWidth` フックで同じ動作を再現できます: `withWidth()`上位コンポーネントは、ページの画面幅を挿入します。 `useWidth` フックで同じ動作を再現できます: `withWidth()`上位コンポーネントは、ページの画面幅を挿入します。 `useWidth` フックで同じ動作を再現できます: `withWidth()`上位コンポーネントは、ページの画面幅を挿入します。 `useWidth` フックで同じ動作を再現できます: `withWidth()`上位コンポーネントは、ページの画面幅を挿入します。 `useWidth` フックで同じ動作を再現できます: You can reproduce the same behavior with a `useWidth` hook: {{"demo": "pages/components/use-media-query/UseWidth.js"}} @@ -169,13 +169,13 @@ Make sure you provide the same custom match media implementation to the client-s #### 引数 -1. `query` (*String* | *Function*):処理するメディアクエリを表す文字列、または文字列を返す(コンテキスト内の)テーマを受け入れるコールバック関数。 -2. `オプション` (*オプジェクト* [任意]): +1. `query` (_string_ | _func_): A string representing the media query to handle or a callback function accepting the theme (in the context) that returns a string. +2. `options` (_object_ [optional]): -- `options.defaultMatches` (*Boolean* [optional]): `window.matchMedia()` はサーバーで使用できないため、 最初のマウント時にデフォルトの一致を返します。 `options.noSsr` (*ブール値* [任意]): デフォルト値 `false`. -- `options.matchMedia` (*Function* [optional]) You can provide your own implementation of *matchMedia*. This can be used for handling an iframe content window. -- `options.noSsr` (*ブール値* [任意]): デフォルト値 `false`. To perform the server-side hydration, the hook needs to render twice. A first time with `false`, the value of the server, and a second time with the resolved value. このダブルパスレンダリングサイクルには欠点があります。 遅いです。 You can set this option to `true` if you are doing **client-side only** rendering. -- `options.ssrMatchMedia` (*Function* [optional]) You can provide your own implementation of *matchMedia* in a [server-side rendering context](#server-side-rendering). +- `options.defaultMatches` (_bool_ [optional]): As `window.matchMedia()` is unavailable on the server, we return a default matches during the first mount. `options.noSsr` (*ブール値* [任意]): デフォルト値 `false`. +- `options.matchMedia` (_func_ [optional]): You can provide your own implementation of _matchMedia_. This can be used for handling an iframe content window. +- `options.noSsr` (_bool_ [optional]): Defaults to `false`. To perform the server-side hydration, the hook needs to render twice. A first time with `false`, the value of the server, and a second time with the resolved value. このダブルパスレンダリングサイクルには欠点があります。 遅いです。 You can set this option to `true` if you are doing **client-side only** rendering. +- `options.ssrMatchMedia` (_func_ [optional]): You can provide your own implementation of _matchMedia_ in a [server-side rendering context](#server-side-rendering). Note: You can change the default options using the [`default props`](/customization/theme-components/#default-props) feature of the theme with the `MuiUseMediaQuery` key. diff --git a/docs/src/pages/components/use-media-query/use-media-query-pt.md b/docs/src/pages/components/use-media-query/use-media-query-pt.md index 9ed53b9c0f470c..a342374de48b98 100644 --- a/docs/src/pages/components/use-media-query/use-media-query-pt.md +++ b/docs/src/pages/components/use-media-query/use-media-query-pt.md @@ -116,7 +116,7 @@ Tente confiar em consultas de mídia CSS do lado do cliente primeiro. Por exempl - [`<Box display>`](/system/display/#hiding-elements) - [`themes.breakpoints.up(x)`](/customization/breakpoints/#css-media-queries) -- ou [`<Hidden implementation="css">`](/components/hidden/#css) +- or [`sx prop`](/system/basics/#heading-the-sx-prop) Se nenhuma das alternativas acima for uma opção, você poderá continuar lendo esta seção da documentação. @@ -162,6 +162,7 @@ function handleRender(req, res) { } } } +} ``` {{"demo": "pages/components/use-media-query/ServerSide.js", "defaultCodeOpen": false}} @@ -180,13 +181,13 @@ O componente de ordem superior `withWidth()` injeta a largura da tela da página #### Argumentos -1. `query` (*String* | *Function*): Uma string representando a consulta de mídia a ser manipulada ou uma função de retorno de chamada aceitando o tema (no contexto) que retorna uma string. -2. `options` (_Object_ [opcional]): +1. `query` (_string_ | _func_): A string representing the media query to handle or a callback function accepting the theme (in the context) that returns a string. +2. `options` (_object_ [optional]): -- `options.defaultMatches` (*Boolean* [opcional]): Como `window.matchMedia()` não esta disponível no servidor, retornamos uma correspondência padrão durante a primeira montagem. O valor padrão é `false`. -- `options.matchMedia` (*Function* [opcional]) Você pode fornecer sua própria implementação de *matchMedia*. Isso pode ser usado para manipular uma janela iframe com conteúdo. -- `options.noSsr` (*Boolean* [opcional]): Padrão é `false`. Para executar a hidratação no lado do servidor, o hook precisa renderizar duas vezes. Uma primeira vez com `false`, o valor do servidor e uma segunda vez com o valor resolvido. Este ciclo de renderização de dupla passagem tem uma desvantagem. É mais lento. Você pode definir esta opção para `true` se você estiver fazendo renderização **somente no lado cliente**. -- `options.ssrMatchMedia` (*Function* [opcional]) Você pode fornecer sua própria implementação de *matchMedia* em um [contexto de renderização do lado do servidor](#server-side-rendering). +- `options.defaultMatches` (_bool_ [optional]): As `window.matchMedia()` is unavailable on the server, we return a default matches during the first mount. O valor padrão é `false`. +- `options.matchMedia` (_func_ [optional]): You can provide your own implementation of _matchMedia_. Isso pode ser usado para manipular uma janela iframe com conteúdo. +- `options.noSsr` (_bool_ [optional]): Defaults to `false`. Para executar a hidratação no lado do servidor, o hook precisa renderizar duas vezes. Uma primeira vez com `false`, o valor do servidor e uma segunda vez com o valor resolvido. Este ciclo de renderização de dupla passagem tem uma desvantagem. É mais lento. Você pode definir esta opção para `true` se você estiver fazendo renderização **somente no lado cliente**. +- `options.ssrMatchMedia` (_func_ [optional]): You can provide your own implementation of _matchMedia_ in a [server-side rendering context](#server-side-rendering). Nota: Você pode alterar as opções padrão usando [`default props`](/customization/theme-components/#default-props), este recurso pertence ao tema através da chave `MuiUseMediaQuery`. diff --git a/docs/src/pages/components/use-media-query/use-media-query-ru.md b/docs/src/pages/components/use-media-query/use-media-query-ru.md index 1fca71fc198382..5b8e422ad41e5e 100644 --- a/docs/src/pages/components/use-media-query/use-media-query-ru.md +++ b/docs/src/pages/components/use-media-query/use-media-query-ru.md @@ -116,7 +116,7 @@ Try relying on client-side CSS media queries first. For instance, you could use: - [`<Box display>`](/system/display/#hiding-elements) - [`themes.breakpoints.up(x)`](/customization/breakpoints/#css-media-queries) -- or [`<Hidden implementation="css">`](/components/hidden/#css) +- or [`sx prop`](/system/basics/#heading-the-sx-prop) If none of the above alternatives are an option, you can proceed reading this section of the documentation. @@ -169,13 +169,13 @@ The `withWidth()` higher-order component injects the screen width of the page. Y #### Аргументы -1. `query` (*String* | *Function*): A string representing the media query to handle or a callback function accepting the theme (in the context) that returns a string. -2. `варианты` (*объекта* [optional]): +1. `query` (_string_ | _func_): A string representing the media query to handle or a callback function accepting the theme (in the context) that returns a string. +2. `options` (_object_ [optional]): -- `options.defaultMatches` (*Boolean* [optional]): As `window.matchMedia()` is unavailable on the server, we return a default matches during the first mount. The default value is `false`. -- `options.matchMedia` (*Function* [optional]) You can provide your own implementation of *matchMedia*. This can be used for handling an iframe content window. -- `options.noSsr` (*Boolean* [optional]): По умолчанию - `false`. Для выполнения гидратации на стороне сервера хук должен рендерится дважды. Первый раз с `false`, значение сервера и второй раз с разрешенным значением. This double pass rendering cycle comes with a drawback. It's slower. Вы можете установить опцию `noSsr` как `true` если вы делаете рендеринг **лишь на стороне клиента**. -- `options.ssrMatchMedia` (*Function* [optional]) You can provide your own implementation of *matchMedia* in a [server-side rendering context](#server-side-rendering). +- `options.defaultMatches` (_bool_ [optional]): As `window.matchMedia()` is unavailable on the server, we return a default matches during the first mount. The default value is `false`. +- `options.matchMedia` (_func_ [optional]): You can provide your own implementation of _matchMedia_. This can be used for handling an iframe content window. +- `options.noSsr` (_bool_ [optional]): Defaults to `false`. Для выполнения гидратации на стороне сервера хук должен рендерится дважды. Первый раз с `false`, значение сервера и второй раз с разрешенным значением. This double pass rendering cycle comes with a drawback. It's slower. Вы можете установить опцию `noSsr` как `true` если вы делаете рендеринг **лишь на стороне клиента**. +- `options.ssrMatchMedia` (_func_ [optional]): You can provide your own implementation of _matchMedia_ in a [server-side rendering context](#server-side-rendering). Note: You can change the default options using the [`default props`](/customization/theme-components/#default-props) feature of the theme with the `MuiUseMediaQuery` key. diff --git a/docs/src/pages/components/use-media-query/use-media-query-zh.md b/docs/src/pages/components/use-media-query/use-media-query-zh.md index 7e523426733b1b..c1ea133e52dbd0 100644 --- a/docs/src/pages/components/use-media-query/use-media-query-zh.md +++ b/docs/src/pages/components/use-media-query/use-media-query-zh.md @@ -118,7 +118,7 @@ const theme = createTheme({ - [`<Box display>`](/system/display/#hiding-elements) - [`themes.breakpoints.up(x)`](/customization/breakpoints/#css-media-queries) -- 或者 [`<Hidden implementation="css">`](/components/hidden/#css) +- or [`sx prop`](/system/basics/#heading-the-sx-prop) 如果上述的方案都不可用,那么你也可以继续阅读本节文档的其余内容。 @@ -181,13 +181,13 @@ function handleRender(req, res) { #### 参数 -1. `query` (_String_ | _Function_):代表要处理的媒体查询的字符串或接受主题(在上下文中)的回调函数,它会返回一个字符串。 -2. `options` (_Object_ [optional]): +1. `query` (_string_ | _func_): A string representing the media query to handle or a callback function accepting the theme (in the context) that returns a string. +2. `options` (_object_ [optional]): -- `options.defaultMatches` (*布尔值* [optional]): 作为 `window.matchMedia()` 在服务器上不可用, 我们在第一次安装时返回默认匹配。 默认值为 `false`。 -- `options.matchMedia` (_Function_ [optional]):你可以提供你自己的 _matchMedia_ 实现。 用其您可以处理一个 iframe 内容窗口。 -- `options.noSsr` (*Boolean* [optional]): 默认值为 `false`。 要和服务器进行同步使用(hydration),hook 需要渲染两次。 第一次使用 `false` 表示服务端的值,第二次使用已解析的值。 这个双向渲染周期带有一个缺点。 速度较慢。 如果你只需要 **客户端**渲染,那么可以将该选项设置为 `true`。 -- `options.ssrMatchMedia` (_Function_ [optional]):你可以在 [服务器端渲染上下文](#server-side-rendering) 中提供你自己的 _matchMedia_ 实现。 +- `options.defaultMatches` (_bool_ [optional]): As `window.matchMedia()` is unavailable on the server, we return a default matches during the first mount. 默认值为 `false`。 +- `options.matchMedia` (_func_ [optional]): You can provide your own implementation of _matchMedia_. 用其您可以处理一个 iframe 内容窗口。 +- `options.noSsr` (_bool_ [optional]): Defaults to `false`. 要和服务器进行同步使用(hydration),hook 需要渲染两次。 第一次使用 `false` 表示服务端的值,第二次使用已解析的值。 这个双向渲染周期带有一个缺点。 速度较慢。 如果你只需要 **客户端**渲染,那么可以将该选项设置为 `true`。 +- `options.ssrMatchMedia` (_func_ [optional]): You can provide your own implementation of _matchMedia_ in a [server-side rendering context](#server-side-rendering). 注意:你可以使用主题的 [`默认属性`](/customization/theme-components/#default-props) 功能和 `MuiUseMediaQuery` 键(key)来更改默认的选项。 diff --git a/docs/src/pages/customization/breakpoints/breakpoints-de.md b/docs/src/pages/customization/breakpoints/breakpoints-de.md index fb4f45e604a9b4..efb985558d6985 100644 --- a/docs/src/pages/customization/breakpoints/breakpoints-de.md +++ b/docs/src/pages/customization/breakpoints/breakpoints-de.md @@ -4,7 +4,7 @@ Für eine optimale Benutzererfahrung müssen Materialdesign-Schnittstellen in der Lage sein, ihr Layout an verschiedenen Haltepunkten anzupassen. Material-UI verwendet eine **vereinfachte** Implementierung der ursprünglichen [Spezifikation](https://material.io/design/layout/responsive-layout-grid.html#breakpoints). -Die Haltepunkte werden intern in verschiedenen Komponenten verwendet, um sie ansprechbar zu machen, Sie können sie jedoch auch benutzten, um das Layout Ihrer Anwendung über das [Grid](/components/grid/) zu steuern und für [Hidden](/components/hidden/) Komponenten. +The breakpoints are used internally in various components to make them responsive, but you can also take advantage of them for controlling the layout of your application through the [Grid](/components/grid/) component. ## Default breakpoints @@ -12,9 +12,9 @@ Jeder Haltepunkt (ein Schlüssel) stimmt mit einer *festen* Bildschirmbreite (ei - ** xs, ** extraklein: 0px - ** sm, ** klein: 600px -- ** md, ** mittel: 960px -- ** lg, ** groß: 1280px -- ** xl ** extra groß: 1920px +- **md,** medium: 900px +- **lg,** large: 1200px +- **xl,** extra-large: 1536px These values can be [customized](#custom-breakpoints). @@ -46,24 +46,6 @@ Manchmal reicht die Verwendung von CSS nicht aus. Möglicherweise möchten Sie d Weitere Informationen finden Sie auf der [ useMediaQuery](/components/use-media-query/) Seite. -### withWidth() - -> ⚠️ This higher-order component will be deprecated for the [useMediaQuery](/components/use-media-query/) hook. - -```jsx -import withWidth from '@material-ui/core/withWidth'; - -function MyComponent(props) { - return <div>{`Current width: ${props.width}`}</div>; -} - -export default withWidth()(MyComponent); -``` - -Weitere Informationen finden Sie auf der [ useMediaQuery](/components/use-media-query/) Seite. - -{{"demo": "pages/customization/breakpoints/WithWidth.js"}} - ## Custom breakpoints You define your project's breakpoints in the `theme.breakpoints` section of your theme. @@ -80,12 +62,12 @@ const theme = createTheme({ values: { xs: 0, sm: 600, - md: 960, - lg: 1280, - xl: 1920, + md: 900, + lg: 1200, + xl: 1536, }, }, -}) +}); ``` Feel free to have as few or as many breakpoints as you want, naming them in whatever way you'd prefer for your project. @@ -94,9 +76,10 @@ Feel free to have as few or as many breakpoints as you want, naming them in what const theme = createTheme({ breakpoints: { values: { + mobile: 0, tablet: 640, laptop: 1024, - desktop: 1280, + desktop: 1200, }, }, }); @@ -107,14 +90,15 @@ If you are using TypeScript, you would also need to use [module augmentation](/g <!-- Tested with packages/material-ui/test/typescript/breakpointsOverrides.augmentation.tsconfig.json --> ```ts -declare module "@material-ui/core/styles/createBreakpoints" { +declare module '@material-ui/core/styles' { interface BreakpointOverrides { xs: false; // removes the `xs` breakpoint sm: false; md: false; lg: false; xl: false; - tablet: true; // adds the `tablet` breakpoint + mobile: true; // adds the `mobile` breakpoint + tablet: true; laptop: true; desktop: true; } @@ -127,34 +111,7 @@ declare module "@material-ui/core/styles/createBreakpoints" { #### Parameter -1. `key` (*String* | *Number*): Ein Haltepunkteschlüssel (`xs`, `sm`, etc.) oder eine Bildschirmbreite in pixel. - -#### Rückgabewerte - -`media query`: A media query string ready to be used with most styling solutions, which matches screen widths greater than the screen size given by the breakpoint key in the first argument and less than the the screen size given by the breakpoint key in the second argument. - -#### Beispiele - -```js -declare module "@material-ui/core/styles/createBreakpoints" { - interface BreakpointOverrides { - xs: false; // removes the `xs` breakpoint - sm: false; - md: false; - lg: false; - xl: false; - tablet: true; // adds the `tablet` breakpoint - laptop: true; - desktop: true; - } -} -``` - -### `theme.breakpoints.down(key) => media query` - -#### Parameter - -1. `key` (*String* | *Number*): Ein Haltepunkteschlüssel (`xs`, `sm`, etc.) oder eine Bildschirmbreite in pixel. +1. `key` (_string_ | _number_): A breakpoint key (`xs`, `sm`, etc.) or a screen width number in px. #### Rückgabewerte @@ -163,11 +120,11 @@ declare module "@material-ui/core/styles/createBreakpoints" { #### Beispiele ```js -const styles = theme => ({ +const styles = (theme) => ({ root: { backgroundColor: 'blue', // Match [md, ∞) - // [960px, ∞) + // [900px, ∞) [theme.breakpoints.up('md')]: { backgroundColor: 'red', }, @@ -175,11 +132,11 @@ const styles = theme => ({ }); ``` -### `theme.breakpoints.only(key) => media query` +### `theme.breakpoints.down(key) => media query` #### Parameter -1. `key` (*String*): Ein Haltepunkteschlüssel (`xs`, `sm`, etc.). +1. `key` (_string_ | _number_): A breakpoint key (`xs`, `sm`, etc.) or a screen width number in px. #### Rückgabewerte @@ -188,12 +145,11 @@ const styles = theme => ({ #### Beispiele ```js -const styles = theme => ({ +const styles = (theme) => ({ root: { backgroundColor: 'blue', - // Match [0, md + 1) - // [0, lg) - // [0, 1280px) + // Match [0, md) + // [0, 900px) [theme.breakpoints.down('md')]: { backgroundColor: 'red', }, @@ -201,12 +157,11 @@ const styles = theme => ({ }); ``` -### `theme.breakpoints.between(start, end) => media query` +### `theme.breakpoints.only(key) => media query` #### Parameter -1. `start` (*String*): A breakpoint key (`xs`, `sm`, etc.) or a screen width number in pixels. -2. `end` (*String*): A breakpoint key (`xs`, `sm`, etc.) or a screen width number in pixels. +1. `key` (_string_): A breakpoint key (`xs`, `sm`, etc.). #### Rückgabewerte @@ -215,12 +170,12 @@ const styles = theme => ({ #### Beispiele ```js -const styles = theme => ({ +const styles = (theme) => ({ root: { backgroundColor: 'blue', // Match [md, md + 1) // [md, lg) - // [960px, 1280px) + // [900px, 1200px) [theme.breakpoints.only('md')]: { backgroundColor: 'red', }, @@ -228,58 +183,30 @@ const styles = theme => ({ }); ``` -### `withWidth([options]) => higher-order component` - -Injizieren Sie eine `width` Eigenschaft. Die an sie übergebene Komponente wird nicht geändert. Stattdessen wird eine neue Komponente zurückgegeben. Diese `width` Haltepunkt-Eigenschaft entspricht der aktuellen Bildschirmbreite. Es kann einer der folgenden Haltepunkte sein: - -```ts -type Breakpoint = 'xs' | 'sm' | 'md' | 'lg' | 'xl'; -``` - -Einige Implementierungsdetails, die interessant sein könnten: - -- Es leitet *nicht React statisch* Eigenschaften weiter, so dass dieser HOC "transparenter" ist. Es kann zum Beispiel verwendet werden, um eine `getInitialProps()` als statische Methode zu definieren (next.js). +### `theme.breakpoints.between(start, end) => media query` #### Parameter -1. `options` (*Object* [optional]): - -- `options.withTheme` (*Boolean* [optional]): Standardeinstellung ist `false`. Übergeben Sie das `Theme` Objekt als Eigenschaft an die Komponente. -- `options.noSSR` (*Boolean* [optional]): Standardeinstellung ist `false`. Um den serverseitigen Renderingabgleich durchzuführen, muss er zweimal gerendert werden. Ein erstes Mal mit nichts und ein zweites Mal mit den Kind-Elementen. Dieser Zyklus mit zwei Durchgängen ist mit einem Nachteil verbunden. Die Benutzeroberfläche blinkt möglicherweise. Sie können dieses Flag auf `true` setzen, wenn Sie kein serverseitiges Rendering durchführen. -- `options.initialWidth` (*Breakpoint* [optional]): Da `window.innerWidth` auf dem Server nicht verfügbar ist, wird eine leere Komponente während der ersten Mounts standardmäßig gerendert. Vielleicht mögen Sie eine Heuristik verwenden, um annähernd die Bildschirmbreite des Client-Browsers zu bestimmen. Sie könnten beispielsweise den Benutzeragenten oder die Client-Hinweise verwenden. Um die Anfangsbreite festzulegen, müssen wir eine benutzerdefinierte Eigenschaft mit dieser Form übergeben: Mit https://caniuse.com/#search=client%20hint, können wir die anfängliche Breite global festlegen, indem Sie die [`benutzerdefinierten Eigenschaften`](/customization/theme-components/#default-props) zum Theme verwenden. - -```js -const theme = createTheme({ - props: { - // withWidth Komponente ⚛️ - MuiWithWidth: { - // Initiale Breite - initialWidth: 'lg', // Haltepunkte ist global gesetzt 🌎! - }, - }, -}); -``` - -- `options.resizeInterval` (*Number* [optional]): Der Standardwert ist 166, entspricht 10 Bildern bei 60 Hz. Anzahl der Millisekunden, die gewartet werden muss, bevor auf ein Ereignis zur Größenänderung des Bildschirms reagiert wird. +1. `start` (_string_): A breakpoint key (`xs`, `sm`, etc.) or a screen width number in px. +2. `end` (_string_): A breakpoint key (`xs`, `sm`, etc.) or a screen width number in px. #### Rückgabewerte -`Komponente höherer Ordnung`: Sollte zum Umwickeln einer Komponente verwendet werden. +`media query`: A media query string ready to be used with most styling solutions, which matches screen widths greater than the screen size given by the breakpoint key in the first argument and less than the the screen size given by the breakpoint key in the second argument. #### Beispiele -```jsx -import withWidth, { isWidthUp } from '@material-ui/core/withWidth'; - -function MyComponent(props) { - if (isWidthUp('sm', props.width)) { - return <span /> - } - - return <div />; -} - -export default withWidth()(MyComponent); +```js +const styles = (theme) => ({ + root: { + backgroundColor: 'blue', + // Match [sm, md) + // [600px, 900px) + [theme.breakpoints.between('sm', 'md')]: { + backgroundColor: 'red', + }, + }, +}); ``` ## Default values diff --git a/docs/src/pages/customization/breakpoints/breakpoints-es.md b/docs/src/pages/customization/breakpoints/breakpoints-es.md index b9998bae529e35..8d4cd7154066db 100644 --- a/docs/src/pages/customization/breakpoints/breakpoints-es.md +++ b/docs/src/pages/customization/breakpoints/breakpoints-es.md @@ -4,7 +4,7 @@ Para una optima experiencia de usuario, las interfaces de material design necesitan ser capaces de adaptar su layout a varias separaciones. Material-UI usa una implementación **simplificada** de la [especificación](https://material.io/design/layout/responsive-layout-grid.html#breakpoints) original. -Las separaciones son usadas internamente en varios componentes para hacerlos responsive, pero también puede tomar ventaja de ellos para controlar el layout de su aplicación mediante los componentes [Grid](/components/grid/) y [Hidden](/components/hidden/). +The breakpoints are used internally in various components to make them responsive, but you can also take advantage of them for controlling the layout of your application through the [Grid](/components/grid/) component. ## Default breakpoints @@ -12,9 +12,9 @@ Cada separación (una llave) coincide con el ancho de pantalla *fijo* (un valor) - **xs** extra-pequeño: 0px - **sm** pequeño: 600px -- **md,** mediano: 960px -- **lg,** grande: 1280px -- **xl** extra-grande: 1920px +- **md,** medium: 900px +- **lg,** large: 1200px +- **xl,** extra-large: 1536px These values can be [customized](#custom-breakpoints). @@ -46,24 +46,6 @@ Sometimes, using CSS isn't enough. You might want to change the React rendering You can learn more on the [useMediaQuery](/components/use-media-query/) page. -### withWidth() - -> ⚠️ This higher-order component will be deprecated for the [useMediaQuery](/components/use-media-query/) hook. - -```jsx -import withWidth from '@material-ui/core/withWidth'; - -function MyComponent(props) { - return <div>{`Current width: ${props.width}`}</div>; -} - -export default withWidth()(MyComponent); -``` - -In the following demo, we change the rendered DOM element (*em*, <u>u</u>, ~~del~~ & span) based on the screen width. - -{{"demo": "pages/customization/breakpoints/WithWidth.js"}} - ## Custom breakpoints You define your project's breakpoints in the `theme.breakpoints` section of your theme. @@ -80,12 +62,12 @@ const theme = createTheme({ values: { xs: 0, sm: 600, - md: 960, - lg: 1280, - xl: 1920, + md: 900, + lg: 1200, + xl: 1536, }, }, -}) +}); ``` Feel free to have as few or as many breakpoints as you want, naming them in whatever way you'd prefer for your project. @@ -94,9 +76,10 @@ Feel free to have as few or as many breakpoints as you want, naming them in what const theme = createTheme({ breakpoints: { values: { + mobile: 0, tablet: 640, laptop: 1024, - desktop: 1280, + desktop: 1200, }, }, }); @@ -107,14 +90,15 @@ If you are using TypeScript, you would also need to use [module augmentation](/g <!-- Tested with packages/material-ui/test/typescript/breakpointsOverrides.augmentation.tsconfig.json --> ```ts -declare module "@material-ui/core/styles/createBreakpoints" { +declare module '@material-ui/core/styles' { interface BreakpointOverrides { xs: false; // removes the `xs` breakpoint sm: false; md: false; lg: false; xl: false; - tablet: true; // adds the `tablet` breakpoint + mobile: true; // adds the `mobile` breakpoint + tablet: true; laptop: true; desktop: true; } @@ -127,34 +111,7 @@ declare module "@material-ui/core/styles/createBreakpoints" { #### Argumentos -1. `key` (*String* | *Number*): A breakpoint key (`xs`, `sm`, etc.) or a screen width number in pixels. - -#### Regresa - -`media query`: A media query string ready to be used with most styling solutions, which matches screen widths greater than the screen size given by the breakpoint key in the first argument and less than the the screen size given by the breakpoint key in the second argument. - -#### Ejemplos - -```js -declare module "@material-ui/core/styles/createBreakpoints" { - interface BreakpointOverrides { - xs: false; // removes the `xs` breakpoint - sm: false; - md: false; - lg: false; - xl: false; - tablet: true; // adds the `tablet` breakpoint - laptop: true; - desktop: true; - } -} -``` - -### `theme.breakpoints.down(key) => media query` - -#### Argumentos - -1. `key` (*String* | *Number*): A breakpoint key (`xs`, `sm`, etc.) or a screen width number in pixels. +1. `key` (_string_ | _number_): A breakpoint key (`xs`, `sm`, etc.) or a screen width number in px. #### Regresa @@ -163,11 +120,11 @@ declare module "@material-ui/core/styles/createBreakpoints" { #### Ejemplos ```js -const styles = theme => ({ +const styles = (theme) => ({ root: { backgroundColor: 'blue', // Match [md, ∞) - // [960px, ∞) + // [900px, ∞) [theme.breakpoints.up('md')]: { backgroundColor: 'red', }, @@ -175,11 +132,11 @@ const styles = theme => ({ }); ``` -### `theme.breakpoints.only(key) => media query` +### `theme.breakpoints.down(key) => media query` #### Argumentos -1. `key` (*String*): A breakpoint key (`xs`, `sm`, etc.). +1. `key` (_string_ | _number_): A breakpoint key (`xs`, `sm`, etc.) or a screen width number in px. #### Regresa @@ -188,12 +145,11 @@ const styles = theme => ({ #### Ejemplos ```js -const styles = theme => ({ +const styles = (theme) => ({ root: { backgroundColor: 'blue', - // Match [0, md + 1) - // [0, lg) - // [0, 1280px) + // Match [0, md) + // [0, 900px) [theme.breakpoints.down('md')]: { backgroundColor: 'red', }, @@ -201,12 +157,11 @@ const styles = theme => ({ }); ``` -### `theme.breakpoints.between(start, end) => media query` +### `theme.breakpoints.only(key) => media query` #### Argumentos -1. `start` (*String*): A breakpoint key (`xs`, `sm`, etc.) or a screen width number in pixels. -2. `end` (*String*): A breakpoint key (`xs`, `sm`, etc.) or a screen width number in pixels. +1. `key` (_string_): A breakpoint key (`xs`, `sm`, etc.). #### Regresa @@ -215,12 +170,12 @@ const styles = theme => ({ #### Ejemplos ```js -const styles = theme => ({ +const styles = (theme) => ({ root: { backgroundColor: 'blue', // Match [md, md + 1) // [md, lg) - // [960px, 1280px) + // [900px, 1200px) [theme.breakpoints.only('md')]: { backgroundColor: 'red', }, @@ -228,65 +183,27 @@ const styles = theme => ({ }); ``` -### `withWidth([options]) => higher-order component` - -Inject a `width` property. It does not modify the component passed to it; instead, it returns a new component. This `width` breakpoint property match the current screen width. It can be one of the following breakpoints: - -```ts -type Breakpoint = 'xs' | 'sm' | 'md' | 'lg' | 'xl'; -``` - -Some implementation details that might be interesting to being aware of: - -- It forwards *non React static* properties so this HOC is more "transparent". For instance, it can be used to defined a `getInitialProps()` static method (next.js). +### `theme.breakpoints.between(start, end) => media query` #### Argumentos -1. `options` (*Object* [optional]): - -- `options.withTheme` (*Boolean* [optional]): Default `false`. Provide the `theme` object to the component as a property. -- `options.noSSR` (*Boolean* [optional]): Default `false`. In order to perform the server-side rendering reconciliation, it needs to render twice. A first time with nothing and a second time with the children. This double pass rendering cycle comes with a drawback. The UI might blink. You can set this flag to `true` if you are not doing server-side rendering. -- `options.initialWidth` (*Breakpoint* [optional]): As `window.innerWidth` is unavailable on the server, we default to rendering an empty component during the first mount. You might want to use an heuristic to approximate the screen width of the client browser screen width. For instance, you could be using the user-agent or the client-hints. In order to set the initialWidth we need to pass a custom property with this shape: https://caniuse.com/#search=client%20hint, we also can set the initial width globally using [`custom properties`](/customization/theme-components/#default-props) on the theme. - -```js -const theme = createTheme({ - props: { - // withWidth component ⚛️ - MuiWithWidth: { - // Initial width property - initialWidth: 'lg', // Breakpoint being globally set 🌎! - }, - }, -}); - }, - }, - }, -}); - Infinity, -+ }), - ] - } -``` - -- `options.resizeInterval` (*Number* [optional]): Defaults to 166, corresponds to 10 frames at 60 Hz. Number of milliseconds to wait before responding to a screen resize event. +1. `start` (_string_): A breakpoint key (`xs`, `sm`, etc.) or a screen width number in px. +2. `end` (_string_): A breakpoint key (`xs`, `sm`, etc.) or a screen width number in px. #### Regresa -`higher-order component`: Should be used to wrap a component. +`media query`: A media query string ready to be used with most styling solutions, which matches screen widths greater than the screen size given by the breakpoint key in the first argument and less than the the screen size given by the breakpoint key in the second argument. #### Ejemplos -```jsx -const theme = createTheme({ - props: { - // withWidth component ⚛️ - MuiWithWidth: { - // Initial width property - initialWidth: 'lg', // Breakpoint being globally set 🌎! - }, - }, -}); - }, +```js +const styles = (theme) => ({ + root: { + backgroundColor: 'blue', + // Match [sm, md) + // [600px, 900px) + [theme.breakpoints.between('sm', 'md')]: { + backgroundColor: 'red', }, }, }); diff --git a/docs/src/pages/customization/breakpoints/breakpoints-fr.md b/docs/src/pages/customization/breakpoints/breakpoints-fr.md index 89d0d86ce2a4b4..2034a897c441a8 100644 --- a/docs/src/pages/customization/breakpoints/breakpoints-fr.md +++ b/docs/src/pages/customization/breakpoints/breakpoints-fr.md @@ -2,19 +2,19 @@ <p class="description">API that enables the use of breakpoints in a wide variety of contexts.</p> -For optimal user experience, material design interfaces need to be able to adapt their layout at various breakpoints. Material-UI uses a **simplified** implementation of the original [specification](https://material.io/design/layout/responsive-layout-grid.html#breakpoints). +For optimal user experience, material design interfaces need to be able to adapt their layout at various breakpoints. Material-UI utilise une implémentation **simplifiée** de la [spécification](https://material.io/design/layout/responsive-layout-grid.html#breakpoints) d'origine The breakpoints are used internally in various components to make them responsive, but you can also take advantage of them for controlling the layout of your application through the [Grid](/components/grid/) and [Hidden](/components/hidden/) components. ## Default breakpoints -Each breakpoint (a key) matches with a *fixed* screen width (a value): +Chaque point d'arrêt (une clé) correspond à une largeur d'écran _fixe_ (une valeur) : - **xs,** extra-small: 0px - **sm,** small: 600px -- **md,** medium: 960px -- **lg,** large: 1280px -- **xl,** extra-large: 1920px +- **md,** medium: 900px +- **lg,** large: 1200px +- **xl,** extra-large: 1536px These values can be [customized](#custom-breakpoints). @@ -46,24 +46,6 @@ Sometimes, using CSS isn't enough. You might want to change the React rendering You can learn more on the [useMediaQuery](/components/use-media-query/) page. -### withWidth() - -> ⚠️ This higher-order component will be deprecated for the [useMediaQuery](/components/use-media-query/) hook. - -```jsx -import withWidth from '@material-ui/core/withWidth'; - -function MyComponent(props) { - return <div>{`Current width: ${props.width}`}</div>; -} - -export default withWidth()(MyComponent); -``` - -In the following demo, we change the rendered DOM element (*em*, <u>u</u>, ~~del~~ & span) based on the screen width. - -{{"demo": "pages/customization/breakpoints/WithWidth.js"}} - ## Custom breakpoints You define your project's breakpoints in the `theme.breakpoints` section of your theme. @@ -80,12 +62,12 @@ const theme = createTheme({ values: { xs: 0, sm: 600, - md: 960, - lg: 1280, - xl: 1920, + md: 900, + lg: 1200, + xl: 1536, }, }, -}) +}); ``` Feel free to have as few or as many breakpoints as you want, naming them in whatever way you'd prefer for your project. @@ -94,12 +76,14 @@ Feel free to have as few or as many breakpoints as you want, naming them in what const theme = createTheme({ breakpoints: { values: { - tablet: 640, - laptop: 1024, - desktop: 1280, + xs: 0, + sm: 600, + md: 960, + lg: 1200, + xl: 1920, }, }, -}); +}) ``` If you are using TypeScript, you would also need to use [module augmentation](/guides/typescript/#customization-of-theme) for the theme to accept the above values. @@ -107,18 +91,15 @@ If you are using TypeScript, you would also need to use [module augmentation](/g <!-- Tested with packages/material-ui/test/typescript/breakpointsOverrides.augmentation.tsconfig.json --> ```ts -declare module "@material-ui/core/styles/createBreakpoints" { - interface BreakpointOverrides { - xs: false; // removes the `xs` breakpoint - sm: false; - md: false; - lg: false; - xl: false; - tablet: true; // adds the `tablet` breakpoint - laptop: true; - desktop: true; - } -} +const theme = createTheme({ + breakpoints: { + values: { + tablet: 640, + laptop: 1024, + desktop: 1280, + }, + }, +}); ``` ## API @@ -131,23 +112,21 @@ declare module "@material-ui/core/styles/createBreakpoints" { #### Valeur de retour -`media query`: A media query string ready to be used with most styling solutions, which matches screen widths greater than the screen size given by the breakpoint key in the first argument and less than the the screen size given by the breakpoint key in the second argument. +`media query`: A media query string ready to be used with most styling solutions, which matches screen widths including the screen size given by the breakpoint key. #### Exemples ```js -declare module "@material-ui/core/styles/createBreakpoints" { - interface BreakpointOverrides { - xs: false; // removes the `xs` breakpoint - sm: false; - md: false; - lg: false; - xl: false; - tablet: true; // adds the `tablet` breakpoint - laptop: true; - desktop: true; - } -} +const styles = (theme) => ({ + root: { + backgroundColor: 'blue', + // Match [md, ∞) + // [900px, ∞) + [theme.breakpoints.up('md')]: { + backgroundColor: 'red', + }, + }, +}); ``` ### `theme.breakpoints.down(key) => media query` @@ -158,17 +137,17 @@ declare module "@material-ui/core/styles/createBreakpoints" { #### Valeur de retour -`media query`: A media query string ready to be used with most styling solutions, which matches screen widths greater than and including the screen size given by the breakpoint key. +`media query`: A media query string ready to be used with most styling solutions, which matches screen widths less than and including the screen size given by the breakpoint key. #### Exemples ```js -const styles = theme => ({ +const styles = (theme) => ({ root: { backgroundColor: 'blue', - // Match [md, ∞) - // [960px, ∞) - [theme.breakpoints.up('md')]: { + // Match [0, md) + // [0, 900px) + [theme.breakpoints.down('md')]: { backgroundColor: 'red', }, }, @@ -183,18 +162,18 @@ const styles = theme => ({ #### Valeur de retour -`media query`: A media query string ready to be used with most styling solutions, which matches screen widths less than and including the screen size given by the breakpoint key. +`media query`: A media query string ready to be used with most styling solutions, which matches screen widths greater than the screen size given by the breakpoint key in the first argument and less than the the screen size given by the breakpoint key in the second argument. #### Exemples ```js -const styles = theme => ({ +const styles = (theme) => ({ root: { backgroundColor: 'blue', - // Match [0, md + 1) - // [0, lg) - // [0, 1280px) - [theme.breakpoints.down('md')]: { + // Match [md, md + 1) + // [md, lg) + // [900px, 1200px) + [theme.breakpoints.only('md')]: { backgroundColor: 'red', }, }, @@ -210,78 +189,23 @@ const styles = theme => ({ #### Valeur de retour -`media query`: A media query string ready to be used with most styling solutions, which matches screen widths including the screen size given by the breakpoint key. +`media query`: A media query string ready to be used with most styling solutions, which matches screen widths greater than and including the screen size given by the breakpoint key. #### Exemples ```js -const styles = theme => ({ +const styles = (theme) => ({ root: { backgroundColor: 'blue', - // Match [md, md + 1) - // [md, lg) - // [960px, 1280px) - [theme.breakpoints.only('md')]: { + // Match [sm, md) + // [600px, 900px) + [theme.breakpoints.between('sm', 'md')]: { backgroundColor: 'red', }, }, }); ``` -### `withWidth([options]) => higher-order component` - -Inject a `width` property. It does not modify the component passed to it; instead, it returns a new component. This `width` breakpoint property match the current screen width. It can be one of the following breakpoints: - -```ts -type Breakpoint = 'xs' | 'sm' | 'md' | 'lg' | 'xl'; -``` - -Some implementation details that might be interesting to being aware of: - -- It forwards *non React static* properties so this HOC is more "transparent". For instance, it can be used to defined a `getInitialProps()` static method (next.js). - -#### Paramètres - -1. `options` (*Object* [optional]): - -- `options.withTheme` (*Boolean* [optional]): Valeur par défaut `false`. Provide the `theme` object to the component as a property. -- `options.noSSR` (*Boolean* [optional]): Valeur par défaut `false`. In order to perform the server-side rendering reconciliation, it needs to render twice. A first time with nothing and a second time with the children. This double pass rendering cycle comes with a drawback. The UI might blink. You can set this flag to `true` if you are not doing server-side rendering. -- `options.initialWidth` (*Breakpoint* [optional]): As `window.innerWidth` is unavailable on the server, we default to rendering an empty component during the first mount. You might want to use an heuristic to approximate the screen width of the client browser screen width. For instance, you could be using the user-agent or the client-hints. In order to set the initialWidth we need to pass a custom property with this shape: https://caniuse.com/#search=client%20hint, we also can set the initial width globally using [`custom properties`](/customization/theme-components/#default-props) on the theme. - -```js -const theme = createTheme({ - props: { - // withWidth component ⚛️ - MuiWithWidth: { - // Initial width property - initialWidth: 'lg', // Breakpoint being globally set 🌎! - }, - }, -}); -``` - -- `options.resizeInterval` (*Number* [optional]): Defaults to 166, corresponds to 10 frames at 60 Hz. Number of milliseconds to wait before responding to a screen resize event. - -#### Valeur de retour - -`higher-order component`: Should be used to wrap a component. - -#### Exemples - -```jsx -import withWidth, { isWidthUp } from '@material-ui/core/withWidth'; - -function MyComponent(props) { - if (isWidthUp('sm', props.width)) { - return <span /> - } - - return <div />; -} - -export default withWidth()(MyComponent); -``` - ## Default values You can explore the default values of the breakpoints using [the theme explorer](/customization/default-theme/?expand-path=$.breakpoints) or by opening the dev tools console on this page (`window.theme.breakpoints`). diff --git a/docs/src/pages/customization/breakpoints/breakpoints-ja.md b/docs/src/pages/customization/breakpoints/breakpoints-ja.md index 966ce8d073ff81..b025f23665999d 100644 --- a/docs/src/pages/customization/breakpoints/breakpoints-ja.md +++ b/docs/src/pages/customization/breakpoints/breakpoints-ja.md @@ -2,9 +2,9 @@ <p class="description">さまざまなコンテキストでブレークポイントを使用できるようにするAPI。</p> -最適なユーザーエクスペリエンスを得るには、material designインターフェイスがさまざまなブレークポイントでレイアウトを調整できる必要があります。 最適なユーザーエクスペリエンスを得るには、material designインターフェイスがさまざまなブレークポイントでレイアウトを調整できる必要があります。 最適なユーザーエクスペリエンスを得るには、material designインターフェイスがさまざまなブレークポイントでレイアウトを調整できる必要があります。 Material-UIは、元の仕様の**簡易**[実装](https://material.io/design/layout/responsive-layout-grid.html#breakpoints)を使用します。 Material-UIは、元の仕様の**簡易**[実装](https://material.io/design/layout/responsive-layout-grid.html#breakpoints)を使用します。 +最適なユーザーエクスペリエンスを得るには、material designインターフェイスがさまざまなブレークポイントでレイアウトを調整できる必要があります。 Material-UIは、元の仕様の**簡易**[実装](https://material.io/design/layout/responsive-layout-grid.html#breakpoints)を使用します。 -ブレークポイントは、さまざまなコンポーネントで応答性を高めるために内部的に使用されますが、[Grid](/components/grid/)および[Hidden](/components/hidden/)コンポーネントを使用してアプリケーションのレイアウトを制御する場合にも利用できます。 +The breakpoints are used internally in various components to make them responsive, but you can also take advantage of them for controlling the layout of your application through the [Grid](/components/grid/) component. ## Default breakpoints @@ -12,9 +12,9 @@ - **xs,** extra-small: 0px - **sm,** small: 600px -- **md,** medium: 960px -- **lg,** large: 1280px -- **xl,** extra-large: 1920px +- **md,** medium: 900px +- **lg,** large: 1200px +- **xl,** extra-large: 1536px These values can be [customized](#custom-breakpoints). @@ -46,24 +46,6 @@ CSSだけでは不十分な場合もあります。 CSSだけでは不十分な 詳細については、 [useMediaQuery](/components/use-media-query/) ページを参照してください。 -### withWidth() - -> ⚠️この高次コンポーネントは、[ useMediaQueryフック](/components/use-media-query/)では非推奨になります。 - -```jsx -import withWidth from '@material-ui/core/withWidth'; - -function MyComponent(props) { - return <div>{`Current width: ${props.width}`}</div>; -} - -export default withWidth()(MyComponent); -``` - -詳細については、 [useMediaQuery](/components/use-media-query/) ページを参照してください。 - -{{"demo": "pages/customization/breakpoints/WithWidth.js"}} - ## Custom breakpoints You define your project's breakpoints in the `theme.breakpoints` section of your theme. @@ -80,12 +62,12 @@ const theme = createTheme({ values: { xs: 0, sm: 600, - md: 960, - lg: 1280, - xl: 1920, + md: 900, + lg: 1200, + xl: 1536, }, }, -}) +}); ``` Feel free to have as few or as many breakpoints as you want, naming them in whatever way you'd prefer for your project. @@ -94,9 +76,10 @@ Feel free to have as few or as many breakpoints as you want, naming them in what const theme = createTheme({ breakpoints: { values: { + mobile: 0, tablet: 640, laptop: 1024, - desktop: 1280, + desktop: 1200, }, }, }); @@ -107,14 +90,15 @@ If you are using TypeScript, you would also need to use [module augmentation](/g <!-- Tested with packages/material-ui/test/typescript/breakpointsOverrides.augmentation.tsconfig.json --> ```ts -declare module "@material-ui/core/styles/createBreakpoints" { +declare module '@material-ui/core/styles' { interface BreakpointOverrides { xs: false; // removes the `xs` breakpoint sm: false; md: false; lg: false; xl: false; - tablet: true; // adds the `tablet` breakpoint + mobile: true; // adds the `mobile` breakpoint + tablet: true; laptop: true; desktop: true; } @@ -127,34 +111,7 @@ declare module "@material-ui/core/styles/createBreakpoints" { #### 引数 -1. `key` (*String* | *Number*):ブレークポイントキー(`xs` 、`sm`など)またはピクセル単位の画面幅の数値。 - -#### 戻り値 - -`media query`: A media query string ready to be used with most styling solutions, which matches screen widths greater than the screen size given by the breakpoint key in the first argument and less than the the screen size given by the breakpoint key in the second argument. - -#### 例 - -```js -declare module "@material-ui/core/styles/createBreakpoints" { - interface BreakpointOverrides { - xs: false; // removes the `xs` breakpoint - sm: false; - md: false; - lg: false; - xl: false; - tablet: true; // adds the `tablet` breakpoint - laptop: true; - desktop: true; - } -} -``` - -### `theme.breakpoints.down(key) => media query` - -#### 引数 - -1. `key` (*String* | *Number*):ブレークポイントキー(`xs` 、`sm`など)またはピクセル単位の画面幅の数値。 +1. `key` (_string_ | _number_): A breakpoint key (`xs`, `sm`, etc.) or a screen width number in px. #### 戻り値 @@ -163,11 +120,11 @@ declare module "@material-ui/core/styles/createBreakpoints" { #### 例 ```js -const styles = theme => ({ +const styles = (theme) => ({ root: { backgroundColor: 'blue', // Match [md, ∞) - // [960px, ∞) + // [900px, ∞) [theme.breakpoints.up('md')]: { backgroundColor: 'red', }, @@ -175,11 +132,11 @@ const styles = theme => ({ }); ``` -### `theme.breakpoints.only(key) => media query` +### `theme.breakpoints.down(key) => media query` #### 引数 -1. `key` (*String*):ブレークポイントキー(`xs` 、`sm`など)。 +1. `key` (_string_ | _number_): A breakpoint key (`xs`, `sm`, etc.) or a screen width number in px. #### 戻り値 @@ -188,12 +145,11 @@ const styles = theme => ({ #### 例 ```js -const styles = theme => ({ +const styles = (theme) => ({ root: { backgroundColor: 'blue', - // Match [0, md + 1) - // [0, lg) - // [0, 1280px) + // Match [0, md) + // [0, 900px) [theme.breakpoints.down('md')]: { backgroundColor: 'red', }, @@ -201,12 +157,11 @@ const styles = theme => ({ }); ``` -### `theme.breakpoints.between(start, end) => media query` +### `theme.breakpoints.only(key) => media query` #### 引数 -1. `start` (*String*): A breakpoint key (`xs`, `sm`, etc.) or a screen width number in pixels. -2. `end` (*String*): A breakpoint key (`xs`, `sm`, etc.) or a screen width number in pixels. +1. `key` (_string_): A breakpoint key (`xs`, `sm`, etc.). #### 戻り値 @@ -215,12 +170,12 @@ const styles = theme => ({ #### 例 ```js -const styles = theme => ({ +const styles = (theme) => ({ root: { backgroundColor: 'blue', // Match [md, md + 1) // [md, lg) - // [960px, 1280px) + // [900px, 1200px) [theme.breakpoints.only('md')]: { backgroundColor: 'red', }, @@ -228,59 +183,30 @@ const styles = theme => ({ }); ``` -### `withWidth([options]) => higher-order component` - -`width`プロパティを挿入します。 渡されたコンポーネントは変更されません。; 代わりに、新しいコンポーネントを返します。 この`width`ブレークポイントのプロパティは、現在の画面の幅に一致します。 次のブレークポイントのいずれかです。 - -```ts -type Breakpoint = 'xs' | 'sm' | 'md' | 'lg' | 'xl'; -``` - -注意が必要な実装の詳細は、次のとおりです。 - -- *non React static* プロパティを転送するので、このHOCはより「透明」です。 たとえば、`getInitialProps()`静的メソッド (next.js) を定義するために使用できます。 +### `theme.breakpoints.between(start, end) => media query` #### 引数 -1. `オプション` (*オプジェクト* [任意]): - -- `options.withTheme` (*ブール値* [任意]): デフォルト値 `false`. `theme`オブジェクトをプロパティとしてコンポーネントに提供します。 -- `options.noSSR` (*ブール値* [任意]): デフォルト値 `false`. サーバー側のレンダリング調整を実行するには、2回レンダリングする必要があります。 1回目は何もない状態で、2回目は子要素と一緒です。 このダブルパスレンダリングサイクルには欠点があります。 UIが点滅することがあります。 サーバサイドレンダリングを実行しない場合は、このフラグを`true`に設定できます。 -- `options.initialWidth` (*Breakpoint* [optional]): As `window.innerWidth`サーバーでは使用できません デフォルトでは、最初のマウント時に空のコンポーネントがレンダリングされます。 クライアント・ブラウザの画面幅。 たとえば、ユーザーエージェントまたはクライアントヒントを使用できます。 InitialWidthを設定するには、この形状のカスタムプロパティを渡す必要があります。 https://caniuse.com/#search=client%20hint、[`テーマにカスタムプロパティを使用して初期幅 -グローバルに設定することもできます`](/customization/theme-components/#default-props)。 - -```js -const theme = createTheme({ - props: { - // withWidth component ⚛️ - MuiWithWidth: { - // Initial width property - initialWidth: 'lg', // Breakpoint being globally set 🌎! - }, - }, -}); -``` - -- `options.resizeInterval` (*Number* [optional]): 既定は166で、60Hzで10フレームに対応します。 画面サイズ変更イベントに応答するまでに待機するミリ秒数。 +1. `start` (_string_): A breakpoint key (`xs`, `sm`, etc.) or a screen width number in px. +2. `end` (_string_): A breakpoint key (`xs`, `sm`, etc.) or a screen width number in px. #### 戻り値 -注意が必要な実装の詳細は、次のとおりです。 +`media query`: A media query string ready to be used with most styling solutions, which matches screen widths greater than the screen size given by the breakpoint key in the first argument and less than the the screen size given by the breakpoint key in the second argument. #### 例 -```jsx -import withWidth, { isWidthUp } from '@material-ui/core/withWidth'; - -function MyComponent(props) { - if (isWidthUp('sm', props.width)) { - return <span /> - } - - return <div />; -} - -export default withWidth()(MyComponent); +```js +const styles = (theme) => ({ + root: { + backgroundColor: 'blue', + // Match [sm, md) + // [600px, 900px) + [theme.breakpoints.between('sm', 'md')]: { + backgroundColor: 'red', + }, + }, +}); ``` ## デフォルト値 diff --git a/docs/src/pages/customization/breakpoints/breakpoints-pt.md b/docs/src/pages/customization/breakpoints/breakpoints-pt.md index c44fed4475a687..15840561497e65 100644 --- a/docs/src/pages/customization/breakpoints/breakpoints-pt.md +++ b/docs/src/pages/customization/breakpoints/breakpoints-pt.md @@ -4,7 +4,7 @@ Para uma experiência de usuário ideal, as interfaces do material design precisam adaptar seu leiaute em vários pontos de quebra. Material-UI usa uma implementação **simplificada** da [especificação](https://material.io/design/layout/responsive-layout-grid.html#breakpoints) original. -Os pontos de quebra são usados internamente em vários componentes para torná-los responsivos, mas você também pode tirar proveito deles para controlar o leiaute da sua aplicação através do componente [Grade](/components/grid/) e [Hidden](/components/hidden/). +The breakpoints are used internally in various components to make them responsive, but you can also take advantage of them for controlling the layout of your application through the [Grid](/components/grid/) component. ## Pontos de quebra padrão @@ -12,9 +12,9 @@ Cada ponto de quebra (uma chave) corresponde a uma largura de tela *fixa* (um va - **xs,** extra-pequeno: 0px - **sm,** pequeno: 600px -- **md,** médio: 960px -- **lg,** grande: 1280px -- **xl,** extra-grande: 1920px +- **md,** medium: 900px +- **lg,** large: 1200px +- **xl,** extra-large: 1536px Esses valores podem ser [customizados](#custom-breakpoints). @@ -46,24 +46,6 @@ range | xs | sm | md | lg | xl Você pode aprender mais na página [useMediaQuery](/components/use-media-query/). -### withWidth() - -> ⚠️ Esse componente de ordem superior será descontinuado para o hook [useMediaQuery](/components/use-media-query/). - -```jsx -import withWidth from '@material-ui/core/withWidth'; - -function MyComponent(props) { - return <div>{`Largura atual: ${props.width}`}</div>; -} - -export default withWidth()(MyComponent); -``` - -Você pode aprender mais na página [useMediaQuery](/components/use-media-query/). - -{{"demo": "pages/customization/breakpoints/WithWidth.js"}} - ## Pontos de quebra customizados Você define os pontos de quebra do seu projeto na seção `theme.breakpoints` do seu tema. @@ -75,13 +57,17 @@ Você define os pontos de quebra do seu projeto na seção `theme.breakpoints` d Se você alterar os valores dos pontos de quebra padrão, você precisará fornecer novos conforme descreveremos: ```jsx -import withWidth from '@material-ui/core/withWidth'; - -function MyComponent(props) { - return <div>{`Largura atual: ${props.width}`}</div>; -} - -export default withWidth()(MyComponent); +const theme = createTheme({ + breakpoints: { + values: { + xs: 0, + sm: 600, + md: 900, + lg: 1200, + xl: 1536, + }, + }, +}); ``` Sinta-se à vontade para ter quantos pontos de quebra você quiser, nomeando-os da maneira que preferir para o seu projeto. @@ -90,9 +76,10 @@ Sinta-se à vontade para ter quantos pontos de quebra você quiser, nomeando-os const theme = createTheme({ breakpoints: { values: { + mobile: 0, tablet: 640, laptop: 1024, - desktop: 1280, + desktop: 1200, }, }, }); @@ -103,14 +90,15 @@ Se você estiver usando TypeScript, você também deverá usar a [extensão de m <!-- Tested with packages/material-ui/test/typescript/breakpointsOverrides.augmentation.tsconfig.json --> ```ts -declare module "@material-ui/core/styles/createBreakpoints" { +declare module '@material-ui/core/styles' { interface BreakpointOverrides { xs: false; // removes the `xs` breakpoint sm: false; md: false; lg: false; xl: false; - tablet: true; // adds the `tablet` breakpoint + mobile: true; // adds the `mobile` breakpoint + tablet: true; laptop: true; desktop: true; } @@ -123,34 +111,7 @@ declare module "@material-ui/core/styles/createBreakpoints" { #### Argumentos -1. `key` (*String* | *Number*): Uma chave de ponto de quebra (`xs`, `sm`, etc.) ou um número de largura de tela em pixels. - -#### Retornos - -Se você estiver usando TypeScript, você também deverá usar a [extensão de módulos](/guides/typescript/#customization-of-theme) para que o tema aceite os valores acima. - -#### Exemplos - -```js -declare module "@material-ui/core/styles/createBreakpoints" { - interface BreakpointOverrides { - xs: false; // removes the `xs` breakpoint - sm: false; - md: false; - lg: false; - xl: false; - tablet: true; // adds the `tablet` breakpoint - laptop: true; - desktop: true; - } -} -``` - -### `theme.breakpoints.down(key) => media query` - -#### Argumentos - -1. `key` (*String* | *Number*): Uma chave de ponto de quebra (`xs`, `sm`, etc.) ou um número de largura de tela em pixels. +1. `key` (_string_ | _number_): A breakpoint key (`xs`, `sm`, etc.) or a screen width number in px. #### Retornos @@ -159,11 +120,11 @@ declare module "@material-ui/core/styles/createBreakpoints" { #### Exemplos ```js -const styles = theme => ({ +const styles = (theme) => ({ root: { backgroundColor: 'blue', // Match [md, ∞) - // [960px, ∞) + // [900px, ∞) [theme.breakpoints.up('md')]: { backgroundColor: 'red', }, @@ -171,11 +132,11 @@ const styles = theme => ({ }); ``` -### `theme.breakpoints.only(key) => media query` +### `theme.breakpoints.down(key) => media query` #### Argumentos -1. `key` (*String*): Uma chave de ponto de quebra (`xs`, `sm`, etc.). +1. `key` (_string_ | _number_): A breakpoint key (`xs`, `sm`, etc.) or a screen width number in px. #### Retornos @@ -184,12 +145,11 @@ const styles = theme => ({ #### Exemplos ```js -const styles = theme => ({ +const styles = (theme) => ({ root: { backgroundColor: 'blue', - // Match [0, md + 1) - // [0, lg) - // [0, 1280px) + // Match [0, md) + // [0, 900px) [theme.breakpoints.down('md')]: { backgroundColor: 'red', }, @@ -197,12 +157,11 @@ const styles = theme => ({ }); ``` -### `theme.breakpoints.between(start, end) => media query` +### `theme.breakpoints.only(key) => media query` #### Argumentos -1. `start` (*String*): Uma chave de ponto de quebra (`xs`, `sm`, etc.) ou um número de largura de tela em pixels. -2. `end` (*String*): Uma chave de ponto de quebra (`xs`, `sm`, etc.) ou um número de largura de tela em pixels. +1. `key` (_string_): A breakpoint key (`xs`, `sm`, etc.). #### Retornos @@ -211,12 +170,12 @@ const styles = theme => ({ #### Exemplos ```js -const styles = theme => ({ +const styles = (theme) => ({ root: { backgroundColor: 'blue', // Match [md, md + 1) // [md, lg) - // [960px, 1280px) + // [900px, 1200px) [theme.breakpoints.only('md')]: { backgroundColor: 'red', }, @@ -224,58 +183,30 @@ const styles = theme => ({ }); ``` -### `withWidth([options]) => higher-order component` - -Injeta uma propriedade `width`. Não modifica o componente passado para ele; em vez disso, ele retorna um novo componente. Esta propriedade de ponto de quebra, `width`, corresponde à largura de tela atual. Pode ser um dos seguintes pontos de quebra: - -```ts -type Breakpoint = 'xs' | 'sm' | 'md' | 'lg' | 'xl'; -``` - -Alguns detalhes de implementação que podem ser interessantes para estar ciente: - -- Ele encaminha as propriedades *non React static* para que este HOC seja mais "transparente". Por exemplo, pode ser usado para definir um método estático (next.js) `getInitialProps()`. +### `theme.breakpoints.between(start, end) => media query` #### Argumentos -1. `options` (_Object_ [opcional]): - -- `options.withTheme` (*Boolean* [opcional]): Padrão `false`. Fornecer o objeto `theme` para o componente como uma propriedade. -- `options.noSSR` (*Boolean* [opcional]): Padrão `false`. Para realizar a reconciliação de renderização do lado do servidor, ele precisa renderizar duas vezes. Uma primeira vez sem nada e uma segunda vez com os filhos. Este ciclo de renderização de dupla passagem tem uma desvantagem. A interface do usuário pode piscar. Você pode definir esse sinalizador para `true` se você não estiver fazendo a renderização do lado do servidor. -- `options.initialWidth` (*Breakpoint* [opcional]): Como `window.innerWidth` não esta disponível no servidor, retornamos uma correspondência padrão durante a primeira montagem. Você pode querer usar uma heurística para aproximar a largura da tela no navegador do cliente. Por exemplo, você poderia estar usando o user-agent ou o client-hint. Para definir o initialWidth, precisamos passar uma propriedade customizada com esta forma: https://caniuse.com/#search=client%20hint, também podemos definir a largura inicial globalmente usando [`propriedades customizadas`](/customization/theme-components/#default-props) no tema. - -```js -const theme = createTheme({ - props: { - // Componente withWidth ⚛️ - MuiWithWidth: { - // Propriedade de largura inicial - initialWidth: 'lg', // Ponto de quebra globalmente definido 🌎! - }, - }, -}); -``` - -- `options.resizeInterval` (*Number* [opcional]): Padrão é 166, que corresponde a 10 quadros a 60 Hz. Número de milissegundos a aguardar antes de responder a um evento de redimensionamento de tela. +1. `start` (_string_): A breakpoint key (`xs`, `sm`, etc.) or a screen width number in px. +2. `end` (_string_): A breakpoint key (`xs`, `sm`, etc.) or a screen width number in px. #### Retornos -`higher-order component`: Deve ser usado para encapsular o componente. +`media query`: Uma string de consulta de mídia pronta para ser usada com a maioria das soluções de estilo, na qual corresponde a larguras de telas maiores que o tamanho da tela fornecido na chave de ponto de quebra no primeiro argumento e menor que o tamanho de tela fornecido pela chave de ponto de quebra no segundo argumento. #### Exemplos -```jsx -import withWidth, { isWidthUp } from '@material-ui/core/withWidth'; - -function MyComponent(props) { - if (isWidthUp('sm', props.width)) { - return <span /> - } - - return <div />; -} - -export default withWidth()(MyComponent); +```js +const styles = (theme) => ({ + root: { + backgroundColor: 'blue', + // Match [sm, md) + // [600px, 900px) + [theme.breakpoints.between('sm', 'md')]: { + backgroundColor: 'red', + }, + }, +}); ``` ## Valores padrão diff --git a/docs/src/pages/customization/breakpoints/breakpoints-ru.md b/docs/src/pages/customization/breakpoints/breakpoints-ru.md index b68fad185129d6..502cbece7b8dbd 100644 --- a/docs/src/pages/customization/breakpoints/breakpoints-ru.md +++ b/docs/src/pages/customization/breakpoints/breakpoints-ru.md @@ -4,7 +4,7 @@ Для оптимального взаимодействия с пользователем material интерфейсы должны быть в состоянии адаптировать свое расположение в различных точках останова. Material-UI использует **упрощенную** реализацию оригинальной [спецификации](https://material.io/design/layout/responsive-layout-grid.html#breakpoints). -The breakpoints are used internally in various components to make them responsive, but you can also take advantage of them for controlling the layout of your application through the [Grid](/components/grid/) and [Hidden](/components/hidden/) components. +The breakpoints are used internally in various components to make them responsive, but you can also take advantage of them for controlling the layout of your application through the [Grid](/components/grid/) component. ## Default breakpoints @@ -12,9 +12,9 @@ The breakpoints are used internally in various components to make them responsiv - **xs,** extra-small: 0px - **sm,** small: 600px -- **md,** medium: 960px -- **lg,** large: 1280px -- **xl,** extra-large: 1920px +- **md,** medium: 900px +- **lg,** large: 1200px +- **xl,** extra-large: 1536px These values can be [customized](#custom-breakpoints). @@ -46,24 +46,6 @@ CSS media queries are the idiomatic approach to make your UI responsive. The the You can learn more on the [useMediaQuery](/components/use-media-query/) page. -### withWidth() - -> ⚠️ This higher-order component will be deprecated for the [useMediaQuery](/components/use-media-query/) hook. - -```jsx -import withWidth from '@material-ui/core/withWidth'; - -function MyComponent(props) { - return <div>{`Current width: ${props.width}`}</div>; -} - -export default withWidth()(MyComponent); -``` - -In the following demo, we change the rendered DOM element (*em*, <u>u</u>, ~~del~~ & span) based on the screen width. - -{{"demo": "pages/customization/breakpoints/WithWidth.js"}} - ## Custom breakpoints You define your project's breakpoints in the `theme.breakpoints` section of your theme. @@ -80,12 +62,12 @@ const theme = createTheme({ values: { xs: 0, sm: 600, - md: 960, - lg: 1280, - xl: 1920, + md: 900, + lg: 1200, + xl: 1536, }, }, -}) +}); ``` Feel free to have as few or as many breakpoints as you want, naming them in whatever way you'd prefer for your project. @@ -94,9 +76,10 @@ Feel free to have as few or as many breakpoints as you want, naming them in what const theme = createTheme({ breakpoints: { values: { + mobile: 0, tablet: 640, laptop: 1024, - desktop: 1280, + desktop: 1200, }, }, }); @@ -107,14 +90,15 @@ If you are using TypeScript, you would also need to use [module augmentation](/g <!-- Tested with packages/material-ui/test/typescript/breakpointsOverrides.augmentation.tsconfig.json --> ```ts -declare module "@material-ui/core/styles/createBreakpoints" { +declare module '@material-ui/core/styles' { interface BreakpointOverrides { xs: false; // removes the `xs` breakpoint sm: false; md: false; lg: false; xl: false; - tablet: true; // adds the `tablet` breakpoint + mobile: true; // adds the `mobile` breakpoint + tablet: true; laptop: true; desktop: true; } @@ -127,34 +111,7 @@ declare module "@material-ui/core/styles/createBreakpoints" { #### Аргументы -1. `key` (*String* | *Number*): A breakpoint key (`xs`, `sm`, etc.) or a screen width number in pixels. - -#### Возвращает - -`media query`: A media query string ready to be used with most styling solutions, which matches screen widths greater than the screen size given by the breakpoint key in the first argument and less than the the screen size given by the breakpoint key in the second argument. - -#### Примеры - -```js -declare module "@material-ui/core/styles/createBreakpoints" { - interface BreakpointOverrides { - xs: false; // removes the `xs` breakpoint - sm: false; - md: false; - lg: false; - xl: false; - tablet: true; // adds the `tablet` breakpoint - laptop: true; - desktop: true; - } -} -``` - -### `theme.breakpoints.down(key) => media query` - -#### Аргументы - -1. `key` (*String* | *Number*): A breakpoint key (`xs`, `sm`, etc.) or a screen width number in pixels. +1. `key` (_string_ | _number_): A breakpoint key (`xs`, `sm`, etc.) or a screen width number in px. #### Возвращает @@ -163,11 +120,11 @@ declare module "@material-ui/core/styles/createBreakpoints" { #### Примеры ```js -const styles = theme => ({ +const styles = (theme) => ({ root: { backgroundColor: 'blue', // Match [md, ∞) - // [960px, ∞) + // [900px, ∞) [theme.breakpoints.up('md')]: { backgroundColor: 'red', }, @@ -175,11 +132,11 @@ const styles = theme => ({ }); ``` -### `theme.breakpoints.only(key) => media query` +### `theme.breakpoints.down(key) => media query` #### Аргументы -1. `key` (*String*): A breakpoint key (`xs`, `sm`, etc.). +1. `key` (_string_ | _number_): A breakpoint key (`xs`, `sm`, etc.) or a screen width number in px. #### Возвращает @@ -188,12 +145,11 @@ const styles = theme => ({ #### Примеры ```js -const styles = theme => ({ +const styles = (theme) => ({ root: { backgroundColor: 'blue', - // Match [0, md + 1) - // [0, lg) - // [0, 1280px) + // Match [0, md) + // [0, 900px) [theme.breakpoints.down('md')]: { backgroundColor: 'red', }, @@ -201,12 +157,11 @@ const styles = theme => ({ }); ``` -### `theme.breakpoints.between(start, end) => media query` +### `theme.breakpoints.only(key) => media query` #### Аргументы -1. `start` (*String*): A breakpoint key (`xs`, `sm`, etc.) or a screen width number in pixels. -2. `end` (*String*): A breakpoint key (`xs`, `sm`, etc.) or a screen width number in pixels. +1. `key` (_string_): A breakpoint key (`xs`, `sm`, etc.). #### Возвращает @@ -215,12 +170,12 @@ const styles = theme => ({ #### Примеры ```js -const styles = theme => ({ +const styles = (theme) => ({ root: { backgroundColor: 'blue', // Match [md, md + 1) // [md, lg) - // [960px, 1280px) + // [900px, 1200px) [theme.breakpoints.only('md')]: { backgroundColor: 'red', }, @@ -228,58 +183,30 @@ const styles = theme => ({ }); ``` -### `withWidth([options]) => higher-order component` - -Вставить свойство `width`. Оно не изменяет переданный в него компонент; вместо этого оно возвращает новый компонент. Свойство точки останова `width` соответствует текущей ширине экрана. Это может быть одна из следующих точек останова: - -```ts -type Breakpoint = 'xs' | 'sm' | 'md' | 'lg' | 'xl'; -``` - -Некоторые детали реализации, которые могут быть интересны для понимания: - -- It forwards *non React static* properties so this HOC is more "transparent". For instance, it can be used to defined a `getInitialProps()` static method (next.js). +### `theme.breakpoints.between(start, end) => media query` #### Аргументы -1. `варианты` (*объекта* [optional]): - -- `options.withTheme` (*Boolean* [optional]): По умолчанию - `false`. Provide the `theme` object to the component as a property. -- `options.noSSR` (*Boolean* [optional]): По умолчанию - `false`. In order to perform the server-side rendering reconciliation, it needs to render twice. A first time with nothing and a second time with the children. This double pass rendering cycle comes with a drawback. The UI might blink. You can set this flag to `true` if you are not doing server-side rendering. -- `options.initialWidth` (*Breakpoint* [optional]): As `window.innerWidth` is unavailable on the server, we default to rendering an empty component during the first mount. You might want to use an heuristic to approximate the screen width of the client browser screen width. For instance, you could be using the user-agent or the client-hints. In order to set the initialWidth we need to pass a custom property with this shape: https://caniuse.com/#search=client%20hint, we also can set the initial width globally using [`custom properties`](/customization/theme-components/#default-props) on the theme. - -```js -const theme = createTheme({ - props: { - // withWidth component ⚛️ - MuiWithWidth: { - // Initial width property - initialWidth: 'lg', // Breakpoint being globally set 🌎! - }, - }, -}); -``` - -- `options.resizeInterval` (*Number* [optional]): Defaults to 166, corresponds to 10 frames at 60 Hz. Number of milliseconds to wait before responding to a screen resize event. +1. `start` (_string_): A breakpoint key (`xs`, `sm`, etc.) or a screen width number in px. +2. `end` (_string_): A breakpoint key (`xs`, `sm`, etc.) or a screen width number in px. #### Возвращает -`компонент высшего порядка`: следует использовать, чтобы обернуть компонент. +`media query`: A media query string ready to be used with most styling solutions, which matches screen widths greater than the screen size given by the breakpoint key in the first argument and less than the the screen size given by the breakpoint key in the second argument. #### Примеры -```jsx -import withWidth, { isWidthUp } from '@material-ui/core/withWidth'; - -function MyComponent(props) { - if (isWidthUp('sm', props.width)) { - return <span /> - } - - return <div />; -} - -export default withWidth()(MyComponent); +```js +const styles = (theme) => ({ + root: { + backgroundColor: 'blue', + // Match [sm, md) + // [600px, 900px) + [theme.breakpoints.between('sm', 'md')]: { + backgroundColor: 'red', + }, + }, +}); ``` ## Default values diff --git a/docs/src/pages/customization/breakpoints/breakpoints-zh.md b/docs/src/pages/customization/breakpoints/breakpoints-zh.md index 941d24d0565a24..f45f28e064ad99 100644 --- a/docs/src/pages/customization/breakpoints/breakpoints-zh.md +++ b/docs/src/pages/customization/breakpoints/breakpoints-zh.md @@ -4,7 +4,7 @@ 为了获得最佳的用户体验,在不同的断点下,material design 的接口需要适应它们的布局。 Material-UI 使用了原先 [specification](https://material.io/design/layout/responsive-layout-grid.html#breakpoints) 的 **简化** 实现。 -不同组件内部也使用了断点来实现响应式的布局,同时借助于 [Grid](/components/grid/) 和 [Hidden](/components/hidden/) 组件,你也可以用其来控制应用的布局。 +The breakpoints are used internally in various components to make them responsive, but you can also take advantage of them for controlling the layout of your application through the [Grid](/components/grid/) component. ## 默认的断点 @@ -12,9 +12,9 @@ - ** xs, ** 超小:0px - ** sm, **小:600px -- ** md, **中等:960px -- ** lg, **大:1280px -- ** xl, **超大:1920px +- **md,** medium: 900px +- **lg,** large: 1200px +- **xl,** extra-large: 1536px 这些值可以是 [定制](#custom-breakpoints) 的。 @@ -56,24 +56,6 @@ const styles = (theme) => ({ 您可以在 [userMediaQuery](/components/use-media-query/) 页面上了解更多信息。 -### withWidth() - -> ⚠️ 有了 [useMediaQuery](/components/use-media-query/) hook,这个高阶组件(higher-order component)将被弃用。 - -```jsx -import withWidth from '@material-ui/core/withWidth'; - -function MyComponent(props) { - return <div>{`当前宽度: ${props.width}`}</div>; -} - -export default withWidth()(MyComponent); -``` - -您可以在 [userMediaQuery](/components/use-media-query/) 页面上了解更多信息。 - -{{"demo": "pages/customization/breakpoints/WithWidth.js"}} - ## 自定义断点 您可以选择在 theme 中的 `theme.breakpoints` 部分定义项目的断点。 @@ -90,9 +72,9 @@ const theme = createTheme({ values: { xs: 0, sm: 600, - md: 960, - lg: 1280, - xl: 1920, + md: 900, + lg: 1200, + xl: 1536, }, }, }); @@ -104,9 +86,10 @@ const theme = createTheme({ const theme = createTheme({ breakpoints: { values: { + mobile: 0, tablet: 640, laptop: 1024, - desktop: 1280, + desktop: 1200, }, }, }); @@ -117,14 +100,15 @@ const theme = createTheme({ <!-- Tested with packages/material-ui/test/typescript/breakpointsOverrides.augmentation.tsconfig.json --> ```ts -declare module "@material-ui/core/styles/createBreakpoints" { +declare module '@material-ui/core/styles' { interface BreakpointOverrides { - xs: false; // 移除 `xs` 断点 + xs: false; // removes the `xs` breakpoint sm: false; md: false; lg: false; xl: false; - tablet: true; // 添加 `tablet` 断点 + mobile: true; // adds the `mobile` breakpoint + tablet: true; laptop: true; desktop: true; } @@ -137,11 +121,11 @@ declare module "@material-ui/core/styles/createBreakpoints" { #### 参数 -1. `key` (*String* | *Number* ):断点键(`xs` ,`sm`等等)或以像素为单位的屏幕宽度数。 +1. `key` (_string_ | _number_): A breakpoint key (`xs`, `sm`, etc.) or a screen width number in px. #### 返回结果 -如果您使用的是 TypeScript,您还需要使用 [module augmentation](/guides/typescript/#customization-of-theme) 来让主题接受上述值。 +`media query`:一个媒体查询字符串,适用于大多数的样式解决方案,它匹配的屏幕宽度大于(包含)断点键给出的屏幕尺寸。 #### 例子 @@ -150,7 +134,7 @@ const styles = (theme) => ({ root: { backgroundColor: 'blue', // Match [md, ∞) - // [960px, ∞) + // [900px, ∞) [theme.breakpoints.up('md')]: { backgroundColor: 'red', }, @@ -162,11 +146,11 @@ const styles = (theme) => ({ #### 参数 -1. `key` (*String* | *Number* ):断点键(`xs` ,`sm`等等)或以像素为单位的屏幕宽度数。 +1. `key` (_string_ | _number_): A breakpoint key (`xs`, `sm`, etc.) or a screen width number in px. #### 返回结果 -`media query`:一个媒体查询字符串,适用于大多数的样式解决方案,它匹配的屏幕宽度大于(包含)断点键给出的屏幕尺寸。 +`media query`:一个媒体查询字符串,适用于大多数的样式解决方案,它匹配的屏幕宽度小于(不包含)断点键给出的屏幕尺寸。 #### 例子 @@ -175,7 +159,7 @@ const styles = (theme) => ({ root: { backgroundColor: 'blue', // Match [0, md) - // [0, 960px) + // [0, 900px) [theme.breakpoints.down('md')]: { backgroundColor: 'red', }, @@ -187,11 +171,11 @@ const styles = (theme) => ({ #### 参数 -1. `key` (*String*):断点键(`xs` ,`sm`等)。 +1. `key` (_string_): A breakpoint key (`xs`, `sm`, etc.). #### 返回结果 -`media query`:一个媒体查询字符串,适用于大多数的样式解决方案,它匹配的屏幕宽度小于(不包含)断点键给出的屏幕尺寸。 +`media query`:一个媒体查询字符串,适用于大多数的样式解决方案,它会匹配屏幕宽度,并包括断点键给出的屏幕尺寸。 #### 例子 @@ -201,7 +185,7 @@ const styles = (theme) => ({ backgroundColor: 'blue', // Match [md, md + 1) // [md, lg) - // [960px, 1280px) + // [900px, 1200px) [theme.breakpoints.only('md')]: { backgroundColor: 'red', }, @@ -213,12 +197,12 @@ const styles = (theme) => ({ #### 参数 -1. `start` (*String*): A breakpoint key (`xs`, `sm`, etc.) or a screen width number in pixels. -2. `end` (*String*): A breakpoint key (`xs`, `sm`, etc.) or a screen width number in pixels. +1. `start` (_string_): A breakpoint key (`xs`, `sm`, etc.) or a screen width number in px. +2. `end` (_string_): A breakpoint key (`xs`, `sm`, etc.) or a screen width number in px. #### 返回结果 -`media query`:一个媒体查询字符串,适用于大多数的样式解决方案,它会匹配屏幕宽度,并包括断点键给出的屏幕尺寸。 +`media query`:一个媒体查询字符串,适用于大多数的样式解决方案,它匹配的屏幕宽度大于第一个参数(包括)中断点键给出的屏幕尺寸,小于第二个参数(不包括)中断点键给出的屏幕尺寸。 #### 例子 @@ -227,7 +211,7 @@ const styles = (theme) => ({ root: { backgroundColor: 'blue', // Match [sm, md) - // [600px, 960px) + // [600px, 900px) [theme.breakpoints.between('sm', 'md')]: { backgroundColor: 'red', }, @@ -235,62 +219,6 @@ const styles = (theme) => ({ }); ``` -### `withWidth([options]) => higher-order component` - -注入 `width` 属性。 它不会修改传递给它的组件;相反,它会返回一个新组件。 这个 `width` 断点属性与当前屏幕宽度匹配。 它可以是以下断点之一: - -```ts -type Breakpoint = 'xs' | 'sm' | 'md' | 'lg' | 'xl'; -``` - -你可能会注意到一些有趣的细节: - -- 它将转发 _非 React 的静态_ 属性,以便 HOC 更 "透明"。 例如,您可以用它来定义一个 `getInitialProps()` 的静态方法 (next.js)。 - -#### 参数 - -1. `options` (_Object_ [optional]): - -- `options.withTheme` (*Boolean* [optional]): 默认值为 `false`。 将 `theme` 对象作为属性提供给组件。 -- `options.noSSR` (_Boolean_ [optional]): 默认值为 `false`。 为了呈现服务器端渲染的协调性,我们需要将它渲染两次。 第一次什么也没渲染,第二次与子组件一起渲染。 这个双向渲染周期带有一个缺点。 UI 会有闪烁。 如果你不进行服务器端渲染,那么可以将此标志设置为 `true`。 -- `options.initialWidth` (*Breakpoint* [可选的]): 为`window.innerWidth`在服务器上不可用, 我们默认在第一次安装期间呈现空组件。 你可能需要使用一个启发式方法来估计客户端浏览器的屏幕宽度。 例如,你可以使用 user-agent 或 [client-hints](https://caniuse.com/#search=client%20hint)。 为了设置 initialWidth,我们需要传递一个类似于以下结构的自定义属性: 我们也可以在主题中使用 [`自定义属性`](/customization/theme-components/#default-props) 来设置全局的初始宽度。 - -```js -const theme = createTheme({ - components: { - // withWidth component ⚛️ - MuiWithWidth: { - defaultProps: { - // Initial width prop - initialWidth: 'lg', // 断点的全局设置 🌎! - }, - }, - }, -}); -``` - -- `options.resizeInterval` (_Number_ [optional]):默认为 166,对应于 60 Hz 的 10帧。 响应屏幕调整大小事件前等待的毫秒数。 - -#### 返回结果 - -`higher-order component`:应用于包装组件。 - -#### 例子 - -```jsx -import withWidth, { isWidthUp } from '@material-ui/core/withWidth'; - -function MyComponent(props) { - if (isWidthUp('sm', props.width)) { - return <span />; - } - - return <div />; -} - -export default withWidth()(MyComponent); -``` - ## 默认值 您可以使用 [主题资源管理器(theme explorer)](/customization/default-theme/?expand-path=$.breakpoints) 或通过打开此页面上的开发工具控制台(dev tools console)(`window.theme.breakpoints`)来探索断点的一些默认值。 diff --git a/docs/src/pages/customization/color/color-de.md b/docs/src/pages/customization/color/color-de.md index 953dc0b93cf044..a03c5bdae3081b 100644 --- a/docs/src/pages/customization/color/color-de.md +++ b/docs/src/pages/customization/color/color-de.md @@ -1,6 +1,6 @@ # Farbe (Color) -<p class="description">Vermitteln Sie Bedeutung durch Farbe. Im Auslieferungszustand haben Sie Zugriff auf alle Farben in der Material Design-Spezifikation.</p> +<p class="description">Vermitteln Sie Bedeutung durch Farbe. Out of the box you get access to all colors in the Material Design guidelines.</p> Das Material Design [Farbsystem](https://material.io/design/color/) kann verwendet werden, um ein Farbschema zu erstellen, das Ihre Marke oder Ihren Stil widerspiegelt. @@ -17,7 +17,7 @@ The Material Design team has also built an awesome palette configuration tool: [ <br /> <br /> -Die Ausgabe kann in die `createTheme()` Funktion eingegeben werden: +The output can be fed into `createTheme()` function: ```js import { createTheme } from '@material-ui/core/styles'; @@ -64,9 +64,9 @@ const theme = createTheme({ }); ``` -Nur die `Haupttöne` müssen bereitgestellt werden (es sei denn, Sie möchten `light`, `dark` oder `contrastText` weiter anpassen), da die anderen Farben von `createTheme()` berechnet werden, wie in der Sektion [ Designanpassung ](/customization/palette/) beschrieben. +Only the `main` shades need be provided (unless you wish to further customize `light`, `dark` or `contrastText`), as the other colors will be calculated by `createTheme()`, as described in the [Theme customization](/customization/palette/) section. -Wenn Sie die standardmäßigen primären und / oder sekundären Farbtöne verwenden, wird durch das Bereitstellen von dem Farbobjekt die entsprechenden Farbtöne der Materialfarbe für main, light und dark von `createTheme()` berechnet. +If you are using the default primary and / or secondary shades then by providing the color object, `createTheme()` will use the appropriate shades from the material color for main, light and dark. ### Werkzeuge von der Community diff --git a/docs/src/pages/customization/color/color-es.md b/docs/src/pages/customization/color/color-es.md index 250195c5ad780d..c939c51efd4de4 100644 --- a/docs/src/pages/customization/color/color-es.md +++ b/docs/src/pages/customization/color/color-es.md @@ -1,6 +1,6 @@ # Color -<p class="description">Transmitir significado a través del color. Ahora mismo se puede acceder a todos los colores en la especificación de diseño de Material Design.</p> +<p class="description">Transmitir significado a través del color. Out of the box you get access to all colors in the Material Design guidelines.</p> El [sistema de color](https://material.io/design/color/) Material Design se puede utilizar para crear un tema de color que refleje su marca o estilo. diff --git a/docs/src/pages/customization/color/color-ja.md b/docs/src/pages/customization/color/color-ja.md index 81364497f478a9..a1d982854802bd 100644 --- a/docs/src/pages/customization/color/color-ja.md +++ b/docs/src/pages/customization/color/color-ja.md @@ -1,6 +1,6 @@ # カラー -<p class="description"><strong>Palette</strong>: A palette is a collection of colors, i.e. hues and their shades. Material-UIは、Material Designガイドラインのすべてのカラーを提供します。 <a href="#color-palette">このカラーパレット</a>は、互いに調和する色でデザインされています。</p> +<p class="description"><strong>Palette</strong>: A palette is a collection of colors, i.e. hues and their shades. Out of the box you get access to all colors in the Material Design guidelines.</p> Material Design[color system](https://material.io/design/color/)を使用すると、自分のブランドやスタイルを反映した色のテーマを作成できます。 @@ -17,7 +17,7 @@ The Material Design team has also built an awesome palette configuration tool: [ <br /> <br /> -出力は、`createTheme()`関数に渡すことができます。 +The output can be fed into `createTheme()` function: ```js import { createTheme } from '@material-ui/core/styles'; @@ -64,9 +64,9 @@ const theme = createTheme({ }); ``` -他の色は [Theme customization](/customization/palette/)セクションで説明されているように`createTheme()`によって計算されるので、`main`シェーディングのみを提供する必要があります(`light`、`dark`、`contrastText`をさらにカスタマイズする場合を除きます)。 +Only the `main` shades need be provided (unless you wish to further customize `light`, `dark` or `contrastText`), as the other colors will be calculated by `createTheme()`, as described in the [Theme customization](/customization/palette/) section. -デフォルトの一次または二次シェード、あるいはその両方を使用している場合にカラーオブジェクトを指定すると、`createTheme()`はメイン、ライト、およびダークにマテリアルカラーからの適切なシェードを使用します。 +If you are using the default primary and / or secondary shades then by providing the color object, `createTheme()` will use the appropriate shades from the material color for main, light and dark. ### コミュニティによるツール diff --git a/docs/src/pages/customization/color/color-pt.md b/docs/src/pages/customization/color/color-pt.md index 3d6a5916e0ffa0..3abba9e4c4f695 100644 --- a/docs/src/pages/customization/color/color-pt.md +++ b/docs/src/pages/customization/color/color-pt.md @@ -1,6 +1,6 @@ # Cor -<p class="description">Transmita significado através da cor. De forma criativa, você obtém acesso a todas as cores da especificação do Material Design.</p> +<p class="description">Transmita significado através da cor. Out of the box you get access to all colors in the Material Design guidelines.</p> O [sistema de cores](https://material.io/design/color/) do Material Design pode ser usado para criar um tema que reflete sua marca ou estilo. @@ -17,7 +17,7 @@ A equipe do Material Design também criou uma ferramenta de configuração de pa <br /> <br /> -A saída pode ser alimentada na função `createTheme()`: +The output can be fed into `createTheme()` function: ```js import { createTheme } from '@material-ui/core/styles'; @@ -46,7 +46,7 @@ Para testar um esquema de cores do [material.io/design/color](https://material.i {{"demo": "pages/customization/color/ColorTool.js", "hideToolbar": true, "bg": true}} -A saída exibida na amostra de cores pode ser colada diretamente na função [`createTheme()`](/customization/theming/#createtheme-options-theme) (para ser usada com [`ThemeProvider`](/customization/theming/#theme-provider)): +The output shown in the color sample can be pasted directly into a [`createTheme()`](/customization/theming/#createtheme-options-theme) function (to be used with [`ThemeProvider`](/customization/theming/#theme-provider)): ```jsx import { createTheme } from '@material-ui/core/styles'; @@ -64,9 +64,9 @@ const theme = createTheme({ }); ``` -Apenas o tom `main` precisa ser fornecido (a menos que você deseje customizar ainda mais `light`, `dark` ou `contrastText`), já que as outras cores serão calculadas por `createTheme()`, como descrito na seção de [customização de tema](/customization/palette/). +Only the `main` shades need be provided (unless you wish to further customize `light`, `dark` or `contrastText`), as the other colors will be calculated by `createTheme()`, as described in the [Theme customization](/customization/palette/) section. -Se você estiver usando os tons primário e / ou secundário por padrão, fornecendo o objeto de cor, `createTheme()` usará tons apropriados da cor do material para `main`, `light` e `dark`. +If you are using the default primary and / or secondary shades then by providing the color object, `createTheme()` will use the appropriate shades from the material color for main, light and dark. ### Ferramentas da comunidade diff --git a/docs/src/pages/customization/color/color-ru.md b/docs/src/pages/customization/color/color-ru.md index 0fc19e3f809eb6..da79695d2aa167 100644 --- a/docs/src/pages/customization/color/color-ru.md +++ b/docs/src/pages/customization/color/color-ru.md @@ -1,6 +1,6 @@ # Цвет -<p class="description">Используйте цвет, чтобы передать смысл. Вы получаете доступ ко всем цветам в спецификации Material Design из коробки.</p> +<p class="description">Используйте цвет, чтобы передать смысл. Out of the box you get access to all colors in the Material Design guidelines.</p> [Система цветов](https://material.io/design/color/) Material Design может быть использована для создания цветовой темы, которая отражает ваш бренд или стиль. @@ -8,7 +8,7 @@ ### Официальный инструмент для работы с цветом -The Material Design team has also built an awesome palette configuration tool: [material.io/resources/color/](https://material.io/resources/color/). This can help you create a color palette for your UI, as well as measure the accessibility level of any color combination. +Команда Material Design также создала потрясающий инструмент настройки палитры: [material.io/resources/color/](https://material.io/resources/color/). This can help you create a color palette for your UI, as well as measure the accessibility level of any color combination. <a href="https://material.io/resources/color/#!/?view.left=0&view.right=0&primary.color=3F51B5&secondary.color=F44336" target="_blank" rel="noopener nofollow"> <img src="/static/images/color/colorTool.png" alt="Официальный инструмент для работы с цветом" style="width: 574px" /> @@ -71,7 +71,7 @@ If you are using the default primary and / or secondary shades then by providing ### Инструменты, созданные сообществом - [create-mui-theme](https://react-theming.github.io/create-mui-theme/): Is an online tool for creating Material-UI themes via Material Design Color Tool. -- [material-ui-theme-editor](https://in-your-saas.github.io/material-ui-theme-editor/): A tool to generate themes for your Material-UI applications by just selecting the colors and having a live preview. Includes basic site templates to show various components and how they are affected by the theme +- [mui-theme-creator](https://bareynol.github.io/mui-theme-creator/): Инструмент, помогающий проектировать и настраивать темы для библиотеки компонентов Material-UI. Includes basic site templates to show various components and how they are affected by the theme - [Material palette generator](https://material.io/inline-tools/color/): Этот инструмент можно использовать для создания палитры на основе любого выбранного цвета. ## 2014 Material Design color palettes diff --git a/docs/src/pages/customization/color/color-zh.md b/docs/src/pages/customization/color/color-zh.md index e3101bcc91e659..17be6167f71422 100644 --- a/docs/src/pages/customization/color/color-zh.md +++ b/docs/src/pages/customization/color/color-zh.md @@ -1,6 +1,6 @@ # Color 颜色 -<p class="description">颜色承载了不同的寓意。 开箱即用,您可以查看 Material Design 规范中的所有颜色。</p> +<p class="description">颜色承载了不同的寓意。 Out of the box you get access to all colors in the Material Design guidelines.</p> 使用 Material Design 的[颜色系统](https://material.io/design/color/),您可创建表现独特品牌或风格的颜色主题。 @@ -18,7 +18,7 @@ Material Design 团队也搭建了一个非常棒的调色板配置工具: [ma <br /> <br /> -输出的结果可以被传入到 `createTheme()` 函数中: +The output can be fed into `createTheme()` function: ```js import { createTheme } from '@material-ui/core/styles'; @@ -47,7 +47,7 @@ const theme = createTheme({ {{"demo": "pages/customization/color/ColorTool.js", "hideToolbar": true, "bg": true}} -您可以把颜色的例子中显示的输出结果直接粘贴到一个 [`createTheme()`](/customization/theming/#createtheme-options-theme) 函数里(需要与 [`ThemeProvider`](/customization/theming/#theme-provider) 配合使用): +The output shown in the color sample can be pasted directly into a [`createTheme()`](/customization/theming/#createtheme-options-theme) function (to be used with [`ThemeProvider`](/customization/theming/#theme-provider)): ```jsx import { createTheme } from '@material-ui/core/styles'; @@ -65,9 +65,9 @@ const theme = createTheme({ }); ``` -您只需提供 `主要的` 阴影(shades)(除非您希望进一步自定义 `light`,`dark` 或 `contrastText` 这几个属性),在 [定制主题](/customization/palette/) 章节中提到,这是因为其他颜色会由 `createTheme()` 自动计算。 +Only the `main` shades need be provided (unless you wish to further customize `light`, `dark` or `contrastText`), as the other colors will be calculated by `createTheme()`, as described in the [Theme customization](/customization/palette/) section. -如果你在使用默认的主要和/或次要阴影,那么通过提供一个颜色对象(color object) ,`createTheme()` 将会根据主(main)、亮(light)和暗(dark)三种 material 颜色使用合适的阴影。 +If you are using the default primary and / or secondary shades then by providing the color object, `createTheme()` will use the appropriate shades from the material color for main, light and dark. ### 社区提供的一些工具 diff --git a/docs/src/pages/customization/default-theme/default-theme-de.md b/docs/src/pages/customization/default-theme/default-theme-de.md index f50e7aa711ca98..4361c25e51fe29 100644 --- a/docs/src/pages/customization/default-theme/default-theme-de.md +++ b/docs/src/pages/customization/default-theme/default-theme-de.md @@ -12,4 +12,4 @@ Explore the default theme object: <!-- #default-branch-switch --> -Wenn Sie mehr darüber erfahren möchten, wie das Theme zusammengestellt wird, werfen Sie einen Blick auf [`material-ui / style / createTheme.js`](https://github.com/mui-org/material-ui/blob/next/packages/material-ui/src/styles/createTheme.js), und die zugehörigen Importe, die `createTheme` verwendet. +If you want to learn more about how the theme is assembled, take a look at [`material-ui/style/createTheme.js`](https://github.com/mui-org/material-ui/blob/next/packages/material-ui/src/styles/createTheme.js), and the related imports which `createTheme` uses. diff --git a/docs/src/pages/customization/default-theme/default-theme-es.md b/docs/src/pages/customization/default-theme/default-theme-es.md index e953b0bcca3886..a0f24c360f2335 100644 --- a/docs/src/pages/customization/default-theme/default-theme-es.md +++ b/docs/src/pages/customization/default-theme/default-theme-es.md @@ -12,4 +12,4 @@ Explore the default theme object: <!-- #default-branch-switch --> -Si deseas obtener más información sobre cómo se monta el tema, echa un vistazo a [`material-ui/style/createTheme.js`](https://github.com/mui-org/material-ui/blob/next/packages/material-ui/src/styles/createTheme.js), y los imports que utiliza `createTheme`. +If you want to learn more about how the theme is assembled, take a look at [`material-ui/style/createTheme.js`](https://github.com/mui-org/material-ui/blob/next/packages/material-ui/src/styles/createTheme.js), and the related imports which `createTheme` uses. diff --git a/docs/src/pages/customization/default-theme/default-theme-fr.md b/docs/src/pages/customization/default-theme/default-theme-fr.md index 960fea6a5f00a4..ab9a776c6a4747 100644 --- a/docs/src/pages/customization/default-theme/default-theme-fr.md +++ b/docs/src/pages/customization/default-theme/default-theme-fr.md @@ -8,7 +8,7 @@ Explore the default theme object: {{"demo": "pages/customization/default-theme/DefaultTheme.js", "hideToolbar": true, "bg": "inline"}} -> Tip: you can play with the documentation theme object in your browser console, as the `theme` variable is exposed on all the documentation pages. Please note that **the documentation site is using a custom theme**. +> Tip: you can play with the documentation theme object in your browser console, as the `theme` variable is exposed on all the documentation pages. Veuillez noter que **la documentation du site utilise un thème personnalisé**. <!-- #default-branch-switch --> diff --git a/docs/src/pages/customization/default-theme/default-theme-ja.md b/docs/src/pages/customization/default-theme/default-theme-ja.md index bf878ec9b00570..9bacfc910802f0 100644 --- a/docs/src/pages/customization/default-theme/default-theme-ja.md +++ b/docs/src/pages/customization/default-theme/default-theme-ja.md @@ -12,4 +12,4 @@ Explore the default theme object: <!-- #default-branch-switch --> -テーマについてもっと知りたい場合は、[`material-ui/style/createTheme.js`](https://github.com/mui-org/material-ui/blob/next/packages/material-ui/src/styles/createTheme.js)又は `createTheme`に関連するものをインポートして使って下さい。 +If you want to learn more about how the theme is assembled, take a look at [`material-ui/style/createTheme.js`](https://github.com/mui-org/material-ui/blob/next/packages/material-ui/src/styles/createTheme.js), and the related imports which `createTheme` uses. diff --git a/docs/src/pages/customization/default-theme/default-theme-pt.md b/docs/src/pages/customization/default-theme/default-theme-pt.md index f72a511b9bd138..25f83996e3f86e 100644 --- a/docs/src/pages/customization/default-theme/default-theme-pt.md +++ b/docs/src/pages/customization/default-theme/default-theme-pt.md @@ -12,4 +12,4 @@ Explore o objeto de tema padrão: <!-- #default-branch-switch --> -Se você quiser aprender mais sobre como o tema é montado, dê uma olhada em [`material-ui/style/createTheme.js`](https://github.com/mui-org/material-ui/blob/next/packages/material-ui/src/styles/createTheme.js), e as importações relacionadas que `createTheme` usa. +If you want to learn more about how the theme is assembled, take a look at [`material-ui/style/createTheme.js`](https://github.com/mui-org/material-ui/blob/next/packages/material-ui/src/styles/createTheme.js), and the related imports which `createTheme` uses. diff --git a/docs/src/pages/customization/default-theme/default-theme-ru.md b/docs/src/pages/customization/default-theme/default-theme-ru.md index ac919e45644b88..66a0a7d5a0f3eb 100644 --- a/docs/src/pages/customization/default-theme/default-theme-ru.md +++ b/docs/src/pages/customization/default-theme/default-theme-ru.md @@ -12,4 +12,4 @@ Explore the default theme object: <!-- #default-branch-switch --> -Подробности о структуре темы изнутри можно посмотреть здесь [`material-ui/style/createTheme.js`](https://github.com/mui-org/material-ui/blob/next/packages/material-ui/src/styles/createTheme.js), а также изучив зависимости, используемые `createTheme`. +If you want to learn more about how the theme is assembled, take a look at [`material-ui/style/createTheme.js`](https://github.com/mui-org/material-ui/blob/next/packages/material-ui/src/styles/createTheme.js), and the related imports which `createTheme` uses. diff --git a/docs/src/pages/customization/default-theme/default-theme-zh.md b/docs/src/pages/customization/default-theme/default-theme-zh.md index f9754862dc7523..fac103e970935b 100644 --- a/docs/src/pages/customization/default-theme/default-theme-zh.md +++ b/docs/src/pages/customization/default-theme/default-theme-zh.md @@ -12,4 +12,4 @@ <!-- #default-branch-switch --> -如果你想了解更多有关主题是如何组合的信息,请看看 [`material-ui/style/createTheme.js`](https://github.com/mui-org/material-ui/blob/next/packages/material-ui/src/styles/createTheme.js) 和 如何用`createTheme` 导入主题 +If you want to learn more about how the theme is assembled, take a look at [`material-ui/style/createTheme.js`](https://github.com/mui-org/material-ui/blob/next/packages/material-ui/src/styles/createTheme.js), and the related imports which `createTheme` uses. diff --git a/docs/src/pages/customization/density/density-de.md b/docs/src/pages/customization/density/density-de.md index cc5b0e49094c97..40b1ebc3b7583f 100644 --- a/docs/src/pages/customization/density/density-de.md +++ b/docs/src/pages/customization/density/density-de.md @@ -38,54 +38,78 @@ The theme is configured with the following options: ```js const theme = createTheme({ - props: { + components: { MuiButton: { - size: 'small', + defaultProps: { + size: 'small', + }, }, MuiFilledInput: { - margin: 'dense', + defaultProps: { + margin: 'dense', + }, }, MuiFormControl: { - margin: 'dense', + defaultProps: { + margin: 'dense', + }, }, MuiFormHelperText: { - margin: 'dense', + defaultProps: { + margin: 'dense', + }, }, MuiIconButton: { - size: 'small', + defaultProps: { + size: 'small', + }, + styleOverrides: { + sizeSmall: { + // Adjust spacing to reach minimal touch target hitbox + marginLeft: 4, + marginRight: 4, + padding: 12, + }, + }, }, MuiInputBase: { - margin: 'dense', + defaultProps: { + margin: 'dense', + }, }, MuiInputLabel: { - margin: 'dense', + defaultProps: { + margin: 'dense', + }, }, MuiListItem: { - dense: true, + defaultProps: { + dense: true, + }, }, MuiOutlinedInput: { - margin: 'dense', + defaultProps: { + margin: 'dense', + }, }, MuiFab: { - size: 'small', + defaultProps: { + size: 'small', + }, }, MuiTable: { - size: 'small', + defaultProps: { + size: 'small', + }, }, MuiTextField: { - margin: 'dense', + defaultProps: { + margin: 'dense', + }, }, MuiToolbar: { - variant: 'dense', - }, - }, - overrides: { - MuiIconButton: { - sizeSmall: { - // Adjust spacing to reach minimal touch target hitbox - marginLeft: 4, - marginRight: 4, - padding: 12, + defaultProps: { + variant: 'dense', }, }, }, diff --git a/docs/src/pages/customization/density/density-es.md b/docs/src/pages/customization/density/density-es.md index 7d59de255a0f29..e9e978052ce4a6 100644 --- a/docs/src/pages/customization/density/density-es.md +++ b/docs/src/pages/customization/density/density-es.md @@ -38,54 +38,78 @@ The theme is configured with the following options: ```js const theme = createTheme({ - props: { + components: { MuiButton: { - size: 'small', + defaultProps: { + size: 'small', + }, }, MuiFilledInput: { - margin: 'dense', + defaultProps: { + margin: 'dense', + }, }, MuiFormControl: { - margin: 'dense', + defaultProps: { + margin: 'dense', + }, }, MuiFormHelperText: { - margin: 'dense', + defaultProps: { + margin: 'dense', + }, }, MuiIconButton: { - size: 'small', + defaultProps: { + size: 'small', + }, + styleOverrides: { + sizeSmall: { + // Adjust spacing to reach minimal touch target hitbox + marginLeft: 4, + marginRight: 4, + padding: 12, + }, + }, }, MuiInputBase: { - margin: 'dense', + defaultProps: { + margin: 'dense', + }, }, MuiInputLabel: { - margin: 'dense', + defaultProps: { + margin: 'dense', + }, }, MuiListItem: { - dense: true, + defaultProps: { + dense: true, + }, }, MuiOutlinedInput: { - margin: 'dense', + defaultProps: { + margin: 'dense', + }, }, MuiFab: { - size: 'small', + defaultProps: { + size: 'small', + }, }, MuiTable: { - size: 'small', + defaultProps: { + size: 'small', + }, }, MuiTextField: { - margin: 'dense', + defaultProps: { + margin: 'dense', + }, }, MuiToolbar: { - variant: 'dense', - }, - }, - overrides: { - MuiIconButton: { - sizeSmall: { - // Adjust spacing to reach minimal touch target hitbox - marginLeft: 4, - marginRight: 4, - padding: 12, + defaultProps: { + variant: 'dense', }, }, }, diff --git a/docs/src/pages/customization/density/density-ja.md b/docs/src/pages/customization/density/density-ja.md index b7d020c0560f97..017465259ea9a1 100644 --- a/docs/src/pages/customization/density/density-ja.md +++ b/docs/src/pages/customization/density/density-ja.md @@ -38,54 +38,78 @@ This section explains how to apply density. Material design ガイドライン ```js const theme = createTheme({ - props: { + components: { MuiButton: { - size: 'small', + defaultProps: { + size: 'small', + }, }, MuiFilledInput: { - margin: 'dense', + defaultProps: { + margin: 'dense', + }, }, MuiFormControl: { - margin: 'dense', + defaultProps: { + margin: 'dense', + }, }, MuiFormHelperText: { - margin: 'dense', + defaultProps: { + margin: 'dense', + }, }, MuiIconButton: { - size: 'small', + defaultProps: { + size: 'small', + }, + styleOverrides: { + sizeSmall: { + // Adjust spacing to reach minimal touch target hitbox + marginLeft: 4, + marginRight: 4, + padding: 12, + }, + }, }, MuiInputBase: { - margin: 'dense', + defaultProps: { + margin: 'dense', + }, }, MuiInputLabel: { - margin: 'dense', + defaultProps: { + margin: 'dense', + }, }, MuiListItem: { - dense: true, + defaultProps: { + dense: true, + }, }, MuiOutlinedInput: { - margin: 'dense', + defaultProps: { + margin: 'dense', + }, }, MuiFab: { - size: 'small', + defaultProps: { + size: 'small', + }, }, MuiTable: { - size: 'small', + defaultProps: { + size: 'small', + }, }, MuiTextField: { - margin: 'dense', + defaultProps: { + margin: 'dense', + }, }, MuiToolbar: { - variant: 'dense', - }, - }, - overrides: { - MuiIconButton: { - sizeSmall: { - // Adjust spacing to reach minimal touch target hitbox - marginLeft: 4, - marginRight: 4, - padding: 12, + defaultProps: { + variant: 'dense', }, }, }, diff --git a/docs/src/pages/customization/density/density-pt.md b/docs/src/pages/customization/density/density-pt.md index 1ce0693f44bfe8..60e63cb1fd1ee4 100644 --- a/docs/src/pages/customization/density/density-pt.md +++ b/docs/src/pages/customization/density/density-pt.md @@ -38,54 +38,78 @@ O tema é configurado com as seguintes opções: ```js const theme = createTheme({ - props: { + components: { MuiButton: { - size: 'small', + defaultProps: { + size: 'small', + }, }, MuiFilledInput: { - margin: 'dense', + defaultProps: { + margin: 'dense', + }, }, MuiFormControl: { - margin: 'dense', + defaultProps: { + margin: 'dense', + }, }, MuiFormHelperText: { - margin: 'dense', + defaultProps: { + margin: 'dense', + }, }, MuiIconButton: { - size: 'small', + defaultProps: { + size: 'small', + }, + styleOverrides: { + sizeSmall: { + // Adjust spacing to reach minimal touch target hitbox + marginLeft: 4, + marginRight: 4, + padding: 12, + }, + }, }, MuiInputBase: { - margin: 'dense', + defaultProps: { + margin: 'dense', + }, }, MuiInputLabel: { - margin: 'dense', + defaultProps: { + margin: 'dense', + }, }, MuiListItem: { - dense: true, + defaultProps: { + dense: true, + }, }, MuiOutlinedInput: { - margin: 'dense', + defaultProps: { + margin: 'dense', + }, }, MuiFab: { - size: 'small', + defaultProps: { + size: 'small', + }, }, MuiTable: { - size: 'small', + defaultProps: { + size: 'small', + }, }, MuiTextField: { - margin: 'dense', + defaultProps: { + margin: 'dense', + }, }, MuiToolbar: { - variant: 'dense', - }, - }, - overrides: { - MuiIconButton: { - sizeSmall: { - // Ajusta o espaçamento para atingir o mínimo de toque - marginLeft: 4, - marginRight: 4, - padding: 12, + defaultProps: { + variant: 'dense', }, }, }, diff --git a/docs/src/pages/customization/density/density-ru.md b/docs/src/pages/customization/density/density-ru.md index 22456d21709afc..99c7e0002bdb39 100644 --- a/docs/src/pages/customization/density/density-ru.md +++ b/docs/src/pages/customization/density/density-ru.md @@ -38,54 +38,78 @@ The theme is configured with the following options: ```js const theme = createTheme({ - props: { + components: { MuiButton: { - size: 'small', + defaultProps: { + size: 'small', + }, }, MuiFilledInput: { - margin: 'dense', + defaultProps: { + margin: 'dense', + }, }, MuiFormControl: { - margin: 'dense', + defaultProps: { + margin: 'dense', + }, }, MuiFormHelperText: { - margin: 'dense', + defaultProps: { + margin: 'dense', + }, }, MuiIconButton: { - size: 'small', + defaultProps: { + size: 'small', + }, + styleOverrides: { + sizeSmall: { + // Adjust spacing to reach minimal touch target hitbox + marginLeft: 4, + marginRight: 4, + padding: 12, + }, + }, }, MuiInputBase: { - margin: 'dense', + defaultProps: { + margin: 'dense', + }, }, MuiInputLabel: { - margin: 'dense', + defaultProps: { + margin: 'dense', + }, }, MuiListItem: { - dense: true, + defaultProps: { + dense: true, + }, }, MuiOutlinedInput: { - margin: 'dense', + defaultProps: { + margin: 'dense', + }, }, MuiFab: { - size: 'small', + defaultProps: { + size: 'small', + }, }, MuiTable: { - size: 'small', + defaultProps: { + size: 'small', + }, }, MuiTextField: { - margin: 'dense', + defaultProps: { + margin: 'dense', + }, }, MuiToolbar: { - variant: 'dense', - }, - }, - overrides: { - MuiIconButton: { - sizeSmall: { - // Adjust spacing to reach minimal touch target hitbox - marginLeft: 4, - marginRight: 4, - padding: 12, + defaultProps: { + variant: 'dense', }, }, }, diff --git a/docs/src/pages/customization/density/density-zh.md b/docs/src/pages/customization/density/density-zh.md index 6e50fbbcfd6281..401d8c38cde81c 100644 --- a/docs/src/pages/customization/density/density-zh.md +++ b/docs/src/pages/customization/density/density-zh.md @@ -65,7 +65,7 @@ const theme = createTheme({ }, styleOverrides: { sizeSmall: { - // 调整间距,以达到最小的触摸目标命中框。 + // Adjust spacing to reach minimal touch target hitbox marginLeft: 4, marginRight: 4, padding: 12, diff --git a/docs/src/pages/customization/how-to-customize/how-to-customize-de.md b/docs/src/pages/customization/how-to-customize/how-to-customize-de.md index 86873cc3b84341..8373a4efbe2ef2 100644 --- a/docs/src/pages/customization/how-to-customize/how-to-customize-de.md +++ b/docs/src/pages/customization/how-to-customize/how-to-customize-de.md @@ -1,3 +1,7 @@ +- - - +components: GlobalStyles +- - - + # How to customize <p class="description">Sie können das Erscheinungsbild einer Material-UI-Komponente einfach anpassen.</p> @@ -16,7 +20,7 @@ Möglicherweise müssen Sie den Stil einer Komponente für eine bestimmte Implem ### Use the `sx` prop -The easiest way to add style overrides for a one-off situation is to use the `sx` prop available on all Material-UI components. Hier ist ein Beispiel: +The easiest way to add style overrides for a one-off situation is to use the [`sx` prop](/system/basics/#the-sx-prop) available on all Material-UI components. Hier ist ein Beispiel: {{"demo": "pages/customization/how-to-customize/SxProp.js"}} @@ -48,7 +52,7 @@ You can find examples of this using different styles libraries in the [Styles li The components special states, like *hover*, *focus*, *disabled* and *selected*, are styled with a higher CSS specificity. [Spezifität ist ein Gewicht](https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity) das für eine gegebene CSS-Deklaration gilt. -Um die internen Zustände der Komponenten zu überschreiben, **müssen Sie die Spezifität erhöhen **. Hier ist ein Beispiel mit dem *disable* Zustand und einer Button Komponente mittels einer **pseudo-class** (`:disabled`): +Um die internen Zustände der Komponenten zu überschreiben, **müssen Sie die Spezifität erhöhen **. Hier ist ein Beispiel mit dem *disable* Zustand und einer Button Komponente mittels einer **pseudo-class</strong> (`:disabled`): ```css .Button { @@ -118,7 +122,7 @@ You can rely on the following [global class names](/styles/advanced/#with-materi ## 2. Reusable style overrides -If you find that you need the same overrides in multiple places across your application, you can use the `styled()` utility for creating a reusable component: +If you find that you need the same overrides in multiple places across your application, you can use the [`styled()`](/customization/styled/) utility to create a reusable component: {{"demo": "pages/customization/how-to-customize/StyledCustomization.js", "defaultCodeOpen": true}} @@ -130,11 +134,30 @@ In the previous section, we learned how to override the style of a Material-UI c ### Dynamisches CSS +Using the `styled()` utility offers a simple way for adding dynamic styles based on props. + {{"demo": "pages/customization/how-to-customize/DynamicCSS.js", "defaultCodeOpen": false}} -### Klassenname Branch +> ⚠️ Note that if you are using TypeScript you will need to update the prop's types of the new component. + +```tsx +import * as React from 'react'; +import { styled } from '@material-ui/core/styles'; +import Slider, { SliderProps } from '@material-ui/core/Slider'; -{{"demo": "pages/customization/how-to-customize/DynamicClassName.js"}} +interface StyledSliderProps extends SliderProps { + success?: boolean; +} + +const StyledSlider = styled(Slider, { + shouldForwardProp: (prop) => prop !== 'success', +})<StyledSliderProps>(({ success, theme }) => ({ + ...(success && + { + // the overrides added when the new prop is used + }), +})); +``` ### CSS-Variablen @@ -156,7 +179,7 @@ Components expose [global class names](/styles/advanced/#with-material-ui-core) ```css .MuiButton-root { - fontsize: '1rem'; + font-size: 1rem; } ``` diff --git a/docs/src/pages/customization/how-to-customize/how-to-customize-es.md b/docs/src/pages/customization/how-to-customize/how-to-customize-es.md index 2678e47c68d535..0f1749856e8026 100644 --- a/docs/src/pages/customization/how-to-customize/how-to-customize-es.md +++ b/docs/src/pages/customization/how-to-customize/how-to-customize-es.md @@ -1,3 +1,7 @@ +- - - +components: GlobalStyles +- - - + # How to customize <p class="description">Los componentes Material-UI pueden ser personalizados de forma sencilla. </p> @@ -16,7 +20,7 @@ Tal vez necesitara cambiar el estilo de un componente para una implementación e ### Use the `sx` prop -The easiest way to add style overrides for a one-off situation is to use the `sx` prop available on all Material-UI components. Here is an example: +The easiest way to add style overrides for a one-off situation is to use the [`sx` prop](/system/basics/#the-sx-prop) available on all Material-UI components. Here is an example: {{"demo": "pages/customization/how-to-customize/SxProp.js"}} @@ -118,7 +122,7 @@ You can rely on the following [global class names](/styles/advanced/#with-materi ## 2. Reusable style overrides -If you find that you need the same overrides in multiple places across your application, you can use the `styled()` utility for creating a reusable component: +If you find that you need the same overrides in multiple places across your application, you can use the [`styled()`](/customization/styled/) utility to create a reusable component: {{"demo": "pages/customization/how-to-customize/StyledCustomization.js", "defaultCodeOpen": true}} @@ -130,11 +134,30 @@ In the previous section, we learned how to override the style of a Material-UI c ### Dynamic CSS +Using the `styled()` utility offers a simple way for adding dynamic styles based on props. + {{"demo": "pages/customization/how-to-customize/DynamicCSS.js", "defaultCodeOpen": false}} -### Class name branch +> ⚠️ Note that if you are using TypeScript you will need to update the prop's types of the new component. + +```tsx +import * as React from 'react'; +import { styled } from '@material-ui/core/styles'; +import Slider, { SliderProps } from '@material-ui/core/Slider'; -{{"demo": "pages/customization/how-to-customize/DynamicClassName.js"}} +interface StyledSliderProps extends SliderProps { + success?: boolean; +} + +const StyledSlider = styled(Slider, { + shouldForwardProp: (prop) => prop !== 'success', +})<StyledSliderProps>(({ success, theme }) => ({ + ...(success && + { + // the overrides added when the new prop is used + }), +})); +``` ### CSS variables @@ -156,7 +179,7 @@ Components expose [global class names](/styles/advanced/#with-material-ui-core) ```css .MuiButton-root { - fontsize: '1rem'; + font-size: 1rem; } ``` diff --git a/docs/src/pages/customization/how-to-customize/how-to-customize-fr.md b/docs/src/pages/customization/how-to-customize/how-to-customize-fr.md index 7684b514d3bb50..3cbd2ef05c7d5a 100644 --- a/docs/src/pages/customization/how-to-customize/how-to-customize-fr.md +++ b/docs/src/pages/customization/how-to-customize/how-to-customize-fr.md @@ -1,3 +1,7 @@ +- - - +Vous pouvez facilement personnaliser l'apparence d'un composant Material-UI. +- - - + # How to customize <p class="description">Vous pouvez facilement personnaliser l'apparence d'un composant Material-UI.</p> @@ -130,11 +134,17 @@ In the previous section, we learned how to override the style of a Material-UI c ### Dynamic CSS +{{"demo": "pages/customization/how-to-customize/DynamicClassName.js"}} + {{"demo": "pages/customization/how-to-customize/DynamicCSS.js", "defaultCodeOpen": false}} -### Class name branch +> ⚠️ Note that if you are using TypeScript you will need to update the prop's types of the new component. -{{"demo": "pages/customization/how-to-customize/DynamicClassName.js"}} +```tsx +.MuiButton-root { + fontsize: '1rem'; +} +``` ### CSS variables @@ -156,7 +166,7 @@ Components expose [global class names](/styles/advanced/#with-material-ui-core) ```css .MuiButton-root { - fontsize: '1rem'; + font-size: 1rem; } ``` diff --git a/docs/src/pages/customization/how-to-customize/how-to-customize-ja.md b/docs/src/pages/customization/how-to-customize/how-to-customize-ja.md index 95807cf4ec3bdf..c79b7bb4d03217 100644 --- a/docs/src/pages/customization/how-to-customize/how-to-customize-ja.md +++ b/docs/src/pages/customization/how-to-customize/how-to-customize-ja.md @@ -1,3 +1,7 @@ +- - - +components: GlobalStyles +- - - + # コンポーネントのカスタマイズ <p class="description">Material-UIコンポーネントの外観を簡単にカスタマイズできます。</p> @@ -16,7 +20,7 @@ ### `size`プロパティを使う -一回限りスタイルをオーバーライドする上で最も簡単な方法は、すべての Material-UI コンポーネントで利用できる `sx` プロパティを使うことです。 Here is an example: +The easiest way to add style overrides for a one-off situation is to use the [`sx` prop](/system/basics/#the-sx-prop) available on all Material-UI components. Here is an example: {{"demo": "pages/customization/how-to-customize/SxProp.js"}} @@ -118,7 +122,7 @@ You can rely on the following [global class names](/styles/advanced/#with-materi ## 2. 再利用可能なスタイルの上書き -If you find that you need the same overrides in multiple places across your application, you can use the `styled()` utility for creating a reusable component: +If you find that you need the same overrides in multiple places across your application, you can use the [`styled()`](/customization/styled/) utility to create a reusable component: {{"demo": "pages/customization/how-to-customize/StyledCustomization.js", "defaultCodeOpen": true}} @@ -130,11 +134,30 @@ In the previous section, we learned how to override the style of a Material-UI c ### 動的CSS +Using the `styled()` utility offers a simple way for adding dynamic styles based on props. + {{"demo": "pages/customization/how-to-customize/DynamicCSS.js", "defaultCodeOpen": false}} -### クラス名のブランチ +> ⚠️ Note that if you are using TypeScript you will need to update the prop's types of the new component. + +```tsx +import * as React from 'react'; +import { styled } from '@material-ui/core/styles'; +import Slider, { SliderProps } from '@material-ui/core/Slider'; -{{"demo": "pages/customization/how-to-customize/DynamicClassName.js"}} +interface StyledSliderProps extends SliderProps { + success?: boolean; +} + +const StyledSlider = styled(Slider, { + shouldForwardProp: (prop) => prop !== 'success', +})<StyledSliderProps>(({ success, theme }) => ({ + ...(success && + { + // the overrides added when the new prop is used + }), +})); +``` ### CSS変数 @@ -156,7 +179,7 @@ Components expose [global class names](/styles/advanced/#with-material-ui-core) ```css .MuiButton-root { - fontsize: '1rem'; + font-size: 1rem; } ``` diff --git a/docs/src/pages/customization/how-to-customize/how-to-customize-pt.md b/docs/src/pages/customization/how-to-customize/how-to-customize-pt.md index 1e2fde9ea2c083..769108efdf755e 100644 --- a/docs/src/pages/customization/how-to-customize/how-to-customize-pt.md +++ b/docs/src/pages/customization/how-to-customize/how-to-customize-pt.md @@ -1,3 +1,7 @@ +- - - +components: GlobalStyles +- - - + # How to customize <p class="description">Você pode customizar facilmente a aparência de um componente do Material-UI.</p> @@ -16,7 +20,7 @@ Pode ser necessário alterar o estilo de um componente em alguma implementação ### Use the `sx` prop -The easiest way to add style overrides for a one-off situation is to use the `sx` prop available on all Material-UI components. Aqui está um exemplo: +The easiest way to add style overrides for a one-off situation is to use the [`sx` prop](/system/basics/#the-sx-prop) available on all Material-UI components. Aqui está um exemplo: {{"demo": "pages/customization/how-to-customize/SxProp.js"}} @@ -118,7 +122,7 @@ You can rely on the following [global class names](/styles/advanced/#with-materi ## 2. Reusable style overrides -If you find that you need the same overrides in multiple places across your application, you can use the `styled()` utility for creating a reusable component: +If you find that you need the same overrides in multiple places across your application, you can use the [`styled()`](/customization/styled/) utility to create a reusable component: {{"demo": "pages/customization/how-to-customize/StyledCustomization.js", "defaultCodeOpen": true}} @@ -130,11 +134,30 @@ In the previous section, we learned how to override the style of a Material-UI c ### CSS Dinâmico +Using the `styled()` utility offers a simple way for adding dynamic styles based on props. + {{"demo": "pages/customization/how-to-customize/DynamicCSS.js", "defaultCodeOpen": false}} -### Nome de classe derivada +> ⚠️ Note that if you are using TypeScript you will need to update the prop's types of the new component. + +```tsx +import * as React from 'react'; +import { styled } from '@material-ui/core/styles'; +import Slider, { SliderProps } from '@material-ui/core/Slider'; -{{"demo": "pages/customization/how-to-customize/DynamicClassName.js"}} +interface StyledSliderProps extends SliderProps { + success?: boolean; +} + +const StyledSlider = styled(Slider, { + shouldForwardProp: (prop) => prop !== 'success', +})<StyledSliderProps>(({ success, theme }) => ({ + ...(success && + { + // the overrides added when the new prop is used + }), +})); +``` ### Variáveis CSS @@ -156,7 +179,7 @@ Components expose [global class names](/styles/advanced/#with-material-ui-core) ```css .MuiButton-root { - fontsize: '1rem'; + font-size: 1rem; } ``` diff --git a/docs/src/pages/customization/how-to-customize/how-to-customize-ru.md b/docs/src/pages/customization/how-to-customize/how-to-customize-ru.md index a81cbef127a926..8f9e1bf9b8b6fa 100644 --- a/docs/src/pages/customization/how-to-customize/how-to-customize-ru.md +++ b/docs/src/pages/customization/how-to-customize/how-to-customize-ru.md @@ -1,3 +1,7 @@ +- - - +components: GlobalStyles +- - - + # How to customize <p class="description">Вы можете легко настроить внешний вид компонента Material-UI.</p> @@ -16,7 +20,7 @@ As components can be used in different contexts, there are several approaches to ### Use the `sx` prop -The easiest way to add style overrides for a one-off situation is to use the `sx` prop available on all Material-UI components. Here is an example: +The easiest way to add style overrides for a one-off situation is to use the [`sx` prop](/system/basics/#the-sx-prop) available on all Material-UI components. Here is an example: {{"demo": "pages/customization/how-to-customize/SxProp.js"}} @@ -118,7 +122,7 @@ You can rely on the following [global class names](/styles/advanced/#with-materi ## 2. Reusable style overrides -If you find that you need the same overrides in multiple places across your application, you can use the `styled()` utility for creating a reusable component: +If you find that you need the same overrides in multiple places across your application, you can use the [`styled()`](/customization/styled/) utility to create a reusable component: {{"demo": "pages/customization/how-to-customize/StyledCustomization.js", "defaultCodeOpen": true}} @@ -130,11 +134,30 @@ In the previous section, we learned how to override the style of a Material-UI c ### Динамический CSS +Using the `styled()` utility offers a simple way for adding dynamic styles based on props. + {{"demo": "pages/customization/how-to-customize/DynamicCSS.js", "defaultCodeOpen": false}} -### Ответвление имени класса +> ⚠️ Note that if you are using TypeScript you will need to update the prop's types of the new component. + +```tsx +import * as React from 'react'; +import { styled } from '@material-ui/core/styles'; +import Slider, { SliderProps } from '@material-ui/core/Slider'; -{{"demo": "pages/customization/how-to-customize/DynamicClassName.js"}} +interface StyledSliderProps extends SliderProps { + success?: boolean; +} + +const StyledSlider = styled(Slider, { + shouldForwardProp: (prop) => prop !== 'success', +})<StyledSliderProps>(({ success, theme }) => ({ + ...(success && + { + // the overrides added when the new prop is used + }), +})); +``` ### CSS переменные @@ -156,7 +179,7 @@ Components expose [global class names](/styles/advanced/#with-material-ui-core) ```css .MuiButton-root { - fontsize: '1rem'; + font-size: 1rem; } ``` diff --git a/docs/src/pages/customization/how-to-customize/how-to-customize-zh.md b/docs/src/pages/customization/how-to-customize/how-to-customize-zh.md index 2f4af9a2345b3c..f4f2a44d66e387 100644 --- a/docs/src/pages/customization/how-to-customize/how-to-customize-zh.md +++ b/docs/src/pages/customization/how-to-customize/how-to-customize-zh.md @@ -1,48 +1,52 @@ -# How to customize +- - - +components: GlobalStyles +- - - + +# 如何定制 <p class="description">您可以轻松地自定义一个 Material-UI 组件的外观。</p> -As components can be used in different contexts, there are several approaches to customizing them. 从最狭窄到最广泛的用例,这些是: 从最狭窄到最广泛的用例,这些是: +由于组件可以在不同的环境中使用,因此有几种方法可以对其进行定制。 从最狭窄到最广泛的用例,这些是: -1. [One-off customization](#1-one-off-customization) -1. [Reusable style overrides](#2-reusable-style-overrides) -1. [Dynamic variation](#3-dynamic-variation) +1. [一次性定制](#1-one-off-customization) +1. [可重复使用的样式覆盖](#2-reusable-style-overrides) +1. [动态变体](#3-dynamic-variation) 1. [全局化主题变体](#4-global-theme-variation) 1. [全局 CSS 覆盖](#5-global-css-override) -## 1. One-off customization +## 1. 一次性定制 您可能需要为实现特定的组件而更改样式,以下有几种解决方案: -### Use the `sx` prop +### 使用 `sx` 属性 -The easiest way to add style overrides for a one-off situation is to use the `sx` prop available on all Material-UI components. 下面是一个示例: 下面是一个示例: +The easiest way to add style overrides for a one-off situation is to use the [`sx` prop](/system/basics/#the-sx-prop) available on all Material-UI components. 下面是一个示例: {{"demo": "pages/customization/how-to-customize/SxProp.js"}} -Next you'll see how you can you can use global class selectors for accessing slots inside the component. You'll also learn how to easily identify the classes which are available to you for each of the states and slots in the component. You'll also learn how to easily identify the classes which are available to you for each of the states and slots in the component. +接下来你会看到如何可以你可以使用全局类选择器来访问组件内部的插槽。 你还将学习如何轻松识别组件中每个状态和槽位的可用类。 -### Overriding nested component styles +### 覆盖嵌套组件样式 -You can use the browser dev tools to identify the slot for the component you want to override. It can save you a lot of time. You can use the browser dev tools to identify the slot for the component you want to override. It can save you a lot of time. The styles injected into the DOM by Material-UI rely on class names that [follow a simple pattern](/styles/advanced/#class-names): `[hash]-Mui[Component name]-[name of the slot]`. +你可以使用浏览器开发工具来确定您要覆盖的组件的插槽。 这样做可以节省你的很多时间。 Material-UI 注入到 DOM中 的样式依赖于[遵循简单模式的类名](/styles/advanced/#class-names):`[hash]-Mui[Component name]-[name of the slot]`. -⚠️ These class names can't be used as CSS selectors because they are unstable, however, Material-UI applies global class names using a consistent convention: `Mui[Component name]-[name of the slot]`. +⚠️ 这些类名不能用作 CSS 选择器,因为它们是不稳定的,然而,Material-UI 在应用全局类名时,使用了一致的约定:`Mui[Component name]-[name of the slot]`. -让我们回到上面的演示。 How can you override the slider's thumb? +让我们回到上面的演示。 如何覆写滑块的拇指图标? <img src="/static/images/customization/dev-tools.png" alt="dev-tools" width="406" /> -In this example, the styles are applied with `.css-ae2u5c-MuiSlider-thumb` so the name of the component is `Slider` and the name of the slot is `thumb`. +在本例中,样式应用的是 `.css-ae2u5c-MuiSlider-thumb`,所以组件的名称是 `Slider`,插槽的名称是 `thumb`。 -You now know that you need to target the `.MuiSlider-thumb` class name for overriding the look of the thumb: +你现在知道你需要针对 `.MuiSlider-thumb` 类名来覆盖拇指的外观: {{"demo": "pages/customization/how-to-customize/DevTools.js"}} ### 用类名(class names)覆盖样式 -If you would like to override the styles of the components using classes, you can use the `className` prop available on each component. For overriding the styles of the different parts inside the component, you can use the global classes available for each slot, as described in the previous section. For overriding the styles of the different parts inside the component, you can use the global classes available for each slot, as described in the previous section. +如果你想使用类覆盖组件的样式,你可以使用每个组件上可用的 `className` 属性。 对于覆盖组件内部不同部件的样式,可以使用每个槽位可用的全局类,如前一节所述。 -You can find examples of this using different styles libraries in the [Styles library interoperability](/guides/interoperability/) guide. +您可以在 [样式库互操作性](/guides/interoperability/) 指南中找到不同样式库的示例。 ### CSS 伪类(Pseudo-classes) @@ -55,7 +59,7 @@ You can find examples of this using different styles libraries in the [Styles li color: black; } -/* Increase the specificity */ +/* 覆盖属性 */ .Button:disabled { color: white; } @@ -65,14 +69,14 @@ You can find examples of this using different styles libraries in the [Styles li <Button disabled className="Button"> ``` -Sometimes, you can't use a **pseudo-class**, as the state doesn't exist in the web specification. 我们以菜单项(menu item)组件和 *selected* 状态为例。 我们以菜单项(menu item)组件和 *selected* 状态为例。 You can use the `.Mui-selected` global class name to customize the special state of the `MenuItem` component: +有时候,您不能使用**伪类**,因为web标准中不存在该状态。 我们以菜单项(menu item)组件和 *selected* 状态为例。 你可以使用全局类名`.Mui-selected`自定义`MenuItem`组件的特殊状态。 ```css .MenuItem { color: black; } -/* Increase the specificity */ +/* 覆盖属性 */ .MenuItem.Mui-selected { color: blue; } @@ -84,13 +88,13 @@ Sometimes, you can't use a **pseudo-class**, as the state doesn't exist in the w #### 为什么我需要增加优先级来覆盖一个组件的状态呢? -通过一些设计,CSS 的一些特殊要求让伪类提高了优先级。 For consistency with native elements, Material-UI increases the specificity of its custom pseudo-classes. 这有一个重要的优点,您可以自由挑选那些想要自定义状态。 这有一个重要的优点,您可以自由挑选那些想要自定义状态。 +通过一些设计,CSS 的一些特殊要求让伪类提高了优先级。 通过一些设计,CSS 的一些特殊要求让伪类提高了优先级。 这有一个重要的优点,您可以自由挑选那些想要自定义状态。 -#### What custom pseudo-classes are available in Material-UI? +#### Material-UI 内部有哪些可被自定义的伪类? You can rely on the following [global class names](/styles/advanced/#with-material-ui-core) generated by Material-UI: -| State | 全局类名 | +| 状态 | 全局类名 | |:------------- |:------------------- | | active | `.Mui-active` | | checked | `.Mui-checked` | @@ -116,25 +120,44 @@ You can rely on the following [global class names](/styles/advanced/#with-materi } ``` -## 2. Reusable style overrides +## 2. 可重复使用的样式覆盖 -If you find that you need the same overrides in multiple places across your application, you can use the `styled()` utility for creating a reusable component: +If you find that you need the same overrides in multiple places across your application, you can use the [`styled()`](/customization/styled/) utility to create a reusable component: {{"demo": "pages/customization/how-to-customize/StyledCustomization.js", "defaultCodeOpen": true}} With it, you have access to all of a component's props to dynamically style the component. -## 3。 Dynamic variation +## 3。 动态变体 -In the previous section, we learned how to override the style of a Material-UI component. 现在,让我们看看我们如何使动态地应用这个覆盖。 现在,让我们看看我们如何使动态地应用这个覆盖。 Here are four alternatives; each has its pros and cons. +In the previous section, we learned how to override the style of a Material-UI component. 现在,让我们看看我们如何使动态地应用这个覆盖。 Here are four alternatives; each has its pros and cons. ### 动态 CSS +Using the `styled()` utility offers a simple way for adding dynamic styles based on props. + {{"demo": "pages/customization/how-to-customize/DynamicCSS.js", "defaultCodeOpen": false}} -### 类名称分支 +> ⚠️ Note that if you are using TypeScript you will need to update the prop's types of the new component. + +```tsx +import * as React from 'react'; +import { styled } from '@material-ui/core/styles'; +import Slider, { SliderProps } from '@material-ui/core/Slider'; -{{"demo": "pages/customization/how-to-customize/DynamicClassName.js"}} +interface StyledSliderProps extends SliderProps { + success?: boolean; +} + +const StyledSlider = styled(Slider, { + shouldForwardProp: (prop) => prop !== 'success', +})<StyledSliderProps>(({ success, theme }) => ({ + ...(success && + { + // the overrides added when the new prop is used + }), +})); +``` ### CSS 变量 @@ -156,7 +179,7 @@ Components expose [global class names](/styles/advanced/#with-material-ui-core) ```css .MuiButton-root { - fontsize: '1rem'; + font-size: 1rem; } ``` diff --git a/docs/src/pages/customization/palette/palette-de.md b/docs/src/pages/customization/palette/palette-de.md index ea1af5af3ca2a9..327003e7cd07bb 100644 --- a/docs/src/pages/customization/palette/palette-de.md +++ b/docs/src/pages/customization/palette/palette-de.md @@ -27,12 +27,12 @@ Die Standardpalette verwendet die mit `A` (`A200` usw.) gekennzeichneten Schatti You may override the default palette values by including a palette object as part of your theme. If any of the: -- [`palette.primary`](/customization/default-theme/?expand-path=$.palette.primary) -- [`palette.secondary`](/customization/default-theme/?expand-path=$.palette.secondary) -- [`palette.error`](/customization/default-theme/?expand-path=$.palette.error) -- [`palette.warning`](/customization/default-theme/?expand-path=$.palette.warning) -- [`palette.info`](/customization/default-theme/?expand-path=$.palette.info) -- [`palette.success`](/customization/default-theme/?expand-path=$.palette.success) +- [`.palette.primary`](/customization/default-theme/?expand-path=$.palette.primary) +- [`.palette.secondary`](/customization/default-theme/?expand-path=$.palette.secondary) +- [`.palette.error`](/customization/default-theme/?expand-path=$.palette.error) +- [`.palette.warning`](/customization/default-theme/?expand-path=$.palette.warning) +- [`.palette.info`](/customization/default-theme/?expand-path=$.palette.info) +- [`.palette.success`](/customization/default-theme/?expand-path=$.palette.success) palette color objects are provided, they will replace the defaults. @@ -134,8 +134,13 @@ const theme = createTheme({ danger: '#e53e3e', }, palette: { + primary: { + main: '#0971f1', + darker: '#053e85', + }, neutral: { - main: '#5c6ac4', + main: '#64748B', + contrastText: '#fff', }, }, }); @@ -146,7 +151,7 @@ If you are using TypeScript, you would also need to use [module augmentation](/g <!-- tested with packages/material-ui/test/typescript/augmentation/paletteColors.spec.ts --> ```ts -declare module '@material-ui/core/styles/createTheme' { +declare module '@material-ui/core/styles/createMuiTheme' { interface Theme { status: { danger: React.CSSProperties['color'], @@ -169,13 +174,15 @@ declare module "@material-ui/core/styles/createPalette" { } ``` +{{"demo": "pages/customization/palette/CustomColor.js"}} + ## Picking colors Etwas Inspiration gefällig? The Material Design team has built an [palette configuration tool](/customization/color/#picking-colors) to help you. ## Dark mode -Material-UI comes with two palette types, light (the default) and dark. You can make the theme dark by setting `mode: 'dark'`. While it's only a single property value change, internally it modifies several palette values. +Material-UI comes with two palette modes: light (the default) and dark. You can make the theme dark by setting `mode: 'dark'`. ```js const darkTheme = createTheme({ @@ -185,11 +192,17 @@ const darkTheme = createTheme({ }); ``` -The colors modified by the palette type are the following: +While it's only a single value change, the `createTheme` helper modifies several palette values. The colors modified by the palette mode are the following: {{"demo": "pages/customization/palette/DarkTheme.js", "bg": "inline", "hideToolbar": true}} -### User preference +### Toggling color mode + +You can use the React context to toggle the mode with a button inside your page. + +{{"demo": "pages/customization/palette/ToggleColorMode.js", "defaultCodeOpen": false}} + +### System preference Users might have specified a preference for a light or dark theme. The method by which the user expresses their preference can vary. It might be a system-wide setting exposed by the Operating System, or a setting controlled by the User Agent. diff --git a/docs/src/pages/customization/palette/palette-es.md b/docs/src/pages/customization/palette/palette-es.md index 84609a0b1e890a..fa9e75e85081fe 100644 --- a/docs/src/pages/customization/palette/palette-es.md +++ b/docs/src/pages/customization/palette/palette-es.md @@ -27,12 +27,12 @@ La paleta predeterminada utiliza los tonos con prefijo `A` (`A200`, etc.) para l Puede anular los valores de la paleta por defecto incluyendo un objeto de paleta como parte de su tema. If any of the: -- [`palette.primary`](/customization/default-theme/?expand-path=$.palette.primary) -- [`palette.secondary`](/customization/default-theme/?expand-path=$.palette.secondary) -- [`palette.error`](/customization/default-theme/?expand-path=$.palette.error) -- [`palette.warning`](/customization/default-theme/?expand-path=$.palette.warning) -- [`palette.info`](/customization/default-theme/?expand-path=$.palette.info) -- [`palette.success`](/customization/default-theme/?expand-path=$.palette.success) +- [`.palette.primary`](/customization/default-theme/?expand-path=$.palette.primary) +- [`.palette.secondary`](/customization/default-theme/?expand-path=$.palette.secondary) +- [`.palette.error`](/customization/default-theme/?expand-path=$.palette.error) +- [`.palette.warning`](/customization/default-theme/?expand-path=$.palette.warning) +- [`.palette.info`](/customization/default-theme/?expand-path=$.palette.info) +- [`.palette.success`](/customization/default-theme/?expand-path=$.palette.success) palette color objects are provided, they will replace the defaults. @@ -134,8 +134,13 @@ const theme = createTheme({ danger: '#e53e3e', }, palette: { + primary: { + main: '#0971f1', + darker: '#053e85', + }, neutral: { - main: '#5c6ac4', + main: '#64748B', + contrastText: '#fff', }, }, }); @@ -148,7 +153,7 @@ If you are using TypeScript, you would also need to use [module augmentation](/g ```ts import * as React from 'react'; import useMediaQuery from '@material-ui/core/useMediaQuery'; -import { createTheme, ThemeProvider } from '@material-ui/core/styles'; +import { createMuiTheme, ThemeProvider } from '@material-ui/core/styles'; import CssBaseline from '@material-ui/core/CssBaseline'; function App() { @@ -156,7 +161,7 @@ function App() { const theme = React.useMemo( () => - createTheme({ + createMuiTheme({ palette: { type: prefersDarkMode ? 'dark' : 'light', }, @@ -173,13 +178,15 @@ function App() { } ``` +{{"demo": "pages/customization/palette/CustomColor.js"}} + ## Picking colors Need inspiration? The Material Design team has built an [palette configuration tool](/customization/color/#picking-colors) to help you. ## Dark mode -Material-UI comes with two palette types, light (the default) and dark. Puedes convertir el tema a obscuro cambiando la configuración `mode: 'dark'`. While it's only a single property value change, internally it modifies several palette values. +Material-UI comes with two palette modes: light (the default) and dark. Puedes convertir el tema a obscuro cambiando la configuración `mode: 'dark'`. ```js const darkTheme = createTheme({ @@ -189,11 +196,17 @@ const darkTheme = createTheme({ }); ``` -The colors modified by the palette type are the following: +While it's only a single value change, the `createTheme` helper modifies several palette values. The colors modified by the palette mode are the following: {{"demo": "pages/customization/palette/DarkTheme.js", "bg": "inline", "hideToolbar": true}} -### User preference +### Toggling color mode + +You can use the React context to toggle the mode with a button inside your page. + +{{"demo": "pages/customization/palette/ToggleColorMode.js", "defaultCodeOpen": false}} + +### System preference Users might have specified a preference for a light or dark theme. The method by which the user expresses their preference can vary. It might be a system-wide setting exposed by the Operating System, or a setting controlled by the User Agent. diff --git a/docs/src/pages/customization/palette/palette-fr.md b/docs/src/pages/customization/palette/palette-fr.md index 9cad0b9c22bbe8..ac4ccac9056e4a 100644 --- a/docs/src/pages/customization/palette/palette-fr.md +++ b/docs/src/pages/customization/palette/palette-fr.md @@ -1,31 +1,31 @@ # Palette -<p class="description">The palette enables you to modify the color of the components to suit your brand.</p> +<p class="description">La palette vous permet de modifier la couleur des composants en fonction de votre marque.</p> -## Palette colors +## Couleurs des palettes -The theme exposes the following palette colors (accessible under `theme.palette.`): +Le thème expose les couleurs de palette suivantes (accessibles sous `theme.palette.`) : -- *primary* - used to represent primary interface elements for a user. It's the color displayed most frequently across your app's screens and components. -- *secondary* - used to represent secondary interface elements for a user. It provides more ways to accent and distinguish your product. Having it is optional. -- *error* - used to represent interface elements that the user should be made aware of. -- *warning* - used to represent potentially dangerous actions or important messages. -- *info* - used to present information to the user that is neutral and not necessarily important. -- *success* - used to indicate the successful completion of an action that user triggered. +- _primary_ - utilisé pour représenter les éléments d'interface principaux pour un utilisateur. C'est la couleur qui s'affiche le plus fréquemment sur les écrans et les composants de votre application. +- _secondary_ - utilisé pour représenter des éléments d'interface secondaires pour un utilisateur. Il offre plus de façons d'accentuer et de distinguer votre produit. L'avoir est facultatif. +- _error_ - utilisé pour représenter les éléments d'interface dont l'utilisateur doit être informé. +- _warning_ - utilisé pour représenter des actions potentiellement dangereuses ou des messages importants. +- _info_ - utilisé pour présenter à l'utilisateur des informations neutres et pas nécessairement importantes. +- _success_ - utilisé pour indiquer la réussite d'une action déclenchée par l'utilisateur. -If you want to learn more about color, you can check out [the color section](/customization/color/). +Si vous souhaitez en savoir plus sur la couleur, vous pouvez consulter la [section couleur](/customization/color/). ## Default values -You can explore the default values of the palette using [the theme explorer](/customization/default-theme/?expand-path=$.palette) or by opening the dev tools console on this page (`window.theme.palette`). +Vous pouvez explorer les valeurs par défaut de la palette en utilisant [l'explorateur de thèmes](/customization/default-theme/?expand-path=$.palette) ou en ouvrant la console des outils de développement sur cette page (`window.theme.palette`). {{"demo": "pages/customization/palette/Intentions.js", "bg": "inline", "hideToolbar": true}} -The default palette uses the shades prefixed with `A` (`A200`, etc.) for the secondary intention, and the un-prefixed shades for the other intentions. +La palette par défaut utilise les nuances préfixées par `A` (`A200`, etc.) pour la couleur de la palette secondaire, et les nuances non préfixées pour les autres couleurs de la palette. ## Personnalisation -You may override the default palette values by including a palette object as part of your theme. If any of the: +Vous pouvez remplacer les valeurs de palette par défaut en incluant un objet palette dans votre thème. Si l'un des : - [`palette.primary`](/customization/default-theme/?expand-path=$.palette.primary) - [`palette.secondary`](/customization/default-theme/?expand-path=$.palette.secondary) @@ -34,9 +34,9 @@ You may override the default palette values by including a palette object as par - [`palette.info`](/customization/default-theme/?expand-path=$.palette.info) - [`palette.success`](/customization/default-theme/?expand-path=$.palette.success) -palette color objects are provided, they will replace the defaults. +des objets de couleur de palette sont fournis, ils remplaceront ceux par défaut. -The palette color value can either be a [color](/customization/color/#2014-material-design-color-palettes) object, or an object with one or more of the keys specified by the following TypeScript interface: +La valeur de couleur de la palette peut être soit un objet [color](/customization/color/#2014-material-design-color-palettes), soit un objet avec une ou plusieurs des clés spécifiées par l'interface TypeScript suivante : ```ts interface PaletteColor { @@ -47,9 +47,9 @@ interface PaletteColor { } ``` -### Using a color object +### Utiliser un objet de couleur -The simplest way to customize an intention is to import one or more of the provided colors and apply them to a palette intention: +Le moyen le plus simple de personnaliser une couleur de palette est d'importer une ou plusieurs des couleurs fournies et de les appliquer : ```js import { createTheme } from '@material-ui/core/styles'; @@ -62,9 +62,9 @@ const theme = createTheme({ }); ``` -### Providing the colors directly +### Fournir les couleurs directement -If you wish to provide more customized colors, you can either create your own color object, or directly supply colors to some or all of the intention's keys: +Si vous souhaitez fournir des couleurs plus personnalisées, vous pouvez soit créer votre propre palette de couleurs, ou fournir directement des couleurs à tout ou partie des clés `theme.palette` : ```js import { createTheme } from '@material-ui/core/styles'; @@ -89,23 +89,18 @@ const theme = createTheme({ }, }); contrastThreshold: 3, - // Used by the functions below to shift a color's luminance by approximately - // two indexes within its tonal palette. - tonalOffset: 0.2, - }, -}); - contrastThreshold: 3, - // Used by the functions below to shift a color's luminance by approximately - // two indexes within its tonal palette. + // Utilisé par les fonctions ci-dessous pour décaler la luminance d'une couleur d'environ + // deux index dans sa palette tonale. + // Par exemple, passer du Red 500 au Red 300 ou au Red 700. // E.g., shift from Red 500 to Red 300 or Red 700. ``` -As in the example above, if the intention object contains custom colors using any of the "main", "light", "dark" or "contrastText" keys, these map as follows: +Comme dans l'exemple ci-dessus, si la couleur de la palette contient des couleurs personnalisées utilisant l'un des clés "main", "light", "dark" ou "contrastText", ces clés sont mappées comme suit : -- If the "dark" and / or "light" keys are omitted, their value(s) will be calculated from "main", according to the "tonalOffset" value. -- If "contrastText" is omitted, its value will be calculated to contrast with "main", according to the "contrastThreshold" value. +- Si les clés "dark" et/ou "light" ne sont pas données, leur(s) valeur(s) seront calculées à partir de "main", selon la valeur "tonalOffset". +- Si "contrastText" n'est pas indiqué, sa valeur sera calculée pour contraster avec "main", selon la valeur "contrastThreshold". -Both the "tonalOffset" and "contrastThreshold" values may be customized as needed. The "tonalOffset" value can either be a number between 0 and 1, which will apply to both light and dark variants, or an object with light and dark variants specified by the following TypeScript type: +Les valeurs "tonalOffset" et "contrastThreshold" peuvent être personnalisées selon les besoins. La valeur "tonalOffset" peut être soit un nombre compris entre 0 et 1, qui s'appliquera aux variantes claires et sombres, soit un objet avec des variantes claires et sombres spécifiées par le type TypeScript suivant : ```ts type PaletteTonalOffset = number | { @@ -114,17 +109,17 @@ type PaletteTonalOffset = number | { }; ``` -A higher value for "tonalOffset" will make calculated values for "light" lighter, and "dark" darker. A higher value for "contrastThreshold" increases the point at which a background color is considered light, and given a dark "contrastText". +Une valeur plus élevée pour "tonalOffset" rendra les valeurs calculées pour "light" plus claires et "dark" plus sombres. Une valeur plus élevée pour "contrastThreshold" augmente le point auquel une couleur d'arrière-plan est considérée light, et donné un "contrastText" dark -Note that "contrastThreshold" follows a non-linear curve. +Notez que "contrastThreshold" suit une courbe non linéaire. ### Exemple {{"demo": "pages/customization/palette/Palette.js", "defaultCodeOpen": true}} -### Adding new colors +### Ajout de nouvelles couleurs -You can add new colors inside and outside the palette of the theme as follow: +Vous pouvez ajouter de nouvelles couleurs à l'intérieur et à l'extérieur de la palette du thème comme suit : ```js import { createTheme } from '@material-ui/core/styles'; @@ -169,13 +164,15 @@ declare module "@material-ui/core/styles/createPalette" { } ``` +{{"demo": "pages/customization/palette/CustomColor.js"}} + ## Picking colors -Need inspiration? The Material Design team has built an [palette configuration tool](/customization/color/#picking-colors) to help you. +Besoin d'inspiration ? L'équipe Material Design a conçu un [outil de configuration de palette](/customization/color/#picking-colors) pour vous aider. -## Dark mode +## Mode Sombre -Material-UI comes with two palette types, light (the default) and dark. You can make the theme dark by setting `mode: 'dark'`. While it's only a single property value change, internally it modifies several palette values. +Material-UI comes with two palette types, light (the default) and dark. Vous pouvez rendre le thème sombre en définissant le `mode : 'dark'`. ```js const darkTheme = createTheme({ @@ -185,17 +182,23 @@ const darkTheme = createTheme({ }); ``` -The colors modified by the palette type are the following: +While it's only a single property value change, internally it modifies several palette values. The colors modified by the palette type are the following: {{"demo": "pages/customization/palette/DarkTheme.js", "bg": "inline", "hideToolbar": true}} ### User preference -Users might have specified a preference for a light or dark theme. The method by which the user expresses their preference can vary. It might be a system-wide setting exposed by the Operating System, or a setting controlled by the User Agent. +You can use the React context to toggle the mode with a button inside your page. + +{{"demo": "pages/customization/palette/ToggleColorMode.js", "defaultCodeOpen": false}} + +### System preference + +Les utilisateurs peuvent avoir spécifié une préférence pour un thème clair ou sombre. La méthode par laquelle l'utilisateur exprime sa préférence peut varier. Il peut s'agir d'un paramètre à l'échelle du système exposé par le système d'exploitation ou d'un paramètre contrôlé par l'agent utilisateur. -You can leverage this preference dynamically with the [useMediaQuery](/components/use-media-query/) hook and the [prefers-color-scheme](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme) media query. +Vous pouvez exploiter cette préférence de manière dynamique avec le crochet [useMediaQuery](/components/use-media-query/) et la requête média [prefers-color-scheme](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme). -For instance, you can enable the dark mode automatically: +Par exemple, vous pouvez activer le mode sombre automatiquement : ```jsx import * as React from 'react'; diff --git a/docs/src/pages/customization/palette/palette-ja.md b/docs/src/pages/customization/palette/palette-ja.md index 45981ad2069127..63866dc8a190bb 100644 --- a/docs/src/pages/customization/palette/palette-ja.md +++ b/docs/src/pages/customization/palette/palette-ja.md @@ -27,12 +27,12 @@ You can explore the default values of the palette using [the theme explorer](/cu You may override the default palette values by including a palette object as part of your theme. If any of the: -- [`palette.primary`](/customization/default-theme/?expand-path=$.palette.primary) -- [`palette.secondary`](/customization/default-theme/?expand-path=$.palette.secondary) -- [`palette.error`](/customization/default-theme/?expand-path=$.palette.error) -- [`palette.warning`](/customization/default-theme/?expand-path=$.palette.warning) -- [`palette.info`](/customization/default-theme/?expand-path=$.palette.info) -- [`palette.success`](/customization/default-theme/?expand-path=$.palette.success) +- [`.palette.primary`](/customization/default-theme/?expand-path=$.palette.primary) +- [`.palette.secondary`](/customization/default-theme/?expand-path=$.palette.secondary) +- [`.palette.error`](/customization/default-theme/?expand-path=$.palette.error) +- [`.palette.warning`](/customization/default-theme/?expand-path=$.palette.warning) +- [`.palette.info`](/customization/default-theme/?expand-path=$.palette.info) +- [`.palette.success`](/customization/default-theme/?expand-path=$.palette.success) palette color objects are provided, they will replace the defaults. @@ -128,8 +128,13 @@ const theme = createTheme({ danger: '#e53e3e', }, palette: { + primary: { + main: '#0971f1', + darker: '#053e85', + }, neutral: { - main: '#5c6ac4', + main: '#64748B', + contrastText: '#fff', }, }, }); @@ -140,7 +145,7 @@ If you are using TypeScript, you would also need to use [module augmentation](/g <!-- tested with packages/material-ui/test/typescript/augmentation/paletteColors.spec.ts --> ```ts -declare module '@material-ui/core/styles/createTheme' { +declare module '@material-ui/core/styles/createMuiTheme' { interface Theme { status: { danger: React.CSSProperties['color'], @@ -163,13 +168,15 @@ declare module "@material-ui/core/styles/createPalette" { } ``` +{{"demo": "pages/customization/palette/CustomColor.js"}} + ## Picking colors インスピレーションが必要ですか? インスピレーションが必要ですか? インスピレーションが必要ですか? インスピレーションが必要ですか? インスピレーションが必要ですか? The Material Design team has built an [palette configuration tool](/customization/color/#picking-colors) to help you. ## Dark mode -Material-UI comes with two palette types, light (the default) and dark. You can make the theme dark by setting `mode: 'dark'`. While it's only a single property value change, internally it modifies several palette values. +Material-UI comes with two palette modes: light (the default) and dark. You can make the theme dark by setting `mode: 'dark'`. ```js const darkTheme = createTheme({ @@ -179,11 +186,17 @@ const darkTheme = createTheme({ }); ``` -The colors modified by the palette type are the following: +While it's only a single value change, the `createTheme` helper modifies several palette values. The colors modified by the palette mode are the following: {{"demo": "pages/customization/palette/DarkTheme.js", "bg": "inline", "hideToolbar": true}} -### User preference +### Toggling color mode + +You can use the React context to toggle the mode with a button inside your page. + +{{"demo": "pages/customization/palette/ToggleColorMode.js", "defaultCodeOpen": false}} + +### System preference Users might have specified a preference for a light or dark theme. The method by which the user expresses their preference can vary. It might be a system-wide setting exposed by the Operating System, or a setting controlled by the User Agent. diff --git a/docs/src/pages/customization/palette/palette-pt.md b/docs/src/pages/customization/palette/palette-pt.md index efecddde401e3c..a102b8775439f9 100644 --- a/docs/src/pages/customization/palette/palette-pt.md +++ b/docs/src/pages/customization/palette/palette-pt.md @@ -27,12 +27,12 @@ A paleta padrão usa as sombras prefixadas com `A` (`A200`, etc.) para a intenç Você pode sobrescrever os valores padrão da paleta incluindo um objeto de paleta como parte do seu tema. Se algum dos seguintes: -- [`palette.primary`](/customization/default-theme/?expand-path=$.palette.primary) -- [`palette.secondary`](/customization/default-theme/?expand-path=$.palette.secondary) -- [`palette.error`](/customization/default-theme/?expand-path=$.palette.error) -- [`palette.warning`](/customization/default-theme/?expand-path=$.palette.warning) -- [`palette.info`](/customization/default-theme/?expand-path=$.palette.info) -- [`palette.success`](/customization/default-theme/?expand-path=$.palette.success) +- [`.palette.primary`](/customization/default-theme/?expand-path=$.palette.primary) +- [`.palette.secondary`](/customization/default-theme/?expand-path=$.palette.secondary) +- [`.palette.error`](/customization/default-theme/?expand-path=$.palette.error) +- [`.palette.warning`](/customization/default-theme/?expand-path=$.palette.warning) +- [`.palette.info`](/customization/default-theme/?expand-path=$.palette.info) +- [`.palette.success`](/customization/default-theme/?expand-path=$.palette.success) palette color objects are provided, they will replace the defaults. @@ -72,19 +72,19 @@ import { createTheme } from '@material-ui/core/styles'; const theme = createTheme({ palette: { primary: { - // light: será calculada com base em palette.primary.main, + // light: will be calculated from palette.primary.main, main: '#ff4400', - // dark: será calculada com base em palette.primary.main, - // contrastText: será calculada para contrastar com palette.primary.main + // dark: will be calculated from palette.primary.main, + // contrastText: will be calculated to contrast with palette.primary.main }, secondary: { light: '#0066ff', main: '#0044ff', - // dark: será calculada com base palette.secondary.main, + // dark: will be calculated from palette.secondary.main, contrastText: '#ffcc00', }, - // Usado por `getContrastText()` para maximizar o contraste entre - // o plano de fundo e o texto. + // Used by `getContrastText()` to maximize the contrast between + // the background and the text. contrastThreshold: 3, // Usado pelas funções abaixo para mudança de uma cor de luminância por aproximadamente // dois índices dentro de sua paleta tonal. @@ -128,8 +128,13 @@ const theme = createTheme({ danger: '#e53e3e', }, palette: { + primary: { + main: '#0971f1', + darker: '#053e85', + }, neutral: { - main: '#5c6ac4', + main: '#64748B', + contrastText: '#fff', }, }, }); @@ -140,7 +145,7 @@ Se você estiver usando TypeScript, você também deverá usar a [extensão de m <!-- tested with packages/material-ui/test/typescript/augmentation/paletteColors.spec.ts --> ```ts -declare module '@material-ui/core/styles/createTheme' { +declare module '@material-ui/core/styles/createMuiTheme' { interface Theme { status: { danger: React.CSSProperties['color'], @@ -163,13 +168,15 @@ declare module "@material-ui/core/styles/createPalette" { } ``` +{{"demo": "pages/customization/palette/CustomColor.js"}} + ## Escolhendo cores Precisa de inspiração? A equipe do Material Design construiu uma [ferramenta de configuração de paleta](/customization/color/#picking-colors) para te ajudar. ## Modo escuro -O Material-UI vem com dois tipos de paletas, claro (o padrão) e escuro. Você pode deixar o tema escuro definindo `mode: 'dark'`. Embora seja apenas uma alteração no valor de uma propriedade única, internamente ela modifica vários valores da paleta. +Material-UI comes with two palette modes: light (the default) and dark. Você pode deixar o tema escuro definindo `mode: 'dark'`. ```js const darkTheme = createTheme({ @@ -179,11 +186,17 @@ const darkTheme = createTheme({ }); ``` -As cores modificadas pelo tipo da paleta são as seguintes: +While it's only a single value change, the `createTheme` helper modifies several palette values. The colors modified by the palette mode are the following: {{"demo": "pages/customization/palette/DarkTheme.js", "bg": "inline", "hideToolbar": true}} -### Preferência do usuário +### Toggling color mode + +You can use the React context to toggle the mode with a button inside your page. + +{{"demo": "pages/customization/palette/ToggleColorMode.js", "defaultCodeOpen": false}} + +### System preference Usuários podem especificar uma preferência por um tema claro ou escuro. O método pelo qual o usuário expressa a sua preferência pode variar. Pode ser uma configuração de sistema exposta pelo Sistema Operacional, ou uma configuração controlada pelo Agente de Usuário. diff --git a/docs/src/pages/customization/palette/palette-ru.md b/docs/src/pages/customization/palette/palette-ru.md index e125ee2ec0abd3..827fc79e0e29c8 100644 --- a/docs/src/pages/customization/palette/palette-ru.md +++ b/docs/src/pages/customization/palette/palette-ru.md @@ -6,12 +6,12 @@ The theme exposes the following palette colors (accessible under `theme.palette.`): -- *primary* - used to represent primary interface elements for a user. It's the color displayed most frequently across your app's screens and components. -- *secondary* - used to represent secondary interface elements for a user. It provides more ways to accent and distinguish your product. Having it is optional. -- *error* - used to represent interface elements that the user should be made aware of. -- *warning* - used to represent potentially dangerous actions or important messages. -- *info* - used to present information to the user that is neutral and not necessarily important. -- *success* - used to indicate the successful completion of an action that user triggered. +- *primary* - Основной. Используется для отображения основных элементов интерфейса It's the color displayed most frequently across your app's screens and components. +- *secondary* - Второстепенный. Используется для отображения второстепенных элементов интерфейса. It provides more ways to accent and distinguish your product. Having it is optional. +- *error* - Цвет ошибки. Используется для отображения элементов, на которые нужно обратить внимание. +- *Предупреждение. Используется для отображения потенциально опасных действия или важных сообщений.</li> +- *info* - Информация. Используется для отображения нейтральной, не представляющей особой важности информации. +- *success* - Успешно. Используется для оповещения об успешном завершении вызванного пользователем действия.</ul> Для более подробного изучения цветовых настроек можно посетить [секцию про цвета](/customization/color/). @@ -21,20 +21,20 @@ You can explore the default values of the palette using [the theme explorer](/cu {{"demo": "pages/customization/palette/Intentions.js", "bg": "inline", "hideToolbar": true}} -Стандартная палитра использует оттенки с префиксом `A` (`A200`, и т. д.) для вторичного оттенка, и без префикса для остальных. +Стандартная палитра использует оттенки с префиксом `A` (`A200`, и т. д.) - для вторичного оттенка, и без префикса - для всех остальных. ## Кастомизация You may override the default palette values by including a palette object as part of your theme. If any of the: -- [`palette.primary`](/customization/default-theme/?expand-path=$.palette.primary) -- [`palette.secondary`](/customization/default-theme/?expand-path=$.palette.secondary) -- [`palette.error`](/customization/default-theme/?expand-path=$.palette.error) -- [`palette.warning`](/customization/default-theme/?expand-path=$.palette.warning) -- [`palette.info`](/customization/default-theme/?expand-path=$.palette.info) -- [`palette.success`](/customization/default-theme/?expand-path=$.palette.success) +- [`.palette.primary`](/customization/default-theme/?expand-path=$.palette.primary) +- [`.palette.secondary`](/customization/default-theme/?expand-path=$.palette.secondary) +- [`.palette.error`](/customization/default-theme/?expand-path=$.palette.error) +- [`.palette.warning`](/customization/default-theme/?expand-path=$.palette.warning) +- [`.palette.info`](/customization/default-theme/?expand-path=$.palette.info) +- [`.palette.success`](/customization/default-theme/?expand-path=$.palette.success) -palette color objects are provided, they will replace the defaults. +переопределенные цвета палитры заменят стандартные. The palette color value can either be a [color](/customization/color/#2014-material-design-color-palettes) object, or an object with one or more of the keys specified by the following TypeScript interface: @@ -49,7 +49,7 @@ interface PaletteColor { ### Using a color object -The simplest way to customize an intention is to import one or more of the provided colors and apply them to a palette intention: +Простейший способ переопределить цветовую палитру - импортировать один или несколько существующих цветов и применить их. ```js import { createTheme } from '@material-ui/core/styles'; @@ -64,7 +64,7 @@ const theme = createTheme({ ### Providing the colors directly -If you wish to provide more customized colors, you can either create your own color object, or directly supply colors to some or all of the intention's keys: +Для создания палитры с большим количеством цветов вы можете либо создать свой собственный цвет, либо записать цвета напрямую в один или все ключи `тематической палитры` ```js import { createTheme } from '@material-ui/core/styles'; @@ -100,7 +100,7 @@ const theme = createTheme({ // E.g., shift from Red 500 to Red 300 or Red 700. ``` -As in the example above, if the intention object contains custom colors using any of the "main", "light", "dark" or "contrastText" keys, these map as follows: +В примере выше, если палитра содержит пользовательские цвета с одним из следующих ключей: "main", "light", "dark" или"contrastText", они используются следующим образом: - If the "dark" and / or "light" keys are omitted, their value(s) will be calculated from "main", according to the "tonalOffset" value. - If "contrastText" is omitted, its value will be calculated to contrast with "main", according to the "contrastThreshold" value. @@ -134,8 +134,13 @@ const theme = createTheme({ danger: '#e53e3e', }, palette: { + primary: { + main: '#0971f1', + darker: '#053e85', + }, neutral: { - main: '#5c6ac4', + main: '#64748B', + contrastText: '#fff', }, }, }); @@ -146,7 +151,7 @@ If you are using TypeScript, you would also need to use [module augmentation](/g <!-- tested with packages/material-ui/test/typescript/augmentation/paletteColors.spec.ts --> ```ts -declare module '@material-ui/core/styles/createTheme' { +declare module '@material-ui/core/styles/createMuiTheme' { interface Theme { status: { danger: React.CSSProperties['color'], @@ -169,13 +174,15 @@ declare module "@material-ui/core/styles/createPalette" { } ``` +{{"demo": "pages/customization/palette/CustomColor.js"}} + ## Picking colors Ищите вдохновение? The Material Design team has built an [palette configuration tool](/customization/color/#picking-colors) to help you. ## Темный режим -Material-UI comes with two palette types, light (the default) and dark. Вы можете сделать тему темной, установив режим `mode: 'dark'`. While it's only a single property value change, internally it modifies several palette values. +Material-UI comes with two palette modes: light (the default) and dark. Вы можете сделать тему темной, установив режим `mode: 'dark'`. ```js const darkTheme = createTheme({ @@ -185,11 +192,17 @@ const darkTheme = createTheme({ }); ``` -The colors modified by the palette type are the following: +While it's only a single value change, the `createTheme` helper modifies several palette values. The colors modified by the palette mode are the following: {{"demo": "pages/customization/palette/DarkTheme.js", "bg": "inline", "hideToolbar": true}} -### User preference +### Toggling color mode + +You can use the React context to toggle the mode with a button inside your page. + +{{"demo": "pages/customization/palette/ToggleColorMode.js", "defaultCodeOpen": false}} + +### System preference Пользователи могли указать предпочтение светлой или темной теме. The method by which the user expresses their preference can vary. It might be a system-wide setting exposed by the Operating System, or a setting controlled by the User Agent. diff --git a/docs/src/pages/customization/palette/palette-zh.md b/docs/src/pages/customization/palette/palette-zh.md index b85fdb19fea0d0..80b7ff460275c2 100644 --- a/docs/src/pages/customization/palette/palette-zh.md +++ b/docs/src/pages/customization/palette/palette-zh.md @@ -27,12 +27,12 @@ 您可以通过将一个调色板对象(palette object)作为主题的一部分来覆盖默认的调色板值。 如果存在以下任何情况: -- [`palette.primary`](/customization/default-theme/?expand-path=$.palette.primary) -- [`palette.secondary`](/customization/default-theme/?expand-path=$.palette.secondary) -- [`palette.error`](/customization/default-theme/?expand-path=$.palette.error) -- [`palette.warning`](/customization/default-theme/?expand-path=$.palette.warning) -- [`palette.info`](/customization/default-theme/?expand-path=$.palette.info) -- [`palette.success`](/customization/default-theme/?expand-path=$.palette.success) +- [`.palette.primary`](/customization/default-theme/?expand-path=$.palette.primary) +- [`.palette.secondary`](/customization/default-theme/?expand-path=$.palette.secondary) +- [`.palette.error`](/customization/default-theme/?expand-path=$.palette.error) +- [`.palette.warning`](/customization/default-theme/?expand-path=$.palette.warning) +- [`.palette.info`](/customization/default-theme/?expand-path=$.palette.info) +- [`.palette.success`](/customization/default-theme/?expand-path=$.palette.success) 这提供了调色板对象,它们将取代默认的颜色对象。 @@ -72,19 +72,19 @@ import { createTheme } from '@material-ui/core/styles'; const theme = createTheme({ palette: { primary: { - // light: 这将从 palette.primary.main 中进行计算, + // light: will be calculated from palette.primary.main, main: '#ff4400', - // dark: 这将从 palette.primary.main 中进行计算, - // contrastText: 这将计算与 palette.primary.main 的对比度 + // dark: will be calculated from palette.primary.main, + // contrastText: will be calculated to contrast with palette.primary.main }, secondary: { light: '#0066ff', main: '#0044ff', - // dark: 这将从 palette.secondary.main 中进行计算, + // dark: will be calculated from palette.secondary.main, contrastText: '#ffcc00', }, - // 使用 `getContrastText()` 来最大化 - // 背景和文本的对比度 + // Used by `getContrastText()` to maximize the contrast between + // the background and the text. contrastThreshold: 3, // 使用下面的函数用于将颜色的亮度在其调色板中 // 移动大约两个指数。 @@ -135,7 +135,8 @@ const theme = createTheme({ darker: '#053e85', }, neutral: { - main: '#5c6ac4', + main: '#64748B', + contrastText: '#fff', }, }, }); @@ -146,7 +147,7 @@ const theme = createTheme({ <!-- tested with packages/material-ui/test/typescript/augmentation/paletteColors.spec.ts --> ```ts -declare module '@material-ui/core/styles/createTheme' { +declare module '@material-ui/core/styles/createMuiTheme' { interface Theme { status: { danger: React.CSSProperties['color']; @@ -175,13 +176,15 @@ declare module '@material-ui/core/styles/createPalette' { } ``` +{{"demo": "pages/customization/palette/CustomColor.js"}} + ## 选取颜色 需要灵感吗? Material Design 团队已经建立了一个[调色板配置工具](/customization/color/#picking-colors)来帮助您选择颜色。 ## 暗色模式 -材质界面有两种调色板的类型,亮色(light)(默认值)和 暗色(dark)模式。 你可以通过设置 `mode: 'dark'` 来启用夜间模式。 虽然只是单一的数值变化,但在其内部却修改了多个调色板的数值。 +Material-UI comes with two palette modes: light (the default) and dark. 你可以通过设置 `mode: 'dark'` 来启用夜间模式。 ```js const darkTheme = createTheme({ @@ -191,11 +194,17 @@ const darkTheme = createTheme({ }); ``` -调色板的类型的调整,修改了如下的颜色: +While it's only a single value change, the `createTheme` helper modifies several palette values. The colors modified by the palette mode are the following: {{"demo": "pages/customization/palette/DarkTheme.js", "bg": "inline", "hideToolbar": true}} -### 用户偏好 +### Toggling color mode + +You can use the React context to toggle the mode with a button inside your page. + +{{"demo": "pages/customization/palette/ToggleColorMode.js", "defaultCodeOpen": false}} + +### System preference 用户可能已经指定了一个亮色或者暗色主题的偏好。 用户表达其偏好的方法可以有所不同。 它可能是操作系统曝光的覆盖整个系统的设置,或由用户代理控制的设置。 diff --git a/docs/src/pages/customization/spacing/spacing-de.md b/docs/src/pages/customization/spacing/spacing-de.md index 071ef3d71d19d8..98869e9a6734d9 100644 --- a/docs/src/pages/customization/spacing/spacing-de.md +++ b/docs/src/pages/customization/spacing/spacing-de.md @@ -28,7 +28,7 @@ theme.spacing(2); // `${4 * 2}px` = '8px' ```js const theme = createTheme({ - spacing: factor => `${0.25 * factor}rem`, // (Bootstrap Strategie) + spacing: (factor) => `${0.25 * factor}rem`, // (Bootstrap strategy) }); theme.spacing(2); // = 0.25 * 2rem = 0.5rem = 8px diff --git a/docs/src/pages/customization/spacing/spacing-es.md b/docs/src/pages/customization/spacing/spacing-es.md index 5649f5f916d560..664bac273296a2 100644 --- a/docs/src/pages/customization/spacing/spacing-es.md +++ b/docs/src/pages/customization/spacing/spacing-es.md @@ -28,7 +28,7 @@ theme.spacing(2); // `${4 * 2}px` = '8px' ```js const theme = createTheme({ - spacing: factor => `${0.25 * factor}rem`, // (Bootstrap strategy) + spacing: (factor) => `${0.25 * factor}rem`, // (Bootstrap strategy) }); theme.spacing(2); // = 0.25 * 2rem = 0.5rem = 8px diff --git a/docs/src/pages/customization/spacing/spacing-fr.md b/docs/src/pages/customization/spacing/spacing-fr.md index a55d0e62cc3f99..a30cf767ea5343 100644 --- a/docs/src/pages/customization/spacing/spacing-fr.md +++ b/docs/src/pages/customization/spacing/spacing-fr.md @@ -2,7 +2,7 @@ <p class="description">Use the theme.spacing() helper to create consistent spacing between the elements of your UI.</p> -Material-UI uses [a recommended 8px scaling factor](https://material.io/design/layout/understanding-layout.html) by default. +Material-UI utilise [un facteur d'échelle de 8px recommandé](https://material.io/design/layout/understanding-layout.html). ```js const theme = createTheme(); diff --git a/docs/src/pages/customization/spacing/spacing-ja.md b/docs/src/pages/customization/spacing/spacing-ja.md index 34ccfb50f34448..6f33ada064e4a5 100644 --- a/docs/src/pages/customization/spacing/spacing-ja.md +++ b/docs/src/pages/customization/spacing/spacing-ja.md @@ -14,7 +14,7 @@ theme.spacing(2); // `${8 * 2}px` = '16px' 間隔の変換は、次の方法で変更できます。 -- a number +- 数値 ```js const theme = createTheme({ @@ -24,17 +24,17 @@ const theme = createTheme({ theme.spacing(2); // `${4 * 2}px` = '8px' ``` -- a function +- 関数 ```js const theme = createTheme({ - spacing: factor => `${0.25 * factor}rem`, // (Bootstrap strategy) + spacing: (factor) => `${0.25 * factor}rem`, // (Bootstrap strategy) }); theme.spacing(2); // = 0.25 * 2rem = 0.5rem = 8px ``` -- an array +- 配列 ```js const theme = createTheme({ @@ -46,14 +46,14 @@ theme.spacing(2); // = '8px' ## Multiple arity -`theme.spacing()` ヘルパーは最大4つの引数を受け入れます。 You can use the arguments to reduce the boilerplate. You can use the arguments to reduce the boilerplate. +`theme.spacing()` ヘルパーは最大4つの引数を受け入れます。 引数を使用すると、ボイラープレートを減らすことができます。 ```diff -padding: `${theme.spacing(1)} ${theme.spacing(2)}`, // '8px 16px' +padding: theme.spacing(1, 2), // '8px 16px' ``` -Mixing string values is also supported: +文字列値のミキシングもサポートされています: ```js margin: theme.spacing(1, 'auto'), // '8px auto' diff --git a/docs/src/pages/customization/spacing/spacing-pt.md b/docs/src/pages/customization/spacing/spacing-pt.md index aadec219c5ba3b..8c6891d07ba7f5 100644 --- a/docs/src/pages/customization/spacing/spacing-pt.md +++ b/docs/src/pages/customization/spacing/spacing-pt.md @@ -28,7 +28,7 @@ theme.spacing(2); // `${4 * 2}px` = '8px' ```js const theme = createTheme({ - spacing: factor => `${0.25 * factor}rem`, // (estratégia do Bootstrap) + spacing: (factor) => `${0.25 * factor}rem`, // (Bootstrap strategy) }); theme.spacing(2); // = 0.25 * 2rem = 0.5rem = 8px diff --git a/docs/src/pages/customization/spacing/spacing-ru.md b/docs/src/pages/customization/spacing/spacing-ru.md index 1896a042cfcaf4..6a1e1394640a12 100644 --- a/docs/src/pages/customization/spacing/spacing-ru.md +++ b/docs/src/pages/customization/spacing/spacing-ru.md @@ -2,7 +2,7 @@ <p class="description">Use the theme.spacing() helper to create consistent spacing between the elements of your UI.</p> -Material-UI uses [a recommended 8px scaling factor](https://material.io/design/layout/understanding-layout.html) by default. +По умолчанию Material-UI использует [рекомендованный 8-пиксельный коэффициент масштабирования](https://material.io/design/layout/understanding-layout.html) ```js const theme = createTheme(); @@ -28,7 +28,7 @@ theme.spacing(2); // `${4 * 2}px` = '8px' ```js const theme = createTheme({ - spacing: factor => `${0.25 * factor}rem`, // (Bootstrap strategy) + spacing: (factor) => `${0.25 * factor}rem`, // (Bootstrap strategy) }); theme.spacing(2); // = 0.25 * 2rem = 0.5rem = 8px diff --git a/docs/src/pages/customization/styled/styled-de.md b/docs/src/pages/customization/styled/styled-de.md new file mode 100644 index 00000000000000..2c2c11eae62915 --- /dev/null +++ b/docs/src/pages/customization/styled/styled-de.md @@ -0,0 +1,70 @@ +# `styled()` + +<p class="description">Utility for creating styled components.</p> + +## Introduction + +All the Material-UI components are styled with the `styled()` utility from `@material-ui/core/styles`. This utility is built on top of the `styled()` module of [`@material-ui/styled-engine`](/guides/styled-engine/) and provides additional features. + +## What problems does it solve? + +The utility can be used as a replacement for emotion's or styled-components' styled() utility. It aims to solve the same problem, but also provides the following benefits: + +1. It uses Material-UI's default `theme` if no theme is available in React context. +2. It supports the theme's [`styleOverrides`](/customization/theme-components/#global-style-overrides) and [`variants`](/customization/theme-components/#adding-new-component-variants) to be applied, based on the `name` applied in the options (can be skipped). +3. It adds support for the [the `sx` prop](/system/basics/#the-sx-prop) (can be skipped). +4. It adds by default `shouldForwardProp` option that is taking into account all props used internally in the Material-UI components (can be overridden). + +## API + +### `styled(Component, [options])(styles) => Component` + +#### Parameter + +1. `Component`: Die Komponente, die verpackt wird. +2. `options` (_object_ [optional]): + + - `options.shouldForwardProp` (_`(props: string) => bool`_ [optional]): Indicates whether the `prop` should be forwarded to the `Component`. + - `options.label` (_string_ [optional]): The suffix of the style sheet. Nützlich zum Debuggen. + - `options.name` (_string_ [optional]): The key used under `theme.components` for specifying `styleOverrides` and `variants`. Also used for generating the `label`. + - `options.slot` (_string_ [optional]): If `Root`, it automatically applies the theme's `styleOverrides` & `variants`. + - `options.overridesResolver` (_(props: object, styles: Record<string, styles>) => styles_ [optional]): Function that returns styles based on the props and the `theme.components[name]styleOverrides` object. + - `options.skipVariantsResolver` (_bool_): Disables the automatic resolver for the `theme.components[name].variants`. + - `options.skipSx` (_bool_ [optional]): Disables the `sx` prop on the component. + - The other keys are forwarded to the `options` argument of emotion's [`styled([Component], [options])`](https://emotion.sh/docs/styled). + +#### Rückgabewerte + +`Component`: Die neu erstellte Komponente. + +## Basic usage + +{{"demo": "pages/customization/styled/BasicUsage.js", "defaultCodeOpen": true}} + +## Using the theme + +{{"demo": "pages/customization/styled/ThemeUsage.js", "defaultCodeOpen": true}} + +## Custom components + +This example demonstrates how you can use the `styled` API to create custom components, with the same capabilities as the core components: + +{{"demo": "pages/customization/styled/UsingOptions.js", "defaultCodeOpen": true }} + +If you inspect this element with the browser DevTools, you will notice that the class of the component now ends with the `MyTestComponent-root`, which comes from the `name` and `slot` options that were provided. In addition to this, the `color` and `variant` props are not propagated to the generated `div` element. + +<img src="/static/images/customization/styled-options.png" alt="Developer tools showing the rendered component" width="312" /> + +## Removing features + +If you would like to remove some of the Material-UI specific features, you can do it like this: + +```diff +const StyledComponent = styled('div', {}, { + name: 'MuiStyled', + slot: 'Root', +- overridesResolver: (props, styles) => styles.root, // disables theme.components[name].styleOverrides ++ skipVariantsResolver: true, // disable theme.components[name].variants ++ skipSx: true, // disable the sx prop +}) +``` diff --git a/docs/src/pages/customization/styled/styled-es.md b/docs/src/pages/customization/styled/styled-es.md new file mode 100644 index 00000000000000..35e675a4e12946 --- /dev/null +++ b/docs/src/pages/customization/styled/styled-es.md @@ -0,0 +1,70 @@ +# `styled()` + +<p class="description">Utility for creating styled components.</p> + +## Introducción + +All the Material-UI components are styled with the `styled()` utility from `@material-ui/core/styles`. This utility is built on top of the `styled()` module of [`@material-ui/styled-engine`](/guides/styled-engine/) and provides additional features. + +## What problems does it solve? + +The utility can be used as a replacement for emotion's or styled-components' styled() utility. It aims to solve the same problem, but also provides the following benefits: + +1. It uses Material-UI's default `theme` if no theme is available in React context. +2. It supports the theme's [`styleOverrides`](/customization/theme-components/#global-style-overrides) and [`variants`](/customization/theme-components/#adding-new-component-variants) to be applied, based on the `name` applied in the options (can be skipped). +3. It adds support for the [the `sx` prop](/system/basics/#the-sx-prop) (can be skipped). +4. It adds by default `shouldForwardProp` option that is taking into account all props used internally in the Material-UI components (can be overridden). + +## API + +### `styled(Component, [options])(styles) => Component` + +#### Argumentos + +1. `Component`: The component that will be wrapped. +2. `options` (*Object* [optional]): + + - `options.shouldForwardProp` (_`(props: string) => bool`_ [optional]): Indicates whether the `prop` should be forwarded to the `Component`. + - `options.label` (_string_ [optional]): The suffix of the style sheet. Useful for debugging. + - `options.name` (_string_ [optional]): The key used under `theme.components` for specifying `styleOverrides` and `variants`. Also used for generating the `label`. + - `options.slot` (_string_ [optional]): If `Root`, it automatically applies the theme's `styleOverrides` & `variants`. + - `options.overridesResolver` (_(props: object, styles: Record<string, styles>) => styles_ [optional]): Function that returns styles based on the props and the `theme.components[name]styleOverrides` object. + - `options.skipVariantsResolver` (_bool_): Disables the automatic resolver for the `theme.components[name].variants`. + - `options.skipSx` (_bool_ [optional]): Disables the `sx` prop on the component. + - The other keys are forwarded to the `options` argument of emotion's [`styled([Component], [options])`](https://emotion.sh/docs/styled). + +#### Regresa + +`Component`: The new component created. + +## Basic usage + +{{"demo": "pages/customization/styled/BasicUsage.js", "defaultCodeOpen": true}} + +## Using the theme + +{{"demo": "pages/customization/styled/ThemeUsage.js", "defaultCodeOpen": true}} + +## Custom components + +This example demonstrates how you can use the `styled` API to create custom components, with the same capabilities as the core components: + +{{"demo": "pages/customization/styled/UsingOptions.js", "defaultCodeOpen": true }} + +If you inspect this element with the browser DevTools, you will notice that the class of the component now ends with the `MyTestComponent-root`, which comes from the `name` and `slot` options that were provided. In addition to this, the `color` and `variant` props are not propagated to the generated `div` element. + +<img src="/static/images/customization/styled-options.png" alt="Developer tools showing the rendered component" width="312" /> + +## Removing features + +If you would like to remove some of the Material-UI specific features, you can do it like this: + +```diff +const StyledComponent = styled('div', {}, { + name: 'MuiStyled', + slot: 'Root', +- overridesResolver: (props, styles) => styles.root, // disables theme.components[name].styleOverrides ++ skipVariantsResolver: true, // disable theme.components[name].variants ++ skipSx: true, // disable the sx prop +}) +``` diff --git a/docs/src/pages/customization/styled/styled-fr.md b/docs/src/pages/customization/styled/styled-fr.md new file mode 100644 index 00000000000000..74d73e23840c38 --- /dev/null +++ b/docs/src/pages/customization/styled/styled-fr.md @@ -0,0 +1,70 @@ +# `styled()` + +<p class="description">Utility for creating styled components.</p> + +## Introduction + +All the Material-UI components are styled with the `styled()` utility from `@material-ui/core/styles`. This utility is built on top of the `styled()` module of [`@material-ui/styled-engine`](/guides/styled-engine/) and provides additional features. + +## What problems does it solve? + +The utility can be used as a replacement for emotion's or styled-components' styled() utility. It aims to solve the same problem, but also provides the following benefits: + +1. It uses Material-UI's default `theme` if no theme is available in React context. +2. It supports the theme's [`styleOverrides`](/customization/theme-components/#global-style-overrides) and [`variants`](/customization/theme-components/#adding-new-component-variants) to be applied, based on the `name` applied in the options (can be skipped). +3. It adds support for the [the `sx` prop](/system/basics/#the-sx-prop) (can be skipped). +4. It adds by default `shouldForwardProp` option that is taking into account all props used internally in the Material-UI components (can be overridden). + +## API + +### `styled(Component, [options])(styles) => Component` + +#### Paramètres + +1. `Component`: The component that will be wrapped. +2. `options` (*Object* [optional]): + + - `options.shouldForwardProp` (_`(props: string) => bool`_ [optional]): Indicates whether the `prop` should be forwarded to the `Component`. + - `options.label` (_string_ [optional]): The suffix of the style sheet. Useful for debugging. + - `options.name` (_string_ [optional]): The key used under `theme.components` for specifying `styleOverrides` and `variants`. Also used for generating the `label`. + - `options.slot` (_string_ [optional]): If `Root`, it automatically applies the theme's `styleOverrides` & `variants`. + - `options.overridesResolver` (_(props: object, styles: Record<string, styles>) => styles_ [optional]): Function that returns styles based on the props and the `theme.components[name]styleOverrides` object. + - `options.skipVariantsResolver` (_bool_): Disables the automatic resolver for the `theme.components[name].variants`. + - `options.skipSx` (_bool_ [optional]): Disables the `sx` prop on the component. + - The other keys are forwarded to the `options` argument of emotion's [`styled([Component], [options])`](https://emotion.sh/docs/styled). + +#### Valeur de retour + +`Component`: The new component created. + +## Utilisation de base + +{{"demo": "pages/customization/styled/BasicUsage.js", "defaultCodeOpen": true}} + +## Using the theme + +{{"demo": "pages/customization/styled/ThemeUsage.js", "defaultCodeOpen": true}} + +## Custom components + +This example demonstrates how you can use the `styled` API to create custom components, with the same capabilities as the core components: + +{{"demo": "pages/customization/styled/UsingOptions.js", "defaultCodeOpen": true }} + +If you inspect this element with the browser DevTools, you will notice that the class of the component now ends with the `MyTestComponent-root`, which comes from the `name` and `slot` options that were provided. In addition to this, the `color` and `variant` props are not propagated to the generated `div` element. + +<img src="/static/images/customization/styled-options.png" alt="Developer tools showing the rendered component" width="312" /> + +## Removing features + +If you would like to remove some of the Material-UI specific features, you can do it like this: + +```diff +const StyledComponent = styled('div', {}, { + name: 'MuiStyled', + slot: 'Root', +- overridesResolver: (props, styles) => styles.root, // disables theme.components[name].styleOverrides ++ skipVariantsResolver: true, // disable theme.components[name].variants ++ skipSx: true, // disable the sx prop +}) +``` diff --git a/docs/src/pages/customization/styled/styled-ja.md b/docs/src/pages/customization/styled/styled-ja.md new file mode 100644 index 00000000000000..199ff13960c149 --- /dev/null +++ b/docs/src/pages/customization/styled/styled-ja.md @@ -0,0 +1,70 @@ +# `styled()` + +<p class="description">Utility for creating styled components.</p> + +## Introduction + +All the Material-UI components are styled with the `styled()` utility from `@material-ui/core/styles`. This utility is built on top of the `styled()` module of [`@material-ui/styled-engine`](/guides/styled-engine/) and provides additional features. + +## What problems does it solve? + +The utility can be used as a replacement for emotion's or styled-components' styled() utility. It aims to solve the same problem, but also provides the following benefits: + +1. It uses Material-UI's default `theme` if no theme is available in React context. +2. It supports the theme's [`styleOverrides`](/customization/theme-components/#global-style-overrides) and [`variants`](/customization/theme-components/#adding-new-component-variants) to be applied, based on the `name` applied in the options (can be skipped). +3. It adds support for the [the `sx` prop](/system/basics/#the-sx-prop) (can be skipped). +4. It adds by default `shouldForwardProp` option that is taking into account all props used internally in the Material-UI components (can be overridden). + +## API + +### `styled(Component, [options])(styles) => Component` + +#### 引数 + +1. `Component`::ラップされるコンポーネント。 +2. `options` (_object_ [optional]): + + - `options.shouldForwardProp` (_`(props: string) => bool`_ [optional]): Indicates whether the `prop` should be forwarded to the `Component`. + - `options.label` (_string_ [optional]): The suffix of the style sheet. Useful for debugging. + - `options.name` (_string_ [optional]): The key used under `theme.components` for specifying `styleOverrides` and `variants`. Also used for generating the `label`. + - `options.slot` (_string_ [optional]): If `Root`, it automatically applies the theme's `styleOverrides` & `variants`. + - `options.overridesResolver` (_(props: object, styles: Record<string, styles>) => styles_ [optional]): Function that returns styles based on the props and the `theme.components[name]styleOverrides` object. + - `options.skipVariantsResolver` (_bool_): Disables the automatic resolver for the `theme.components[name].variants`. + - `options.skipSx` (_bool_ [optional]): Disables the `sx` prop on the component. + - The other keys are forwarded to the `options` argument of emotion's [`styled([Component], [options])`](https://emotion.sh/docs/styled). + +#### 戻り値 + +`Component` :作成された新しいコンポーネント。 内部コンポーネントへの参照を転送します。 + +## 基本的な用法 + +{{"demo": "pages/customization/styled/BasicUsage.js", "defaultCodeOpen": true}} + +## Using the theme + +{{"demo": "pages/customization/styled/ThemeUsage.js", "defaultCodeOpen": true}} + +## Custom components + +This example demonstrates how you can use the `styled` API to create custom components, with the same capabilities as the core components: + +{{"demo": "pages/customization/styled/UsingOptions.js", "defaultCodeOpen": true }} + +If you inspect this element with the browser DevTools, you will notice that the class of the component now ends with the `MyTestComponent-root`, which comes from the `name` and `slot` options that were provided. In addition to this, the `color` and `variant` props are not propagated to the generated `div` element. + +<img src="/static/images/customization/styled-options.png" alt="Developer tools showing the rendered component" width="312" /> + +## Removing features + +If you would like to remove some of the Material-UI specific features, you can do it like this: + +```diff +const StyledComponent = styled('div', {}, { + name: 'MuiStyled', + slot: 'Root', +- overridesResolver: (props, styles) => styles.root, // disables theme.components[name].styleOverrides ++ skipVariantsResolver: true, // disable theme.components[name].variants ++ skipSx: true, // disable the sx prop +}) +``` diff --git a/docs/src/pages/customization/styled/styled-pt.md b/docs/src/pages/customization/styled/styled-pt.md new file mode 100644 index 00000000000000..37db0d835a1012 --- /dev/null +++ b/docs/src/pages/customization/styled/styled-pt.md @@ -0,0 +1,70 @@ +# `styled()` + +<p class="description">Utility for creating styled components.</p> + +## Introdução + +All the Material-UI components are styled with the `styled()` utility from `@material-ui/core/styles`. This utility is built on top of the `styled()` module of [`@material-ui/styled-engine`](/guides/styled-engine/) and provides additional features. + +## What problems does it solve? + +The utility can be used as a replacement for emotion's or styled-components' styled() utility. It aims to solve the same problem, but also provides the following benefits: + +1. It uses Material-UI's default `theme` if no theme is available in React context. +2. It supports the theme's [`styleOverrides`](/customization/theme-components/#global-style-overrides) and [`variants`](/customization/theme-components/#adding-new-component-variants) to be applied, based on the `name` applied in the options (can be skipped). +3. It adds support for the [the `sx` prop](/system/basics/#the-sx-prop) (can be skipped). +4. It adds by default `shouldForwardProp` option that is taking into account all props used internally in the Material-UI components (can be overridden). + +## API + +### `styled(Component, [options])(styles) => Component` + +#### Argumentos + +1. `Component`: O componente que será manipulado. +2. `options` (_object_ [optional]): + + - `options.shouldForwardProp` (_`(props: string) => bool`_ [optional]): Indicates whether the `prop` should be forwarded to the `Component`. + - `options.label` (_string_ [optional]): The suffix of the style sheet. Útil para depuração. + - `options.name` (_string_ [optional]): The key used under `theme.components` for specifying `styleOverrides` and `variants`. Also used for generating the `label`. + - `options.slot` (_string_ [optional]): If `Root`, it automatically applies the theme's `styleOverrides` & `variants`. + - `options.overridesResolver` (_(props: object, styles: Record<string, styles>) => styles_ [optional]): Function that returns styles based on the props and the `theme.components[name]styleOverrides` object. + - `options.skipVariantsResolver` (_bool_): Disables the automatic resolver for the `theme.components[name].variants`. + - `options.skipSx` (_bool_ [optional]): Disables the `sx` prop on the component. + - The other keys are forwarded to the `options` argument of emotion's [`styled([Component], [options])`](https://emotion.sh/docs/styled). + +#### Retornos + +`Component`: O novo componente criado. + +## Utilização Básica + +{{"demo": "pages/customization/styled/BasicUsage.js", "defaultCodeOpen": true}} + +## Using the theme + +{{"demo": "pages/customization/styled/ThemeUsage.js", "defaultCodeOpen": true}} + +## Componentes customizados + +This example demonstrates how you can use the `styled` API to create custom components, with the same capabilities as the core components: + +{{"demo": "pages/customization/styled/UsingOptions.js", "defaultCodeOpen": true }} + +If you inspect this element with the browser DevTools, you will notice that the class of the component now ends with the `MyTestComponent-root`, which comes from the `name` and `slot` options that were provided. In addition to this, the `color` and `variant` props are not propagated to the generated `div` element. + +<img src="/static/images/customization/styled-options.png" alt="Developer tools showing the rendered component" width="312" /> + +## Removing features + +If you would like to remove some of the Material-UI specific features, you can do it like this: + +```diff +const StyledComponent = styled('div', {}, { + name: 'MuiStyled', + slot: 'Root', +- overridesResolver: (props, styles) => styles.root, // disables theme.components[name].styleOverrides ++ skipVariantsResolver: true, // disable theme.components[name].variants ++ skipSx: true, // disable the sx prop +}) +``` diff --git a/docs/src/pages/customization/styled/styled-ru.md b/docs/src/pages/customization/styled/styled-ru.md new file mode 100644 index 00000000000000..f093800e34baf9 --- /dev/null +++ b/docs/src/pages/customization/styled/styled-ru.md @@ -0,0 +1,70 @@ +# `styled()` + +<p class="description">Utility for creating styled components.</p> + +## Вступление + +All the Material-UI components are styled with the `styled()` utility from `@material-ui/core/styles`. This utility is built on top of the `styled()` module of [`@material-ui/styled-engine`](/guides/styled-engine/) and provides additional features. + +## What problems does it solve? + +The utility can be used as a replacement for emotion's or styled-components' styled() utility. It aims to solve the same problem, but also provides the following benefits: + +1. It uses Material-UI's default `theme` if no theme is available in React context. +2. It supports the theme's [`styleOverrides`](/customization/theme-components/#global-style-overrides) and [`variants`](/customization/theme-components/#adding-new-component-variants) to be applied, based on the `name` applied in the options (can be skipped). +3. It adds support for the [the `sx` prop](/system/basics/#the-sx-prop) (can be skipped). +4. It adds by default `shouldForwardProp` option that is taking into account all props used internally in the Material-UI components (can be overridden). + +## API + +### `styled(Component, [options])(styles) => Component` + +#### Аргументы + +1. `Component`: The component that will be wrapped. +2. `options` (_object_ [optional]): + + - `options.shouldForwardProp` (_`(props: string) => bool`_ [optional]): Indicates whether the `prop` should be forwarded to the `Component`. + - `options.label` (_string_ [optional]): The suffix of the style sheet. Полезно для отладки. + - `options.name` (_string_ [optional]): The key used under `theme.components` for specifying `styleOverrides` and `variants`. Also used for generating the `label`. + - `options.slot` (_string_ [optional]): If `Root`, it automatically applies the theme's `styleOverrides` & `variants`. + - `options.overridesResolver` (_(props: object, styles: Record<string, styles>) => styles_ [optional]): Function that returns styles based on the props and the `theme.components[name]styleOverrides` object. + - `options.skipVariantsResolver` (_bool_): Disables the automatic resolver for the `theme.components[name].variants`. + - `options.skipSx` (_bool_ [optional]): Disables the `sx` prop on the component. + - The other keys are forwarded to the `options` argument of emotion's [`styled([Component], [options])`](https://emotion.sh/docs/styled). + +#### Возвращает + +`Component`: The new component created. + +## Basic Usage (Основное использование) + +{{"demo": "pages/customization/styled/BasicUsage.js", "defaultCodeOpen": true}} + +## Using the theme + +{{"demo": "pages/customization/styled/ThemeUsage.js", "defaultCodeOpen": true}} + +## Custom components + +This example demonstrates how you can use the `styled` API to create custom components, with the same capabilities as the core components: + +{{"demo": "pages/customization/styled/UsingOptions.js", "defaultCodeOpen": true }} + +If you inspect this element with the browser DevTools, you will notice that the class of the component now ends with the `MyTestComponent-root`, which comes from the `name` and `slot` options that were provided. In addition to this, the `color` and `variant` props are not propagated to the generated `div` element. + +<img src="/static/images/customization/styled-options.png" alt="Developer tools showing the rendered component" width="312" /> + +## Removing features + +If you would like to remove some of the Material-UI specific features, you can do it like this: + +```diff +const StyledComponent = styled('div', {}, { + name: 'MuiStyled', + slot: 'Root', +- overridesResolver: (props, styles) => styles.root, // disables theme.components[name].styleOverrides ++ skipVariantsResolver: true, // disable theme.components[name].variants ++ skipSx: true, // disable the sx prop +}) +``` diff --git a/docs/src/pages/customization/styled/styled-zh.md b/docs/src/pages/customization/styled/styled-zh.md new file mode 100644 index 00000000000000..0d188744aee970 --- /dev/null +++ b/docs/src/pages/customization/styled/styled-zh.md @@ -0,0 +1,70 @@ +# `styled()` + +<p class="description">Utility for creating styled components.</p> + +## 简介 + +All the Material-UI components are styled with the `styled()` utility from `@material-ui/core/styles`. This utility is built on top of the `styled()` module of [`@material-ui/styled-engine`](/guides/styled-engine/) and provides additional features. + +## What problems does it solve? + +The utility can be used as a replacement for emotion's or styled-components' styled() utility. It aims to solve the same problem, but also provides the following benefits: + +1. It uses Material-UI's default `theme` if no theme is available in React context. +2. It supports the theme's [`styleOverrides`](/customization/theme-components/#global-style-overrides) and [`variants`](/customization/theme-components/#adding-new-component-variants) to be applied, based on the `name` applied in the options (can be skipped). +3. It adds support for the [the `sx` prop](/system/basics/#the-sx-prop) (can be skipped). +4. It adds by default `shouldForwardProp` option that is taking into account all props used internally in the Material-UI components (can be overridden). + +## API + +### `styled(Component, [options])(styles) => Component` + +#### 参数 + +1. `Component` :将被包装的组件。 +2. `options` (_object_ [optional]): + + - `options.shouldForwardProp` (_`(props: string) => bool`_ [optional]): Indicates whether the `prop` should be forwarded to the `Component`. + - `options.label` (_string_ [optional]): The suffix of the style sheet. 适合调试。 + - `options.name` (_string_ [optional]): The key used under `theme.components` for specifying `styleOverrides` and `variants`. Also used for generating the `label`. + - `options.slot` (_string_ [optional]): If `Root`, it automatically applies the theme's `styleOverrides` & `variants`. + - `options.overridesResolver` (_(props: object, styles: Record<string, styles>) => styles_ [optional]): Function that returns styles based on the props and the `theme.components[name]styleOverrides` object. + - `options.skipVariantsResolver` (_bool_): Disables the automatic resolver for the `theme.components[name].variants`. + - `options.skipSx` (_bool_ [optional]): Disables the `sx` prop on the component. + - The other keys are forwarded to the `options` argument of emotion's [`styled([Component], [options])`](https://emotion.sh/docs/styled). + +#### 返回结果 + +`Component` :已创建的新组建。 + +## 基本用法 + +{{"demo": "pages/customization/styled/BasicUsage.js", "defaultCodeOpen": true}} + +## Using the theme + +{{"demo": "pages/customization/styled/ThemeUsage.js", "defaultCodeOpen": true}} + +## 2. 自定义组件 + +This example demonstrates how you can use the `styled` API to create custom components, with the same capabilities as the core components: + +{{"demo": "pages/customization/styled/UsingOptions.js", "defaultCodeOpen": true }} + +If you inspect this element with the browser DevTools, you will notice that the class of the component now ends with the `MyTestComponent-root`, which comes from the `name` and `slot` options that were provided. In addition to this, the `color` and `variant` props are not propagated to the generated `div` element. + +<img src="/static/images/customization/styled-options.png" alt="Developer tools showing the rendered component" width="312" /> + +## Removing features + +If you would like to remove some of the Material-UI specific features, you can do it like this: + +```diff +const StyledComponent = styled('div', {}, { + name: 'MuiStyled', + slot: 'Root', +- overridesResolver: (props, styles) => styles.root, // disables theme.components[name].styleOverrides ++ skipVariantsResolver: true, // disable theme.components[name].variants ++ skipSx: true, // disable the sx prop +}) +``` diff --git a/docs/src/pages/customization/theme-components/theme-components-es.md b/docs/src/pages/customization/theme-components/theme-components-es.md index a05038da7915c3..eb9deba27b2536 100644 --- a/docs/src/pages/customization/theme-components/theme-components-es.md +++ b/docs/src/pages/customization/theme-components/theme-components-es.md @@ -46,6 +46,10 @@ const theme = createTheme({ }, }); Infinity, ++ }), + ] + } + Infinity, + }), ] } diff --git a/docs/src/pages/customization/theme-components/theme-components-zh.md b/docs/src/pages/customization/theme-components/theme-components-zh.md index 238a9cb437ab1d..78c84cbcaf7cd8 100644 --- a/docs/src/pages/customization/theme-components/theme-components-zh.md +++ b/docs/src/pages/customization/theme-components/theme-components-zh.md @@ -1,6 +1,6 @@ # Components 组件 -<p class="description">The theme's `components` key allows you to customize a component without wrapping it in another component. You can change the styles, the default props, and more. 你可以更改样式、默认属性等等其他东西。</p> +<p class="description">The theme's `components` key allows you to customize a component without wrapping it in another component. You can change the styles, the default props, and more. 你可以更改样式、默认属性等等其他东西。 你可以更改样式、默认属性等等其他东西。</p> ## 重写全局样式 @@ -31,7 +31,7 @@ const theme = createTheme({ ## 默认属性 -You can change the default of every prop of a Material-UI component. A `defaultProps` key is exposed in the theme's `components` key for this use case. 下面示例就是指定`defaultProps`属性覆盖`components`下组件的默认属性。 +You can change the default of every prop of a Material-UI component. A `defaultProps` key is exposed in the theme's `components` key for this use case. 下面示例就是指定`defaultProps`属性覆盖`components`下组件的默认属性。 下面示例就是指定`defaultProps`属性覆盖`components`下组件的默认属性。 ```js const theme = createTheme({ @@ -44,11 +44,6 @@ const theme = createTheme({ }, }, }, -}); - disableRipple: true, // No more ripple! - }, - }, - }, }); ``` @@ -58,7 +53,7 @@ const theme = createTheme({ ## 添加新的组件变量 -You can use the `variants` key in the theme's `components` section to add new variants to Material-UI components. These new variants can specify what styles the component should have when specific props are applied. 这些变量能够决定当使用特定的属性时组件应该采用什么样的样式。 +You can use the `variants` key in the theme's `components` section to add new variants to Material-UI components. These new variants can specify what styles the component should have when specific props are applied. 这些变量能够决定当使用特定的属性时组件应该采用什么样的样式。 这些变量能够决定当使用特定的属性时组件应该采用什么样的样式。 在组件名称(如:MuiButton)下以数组形式定义组件变量。 数组中的每个变量都会对应一个CSS类添加到HTML`<head>`中。 For each of them a CSS class is added to the HTML `<head>`. The order is important, so make sure that the styles that should win are specified last. diff --git a/docs/src/pages/customization/theming/theming-de.md b/docs/src/pages/customization/theming/theming-de.md index 5da3d87a428140..62e3bcd880dc5f 100644 --- a/docs/src/pages/customization/theming/theming-de.md +++ b/docs/src/pages/customization/theming/theming-de.md @@ -18,13 +18,13 @@ Mehr darüber erfahren Sie im [API](/styles/api/#themeprovider) Abschnitt. `Them Das Ändern der Konfigurationsvariablen für das Theme ist der effektivste Weg, um die Material-UI an Ihre Bedürfnisse anzupassen. Die folgenden Abschnitte behandeln die wichtigsten Theme-Variablen: -- [Palette](/customization/palette/) -- [Typografie](/customization/typography/) -- [Abstände](/customization/spacing/) -- [Haltepunkte](/customization/breakpoints/) -- [z-index](/customization/z-index/) -- [Komponenten](/customization/theme-components/) -- [Übergänge](/customization/transitions/) +- [`.palette`](/customization/palette/) +- [`.typography`](/customization/typography/) +- [`.abstände`](/customization/spacing/) +- [`.haltepunkte`](/customization/breakpoints/) +- [`.zIndex`](/customization/z-index/) +- [`.transições`](/customization/transitions/) +- [`.komponenten`](/customization/theme-components/) Sie können den [Standard-Themenbereich](/customization/default-theme/) auschecken, um das Standarddesign vollständig anzuzeigen. @@ -32,6 +32,32 @@ Sie können den [Standard-Themenbereich](/customization/default-theme/) auscheck When using Material-UI's theme with the [styling solution](/styles/basics/) or [any others](/guides/interoperability/#themeprovider), it can be convenient to add additional variables to the theme so you can use them everywhere. Zum Beispiel: +```jsx +const theme = createTheme({ + status: { + danger: orange[500], + }, +}); +``` + +If you are using TypeScript, you would also need to use [module augmentation](/guides/typescript/#customization-of-theme) for the theme to accept the above values. + +```tsx +declare module '@material-ui/core/styles' { + interface Theme { + status: { + danger: string; + }; + } + // allow configuration using `createTheme` + interface ThemeOptions { + status?: { + danger?: string; + }; + } +} +``` + {{"demo": "pages/customization/theming/CustomStyles.js"}} ## Zugriff auf das Theme in einer Komponente @@ -75,12 +101,12 @@ Generieren Sie eine Themenbasis von den gegebenen Optionen. #### Parameter -1. `options` (*Object*): Nimmt ein unvollständiges Themeobjekt auf und fügt die fehlenden Teile hinzu. -2. `...args` (*Array*): Deep merge the arguments with the about to be returned theme. +1. `options` (_object_): Takes an incomplete theme object and adds the missing parts. +2. `...args` (_object[]_): Deep merge the arguments with the about to be returned theme. #### Rückgabewerte -`theme` (*Object*): Das neue Theme mit einer responsiven Typografie. +`theme` (_object_): A complete, ready-to-use theme object. #### Beispiele @@ -107,17 +133,17 @@ Generieren Sie responsive Typografieeinstellungen basierend auf den erhaltenen O #### Parameter -1. `theme` (*Object*): Das zu verbessernde Themeobjekt. -2. `options` (*Object* [optional]): +1. `theme` (_object_): The theme object to enhance. +2. `options` (_object_ [optional]): -- `breakpoints` (*Array\<String\>* [optional]): Default to `['sm', 'md', 'lg']`. Array von [Haltepunkten](/customization/breakpoints/) (Bezeichner). -- `disableAlign` (*Boolean* [optional]): Standardmäßig auf `false`. Ob sich die Schriftgrößen geringfügig ändern, um die Höhen der Linie beizubehalten und an das 4px-Linienhöhenraster von Material Design anzupassent. Dies erfordert eine einheitlose Zeilenhöhe in den Stilen des Designs. -- `factor` (*Nummer* [optional]): Standardmäßig auf `2`. Dieser Wert bestimmt die Stärke der Größenänderung der Schriftgröße. Je höher der Wert, desto geringer ist der Unterschied zwischen den Schriftgrößen auf kleinen Bildschirmen. Je niedriger der Wert, desto größer die Schriftgröße für kleine Bildschirme. The value must be greater than 1. -- `variants` (*Array\<String\>* [optional]): Default to all. Die zu behandelnden Typografie-Varianten. +- `breakpoints` (_array\<string\>_ [optional]): Default to `['sm', 'md', 'lg']`. Array von [Haltepunkten](/customization/breakpoints/) (Bezeichner). +- `disableAlign` (_bool_ [optional]): Default to `false`. Ob sich die Schriftgrößen geringfügig ändern, um die Höhen der Linie beizubehalten und an das 4px-Linienhöhenraster von Material Design anzupassent. Dies erfordert eine einheitlose Zeilenhöhe in den Stilen des Designs. +- `factor` (_number_ [optional]): Default to `2`. Dieser Wert bestimmt die Stärke der Größenänderung der Schriftgröße. Je höher der Wert, desto geringer ist der Unterschied zwischen den Schriftgrößen auf kleinen Bildschirmen. Je niedriger der Wert, desto größer die Schriftgröße für kleine Bildschirme. The value must be greater than 1. +- `variants` (_array\<string\>_ [optional]): Default to all. Die zu behandelnden Typografie-Varianten. #### Rückgabewerte -`theme` (*Object*): Ein vollständiges, gebrauchsfertiges Themeobjekt. +`theme` (_object_): The new theme with a responsive typography. #### Beispiele @@ -140,12 +166,12 @@ Using `unstable_createMuiStrictModeTheme` restricts the usage of some of our com #### Parameter -1. `options` (*Object*): Nimmt ein unvollständiges Themeobjekt auf und fügt die fehlenden Teile hinzu. -2. `...args` (*Array*): Deep merge the arguments with the about to be returned theme. +1. `options` (_object_): Takes an incomplete theme object and adds the missing parts. +2. `...args` (_object[]_): Deep merge the arguments with the about to be returned theme. #### Rückgabewerte -`theme` (*Object*): Das neue Theme mit einer responsiven Typografie. +`theme` (_object_): A complete, ready to use theme object. #### Beispiele diff --git a/docs/src/pages/customization/theming/theming-es.md b/docs/src/pages/customization/theming/theming-es.md index c6d6cb416543f6..8890c7258a0225 100644 --- a/docs/src/pages/customization/theming/theming-es.md +++ b/docs/src/pages/customization/theming/theming-es.md @@ -1,6 +1,6 @@ # Temática -<p class="description">Personaliza Material-UI con tu tema. Puedes cambiar los colores, la tipogradía y mucho más.</p> +<p class="description">Personaliza Material-UI con tu tema. Puedes cambiar los colores, la tipografía y mucho más.</p> El tema especifica el color de los componentes, las obscuridad de las superficies, nivel de la sombra, opacidad apropiada de la tinta de los elementos, etc. @@ -18,19 +18,45 @@ Puede aprender más acerca de esto en la [sección API](/styles/api/#themeprovid Cambiar las variables de configuración del tema es la forma más efectiva de adaptar Material-UI a sus necesidades. Las siguientes secciones cubren las variables de tema más importantes: -- [Paleta](/customization/palette/) -- [Tipografía](/customization/typography/) -- [Espaciado](/customization/spacing/) -- [Separaciones](/customization/breakpoints/) -- [z-index](/customization/z-index/) -- [Componentes](/customization/theme-components/) -- [Transiciones](/customization/transitions/) +- [`.paleta`](/customization/palette/) +- [`.typography`](/customization/typography/) +- [`.espaciado`](/customization/spacing/) +- [`.separaciones`](/customization/breakpoints/) +- [`.zIndex`](/customization/z-index/) +- [`.transições`](/customization/transitions/) +- [`.componentes`](/customization/theme-components/) Puede consultar la sección de [Tema predeterminado](/customization/default-theme/) para ver el tema completo. ### Variables personalizadas -When using Material-UI's theme with the [styling solution](/styles/basics/) or [any others](/guides/interoperability/#themeprovider), it can be convenient to add additional variables to the theme so you can use them everywhere. Por ejemplo: +Al usar el tema de Material-UI con la [solución de estilo](/styles/basics/) o [cualquier otra](/guides/interoperability/#themeprovider), puede ser conveniente añadir variables adicionales al tema, para que se puedan usar en todas partes. Por ejemplo: + +```jsx +const theme = createTheme({ + status: { + danger: orange[500], + }, +}); +``` + +If you are using TypeScript, you would also need to use [module augmentation](/guides/typescript/#customization-of-theme) for the theme to accept the above values. + +```tsx +declare module '@material-ui/core/styles' { + interface Theme { + status: { + danger: string; + }; + } + // allow configuration using `createTheme` + interface ThemeOptions { + status?: { + danger?: string; + }; + } +} +``` {{"demo": "pages/customization/theming/CustomStyles.js"}} @@ -75,12 +101,12 @@ Generar un tema en base a las opciones recibidas. #### Argumentos -1. `options` (*Object*): Takes an incomplete theme object and adds the missing parts. -2. `...args` (*Array*): Deep merge the arguments with the about to be returned theme. +1. `options` (_object_): Takes an incomplete theme object and adds the missing parts. +2. `...args` (_object[]_): Deep merge the arguments with the about to be returned theme. #### Regresa -`theme` (*Object*): The new theme with a responsive typography. +`theme` (_object_): A complete, ready-to-use theme object. #### Ejemplos @@ -107,17 +133,17 @@ Generate responsive typography settings based on the options received. #### Argumentos -1. `theme` (*Object*): The theme object to enhance. +1. `theme` (_object_): The theme object to enhance. 2. `options` (*Object* [optional]): -- `breakpoints` (*Array\<String\>* [optional]): Default to `['sm', 'md', 'lg']`. `breakpoints` (*Array\<String\>* [optional]): Default to `['sm', 'md', 'lg']`. -- `disableAlign` (*Boolean* [optional]): Default to `false`. Whether font sizes change slightly so line heights are preserved and align to Material Design's 4px line height grid. This requires a unitless line height in the theme's styles. -- `factor` (*Number* [optional]): Default to `2`. This value determines the strength of font size resizing. The higher the value, the less difference there is between font sizes on small screens. The lower the value, the bigger font sizes for small screens. The value must be greater than 1. -- `variants` (*Array\<String\>* [optional]): Default to all. The typography variants to handle. +- `breakpoints` (_array\<string\>_ [optional]): Default to `['sm', 'md', 'lg']`. `breakpoints` (*Array\<String\>* [optional]): Default to `['sm', 'md', 'lg']`. +- `disableAlign` (_bool_ [optional]): Default to `false`. Whether font sizes change slightly so line heights are preserved and align to Material Design's 4px line height grid. This requires a unitless line height in the theme's styles. +- `factor` (_number_ [optional]): Default to `2`. This value determines the strength of font size resizing. The higher the value, the less difference there is between font sizes on small screens. The lower the value, the bigger font sizes for small screens. The value must be greater than 1. +- `variants` (_array\<string\>_ [optional]): Default to all. The typography variants to handle. #### Regresa -`theme` (*Object*): A complete, ready to use theme object. +`theme` (_object_): The new theme with a responsive typography. #### Ejemplos @@ -140,12 +166,12 @@ Using `unstable_createMuiStrictModeTheme` restricts the usage of some of our com #### Argumentos -1. `options` (*Object*): Takes an incomplete theme object and adds the missing parts. -2. `...args` (*Array*): Deep merge the arguments with the about to be returned theme. +1. `options` (_object_): Takes an incomplete theme object and adds the missing parts. +2. `...args` (_object[]_): Deep merge the arguments with the about to be returned theme. #### Regresa -`theme` (*Object*): The new theme with a responsive typography. +`theme` (_object_): A complete, ready to use theme object. #### Ejemplos diff --git a/docs/src/pages/customization/theming/theming-fr.md b/docs/src/pages/customization/theming/theming-fr.md index 6a796916a339d9..eef13e01b4dc44 100644 --- a/docs/src/pages/customization/theming/theming-fr.md +++ b/docs/src/pages/customization/theming/theming-fr.md @@ -18,13 +18,13 @@ You can learn more about this in [the API section](/styles/api/#themeprovider). Changer la configuration du thème est la manière la plus efficace d'accorder Material-UI à vos préférences. Les sections suivantes couvrent les principales variables des thèmes: -- [Palette](/customization/palette/) -- [Typographie](/customization/typography/) -- [Ecartement](/customization/spacing/) -- [Breakpoints](/customization/breakpoints/) -- [z-index](/customization/z-index/) -- [Composants](/customization/theme-components/) -- [Les transitions](/customization/transitions/) +- [`Palette`](/customization/palette/) +- [`Typographie`](/customization/typography/) +- [`Ecartement`](/customization/spacing/) +- [`Breakpoints`](/customization/breakpoints/) +- [`z-index`](/customization/z-index/) +- [`Les transitions`](/customization/transitions/) +- [`Composants`](/customization/theme-components/) Vous pouvez consulter la section [thème par défaut](/customization/default-theme/) pour afficher le thème par défaut dans son intégralité. @@ -32,6 +32,32 @@ Vous pouvez consulter la section [thème par défaut](/customization/default-the When using Material-UI's theme with the [styling solution](/styles/basics/) or [any others](/guides/interoperability/#themeprovider), it can be convenient to add additional variables to the theme so you can use them everywhere. Par exemple: +```jsx +const theme = createTheme({ + status: { + danger: orange[500], + }, +}); +``` + +If you are using TypeScript, you would also need to use [module augmentation](/guides/typescript/#customization-of-theme) for the theme to accept the above values. + +```tsx +declare module '@material-ui/core/styles' { + interface Theme { + status: { + danger: string; + }; + } + // allow configuration using `createTheme` + interface ThemeOptions { + status?: { + danger?: string; + }; + } +} +``` + {{"demo": "pages/customization/theming/CustomStyles.js"}} ## Accéder au thème dans un composant @@ -80,7 +106,7 @@ Générer un thème basé sur les options reçues. #### Valeur de retour -`theme` (*Object*): The new theme with a responsive typography. +`theme` (*Object*): A complete, ready to use theme object. #### Exemples @@ -110,14 +136,14 @@ Generate responsive typography settings based on the options received. 1. `theme` (*Object*): The theme object to enhance. 2. `options` (*Object* [optional]): -- `breakpoints` (*Array\<String\>* [optional]): Default to `['sm', 'md', 'lg']`. `breakpoints` (*Array\<String\>* [optional]): Default to `['sm', 'md', 'lg']`. +- `breakpoints` (_array\<string\>_ [optional]): Default to `['sm', 'md', 'lg']`. `breakpoints` (*Array\<String\>* [optional]): Default to `['sm', 'md', 'lg']`. - `disableAlign` (*Boolean* [optional]): Default to `false`. Whether font sizes change slightly so line heights are preserved and align to Material Design's 4px line height grid. This requires a unitless line height in the theme's styles. - `factor` (*Number* [optional]): Default to `2`. This value determines the strength of font size resizing. The higher the value, the less difference there is between font sizes on small screens. The lower the value, the bigger font sizes for small screens. The value must be greater than 1. - `variants` (*Array\<String\>* [optional]): Default to all. The typography variants to handle. #### Valeur de retour -`theme` (*Object*): A complete, ready to use theme object. +`theme` (_object_): The new theme with a responsive typography. #### Exemples @@ -136,7 +162,7 @@ Generates a theme that reduces the amount of warnings inside [`React.StrictMode` #### Requirements -Using `unstable_createMuiStrictModeTheme` restricts the usage of some of our components. +`theme` (*Object*): The new theme with a responsive typography. #### Paramètres @@ -145,7 +171,7 @@ Using `unstable_createMuiStrictModeTheme` restricts the usage of some of our com #### Valeur de retour -`theme` (*Object*): The new theme with a responsive typography. +`theme` (_object_): A complete, ready to use theme object. #### Exemples diff --git a/docs/src/pages/customization/theming/theming-ja.md b/docs/src/pages/customization/theming/theming-ja.md index 89f9f2881a1d0b..51629027e9c17d 100644 --- a/docs/src/pages/customization/theming/theming-ja.md +++ b/docs/src/pages/customization/theming/theming-ja.md @@ -18,13 +18,13 @@ テーマの構成変数を変更することは、Material-UIをニーズに合わせる最も効果的な方法です。 以下のセクションでは、最も重要なテーマ変数について説明します。 以下のセクションでは、最も重要なテーマ変数について説明します。 以下のセクションでは、最も重要なテーマ変数について説明します。 以下のセクションでは、最も重要なテーマ変数について説明します。 以下のセクションでは、最も重要なテーマ変数について説明します。 以下のセクションでは、最も重要なテーマ変数について説明します。 -- [パレット](/customization/palette/) -- [タイポグラフィ](/customization/typography/) -- [Spacing](/customization/spacing/) -- [ブレークポイント](/customization/breakpoints/) -- [z-index](/customization/z-index/) -- [コンポーネント](/customization/theme-components/) -- [Transitions](/customization/transitions/) +- [`.パレット`](/customization/palette/) +- [`.タイポグラフィ`](/customization/typography/) +- [`.spacing`](/customization/spacing/) +- [`.ブレークポイント`](/customization/breakpoints/) +- [`.zIndex`](/customization/z-index/) +- [`.transições`](/customization/transitions/) +- [`.コンポーネント`](/customization/theme-components/) [既定のテーマセクション](/customization/default-theme/)をチェックアウトすると、既定のテーマをすべて表示できます。 @@ -32,6 +32,32 @@ When using Material-UI's theme with the [styling solution](/styles/basics/) or [any others](/guides/interoperability/#themeprovider), it can be convenient to add additional variables to the theme so you can use them everywhere. 例えば: +```jsx +const theme = createTheme({ + status: { + danger: orange[500], + }, +}); +``` + +If you are using TypeScript, you would also need to use [module augmentation](/guides/typescript/#customization-of-theme) for the theme to accept the above values. + +```tsx +declare module '@material-ui/core/styles' { + interface Theme { + status: { + danger: string; + }; + } + // allow configuration using `createTheme` + interface ThemeOptions { + status?: { + danger?: string; + }; + } +} +``` + {{"demo": "pages/customization/theming/CustomStyles.js"}} ## コンポーネント内のテーマへのアクセス @@ -75,12 +101,12 @@ Otherwise you'll encounter `Error: Function component cannot be given refs`. See #### 引数 -1. `options` (*Object*): 不完全なテーマオブジェクトを取得し、不足している部分を追加します。 -2. `...args` (*Array*): Deep merge the arguments with the about to be returned theme. +1. `options` (_object_): Takes an incomplete theme object and adds the missing parts. +2. `...args` (_object[]_): Deep merge the arguments with the about to be returned theme. #### 戻り値 -`theme` (*Object*): レスポンシブなタイポグラフィを備えた新しいテーマ。 +`theme` (_object_): A complete, ready-to-use theme object. #### 例 @@ -107,17 +133,17 @@ const theme = createTheme({ #### 引数 -1. `theme` (*Object*): 強化するテーマオブジェクト。 -2. `オプション` (*オプジェクト* [任意]): +1. `theme` (_object_): The theme object to enhance. +2. `options` (_object_ [optional]): -- `breakpoints` (*Array\<String\>* [optional]): Default to `['sm', 'md', 'lg']`. `breakpoints` (*Array\<String\>* [optional]): Default to `['sm', 'md', 'lg']`. -- `disableAlign` (*Boolean* [optional]): Default to `false`. フォントサイズがわずかに変化して線が表示されるかどうか 高さは保持され、Material Designの4pxライン高さグリッドに位置合わせされます。 これには、テーマのスタイルで単位なしの行の高さが必要です。 これには、テーマのスタイルで単位なしの行の高さが必要です。 これには、テーマのスタイルで単位なしの行の高さが必要です。 -- `factor` (*Number* [optional]): Default to `2`. この値は、フォントサイズのサイズ変更の強度を決定します。 値が大きいほど、小さな画面のフォントサイズの差は小さくなります。 値が小さいほど、小さい画面のフォントサイズが大きくなります。 値は1より大きくなければなりません。 値が大きいほど、小さな画面のフォントサイズの差は小さくなります。 値が小さいほど、小さい画面のフォントサイズが大きくなります。 値は1より大きくなければなりません。 値が大きいほど、小さな画面のフォントサイズの差は小さくなります。 値が小さいほど、小さい画面のフォントサイズが大きくなります。 値は1より大きくなければなりません。 値が大きいほど、小さな画面のフォントサイズの差は小さくなります。 値が小さいほど、小さい画面のフォントサイズが大きくなります。 値は1より大きくなければなりません。 -- `variants` (*Array\<String\>* [optional]): Default to all. 処理するタイポグラフィバリアント。 +- `breakpoints` (_array\<string\>_ [optional]): Default to `['sm', 'md', 'lg']`. `breakpoints` (*Array\<String\>* [optional]): Default to `['sm', 'md', 'lg']`. +- `disableAlign` (_bool_ [optional]): Default to `false`. フォントサイズがわずかに変化して線が表示されるかどうか 高さは保持され、Material Designの4pxライン高さグリッドに位置合わせされます。 これには、テーマのスタイルで単位なしの行の高さが必要です。 これには、テーマのスタイルで単位なしの行の高さが必要です。 これには、テーマのスタイルで単位なしの行の高さが必要です。 +- `factor` (_number_ [optional]): Default to `2`. この値は、フォントサイズのサイズ変更の強度を決定します。 値が大きいほど、小さな画面のフォントサイズの差は小さくなります。 値が小さいほど、小さい画面のフォントサイズが大きくなります。 値は1より大きくなければなりません。 値が大きいほど、小さな画面のフォントサイズの差は小さくなります。 値が小さいほど、小さい画面のフォントサイズが大きくなります。 値は1より大きくなければなりません。 値が大きいほど、小さな画面のフォントサイズの差は小さくなります。 値が小さいほど、小さい画面のフォントサイズが大きくなります。 値は1より大きくなければなりません。 値が大きいほど、小さな画面のフォントサイズの差は小さくなります。 値が小さいほど、小さい画面のフォントサイズが大きくなります。 値は1より大きくなければなりません。 +- `variants` (_array\<string\>_ [optional]): Default to all. 処理するタイポグラフィバリアント。 #### 戻り値 -`theme` (*Object*): すぐに使用できる完全なテーマオブジェクト。 +`theme` (_object_): The new theme with a responsive typography. #### 例 @@ -140,12 +166,12 @@ Using `unstable_createMuiStrictModeTheme` restricts the usage of some of our com #### 引数 -1. `options` (*Object*): 不完全なテーマオブジェクトを取得し、不足している部分を追加します。 -2. `...args` (*Array*): Deep merge the arguments with the about to be returned theme. +1. `options` (_object_): Takes an incomplete theme object and adds the missing parts. +2. `...args` (_object[]_): Deep merge the arguments with the about to be returned theme. #### 戻り値 -`theme` (*Object*): レスポンシブなタイポグラフィを備えた新しいテーマ。 +`theme` (_object_): A complete, ready to use theme object. #### 例 diff --git a/docs/src/pages/customization/theming/theming-pt.md b/docs/src/pages/customization/theming/theming-pt.md index bf4a52bfe642d9..d422eeb1666d9a 100644 --- a/docs/src/pages/customization/theming/theming-pt.md +++ b/docs/src/pages/customization/theming/theming-pt.md @@ -18,13 +18,13 @@ O `ThemeProvider` depende do [ recurso de contexto do React](https://pt-br.react Alterar as variáveis de configuração do tema é a maneira mais eficaz de combinar o Material-UI às suas necessidades. As seções a seguir abordam as variáveis mais importantes do tema: -- [Paleta](/customization/palette/) -- [Tipografia](/customization/typography/) -- [Espaçamento](/customization/spacing/) -- [Pontos de quebra](/customization/breakpoints/) -- [z-index](/customization/z-index/) -- [Componentes](/customization/theme-components/) -- [Transições](/customization/transitions/) +- [`.paleta`](/customization/palette/) +- [`.typography`](/customization/typography/) +- [`.espaçamento`](/customization/spacing/) +- [`.pontos de quebra`](/customization/breakpoints/) +- [`.zIndex`](/customization/z-index/) +- [`.transições`](/customization/transitions/) +- [`.componentes`](/customization/theme-components/) Você pode conferir a [seção de tema padrão](/customization/default-theme/) para visualizar o tema padrão na íntegra. @@ -32,6 +32,32 @@ Você pode conferir a [seção de tema padrão](/customization/default-theme/) p Ao usar o tema do Material-UI com a [solução de estilo](/styles/basics/) ou [quaisquer outros](/guides/interoperability/#themeprovider), pode ser conveniente adicionar variáveis adicionais ao tema, para que você possa usá-las em qualquer lugar. Por exemplo: +```jsx +const theme = createTheme({ + status: { + danger: orange[500], + }, +}); +``` + +Se você estiver usando TypeScript, você também deverá usar a [extensão de módulos](/guides/typescript/#customization-of-theme) para que o tema aceite os valores acima. + +```tsx +declare module '@material-ui/core/styles' { + interface Theme { + status: { + danger: string; + }; + } + // allow configuration using `createTheme` + interface ThemeOptions { + status?: { + danger?: string; + }; + } +} +``` + {{"demo": "pages/customization/theming/CustomStyles.js"}} ## Acessando o tema em um componente @@ -75,12 +101,12 @@ Gere uma base de temas sobre as opções recebidas. #### Argumentos -1. `options` (*Object*): Recebe um objeto de tema incompleto e adiciona as partes ausentes. -2. `...args` (*Array*): mescle os argumentos com o tema sobre o qual será retornado. +1. `options` (_object_): Takes an incomplete theme object and adds the missing parts. +2. `...args` (_object[]_): Deep merge the arguments with the about to be returned theme. #### Retornos -`theme` (*Object*): O novo tema com uma tipografia responsiva. +`theme` (_object_): A complete, ready-to-use theme object. #### Exemplos @@ -107,17 +133,17 @@ Gera configurações de tipografia responsivas com base nas opções recebidas. #### Argumentos -1. `theme` (*Object*): O objeto de tema a ser aplicado as alterações. -2. `options` (_Object_ [opcional]): +1. `theme` (_object_): The theme object to enhance. +2. `options` (_object_ [optional]): -- `breakpoints` (*Array\<String\>* [opcional]): Padrão `['sm', 'md', 'lg']`. Array de [pontos de quebra](/customization/breakpoints/) (identificadores). -- `disableAlign` (*Boolean* [opcional]): Padrão `false`. Se os tamanhos de fonte mudam pouco, as alturas da linha são preservadas e alinhadas à altura da linha da grade em 4px do Material Design. Isso requer uma altura de linha sem unidade nos estilos do tema. -- `factor` (*Number* [opcional]): Padrão `2`. Este valor determina o fator de redimensionamento do tamanho da fonte. Quanto maior o valor, menor a diferença entre tamanhos de fonte em telas pequenas. Quanto menor o valor, maiores os tamanhos de fonte para telas pequenas. O valor deve ser maior que 1. -- `variants` (*Array\<String\>* [opcional]): Padrão todos. As variantes de tipografia para manipular. +- `breakpoints` (_array\<string\>_ [optional]): Default to `['sm', 'md', 'lg']`. Array de [pontos de quebra](/customization/breakpoints/) (identificadores). +- `disableAlign` (_bool_ [optional]): Default to `false`. Se os tamanhos de fonte mudam pouco, as alturas da linha são preservadas e alinhadas à altura da linha da grade em 4px do Material Design. Isso requer uma altura de linha sem unidade nos estilos do tema. +- `factor` (_number_ [optional]): Default to `2`. Este valor determina o fator de redimensionamento do tamanho da fonte. Quanto maior o valor, menor a diferença entre tamanhos de fonte em telas pequenas. Quanto menor o valor, maiores os tamanhos de fonte para telas pequenas. O valor deve ser maior que 1. +- `variants` (_array\<string\>_ [optional]): Default to all. As variantes de tipografia para manipular. #### Retornos -`theme` (*Object*): Um objeto de tema completo, pronto para uso. +`theme` (_object_): The new theme with a responsive typography. #### Exemplos @@ -140,12 +166,12 @@ Atualmente `unstable_createMuiStrictModeTheme` não adiciona requisitos adiciona #### Argumentos -1. `options` (*Object*): Recebe um objeto de tema incompleto e adiciona as partes ausentes. -2. `...args` (*Array*): mescle os argumentos com o tema sobre o qual será retornado. +1. `options` (_object_): Takes an incomplete theme object and adds the missing parts. +2. `...args` (_object[]_): Deep merge the arguments with the about to be returned theme. #### Retornos -`theme` (*Object*): O novo tema com uma tipografia responsiva. +`theme` (_object_): A complete, ready to use theme object. #### Exemplos diff --git a/docs/src/pages/customization/theming/theming-ru.md b/docs/src/pages/customization/theming/theming-ru.md index e3d9cc30d52575..4bdb0786610f18 100644 --- a/docs/src/pages/customization/theming/theming-ru.md +++ b/docs/src/pages/customization/theming/theming-ru.md @@ -18,13 +18,13 @@ Изменение переменных конфигурации темы (theme configuration variables) — наиболее эффективный способ настройки Material-UI под ваши потребности. В следующих разделах рассматриваются наиболее важные переменные темы: -- [Палитра](/customization/palette/) -- [Typography](/customization/typography/) -- [Интервал](/customization/spacing/) -- [Контрольные точки](/customization/breakpoints/) -- [z-index](/customization/z-index/) -- [Компоненты](/customization/theme-components/) -- [Переходы](/customization/transitions/) +- [`.палитра`](/customization/palette/) +- [`.typography`](/customization/typography/) +- [`.интервал`](/customization/spacing/) +- [`.контрольные точки`](/customization/breakpoints/) +- [`.zIndex`](/customization/z-index/) +- [`.transições`](/customization/transitions/) +- [`.компоненты`](/customization/theme-components/) Вы можете проверить [ раздел "тема по умолчанию" (default theme) ](/customization/default-theme/) для просмотра полной информации о default theme. @@ -32,6 +32,32 @@ When using Material-UI's theme with the [styling solution](/styles/basics/) or [any others](/guides/interoperability/#themeprovider), it can be convenient to add additional variables to the theme so you can use them everywhere. Например: +```jsx +const theme = createTheme({ + status: { + danger: orange[500], + }, +}); +``` + +If you are using TypeScript, you would also need to use [module augmentation](/guides/typescript/#customization-of-theme) for the theme to accept the above values. + +```tsx +declare module '@material-ui/core/styles' { + interface Theme { + status: { + danger: string; + }; + } + // allow configuration using `createTheme` + interface ThemeOptions { + status?: { + danger?: string; + }; + } +} +``` + {{"demo": "pages/customization/theming/CustomStyles.js"}} ## Доступ к теме в компоненте @@ -42,7 +68,7 @@ When using Material-UI's theme with the [styling solution](/styles/basics/) or [ Вы [можете получить доступ](/styles/advanced/#accessing-the-theme-in-a-component) к переменным темы внутри ваших React-компонент. -- [material-ui-theme-editor](https://in-your-saas.github.io/material-ui-theme-editor/): A tool to generate themes for your Material-UI applications by just selecting the colors and having a live preview. Includes basic site templates to show various components and how they are affected by the theme +- [mui-theme-creator](https://bareynol.github.io/mui-theme-creator/): Инструмент, помогающий проектировать и настраивать темы для библиотеки компонентов Material-UI. Includes basic site templates to show various components and how they are affected by the theme - [create-mui-theme](https://react-theming.github.io/create-mui-theme/): Is an online tool for creating Material-UI themes via Material Design Color Tool. - [Material palette generator](https://material.io/inline-tools/color/): Этот инструмент можно использовать для создания палитры на основе любого выбранного цвета. @@ -75,12 +101,12 @@ Generate a theme base on the options received. #### Аргументы -1. `options` (*Object*): Takes an incomplete theme object and adds the missing parts. -2. `...args` (*Array*): Deep merge the arguments with the about to be returned theme. +1. `options` (_object_): Takes an incomplete theme object and adds the missing parts. +2. `...args` (_object[]_): Deep merge the arguments with the about to be returned theme. #### Возвращает -`theme` (*Object*): The new theme with a responsive typography. +`theme` (_object_): A complete, ready-to-use theme object. #### Примеры @@ -107,17 +133,17 @@ Generate responsive typography settings based on the options received. #### Аргументы -1. `theme` (*Object*): The theme object to enhance. -2. `варианты` (*объекта* [optional]): +1. `theme` (_object_): The theme object to enhance. +2. `options` (_object_ [optional]): -- `breakpoints` (*Array\<String\>* [optional]): Default to `['sm', 'md', 'lg']`. `breakpoints` (*Array\<String\>* [optional]): Default to `['sm', 'md', 'lg']`. -- `disableAlign` (*Boolean* [optional]): Default to `false`. Whether font sizes change slightly so line heights are preserved and align to Material Design's 4px line height grid. This requires a unitless line height in the theme's styles. -- `factor` (*Number* [optional]): Default to `2`. This value determines the strength of font size resizing. The higher the value, the less difference there is between font sizes on small screens. The lower the value, the bigger font sizes for small screens. The value must be greater than 1. -- `variants` (*Array\<String\>* [optional]): Default to all. The typography variants to handle. +- `breakpoints` (_array\<string\>_ [optional]): Default to `['sm', 'md', 'lg']`. `breakpoints` (*Array\<String\>* [optional]): Default to `['sm', 'md', 'lg']`. +- `disableAlign` (_bool_ [optional]): Default to `false`. Whether font sizes change slightly so line heights are preserved and align to Material Design's 4px line height grid. This requires a unitless line height in the theme's styles. +- `factor` (_number_ [optional]): Default to `2`. This value determines the strength of font size resizing. The higher the value, the less difference there is between font sizes on small screens. The lower the value, the bigger font sizes for small screens. The value must be greater than 1. +- `variants` (_array\<string\>_ [optional]): Default to all. The typography variants to handle. #### Возвращает -`theme` (*Object*): A complete, ready to use theme object. +`theme` (_object_): The new theme with a responsive typography. #### Примеры @@ -140,12 +166,12 @@ Using `unstable_createMuiStrictModeTheme` restricts the usage of some of our com #### Аргументы -1. `options` (*Object*): Takes an incomplete theme object and adds the missing parts. -2. `...args` (*Array*): Deep merge the arguments with the about to be returned theme. +1. `options` (_object_): Takes an incomplete theme object and adds the missing parts. +2. `...args` (_object[]_): Deep merge the arguments with the about to be returned theme. #### Возвращает -`theme` (*Object*): The new theme with a responsive typography. +`theme` (_object_): A complete, ready to use theme object. #### Примеры diff --git a/docs/src/pages/customization/theming/theming-zh.md b/docs/src/pages/customization/theming/theming-zh.md index 8e3b5669a2d2a3..9e4ebb7fa3d4e1 100644 --- a/docs/src/pages/customization/theming/theming-zh.md +++ b/docs/src/pages/customization/theming/theming-zh.md @@ -18,13 +18,13 @@ 更改主题配置变量是将 Material-UI 与您的需求相匹配的最有效方法。 以下各节涵盖了一些最重要的主题变量: -- [Palette 调色板](/customization/palette/) -- [文字铸排](/customization/typography/) -- [Spacing 间距](/customization/spacing/) -- [Breakpoints 断点](/customization/breakpoints/) -- [z-index](/customization/z-index/) -- [Components 组件](/customization/theme-components/) -- [过渡动画](/customization/transitions/) +- [`.调色板`](/customization/palette/) +- [`.typography`](/customization/typography/) +- [`.spacing 间距`](/customization/spacing/) +- [`.breakpoints 断点`](/customization/breakpoints/) +- [`.zIndex`](/customization/z-index/) +- [`.过渡动画`](/customization/transitions/) +- [`.组件`](/customization/theme-components/) 您可以在[默认主题部分](/customization/default-theme/)查看完整的默认样式。 @@ -32,6 +32,32 @@ 当 Material-UI 的主题与[样式解决方案(styling solution)](/styles/basics/)或[任何其他解决方案](/guides/interoperability/#themeprovider)一起使用时,若您将额外的变量添加到主题中,这样就能便于在任何地方使用它们。 就像这样: +```jsx +const theme = createTheme({ + status: { + danger: orange[500], + }, +}); +``` + +如果您使用的是 TypeScript,您还需要使用 [module augmentation](/guides/typescript/#customization-of-theme) 来让主题接受上述值。 + +```tsx +declare module '@material-ui/core/styles' { + interface Theme { + status: { + danger: string; + }; + } + // allow configuration using `createTheme` + interface ThemeOptions { + status?: { + danger?: string; + }; + } +} +``` + {{"demo": "pages/customization/theming/CustomStyles.js"}} ## 访问组件中的主题 @@ -75,12 +101,12 @@ #### 参数 -1. `options` (*Object*):采用不完整的主题对象并添加缺少的部分。 -2. `...args` (*Array*): 将参数与即将返回的主题深度合并(deep merge)。 +1. `options` (_object_): Takes an incomplete theme object and adds the missing parts. +2. `...args` (_object[]_): Deep merge the arguments with the about to be returned theme. #### 返回结果 -`theme` (*Object*): 响应式排版的新主题。 +`theme` (_object_): A complete, ready-to-use theme object. #### 例子 @@ -107,17 +133,17 @@ const theme = createTheme({ #### 参数 -1. `theme` (*Object*): 要增强的主题对象。 -2. `options` (_Object_ [optional]): +1. `theme` (_object_): The theme object to enhance. +2. `options` (_object_ [optional]): -- `breakpoints` (*Array\<String\>* [optional]): Default to `['sm', 'md', 'lg']`. Array of [breakpoints](/customization/breakpoints/) (identifiers). 一个 [breakpoints](/customization/breakpoints/) 的数组(identifiers)。 一个 [breakpoints](/customization/breakpoints/) 的数组(identifiers)。 -- `disableAlign` (_Boolean_ [optional]): 默认值为`false`。 字体大小是否略有变化,这样能够保持行高并与 Material Design 的 4px 行高网格相对齐。 这需要主题样式中的无单位行高度。 -- `factor` (_Number_ [optional]): 默认值是 `2`。 此值决定了字体大小调整的强度。 值越高的话,在较小的屏幕上字体大小之间的差异就越小。 值越低的话,在较小屏幕上的字体就越大。 该值必须大于1。 -- `variants` (_Array\<String\>_ [optional]):默认值为 all。 需要处理的文字变体。 +- `breakpoints` (_array\<string\>_ [optional]): Default to `['sm', 'md', 'lg']`. 一个 [breakpoints](/customization/breakpoints/) 的数组(identifiers)。 +- `disableAlign` (_bool_ [optional]): Default to `false`. 字体大小是否略有变化,这样能够保持行高并与 Material Design 的 4px 行高网格相对齐。 这需要主题样式中的无单位行高度。 +- `factor` (_number_ [optional]): Default to `2`. 此值决定了字体大小调整的强度。 值越高的话,在较小的屏幕上字体大小之间的差异就越小。 值越低的话,在较小屏幕上的字体就越大。 该值必须大于1。 +- `variants` (_array\<string\>_ [optional]): Default to all. 需要处理的文字变体。 #### 返回结果 -生成一个主题,该主题减少 [`React.StrictMode`](https://reactjs.org/docs/strict-mode.html) 内的警告数量,类似于 `Warning: findDOMNode is deprecated in StrictMode`。 +`theme` (_object_): The new theme with a responsive typography. #### 例子 @@ -140,12 +166,12 @@ theme = responsiveFontSizes(theme); #### 参数 -1. `options` (*Object*):采用不完整的主题对象并添加缺少的部分。 -2. `...args` (*Array*): 将参数与即将返回的主题深度合并(deep merge)。 +1. `options` (_object_): Takes an incomplete theme object and adds the missing parts. +2. `...args` (_object[]_): Deep merge the arguments with the about to be returned theme. #### 返回结果 -`theme` (*Object*): 响应式排版的新主题。 +`theme` (_object_): A complete, ready to use theme object. #### 例子 diff --git a/docs/src/pages/customization/transitions/transitions-de.md b/docs/src/pages/customization/transitions/transitions-de.md index acf3fdc87db78e..f463ea34495e89 100644 --- a/docs/src/pages/customization/transitions/transitions-de.md +++ b/docs/src/pages/customization/transitions/transitions-de.md @@ -8,12 +8,12 @@ #### Parameter -1. `props` (_String_ | _String[]_): Defaults to `['all']`. Provides a CSS property, or a list of CSS properties that should be transitioned. -2. `options` (*Object* [optional]): +1. `props` (_string_ | _string[]_): Defaults to `['all']`. Provides a CSS property, or a list of CSS properties that should be transitioned. +2. `options` (_object_ [optional]): -- `options.duration` (_String_ | _Number_ [optional]): Defaults to `theme.transitions.duration.standard`. Provides the duration of the transition. -- `options.easing` (_String_ [optional]): Defaults to `theme.transitions.easing.easeInOut`. Provides the easing for the transition. -- `options.delay` (_String_ | _Number_ [optional]): Defaults to `0`. Provides the delay for the transition. +- `options.duration` (_string_ | _number_ [optional]): Defaults to `theme.transitions.duration.standard`. Provides the duration of the transition. +- `options.easing` (_string_ [optional]): Defaults to `theme.transitions.easing.easeInOut`. Provides the easing for the transition. +- `options.delay` (_string_ | _number_ [optional]): Defaults to `0`. Provides the delay for the transition. #### Rückgabewerte @@ -33,7 +33,7 @@ theme.transitions.create(['background-color', 'transform']); #### Parameter -1. `height` (_Number_): The height of the component. +1. `height` (_number_): The height of the component. #### Rückgabewerte diff --git a/docs/src/pages/customization/transitions/transitions-es.md b/docs/src/pages/customization/transitions/transitions-es.md index b2a49025dad0c1..7ba85a8075c99b 100644 --- a/docs/src/pages/customization/transitions/transitions-es.md +++ b/docs/src/pages/customization/transitions/transitions-es.md @@ -8,12 +8,12 @@ #### Argumentos -1. `props` (_String_ | _String[]_): Defaults to `['all']`. Provides a CSS property, or a list of CSS properties that should be transitioned. +1. `props` (_string_ | _string[]_): Defaults to `['all']`. Provides a CSS property, or a list of CSS properties that should be transitioned. 2. `options` (*Object* [optional]): -- `options.duration` (_String_ | _Number_ [optional]): Defaults to `theme.transitions.duration.standard`. Provides the duration of the transition. -- `options.easing` (_String_ [optional]): Defaults to `theme.transitions.easing.easeInOut`. Provides the easing for the transition. -- `options.delay` (_String_ | _Number_ [optional]): Defaults to `0`. Provides the delay for the transition. +- `options.duration` (_string_ | _number_ [optional]): Defaults to `theme.transitions.duration.standard`. Provides the duration of the transition. +- `options.easing` (_string_ [optional]): Defaults to `theme.transitions.easing.easeInOut`. Provides the easing for the transition. +- `options.delay` (_string_ | _number_ [optional]): Defaults to `0`. Provides the delay for the transition. #### Regresa @@ -33,7 +33,7 @@ theme.transitions.create(['background-color', 'transform']); #### Argumentos -1. `height` (_Number_): The height of the component. +1. `height` (_number_): The height of the component. #### Regresa diff --git a/docs/src/pages/customization/transitions/transitions-ja.md b/docs/src/pages/customization/transitions/transitions-ja.md index ca8ae55df9b41c..32c29cfe262f95 100644 --- a/docs/src/pages/customization/transitions/transitions-ja.md +++ b/docs/src/pages/customization/transitions/transitions-ja.md @@ -8,12 +8,12 @@ #### 引数 -1. `props` (_String_ | _String[]_): Defaults to `['all']`. Provides a CSS property, or a list of CSS properties that should be transitioned. -2. `オプション` (*オプジェクト* [任意]): +1. `props` (_string_ | _string[]_): Defaults to `['all']`. Provides a CSS property, or a list of CSS properties that should be transitioned. +2. `options` (_object_ [optional]): -- `options.duration` (_String_ | _Number_ [optional]): Defaults to `theme.transitions.duration.standard`. Provides the duration of the transition. -- `options.easing` (_String_ [optional]): Defaults to `theme.transitions.easing.easeInOut`. Provides the easing for the transition. -- `options.delay` (_String_ | _Number_ [optional]): Defaults to `0`. Provides the delay for the transition. +- `options.duration` (_string_ | _number_ [optional]): Defaults to `theme.transitions.duration.standard`. Provides the duration of the transition. +- `options.easing` (_string_ [optional]): Defaults to `theme.transitions.easing.easeInOut`. Provides the easing for the transition. +- `options.delay` (_string_ | _number_ [optional]): Defaults to `0`. Provides the delay for the transition. #### 戻り値 @@ -33,7 +33,7 @@ theme.transitions.create(['background-color', 'transform']); #### 引数 -1. `height` (_Number_): The height of the component. +1. `height` (_number_): The height of the component. #### 戻り値 diff --git a/docs/src/pages/customization/transitions/transitions-pt.md b/docs/src/pages/customization/transitions/transitions-pt.md index 0105871fe4fc29..eb5116f0ab2029 100644 --- a/docs/src/pages/customization/transitions/transitions-pt.md +++ b/docs/src/pages/customization/transitions/transitions-pt.md @@ -8,12 +8,12 @@ #### Argumentos -1. `props` (_String_ | _String[]_): Padrão `['all']`. Fornece uma propriedade CSS, ou uma lista de propriedades CSS que devem ser transicionadas. -2. `options` (_Object_ [opcional]): +1. `props` (_string_ | _string[]_): Defaults to `['all']`. Fornece uma propriedade CSS, ou uma lista de propriedades CSS que devem ser transicionadas. +2. `options` (_object_ [optional]): -- `options.duration` (_String_ | _Number_ [opcional]): Padrão `theme.transitions.duration.standard`. Fornece a duração da transição. -- `options.easing` (_String_ [opcional]): Padrão `theme.transitions.easing.easeInOut`. Fornece a atenuação para a transição. -- `options.delay` (_String_ | _Number_ [opcional]): Padrão `0`. Fornece o atraso para a transição. +- `options.duration` (_string_ | _number_ [optional]): Defaults to `theme.transitions.duration.standard`. Fornece a duração da transição. +- `options.easing` (_string_ [opcional]): Padrão `theme.transitions.easing.easeInOut`. Fornece a atenuação para a transição. +- `options.delay` (_string_ | _number_ [optional]): Defaults to `0`. Fornece o atraso para a transição. #### Retornos @@ -33,7 +33,7 @@ theme.transitions.create(['background-color', 'transform']); #### Argumentos -1. `height` (_Number_): A altura do componente. +1. `height` (_number_): The height of the component. #### Retornos @@ -50,13 +50,13 @@ const theme = createTheme({ shortest: 150, shorter: 200, short: 250, - // mais básico recomendado periodicidade + // most basic recommended timing standard: 300, - // isto é para ser utilizado em animações complexas + // this is to be used in complex animations complex: 375, - // recomendado quando algo esta entrando na tela + // recommended when something is entering screen enteringScreen: 225, - // recomendado quando algo esta deixando a tela + // recommended when something is leaving screen leavingScreen: 195, }, }, @@ -71,7 +71,7 @@ Você pode alterar alguns ou todos os valores de atenuação, ou fornecer valore const theme = createTheme({ transitions: { easing: { - // Esta é a curva de atenuação mais comum. + // This is the most common easing curve. easeInOut: 'cubic-bezier(0.4, 0, 0.2, 1)', // Objetos que entram na tela na velocidade total e // lentamente desaceleram até um ponto de repouso. diff --git a/docs/src/pages/customization/transitions/transitions-ru.md b/docs/src/pages/customization/transitions/transitions-ru.md index 7d60c5b1cec0cd..34a5038ee7cc99 100644 --- a/docs/src/pages/customization/transitions/transitions-ru.md +++ b/docs/src/pages/customization/transitions/transitions-ru.md @@ -1,6 +1,6 @@ # Переходы -<p class="description">The theme key enables you to customize the durations and easings of the various transitions used across Material-UI components, and offers a utility for creating custom transitions.</p> +<p class="description">Ключ темы, позволяющий настроить длительность и плавность переходов, используемых в компонентах material-ui, предлагающий утилиту для создания пользовательских переходов.</p> ## API @@ -8,18 +8,18 @@ #### Аргументы -1. `props` (_String_ | _String[]_): Defaults to `['all']`. Provides a CSS property, or a list of CSS properties that should be transitioned. -2. `варианты` (*объекта* [optional]): +1. `props` (_string_ | _string[]_): Defaults to `['all']`. Содержит свойство или список CSS свойств, для которых должен быть задан переход. +2. `options` (_object_ [optional]): -- `options.duration` (_String_ | _Number_ [optional]): Defaults to `theme.transitions.duration.standard`. Provides the duration of the transition. -- `options.easing` (_String_ [optional]): Defaults to `theme.transitions.easing.easeInOut`. Provides the easing for the transition. -- `options.delay` (_String_ | _Number_ [optional]): Defaults to `0`. Provides the delay for the transition. +- `options.duration` (_string_ | _number_ [optional]): Defaults to `theme.transitions.duration.standard`. Содержит длительность перехода +- `options.easing` (_string_ [optional]): По умолчанию `theme.transitions.easing.easeInOut`. Содержит плавность перехода +- `options.delay` (_string_ | _number_ [optional]): Defaults to `0`. Содержит отсрочку начала перехода #### Возвращает -`transition`: A CSS transition value, which composes all CSS properties that should be transitioned, together with the defined duration, easing and delay. +`transition`: Значение CSS перехода, объединяющее CSS свойства,, для которых должен быть выполнен переход, с определенной длительностью, плавностью и отсрочкой. -Use the <code>theme.transitions.create()</code> helper to create consistent transitions for the elements of your UI.</p> +Используйте помощник <code>theme.transitions.create()</code> для создания последовательных переходов элементов интерфейса</p> ```js theme.transitions.create(['background-color', 'transform']); @@ -33,15 +33,15 @@ theme.transitions.create(['background-color', 'transform']); #### Аргументы -1. `height` (_Number_): The height of the component. +1. `height` (_number_): The height of the component. #### Возвращает -`duration`: The calculated duration based on the height. +`duration`: Длительность, высчитанная на основании высоты ## Durations -You can change some or all of the duration values, or provide your own (for use in the `create()` helper). This example shows all the default values (in milliseconds), but you only need to provide the keys you wish to change or add. +Вы можете изменить одно или несколько предопределенных значений duration или же добавить свое собственное (для использования в помощнике `create()`) В примере ниже показаны все значения по умолчанию, но все что вам нужно это указать значения для ключей, которые вы хотите добавить или изменить. ```js const theme = createTheme({ @@ -63,9 +63,9 @@ const theme = createTheme({ }); ``` -## Easings +## Плавность -You can change some or all of the easing values, or provide your own, by providing a custom CSS <code>transition-timing-function</code> value. +Вы можете изменить одно или несколько предопределенных значений плавности, либо же добавить свои собственные, указав значение пользовательской CSS функции <code>длительностей перехода</code> . ```js const theme = createTheme({ @@ -73,18 +73,17 @@ const theme = createTheme({ easing: { // This is the most common easing curve. easeInOut: 'cubic-bezier(0.4, 0, 0.2, 1)', - // Objects enter the screen at full velocity from off-screen and - // slowly decelerate to a resting point. + // Объекты появляются на полной скорости из-за пределов экрана и постепенно замедляются при приближении к локации. easeOut: 'cubic-bezier(0.0, 0, 0.2, 1)', - // Objects leave the screen at full velocity. They do not decelerate when off-screen. + // Объекты покидают экран на полной скорости без всякого замедления у края экрана. easeIn: 'cubic-bezier(0.4, 0, 1, 1)', - // The sharp curve is used by objects that may return to the screen at any time. + // Резкий переход используется для объектов, которые могут появиться на экране в любое время sharp: 'cubic-bezier(0.4, 0, 0.6, 1)', }, }, }); ``` -## References +## Ссылки -Check out the [Transitions](/components/transitions/) page to explore the transition components that are included with Material-UI. +Посетите страницу [Transitions](/components/transitions/) чтобы изучить компоненты перехода, используемые в Material-ui diff --git a/docs/src/pages/customization/transitions/transitions-zh.md b/docs/src/pages/customization/transitions/transitions-zh.md index 9756c97e0c3869..7b01ef2dacb430 100644 --- a/docs/src/pages/customization/transitions/transitions-zh.md +++ b/docs/src/pages/customization/transitions/transitions-zh.md @@ -9,12 +9,12 @@ #### 参数 -1. `props` (_String_ | _String[]_):默认值为 `['all']`。 这将提供一个 CSS 属性,或者提供一个应该具有动画效果的 CSS 属性列表。 -2. `options` (_Object_ [optional]): +1. `props` (_string_ | _string[]_): Defaults to `['all']`. 这将提供一个 CSS 属性,或者提供一个应该具有动画效果的 CSS 属性列表。 +2. `options` (_object_ [optional]): -- `options.duration` (_String_ | _Number_ [optional]):默认为 `theme.transitions.duration.standard`。 这将提供动画效果的时长。 -- `options.easing` (_String_ [optional]):默认为 `theme.transitions.easing.easeInOut`。 这将为动画提供缓动效果。 -- `options.delay` (_String_ | _Number_ [optional]):默认为 `0`。 这将为动画提供延迟效果。 +- `options.duration` (_string_ | _number_ [optional]): Defaults to `theme.transitions.duration.standard`. 这将提供动画效果的时长。 +- `options.easing` (_string_ [optional]):默认为 `theme.transitions.easing.easeInOut`。 这将为动画提供缓动效果。 +- `options.delay` (_string_ | _number_ [optional]): Defaults to `0`. 这将为动画提供延迟效果。 #### 返回结果 @@ -34,7 +34,7 @@ theme.transitions.create(['background-color', 'transform']); #### 参数 -1. `height` (_Number_):组件的高度。 +1. `height` (_number_): The height of the component. #### 返回结果 @@ -51,13 +51,13 @@ const theme = createTheme({ shortest: 150, shorter: 200, short: 250, - // 最基本的建议时间 + // most basic recommended timing standard: 300, - // 这将用于复杂的动画中 + // this is to be used in complex animations complex: 375, - // 当有东西转进屏幕时建议使用 + // recommended when something is entering screen enteringScreen: 225, - // 当有东西转出屏幕时建议使用 + // recommended when something is leaving screen leavingScreen: 195, }, }, @@ -72,7 +72,7 @@ const theme = createTheme({ const theme = createTheme({ transitions: { easing: { - // 这是最常见的缓和曲线(easing curve)。 + // This is the most common easing curve. easeInOut: 'cubic-bezier(0.4, 0, 0.2, 1)', // 物体以全速从屏幕外进入屏幕,并在屏幕上以全速前进。 // 缓慢减速至静止点。 diff --git a/docs/src/pages/customization/typography/typography-de.md b/docs/src/pages/customization/typography/typography-de.md index 42c2a8675b9874..8c187ee8ea7b07 100644 --- a/docs/src/pages/customization/typography/typography-de.md +++ b/docs/src/pages/customization/typography/typography-de.md @@ -35,34 +35,29 @@ Um Schriftarten selbst zu hosten, laden Sie diese als `ttf`, `woff` und/oder `wo ```js import RalewayWoff2 from './fonts/Raleway-Regular.woff2'; - -const raleway = { - fontFamily: 'Raleway', - fontStyle: 'normal', - fontDisplay: 'swap', - fontWeight: 400, - src: ` - local('Raleway'), - local('Raleway-Regular'), - url(${RalewayWoff2}) format('woff2') - `, - unicodeRange: - 'U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF', -}; ``` Next, you need to change the theme to use this new font. In order to globally define Raleway as a font face, the [`CssBaseline`](/components/css-baseline/) component can be used (or any other CSS solution of your choice). ```jsx +import RalewayWoff2 from './fonts/Raleway-Regular.woff2'; + const theme = createTheme({ typography: { fontFamily: 'Raleway, Arial', }, components: { MuiCssBaseline: { - styleOverrides: { - '@font-face': [raleway], - }, + styleOverrides: ` + @font-face { + font-family: 'Raleway'; + font-style: normal; + font-display: swap; + font-weight: 400; + src: "local('Raleway'), local('Raleway-Regular'), url(${RalewayWoff2}) format('woff2')"; + unicodeRange: 'U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF', + } + `, }, }, }); @@ -71,11 +66,19 @@ const theme = createTheme({ return ( <ThemeProvider theme={theme}> <CssBaseline /> - {children} + <Box + sx={{ + fontFamily: 'Raleway', + }} + > + Raleway + </Box> </ThemeProvider> ); ``` +Note that if you want to add additional `@font-face` declarations, you need to use the string CSS template syntax for adding style overrides, so that the previosly defined `@font-face` declarations won't be replaced. + ## Schriftgröße Material-UI verwendet `rem` Einheiten für die Schriftgröße. The browser `<html>` element default font size is `16px`, but browsers have an option to change this value, so `rem` units allow us to accommodate the user's settings, resulting in a better accessibility support. Benutzer ändern Schriftgröße aus alle Arten von Gründen, von Sehschwäche bis zu optimalen Einstellungen für Geräte, die sehr unterschiedlich in Größe und Betrachtungsabstand sein können. @@ -85,8 +88,8 @@ Um die Schriftgröße der Material-UI zu ändern, können Sie eine `fontSize` Ei ```js const theme = createTheme({ typography: { - // In Chinesisch und Japanisch sind die Zeichen normalerweise größer, - // daher kann eine kleinere Schriftgröße angemessen sein. + // In Chinese and Japanese the characters are usually larger, + // so a smaller fontsize may be appropriate. fontSize: 12, }, }); @@ -122,7 +125,7 @@ Um dieses Setup zu automatisieren, können Sie die Funktion [`responsiveFontSize {{"demo": "pages/customization/typography/ResponsiveFontSizesChart.js", "hideToolbar": true}} -Sie können dies in dem folgenden Beispiel in Aktion sehen. Passen Sie die Fenstergröße Ihres Browsers an und beachten Sie, wie sich die Schriftgröße ändert, wenn die Breite die unterschiedlichen [Haltepunkte](/customization/breakpoints/) überschreitet: +Sie können dies in dem folgenden Beispiel in Aktion sehen. Adjust your browser's window size, and notice how the font size changes as the width crosses the different [breakpoints](/customization/breakpoints/): ```js import { createTheme, responsiveFontSizes } from '@material-ui/core/styles'; @@ -148,7 +151,7 @@ An `htmlFontSize` theme property is provided for this use case, which tells Mate ```js const theme = createTheme({ typography: { - // Informiere die Material-UI über die Schriftgröße des HTML-Elements. + // Tell Material-UI what's the font-size on the html element is. htmlFontSize: 10, }, }); @@ -224,24 +227,24 @@ const theme = createTheme({ > If you aren't using TypeScript you should skip this step. -You need to make sure that the typings for the theme's `typography` variants and the `Typogrpahy`'s `variant` prop reflects the new set of variants. +You need to make sure that the typings for the theme's `typography` variants and the `Typography`'s `variant` prop reflects the new set of variants. <!-- Tested with packages/material-ui/test/typescript/augmentation/typographyVariants.spec.ts --> ```ts -declare module '@material-ui/core/styles/createTypography' { - interface Typography { +declare module '@material-ui/core/styles' { + interface TypographyVariants { poster: React.CSSProperties; } // allow configuration using `createTheme` - interface TypographyOptions { + interface TypographyVariantsOptions { poster?: React.CSSProperties; } } // Update the Typography's variant prop options -declare module '@material-ui/core/Typography/Typography' { +declare module '@material-ui/core/Typography' { interface TypographyPropsVariantOverrides { poster: true; h3: false; diff --git a/docs/src/pages/customization/typography/typography-es.md b/docs/src/pages/customization/typography/typography-es.md index 678584d4b6419a..39b147751355da 100644 --- a/docs/src/pages/customization/typography/typography-es.md +++ b/docs/src/pages/customization/typography/typography-es.md @@ -35,34 +35,29 @@ Para fuentes auto-hospedadas, descargue los archivos de fuente en `ttf`, `woff`, ```js import RalewayWoff2 from './fonts/Raleway-Regular.woff2'; - -const raleway = { - fontFamily: 'Raleway', - fontStyle: 'normal', - fontDisplay: 'swap', - fontWeight: 400, - src: ` - local('Raleway'), - local('Raleway-Regular'), - url(${RalewayWoff2}) format('woff2') - `, - unicodeRange: - 'U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF', -}; ``` Luego, usted podrá lo necesario en el cambiar el tema para usar la nueva fuente. En aras de definir de forma global como una cara de fuente, el componente [`CssBaseline`](/components/css-baseline/) podra ser usado (o cualquier otra solucion CSS de su eleccion). ```jsx +import RalewayWoff2 from './fonts/Raleway-Regular.woff2'; + const theme = createTheme({ typography: { fontFamily: 'Raleway, Arial', }, components: { MuiCssBaseline: { - styleOverrides: { - '@font-face': [raleway], - }, + styleOverrides: ` + @font-face { + font-family: 'Raleway'; + font-style: normal; + font-display: swap; + font-weight: 400; + src: "local('Raleway'), local('Raleway-Regular'), url(${RalewayWoff2}) format('woff2')"; + unicodeRange: 'U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF', + } + `, }, }, }); @@ -71,11 +66,19 @@ const theme = createTheme({ return ( <ThemeProvider theme={theme}> <CssBaseline /> - {children} + <Box + sx={{ + fontFamily: 'Raleway', + }} + > + Raleway + </Box> </ThemeProvider> ); ``` +Note that if you want to add additional `@font-face` declarations, you need to use the string CSS template syntax for adding style overrides, so that the previosly defined `@font-face` declarations won't be replaced. + ## Font size Material-UI usa unidades `rem` para el tamaño de fuente. El navegador `<html>` element default font size is `16px`, pero navegadores tienen la opcion de cambiar este valor, asi que las unidades `rem` nos permitiran acomodar la configuracion del usuario, esto resultara en un mejor soporte de accesibilidad. Los Usuarios cambian el tamaño de fuente por diversas razones, desde la vista hasta elegir el tamaño optimo para dispositivos que pueden tener muchas diferencias entre la distancia de visión y el tamaño. @@ -224,24 +227,24 @@ const theme = createTheme({ > If you aren't using TypeScript you should skip this step. -You need to make sure that the typings for the theme's `typography` variants and the `Typogrpahy`'s `variant` prop reflects the new set of variants. +You need to make sure that the typings for the theme's `typography` variants and the `Typography`'s `variant` prop reflects the new set of variants. <!-- Tested with packages/material-ui/test/typescript/augmentation/typographyVariants.spec.ts --> ```ts -declare module '@material-ui/core/styles/createTypography' { - interface Typography { - poster: React. CSSProperties; +declare module '@material-ui/core/styles' { + interface TypographyVariants { + poster: React.CSSProperties; } // allow configuration using `createTheme` - interface TypographyOptions { - poster?: React. CSSProperties; + interface TypographyVariantsOptions { + poster?: React.CSSProperties; } } // Update the Typography's variant prop options -declare module '@material-ui/core/Typography/Typography' { +declare module '@material-ui/core/Typography' { interface TypographyPropsVariantOverrides { poster: true; h3: false; diff --git a/docs/src/pages/customization/typography/typography-fr.md b/docs/src/pages/customization/typography/typography-fr.md index e5399c2ef35b15..7d934594b7546c 100644 --- a/docs/src/pages/customization/typography/typography-fr.md +++ b/docs/src/pages/customization/typography/typography-fr.md @@ -76,6 +76,8 @@ return ( ); ``` +Note that if you want to add additional `@font-face` declarations, you need to use the string CSS template syntax for adding style overrides, so that the previosly defined `@font-face` declarations won't be replaced. + ## Font size Material-UI uses `rem` units for the font size. The browser `<html>` element default font size is `16px`, but browsers have an option to change this value, so `rem` units allow us to accommodate the user's settings, resulting in a better accessibility support. Users change font size settings for all kinds of reasons, from poor eyesight to choosing optimum settings for devices that can be vastly different in size and viewing distance. @@ -224,7 +226,7 @@ const theme = createTheme({ > If you aren't using TypeScript you should skip this step. -You need to make sure that the typings for the theme's `typography` variants and the `Typogrpahy`'s `variant` prop reflects the new set of variants. +You need to make sure that the typings for the theme's `typography` variants and the `Typography`'s `variant` prop reflects the new set of variants. <!-- Tested with packages/material-ui/test/typescript/augmentation/typographyVariants.spec.ts --> diff --git a/docs/src/pages/customization/typography/typography-ja.md b/docs/src/pages/customization/typography/typography-ja.md index 02972109119173..bcb4ddd3740d94 100644 --- a/docs/src/pages/customization/typography/typography-ja.md +++ b/docs/src/pages/customization/typography/typography-ja.md @@ -35,34 +35,29 @@ const theme = createTheme({ ```js import RalewayWoff2 from './fonts/Raleway-Regular.woff2'; - -const raleway = { - fontFamily: 'Raleway', - fontStyle: 'normal', - fontDisplay: 'swap', - fontWeight: 400, - src: ` - local('Raleway'), - local('Raleway-Regular'), - url(${RalewayWoff2}) format('woff2') - `, - unicodeRange: - 'U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF', -}; ``` Next, you need to change the theme to use this new font. In order to globally define Raleway as a font face, the [`CssBaseline`](/components/css-baseline/) component can be used (or any other CSS solution of your choice). ```jsx +import RalewayWoff2 from './fonts/Raleway-Regular.woff2'; + const theme = createTheme({ typography: { fontFamily: 'Raleway, Arial', }, components: { MuiCssBaseline: { - styleOverrides: { - '@font-face': [raleway], - }, + styleOverrides: ` + @font-face { + font-family: 'Raleway'; + font-style: normal; + font-display: swap; + font-weight: 400; + src: "local('Raleway'), local('Raleway-Regular'), url(${RalewayWoff2}) format('woff2')"; + unicodeRange: 'U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF', + } + `, }, }, }); @@ -71,16 +66,24 @@ const theme = createTheme({ return ( <ThemeProvider theme={theme}> <CssBaseline /> - {children} + <Box + sx={{ + fontFamily: 'Raleway', + }} + > + Raleway + </Box> </ThemeProvider> ); ``` +Note that if you want to add additional `@font-face` declarations, you need to use the string CSS template syntax for adding style overrides, so that the previosly defined `@font-face` declarations won't be replaced. + ## フォントサイズ -An `htmlFontSize` theme property is provided for this use case, which tells Material-UI what the font-size on the `<html>` element is. An `htmlFontSize` theme property is provided for this use case, which tells Material-UI what the font-size on the `<html>` element is. ⚠️ Changing the font size can harm accessibility ♿️. Most browsers agreed on the default size of 16 pixels, but the user can change it. For instance, someone with an impaired vision could have set their browser’s default font size to something larger. +Material-UIでは、フォントサイズに`rem`単位を使用します。 ブラウザの`<html>`要素のデフォルトのフォントサイズは`16px`ですが、ブラウザにはこの値を変更するオプションがあります。そのため、`rem`単位を使用すると、ユーザーの設定に対応できるため、アクセシビリティのサポートが向上します。 ユーザーは、視力の低下から最適な設定の選択まで、さまざまな理由でフォントサイズの設定を変更できます。サイズや表示距離が大幅に異なるデバイスにも対応できます。 -An `htmlFontSize` theme property is provided for this use case, which tells Material-UI what the font-size on the `<html>` element is. This is used to adjust the `rem` value so the calculated font-size always match the specification. +Material-UIのフォントサイズを変更するには、`fontSize`プロパティを指定します。 デフォルト値は `14px` です。 ```js const theme = createTheme({ @@ -100,7 +103,7 @@ const theme = createTheme({ ### レスポンシブフォントサイズ -[media queries](/customization/breakpoints/#api) を使用できます: Typographyバリアント型プロパティは、生成されたCSSに直接マップされます。 Typographyバリアント型プロパティは、生成されたCSSに直接マップされます。 [media queries](/customization/breakpoints/#api) を使用できます: Typographyバリアント型プロパティは、生成されたCSSに直接マップされます。 [media queries](/customization/breakpoints/#api) を使用できます: +[media queries](/customization/breakpoints/#api) を使用できます: Typographyバリアント型プロパティは、生成されたCSSに直接マップされます。 [media queries](/customization/breakpoints/#api) を使用できます: ```js const theme = createTheme(); @@ -122,7 +125,7 @@ theme.typography.h3 = { {{"demo": "pages/customization/typography/ResponsiveFontSizesChart.js", "hideToolbar": true}} -以下の例で実際にこれを見ることができます。 ブラウザのウィンドウサイズを調整し、幅が異なる[ブレークポイント](/customization/breakpoints/)を横切るときにフォントサイズがどのように変化するかを確認します。 +以下の例で実際にこれを見ることができます。 Adjust your browser's window size, and notice how the font size changes as the width crosses the different [breakpoints](/customization/breakpoints/): ```js import { createTheme, responsiveFontSizes } from '@material-ui/core/styles'; @@ -139,11 +142,11 @@ theme = responsiveFontSizes(theme); ### HTMLフォントサイズ -An `htmlFontSize` theme property is provided for this use case, which tells Material-UI what the font-size on the `<html>` element is. This is used to adjust the `rem` value so the calculated font-size always match the specification. +`<html>`要素のデフォルトのフォントサイズを変更することもできます。 たとえば、[ 10pxの単純化を使用する場合](https://www.sitepoint.com/understanding-and-using-rem-units-in-css/) 。 -> ⚠️ Changing the font size can harm accessibility ♿️. Most browsers agreed on the default size of 16 pixels, but the user can change it. For instance, someone with an impaired vision could have set their browser's default font size to something larger. +> ⚠️ フォントサイズを変えるとアクセシビリティに悪影響を及ぼす可能性があります ♿️ Most browsers agreed on the default size of 16 pixels, but the user can change it. For instance, someone with an impaired vision could have set their browser's default font size to something larger. -An `htmlFontSize` theme property is provided for this use case, which tells Material-UI what the font-size on the `<html>` element is. This is used to adjust the `rem` value so the calculated font-size always match the specification. +An `htmlFontSize` theme property is provided for this use case, which tells Material-UI what the font-size on the `<html>` element is. これは、計算されたフォントサイズが常に仕様と一致するように、`rem`の値を調整するために使用されます。 ```js const theme = createTheme({ @@ -166,7 +169,7 @@ _以下のデモを正しく表示するには、このページのhtml要素に ## バリアント -The typography object comes with [13 variants](/components/typography/#component) by default: +タイポグラフィオブジェクトは、デフォルトでは[13のバリアント](/components/typography/#component)を持っています。 - h1 - h2 @@ -224,24 +227,24 @@ const theme = createTheme({ > If you aren't using TypeScript you should skip this step. -You need to make sure that the typings for the theme's `typography` variants and the `Typogrpahy`'s `variant` prop reflects the new set of variants. +You need to make sure that the typings for the theme's `typography` variants and the `Typography`'s `variant` prop reflects the new set of variants. <!-- Tested with packages/material-ui/test/typescript/augmentation/typographyVariants.spec.ts --> ```ts -declare module '@material-ui/core/styles/createTypography' { - interface Typography { +declare module '@material-ui/core/styles' { + interface TypographyVariants { poster: React.CSSProperties; } // allow configuration using `createTheme` - interface TypographyOptions { + interface TypographyVariantsOptions { poster?: React.CSSProperties; } } // Update the Typography's variant prop options -declare module '@material-ui/core/Typography/Typography' { +declare module '@material-ui/core/Typography' { interface TypographyPropsVariantOverrides { poster: true; h3: false; @@ -262,4 +265,4 @@ declare module '@material-ui/core/Typography/Typography' { ## デフォルト値 -You can explore the default values of the typography using [the theme explorer](/customization/default-theme/?expand-path=$.typography) or by opening the dev tools console on this page (`window.theme.typography`). +タイポグラフィのデフォルト値を調べるには、[テーマエクスプローラ](/customization/default-theme/?expand-path=$.typography)を使うか、このページの開発ツールコンソール(`window.theme.typography`)を開くことで調べることができます。 diff --git a/docs/src/pages/customization/typography/typography-pt.md b/docs/src/pages/customization/typography/typography-pt.md index 0ba125c9d6381c..22eda3da671c9b 100644 --- a/docs/src/pages/customization/typography/typography-pt.md +++ b/docs/src/pages/customization/typography/typography-pt.md @@ -35,34 +35,29 @@ Para fontes auto-hospedadas, baixe os arquivos de fonte em formatos `ttf`, `woff ```js import RalewayWoff2 from './fonts/Raleway-Regular.woff2'; - -const raleway = { - fontFamily: 'Raleway', - fontStyle: 'normal', - fontDisplay: 'swap', - fontWeight: 400, - src: ` - local('Raleway'), - local('Raleway-Regular'), - url(${RalewayWoff2}) format('woff2') - `, - unicodeRange: - 'U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF', -}; ``` Em seguida, você precisa alterar o tema para usar essa nova fonte. Para definir globalmente Raleway como uma fonte, o componente [`CssBaseline`](/components/css-baseline/) pode ser usado (ou qualquer outra solução CSS de sua escolha). ```jsx +import RalewayWoff2 from './fonts/Raleway-Regular.woff2'; + const theme = createTheme({ typography: { fontFamily: 'Raleway, Arial', }, components: { MuiCssBaseline: { - styleOverrides: { - '@font-face': [raleway], - }, + styleOverrides: ` + @font-face { + font-family: 'Raleway'; + font-style: normal; + font-display: swap; + font-weight: 400; + src: "local('Raleway'), local('Raleway-Regular'), url(${RalewayWoff2}) format('woff2')"; + unicodeRange: 'U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF', + } + `, }, }, }); @@ -71,11 +66,19 @@ const theme = createTheme({ return ( <ThemeProvider theme={theme}> <CssBaseline /> - {children} + <Box + sx={{ + fontFamily: 'Raleway', + }} + > + Raleway + </Box> </ThemeProvider> ); ``` +Note that if you want to add additional `@font-face` declarations, you need to use the string CSS template syntax for adding style overrides, so that the previosly defined `@font-face` declarations won't be replaced. + ## Tamanho da fonte Material-UI usa a unidade `rem` para o tamanho da fonte. O tamanho da fonte padrão do elemento `<html>` do navegador é `16px`, mas os navegadores têm a opção de alterar esse valor, a unidade `rem` nos permite acomodar as configurações do usuário, resultando em um melhor suporte de acessibilidade. Os usuários alteram as configurações de tamanho da fonte por vários motivos, desde problemas de visão, até a escolha de configurações ideais para dispositivos que podem ser muito diferentes em tamanho e distância de visualização. @@ -85,8 +88,8 @@ Para alterar o tamanho da fonte do Material-UI, você pode definir a propriedade ```js const theme = createTheme({ typography: { - // Em chinês e japonês os caracteres são geralmente maiores, - // então um tamanho de letra menor pode ser apropriado. + // In Chinese and Japanese the characters are usually larger, + // so a smaller fontsize may be appropriate. fontSize: 12, }, }); @@ -122,7 +125,7 @@ Para automatizar estas configurações, você pode usar a função auxiliar [`re {{"demo": "pages/customization/typography/ResponsiveFontSizesChart.js", "hideToolbar": true}} -Você pode ver isso em ação no exemplo abaixo. Ajuste o tamanho da janela do navegador e observe como o tamanho da fonte muda à medida que a largura cruza os diferentes [pontos de quebra](/customization/breakpoints/): +Você pode ver isso em ação no exemplo abaixo. Adjust your browser's window size, and notice how the font size changes as the width crosses the different [breakpoints](/customization/breakpoints/): ```js import { createTheme, responsiveFontSizes } from '@material-ui/core/styles'; @@ -148,7 +151,7 @@ Uma propriedade de tema `htmlFontSize` é fornecida para este caso de uso, que i ```js const theme = createTheme({ typography: { - // Diz ao Material-UI qual é o font-size no elemento html. + // Tell Material-UI what's the font-size on the html element is. htmlFontSize: 10, }, }); @@ -224,24 +227,24 @@ const theme = createTheme({ > If you aren't using TypeScript you should skip this step. -You need to make sure that the typings for the theme's `typography` variants and the `Typogrpahy`'s `variant` prop reflects the new set of variants. +You need to make sure that the typings for the theme's `typography` variants and the `Typography`'s `variant` prop reflects the new set of variants. <!-- Tested with packages/material-ui/test/typescript/augmentation/typographyVariants.spec.ts --> ```ts -declare module '@material-ui/core/styles/createTypography' { - interface Typography { +declare module '@material-ui/core/styles' { + interface TypographyVariants { poster: React.CSSProperties; } // allow configuration using `createTheme` - interface TypographyOptions { + interface TypographyVariantsOptions { poster?: React.CSSProperties; } } // Update the Typography's variant prop options -declare module '@material-ui/core/Typography/Typography' { +declare module '@material-ui/core/Typography' { interface TypographyPropsVariantOverrides { poster: true; h3: false; diff --git a/docs/src/pages/customization/typography/typography-ru.md b/docs/src/pages/customization/typography/typography-ru.md index 0e6d561787c2c4..5a2b0236931d23 100644 --- a/docs/src/pages/customization/typography/typography-ru.md +++ b/docs/src/pages/customization/typography/typography-ru.md @@ -35,34 +35,29 @@ To self-host fonts, download the font files in `ttf`, `woff`, and/or `woff2` for ```js import RalewayWoff2 from './fonts/Raleway-Regular.woff2'; - -const raleway = { - fontFamily: 'Raleway', - fontStyle: 'normal', - fontDisplay: 'swap', - fontWeight: 400, - src: ` - local('Raleway'), - local('Raleway-Regular'), - url(${RalewayWoff2}) format('woff2') - `, - unicodeRange: - 'U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF', -}; ``` Next, you need to change the theme to use this new font. In order to globally define Raleway as a font face, the [`CssBaseline`](/components/css-baseline/) component can be used (or any other CSS solution of your choice). ```jsx +import RalewayWoff2 from './fonts/Raleway-Regular.woff2'; + const theme = createTheme({ typography: { fontFamily: 'Raleway, Arial', }, components: { MuiCssBaseline: { - styleOverrides: { - '@font-face': [raleway], - }, + styleOverrides: ` + @font-face { + font-family: 'Raleway'; + font-style: normal; + font-display: swap; + font-weight: 400; + src: "local('Raleway'), local('Raleway-Regular'), url(${RalewayWoff2}) format('woff2')"; + unicodeRange: 'U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF', + } + `, }, }, }); @@ -71,11 +66,19 @@ const theme = createTheme({ return ( <ThemeProvider theme={theme}> <CssBaseline /> - {children} + <Box + sx={{ + fontFamily: 'Raleway', + }} + > + Raleway + </Box> </ThemeProvider> ); ``` +Note that if you want to add additional `@font-face` declarations, you need to use the string CSS template syntax for adding style overrides, so that the previosly defined `@font-face` declarations won't be replaced. + ## Размер шрифта Material-UI uses `rem` units for the font size. The browser `<html>` element default font size is `16px`, but browsers have an option to change this value, so `rem` units allow us to accommodate the user's settings, resulting in a better accessibility support. Users change font size settings for all kinds of reasons, from poor eyesight to choosing optimum settings for devices that can be vastly different in size and viewing distance. @@ -224,24 +227,24 @@ const theme = createTheme({ > If you aren't using TypeScript you should skip this step. -You need to make sure that the typings for the theme's `typography` variants and the `Typogrpahy`'s `variant` prop reflects the new set of variants. +You need to make sure that the typings for the theme's `typography` variants and the `Typography`'s `variant` prop reflects the new set of variants. <!-- Tested with packages/material-ui/test/typescript/augmentation/typographyVariants.spec.ts --> ```ts -declare module '@material-ui/core/styles/createTypography' { - interface Typography { +declare module '@material-ui/core/styles' { + interface TypographyVariants { poster: React.CSSProperties; } // allow configuration using `createTheme` - interface TypographyOptions { + interface TypographyVariantsOptions { poster?: React.CSSProperties; } } // Update the Typography's variant prop options -declare module '@material-ui/core/Typography/Typography' { +declare module '@material-ui/core/Typography' { interface TypographyPropsVariantOverrides { poster: true; h3: false; diff --git a/docs/src/pages/customization/typography/typography-zh.md b/docs/src/pages/customization/typography/typography-zh.md index c68ba1cf3fd8bd..b1eed9182eead5 100644 --- a/docs/src/pages/customization/typography/typography-zh.md +++ b/docs/src/pages/customization/typography/typography-zh.md @@ -35,34 +35,29 @@ const theme = createTheme({ ```js import RalewayWoff2 from './fonts/Raleway-Regular.woff2'; - -const raleway = { - fontFamily: 'Raleway', - fontStyle: 'normal', - fontDisplay: 'swap', - fontWeight: 400, - src: ` - local('Raleway'), - local('Raleway-Regular'), - url(${RalewayWoff2}) format('woff2') - `, - unicodeRange: - 'U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF', -}; ``` 接下来,您需要做的是修改主题,来使用这一个新的字体。 如果想在全局定义 Raleway 作为一个字体,您可以使用 [`CssBaseline`](/components/css-baseline/) 组件(或者你也可以选择你想要的任意其他 CSS 方案)。 ```jsx +import RalewayWoff2 from './fonts/Raleway-Regular.woff2'; + const theme = createTheme({ typography: { fontFamily: 'Raleway, Arial', }, components: { MuiCssBaseline: { - styleOverrides: { - '@font-face': [raleway], - }, + styleOverrides: ` + @font-face { + font-family: 'Raleway'; + font-style: normal; + font-display: swap; + font-weight: 400; + src: "local('Raleway'), local('Raleway-Regular'), url(${RalewayWoff2}) format('woff2')"; + unicodeRange: 'U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF', + } + `, }, }, }); @@ -71,11 +66,19 @@ const theme = createTheme({ return ( <ThemeProvider theme={theme}> <CssBaseline /> - {children} + <Box + sx={{ + fontFamily: 'Raleway', + }} + > + Raleway + </Box> </ThemeProvider> ); ``` +Note that if you want to add additional `@font-face` declarations, you need to use the string CSS template syntax for adding style overrides, so that the previosly defined `@font-face` declarations won't be replaced. + ## 字体大小(Font size) Material-UI 使用 `rem` 单元来定义字体的大小。 浏览器 `<html>` 元素的默认字体大小为 `16px`,但是浏览器提供了一个改变这个值的选项,所以 `rem` 单元能够让我们适应用户的设置,从而提供更好的无障碍设计的支持。 其实用户改变字体大小设置的原因多种多样,有不太好的视力,或者选择适应设备的最佳设置,这样在大小和查看距离上会有很大的差异。 @@ -85,8 +88,8 @@ Material-UI 使用 `rem` 单元来定义字体的大小。 浏览器 `<html>` ```js const theme = createTheme({ typography: { - // 中文字符和日文字符通常比较大, - // 所以选用一个略小的 fontsize 会比较合适。 + // In Chinese and Japanese the characters are usually larger, + // so a smaller fontsize may be appropriate. fontSize: 12, }, }); @@ -148,7 +151,7 @@ theme = responsiveFontSizes(theme); ```js const theme = createTheme({ typography: { - // 告知 Material-UI 此 html 元素的具体字体大小。 + // Tell Material-UI what's the font-size on the html element is. htmlFontSize: 10, }, }); @@ -202,11 +205,11 @@ const theme = createTheme({ {{"demo": "pages/customization/typography/TypographyVariants.js"}} -## Adding & disabling variants +## 添加 & 禁用变体 -In addition to using the default typography variants, you can add custom ones, or disable any you don't need. Here is what you need to do: +除了使用默认的排版变体外,你还可以添加自定义的排版,或者禁用任何你不需要的排版。 Here is what you need to do: -**Step 1. Step 1. Update the theme's typography object** +**Step 1. Step 1. Step 1. Update the theme's typography object** ```js const theme = createTheme({ @@ -220,28 +223,28 @@ const theme = createTheme({ }); ``` -**Step 2. Step 2. Update the necessary typings (if you are using TypeScript)** +**Step 2. Step 2. Step 2. Update the necessary typings (if you are using TypeScript)** > If you aren't using TypeScript you should skip this step. -You need to make sure that the typings for the theme's `typography` variants and the `Typogrpahy`'s `variant` prop reflects the new set of variants. +You need to make sure that the typings for the theme's `typography` variants and the `Typography`'s `variant` prop reflects the new set of variants. <!-- Tested with packages/material-ui/test/typescript/augmentation/typographyVariants.spec.ts --> ```ts -declare module '@material-ui/core/styles/createTypography' { - interface Typography { +declare module '@material-ui/core/styles' { + interface TypographyVariants { poster: React.CSSProperties; } // allow configuration using `createTheme` - interface TypographyOptions { + interface TypographyVariantsOptions { poster?: React.CSSProperties; } } // Update the Typography's variant prop options -declare module '@material-ui/core/Typography/Typography' { +declare module '@material-ui/core/Typography' { interface TypographyPropsVariantOverrides { poster: true; h3: false; @@ -249,7 +252,7 @@ declare module '@material-ui/core/Typography/Typography' { } ``` -**Step 3. Step 3. You can now use the new variant** +**Step 3. Step 3. Step 3. You can now use the new variant** {{"demo": "pages/customization/typography/TypographyCustomVariant.js", "hideToolbar": true}} diff --git a/docs/src/pages/customization/typography/typography.md b/docs/src/pages/customization/typography/typography.md index ab408eeb3f3a00..e93a8f65212803 100644 --- a/docs/src/pages/customization/typography/typography.md +++ b/docs/src/pages/customization/typography/typography.md @@ -238,7 +238,7 @@ const theme = createTheme({ > If you aren't using TypeScript you should skip this step. -You need to make sure that the typings for the theme's `typography` variants and the `Typogrpahy`'s `variant` prop reflects the new set of variants. +You need to make sure that the typings for the theme's `typography` variants and the `Typography`'s `variant` prop reflects the new set of variants. <!-- Tested with packages/material-ui/test/typescript/augmentation/typographyVariants.spec.ts --> diff --git a/docs/src/pages/customization/z-index/z-index-fr.md b/docs/src/pages/customization/z-index/z-index-fr.md index f244a1aa79307a..6b8080339b0402 100644 --- a/docs/src/pages/customization/z-index/z-index-fr.md +++ b/docs/src/pages/customization/z-index/z-index-fr.md @@ -4,7 +4,7 @@ Several Material-UI components utilize `z-index`, employing a default z-index scale in Material-UI that has been designed to properly layer drawers, modals, snackbars, tooltips, and more. -The `z-index` values start at an arbitrary number, high and specific enough to ideally avoid conflicts: +Les valeurs `z-index` commencent à un nombre arbitraire, suffisamment élevé et spécifique pour idéalement éviter les conflits : - mobile stepper: 1000 - speed dial: 1050 diff --git a/docs/src/pages/customization/z-index/z-index-ja.md b/docs/src/pages/customization/z-index/z-index-ja.md index 4b6e2180d2d9a2..595549f67a153b 100644 --- a/docs/src/pages/customization/z-index/z-index-ja.md +++ b/docs/src/pages/customization/z-index/z-index-ja.md @@ -14,4 +14,4 @@ The `z-index` values start at an arbitrary number, high and specific enough to i - snackbar: 1400 - tooltip: 1500 -これらの値はいつでもカスタマイズできます。 これらの値はいつでもカスタマイズできます。 これらの値はいつでもカスタマイズできます。 これらの値はいつでもカスタマイズできます。 You will find them in the theme under the [`zIndex`](/customization/default-theme/?expand-path=$.zIndex) key of the theme. 個々の値をカスタマイズすることはお勧めできません。; 1つを変更した場合は、すべてを変更する必要があります。 +これらの値はいつでもカスタマイズできます。 これらは、テーマの[`zIndex`](/customization/default-theme/?expand-path=$.zIndex)キーの下のテーマにあります。 個々の値をカスタマイズすることはお勧めできません。; 1つを変更した場合は、すべてを変更する必要があります。 diff --git a/docs/src/pages/discover-more/related-projects/related-projects-de.md b/docs/src/pages/discover-more/related-projects/related-projects-de.md index e13874b6a244c5..e7fe6ced0a5c7a 100644 --- a/docs/src/pages/discover-more/related-projects/related-projects-de.md +++ b/docs/src/pages/discover-more/related-projects/related-projects-de.md @@ -6,14 +6,15 @@ Da der Umfang der Probleme, die Material-UI löst, begrenzt ist, versuchen wir, ## Design-Ressourcen -<a href="https://material-ui.com/store/items/sketch-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-sketch" style="margin-left: 8px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-sketch.svg" alt="sketch" /></a> -<a href="https://material-ui.com/store/items/figma-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-figma" style="margin-left: 32px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-figma.svg" alt="figma" /></a> +<a href="https://material-ui.com/store/items/figma-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-figma" style="margin-left: 8px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-figma.svg" alt="figma" /></a> +<a href="https://material-ui.com/store/items/adobe-xd-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-adobe-xd" style="margin-left: 32px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-adobe-xd.svg" alt="adobe-xd" /></a> +<a href="https://material-ui.com/store/items/sketch-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-sketch" style="margin-left: 32px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-sketch.svg" alt="sketch" /></a> Dies ist eine Sammlung von Drittanbieterprojekten, die Material-UI erweitern. - **Figma**: [Figma for Material-UI](https://material-ui.com/store/items/figma-react/?utm_source=docs&utm_medium=referral&utm_campaign=related-projects-sketch) — A large UI kit with over 600 handcrafted Material-UI's components 🎨. -- **Sketch**: [Sketch for Material-UI](https://material-ui.com/store/items/sketch-react/?utm_source=docs&utm_medium=referral&utm_campaign=related-projects-sketch) — A large UI kit with over 600 handcrafted Material-UI's symbols 💎. - [Adobe XD](https://material-ui.com/store/items/adobe-xd-react/?utm_source=docs&utm_medium=referral&utm_campaign=related-projects-adobe-xd): A large UI kit with over 600 handcrafted Material-UI components. +- **Sketch**: [Sketch for Material-UI](https://material-ui.com/store/items/sketch-react/?utm_source=docs&utm_medium=referral&utm_campaign=related-projects-sketch) — A large UI kit with over 600 handcrafted Material-UI's symbols 💎. - **Framer**: [Framer for Material-UI](https://packages.framer.com/package/material-ui/material-ui) — A small MIT UI kit preview of handcrafted Material-UI's component. ## Bilder und Illustrationen @@ -64,10 +65,6 @@ Dies ist eine Sammlung von Drittanbieterprojekten, die Material-UI erweitern. - [material-ui-image](https://mui.wertarbyte.com/#material-ui-image): Images are ugly until they're loaded. Materialize it with material image! It will fade in like the material image loading pattern suggests. -### Paginierung - -- [material-ui-flat-pagination](https://github.com/szmslab/material-ui-flat-pagination): A flat design pagination component for Material-UI. - ### Scheduler/Calendar - [dx-react-scheduler-material-ui](https://devexpress.github.io/devextreme-reactive/react/scheduler/): A scheduler/calendar component for Material-UI with multiple calendar views, editing, recurrence appointments and date navigation features ([paid license](https://js.devexpress.com/licensing/)). diff --git a/docs/src/pages/discover-more/related-projects/related-projects-es.md b/docs/src/pages/discover-more/related-projects/related-projects-es.md index 48231ecd21a6e1..3c5e412b1aa634 100644 --- a/docs/src/pages/discover-more/related-projects/related-projects-es.md +++ b/docs/src/pages/discover-more/related-projects/related-projects-es.md @@ -6,14 +6,15 @@ Debido a que el alcance de los problemas que soluciona Material-UI es límite, i ## Recursos de diseño -<a href="https://material-ui.com/store/items/sketch-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-sketch" style="margin-left: 8px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-sketch.svg" alt="sketch" /></a> -<a href="https://material-ui.com/store/items/figma-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-figma" style="margin-left: 32px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-figma.svg" alt="figma" /></a> +<a href="https://material-ui.com/store/items/figma-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-figma" style="margin-left: 8px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-figma.svg" alt="figma" /></a> +<a href="https://material-ui.com/store/items/adobe-xd-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-adobe-xd" style="margin-left: 32px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-adobe-xd.svg" alt="adobe-xd" /></a> +<a href="https://material-ui.com/store/items/sketch-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-sketch" style="margin-left: 32px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-sketch.svg" alt="sketch" /></a> A set of reusable components for design tools is available, designed to match the React components, and to help you craft great products: - **Figma**: [Figma for Material-UI](https://material-ui.com/store/items/figma-react/?utm_source=docs&utm_medium=referral&utm_campaign=related-projects-sketch) — A large UI kit with over 600 handcrafted Material-UI's components 🎨. -- **Sketch**: [Sketch for Material-UI](https://material-ui.com/store/items/sketch-react/?utm_source=docs&utm_medium=referral&utm_campaign=related-projects-sketch) — A large UI kit with over 600 handcrafted Material-UI's symbols 💎. - [Adobe XD](https://material-ui.com/store/items/adobe-xd-react/?utm_source=docs&utm_medium=referral&utm_campaign=related-projects-adobe-xd): A large UI kit with over 600 handcrafted Material-UI components. +- **Sketch**: [Sketch for Material-UI](https://material-ui.com/store/items/sketch-react/?utm_source=docs&utm_medium=referral&utm_campaign=related-projects-sketch) — A large UI kit with over 600 handcrafted Material-UI's symbols 💎. - **Framer**: [Framer for Material-UI](https://packages.framer.com/package/material-ui/material-ui) — A small MIT UI kit preview of handcrafted Material-UI's component. ## Imágenes e ilustraciones @@ -64,10 +65,6 @@ Esta es una colección de proyectos de terceros que amplían Material-UI. - [material-ui-image](https://mui.wertarbyte.com/#material-ui-image): Las imágenes son feas hasta que estén cargadas. ¡Materialízalo con material image! Se desvanecerá como lo sugiere el patrón de carga de material image. -### Pagination - -- [crear-mui-theme](https://react-theming.github.io/create-mui-theme/): Una herramienta en línea para crear temas de Material-UI a través de Material Design Color Tool. - ### Paginación - [material-ui-plan-pagination](https://github.com/szmslab/material-ui-flat-pagination): Un componente de paginación de diseño plano para Material-UI. diff --git a/docs/src/pages/discover-more/related-projects/related-projects-fr.md b/docs/src/pages/discover-more/related-projects/related-projects-fr.md index 7dc961ee4e611f..523937ad9076b7 100644 --- a/docs/src/pages/discover-more/related-projects/related-projects-fr.md +++ b/docs/src/pages/discover-more/related-projects/related-projects-fr.md @@ -6,14 +6,15 @@ Because the scope of problems Material-UI solves is bound, we try to play nicely ## Design resources -<a href="https://material-ui.com/store/items/sketch-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-sketch" style="margin-left: 8px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-sketch.svg" alt="sketch" /></a> -<a href="https://material-ui.com/store/items/figma-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-figma" style="margin-left: 32px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-figma.svg" alt="figma" /></a> +<a href="https://material-ui.com/store/items/figma-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-figma" style="margin-left: 8px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-figma.svg" alt="figma" /></a> +<a href="https://material-ui.com/store/items/adobe-xd-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-adobe-xd" style="margin-left: 32px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-adobe-xd.svg" alt="adobe-xd" /></a> +<a href="https://material-ui.com/store/items/sketch-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-sketch" style="margin-left: 32px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-sketch.svg" alt="sketch" /></a> A set of reusable components for design tools is available, designed to match the React components, and to help you craft great products: - **Figma**: [Figma for Material-UI](https://material-ui.com/store/items/figma-react/?utm_source=docs&utm_medium=referral&utm_campaign=related-projects-sketch) — A large UI kit with over 600 handcrafted Material-UI's components 🎨. -- **Sketch**: [Sketch for Material-UI](https://material-ui.com/store/items/sketch-react/?utm_source=docs&utm_medium=referral&utm_campaign=related-projects-sketch) — A large UI kit with over 600 handcrafted Material-UI's symbols 💎. - [Adobe XD](https://material-ui.com/store/items/adobe-xd-react/?utm_source=docs&utm_medium=referral&utm_campaign=related-projects-adobe-xd): A large UI kit with over 600 handcrafted Material-UI components. +- **Sketch**: [Sketch for Material-UI](https://material-ui.com/store/items/sketch-react/?utm_source=docs&utm_medium=referral&utm_campaign=related-projects-sketch) — A large UI kit with over 600 handcrafted Material-UI's symbols 💎. - **Framer**: [Framer for Material-UI](https://packages.framer.com/package/material-ui/material-ui) — A small MIT UI kit preview of handcrafted Material-UI's component. ## Images and illustrations @@ -64,10 +65,6 @@ This is a collection of third-party projects that extend Material-UI. - [material-ui-image](https://mui.wertarbyte.com/#material-ui-image): Images are ugly until they're loaded. Materialize it with material image! It will fade in like the material image loading pattern suggests. -### Pagination - -- [material-ui-flat-pagination](https://github.com/szmslab/material-ui-flat-pagination): A flat design pagination component for Material-UI. - ### Scheduler/Calendar - [dx-react-scheduler-material-ui](https://devexpress.github.io/devextreme-reactive/react/scheduler/): A scheduler/calendar component for Material-UI with multiple calendar views, editing, recurrence appointments and date navigation features ([paid license](https://js.devexpress.com/licensing/)). diff --git a/docs/src/pages/discover-more/related-projects/related-projects-ja.md b/docs/src/pages/discover-more/related-projects/related-projects-ja.md index f147fa7540fbba..837994f9e58cb7 100644 --- a/docs/src/pages/discover-more/related-projects/related-projects-ja.md +++ b/docs/src/pages/discover-more/related-projects/related-projects-ja.md @@ -6,14 +6,15 @@ Because the scope of problems Material-UI solves is bound, we try to play nicely ## Design resources -<a href="https://material-ui.com/store/items/sketch-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-sketch" style="margin-left: 8px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-sketch.svg" alt="sketch" /></a> -<a href="https://material-ui.com/store/items/figma-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-figma" style="margin-left: 32px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-figma.svg" alt="figma" /></a> +<a href="https://material-ui.com/store/items/figma-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-figma" style="margin-left: 8px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-figma.svg" alt="figma" /></a> +<a href="https://material-ui.com/store/items/adobe-xd-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-adobe-xd" style="margin-left: 32px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-adobe-xd.svg" alt="adobe-xd" /></a> +<a href="https://material-ui.com/store/items/sketch-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-sketch" style="margin-left: 32px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-sketch.svg" alt="sketch" /></a> A set of reusable components for design tools is available, designed to match the React components, and to help you craft great products: - **Figma**: [Figma for Material-UI](https://material-ui.com/store/items/figma-react/?utm_source=docs&utm_medium=referral&utm_campaign=related-projects-sketch) — A large UI kit with over 600 handcrafted Material-UI's components 🎨. +- [Adobe XD](https://material-ui.com/store/items/adobe-xd-react/?utm_source=docs&utm_medium=referral&utm_campaign=related-projects-adobe-xd): 600を超えるMaterial-UIのコンポーネントを含んだ大規模なUIキット - **Sketch**: [Sketch for Material-UI](https://material-ui.com/store/items/sketch-react/?utm_source=docs&utm_medium=referral&utm_campaign=related-projects-sketch) — A large UI kit with over 600 handcrafted Material-UI's symbols 💎. -- [Adobe XD](https://material-ui.com/store/items/adobe-xd-react/?utm_source=docs&utm_medium=referral&utm_campaign=related-projects-adobe-xd): A large UI kit with over 600 handcrafted Material-UI components. - **Framer**: [Framer for Material-UI](https://packages.framer.com/package/material-ui/material-ui) — A small MIT UI kit preview of handcrafted Material-UI's component. ## Images and illustrations @@ -64,10 +65,6 @@ This is a collection of third-party projects that extend Material-UI. - [material-ui-image](https://mui.wertarbyte.com/#material-ui-image): Images are ugly until they're loaded. Materialize it with material image! It will fade in like the material image loading pattern suggests. -### Pagination - -- [material-ui-flat-pagination](https://github.com/szmslab/material-ui-flat-pagination): A flat design pagination component for Material-UI. - ### Scheduler/Calendar - [dx-react-scheduler-material-ui](https://devexpress.github.io/devextreme-reactive/react/scheduler/): A scheduler/calendar component for Material-UI with multiple calendar views, editing, recurrence appointments and date navigation features ([paid license](https://js.devexpress.com/licensing/)). diff --git a/docs/src/pages/discover-more/related-projects/related-projects-pt.md b/docs/src/pages/discover-more/related-projects/related-projects-pt.md index 86d0560195be14..a3c9efac8b7b07 100644 --- a/docs/src/pages/discover-more/related-projects/related-projects-pt.md +++ b/docs/src/pages/discover-more/related-projects/related-projects-pt.md @@ -6,14 +6,15 @@ Como o escopo dos problemas que o Material-UI resolve é limitado, tentamos inte ## Recursos de design -<a href="https://material-ui.com/store/items/sketch-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-sketch" style="margin-left: 8px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-sketch.svg" alt="sketch" /></a> -<a href="https://material-ui.com/store/items/figma-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-figma" style="margin-left: 32px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-figma.svg" alt="figma" /></a> +<a href="https://material-ui.com/store/items/figma-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-figma" style="margin-left: 8px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-figma.svg" alt="figma" /></a> +<a href="https://material-ui.com/store/items/adobe-xd-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-adobe-xd" style="margin-left: 32px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-adobe-xd.svg" alt="adobe-xd" /></a> +<a href="https://material-ui.com/store/items/sketch-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-sketch" style="margin-left: 32px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-sketch.svg" alt="sketch" /></a> Esta é uma coleção de projetos de terceiros que estendem Material-UI. - **Figma**: [Figma para Material-UI](https://material-ui.com/store/items/figma-react/?utm_source=docs&utm_medium=referral&utm_campaign=related-projects-sketch) — Um kit de interface de usuário grande com mais de 600 componentes de Material-UI trabalhados à mão 🎨. -- **Sketch**: [Sketch para Material-UI](https://material-ui.com/store/items/sketch-react/?utm_source=docs&utm_medium=referral&utm_campaign=related-projects-sketch) — Um kit de interface de usuário grande com mais de 600 símbolos de Material-UI trabalhados à mão 💎. - [Adobe XD](https://material-ui.com/store/items/adobe-xd-react/?utm_source=docs&utm_medium=referral&utm_campaign=related-projects-adobe-xd): A large UI kit with over 600 handcrafted Material-UI components. +- **Sketch**: [Sketch para Material-UI](https://material-ui.com/store/items/sketch-react/?utm_source=docs&utm_medium=referral&utm_campaign=related-projects-sketch) — Um kit de interface de usuário grande com mais de 600 símbolos de Material-UI trabalhados à mão 💎. - **Framer**: [Framer para Material-UI](https://packages.framer.com/package/material-ui/material-ui) — Um pequeno kit MIT de interface de usuário em preview, de componentes de Material-UI trabalhado a mão. ## Imagens e ilustrações @@ -64,10 +65,6 @@ Esta é uma coleção de projetos de terceiros que estendem Material-UI. - [material-ui-image](https://mui.wertarbyte.com/#material-ui-image): Imagens são feias até serem carregadas. Materialize elas com material image! Irá desvanecer, como sugere o padrão de carregamento de imagem material. -### Paginação - -- [material-ui-flat-pagination](https://github.com/szmslab/material-ui-flat-pagination): Um componente de paginação de design plano para Material-UI. - ### Agenda/Calendário - [dx-react-scheduler-material-ui](https://devexpress.github.io/devextreme-reactive/react/scheduler/): Um componente agenda/calendário para Material-UI com múltiplas visualizações de calendário, edição, compromissos de recorrência e recursos de navegação por data ([licença paga](https://js.devexpress.com/licensing/)). diff --git a/docs/src/pages/discover-more/related-projects/related-projects-ru.md b/docs/src/pages/discover-more/related-projects/related-projects-ru.md index 88695cad9edf4e..62c9deb28eccca 100644 --- a/docs/src/pages/discover-more/related-projects/related-projects-ru.md +++ b/docs/src/pages/discover-more/related-projects/related-projects-ru.md @@ -6,14 +6,15 @@ Because the scope of problems Material-UI solves is bound, we try to play nicely ## Design resources -<a href="https://material-ui.com/store/items/sketch-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-sketch" style="margin-left: 8px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-sketch.svg" alt="sketch" /></a> -<a href="https://material-ui.com/store/items/figma-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-figma" style="margin-left: 32px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-figma.svg" alt="figma" /></a> +<a href="https://material-ui.com/store/items/figma-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-figma" style="margin-left: 8px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-figma.svg" alt="figma" /></a> +<a href="https://material-ui.com/store/items/adobe-xd-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-adobe-xd" style="margin-left: 32px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-adobe-xd.svg" alt="adobe-xd" /></a> +<a href="https://material-ui.com/store/items/sketch-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-sketch" style="margin-left: 32px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-sketch.svg" alt="sketch" /></a> A set of reusable components for design tools is available, designed to match the React components, and to help you craft great products: - **Figma**: [Figma for Material-UI](https://material-ui.com/store/items/figma-react/?utm_source=docs&utm_medium=referral&utm_campaign=related-projects-sketch) — A large UI kit with over 600 handcrafted Material-UI's components 🎨. +- [Adobe XD](https://material-ui.com/store/items/adobe-xd-react/?utm_source=docs&utm_medium=referral&utm_campaign=related-projects-adobe-xd): Большой UI-набор из более чем 600 самодельных компонентов Material-UI. - **Sketch**: [Sketch for Material-UI](https://material-ui.com/store/items/sketch-react/?utm_source=docs&utm_medium=referral&utm_campaign=related-projects-sketch) — A large UI kit with over 600 handcrafted Material-UI's symbols 💎. -- [Adobe XD](https://material-ui.com/store/items/adobe-xd-react/?utm_source=docs&utm_medium=referral&utm_campaign=related-projects-adobe-xd): A large UI kit with over 600 handcrafted Material-UI components. - **Framer**: [Framer for Material-UI](https://packages.framer.com/package/material-ui/material-ui) — A small MIT UI kit preview of handcrafted Material-UI's component. ## Images and illustrations @@ -64,10 +65,6 @@ This is a collection of third-party projects that extend Material-UI. - [material-ui-image](https://mui.wertarbyte.com/#material-ui-image): Images are ugly until they're loaded. Materialize it with material image! It will fade in like the material image loading pattern suggests. -### Pagination - -- [material-ui-flat-pagination](https://github.com/szmslab/material-ui-flat-pagination): A flat design pagination component for Material-UI. - ### Scheduler/Calendar - [dx-react-scheduler-material-ui](https://devexpress.github.io/devextreme-reactive/react/scheduler/): A scheduler/calendar component for Material-UI with multiple calendar views, editing, recurrence appointments and date navigation features ([paid license](https://js.devexpress.com/licensing/)). diff --git a/docs/src/pages/discover-more/related-projects/related-projects-zh.md b/docs/src/pages/discover-more/related-projects/related-projects-zh.md index 893d97ccaffd3d..49e6ae3b6bcc3e 100644 --- a/docs/src/pages/discover-more/related-projects/related-projects-zh.md +++ b/docs/src/pages/discover-more/related-projects/related-projects-zh.md @@ -6,14 +6,15 @@ ## 设计资源 -<a href="https://material-ui.com/store/items/sketch-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-sketch" style="margin-left: 8px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-sketch.svg" alt="sketch" /></a> -<a href="https://material-ui.com/store/items/figma-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-figma" style="margin-left: 32px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-figma.svg" alt="figma" /></a> +<a href="https://material-ui.com/store/items/figma-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-figma" style="margin-left: 8px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-figma.svg" alt="figma" /></a> +<a href="https://material-ui.com/store/items/adobe-xd-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-adobe-xd" style="margin-left: 32px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-adobe-xd.svg" alt="adobe-xd" /></a> +<a href="https://material-ui.com/store/items/sketch-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-sketch" style="margin-left: 32px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-sketch.svg" alt="sketch" /></a> 一套可重复使用的设计工具组件已经面世,这些工具是为了配合 React 组件而设计的,它们可以帮助你制作优秀的产品。 - [Figma](https://material-ui.com/store/items/figma-react/?utm_source=docs&utm_medium=referral&utm_campaign=related-projects-figma):大型 UI 套件,包含 600 多个手工制作的 Material-UI 组件。 -- [Sketch](https://material-ui.com/store/items/sketch-react/?utm_source=docs&utm_medium=referral&utm_campaign=related-projects-sketch):大型 UI 套件,包含 600 多个手工制作的 Material-UI 符号。 - [Adobe XD](https://material-ui.com/store/items/adobe-xd-react/?utm_source=docs&utm_medium=referral&utm_campaign=related-projects-adobe-xd):大型 UI 套件,包含六百多个手工制作的 Material-UI 组件。 +- [Sketch](https://material-ui.com/store/items/sketch-react/?utm_source=docs&utm_medium=referral&utm_campaign=related-projects-sketch):大型 UI 套件,包含 600 多个手工制作的 Material-UI 符号。 - [Framer](https://packages.framer.com/package/material-ui/material-ui):Material-UI 组件的小型 UI 套件 ## 图像和图案 @@ -64,10 +65,6 @@ - [material-ui-image](https://mui.wertarbyte.com/#material-ui-image):图片在完全加载之前都是很简陋的。 使用 material 图像来物化它! 它会像 material 图像的加载模式建议的一样淡入。 -### 分页组件 Pagination - -- [material-ui-flat-pagination](https://github.com/szmslab/material-ui-flat-pagination):一个基于 Material-UI 的扁平化设计的分页组件。 - ### 日程表/日历 - [dx-react-scheduler-material-ui](https://devexpress.github.io/devextreme-reactive/react/scheduler/):一个基于 Material-UI 的日程表/日历组件,它具有多个功能,包括日历视图、编辑、重复一些预约和日期导航(需要 [付费的许可证](https://js.devexpress.com/licensing/))。 diff --git a/docs/src/pages/discover-more/showcase/showcase-fr.md b/docs/src/pages/discover-more/showcase/showcase-fr.md index 79240c76ba287a..5ae934684ee691 100644 --- a/docs/src/pages/discover-more/showcase/showcase-fr.md +++ b/docs/src/pages/discover-more/showcase/showcase-fr.md @@ -2,9 +2,9 @@ <p class="description">Vous trouverez ci-dessous une liste de certaines applications publiques utilisant Material-UI.</p> -Utilisez-vous Material-UI ? [Share your product](https://github.com/mui-org/material-ui/issues/22426). +Utilisez-vous Material-UI ? [Partagez votre produit](https://github.com/mui-org/material-ui/issues/22426). -The websites we include rank well in at least one of these dimensions: +Les sites Web que nous incluons se classent bien dans au moins une de ces dimensions : - Non Material Design customization - High traffic diff --git a/docs/src/pages/discover-more/team/team-fr.md b/docs/src/pages/discover-more/team/team-fr.md index fe5042ed1e1ffb..b1422efc89e2cc 100644 --- a/docs/src/pages/discover-more/team/team-fr.md +++ b/docs/src/pages/discover-more/team/team-fr.md @@ -6,6 +6,6 @@ Material-UI is maintained by a group of invaluable core contributors, with the m {{"demo": "pages/discover-more/team/Team.js", "hideToolbar": true, "bg": "inline"}} -Impliquez-vous dans le développement de Material-UI en [ouvrant un problème](https://github.com/mui-org/material-ui/issues/new) ou soumettre une demande de tirage. Read the [contributing guidelines](https://github.com/mui-org/material-ui/blob/HEAD/CONTRIBUTING.md) for information on how we develop. +Impliquez-vous dans le développement de Material-UI en [ouvrant un problème](https://github.com/mui-org/material-ui/issues/new) ou soumettre une demande de tirage. Lisez les [consignes de contribution](https://github.com/mui-org/material-ui/blob/HEAD/CONTRIBUTING.md) pour plus d'informations sur la façon dont nous développons. [Join and support the project!](/getting-started/faq/#material-ui-is-awesome-how-can-i-support-the-project) diff --git a/docs/src/pages/discover-more/vision/vision-de.md b/docs/src/pages/discover-more/vision/vision-de.md index 0a618bffc90beb..bd1da644361328 100644 --- a/docs/src/pages/discover-more/vision/vision-de.md +++ b/docs/src/pages/discover-more/vision/vision-de.md @@ -6,7 +6,7 @@ Die Material Design-Richtlinien sind ein unglaublicher Ausgangspunkt, aber sie g Daher wird die Material-UI nicht nur eine Implementierung der Material Design-Richtlinien sein, sondern auch eine allgemeine Benutzerschnittstellen-Bibliothek von Komponenten, die von vielen benötigt werden. Diese allgemeine Verwendung impliziert jedoch keine andere Entwurfsmethodik. Das bedeutet auch, dass wir Komponenten oder Kombinationen haben werden, die in den Konstruktionsrichtlinien nicht behandelt werden. -Wir werden uns darauf konzentrieren, alle einfachen Tools bereitzustellen, die zum Aufbau einer umfassenden Benutzeroberfläche mit React erforderlich sind. Wir möchten nicht, dass sie das Gefühl haben, dass ihre Benutzeroberfläche einfach wie ein anderes Google-Produkt aussieht. Once we implement the Material design specification (which is a bar set quite high), you should be able to take advantage of it for your own business with any style customization needed. Wir möchten, dass Unternehmen das Material-UI so einsetzen, dass sie zu ihrer Marke passen, ob Sie der Materialphilosophie nahe sind oder nicht. +Wir werden uns darauf konzentrieren, alle einfachen Tools bereitzustellen, die zum Aufbau einer umfassenden Benutzeroberfläche mit React erforderlich sind. Once we implement the Material Design guidelines (which is a bar set quite high), you should be able to take advantage of it for your own business with any style customization needed. Once we implement the Material design specification (which is a bar set quite high), you should be able to take advantage of it for your own business with any style customization needed. Wir möchten, dass Unternehmen das Material-UI so einsetzen, dass sie zu ihrer Marke passen, ob Sie der Materialphilosophie nahe sind oder nicht. Aus der Sicht eines Entwicklers möchten wir, dass die Material-UI folgende Funktionen bereitstellt: diff --git a/docs/src/pages/discover-more/vision/vision-es.md b/docs/src/pages/discover-more/vision/vision-es.md index 54fad3fc6601b8..c87372de3e0d9c 100644 --- a/docs/src/pages/discover-more/vision/vision-es.md +++ b/docs/src/pages/discover-more/vision/vision-es.md @@ -6,7 +6,7 @@ Las pautas de Material Design son un excelente punto de partida, pero no brindan Therefore, Material-UI will be not only be an implementation of the Material Design guidelines, but a general use UI library of components that are needed by many. This generalized use doesn't imply any other design methodology. It also means we will have components or combinations that are simply not addressed in the design guidelines. -We will focus on providing all the low-level tools needed to build a rich user-interface with React. We don't want them to feel that their UI simply looks like another Google product. Once we implement the Material design specification (which is a bar set quite high), you should be able to take advantage of it for your own business with any style customization needed. We want to see companies succeeding using Material-UI in a way that matches their brand, close to the material philosophy or not. +We will focus on providing all the low-level tools needed to build a rich user-interface with React. Once we implement the Material Design guidelines (which is a bar set quite high), you should be able to take advantage of it for your own business with any style customization needed. Once we implement the Material design specification (which is a bar set quite high), you should be able to take advantage of it for your own business with any style customization needed. We want to see companies succeeding using Material-UI in a way that matches their brand, close to the material philosophy or not. Desde la perspectiva de un desarrollador: queremos que Material-UI: diff --git a/docs/src/pages/discover-more/vision/vision-fr.md b/docs/src/pages/discover-more/vision/vision-fr.md index 5e815898e23a05..7139eda529e11f 100644 --- a/docs/src/pages/discover-more/vision/vision-fr.md +++ b/docs/src/pages/discover-more/vision/vision-fr.md @@ -6,7 +6,7 @@ Les recommandation material design sont un point de départ incroyable, mais ell Par conséquent, Material-UI sera non seulement une implémentation de Material Design, mais également une bibliothèque d'interface utilisateur à usage général composée de composants nécessaires à de nombreuses personnes. Cette utilisation généralisée n'implique aucune autre méthodologie de conception. Cela signifie également que nous aurons des composants ou des combinaisons qui ne sont tout simplement pas abordés dans la specification officielle. -Nous nous concentrerons sur la fourniture de tous les outils de bas niveau nécessaires pour créer une interface utilisateur riche avec React. Nous ne voulons pas qu'ils sentent que leur interface utilisateur ressemble simplement à un autre produit Google. Once we implement the Material design specification (which is a bar set quite high), you should be able to take advantage of it for your own business with any style customization needed. Nous voulons que les entreprises réussissent à utiliser Material-UI d’une manière qui corresponde à leur marque, proche de la philosophie Material ou non. +Nous nous concentrerons sur la fourniture de tous les outils de bas niveau nécessaires pour créer une interface utilisateur riche avec React. Once we implement the Material design specification (which is a bar set quite high), you should be able to take advantage of it for your own business with any style customization needed. Once we implement the Material design specification (which is a bar set quite high), you should be able to take advantage of it for your own business with any style customization needed. Nous voulons que les entreprises réussissent à utiliser Material-UI d’une manière qui corresponde à leur marque, proche de la philosophie Material ou non. Du point de vue du développeur, nous souhaitons que Material-UI: diff --git a/docs/src/pages/discover-more/vision/vision-ja.md b/docs/src/pages/discover-more/vision/vision-ja.md index e7f73fe7cb9c1f..db116bb3709309 100644 --- a/docs/src/pages/discover-more/vision/vision-ja.md +++ b/docs/src/pages/discover-more/vision/vision-ja.md @@ -6,7 +6,7 @@ したがって、Material-UIはMaterial Designガイドラインの実装であるだけでなく、多くのユーザが必要とするコンポーネントの一般的なUIライブラリでもあります。 この一般的な使用は、他の設計方法論を意味するものではありません。 また、設計ガイドラインでは扱われていないコンポーネントや組み合わせもあります。 この一般的な使用は、他の設計方法論を意味するものではありません。 また、設計ガイドラインでは扱われていないコンポーネントや組み合わせもあります。 この一般的な使用は、他の設計方法論を意味するものではありません。 また、設計ガイドラインでは扱われていないコンポーネントや組み合わせもあります。 この一般的な使用は、他の設計方法論を意味するものではありません。 また、設計ガイドラインでは扱われていないコンポーネントや組み合わせもあります。 この一般的な使用は、他の設計方法論を意味するものではありません。 また、設計ガイドラインでは扱われていないコンポーネントや組み合わせもあります。 この一般的な使用は、他の設計方法論を意味するものではありません。 また、設計ガイドラインでは扱われていないコンポーネントや組み合わせもあります。 -私たちは、Reactでリッチなユーザインターフェイスを構築するために必要な低レベルのツールを提供することに焦点を当てます。 私たちは、Reactでリッチなユーザインターフェイスを構築するために必要な低レベルのツールを提供することに焦点を当てます。 Once we implement the Material design specification (which is a bar set quite high), you should be able to take advantage of it for your own business with any style customization needed. 私たちは、Reactでリッチなユーザインターフェイスを構築するために必要な低レベルのツールを提供することに焦点を当てます。 Once we implement the Material design specification (which is a bar set quite high), you should be able to take advantage of it for your own business with any style customization needed. 私たちは、企業がマテリアル・フィロソフィーに近いかどうかに関わらず、自社のブランドに合った方法でMaterial-UIを使って成功することを望んでいます。 我々はUIがGoogleの別の製品のように見えるだけだと思われたくない。 私たちは、企業がマテリアル・フィロソフィーに近いかどうかに関わらず、自社のブランドに合った方法でMaterial-UIを使って成功することを望んでいます。 我々はUIがGoogleの別の製品のように見えるだけだと思われたくない。 私たちは、企業がマテリアル・フィロソフィーに近いかどうかに関わらず、自社のブランドに合った方法でMaterial-UIを使って成功することを望んでいます。 我々はUIがGoogleの別の製品のように見えるだけだと思われたくない。 +私たちは、Reactでリッチなユーザインターフェイスを構築するために必要な低レベルのツールを提供することに焦点を当てます。 私たちは、Reactでリッチなユーザインターフェイスを構築するために必要な低レベルのツールを提供することに焦点を当てます。 Once we implement the Material design specification (which is a bar set quite high), you should be able to take advantage of it for your own business with any style customization needed. Once we implement the Material Design guidelines (which is a bar set quite high), you should be able to take advantage of it for your own business with any style customization needed. 私たちは、企業がマテリアル・フィロソフィーに近いかどうかに関わらず、自社のブランドに合った方法でMaterial-UIを使って成功することを望んでいます。 我々はUIがGoogleの別の製品のように見えるだけだと思われたくない。 私たちは、企業がマテリアル・フィロソフィーに近いかどうかに関わらず、自社のブランドに合った方法でMaterial-UIを使って成功することを望んでいます。 我々はUIがGoogleの別の製品のように見えるだけだと思われたくない。 私たちは、企業がマテリアル・フィロソフィーに近いかどうかに関わらず、自社のブランドに合った方法でMaterial-UIを使って成功することを望んでいます。 我々はUIがGoogleの別の製品のように見えるだけだと思われたくない。 From a developer's point of view, we want Material-UI to: diff --git a/docs/src/pages/discover-more/vision/vision-pt.md b/docs/src/pages/discover-more/vision/vision-pt.md index 2ae66c7f47f70c..890f4365cd4da3 100644 --- a/docs/src/pages/discover-more/vision/vision-pt.md +++ b/docs/src/pages/discover-more/vision/vision-pt.md @@ -6,7 +6,7 @@ As diretrizes do Material Design são um ponto de partida incrível, mas não fo Portanto, Material-UI não será apenas uma implementação das diretrizes de Material Design, mas uma biblioteca de componentes UI de uso geral que são necessários para muitos. Esse uso generalizado não implica em nenhuma outra metodologia de design. Isso também significa que teremos componentes ou combinações que simplesmente não são abordadas nas diretrizes de design. -Vamos nos concentrar em fornecer todas as ferramentas de baixo nível necessárias para construir uma interface de usuário rica com o React. Depois de implementarmos a especificação do Material Design (que já é um nível elevado), você poderá aproveitá-la para seu próprio negócio com qualquer personalização de estilo necessária. Queremos que as empresas consigam usar o Material-UI de uma forma que corresponda à sua marca, próxima da filosofia material ou não. Não queremos que eles sintam que a interface do usuário simplesmente se parece com outro produto do Google. +Vamos nos concentrar em fornecer todas as ferramentas de baixo nível necessárias para construir uma interface de usuário rica com o React. Once we implement the Material Design guidelines (which is a bar set quite high), you should be able to take advantage of it for your own business with any style customization needed. Queremos que as empresas consigam usar o Material-UI de uma forma que corresponda à sua marca, próxima da filosofia material ou não. Não queremos que eles sintam que a interface do usuário simplesmente se parece com outro produto do Google. Do ponto de vista de um desenvolvedor, queremos que o Material-UI: diff --git a/docs/src/pages/discover-more/vision/vision-ru.md b/docs/src/pages/discover-more/vision/vision-ru.md index 91ccc678ba79cd..08a3f220e7d5d0 100644 --- a/docs/src/pages/discover-more/vision/vision-ru.md +++ b/docs/src/pages/discover-more/vision/vision-ru.md @@ -6,7 +6,7 @@ The Material Design guidelines are an incredible starting point, but they do not Therefore, Material-UI will be not only be an implementation of the Material Design guidelines, but a general use UI library of components that are needed by many. This generalized use doesn't imply any other design methodology. It also means we will have components or combinations that are simply not addressed in the design guidelines. -We will focus on providing all the low-level tools needed to build a rich user-interface with React. We don't want them to feel that their UI simply looks like another Google product. Once we implement the Material design specification (which is a bar set quite high), you should be able to take advantage of it for your own business with any style customization needed. We want to see companies succeeding using Material-UI in a way that matches their brand, close to the material philosophy or not. +We will focus on providing all the low-level tools needed to build a rich user-interface with React. Once we implement the Material Design guidelines (which is a bar set quite high), you should be able to take advantage of it for your own business with any style customization needed. Once we implement the Material design specification (which is a bar set quite high), you should be able to take advantage of it for your own business with any style customization needed. We want to see companies succeeding using Material-UI in a way that matches their brand, close to the material philosophy or not. From a developer's point of view, we want Material-UI to: diff --git a/docs/src/pages/discover-more/vision/vision-zh.md b/docs/src/pages/discover-more/vision/vision-zh.md index 84bfc3f10e4364..2e1e71dc3c02d7 100644 --- a/docs/src/pages/discover-more/vision/vision-zh.md +++ b/docs/src/pages/discover-more/vision/vision-zh.md @@ -6,7 +6,7 @@ Material-UI 起航于 Material Design 指导下的设计原则,但一款软件 正因此,Material-UI 绝不只是应用、实现 Material Design 所列述的原则,它更像一个面对广大用户提出的设计问题,提供优良设计组件甚或设计方案的 UI 库。 这个一般化的做法并没有遵循任何已有的设计原则。 此处我们还有想要表达的另一层意思,那就是 Material-UI 的一些组件或组合可能提供了一些 Material Design 还未能给出的设计思路。 -Material-Ui 致力于提供各类底层的、基础型的工具。有了它,用户可以开发出丰富的用户界面。 一旦我们实施了 Material Design 规范(这是一个很高的标准),您就能够针对自己的业务定制任何所需要的样式。 我们很想看到的是,公司会根据自己的品牌有了自己的一套 Material-UI 使用方法,却无关乎或者不是百分之百有着 material 的设计哲学和内涵。 我们不想要看到 Material-UI 只是 Google 产品的另一个复制品。 +Material-Ui 致力于提供各类底层的、基础型的工具。有了它,用户可以开发出丰富的用户界面。 Once we implement the Material Design guidelines (which is a bar set quite high), you should be able to take advantage of it for your own business with any style customization needed. 我们很想看到的是,公司会根据自己的品牌有了自己的一套 Material-UI 使用方法,却无关乎或者不是百分之百有着 material 的设计哲学和内涵。 我们不想要看到 Material-UI 只是 Google 产品的另一个复制品。 作为开发者,我们眼中 Material-UI 的未来应该是: diff --git a/docs/src/pages/getting-started/example-projects/example-projects-de.md b/docs/src/pages/getting-started/example-projects/example-projects-de.md index 4ab39145dbccfb..f0cada826c0116 100644 --- a/docs/src/pages/getting-started/example-projects/example-projects-de.md +++ b/docs/src/pages/getting-started/example-projects/example-projects-de.md @@ -6,14 +6,16 @@ You can find some example projects in the [GitHub repository](https://github.com/mui-org/material-ui) under the [`/examples`](https://github.com/mui-org/material-ui/tree/master/examples) folder: +<!-- #default-branch-switch --> + +- https://github.com/mui-org/material-ui/tree/master/examples/nextjs - https://github.com/mui-org/material-ui/tree/master/examples/create-react-app - [Gatsby](https://github.com/mui-org/material-ui/tree/next/examples/gatsby) - [Gatsby Theme](https://github.com/mui-org/material-ui/tree/next/examples/gatsby-theme) -- https://github.com/mui-org/material-ui/tree/master/examples/nextjs - [Preact](https://github.com/mui-org/material-ui/tree/next/examples/preact) - [CDN](https://github.com/mui-org/material-ui/tree/next/examples/cdn) - [Plain server-side](https://github.com/mui-org/material-ui/tree/next/examples/ssr) -- [Use styled-components as style engine](https://github.com/mui-org/material-ui/tree/next/examples/create-react-app-with-styled-components) +- [Use styled-components as style engine](https://github.com/mui-org/material-ui/tree/next/examples/create-react-app-with-styled-components) ([TypeScript version](https://github.com/mui-org/material-ui/tree/next/examples/create-react-app-with-styled-components-typescript)) Create React App ist ein großartiges Projekt zum Lernen von React. Schauen Sie sich die [verfügbaren Alternativen an](https://github.com/facebook/create-react-app/blob/master/README.md#popular-alternatives) um zu sehen, welches Projekt am besten zu Ihnen passt. @@ -25,8 +27,18 @@ If you want to start with a more complete and real-world example, you could take ### Kostenlos +- [GraphQL API and Relay Starter Kit](https://github.com/kriasoft/graphql-starter): + + - ![sterne](https://img.shields.io/github/stars/kriasoft/graphql-starter.svg?style=social&label=Star) + - GraphQL API project using code-first design (TypeScript, OAuth, GraphQL.js, Knex, Cloud SQL) + - Web application project pre-configured with Webpack v5, TypeScript, React, Relay, Material UI + - Serverless deployment: `api` -> Cloud Functions, `web` -> Cloudflare Workers + - Client-side page routing/rendering at CDN edge locations, lazy loading + - Optimized for fast CI/CD builds and deployments using Yarn v2 monorepo design + - [React Most Wanted](https://github.com/TarikHuber/react-most-wanted): + - ![sterne](https://img.shields.io/github/stars/TarikHuber/react-most-wanted.svg?style=social&label=Star) - Erstellt mit Create React App - Custom Create React App script to start a new project with just a single CLI command - Build for Firebase including Authentication using the official Firebase Web Auth UI @@ -34,28 +46,31 @@ If you want to start with a more complete and real-world example, you could take - All PWA features included (SW, Notifications, deferred installation prompt and more) - Optimized and scalable performance (all ~100 points on Lighthouse) -- [RMUIF](https://github.com/phoqe/rmuif): +- [React SaaS Template](https://github.com/dunky11/react-saas-template): - - Bootstrapped with Create React App, the same tooling works from the get-go - - Built on top of Firebase with all their products for the web included - - Robust routing with React Router including protected routes and error handling - - Extensive mobile support with full-screen dialogs and react-swipeable-views for tabs - - Cross-platform application monitoring with a focus on error reporting with Sentry + - ![sterne](https://img.shields.io/github/stars/dunky11/react-saas-template.svg?style=social&label=Star) + - Erstellt mit Create React App + - Features a landing page, a blog, an area to login/register and an admin-dashboard + - Fully routed using react-router + - Lazy loads components to boost performance + - Components for statistics, text with emoji support, image upload and much more... - [Material Sense](https://github.com/alexanmtz/material-sense): + - ![sterne](https://img.shields.io/github/stars/alexanmtz/material-sense.svg?style=social&label=Star) - Diagramme mit recharts - React Router mit einem Navigationsbeispiel - Ein Docker-Container mit einem Nginx-Server für den Produktionsaufbau - Erstellt mit Create React App -- [React SaaS Template](https://github.com/dunky11/react-saas-template): +- [RMUIF](https://github.com/phoqe/rmuif): - - Erstellt mit Create React App - - Features a landing page, a blog, an area to login/register and an admin-dashboard - - Fully routed using react-router - - Lazy loads components to boost performance - - Components for statistics, text with emoji support, image upload and much more... + - ![sterne](https://img.shields.io/github/stars/rmuif/web.svg?style=social&label=Star) + - Bootstrapped with Create React App, the same tooling works from the get-go + - Built on top of Firebase with all their products for the web included + - Robust routing with React Router including protected routes and error handling + - Extensive mobile support with full-screen dialogs and react-swipeable-views for tabs + - Cross-platform application monitoring with a focus on error reporting with Sentry ### Kostenpflichtig @@ -67,3 +82,8 @@ If you want to start with a more complete and real-world example, you could take - Model your database and application with the intuitive GUI - Generate your application, including a complete scaffolded backend - Preview your application online, and download the generated code + +- [Divjoy](https://divjoy.com?via=material-ui): + + - Create your Material-UI app in minutes. + - You'll get a nice template, authentication, database integration, subscription payments, and more. diff --git a/docs/src/pages/getting-started/example-projects/example-projects-es.md b/docs/src/pages/getting-started/example-projects/example-projects-es.md index c245fd5d5283d9..3dc6731071afda 100644 --- a/docs/src/pages/getting-started/example-projects/example-projects-es.md +++ b/docs/src/pages/getting-started/example-projects/example-projects-es.md @@ -4,16 +4,18 @@ ## Ejemplos oficiales -Puedes encontrar algunos proyectos de ejemplo en el [repositorio de Github](https://github.com/mui-org/material-ui) dentro de la carpeta [`/examples`](https://github.com/mui-org/material-ui/tree/master/examples): +Puedes encontrar algunos proyectos de ejemplo en el [repositorio de GitHub](https://github.com/mui-org/material-ui) dentro de la carpeta [`/examples`](https://github.com/mui-org/material-ui/tree/master/examples): +<!-- #default-branch-switch --> + +- https://github.com/mui-org/material-ui/tree/master/examples/nextjs - https://github.com/mui-org/material-ui/tree/master/examples/create-react-app - [Gatsby](https://github.com/mui-org/material-ui/tree/next/examples/gatsby) - [Gatsby Theme](https://github.com/mui-org/material-ui/tree/next/examples/gatsby-theme) -- https://github.com/mui-org/material-ui/tree/master/examples/nextjs - [Preact](https://github.com/mui-org/material-ui/tree/next/examples/preact) - [CDN](https://github.com/mui-org/material-ui/tree/next/examples/cdn) - [Plain server-side](https://github.com/mui-org/material-ui/tree/next/examples/ssr) -- [Use styled-components as style engine](https://github.com/mui-org/material-ui/tree/next/examples/create-react-app-with-styled-components) +- [Use styled-components as style engine](https://github.com/mui-org/material-ui/tree/next/examples/create-react-app-with-styled-components) ([TypeScript version](https://github.com/mui-org/material-ui/tree/next/examples/create-react-app-with-styled-components-typescript)) Create React App es un excelente proyecto para aprender React. Echa un vistazo a [las alternativas disponibles](https://github.com/facebook/create-react-app/blob/master/README.md#popular-alternatives) para ver qué proyecto se adapta mejor a tus necesidades. @@ -25,8 +27,18 @@ Si quieres empezar con un ejemplo más completo y real, puedes echar un vistazo ### Gratis +- [GraphQL API and Relay Starter Kit](https://github.com/kriasoft/graphql-starter): + + - ![estrellas](https://img.shields.io/github/stars/kriasoft/graphql-starter.svg?style=social&label=Star) + - GraphQL API project using code-first design (TypeScript, OAuth, GraphQL.js, Knex, Cloud SQL) + - Web application project pre-configured with Webpack v5, TypeScript, React, Relay, Material UI + - Serverless deployment: `api` -> Cloud Functions, `web` -> Cloudflare Workers + - Client-side page routing/rendering at CDN edge locations, lazy loading + - Optimized for fast CI/CD builds and deployments using Yarn v2 monorepo design + - [React Most Wanted](https://github.com/TarikHuber/react-most-wanted): + - ![estrellas](https://img.shields.io/github/stars/TarikHuber/react-most-wanted.svg?style=social&label=Star) - Creado con Create React App - Crear un script de Create React App personalizado para iniciar un nuevo proyecto con un solo comando CLI - Build for Firebase including Authentication using the official Firebase Web Auth UI @@ -34,28 +46,31 @@ Si quieres empezar con un ejemplo más completo y real, puedes echar un vistazo - All PWA features included (SW, Notifications, deferred installation prompt and more) - Optimized and scalable performance (all ~100 points on Lighthouse) -- [RMUIF](https://github.com/phoqe/rmuif): +- [React SaaS Template](https://github.com/dunky11/react-saas-template): - - Bootstrapped with Create React App, the same tooling works from the get-go - - Built on top of Firebase with all their products for the web included - - Robust routing with React Router including protected routes and error handling - - Extensive mobile support with full-screen dialogs and react-swipeable-views for tabs - - Cross-platform application monitoring with a focus on error reporting with Sentry + - ![estrellas](https://img.shields.io/github/stars/dunky11/react-saas-template.svg?style=social&label=Star) + - Creado con Create React App + - Features a landing page, a blog, an area to login/register and an admin-dashboard + - Fully routed using react-router + - Lazy loads components to boost performance + - Components for statistics, text with emoji support, image upload and much more... - [Material Sense](https://github.com/alexanmtz/material-sense): + - ![estrellas](https://img.shields.io/github/stars/alexanmtz/material-sense.svg?style=social&label=Star) - Graph using recharts - React Router incluido con un ejemplo de navegación - Un contenedor de docker con servidor Nginx para compilado de producción - Creado con Create React App -- [React SaaS Template](https://github.com/dunky11/react-saas-template): +- [RMUIF](https://github.com/phoqe/rmuif): - - Creado con Create React App - - Features a landing page, a blog, an area to login/register and an admin-dashboard - - Fully routed using react-router - - Lazy loads components to boost performance - - Components for statistics, text with emoji support, image upload and much more... + - ![estrellas](https://img.shields.io/github/stars/rmuif/web.svg?style=social&label=Star) + - Bootstrapped with Create React App, the same tooling works from the get-go + - Built on top of Firebase with all their products for the web included + - Robust routing with React Router including protected routes and error handling + - Extensive mobile support with full-screen dialogs and react-swipeable-views for tabs + - Cross-platform application monitoring with a focus on error reporting with Sentry ### De Pago @@ -67,3 +82,8 @@ Si quieres empezar con un ejemplo más completo y real, puedes echar un vistazo - Model your database and application with the intuitive GUI - Generate your application, including a complete scaffolded backend - Preview your application online, and download the generated code + +- [Divjoy](https://divjoy.com?via=material-ui): + + - Create your Material-UI app in minutes. + - You'll get a nice template, authentication, database integration, subscription payments, and more. diff --git a/docs/src/pages/getting-started/example-projects/example-projects-fr.md b/docs/src/pages/getting-started/example-projects/example-projects-fr.md index 6a0739a53d0318..eba1f0726be49d 100644 --- a/docs/src/pages/getting-started/example-projects/example-projects-fr.md +++ b/docs/src/pages/getting-started/example-projects/example-projects-fr.md @@ -6,14 +6,16 @@ Vous pouvez trouver des exemples de projets dans le [dépôt GitHub](https://github.com/mui-org/material-ui) sous le dossier [`/examples`](https://github.com/mui-org/material-ui/tree/master/examples) : +<!-- #default-branch-switch --> + - https://github.com/mui-org/material-ui/tree/master/examples/create-react-app +- https://github.com/mui-org/material-ui/tree/next/examples/create-react-app-with-styled-components - [Gatsby](https://github.com/mui-org/material-ui/tree/next/examples/gatsby) - [Gatsby Theme](https://github.com/mui-org/material-ui/tree/next/examples/gatsby-theme) -- https://github.com/mui-org/material-ui/tree/master/examples/nextjs - [Preact](https://github.com/mui-org/material-ui/tree/next/examples/preact) - [CDN](https://github.com/mui-org/material-ui/tree/next/examples/cdn) - [Plain server-side](https://github.com/mui-org/material-ui/tree/next/examples/ssr) -- [Use styled-components as style engine](https://github.com/mui-org/material-ui/tree/next/examples/create-react-app-with-styled-components) +- https://github.com/mui-org/material-ui/tree/master/examples/nextjs Create React App est un projet génial pour apprendre React. Regardez [les alternatives disponibles](https://github.com/facebook/create-react-app/blob/master/README.md#popular-alternatives) pour voir quel projet correspond le mieux à vos besoins. @@ -25,8 +27,18 @@ If you want to start with a more complete and real-world example, you could take ### Gratuit +- [GraphQL API and Relay Starter Kit](https://github.com/kriasoft/graphql-starter): + + - ![stars](https://img.shields.io/github/stars/kriasoft/graphql-starter.svg?style=social&label=Star) + - GraphQL API project using code-first design (TypeScript, OAuth, GraphQL.js, Knex, Cloud SQL) + - Web application project pre-configured with Webpack v5, TypeScript, React, Relay, Material UI + - Serverless deployment: `api` -> Cloud Functions, `web` -> Cloudflare Workers + - Client-side page routing/rendering at CDN edge locations, lazy loading + - Optimized for fast CI/CD builds and deployments using Yarn v2 monorepo design + - [React Most Wanted](https://github.com/TarikHuber/react-most-wanted): + - ![stars](https://img.shields.io/github/stars/TarikHuber/react-most-wanted.svg?style=social&label=Star) - Created with Create React App - Custom Create React App script to start a new project with just a single CLI command - Build for Firebase including Authentication using the official Firebase Web Auth UI @@ -34,28 +46,31 @@ If you want to start with a more complete and real-world example, you could take - All PWA features included (SW, Notifications, deferred installation prompt and more) - Optimized and scalable performance (all ~100 points on Lighthouse) -- [RMUIF](https://github.com/phoqe/rmuif): +- [React SaaS Template](https://github.com/dunky11/react-saas-template): - - Bootstrapped with Create React App, the same tooling works from the get-go - - Built on top of Firebase with all their products for the web included - - Robust routing with React Router including protected routes and error handling - - Extensive mobile support with full-screen dialogs and react-swipeable-views for tabs - - Cross-platform application monitoring with a focus on error reporting with Sentry + - ![stars](https://img.shields.io/github/stars/dunky11/react-saas-template.svg?style=social&label=Star) + - Created with Create React App + - Features a landing page, a blog, an area to login/register and an admin-dashboard + - Fully routed using react-router + - Lazy loads components to boost performance + - Components for statistics, text with emoji support, image upload and much more... - [Material Sense](https://github.com/alexanmtz/material-sense): + - ![stars](https://img.shields.io/github/stars/alexanmtz/material-sense.svg?style=social&label=Star) - Graph using recharts - React Router included with a navigation example - A docker container with an Nginx server for production build - Created with Create React App -- [React SaaS Template](https://github.com/dunky11/react-saas-template): +- [RMUIF](https://github.com/phoqe/rmuif): - - Created with Create React App - - Features a landing page, a blog, an area to login/register and an admin-dashboard - - Fully routed using react-router - - Lazy loads components to boost performance - - Components for statistics, text with emoji support, image upload and much more... + - ![stars](https://img.shields.io/github/stars/rmuif/web.svg?style=social&label=Star) + - Bootstrapped with Create React App, the same tooling works from the get-go + - Built on top of Firebase with all their products for the web included + - Robust routing with React Router including protected routes and error handling + - Extensive mobile support with full-screen dialogs and react-swipeable-views for tabs + - Cross-platform application monitoring with a focus on error reporting with Sentry ### Payant @@ -67,3 +82,8 @@ If you want to start with a more complete and real-world example, you could take - Model your database and application with the intuitive GUI - Generate your application, including a complete scaffolded backend - Preview your application online, and download the generated code + +- [Divjoy](https://divjoy.com?via=material-ui): + + - Create your Material-UI app in minutes. + - You'll get a nice template, authentication, database integration, subscription payments, and more. diff --git a/docs/src/pages/getting-started/example-projects/example-projects-ja.md b/docs/src/pages/getting-started/example-projects/example-projects-ja.md index f50c90f17e21e0..16aa108c3ff32a 100644 --- a/docs/src/pages/getting-started/example-projects/example-projects-ja.md +++ b/docs/src/pages/getting-started/example-projects/example-projects-ja.md @@ -4,58 +4,73 @@ ## Official examples -You can find some example projects in the [GitHub repository](https://github.com/mui-org/material-ui) under the [`/examples`](https://github.com/mui-org/material-ui/tree/master/examples) folder: +[GitHubリポジトリ](https://github.com/mui-org/material-ui)の下の[`/examples`](https://github.com/mui-org/material-ui/tree/next/examples)フォルダにいくつかのサンプルプロジェクトを用意しています。 -- https://github.com/mui-org/material-ui/tree/master/examples/create-react-app +<!-- #default-branch-switch --> + +- https://github.com/mui-org/material-ui/tree/master/examples/nextjs +- [Create React App](https://github.com/mui-org/material-ui/tree/next/examples/create-react-app) ([TypeScriptバージョン](https://github.com/mui-org/material-ui/tree/next/examples/create-react-app-with-typescript)) - [Gatsby](https://github.com/mui-org/material-ui/tree/next/examples/gatsby) - [Gatsby Theme](https://github.com/mui-org/material-ui/tree/next/examples/gatsby-theme) -- https://github.com/mui-org/material-ui/tree/master/examples/nextjs - [Preact](https://github.com/mui-org/material-ui/tree/next/examples/preact) - [CDN](https://github.com/mui-org/material-ui/tree/next/examples/cdn) - [Plain server-side](https://github.com/mui-org/material-ui/tree/next/examples/ssr) -- [Use styled-components as style engine](https://github.com/mui-org/material-ui/tree/next/examples/create-react-app-with-styled-components) +- [Use styled-components as style engine](https://github.com/mui-org/material-ui/tree/next/examples/create-react-app-with-styled-components) ([TypeScript version](https://github.com/mui-org/material-ui/tree/next/examples/create-react-app-with-styled-components-typescript)) -Create React AppはReactを学ぶのに良いプロジェクトです。 Create React AppはReactを学ぶのに良いプロジェクトです。 どのプロジェクトが自分のニーズに最も適しているか知る為に[利用可能な代替案](https://github.com/facebook/create-react-app/blob/master/README.md#popular-alternatives)をみてみてください。 Create React AppはReactを学ぶのに良いプロジェクトです。 どのプロジェクトが自分のニーズに最も適しているか知る為に[利用可能な代替案](https://github.com/facebook/create-react-app/blob/master/README.md#popular-alternatives)をみてみてください。 Create React AppはReactを学ぶのに良いプロジェクトです。 どのプロジェクトが自分のニーズに最も適しているか知る為に[利用可能な代替案](https://github.com/facebook/create-react-app/blob/master/README.md#popular-alternatives)をみてみてください。 Create React AppはReactを学ぶのに良いプロジェクトです。 Create React AppはReactを学ぶのに良いプロジェクトです。 どのプロジェクトが自分のニーズに最も適しているか知る為に[利用可能な代替案](https://github.com/facebook/create-react-app/blob/master/README.md#popular-alternatives)をみてみてください。 Create React AppはReactを学ぶのに良いプロジェクトです。 どのプロジェクトが自分のニーズに最も適しているか知る為に[利用可能な代替案](https://github.com/facebook/create-react-app/blob/master/README.md#popular-alternatives)をみてみてください。 Create React AppはReactを学ぶのに良いプロジェクトです。 どのプロジェクトが自分のニーズに最も適しているか知る為に[利用可能な代替案](https://github.com/facebook/create-react-app/blob/master/README.md#popular-alternatives)をみてみてください。 Create React AppはReactを学ぶのに良いプロジェクトです。 どのプロジェクトが自分のニーズに最も適しているか知る為に[利用可能な代替案](https://github.com/facebook/create-react-app/blob/master/README.md#popular-alternatives)をみてみてください。 +Create React AppはReactを学ぶのに良いプロジェクトです。 どのプロジェクトが自分のニーズに最も適しているか知る為に[利用可能な代替案](https://github.com/facebook/create-react-app/blob/master/README.md#popular-alternatives)をみてみてください。 このドキュメントサイトのソースコードもリポジトリに含まれています。 少しだけ複雑なプロジェクトです。 [`/docs`](https://github.com/mui-org/material-ui/tree/master/docs)フォルダのビルド手順を確認してください。 ## 更に高度なサンプルプロジェクト -If you want to start with a more complete and real-world example, you could take a look at the [premium themes & templates](https://material-ui.com/store/?utm_source=docs&utm_medium=referral&utm_campaign=example-projects-store) or: +より完全で現実的な例から始めたい場合 [プレミアムテーマ & テンプレート](https://material-ui.com/store/?utm_source=docs&utm_medium=referral&utm_campaign=example-projects-store) をご覧ください: ### Gratuit +- [GraphQL API and Relay Starter Kit](https://github.com/kriasoft/graphql-starter): + + - ![Stars](https://img.shields.io/github/stars/kriasoft/graphql-starter.svg?style=social&label=Star) + - GraphQL API project using code-first design (TypeScript, OAuth, GraphQL.js, Knex, Cloud SQL) + - Web application project pre-configured with Webpack v5, TypeScript, React, Relay, Material UI + - Serverless deployment: `api` -> Cloud Functions, `web` -> Cloudflare Workers + - Client-side page routing/rendering at CDN edge locations, lazy loading + - Optimized for fast CI/CD builds and deployments using Yarn v2 monorepo design + - [React Most Wanted](https://github.com/TarikHuber/react-most-wanted): + - ![Stars](https://img.shields.io/github/stars/TarikHuber/react-most-wanted.svg?style=social&label=Star) - Create React Appによる生成 - 単一のCLIコマンドで新しいプロジェクトを開始するカスタムCreate React Appスクリプト - 公式のFirebase Web Auth UIを使用した認証を含むFirebase用のビルド - エラー処理(404)および遅延ロードを含むReact Routerによるルーティング - - All PWA features included (SW, Notifications, deferred installation prompt and more) + - すべてのPWA機能が含まれています(SW、通知、遅延インストールプロンプトなど) - 最適化されたスケーラブルなパフォーマンス(すべてLighthouseで最大100ポイント) -- [RMUIF](https://github.com/phoqe/rmuif): +- [React SaaS Template](https://github.com/dunky11/react-saas-template): - - Bootstrapped with Create React App, the same tooling works from the get-go - - Built on top of Firebase with all their products for the web included - - Robust routing with React Router including protected routes and error handling - - フルスクリーンダイアログと react-swipeable-viewsによる広範なモバイルサポートタブ用 - - Cross-platform application monitoring with a focus on error reporting with Sentry + - ![Stars](https://img.shields.io/github/stars/dunky11/react-saas-template.svg?style=social&label=Star) + - Create React Appによる生成 + - Features a landing page, a blog, an area to login/register and an admin-dashboard + - Fully routed using react-router + - Lazy loads components to boost performance + - Components for statistics, text with emoji support, image upload and much more... - [Material Sense](https://github.com/alexanmtz/material-sense): + - ![Stars](https://img.shields.io/github/stars/alexanmtz/material-sense.svg?style=social&label=Star) - rechartsを用いたグラフ - ナビゲーションのサンプルに含まれるReact Router - プロダクションビルド用のNginxサーバ含むdockerコンテナ - Create React Appによる生成 -- [React SaaS Template](https://github.com/dunky11/react-saas-template): +- [RMUIF](https://github.com/rmuif/web): - - Create React Appによる生成 - - Features a landing page, a blog, an area to login/register and an admin-dashboard - - Fully routed using react-router - - Lazy loads components to boost performance - - Components for statistics, text with emoji support, image upload and much more... + - ![Stars](https://img.shields.io/github/stars/rmuif/web.svg?style=social&label=Star) + - Bootstrapped with Create React App, the same tooling works from the get-go + - Built on top of Firebase with all their products for the web included + - Robust routing with React Router including protected routes and error handling + - フルスクリーンダイアログと react-swipeable-viewsによる広範なモバイルサポートタブ用 + - Cross-platform application monitoring with a focus on error reporting with Sentry ### 有料 @@ -67,3 +82,8 @@ If you want to start with a more complete and real-world example, you could take - Model your database and application with the intuitive GUI - Generate your application, including a complete scaffolded backend - Preview your application online, and download the generated code + +- [Divjoy](https://divjoy.com?via=material-ui): + + - Create your Material-UI app in minutes. + - You'll get a nice template, authentication, database integration, subscription payments, and more. diff --git a/docs/src/pages/getting-started/example-projects/example-projects-pt.md b/docs/src/pages/getting-started/example-projects/example-projects-pt.md index 1100801ffca2b3..3b022a7f639752 100644 --- a/docs/src/pages/getting-started/example-projects/example-projects-pt.md +++ b/docs/src/pages/getting-started/example-projects/example-projects-pt.md @@ -6,14 +6,16 @@ Você pode encontrar alguns exemplos de projetos no repositório [GitHub](https://github.com/mui-org/material-ui) na pasta [`/examples`](https://github.com/mui-org/material-ui/tree/master/examples): +<!-- #default-branch-switch --> + +- [Next.js](https://github.com/mui-org/material-ui/tree/next/examples/nextjs) ([Versão TypeScript](https://github.com/mui-org/material-ui/tree/next/examples/nextjs-with-typescript)) - [Create React App](https://github.com/mui-org/material-ui/tree/next/examples/create-react-app) ([versão TypeScript](https://github.com/mui-org/material-ui/tree/next/examples/create-react-app-with-typescript)) - [Gatsby](https://github.com/mui-org/material-ui/tree/next/examples/gatsby) - [Tema Gatsby](https://github.com/mui-org/material-ui/tree/next/examples/gatsby-theme) -- [Next.js](https://github.com/mui-org/material-ui/tree/next/examples/nextjs) ([versão TypeScript](https://github.com/mui-org/material-ui/tree/next/examples/nextjs-with-typescript)) - [Preact](https://github.com/mui-org/material-ui/tree/next/examples/preact) - [CDN](https://github.com/mui-org/material-ui/tree/next/examples/cdn) - [Plain server-side](https://github.com/mui-org/material-ui/tree/next/examples/ssr) -- [Use styled-components como motor de estilo](https://github.com/mui-org/material-ui/tree/next/examples/create-react-app-with-styled-components) +- [Use styled-components as style engine](https://github.com/mui-org/material-ui/tree/next/examples/create-react-app-with-styled-components) ([TypeScript version](https://github.com/mui-org/material-ui/tree/next/examples/create-react-app-with-styled-components-typescript)) Create React App é um projeto incrível para aprender React. Dê uma olhada nas [alternativas disponíveis](https://github.com/facebook/create-react-app/blob/master/README.md#popular-alternatives) para ver qual projeto melhor atende às suas necessidades. @@ -25,8 +27,18 @@ Se você quer começar com um exemplo mais completo e do mundo real, você pode ### Grátis +- [GraphQL API and Relay Starter Kit](https://github.com/kriasoft/graphql-starter): + + - ![estrelas](https://img.shields.io/github/stars/kriasoft/graphql-starter.svg?style=social&label=Star) + - GraphQL API project using code-first design (TypeScript, OAuth, GraphQL.js, Knex, Cloud SQL) + - Web application project pre-configured with Webpack v5, TypeScript, React, Relay, Material UI + - Serverless deployment: `api` -> Cloud Functions, `web` -> Cloudflare Workers + - Client-side page routing/rendering at CDN edge locations, lazy loading + - Optimized for fast CI/CD builds and deployments using Yarn v2 monorepo design + - [React Most Wanted](https://github.com/TarikHuber/react-most-wanted): + - ![estrelas](https://img.shields.io/github/stars/TarikHuber/react-most-wanted.svg?style=social&label=Star) - Criado com o Create React App - Script customizado de Create React App para iniciar um novo projeto com somente um único comando CLI - Construído para Firebase incluindo autenticação usando a oficial Firebase Web Auth UI @@ -34,28 +46,31 @@ Se você quer começar com um exemplo mais completo e do mundo real, você pode - Todos os recursos PWA incluídos (SW, Notificações, prompt de instalação diferido e muito mais) - Desempenho otimizado e escalável (todos ~100 pontos em Lighthouse) -- [RMUIF](https://github.com/phoqe/rmuif): +- [React SaaS Template](https://github.com/dunky11/react-saas-template): - - Bootstrapped com Create React App, as mesmas ferramentas de trabalho de get-go - - Construído sobre o Firebase com todos os seus produtos para a web incluído - - Roteamento robusto com React Router, incluindo rotas protegidas e manipulação de erros - - Suporte móvel extensivo com diálogos de tela cheia e react-swipeable-views para abas - - Monitoramento de aplicativos entre plataformas com foco no relatório de erros com Sentry + - ![estrelas](https://img.shields.io/github/stars/dunky11/react-saas-template.svg?style=social&label=Star) + - Criado com o Create React App + - Apresentando uma página inicial, um blog, uma área para login/registro e um painel de administração + - Totalmente roteado usando react-router + - De forma tardia, carrega componentes para aumentar o desempenho + - Componentes para estatísticas, texto com suporte a emoji, upload de imagens e muito mais... - [Material Sense](https://github.com/alexanmtz/material-sense): + - ![estrelas](https://img.shields.io/github/stars/alexanmtz/material-sense.svg?style=social&label=Star) - Gráfico usando recharts - React Router incluído com um exemplo de navegação - Um contêiner docker com um servidor Nginx para compilação de produção - Criado com o Create React App -- [React SaaS Template](https://github.com/dunky11/react-saas-template): +- [RMUIF](https://github.com/phoqe/rmuif): - - Criado com o Create React App - - Apresentando uma página inicial, um blog, uma área para login/registro e um painel de administração - - Totalmente roteado usando react-router - - De forma tardia, carrega componentes para aumentar o desempenho - - Componentes para estatísticas, texto com suporte a emoji, upload de imagens e muito mais... + - ![estrelas](https://img.shields.io/github/stars/rmuif/web.svg?style=social&label=Star) + - Bootstrapped com Create React App, as mesmas ferramentas de trabalho de get-go + - Construído sobre o Firebase com todos os seus produtos para a web incluído + - Roteamento robusto com React Router, incluindo rotas protegidas e manipulação de erros + - Suporte móvel extensivo com diálogos de tela cheia e react-swipeable-views para abas + - Monitoramento de aplicativos entre plataformas com foco no relatório de erros com Sentry ### Pago @@ -67,3 +82,8 @@ Se você quer começar com um exemplo mais completo e do mundo real, você pode - Modele seu banco de dados e aplicativo com uma interface intuitiva - Gere sua aplicação, incluindo um scaffolded de backend completo - Pré-visualize seu aplicativo online, e baixe o código gerado + +- [Divjoy](https://divjoy.com?via=material-ui): + + - Create your Material-UI app in minutes. + - You'll get a nice template, authentication, database integration, subscription payments, and more. diff --git a/docs/src/pages/getting-started/example-projects/example-projects-ru.md b/docs/src/pages/getting-started/example-projects/example-projects-ru.md index 0f1ceff3d245af..7f42fdbfe51583 100644 --- a/docs/src/pages/getting-started/example-projects/example-projects-ru.md +++ b/docs/src/pages/getting-started/example-projects/example-projects-ru.md @@ -6,14 +6,16 @@ You can find some example projects in the [GitHub repository](https://github.com/mui-org/material-ui) under the [`/examples`](https://github.com/mui-org/material-ui/tree/master/examples) folder: +<!-- #default-branch-switch --> + +- https://github.com/mui-org/material-ui/tree/master/examples/nextjs - https://github.com/mui-org/material-ui/tree/master/examples/create-react-app - [Gatsby](https://github.com/mui-org/material-ui/tree/next/examples/gatsby) - [Gatsby Theme](https://github.com/mui-org/material-ui/tree/next/examples/gatsby-theme) -- https://github.com/mui-org/material-ui/tree/master/examples/nextjs - [Preact](https://github.com/mui-org/material-ui/tree/next/examples/preact) - [CDN](https://github.com/mui-org/material-ui/tree/next/examples/cdn) - [Plain server-side](https://github.com/mui-org/material-ui/tree/next/examples/ssr) -- [Используем styled-components в качестве движка стилей](https://github.com/mui-org/material-ui/tree/next/examples/create-react-app-with-styled-components) +- [Use styled-components as style engine](https://github.com/mui-org/material-ui/tree/next/examples/create-react-app-with-styled-components) ([TypeScript version](https://github.com/mui-org/material-ui/tree/next/examples/create-react-app-with-styled-components-typescript)) Create React App - отличный проект для изучения React. Посмотрите на [доступные альтернативы](https://github.com/facebook/create-react-app/blob/master/README.md#popular-alternatives) чтобы увидеть, какой проект лучше всего соответствует вашим потребностям. @@ -25,8 +27,18 @@ Create React App - отличный проект для изучения React. ### Free +- [GraphQL API and Relay Starter Kit](https://github.com/kriasoft/graphql-starter): + + - ![stars](https://img.shields.io/github/stars/kriasoft/graphql-starter.svg?style=social&label=Star) + - GraphQL API project using code-first design (TypeScript, OAuth, GraphQL.js, Knex, Cloud SQL) + - Web application project pre-configured with Webpack v5, TypeScript, React, Relay, Material UI + - Serverless deployment: `api` -> Cloud Functions, `web` -> Cloudflare Workers + - Client-side page routing/rendering at CDN edge locations, lazy loading + - Optimized for fast CI/CD builds and deployments using Yarn v2 monorepo design + - [React Most Wanted](https://github.com/TarikHuber/react-most-wanted): + - ![stars](https://img.shields.io/github/stars/TarikHuber/react-most-wanted.svg?style=social&label=Star) - Created with Create React App - Custom Create React App script to start a new project with just a single CLI command - Build for Firebase including Authentication using the official Firebase Web Auth UI @@ -34,28 +46,31 @@ Create React App - отличный проект для изучения React. - All PWA features included (SW, Notifications, deferred installation prompt and more) - Optimized and scalable performance (all ~100 points on Lighthouse) -- [RMUIF](https://github.com/phoqe/rmuif): +- [React SaaS Template](https://github.com/dunky11/react-saas-template): - - Bootstrapped with Create React App, the same tooling works from the get-go - - Built on top of Firebase with all their products for the web included - - Robust routing with React Router including protected routes and error handling - - Extensive mobile support with full-screen dialogs and react-swipeable-views for tabs - - Cross-platform application monitoring with a focus on error reporting with Sentry + - ![stars](https://img.shields.io/github/stars/dunky11/react-saas-template.svg?style=social&label=Star) + - Created with Create React App + - Features a landing page, a blog, an area to login/register and an admin-dashboard + - Fully routed using react-router + - Lazy loads components to boost performance + - Components for statistics, text with emoji support, image upload and much more... - [Material Sense](https://github.com/alexanmtz/material-sense): + - ![stars](https://img.shields.io/github/stars/alexanmtz/material-sense.svg?style=social&label=Star) - Graph using recharts - React Router включен с примером навигации - A docker container with an Nginx server for production build - Created with Create React App -- [React SaaS Template](https://github.com/dunky11/react-saas-template): +- [RMUIF](https://github.com/phoqe/rmuif): - - Created with Create React App - - Features a landing page, a blog, an area to login/register and an admin-dashboard - - Fully routed using react-router - - Lazy loads components to boost performance - - Components for statistics, text with emoji support, image upload and much more... + - ![stars](https://img.shields.io/github/stars/rmuif/web.svg?style=social&label=Star) + - Bootstrapped with Create React App, the same tooling works from the get-go + - Built on top of Firebase with all their products for the web included + - Robust routing with React Router including protected routes and error handling + - Extensive mobile support with full-screen dialogs and react-swipeable-views for tabs + - Cross-platform application monitoring with a focus on error reporting with Sentry ### Paid @@ -67,3 +82,8 @@ Create React App - отличный проект для изучения React. - Model your database and application with the intuitive GUI - Generate your application, including a complete scaffolded backend - Preview your application online, and download the generated code + +- [Divjoy](https://divjoy.com?via=material-ui): + + - Create your Material-UI app in minutes. + - You'll get a nice template, authentication, database integration, subscription payments, and more. diff --git a/docs/src/pages/getting-started/example-projects/example-projects-zh.md b/docs/src/pages/getting-started/example-projects/example-projects-zh.md index ed1821ba4efab0..caf08481bbb547 100644 --- a/docs/src/pages/getting-started/example-projects/example-projects-zh.md +++ b/docs/src/pages/getting-started/example-projects/example-projects-zh.md @@ -6,14 +6,16 @@ 您可以在 [GitHub 存储库](https://github.com/mui-org/material-ui)中的 [`/examples`](https://github.com/mui-org/material-ui/tree/master/examples) 文件夹下找到一些示例项目: +<!-- #default-branch-switch --> + +- [Next.js](https://github.com/mui-org/material-ui/tree/next/examples/nextjs) ([TypeScript 版本](https://github.com/mui-org/material-ui/tree/next/examples/nextjs-with-typescript)) - [Create React App](https://github.com/mui-org/material-ui/tree/next/examples/create-react-app) ([TypeScript 版本](https://github.com/mui-org/material-ui/tree/next/examples/create-react-app-with-typescript)) - [Gatsby](https://github.com/mui-org/material-ui/tree/next/examples/gatsby) - [Gatsby 主题](https://github.com/mui-org/material-ui/tree/next/examples/gatsby-theme) -- [Next.js](https://github.com/mui-org/material-ui/tree/next/examples/nextjs) ([TypeScript 版本](https://github.com/mui-org/material-ui/tree/next/examples/nextjs-with-typescript)) - [Preact](https://github.com/mui-org/material-ui/tree/next/examples/preact) - [CDN](https://github.com/mui-org/material-ui/tree/next/examples/cdn) - [朴素的服务端渲染](https://github.com/mui-org/material-ui/tree/next/examples/ssr) -- [使用 styled-components 来作为样式渲染引擎](https://github.com/mui-org/material-ui/tree/next/examples/create-react-app-with-styled-components) +- [Use styled-components as style engine](https://github.com/mui-org/material-ui/tree/next/examples/create-react-app-with-styled-components) ([TypeScript version](https://github.com/mui-org/material-ui/tree/next/examples/create-react-app-with-styled-components-typescript)) Create React App 是一个很棒的学习 React 的项目。 请看一下这些[可用的替代方案](https://github.com/facebook/create-react-app/blob/master/README.md#popular-alternatives) ,看看哪个项目最符合您的需求。 @@ -25,8 +27,18 @@ Create React App 是一个很棒的学习 React 的项目。 请看一下这些[ ### 免费的资源 +- [GraphQL API and Relay Starter Kit](https://github.com/kriasoft/graphql-starter): + + - ![stars](https://img.shields.io/github/stars/kriasoft/graphql-starter.svg?style=social&label=Star) + - GraphQL API project using code-first design (TypeScript, OAuth, GraphQL.js, Knex, Cloud SQL) + - Web application project pre-configured with Webpack v5, TypeScript, React, Relay, Material UI + - Serverless deployment: `api` -> Cloud Functions, `web` -> Cloudflare Workers + - Client-side page routing/rendering at CDN edge locations, lazy loading + - Optimized for fast CI/CD builds and deployments using Yarn v2 monorepo design + - [React 最常用到的](https://github.com/TarikHuber/react-most-wanted): + - ![stars](https://img.shields.io/github/stars/TarikHuber/react-most-wanted.svg?style=social&label=Star) - 使用 Create React App 创建 - 定制化的 Create React App 仅需单行 CLI 命令就能开始一个新项目 - 使用官方的 Firebase Web Auth UI 来构建 Firebase,并涵盖了身份验证 @@ -34,28 +46,31 @@ Create React App 是一个很棒的学习 React 的项目。 请看一下这些[ - 包含所有渐进式网页应用(PWA)的功能(SW 即 Service Worker, 通知,延迟安装的提示,以及更多) - 优化和可扩展的性能(在 Lighthouse 总共有大约100分) -- [RMUIF](https://github.com/phoqe/rmuif): +- [React SaaS 模板](https://github.com/dunky11/react-saas-template): - - 使用 Create React App 创建,也是可以开箱即用 - - 基于 Firebase 建成,并包括它所有网站上的产品 - - 使用 React Router 进行可靠的路由,包括了保护的路由和错误处理 - - 全面的移动支持,带有全屏对话框和 react-swipeable-views 的选项卡 - - 跨平台应用程序的的监测工作,主要是使用 Sentry 生成的错误报告 + - ![stars](https://img.shields.io/github/stars/dunky11/react-saas-template.svg?style=social&label=Star) + - 使用 Create React App 创建 + - 特征是一个登录页面,博客,一个登录和注册的区块,以及一个管理员控制界面 + - 完全使用 react-router 来路由 + - 延迟加载组件以提高性能 + - 一些显示统计数据、带有表情支持的文本、图片上传和更多内容的组件。。。 - [Material Sense](https://github.com/alexanmtz/material-sense): + - ![stars](https://img.shields.io/github/stars/alexanmtz/material-sense.svg?style=social&label=Star) - 使用 recharts 的图表 - 运用 React Router 的一个导航示例 - 一个在生产环境下使用的带有 Nginx 服务器的 docker container(docker 容器)。 - 使用 Create React App 创建 -- [React SaaS 模板](https://github.com/dunky11/react-saas-template): +- [RMUIF](https://github.com/phoqe/rmuif): - - 使用 Create React App 创建 - - 特征是一个登录页面,博客,一个登录和注册的区块,以及一个管理员控制界面 - - 完全使用 react-router 来路由 - - 延迟加载组件以提高性能 - - 一些显示统计数据、带有表情支持的文本、图片上传和更多内容的组件。。。 + - ![stars](https://img.shields.io/github/stars/rmuif/web.svg?style=social&label=Star) + - 使用 Create React App 创建,也是可以开箱即用 + - 基于 Firebase 建成,并包括它所有网站上的产品 + - 使用 React Router 进行可靠的路由,包括了保护的路由和错误处理 + - 全面的移动支持,带有全屏对话框和 react-swipeable-views 的选项卡 + - 跨平台应用程序的的监测工作,主要是使用 Sentry 生成的错误报告 ### 付费的资源 @@ -67,3 +82,8 @@ Create React App 是一个很棒的学习 React 的项目。 请看一下这些[ - 用直观的 GUI 模拟你的数据库和应用程序 - 生成您的应用程序,包括一个完整的 scaffolded 后台 - 在线预览您的应用程序,并下载生成的代码 + +- [Divjoy](https://divjoy.com?via=material-ui): + + - Create your Material-UI app in minutes. + - You'll get a nice template, authentication, database integration, subscription payments, and more. diff --git a/docs/src/pages/getting-started/faq/faq-de.md b/docs/src/pages/getting-started/faq/faq-de.md index d82d14427b178c..68ea61e2b4203c 100644 --- a/docs/src/pages/getting-started/faq/faq-de.md +++ b/docs/src/pages/getting-started/faq/faq-de.md @@ -47,11 +47,12 @@ Der Ripple-Effekt kommt ausschließlich von der `BaseButton` Komponente. Sie kö import { createTheme } from '@material-ui/core'; const theme = createTheme({ - props: { + components: { // Name of the component ⚛️ MuiButtonBase: { - // The properties to apply - disableRipple: true, // No more ripple, on the whole application 💣! + defaultProps: { + // The props to apply + disableRipple: true, // No more ripple, on the whole application 💣! }, }, }); @@ -66,7 +67,7 @@ import { createTheme } from '@material-ui/core'; const theme = createTheme({ transitions: { - // Jetzt haven wir überall `transition: none;` + // So we have `transition: none;` everywhere create: () => 'none', }, }); @@ -109,7 +110,7 @@ No, it's not required. But this dependency comes built in, so carries no additio Perhaps, however, you're adding some Material-UI components to an app that already uses another styling solution, or are already familiar with a different API, and don't want to learn a new one? In diesem Fall gehen Sie zum [Zusammenführen von Style Libraries](/guides/interoperability/) Abschnitt in dem wir zeigen, wie einfach es ist, Material-UI-Komponenten mit alternativen Stilbibliotheken umzustrukturieren. -## Wann verwende ich inline-style vs CSS? +## When should I use inline-style vs. CSS? Verwenden Sie als Faustregel Inline-Style nur für dynamische Stileigenschaften. Die CSS-Alternative bietet weitere Vorteile, z.B.: @@ -120,7 +121,7 @@ Verwenden Sie als Faustregel Inline-Style nur für dynamische Stileigenschaften. ## Wie verwende ich den react-router? -We detail the [integration with third-party routing libraries](/guides/composition/#routing-libraries) like react-router, Gatsby or Next.js in our guide. +We detail the [integration with third-party routing libraries](/guides/routing/) like react-router, Gatsby or Next.js in our guide. ## Wie kann ich auf das DOM-Element zugreifen? @@ -370,7 +371,10 @@ Aus diesem Grund benötigen wir eine Eigenschaft mit dem eigentlichen DOM-Knoten ```jsx function App() { const [container, setContainer] = React.useState(null); - const handleRef = React.useCallback(instance => setContainer(instance), [setContainer]) + const handleRef = React.useCallback( + (instance) => setContainer(instance), + [setContainer], + ); return ( <div className="App"> diff --git a/docs/src/pages/getting-started/faq/faq-es.md b/docs/src/pages/getting-started/faq/faq-es.md index ef0812f37733e4..f0cb2253ee9895 100644 --- a/docs/src/pages/getting-started/faq/faq-es.md +++ b/docs/src/pages/getting-started/faq/faq-es.md @@ -44,16 +44,15 @@ Scrolling is blocked as soon as a modal is opened. This prevents interacting wit The ripple effect is exclusively coming from the `BaseButton` component. You can disable the ripple effect globally by providing the following in your theme: ```js -module.exports = { - entry: { -+ vendor: ["@material-ui/styles"], - app1: "./src/app.1.js", - app2: "./src/app.2.js", - }, - plugins: [ -+ new webpack.optimize.CommonsChunkPlugin({ -+ name: "vendor", -+ minChunks: +import { createTheme } from '@material-ui/core'; + +const theme = createTheme({ + components: { + // Name of the component ⚛️ + MuiButtonBase: { + defaultProps: { + // The props to apply + disableRipple: true, // No more ripple, on the whole application 💣! Infinity, + }), ] @@ -69,7 +68,7 @@ import { createTheme } from '@material-ui/core'; const theme = createTheme({ transitions: { - // Então temos `transition: none;` everywhere + // So we have `transition: none;` everywhere create: () => 'none', }, }); @@ -112,7 +111,7 @@ No, it's not required. But this dependency comes built in, so carries no additio You can use `npm ls @material-ui/styles`, `yarn list @material-ui/styles` or `find -L ./node_modules | grep /@material-ui/styles/package.json` commands in your application folder. If you think that the issue may be in the duplication of the @material-ui/styles module somewhere in your dependencies, there are several ways to check this. -## When should I use inline-style vs CSS? +## When should I use inline-style vs. CSS? As a rule of thumb, only use inline-style for dynamic style properties. The CSS alternative provides more advantages, such as: @@ -123,7 +122,7 @@ As a rule of thumb, only use inline-style for dynamic style properties. The CSS ## ¿Cómo uso react-router? -We detail the [integration with third-party routing libraries](/guides/composition/#routing-libraries) like react-router, Gatsby or Next.js in our guide. +We detail the [integration with third-party routing libraries](/guides/routing/) like react-router, Gatsby or Next.js in our guide. ## ¿Cómo puedo acceder al elemento DOM? @@ -245,29 +244,17 @@ The styling solution relies on a cache, the *sheets manager*, to only inject the example of fix: ```diff +-// Create a sheets instance. -const sheets = new ServerStyleSheets(); function handleRender(req, res) { - + // Create a sheets instance. + const sheets = new ServerStyleSheets(); - //… const html = ReactDOMServer.renderToString( - -// Create a sheets instance. --const sheets = new ServerStyleSheets(); - -function handleRender(req, res) { - -+ // Create a sheets instance. - - + const sheets = new ServerStyleSheets(); - //… + + // Render the component to a string. const html = ReactDOMServer.renderToString( - const html = ReactDOMServer.renderToString( - const html = ReactDOMServer.renderToString( - const html = ReactDOMServer.renderToString( - -// Create a sheets instance. ``` ### React class name hydration mismatch @@ -297,14 +284,8 @@ function handleRender(req, res) { + // Create a new class name generator. - + const sheets = new ServerStyleSheets(); - - //… + // Render the component to a string. const html = ReactDOMServer.renderToString( - const html = ReactDOMServer.renderToString( - const html = ReactDOMServer.renderToString( - const html = ReactDOMServer.renderToString( - -// Create a sheets instance. ``` - You need to verify that your client and server are running the **exactly the same version** of Material-UI. It is possible that a mismatch of even minor versions can cause styling problems. To check version numbers, run `npm list @material-ui/core` in the environment where you build your application and also in your deployment environment. @@ -317,8 +298,8 @@ function handleRender(req, res) { "dependencies": { ... - "@material-ui/core": "^4.0.0", -+ "@material-ui/core": "4.0.0", - ... + + "@material-ui/core": "4.0.0", + ... }, ``` @@ -371,7 +352,10 @@ This is why we require a prop with the actual DOM node so that React can take ca ```jsx function App() { const [container, setContainer] = React.useState(null); - const handleRef = React.useCallback(instance => setContainer(instance), [setContainer]) + const handleRef = React.useCallback( + (instance) => setContainer(instance), + [setContainer], + ); return ( <div className="App"> diff --git a/docs/src/pages/getting-started/faq/faq-ja.md b/docs/src/pages/getting-started/faq/faq-ja.md index e60646d6f3fc4d..32025346c98279 100644 --- a/docs/src/pages/getting-started/faq/faq-ja.md +++ b/docs/src/pages/getting-started/faq/faq-ja.md @@ -9,26 +9,26 @@ If you still can't find what you're looking for, you can refer to our [support p Material-UIをサポートする方法はたくさんあります。 - **ライブラリを布教する** **ライブラリを布教する** **ライブラリを布教する** **ライブラリを布教する** **ライブラリを布教する** Evangelize Material-UI by [linking to material-ui.com](https://material-ui.com/) on your website, every backlink matters. Follow us on [Twitter](https://twitter.com/MaterialUI), like and retweet the important news. Or just talk about us with your friends. -- **Give us feedback**. Tell us what we're doing well or where we can improve. Please upvote (👍) the issues that you are the most interested in seeing solved. -- **Help new users**. You can answer questions on [StackOverflow](https://stackoverflow.com/questions/tagged/material-ui). -- **Make changes happen**. +- **フィードバックを送る** Tell us what we're doing well or where we can improve. Please upvote (👍) the issues that you are the most interested in seeing solved. +- **新規ユーザーを助ける** You can answer questions on [StackOverflow](https://stackoverflow.com/questions/tagged/material-ui). +- **変更を加える** - Edit the documentation. Every page has an "EDIT THIS PAGE" link in the top right. - Report bugs or missing features by [creating an issue](https://github.com/mui-org/material-ui/issues/new). - Review and comment on existing [pull requests](https://github.com/mui-org/material-ui/pulls) and [issues](https://github.com/mui-org/material-ui/issues). - Help [translate](https://translate.material-ui.com) the documentation. - - [Improve our documentation](https://github.com/mui-org/material-ui/tree/master/docs), fix bugs, or add features by [submitting a pull request](https://github.com/mui-org/material-ui/pulls). -- **Support us financially on [OpenCollective](https://opencollective.com/material-ui)**. If you use Material-UI in a commercial project and would like to support its continued development by becoming a Sponsor, or in a side or hobby project and would like to become a Backer, you can do so through OpenCollective. All funds donated are managed transparently, and Sponsors receive recognition in the README and on the Material-UI home page. + - [Pull Requestを出して](https://github.com/mui-org/material-ui/pulls)、[私たちのドキュメントを改善したり](https://github.com/mui-org/material-ui/tree/next/docs)、 バグを修正したり、新機能を追加したりしましょう。 +- **[OpenCollective](https://opencollective.com/material-ui)で資金的なサポートをする** If you use Material-UI in a commercial project and would like to support its continued development by becoming a Sponsor, or in a side or hobby project and would like to become a Backer, you can do so through OpenCollective. All funds donated are managed transparently, and Sponsors receive recognition in the README and on the Material-UI home page. ## productionビルドでコンポーネントが正しくレンダリングされないのはなぜですか? -Material-UIが機能するためには、`className`ページ上のすべてのコンポーネントの値は、[クラス名ジェネレータ](/styles/advanced/#class-names)の単一インスタンスによって生成される必要があります。 Material-UIが機能するためには、`className`ページ上のすべてのコンポーネントの値は、[クラス名ジェネレータ](/styles/advanced/#class-names)の単一インスタンスによって生成される必要があります。 Material-UIが機能するためには、`className`ページ上のすべてのコンポーネントの値は、[クラス名ジェネレータ](/styles/advanced/#class-names)の単一インスタンスによって生成される必要があります。 Material-UIが機能するためには、`className`ページ上のすべてのコンポーネントの値は、[クラス名ジェネレータ](/styles/advanced/#class-names)の単一インスタンスによって生成される必要があります。 Material-UIが機能するためには、`className`ページ上のすべてのコンポーネントの値は、[クラス名ジェネレータ](/styles/advanced/#class-names)の単一インスタンスによって生成される必要があります。 The #1 reason this likely happens is due to class name conflicts once your code is in a production bundle. +Material-UIが機能するためには、`className`ページ上のすべてのコンポーネントの値は、[クラス名ジェネレータ](/styles/advanced/#class-names)の単一インスタンスによって生成される必要があります。 Material-UIが機能するためには、`className`ページ上のすべてのコンポーネントの値は、[クラス名ジェネレータ](/styles/advanced/#class-names)の単一インスタンスによって生成される必要があります。 The #1 reason this likely happens is due to class name conflicts once your code is in a production bundle. To correct this issue, all components on the page need to be initialized such that there is only ever **one class name generator** among them. さまざまなシナリオで、誤って2つのクラス名ジェネレータを使用することになる事例 -- 誤ってMaterial-UIの2つのバージョンを**bundle**してしまっている場合、 依存関係がMaterial-UIを対の依存関係として正しく設定されていない可能性があります You can use `npm ls @material-ui/styles`, `yarn list @material-ui/styles` or `find -L ./node_modules | grep /@material-ui/styles/package.json` commands in your application folder. If you think that the issue may be in the duplication of the @material-ui/styles module somewhere in your dependencies, there are several ways to check this. --hoistフラグを指定してbootstrap option を実行してみてください。 -- You are using `StylesProvider` for a **subset** of your React tree. +- 誤って2つのバージョンのMaterial-UIを**バンドル**してしまっている場合。 If you think that the issue may be in the duplication of the @material-ui/styles module somewhere in your dependencies, there are several ways to check this. --hoistフラグを指定してbootstrap option を実行してみてください。 +- Reactツリーの**サブセット**に`StylesProvider`を使用している場合 - バンドラーを使用していて、それが原因で複数のクラス名ジェネレータインスタンスが作成されるようにコードを分割している場合。 > Webパックで[SplitChunksPlugin](https://webpack.js.org/plugins/split-chunks-plugin/)を使用している場合は、[`最適化`で`runtimeChunk`](https://webpack.js.org/configuration/optimization/#optimization-runtimechunk)設定を構成してみてください。 @@ -47,11 +47,12 @@ Material-UI uses the same theme helper for creating all its transitions. Therefo import { createTheme } from '@material-ui/core'; const theme = createTheme({ - props: { + components: { // Name of the component ⚛️ MuiButtonBase: { - // The properties to apply - disableRipple: true, // No more ripple, on the whole application 💣! + defaultProps: { + // The props to apply + disableRipple: true, // No more ripple, on the whole application 💣! }, }, }); @@ -107,9 +108,9 @@ Notice that the usage of `CssBaseline` is required for the above approach to wor いいえ、必須ではありません。 いいえ、必須ではありません。 But this dependency comes built in, so carries no additional bundle size overhead. いいえ、必須ではありません。 But this dependency comes built in, so carries no additional bundle size overhead. -その場合は、[スタイルライブラリの相互運用](/guides/interoperability/)セクションで、Material-UIコンポーネントを別のスタイルのライブラリでスタイル変更することがいかに簡単であるかを示します。 その場合は、[スタイルライブラリの相互運用](/guides/interoperability/)セクションで、Material-UIコンポーネントを別のスタイルのライブラリでスタイル変更することがいかに簡単であるかを示します。 その場合は、[スタイルライブラリの相互運用](/guides/interoperability/)セクションで、Material-UIコンポーネントを別のスタイルのライブラリでスタイル変更することがいかに簡単であるかを示します。 その場合は、[スタイルライブラリの相互運用](/guides/interoperability/)セクションで、Material-UIコンポーネントを別のスタイルのライブラリでスタイル変更することがいかに簡単であるかを示します。 その場合は、[スタイルライブラリの相互運用](/guides/interoperability/)セクションで、Material-UIコンポーネントを別のスタイルのライブラリでスタイル変更することがいかに簡単であるかを示します。 Perhaps, however, you're adding some Material-UI components to an app that already uses another styling solution, or are already familiar with a different API, and don't want to learn a new one? +その場合は、[スタイルライブラリの相互運用](/guides/interoperability/)セクションで、Material-UIコンポーネントを別のスタイルのライブラリでスタイル変更することがいかに簡単であるかを示します。 その場合は、[スタイルライブラリの相互運用](/guides/interoperability/)セクションで、Material-UIコンポーネントを別のスタイルのライブラリでスタイル変更することがいかに簡単であるかを示しています。 -## インラインスタイルとCSSのどちらを使用すべきか +## When should I use inline-style vs. CSS? 経験則として、動的styleプロパティにはinline-styleのみを使用してください。 CSSの代替手段は、次のようなより多くの利点を提供します。 @@ -120,7 +121,7 @@ Notice that the usage of `CssBaseline` is required for the above approach to wor ## react-routerの使い方は? -We detail the [integration with third-party routing libraries](/guides/composition/#routing-libraries) like react-router, Gatsby or Next.js in our guide. +We detail the [integration with third-party routing libraries](/guides/routing/) like react-router, Gatsby or Next.js in our guide. ## どうやってDOM要素にアクセスできますか? @@ -275,7 +276,7 @@ function handleRender(req, res) { #### 実行するアクション -クラス名の値は、[class name generator](/styles/advanced/#class-names)の概念に基づいています。 ページ全体を**単一のジェネレーターでレンダリングする必要があります** 。 このジェネレーターは、サーバーとクライアントで同じように動作する必要があります。 例えば: ページ全体を**単一のジェネレーターでレンダリングする必要があります** 。 このジェネレーターは、サーバーとクライアントで同じように動作する必要があります。 例えば: ページ全体を**単一のジェネレーターでレンダリングする必要があります** 。 このジェネレーターは、サーバーとクライアントで同じように動作する必要があります。 例えば: クラス名の値は、[class name generator](/styles/advanced/#class-names)の概念に基づいています。 このジェネレーターは、サーバーとクライアントで同じように動作する必要があります。 例えば: +クラス名の値は、[class name generator](/styles/advanced/#class-names)の概念に基づいています。 ページ全体を**単一のジェネレーターでレンダリングする必要があります** 。 このジェネレーターは、サーバーとクライアントで同じように動作する必要があります。 例えば: ページ全体を**単一のジェネレーターでレンダリングする必要があります** 。 このジェネレーターは、サーバーとクライアントで同じように動作する必要があります。 例えば: ページ全体を**単一のジェネレーターでレンダリングする必要があります** 。 このジェネレーターは、サーバーとクライアントで同じように動作する必要があります。 例えば: ページ全体を**単一のジェネレーターで**レンダリングする必要があります 。 このジェネレーターは、サーバーとクライアントで同じように動作する必要があります。 例えば: - 要求ごとに新しいクラス名ジェネレータを提供する必要があります。 しかし、異なるリクエスト間で`createGenerateClassName()`を共有すべきではありません。 要求ごとに新しいクラス名ジェネレータを提供する必要があります。 しかし、異なるリクエスト間で`createGenerateClassName()`を共有すべきではありません。 要求ごとに新しいクラス名ジェネレータを提供する必要があります。 しかし、異なるリクエスト間で`createGenerateClassName()`を共有すべきではありません。 要求ごとに新しいクラス名ジェネレータを提供する必要があります。 しかし、異なるリクエスト間で`createGenerateClassName()`を共有すべきではありません。 要求ごとに新しいクラス名ジェネレータを提供する必要があります。 しかし、異なるリクエスト間で`createGenerateClassName()`を共有すべきではありません。 要求ごとに新しいクラス名ジェネレータを提供する必要があります。 しかし、異なるリクエスト間で`createGenerateClassName()`を共有すべきではありません。 @@ -368,7 +369,10 @@ function Portal({ children, container }) { ```jsx function App() { const [container, setContainer] = React.useState(null); - const handleRef = React.useCallback(instance => setContainer(instance), [setContainer]) + const handleRef = React.useCallback( + (instance) => setContainer(instance), + [setContainer], + ); return ( <div className="App"> diff --git a/docs/src/pages/getting-started/faq/faq-pt.md b/docs/src/pages/getting-started/faq/faq-pt.md index b2d37084c90a4b..fe715587ddd85f 100644 --- a/docs/src/pages/getting-started/faq/faq-pt.md +++ b/docs/src/pages/getting-started/faq/faq-pt.md @@ -47,11 +47,12 @@ O efeito cascata é exclusivamente proveniente do componente `BaseButton`. Você import { createTheme } from '@material-ui/core'; const theme = createTheme({ - props: { - // Nome do componente ⚛️ + components: { + // Name of the component ⚛️ MuiButtonBase: { - // As propriedades para aplicar - disableRipple: true, // Sem efeito cascata, em toda aplicação 💣! + defaultProps: { + // The props to apply + disableRipple: true, // No more ripple, on the whole application 💣! }, }, }); @@ -66,7 +67,7 @@ import { createTheme } from '@material-ui/core'; const theme = createTheme({ transitions: { - // Então temos `transition: none;` em todo lugar + // So we have `transition: none;` everywhere create: () => 'none', }, }); @@ -109,7 +110,7 @@ Não, não é obrigatório. Mas essa dependência vem embutida, portanto, não s No entanto, talvez você esteja adicionando os componentes Material-UI para uma aplicação que já usa outra solução de estilos, ou, já esta familiarizado com uma API diferente e não quer aprender uma nova? Nesse caso, dirija-se à seção de [interoperabilidade da biblioteca de estilos](/guides/interoperability/), onde mostramos como é simples reestilizar os componentes do Material-UI com bibliotecas de estilos alternativas. -## Quando devo usar o estilo em linha vs CSS? +## When should I use inline-style vs. CSS? Como regra geral, use apenas o estilo em linha para propriedades de estilo dinâmicas. A alternativa de uso com CSS oferece mais vantagens, em: @@ -120,7 +121,7 @@ Como regra geral, use apenas o estilo em linha para propriedades de estilo dinâ ## Como usar react-router? -Detalhamos a [integração com bibliotecas de roteamento de terceiros](/guides/composition/#routing-libraries) como react-router, Gatsby ou Next.js em nosso guia. +Detalhamos a [integração com bibliotecas de roteamento de terceiros](/guides/routing/) como react-router, Gatsby ou Next.js em nosso guia. ## Como posso acessar o elemento DOM? @@ -349,7 +350,10 @@ Com esta simples heurística `Portal` pode renderizar novamente depois de montad ```jsx function App() { const [container, setContainer] = React.useState(null); - const handleRef = React.useCallback(instance => setContainer(instance), [setContainer]) + const handleRef = React.useCallback( + (instance) => setContainer(instance), + [setContainer], + ); return ( <div className="App"> diff --git a/docs/src/pages/getting-started/faq/faq-ru.md b/docs/src/pages/getting-started/faq/faq-ru.md index 1830c1d3ec943e..671d372bbcc3a4 100644 --- a/docs/src/pages/getting-started/faq/faq-ru.md +++ b/docs/src/pages/getting-started/faq/faq-ru.md @@ -47,11 +47,12 @@ The ripple effect is exclusively coming from the `BaseButton` component. You can import { createTheme } from '@material-ui/core'; const theme = createTheme({ - props: { + components: { // Name of the component ⚛️ MuiButtonBase: { - // The properties to apply - disableRipple: true, // No more ripple, on the whole application 💣! + defaultProps: { + // The props to apply + disableRipple: true, // No more ripple, on the whole application 💣! }, }, }); @@ -66,7 +67,7 @@ import { createTheme } from '@material-ui/core'; const theme = createTheme({ transitions: { - // Então temos `transition: none;` everywhere + // So we have `transition: none;` everywhere create: () => 'none', }, }); @@ -109,7 +110,7 @@ No, it's not required. But this dependency comes built in, so carries no additio You can use `npm ls @material-ui/styles`, `yarn list @material-ui/styles` or `find -L ./node_modules | grep /@material-ui/styles/package.json` commands in your application folder. If you think that the issue may be in the duplication of the @material-ui/styles module somewhere in your dependencies, there are several ways to check this. -## When should I use inline-style vs CSS? +## When should I use inline-style vs. CSS? As a rule of thumb, only use inline-style for dynamic style properties. The CSS alternative provides more advantages, such as: @@ -120,7 +121,7 @@ As a rule of thumb, only use inline-style for dynamic style properties. The CSS ## Как мне использовать react-router? -We detail the [integration with third-party routing libraries](/guides/composition/#routing-libraries) like react-router, Gatsby or Next.js in our guide. +We detail the [integration with third-party routing libraries](/guides/routing/) like react-router, Gatsby or Next.js in our guide. ## Как я могу получить доступ к элементу DOM? @@ -368,7 +369,10 @@ This is why we require a prop with the actual DOM node so that React can take ca ```jsx function App() { const [container, setContainer] = React.useState(null); - const handleRef = React.useCallback(instance => setContainer(instance), [setContainer]) + const handleRef = React.useCallback( + (instance) => setContainer(instance), + [setContainer], + ); return ( <div className="App"> diff --git a/docs/src/pages/getting-started/faq/faq-zh.md b/docs/src/pages/getting-started/faq/faq-zh.md index b5a18c8892104a..79657e9e7e4325 100644 --- a/docs/src/pages/getting-started/faq/faq-zh.md +++ b/docs/src/pages/getting-started/faq/faq-zh.md @@ -52,7 +52,7 @@ const theme = createTheme({ MuiButtonBase: { defaultProps: { // The props to apply - disableRipple: true, // 全局禁用波纹 💣! + disableRipple: true, // No more ripple, on the whole application 💣! }, }, }, @@ -68,7 +68,7 @@ import { createTheme } from '@material-ui/core'; const theme = createTheme({ transitions: { - // 这样就设定了全局的 `transition: none;` + // So we have `transition: none;` everywhere create: () => 'none', }, }); @@ -113,7 +113,7 @@ const theme = createTheme({ 然而,也许您正在给应用程序添加一些 Material-UI 组件,而应用程序以及使用了其他的样式解决方案,或者您已经熟悉了不同的 API,而不想学习一个新的 API? 在这种情况下,请访问 [样式库互用](/guides/interoperability/) 章节,在那你可以发现我们使用了一些替代样式库来重新设置 Material-UI 组件的样式,而这是多么的简单。 -## 内联样式与 CSS 之间我应该怎么选择使用的时机? +## When should I use inline-style vs. CSS? 根据经验,仅对动态样式属性使用内联样式。 CSS 的替代方案也有诸多优势,例如: @@ -124,7 +124,7 @@ const theme = createTheme({ ## 我应该怎么使用 react-router? -在我们的指南中详细介绍了如何与 react-router、Gatsby 或 Next.js 这样的 [第三方路由库](/guides/composition/#routing-libraries) 整合。 +在我们的指南中详细介绍了如何与 react-router、Gatsby 或 Next.js 这样的 [第三方路由库](/guides/routing/) 整合。 ## 我应该怎么访问 DOM 元素? @@ -352,14 +352,15 @@ function Portal({ children, container }) { ```jsx function App() { const [container, setContainer] = React.useState(null); - const handleRef = React.useCallback((instance) => setContainer(instance), [ - setContainer, - ]); + const handleRef = React.useCallback( + (instance) => setContainer(instance), + [setContainer], + ); return ( <div className="App"> <Portal container={container}> - <span>传送门</span> + <span>Portaled</span> </Portal> <div ref={handleRef} /> </div> diff --git a/docs/src/pages/getting-started/installation/installation-de.md b/docs/src/pages/getting-started/installation/installation-de.md index 87743bb13afca9..1bab37c54bf268 100644 --- a/docs/src/pages/getting-started/installation/installation-de.md +++ b/docs/src/pages/getting-started/installation/installation-de.md @@ -16,7 +16,21 @@ npm install @material-ui/core@next @emotion/react @emotion/styled yarn add @material-ui/core@next @emotion/react @emotion/styled ``` -Beachten Sie, dass [react](https://www.npmjs.com/package/react) >= 16.8.0 und [react-dom](https://www.npmjs.com/package/react-dom) >= 16.8.0 Abhängigkeiten in Ihrem Projekt sein müssen. +<!-- #react-peer-version --> + +Beachten Sie, dass [react](https://www.npmjs.com/package/react) >= 17.0.0 und [react-dom](https://www.npmjs.com/package/react-dom) >= 17.0.0 Abhängigkeiten in Ihrem Projekt sein müssen. + +Or if you want to use `styled-components` as a styling engine: + +```sh +// with npm +npm install @material-ui/core@next @material-ui/styled-engine-sc@next styled-components + +// with yarn +yarn add @material-ui/core@next @material-ui/styled-engine-sc@next styled-components +``` + +Take a look at the [Styled Engine guide](/guides/styled-engine/) for more information about how to configure `styled-components` as the style engine. ## Die Roboto Schrift @@ -28,7 +42,7 @@ Material-UI wurde mit Blick auf die [Roboto](https://fonts.google.com/specimen/R ## Schriftarten-Icons -Hier sind einige [Anweisungen](/components/icons/#font-icons) wie das geht. In order to use the font `Icon` component, you must first add the [Material icons](https://material.io/tools/icons/) font. Zum Beispiel über Google Web Fonts: +To use the font `Icon` component, you must first add the [Material icons](https://fonts.google.com/icons) font. In order to use the font `Icon` component, you must first add the [Material icons](https://material.io/tools/icons/) font. Zum Beispiel über Google Web Fonts: ```html <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" /> @@ -64,12 +78,12 @@ Sie können diesem [CDN-Beispiel](https://github.com/mui-org/material-ui/tree/ma ## Design-Ressourcen <a href="https://material-ui.com/store/items/figma-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-figma" style="margin-left: 8px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-figma.svg" alt="figma" /></a> -<a href="https://material-ui.com/store/items/sketch-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-sketch" style="margin-left: 32px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-sketch.svg" alt="sketch" /></a> <a href="https://material-ui.com/store/items/adobe-xd-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-adobe-xd" style="margin-left: 32px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-adobe-xd.svg" alt="adobe-xd" /></a> +<a href="https://material-ui.com/store/items/sketch-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-sketch" style="margin-left: 32px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-sketch.svg" alt="sketch" /></a> -Dies ist eine Sammlung von Drittanbieterprojekten, die Material-UI erweitern. +A set of reusable components for design tools is available, designed to match the React components and to help you craft great products: - [Figma](https://material-ui.com/store/items/figma-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-figma): A large UI kit with over 600 handcrafted Material-UI components. -- **Sketch**: [Sketch for Material-UI](https://material-ui.com/store/items/sketch-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-sketch) — A large UI kit with over 600 handcrafted Material-UI's symbols 💎. - [Adobe XD](https://material-ui.com/store/items/adobe-xd-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-adobe-xd): A large UI kit with over 600 handcrafted Material-UI components. +- **Sketch**: [Sketch for Material-UI](https://material-ui.com/store/items/sketch-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-sketch) — A large UI kit with over 600 handcrafted Material-UI's symbols 💎. - **Framer**: [Framer for Material-UI](https://packages.framer.com/package/material-ui/material-ui) — A small MIT UI kit preview of handcrafted Material-UI's component. diff --git a/docs/src/pages/getting-started/installation/installation-es.md b/docs/src/pages/getting-started/installation/installation-es.md index 44ef8c1ec63e8b..2cf440d5473136 100644 --- a/docs/src/pages/getting-started/installation/installation-es.md +++ b/docs/src/pages/getting-started/installation/installation-es.md @@ -16,7 +16,21 @@ npm install @material-ui/core@next @emotion/react @emotion/styled yarn add @material-ui/core@next @emotion/react @emotion/styled ``` -Ten en cuenta que [ react ](https://www.npmjs.com/package/react) > = 16.8.0 y [ react-dom ](https://www.npmjs.com/package/react-dom) > = 16.8.0 son dependencias tipo "peer". +<!-- #react-peer-version --> + +Ten en cuenta que [ react ](https://www.npmjs.com/package/react) > = 17.0.0 y [ react-dom ](https://www.npmjs.com/package/react-dom) > = 17.0.0 son dependencias tipo "peer". + +Or if you want to use `styled-components` as a styling engine: + +```sh +// with npm +npm install @material-ui/core@next @material-ui/styled-engine-sc@next styled-components + +// with yarn +yarn add @material-ui/core@next @material-ui/styled-engine-sc@next styled-components +``` + +Take a look at the [Styled Engine guide](/guides/styled-engine/) for more information about how to configure `styled-components` as the style engine. ## Fuente Roboto @@ -28,7 +42,7 @@ Material-UI fue diseñado con la fuente [ Roboto ](https://fonts.google.com/spec ## Fuente de Iconos -Aquí hay [ algunas instrucciones ](/components/icons/#font-icons) sobre cómo hacerlo. Aquí hay [ algunas instrucciones ](/components/icons/#font-icons) sobre cómo hacerlo. Por ejemplo, a través de Google Web Fonts: +To use the font `Icon` component, you must first add the [Material icons](https://fonts.google.com/icons) font. Here are [some instructions](/components/icons/#font-icons) on how to do so. Por ejemplo, a través de Google Web Fonts: ```html <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" /> @@ -64,12 +78,12 @@ Puedes seguir [ este ejemplo sobre CDN ](https://github.com/mui-org/material-ui/ ## Recursos de diseño <a href="https://material-ui.com/store/items/figma-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-figma" style="margin-left: 8px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-figma.svg" alt="figma" /></a> -<a href="https://material-ui.com/store/items/sketch-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-sketch" style="margin-left: 32px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-sketch.svg" alt="sketch" /></a> <a href="https://material-ui.com/store/items/adobe-xd-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-adobe-xd" style="margin-left: 32px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-adobe-xd.svg" alt="adobe-xd" /></a> +<a href="https://material-ui.com/store/items/sketch-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-sketch" style="margin-left: 32px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-sketch.svg" alt="sketch" /></a> -A set of reusable components for design tools is available, designed to match the React components, and to help you craft great products: +A set of reusable components for design tools is available, designed to match the React components and to help you craft great products: - [Figma](https://material-ui.com/store/items/figma-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-figma): A large UI kit with over 600 handcrafted Material-UI components. -- **Sketch**: [Sketch for Material-UI](https://material-ui.com/store/items/sketch-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-sketch) — A large UI kit with over 600 handcrafted Material-UI's symbols 💎. - [Adobe XD](https://material-ui.com/store/items/adobe-xd-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-adobe-xd): A large UI kit with over 600 handcrafted Material-UI components. +- **Sketch**: [Sketch for Material-UI](https://material-ui.com/store/items/sketch-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-sketch) — A large UI kit with over 600 handcrafted Material-UI's symbols 💎. - **Framer**: [Framer for Material-UI](https://packages.framer.com/package/material-ui/material-ui) — A small MIT UI kit preview of handcrafted Material-UI's component. diff --git a/docs/src/pages/getting-started/installation/installation-fr.md b/docs/src/pages/getting-started/installation/installation-fr.md index 2193a8f3a33688..d85fa83199836d 100644 --- a/docs/src/pages/getting-started/installation/installation-fr.md +++ b/docs/src/pages/getting-started/installation/installation-fr.md @@ -16,8 +16,18 @@ npm install @material-ui/core@next @emotion/react @emotion/styled yarn add @material-ui/core@next @emotion/react @emotion/styled ``` +<!-- #react-peer-version --> + Veuillez noter que [react](https://www.npmjs.com/package/react) >= 16.8.0 et [react-dom](https://www.npmjs.com/package/react-dom) >= 16.8.0 sont des dépendances. +Or if you want to use `styled-components` as a styling engine: + +```sh +<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" /> +``` + +Take a look at the [Styled Engine guide](/guides/styled-engine/) for more information about how to configure `styled-components` as the style engine. + ## La police Roboto Materiel-UI a été conçu avec la police [Roboto](https://fonts.google.com/specimen/Roboto) à l’esprit. Veillez donc à suivre [ces instructions](/components/typography/#general) . Par exemple, via Google Web Fonts: @@ -28,7 +38,7 @@ Materiel-UI a été conçu avec la police [Roboto](https://fonts.google.com/spec ## Polices d'icônes -Voici [quelques instructions](/components/icons/#font-icons) sur la façon de le faire. In order to use the font `Icon` component, you must first add the [Material icons](https://material.io/tools/icons/) font. Par exemple, via Google Web Fonts: +Materiel-UI a été conçu avec la police [Roboto](https://fonts.google.com/specimen/Roboto) à l’esprit. In order to use the font `Icon` component, you must first add the [Material icons](https://material.io/tools/icons/) font. Par exemple, via Google Web Fonts: ```html <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" /> @@ -64,12 +74,12 @@ Vous pouvez suivre [cet exemple CDN](https://github.com/mui-org/material-ui/tree ## Design resources <a href="https://material-ui.com/store/items/figma-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-figma" style="margin-left: 8px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-figma.svg" alt="figma" /></a> -<a href="https://material-ui.com/store/items/sketch-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-sketch" style="margin-left: 32px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-sketch.svg" alt="sketch" /></a> <a href="https://material-ui.com/store/items/adobe-xd-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-adobe-xd" style="margin-left: 32px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-adobe-xd.svg" alt="adobe-xd" /></a> +<a href="https://material-ui.com/store/items/sketch-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-sketch" style="margin-left: 32px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-sketch.svg" alt="sketch" /></a> A set of reusable components for design tools is available, designed to match the React components, and to help you craft great products: - [Figma](https://material-ui.com/store/items/figma-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-figma): A large UI kit with over 600 handcrafted Material-UI components. -- **Sketch**: [Sketch for Material-UI](https://material-ui.com/store/items/sketch-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-sketch) — A large UI kit with over 600 handcrafted Material-UI's symbols 💎. - [Adobe XD](https://material-ui.com/store/items/adobe-xd-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-adobe-xd): A large UI kit with over 600 handcrafted Material-UI components. +- **Sketch**: [Sketch for Material-UI](https://material-ui.com/store/items/sketch-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-sketch) — A large UI kit with over 600 handcrafted Material-UI's symbols 💎. - **Framer**: [Framer for Material-UI](https://packages.framer.com/package/material-ui/material-ui) — A small MIT UI kit preview of handcrafted Material-UI's component. diff --git a/docs/src/pages/getting-started/installation/installation-ja.md b/docs/src/pages/getting-started/installation/installation-ja.md index 6723ba21fe8ab3..547523848b0ddc 100644 --- a/docs/src/pages/getting-started/installation/installation-ja.md +++ b/docs/src/pages/getting-started/installation/installation-ja.md @@ -16,11 +16,25 @@ npm install @material-ui/core@next @emotion/react @emotion/styled yarn add @material-ui/core@next @emotion/react @emotion/styled ``` -[react](https://www.npmjs.com/package/react) >= 16.8.0 and [react-dom](https://www.npmjs.com/package/react-dom) >= 16.8.0が peer dependencies であることに注意してください。 +<!-- #react-peer-version --> + +[react](https://www.npmjs.com/package/react) >= 17.0.0 and [react-dom](https://www.npmjs.com/package/react-dom) >= 17.0.0が peer dependencies であることに注意してください。 + +Or if you want to use `styled-components` as a styling engine: + +```sh +// with npm +npm install @material-ui/core@next @material-ui/styled-engine-sc@next styled-components + +// with yarn +yarn add @material-ui/core@next @material-ui/styled-engine-sc@next styled-components +``` + +Take a look at the [Styled Engine guide](/guides/styled-engine/) for more information about how to configure `styled-components` as the style engine. ## Robotoフォント -Material-UIは[Roboto](https://fonts.google.com/specimen/Roboto)フォントを考慮して設計されています。 その為、必ず[以下の手順](/components/typography/#general) に従ってください。 たとえば、Google Web Fontsを用いて、 その為、必ず[以下の手順](/components/typography/#general) に従ってください。 たとえば、Google Web Fontsを用いて、 その為、必ず[以下の手順](/components/typography/#general) に従ってください。 たとえば、Google Web Fontsを用いて、 その為、必ず[以下の手順](/components/typography/#general) に従ってください。 たとえば、Google Web Fontsを用いて、 その為、必ず[以下の手順](/components/typography/#general) に従ってください。 たとえば、Google Web Fontsを用いて、 その為、必ず[以下の手順](/components/typography/#general) に従ってください。 たとえば、Google Web Fontsを用いて、 +Material-UIは[Roboto](https://fonts.google.com/specimen/Roboto)フォントを考慮して設計されています。 その為、必ず[以下の手順](/components/typography/#general) に従ってください。 たとえば、Google Web Fontsを用いて、 ```html <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" /> @@ -28,7 +42,7 @@ Material-UIは[Roboto](https://fonts.google.com/specimen/Roboto)フォントを ## フォントアイコン -In order to use the font `Icon` component, you must first add the [Material icons](https://material.io/tools/icons/) font. こちらは、その時の[手続き](/components/icons/#font-icons)です。 たとえば、Google Web Fontsを用いて、 +To use the font `Icon` component, you must first add the [Material icons](https://fonts.google.com/icons) font. こちらは、その[手順](/components/icons/#font-icons)です。 たとえば、Google Web Fontsを用いて、 ```html <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" /> @@ -50,26 +64,26 @@ yarn add @material-ui/icons プロトタイピングには最適な最小限のフロントエンド構造でMaterial-UIを使い始めることができます。 -Two Universal Module Definition (**UMD**) files are provided: +2つのユニバーサルモジュール定義 (**UMD**) ファイルが提供されています: - 開発用: https://unpkg.com/@material-ui/core@latest/umd/material-ui.development.js - 本番用: https://unpkg.com/@material-ui/core@latest/umd/material-ui.production.min.js [CDN example](https://github.com/mui-org/material-ui/tree/master/examples/cdn)に従うことで、すぐに開発を始めることができます。 -⚠️ Using this approach in **production** is **discouraged** though - the client has to download the entire library, regardless of which components are actually used, affecting performance and bandwidth utilization. +⚠️ただし、**本番環境**でこのアプローチを使用することは**推奨しません**。クライアントは、実際にどのコンポーネントが使用されているかにかかわらず、ライブラリ全体をダウンロードする必要があるため、パフォーマンスと帯域幅の使用率に影響を与えます。 -⚠️ UMDリンクは、ライブラリの最新バージョンを示すために`latest`タグを使用しています。 このポインターは**不安定です** 、新しいバージョンがリリースされると変わります。 ⚠️ UMDリンクは、ライブラリの最新バージョンを示すために`latest`タグを使用しています。 このポインターは**不安定です** 、新しいバージョンがリリースされると変わります。 You should consider pointing to a specific version, such as [v4.4.0](https://unpkg.com/@material-ui/core@4.4.0/umd/material-ui.development.js). このポインターは**不安定です** 、新しいバージョンがリリースされると変わります。 ⚠️ UMDリンクは、ライブラリの最新バージョンを示すために`latest`タグを使用しています。 このポインターは**不安定です** 、新しいバージョンがリリースされると変わります。 You should consider pointing to a specific version, such as [v4.4.0](https://unpkg.com/@material-ui/core@4.4.0/umd/material-ui.development.js). +⚠️ UMDリンクは、ライブラリの最新バージョンを示すために`latest`タグを使用しています。 このポインターは**不安定で** 、新しいバージョンがリリースされると変わります。 [v4.4.0](https://unpkg.com/@material-ui/core@4.4.0/umd/material-ui.development.js) のような特定のバージョンを指すことを考慮する必要があります。 ## Design resources <a href="https://material-ui.com/store/items/figma-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-figma" style="margin-left: 8px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-figma.svg" alt="figma" /></a> -<a href="https://material-ui.com/store/items/sketch-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-sketch" style="margin-left: 32px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-sketch.svg" alt="sketch" /></a> <a href="https://material-ui.com/store/items/adobe-xd-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-adobe-xd" style="margin-left: 32px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-adobe-xd.svg" alt="adobe-xd" /></a> +<a href="https://material-ui.com/store/items/sketch-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-sketch" style="margin-left: 32px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-sketch.svg" alt="sketch" /></a> -A set of reusable components for design tools is available, designed to match the React components, and to help you craft great products: +A set of reusable components for design tools is available, designed to match the React components and to help you craft great products: -- [Figma](https://material-ui.com/store/items/figma-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-figma): A large UI kit with over 600 handcrafted Material-UI components. -- **Sketch**: [Sketch for Material-UI](https://material-ui.com/store/items/sketch-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-sketch) — A large UI kit with over 600 handcrafted Material-UI's symbols 💎. -- [Adobe XD](https://material-ui.com/store/items/adobe-xd-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-adobe-xd): A large UI kit with over 600 handcrafted Material-UI components. +- [Figma](https://material-ui.com/store/items/figma-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-figma): 600個以上ものMaterial-UIコンポーネントを含んだ大規模なUIキット +- [Adobe XD](https://material-ui.com/store/items/adobe-xd-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-adobe-xd): 600を超えるMaterial-UIのコンポーネントを含んだ大規模なUIキット +- [Sketch](https://material-ui.com/store/items/sketch-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-sketch): 600を超えるMaterial-UIのシンボルを含んだUIキット - **Framer**: [Framer for Material-UI](https://packages.framer.com/package/material-ui/material-ui) — A small MIT UI kit preview of handcrafted Material-UI's component. diff --git a/docs/src/pages/getting-started/installation/installation-pt.md b/docs/src/pages/getting-started/installation/installation-pt.md index d264f37c5e909d..a1f775052bca3c 100644 --- a/docs/src/pages/getting-started/installation/installation-pt.md +++ b/docs/src/pages/getting-started/installation/installation-pt.md @@ -16,7 +16,21 @@ npm install @material-ui/core@next @emotion/react @emotion/styled yarn add @material-ui/core@next @emotion/react @emotion/styled ``` -Note que o pacote possui 2 dependências obrigatórias: [react](https://www.npmjs.com/package/react) >= 16.8.0 e [react-dom](https://www.npmjs.com/package/react-dom) >= 16.8.0. +<!-- #react-peer-version --> + +Note que o pacote possui 2 dependências obrigatórias: [react](https://www.npmjs.com/package/react) >= 17.0.0 e [react-dom](https://www.npmjs.com/package/react-dom) >= 17.0.0. + +Or if you want to use `styled-components` as a styling engine: + +```sh +// with npm +npm install @material-ui/core@next @material-ui/styled-engine-sc@next styled-components + +// with yarn +yarn add @material-ui/core@next @material-ui/styled-engine-sc@next styled-components +``` + +Take a look at the [Styled Engine guide](/guides/styled-engine/) for more information about how to configure `styled-components` as the style engine. ## Fonte Roboto @@ -28,7 +42,7 @@ O Material-UI foi desenvolvido com base na fonte [Roboto](https://fonts.google.c ## Ícones -Para utilizar o componente de fonte `Icon`, você deve primeiro adicionar a fonte [Material icons](https://material.io/tools/icons/). Aqui estão [ algumas instruções ](/components/icons/#font-icons) sobre como fazer isso. Como alternativa, carregue através do Google Web Fonts: +To use the font `Icon` component, you must first add the [Material icons](https://fonts.google.com/icons) font. Aqui estão [ algumas instruções ](/components/icons/#font-icons) sobre como fazer isso. Como alternativa, carregue através do Google Web Fonts: ```html <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" /> @@ -64,12 +78,12 @@ Você pode seguir [esse exemplo de CDN](https://github.com/mui-org/material-ui/t ## Recursos de design <a href="https://material-ui.com/store/items/figma-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-figma" style="margin-left: 8px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-figma.svg" alt="figma" /></a> -<a href="https://material-ui.com/store/items/sketch-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-sketch" style="margin-left: 32px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-sketch.svg" alt="sketch" /></a> <a href="https://material-ui.com/store/items/adobe-xd-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-adobe-xd" style="margin-left: 32px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-adobe-xd.svg" alt="adobe-xd" /></a> +<a href="https://material-ui.com/store/items/sketch-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-sketch" style="margin-left: 32px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-sketch.svg" alt="sketch" /></a> -Esta é uma coleção de projetos de terceiros que estendem Material-UI. +A set of reusable components for design tools is available, designed to match the React components and to help you craft great products: - [Figma](https://material-ui.com/store/items/figma-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-figma): A large UI kit with over 600 handcrafted Material-UI components. -- **Sketch**: [Sketch para Material-UI](https://material-ui.com/store/items/sketch-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-sketch) — Um kit de interface de usuário grande com mais de 600 símbolos de Material-UI trabalhados à mão 💎. - [Adobe XD](https://material-ui.com/store/items/adobe-xd-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-adobe-xd): A large UI kit with over 600 handcrafted Material-UI components. +- **Sketch**: [Sketch para Material-UI](https://material-ui.com/store/items/sketch-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-sketch) — Um kit de interface de usuário grande com mais de 600 símbolos de Material-UI trabalhados à mão 💎. - **Framer**: [Framer para Material-UI](https://packages.framer.com/package/material-ui/material-ui) — Um pequeno kit MIT de interface de usuário em preview, de componentes de Material-UI trabalhado a mão. diff --git a/docs/src/pages/getting-started/installation/installation-ru.md b/docs/src/pages/getting-started/installation/installation-ru.md index 5bcfa4abd9e860..f42987ee17e577 100644 --- a/docs/src/pages/getting-started/installation/installation-ru.md +++ b/docs/src/pages/getting-started/installation/installation-ru.md @@ -9,14 +9,28 @@ Material-UI доступен в виде пакета [ npm ](https://www.npmjs. Для установки и сохранения в вашем ` package.json ` зависимости, запустите: ```sh -// with npm +// для npm npm install @material-ui/core@next @emotion/react @emotion/styled -// with yarn +// для yarn yarn add @material-ui/core@next @emotion/react @emotion/styled ``` -Обратите внимание, что [react](https://www.npmjs.com/package/react) > = 16.8.0 и [react-dom](https://www.npmjs.com/package/react-dom) > = 16.8.0 являются одноранговыми зависимостями. +<!-- #react-peer-version --> + +Обратите внимание, что [react](https://www.npmjs.com/package/react) >= 17.0.0 и [react-dom](https://www.npmjs.com/package/react-dom) >= 17.0.0 взаимозависимы (peer dependencies). + +Or if you want to use `styled-components` as a styling engine: + +```sh +// with npm +npm install @material-ui/core@next @material-ui/styled-engine-sc@next styled-components + +// with yarn +yarn add @material-ui/core@next @material-ui/styled-engine-sc@next styled-components +``` + +Take a look at the [Styled Engine guide](/guides/styled-engine/) for more information about how to configure `styled-components` as the style engine. ## Шрифт Roboto @@ -28,7 +42,7 @@ Material-UI был разработан на основе шрифта [Roboto]( ## Иконочный шрифт -Вот [некоторые инструкции](/components/icons/#font-icons) как это сделать. Вот [некоторые инструкции](/components/icons/#font-icons) как это сделать. Например, через Google Web Fonts: +To use the font `Icon` component, you must first add the [Material icons](https://fonts.google.com/icons) font. Вот [некоторые инструкции](/components/icons/#font-icons) как это сделать. Например, через Google Web Fonts: ```html <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" /> @@ -57,19 +71,19 @@ yarn add @material-ui/icons Вы можете следовать [этому примеру CDN](https://github.com/mui-org/material-ui/tree/master/examples/cdn) для быстрого старта. -Использование этого подхода в **продакшене** **не рекомендуется** - клиент вынужден загружать целую библиотеку независимо от того, какие компоненты он реально использует. Это плохо влияет на производительность. +Использование этого подхода в **продакшене** **не рекомендуется** - клиент вынужден загружать целую библиотеку, независимо от того, какие компоненты фактически используются, что оказывает влияние на производительность и загруженность полосы пропускания. В ссылках на UMD-файлы используется тег `latest` для указания на последнюю версию библиотеки. Этот указатель **нестабильный**, он изменяется при появлении новых версий. Вы можете указывать конкретную версию, например, [v4.4.0](https://unpkg.com/@material-ui/core@4.4.0/umd/material-ui.development.js). ## Design resources <a href="https://material-ui.com/store/items/figma-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-figma" style="margin-left: 8px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-figma.svg" alt="figma" /></a> -<a href="https://material-ui.com/store/items/sketch-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-sketch" style="margin-left: 32px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-sketch.svg" alt="sketch" /></a> <a href="https://material-ui.com/store/items/adobe-xd-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-adobe-xd" style="margin-left: 32px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-adobe-xd.svg" alt="adobe-xd" /></a> +<a href="https://material-ui.com/store/items/sketch-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-sketch" style="margin-left: 32px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-sketch.svg" alt="sketch" /></a> -A set of reusable components for design tools is available, designed to match the React components, and to help you craft great products: +A set of reusable components for design tools is available, designed to match the React components and to help you craft great products: -- [Figma](https://material-ui.com/store/items/figma-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-figma): A large UI kit with over 600 handcrafted Material-UI components. -- **Sketch**: [Sketch for Material-UI](https://material-ui.com/store/items/sketch-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-sketch) — A large UI kit with over 600 handcrafted Material-UI's symbols 💎. -- [Adobe XD](https://material-ui.com/store/items/adobe-xd-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-adobe-xd): A large UI kit with over 600 handcrafted Material-UI components. +- [Figma](https://material-ui.com/store/items/figma-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-figma): Большой UI-набор из более чем 600 самодельных компонентов Material-UI. +- [Adobe XD](https://material-ui.com/store/items/adobe-xd-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-adobe-xd): Большой UI-набор из более чем 600 самодельных компонентов Material-UI. +- [Sketch](https://material-ui.com/store/items/sketch-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-sketch): Большой UI-набор из более чем 600 самодельных символов Material-UI. - **Framer**: [Framer for Material-UI](https://packages.framer.com/package/material-ui/material-ui) — A small MIT UI kit preview of handcrafted Material-UI's component. diff --git a/docs/src/pages/getting-started/installation/installation-zh.md b/docs/src/pages/getting-started/installation/installation-zh.md index fc4c7eb565e543..0cd2f61241fc43 100644 --- a/docs/src/pages/getting-started/installation/installation-zh.md +++ b/docs/src/pages/getting-started/installation/installation-zh.md @@ -16,7 +16,21 @@ npm install @material-ui/core@next @emotion/react @emotion/styled yarn add @material-ui/core@next @emotion/react @emotion/styled ``` -请注意,安装依赖于 [react](https://www.npmjs.com/package/react) 的 16.8.0 及以上版本,和 [react-dom](https://www.npmjs.com/package/react-dom) >= 16.8.0 及以上版本。 +<!-- #react-peer-version --> + +请注意,安装依赖于 [react](https://www.npmjs.com/package/react) 的 17.0.0 及以上版本,和 [react-dom](https://www.npmjs.com/package/react-dom) >= 17.0.0 及以上版本。 + +Or if you want to use `styled-components` as a styling engine: + +```sh +// with npm +npm install @material-ui/core@next @material-ui/styled-engine-sc@next styled-components + +// with yarn +yarn add @material-ui/core@next @material-ui/styled-engine-sc@next styled-components +``` + +Take a look at the [Styled Engine guide](/guides/styled-engine/) for more information about how to configure `styled-components` as the style engine. ## Roboto 字体 @@ -31,7 +45,7 @@ yarn add @material-ui/core@next @emotion/react @emotion/styled ## Font Icons 字体图标 -若您想使用 `Icon` 组件,前提条件是安装了 [Material icons](https://material.io/tools/icons/) 的字体。 我们提供了安装字体的[一些说明](/components/icons/#font-icons)。 例如,通过 Google Web Fonts 引入: +To use the font `Icon` component, you must first add the [Material icons](https://fonts.google.com/icons) font. 我们提供了安装字体的[一些说明](/components/icons/#font-icons)。 例如,通过 Google Web Fonts 引入: ```html <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" /> @@ -67,12 +81,12 @@ yarn add @material-ui/icons ## 设计资源 <a href="https://material-ui.com/store/items/figma-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-figma" style="margin-left: 8px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-figma.svg" alt="figma" /></a> -<a href="https://material-ui.com/store/items/sketch-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-sketch" style="margin-left: 32px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-sketch.svg" alt="sketch" /></a> <a href="https://material-ui.com/store/items/adobe-xd-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-adobe-xd" style="margin-left: 32px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-adobe-xd.svg" alt="adobe-xd" /></a> +<a href="https://material-ui.com/store/items/sketch-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-sketch" style="margin-left: 32px; margin-top: 8px; display: inline-block;"><img src="/static/images/download-sketch.svg" alt="sketch" /></a> -一套可重复使用的设计工具组件已经面世,这些工具是为了配合 React 组件而设计的,它们可以帮助你制作优秀的产品。 +A set of reusable components for design tools is available, designed to match the React components and to help you craft great products: - [Figma](https://material-ui.com/store/items/figma-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-figma):大型 UI 套件,包含 600 多个手工制作的 Material-UI 组件。 +- [Adobe XD](https://material-ui.com/store/items/adobe-xd-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-adobe-xd):大型 UI 套件,包含六百多个手工制作的 Material-UI 组件。 - [Sketch](https://material-ui.com/store/items/sketch-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-sketch):大型 UI 套件,包含 600 多个手工制作的 Material-UI 符号。 -- [Adobe XD](https://material-ui.com/store/items/adobe-xd-react/?utm_source=docs&utm_medium=referral&utm_campaign=installation-adobe-xd): A large UI kit with over 600 handcrafted Material-UI components. - [Framer](https://packages.framer.com/package/material-ui/material-ui):Material-UI 组件的小型 UI 套件 diff --git a/docs/src/pages/getting-started/installation/installation.md b/docs/src/pages/getting-started/installation/installation.md index ca468e6c89c8b6..0780398e4d9837 100644 --- a/docs/src/pages/getting-started/installation/installation.md +++ b/docs/src/pages/getting-started/installation/installation.md @@ -64,12 +64,14 @@ For instance, via Google Web Fonts: In order to use prebuilt SVG Material icons, such as those found in the [icons demos](/components/icons/) you must first install the [@material-ui/icons](https://www.npmjs.com/package/@material-ui/icons) package: +<!-- #default-branch-switch --> + ```sh // with npm -npm install @material-ui/icons +npm install @material-ui/icons@next // with yarn -yarn add @material-ui/icons +yarn add @material-ui/icons@next ``` ## CDN diff --git a/docs/src/pages/getting-started/learn/learn-de.md b/docs/src/pages/getting-started/learn/learn-de.md index c5fdaa076a227b..c3ea43ab1a10e6 100644 --- a/docs/src/pages/getting-started/learn/learn-de.md +++ b/docs/src/pages/getting-started/learn/learn-de.md @@ -52,5 +52,5 @@ Wenn Sie das erste Mal die Material-UI lernen, finden Sie möglicherweise Blogbe [![cookbook](/static/blog/material-ui-v4-is-out/cookbook.png)](https://www.amazon.com/gp/product/1789615224/) -- **Builder Book**: Learn how to build a full-stack JavaScript web application from scratch, using a Modern JavaScript stack and Material-UI. - - 📘 [ Das Buch ](https://builderbook.org/book) +- **Builder Book**: Learn how to build a full-stack JavaScript and SaaS web application from scratch, using a Modern JavaScript stack and Material-UI. + - 📘 [ Das Buch ](https://builderbook.org/) diff --git a/docs/src/pages/getting-started/learn/learn-es.md b/docs/src/pages/getting-started/learn/learn-es.md index 692322633706c0..894cc9534c52ec 100644 --- a/docs/src/pages/getting-started/learn/learn-es.md +++ b/docs/src/pages/getting-started/learn/learn-es.md @@ -52,5 +52,5 @@ Cuando comienzas a aprender Material-UI, puedes encontrar publicaciones en blogs [![cookbook](/static/blog/material-ui-v4-is-out/cookbook.png)](https://www.amazon.com/gp/product/1789615224/) -- **Builder Book**: Learn how to build a full-stack JavaScript web application from scratch, using a Modern JavaScript stack and Material-UI. - - https://builderbook.org/book +- **Builder Book**: Learn how to build a full-stack JavaScript and SaaS web application from scratch, using a Modern JavaScript stack and Material-UI. + - [El Libro](https://builderbook.org/) diff --git a/docs/src/pages/getting-started/learn/learn-fr.md b/docs/src/pages/getting-started/learn/learn-fr.md index 8dcb17e557d9a8..cf44d45cb649ec 100644 --- a/docs/src/pages/getting-started/learn/learn-fr.md +++ b/docs/src/pages/getting-started/learn/learn-fr.md @@ -2,13 +2,13 @@ <p class="description">Nouveau sur Material-UI ? C'est facile à apprendre si vous savez par où commencer ! Ce guide vous aidera à démarrer rapidement.</p> -Comme toute technologie inconnue, Material-UI a une courbe d'apprentissage. Whether you prefer a more theoretical or practical approach, we hope you'll find this section helpful. Developers come to Material-UI from different backgrounds and with different learning styles. Whether you prefer a more theoretical or practical approach, we hope you’ll find this section helpful. +Comme toute technologie inconnue, Material-UI a une courbe d'apprentissage. Que vous préfériez une approche plus théorique ou plus pratique, nous espérons que cette section vous sera utile. Developers come to Material-UI from different backgrounds and with different learning styles. Whether you prefer a more theoretical or practical approach, we hope you’ll find this section helpful. -## First example +## Premier exemple La page [d'utilisation](/getting-started/usage/#quick-start) contient un petit exemple Material-UI avec un éditeur en ligne. Even if you don't know anything about Material-UI yet, try changing the code and see how it affects the result. -## Example projects +## Exemples de projets Il y a [quelques exemples de projets](/getting-started/example-projects/) disponibles, fournissant l'infrastructure nécessaire pour développer et déployer des sites web dans React. @@ -22,9 +22,9 @@ Lors de la première utilisation de Material-UI, vous trouverez peut-être que l ### Gratuit -- **Introduction to Material-UI**: a series of videos covering all the important Material-UI components. +- **Introduction à Material-UI**: une série de vidéos couvrant tous les composants Material-UI importants. - 📹 [The videos](https://www.youtube.com/watch?v=pHclLuRolzE&list=PLQg6GaokU5CwiVmsZ0d_9Zsg_DnIP_xwr) -- **Customize Material-UI for your project**: a look at how you can customize Material-UI to align with your company identity (design system) and products +- **Personnaliser Material-UI pour votre projet**: un regard sur la façon dont vous pouvez personnaliser Material-UI pour aligner avec l'identité de votre entreprise (système de conception) et les produits - 📹 [The videos](https://www.youtube.com/watch?v=bDkB3LoQKxs) - **Meet Material-UI — your new favorite user interface library**: a blog post that guides you in building a Todo MVC while covering some important concepts of Material-UI. - 📝 [The blog post](https://medium.freecodecamp.org/meet-your-material-ui-your-new-favorite-user-interface-library-6349a1c88a8c) @@ -33,21 +33,21 @@ Lors de la première utilisation de Material-UI, vous trouverez peut-être que l - **Getting Started With Material-UI For React**: a blog post that guides you in building a simple card list. - 📝 [The blog post](https://medium.com/codingthesmartway-com-blog/getting-started-with-material-ui-for-react-material-design-for-react-364b2688b555) - 📹 [The video](https://www.youtube.com/watch?v=PWadEeOuv5o) -- **Elegant UX in React with Material-UI**: a blog post covering some important Material-UI concepts. +- **UX élégant en React avec Material-UI**: un article de blog couvrant quelques concepts importants de Material-UI. - 📝 [The blog post](https://alligator.io/react/material-ui/) ### Payant -- **Implement high fidelity designs**: Bridge the gap between Design & Development. Break down detailed designs and bring them to life with Material-UI and React. +- **Implémenter des conceptions de haute fidélité**: Passez le fossé entre Design & Développement. Décomposez les designs détaillés et donnez-leur vie avec Material-UI et React. - 💻 [The Course](https://click.linksynergy.com/deeplink?id=IVuPfk1F/Ow&mid=39197&murl=https%3A%2F%2Fwww.udemy.com%2Fcourse%2Fimplement-high-fidelity-designs-with-material-ui-and-reactjs%2F) -- **Apply Google Material Design**: This course teaches the fundamentals of Google Material Design and how to develop an end-to-end flight search and booking application using Material-UI and React. +- **Appliquer Google Material Design**: Ce cours enseigne les fondamentaux de Google Material Design et comment développer une application de recherche et de réservation de bout en bout en vol à l'aide de Material-UI et de React. - 📹 [Watch Course Trailer](https://www.youtube.com/watch?v=hhZ6yFvCWho) - 💻 [The Course](https://bonsaiilabs.com/courseDetail/material-ui-with-react) -- **Cookbook**: Build modern-day applications by implementing Material Design principles in React, using Material-UI. +- **Cookbook**: Construisez des applications modernes en implémentant les principes de conception de matériaux dans React, en utilisant Material-UI. - 📘 [The book](https://www.amazon.com/gp/product/1789615224/) [![cookbook](/static/blog/material-ui-v4-is-out/cookbook.png)](https://www.amazon.com/gp/product/1789615224/) diff --git a/docs/src/pages/getting-started/learn/learn-ja.md b/docs/src/pages/getting-started/learn/learn-ja.md index 0c6fd8ae2eeb2c..71439395e6c8b9 100644 --- a/docs/src/pages/getting-started/learn/learn-ja.md +++ b/docs/src/pages/getting-started/learn/learn-ja.md @@ -1,14 +1,14 @@ # Material-UIを学ぶ -<p class="description">Material-UIは初めてですか? 何から始めればいいのかは簡単に分かります。 このガイドを読めばすぐに開始できます。 何から始めればいいのかは簡単に分かります。 このガイドを読めばすぐに開始できます。</p> +<p class="description">Material-UIは初めてですか? 何から始めればいいのかを知っていれば、簡単に習得できますよ! このガイドを読めばすぐに開始できます。</p> -Developers come to Material-UI from different backgrounds and with different learning styles. Whether you prefer a more theoretical or practical approach, we hope you'll find this section helpful. 馴染みのないテクノロジーのようにMaterial-UIには学習曲線があります。 練習とある程度の忍耐力があれば、すぐに慣れると思います。 練習とある程度の忍耐力があれば、すぐに慣れると思います。 練習とある程度の忍耐力があれば、すぐに慣れると思います。 練習とある程度の忍耐力があれば、すぐに慣れると思います。 練習とある程度の忍耐力があれば、すぐに慣れると思います。 練習とある程度の忍耐力があれば、すぐに慣れると思います。 +Material-UIの開発者は、さまざまなバックグラウンドを持ち、さまざまな学習スタイルを持っています。 理論から入る人にとっても、理屈より実践を大切にする方にとっても、このセクションが役に立てれば幸いです。 馴染みのないテクノロジーのようにMaterial-UIには学習曲線があります。 練習とある程度の忍耐力があれば、すぐに慣れると思います。 -## First example +## 最初の例 -[使い方ページ](/getting-started/usage/#quick-start)ではMaterial-UIの小さな例とライブエディタがあります。 Material-UIについて何も知らなかったとしても、コードを書き換えてどのように作用するか確認してみてください。 Material-UIについて何も知らなかったとしても、コードを書き換えてどのように作用するか確認してみてください。 Material-UIについて何も知らなかったとしても、コードを書き換えてどのように作用するか確認してみてください。 Even if you don't know anything about Material-UI yet, try changing the code and see how it affects the result. +[使い方ページ](/getting-started/usage/#quick-start)ではMaterial-UIの小さな例とライブエディタがあります。 Material-UIについてまだよくわからないかもしれませんが、コードをいじってみて、それが見た目にどのように作用するのか確認してみましょう。 -## Example projects +## サンプルプロジェクト ReactでWebサイトを開発してデプロイする為に必要なインフラを提供する[いくつかのサンプルプロジェクト](/getting-started/example-projects/)があります。 @@ -18,22 +18,22 @@ ReactでWebサイトを開発してデプロイする為に必要なインフラ ## 推奨する資料 -Material-UIを初めて学ぶときは、公式のドキュメントよりもサードパーティのブログ記事や本、動画のコースの方が役に立つかもしれません。 以下はオススメの資料です。中には無料で利用できるものもあります。 以下はオススメの資料です。中には無料で利用できるものもあります。 以下はオススメの資料です。中には無料で利用できるものもあります。 以下はオススメの資料です。中には無料で利用できるものもあります。 +Material-UIを初めて学ぶときは、公式のドキュメントよりもサードパーティのブログ記事や本、動画のコースの方が役に立つかもしれません。 以下はオススメの資料です。中には無料で利用できるものもあります。 ### Gratuit -- **Introduction to Material-UI**: a series of videos covering all the important Material-UI components. +- **Introduction to Material-UI**: Material-UIの重要なコンポーネント全体を網羅した動画シリーズです。 - 📹 [動画](https://www.youtube.com/watch?v=pHclLuRolzE&list=PLQg6GaokU5CwiVmsZ0d_9Zsg_DnIP_xwr) -- **Meet Material-UI—あなたのお気に入りの新しいユーザインタフェースライブラリ**: Material-UIのいくつかの重要な概念をカバーしながら、Todo MVCの構築を案内するブログ投稿。 +- **Customize Material-UI for your project**: 自社のアイデンティティ(デザインシステム)や製品に合わせてMaterial-UIをカスタマイズする方法を紹介しています。 - 📹 [動画](https://www.youtube.com/watch?v=bDkB3LoQKxs) -- **Learn React & Material-UI**: Material-UIの重要なコンポーネントの全てをカバーするシリーズの動画です。 +- **Meet Material-UI — your new favorite user interface library**: Material-UIの重要な概念をカバーしながら、TodoアプリをMVCで構築する方法を解説したブログ投稿です。 - 📝 [ブログ記事](https://medium.freecodecamp.org/meet-your-material-ui-your-new-favorite-user-interface-library-6349a1c88a8c) -- **Getting Started With Material-UI For React**: シンプルなカードのリストの構築の手引きとなるブログ記事です。 +- **Learn React & Material-UI**: Material-UIの重要なコンポーネント全体を網羅した動画シリーズです。 - 📹 [動画](https://www.youtube.com/watch?v=xm4LX5fJKZ8&list=PLcCp4mjO-z98WAu4sd0eVha1g-NMfzHZk) - **Getting Started With Material-UI For React**: 単純なカードリストの作成方法を説明しているブログ投稿です。 - 📝 [The blog post](https://medium.com/codingthesmartway-com-blog/getting-started-with-material-ui-for-react-material-design-for-react-364b2688b555) - 📹 [The video](https://www.youtube.com/watch?v=PWadEeOuv5o) -- 📝 [ブログ記事](https://alligator.io/react/material-ui/) +- **Elegant UX in React with Material-UI**: いくつかのMaterial-UIの重要な概念をカバーしたブログ投稿です。 - 📝 [ブログ記事](https://alligator.io/react/material-ui/) ### 有料 @@ -52,5 +52,5 @@ Material-UIを初めて学ぶときは、公式のドキュメントよりもサ [![cookbook](/static/blog/material-ui-v4-is-out/cookbook.png)](https://www.amazon.com/gp/product/1789615224/) -- **Builder Book**: Modern JavaScriptスタックとMaterial-UIを使用して、フルスタックのJavaScript Webアプリケーションを最初から構築する方法を説明します。 - - 📘 [書籍](https://builderbook.org/book) +- **Builder Book**: Learn how to build a full-stack JavaScript and SaaS web application from scratch, using a Modern JavaScript stack and Material-UI. + - 📘 [書籍](https://builderbook.org/) diff --git a/docs/src/pages/getting-started/learn/learn-pt.md b/docs/src/pages/getting-started/learn/learn-pt.md index 9e51f49bae1f04..4b598835974abf 100644 --- a/docs/src/pages/getting-started/learn/learn-pt.md +++ b/docs/src/pages/getting-started/learn/learn-pt.md @@ -52,5 +52,5 @@ Ao começar a aprender o Material-UI, você pode encontrar postagens de blogs de [![cookbook](/static/blog/material-ui-v4-is-out/cookbook.png)](https://www.amazon.com/gp/product/1789615224/) -- **Builder Book**: Aprenda como criar um aplicativo web totalmente com JavaScript a partir do zero, usando uma stack moderna de JavaScript e Material-UI. - - 📘 [The book](https://builderbook.org/book) +- **Builder Book**: Learn how to build a full-stack JavaScript and SaaS web application from scratch, using a Modern JavaScript stack and Material-UI. + - 📘 [O livro](https://builderbook.org/) diff --git a/docs/src/pages/getting-started/learn/learn-ru.md b/docs/src/pages/getting-started/learn/learn-ru.md index d907a43566865c..3beee4fe2c3224 100644 --- a/docs/src/pages/getting-started/learn/learn-ru.md +++ b/docs/src/pages/getting-started/learn/learn-ru.md @@ -52,5 +52,5 @@ [![cookbook](/static/blog/material-ui-v4-is-out/cookbook.png)](https://www.amazon.com/gp/product/1789615224/) -- **Builder Book**: Learn how to build a full-stack JavaScript web application from scratch, using a Modern JavaScript stack and Material-UI. - - 📘 [The book](https://builderbook.org/book) +- **Builder Book**: Learn how to build a full-stack JavaScript and SaaS web application from scratch, using a Modern JavaScript stack and Material-UI. + - 📘 [The book](https://builderbook.org/) diff --git a/docs/src/pages/getting-started/learn/learn-zh.md b/docs/src/pages/getting-started/learn/learn-zh.md index 00c7409946a48d..78bbdb0d426142 100644 --- a/docs/src/pages/getting-started/learn/learn-zh.md +++ b/docs/src/pages/getting-started/learn/learn-zh.md @@ -52,5 +52,5 @@ [![参考手册](/static/blog/material-ui-v4-is-out/cookbook.png)](https://www.amazon.com/gp/product/1789615224/) -- **Builder Book**:学习如何使用 Modern JavaScript 堆栈和 Material-UI 来从头开始创建一个全栈 JavaScript Web 应用程序。 - - 📘 [The book](https://builderbook.org/book) +- **Builder Book**: Learn how to build a full-stack JavaScript and SaaS web application from scratch, using a Modern JavaScript stack and Material-UI. + - 📘 [书](https://builderbook.org/) diff --git a/docs/src/pages/getting-started/support/support-ja.md b/docs/src/pages/getting-started/support/support-ja.md index 24e0e83c9943eb..c13d4a2a9026c2 100644 --- a/docs/src/pages/getting-started/support/support-ja.md +++ b/docs/src/pages/getting-started/support/support-ja.md @@ -14,7 +14,7 @@ For crowdsourced technical questions from expert Material-UI devs in our communi ### GitHub<img src="/static/images/logos/github.svg" width="24" height="24" alt="GitHub logo" loading="lazy" /> -We use GitHub issues exclusively as a bugs and feature requests tracker. バグや機能要求の目的でのみGitHubのIssueを使用しています。 バグを発見したと思われる場合、または新しく追加して欲しい機能を提案したい場合。 [これまでに同様な点が報告されていないか](https://github.com/mui-org/material-ui/issues?utf8=%E2%9C%93&q=is%3Aopen+is%3Aclosed)修正されていないか確認してください。 既存の課題やプルリクエストを検索して、誰かが自分に似たようなものを報告しているかどうかを確認できます。 既存の課題やプルリクエストを検索して、誰かが自分に似たようなものを報告しているかどうかを確認できます。 +バグや機能要求の目的でのみGitHubのIssueを使用しています。 バグや機能要求の目的でのみGitHubのIssueを使用しています。 バグを発見したと思われる場合、または新しく追加して欲しい機能を提案したい場合。 [これまでに同様な点が報告されていないか](https://github.com/mui-org/material-ui/issues?utf8=%E2%9C%93&q=is%3Aopen+is%3Aclosed)修正されていないか確認してください。 既存の課題やプルリクエストを検索して、誰かが自分に似たようなものを報告しているかどうかを確認できます。 既存の課題やプルリクエストを検索して、誰かが自分に似たようなものを報告しているかどうかを確認できます。 [Issueを開く](https://github.com/mui-org/material-ui/issues/new/choose) @@ -35,7 +35,7 @@ We use GitHub issues exclusively as a bugs and feature requests tracker. バグ ### 参考資料 📖 -Material-UIは初めてですか? 何から始めればいいのかは簡単に分かります。 このガイドを読めばすぐに開始できます。 何から始めればいいのかは簡単に分かります。 +Material-UIは初めてですか? 何から始めればいいのかを知っていれば、簡単に習得できますよ! [Material-UIを学ぶ](/getting-started/learn/) @@ -47,15 +47,15 @@ Material-UIの最新ニュースを受け取る ### サポートされているバージョン -Material-UI CE (Community Edition) は、最初から100%オープンソース (MITライセンス) であり、常にそうです。 Developers can ensure Material-UI is the right choice for their React applications through Material-UI’s community maintenance strategy. Material-UI CE (Community Edition) は、最初から100%オープンソース (MITライセンス) であり、常にそうです。 The Material-UI team regularly ships new releases, bug fixes, and is very welcoming to community pull requests. +Material-UI CE (Community Edition) は、最初から100%オープンソース (MITライセンス) であり、常にそうです。 Developers can ensure Material-UI is the right choice for their React applications through Material-UI’s community maintenance strategy. 開発者は、Material-UIのコミュニティメンテナンス方針を通して、Material-UIがReactアプリケーションに最適な選択肢であることを保証できます。 The Material-UI team regularly ships new releases, bug fixes, and is very welcoming to community pull requests. Given the reality of time and resource constraints, as well as the desire to keep innovating, over time it becomes necessary to shift focus to newer versions of the framework ([our release schedule](https://material-ui.com/versions/#release-frequency)), while making the transition to newer versions as smooth as possible, including publishing migration guides such as [this one for v4](/guides/migration-v3/). The open-source community is always welcome to submit new features and bug fixes as well. The current status of each Material-UI version is as follows: -- Material-UI v4 (hooks): ✅ In active development. +- Material-UI v5 (emotion): ✅ 開発継続中 - Material-UI v3 (change supported browsers): ⚠️ Only handle security fixes. -- Material-UI v3 (change supported browsers): ❌ Inactive. +- Material-UI v3 (change supported browsers): ❌ 開発終了 - ~Material-UI v2 (never existed)~. - Material-UI v1 (rewrite): ❌ Inactive. - Material-UI v0.x: ❌ Inactive. diff --git a/docs/src/pages/getting-started/support/support-ru.md b/docs/src/pages/getting-started/support/support-ru.md index c45998ca16a1d5..46673d82a65d18 100644 --- a/docs/src/pages/getting-started/support/support-ru.md +++ b/docs/src/pages/getting-started/support/support-ru.md @@ -1,4 +1,4 @@ -# Support +# Поддержка <p class="description">From community help to premium critical business support, we're here to help.</p> diff --git a/docs/src/pages/getting-started/supported-components/supported-components-de.md b/docs/src/pages/getting-started/supported-components/supported-components-de.md index 9be4562e62b571..ee3602537dd174 100644 --- a/docs/src/pages/getting-started/supported-components/supported-components-de.md +++ b/docs/src/pages/getting-started/supported-components/supported-components-de.md @@ -45,7 +45,7 @@ Wenn Sie Unterstützung für eine Komponente oder ein Feature hinzufügen möcht - **[Inset](https://material.io/design/components/dividers.html#types) ✓** - **[Inset](https://material.io/design/components/dividers.html#types) ✓** - **[Listas de Imagem](https://material.io/design/components/image-lists.html) ✓** (também conhecido como Grade Lista)******** -- ****[Listas de Imagem](https://material.io/design/components/image-lists.html) ✓** (também conhecido como Grade Lista)****** +- ****[Listas de Imagem](https://material.io/design/components/image-lists.html) ✓** (também conhecido como Grade Lista)********** - [Types:](https://material.io/design/components/lists.html#types) - **Single line ✓** - **Two line ✓** @@ -58,7 +58,7 @@ Wenn Sie Unterstützung für eine Komponente oder ein Feature hinzufügen möcht - **Expand/collapse ✓** (bzw. Verschachtelt) - **Switch ✓** - Reorder -- **[Progress indicators](https://material.io/design/components/progress-indicators.html) ✓** +- ******** [ Toolbars](https://material.io/archive/guidelines/components/toolbars.html) ✓**(Veraltetes Material v1)****** - **[Dropdown menu](https://material.io/design/components/menus.html#dropdown-menu) ✓** (Can be composed) - [Cascade](https://material.io/design/components/menus.html#dropdown-menu) - [Exposed dropdown menus](https://material.io/design/components/menus.html#exposed-dropdown-menu) @@ -85,7 +85,7 @@ Wenn Sie Unterstützung für eine Komponente oder ein Feature hinzufügen möcht - **[Fixed tabs](https://material.io/design/components/tabs.html#fixed-tabs) ✓** - **[Scrollable tabs](https://material.io/design/components/tabs.html#scrollable-tabs) ✓** - **[Mobile steps](https://material.io/archive/guidelines/components/steppers.html#steppers-types-of-steps) ✓** -- ****** [ Toolbars](https://material.io/archive/guidelines/components/toolbars.html) ✓**(Veraltetes Material v1)**** +- ******** [ Toolbars](https://material.io/archive/guidelines/components/toolbars.html) ✓**(Veraltetes Material v1)****** - **[Tooltips](https://material.io/design/components/tooltips.html) ✓** - **[Filled](https://material.io/design/components/text-fields.html#filled-text-field) ✓** - **[Outline](https://material.io/design/components/text-fields.html#outlined-text-field) ✓** diff --git a/docs/src/pages/getting-started/supported-components/supported-components-es.md b/docs/src/pages/getting-started/supported-components/supported-components-es.md index 558bb22569289f..dbf138c7951c85 100644 --- a/docs/src/pages/getting-started/supported-components/supported-components-es.md +++ b/docs/src/pages/getting-started/supported-components/supported-components-es.md @@ -44,7 +44,7 @@ If you wish to add support for a component or feature not highlighted here, plea - **[Inset](https://material.io/design/components/dividers.html#types) ✓** - **[Inset](https://material.io/design/components/dividers.html#types) ✓** - **[Inset](https://material.io/design/components/dividers.html#types) ✓** -- ****[Listas de Imagem](https://material.io/design/components/image-lists.html) ✓** (também conhecido como Grade Lista)****** +- **[Listas de Imagem](https://material.io/design/components/image-lists.html) ✓** (também conhecido como Grade Lista)******** - **[Menus](https://material.io/design/components/menus.html) ✓** - [Types:](https://material.io/design/components/lists.html#types) - **Single line ✓** diff --git a/docs/src/pages/getting-started/supported-components/supported-components-fr.md b/docs/src/pages/getting-started/supported-components/supported-components-fr.md index f0024383ec6dd3..9c9f81a7855dee 100644 --- a/docs/src/pages/getting-started/supported-components/supported-components-fr.md +++ b/docs/src/pages/getting-started/supported-components/supported-components-fr.md @@ -45,7 +45,7 @@ If you wish to add support for a component or feature not highlighted here, plea - **[Inset](https://material.io/design/components/dividers.html#types) ✓** - **[Inset](https://material.io/design/components/dividers.html#types) ✓** - **[Image lists](https://material.io/design/components/image-lists.html) ✓** (AKA Grid Lists)******** -- ****[Image lists](https://material.io/design/components/image-lists.html) ✓** (AKA Grid Lists)****** +- ****[Image lists](https://material.io/design/components/image-lists.html) ✓** (AKA Grid Lists)********** - [Types:](https://material.io/design/components/lists.html#types) - **Single line ✓** - **Two line ✓** @@ -58,7 +58,7 @@ If you wish to add support for a component or feature not highlighted here, plea - **Expand/collapse ✓** (AKA Nested) - **Switch ✓** - Reorder -- **[Progress indicators](https://material.io/design/components/progress-indicators.html) ✓** +- ****[Image lists](https://material.io/design/components/image-lists.html) ✓** (AKA Grid Lists)********** - **[Dropdown menu](https://material.io/design/components/menus.html#dropdown-menu) ✓** (Can be composed) - [Cascade](https://material.io/design/components/menus.html#dropdown-menu) - [Exposed dropdown menus](https://material.io/design/components/menus.html#exposed-dropdown-menu) diff --git a/docs/src/pages/getting-started/supported-components/supported-components-ja.md b/docs/src/pages/getting-started/supported-components/supported-components-ja.md index aa2973ae4ec31f..680a7408362c29 100644 --- a/docs/src/pages/getting-started/supported-components/supported-components-ja.md +++ b/docs/src/pages/getting-started/supported-components/supported-components-ja.md @@ -1,12 +1,12 @@ # サポートされているコンポーネント -<p class="description">以下は、Material Designコンポーネントと機能のリストです。 Material-UIで現在サポートされているものは✓が表示されています。 Material-UIで現在サポートされているものは✓が表示されています。 Material-UIで現在サポートされているものは✓が表示されています。 Material-UIで現在サポートされているものは✓が表示されています。</p> +<p class="description">以下は、Material Designコンポーネントと機能のリストです。 Material-UIで現在サポートされているものは✓が表示されています。</p> While we strive to follow the guidelines where practical (applying common sense where guidelines contradict - a more common occurrence than one might expect), we do not expect to support every component, nor every feature of every component, but rather to provide the building blocks to allow developers to create compelling user interfaces and experiences. ここで強調表示されていないコンポーネントまたは機能のサポートを追加したい場合は、関連する[GitHub Issue](https://github.com/mui-org/material-ui/issues)を探す、または、プルリクエストを送信する前にアプローチを議論するための新しいIssueを作成してください。 -- **[Painéis de Expansão](https://material.io/archive/guidelines/components/expansion-panels.html) ✓** (*Legado Material v1*) +- **[Accordion](https://material.io/archive/guidelines/components/expansion-panels.html) ✓** (_Legacy Material v1_) - App bars - **[Top](https://material.io/design/components/app-bars-top.html) ✓** - **[Bottom](https://material.io/design/components/app-bars-bottom.html) ✓** @@ -17,7 +17,7 @@ While we strive to follow the guidelines where practical (applying common sense - **[Toggle buttons](https://material.io/design/components/buttons.html#buttons-toggle-buttons) ~** ([Lab](/components/about-the-lab/)) - **[Icon toggle buttons](https://material.io/design/components/buttons.html#toggle-button) ✓** (Custom Checkbox) - **[Cards](https://material.io/design/components/cards.html) ✓** - - Transições: + - Transitions: - **[Speed dial](https://material.io/design/components/buttons-floating-action-button.html#types-of-transitions) ~** ([Lab](/components/about-the-lab/)) - [Menu](https://material.io/design/components/buttons-floating-action-button.html#types-of-transitions) - [Morph](https://material.io/design/components/buttons-floating-action-button.html#types-of-transitions) @@ -36,16 +36,16 @@ While we strive to follow the guidelines where practical (applying common sense - **[Confirmation dialogs](https://material.io/design/components/dialogs.html#confirmation-dialog) ✓** - **[Dividers](https://material.io/design/components/dividers.html) ✓** - **[Full bleed](https://material.io/design/components/dividers.html#types) ✓** - - **[Diálogos simples](https://material.io/design/components/dialogs.html#simple-dialog) ✓** (Pode ser composto com Dialog e a List.) + - **[Simple dialogs](https://material.io/design/components/dialogs.html#simple-dialog) ✓** (DialogとListで構成可能) - **[Middle](https://material.io/design/components/dividers.html#types) ✓** - **[Subheader](https://material.io/design/components/dividers.html#types) ✓** -- **[Inset](https://material.io/design/components/dividers.html#types) ✓** - - **[Inset](https://material.io/design/components/dividers.html#types) ✓** - - **[Inset](https://material.io/design/components/dividers.html#types) ✓** - - **[Inset](https://material.io/design/components/dividers.html#types) ✓** +- **[Dividers](https://material.io/design/components/dividers.html) ✓** + - **[Full bleed](https://material.io/design/components/dividers.html#types) ✓** - **[Inset](https://material.io/design/components/dividers.html#types) ✓** -- ****[Listas de Imagem](https://material.io/design/components/image-lists.html) ✓** (também conhecido como Grade Lista)****** -- **以下は、Material Designコンポーネントと機能のリストです。** + - **[Middle](https://material.io/design/components/dividers.html#types) ✓** + - **[Subheader](https://material.io/design/components/dividers.html#types) ✓** +- **[Image lists](https://material.io/components/image-lists)✓** +- **[Lists](https://material.io/design/components/lists.html)✓** - [Types:](https://material.io/design/components/lists.html#types) - **Single line ✓** - **Two line ✓** diff --git a/docs/src/pages/getting-started/supported-components/supported-components-pt.md b/docs/src/pages/getting-started/supported-components/supported-components-pt.md index 044fe51e32aefd..51edc36d7b9547 100644 --- a/docs/src/pages/getting-started/supported-components/supported-components-pt.md +++ b/docs/src/pages/getting-started/supported-components/supported-components-pt.md @@ -44,7 +44,7 @@ Se você deseja adicionar suporte a um componente ou recurso não destacado aqui - **[Inset](https://material.io/design/components/dividers.html#types) ✓** - **[Middle](https://material.io/design/components/dividers.html#types) ✓** - **[Subheader](https://material.io/design/components/dividers.html#types) ✓** -- ****[Listas de Imagem](https://material.io/design/components/image-lists.html) ✓** (também conhecido como Grade Lista)****** +- **[Listas de Imagem](https://material.io/design/components/image-lists.html) ✓** (também conhecido como Grade Lista)******** - **[Listas](https://material.io/design/components/lists.html) ✓** - [Tipos:](https://material.io/design/components/lists.html#types) - **Linha única ✓** diff --git a/docs/src/pages/getting-started/supported-components/supported-components-ru.md b/docs/src/pages/getting-started/supported-components/supported-components-ru.md index e53b6cd6ea1af0..e3b7acf29f1143 100644 --- a/docs/src/pages/getting-started/supported-components/supported-components-ru.md +++ b/docs/src/pages/getting-started/supported-components/supported-components-ru.md @@ -44,7 +44,7 @@ If you wish to add support for a component or feature not highlighted here, plea - **[Inset](https://material.io/design/components/dividers.html#types) ✓** - **[Inset](https://material.io/design/components/dividers.html#types) ✓** - **[Inset](https://material.io/design/components/dividers.html#types) ✓** -- ****[Listas de Imagem](https://material.io/design/components/image-lists.html) ✓** (também conhecido como Grade Lista)****** +- **[Listas de Imagem](https://material.io/design/components/image-lists.html) ✓** (também conhecido como Grade Lista)******** - **[Menus](https://material.io/design/components/menus.html) ✓** - [Types:](https://material.io/design/components/lists.html#types) - **Single line ✓** diff --git a/docs/src/pages/getting-started/supported-components/supported-components-zh.md b/docs/src/pages/getting-started/supported-components/supported-components-zh.md index 36aa1885004c98..126109514b2216 100644 --- a/docs/src/pages/getting-started/supported-components/supported-components-zh.md +++ b/docs/src/pages/getting-started/supported-components/supported-components-zh.md @@ -44,7 +44,7 @@ - **[Inset(内凹分隔线)](https://material.io/design/components/dividers.html#types) ✓** - **[Middle(中段分隔线)](https://material.io/design/components/dividers.html#types) ✓** - **[Subheader(副标题分隔线)](https://material.io/design/components/dividers.html#types) ✓** -- ****[Image lists](https://material.io/design/components/image-lists.html) ✓** (又名 Grid Lists)****** +- **[Image lists](https://material.io/design/components/image-lists.html) ✓** (又名 Grid Lists)******** - **[Lists(列表)](https://material.io/design/components/lists.html) ✓** - [类型:](https://material.io/design/components/lists.html#types) - **Single line (单行)✓** diff --git a/docs/src/pages/getting-started/supported-platforms/supported-platforms-de.md b/docs/src/pages/getting-started/supported-platforms/supported-platforms-de.md index 6619a214e3f80a..bb569ae1903db0 100644 --- a/docs/src/pages/getting-started/supported-platforms/supported-platforms-de.md +++ b/docs/src/pages/getting-started/supported-platforms/supported-platforms-de.md @@ -8,21 +8,35 @@ Die Material-UI unterstützt die neuesten, stabilen Versionen aller gängigen Br <!-- #stable-snapshot --> -| Edge | Firefox | Chrome | Safari (macOS) | Safari (iOS) | -|:----- |:------- |:------ |:-------------- |:------------ | -| >= 85 | >= 78 | >= 84 | >= 13 | >= 12.1 | +| Edge | Firefox | Chrome | Safari (macOS) | Safari (iOS) | IE | +|:----- |:------- |:------ |:-------------- |:------------ |:-------------------- | +| >= 85 | >= 78 | >= 84 | >= 13 | >= 12.1 | 11 (partial support) | <!-- #default-branch-switch --> -An extensive list can be found in our [.browserlistrc](https://github.com/mui-org/material-ui/blob/next/.browserslistrc#L12-L27) (check the `stable` entry). If you need to support IE 11, check out our [legacy bundle](/guides/minimizing-bundle-size/#legacy-bundle). +An extensive list can be found in our [.browserlistrc](https://github.com/mui-org/material-ui/blob/next/.browserslistrc#L12-L27) (check the `stable` entry). Da Googlebot einen Web-Rendering-Service (WRS) zum Indizieren des Seiteninhalts verwendet, ist es entscheidend, dass Material-UI dies unterstützt. [WRS aktualisiert regelmäßig die verwendete Rendering-Engine](https://webmasters.googleblog.com/2019/05/the-new-evergreen-googlebot.html). Sie können erwarten, dass die Komponenten von Material-UI ohne größere Probleme gerendert werden. +### IE 11 + +Material-UI provides **partial** supports for IE 11. Be aware of the following: + +- Some of the components have no support. For instance, the new components, the data grid, the date picker. +- Some of the components have degraded support. For instance, the outlined input border radius is missing, the combobox doesn't remove diacritics, the circular progress animation is wobbling. +- The documentaton itself might crash. +- You need install the [legacy bundle](/guides/minimizing-bundle-size/#legacy-bundle). +- You might need to install polyfills. For instance for the [popper.js transitive dependency](https://popper.js.org/docs/v2/browser-support/#ie11). + +Overall, the library doesn't prioritize the support of IE 11 if it harms the most common use cases. For instance, we will close new issues opened about IE 11 and might not merge pull requests that improve IE 11 support. + +v6 will completely remove the support of IE 11. + ## Server <!-- #stable-snapshot --> -We support [Node.js](https://github.com/nodejs/node) starting with version 10 for server-side rendering. Where possible, the [LTS versions that are in maintenance](https://github.com/nodejs/Release#release-schedule) are supported. +Material-UI supports [Node.js](https://github.com/nodejs/node) starting with version 12.17 (or 12.0 with `--experimental-modules` enabled) for server-side rendering. Where possible, the [LTS versions that are in maintenance](https://github.com/nodejs/Release#release-schedule) are supported. ### CSS-Präfix @@ -32,8 +46,10 @@ Das in dieser Dokumentation bereitgestellte CSS wird mit dem [`Autoprefixer`](ht ## React -Material-UI supports the most recent versions of React, starting with ^16.8.0 (the one with the hooks). Have a look at the older [versions](https://material-ui.com/versions/) for backward compatibility. +<!-- #react-peer-version --> + +Material-UI supports the most recent versions of React, starting with ^17.0.0 (the one with event delegation at the React root). Have a look at the older [versions](https://material-ui.com/versions/) for backward compatibility. ## TypeScript -Material-UI requires a minimum version of TypeScript 3.2. +Material-UI requires a minimum version of TypeScript 3.5. diff --git a/docs/src/pages/getting-started/supported-platforms/supported-platforms-es.md b/docs/src/pages/getting-started/supported-platforms/supported-platforms-es.md index 2b250cccbc801a..88fca31b5d71f7 100644 --- a/docs/src/pages/getting-started/supported-platforms/supported-platforms-es.md +++ b/docs/src/pages/getting-started/supported-platforms/supported-platforms-es.md @@ -8,21 +8,35 @@ Material-UI es compatible con las versiones más recientes y estables de todos l <!-- #stable-snapshot --> -| Edge | Firefox | Chrome | Safari (macOS) | Safari (iOS) | -|:----- |:------- |:------ |:-------------- |:------------ | -| >= 85 | >= 78 | >= 84 | >= 13 | >= 12.1 | +| Edge | Firefox | Chrome | Safari (macOS) | Safari (iOS) | IE | +|:----- |:------- |:------ |:-------------- |:------------ |:-------------------- | +| >= 85 | >= 78 | >= 84 | >= 13 | >= 12.1 | 11 (partial support) | <!-- #default-branch-switch --> -An extensive list can be found in our [.browserlistrc](https://github.com/mui-org/material-ui/blob/next/.browserslistrc#L12-L27) (check the `stable` entry). If you need to support IE 11, check out our [legacy bundle](/guides/minimizing-bundle-size/#legacy-bundle). +An extensive list can be found in our [.browserlistrc](https://github.com/mui-org/material-ui/blob/next/.browserslistrc#L12-L27) (check the `stable` entry). Es fundamental que Material-UI sea compatible con el servicio de renderización web (WRS) utilizado por Googlebot para clasificar el contenido de la página web. [WRS regularly updates the rendering engine it uses](https://webmasters.googleblog.com/2019/05/the-new-evergreen-googlebot.html). Podrás contar con que los componentes de Material-UI sean renderizados sin mayores problemas. +### IE 11 + +Material-UI provides **partial** supports for IE 11. Be aware of the following: + +- Some of the components have no support. For instance, the new components, the data grid, the date picker. +- Some of the components have degraded support. For instance, the outlined input border radius is missing, the combobox doesn't remove diacritics, the circular progress animation is wobbling. +- The documentaton itself might crash. +- You need install the [legacy bundle](/guides/minimizing-bundle-size/#legacy-bundle). +- You might need to install polyfills. For instance for the [popper.js transitive dependency](https://popper.js.org/docs/v2/browser-support/#ie11). + +Overall, the library doesn't prioritize the support of IE 11 if it harms the most common use cases. For instance, we will close new issues opened about IE 11 and might not merge pull requests that improve IE 11 support. + +v6 will completely remove the support of IE 11. + ## Servidor <!-- #stable-snapshot --> -We support [Node.js](https://github.com/nodejs/node) starting with version 10 for server-side rendering. Where possible, the [LTS versions that are in maintenance](https://github.com/nodejs/Release#release-schedule) are supported. +Material-UI supports [Node.js](https://github.com/nodejs/node) starting with version 12.17 (or 12.0 with `--experimental-modules` enabled) for server-side rendering. Where possible, the [LTS versions that are in maintenance](https://github.com/nodejs/Release#release-schedule) are supported. ### Prefijado de CSS @@ -32,8 +46,10 @@ El CSS servido en ésta documentación se procesa con [`autoprefixer`](https://w ## React -Material-UI supports the most recent versions of React, starting with ^16.8.0 (the one with the hooks). Have a look at the older [versions](https://material-ui.com/versions/) for backward compatibility. +<!-- #react-peer-version --> + +Material-UI supports the most recent versions of React, starting with ^17.0.0 (the one with event delegation at the React root). Have a look at the older [versions](https://material-ui.com/versions/) for backward compatibility. ## TypeScript -Material-UI requires a minimum version of TypeScript 3.2. +Material-UI requires a minimum version of TypeScript 3.5. diff --git a/docs/src/pages/getting-started/supported-platforms/supported-platforms-fr.md b/docs/src/pages/getting-started/supported-platforms/supported-platforms-fr.md index 3367b149621000..ad50df20a30ec9 100644 --- a/docs/src/pages/getting-started/supported-platforms/supported-platforms-fr.md +++ b/docs/src/pages/getting-started/supported-platforms/supported-platforms-fr.md @@ -8,16 +8,30 @@ Material-UI prend en charge les dernières versions stables de tous les principa <!-- #stable-snapshot --> -| Edge | Firefox | Chrome | Safari (macOS) | Safari (iOS) | -|:----- |:------- |:------ |:-------------- |:------------ | -| >= 85 | >= 78 | >= 84 | >= 13 | >= 12.1 | +| Edge | Firefox | Chrome | Safari (macOS) | Safari (iOS) | IE | +|:----- |:------- |:------ |:-------------- |:------------ |:-------------------- | +| >= 85 | >= 78 | >= 84 | >= 13 | >= 12.1 | 11 (partial support) | <!-- #default-branch-switch --> -Une liste exhaustive se trouve dans notre [.browserlistrc](https://github.com/mui-org/material-ui/blob/next/.browserslistrc#L12-L27) (vérifiez l'entrée `stable`). If you need to support IE 11, check out our [legacy bundle](/guides/minimizing-bundle-size/#legacy-bundle). +Une liste exhaustive se trouve dans notre [.browserlistrc](https://github.com/mui-org/material-ui/blob/next/.browserslistrc#L12-L27) (vérifiez l'entrée `stable`). Étant donné que Googlebot utilise un service de rendu Web (WRS) pour indexer le contenu de la page, il est essentiel que Material-UI le prenne en charge. [WRS regularly updates the rendering engine it uses](https://webmasters.googleblog.com/2019/05/the-new-evergreen-googlebot.html). Vous pouvez vous attendre à ce que les composants de Material-UI soient rendus sans problèmes majeurs. +### IE11 + +Material-UI provides **partial** supports for IE 11. Be aware of the following: + +- Some of the components have no support. For instance, the new components, the data grid, the date picker. +- Some of the components have degraded support. For instance, the outlined input border radius is missing, the combobox doesn't remove diacritics, the circular progress animation is wobbling. +- The documentaton itself might crash. +- If you need to support IE 11, check out our [legacy bundle](/guides/minimizing-bundle-size/#legacy-bundle). +- You might need to install polyfills. For instance for the [popper.js transitive dependency](https://popper.js.org/docs/v2/browser-support/#ie11). + +Overall, the library doesn't prioritize the support of IE 11 if it harms the most common use cases. For instance, we will close new issues opened about IE 11 and might not merge pull requests that improve IE 11 support. + +v6 will completely remove the support of IE 11. + ## Serveur <!-- #stable-snapshot --> @@ -32,6 +46,8 @@ The CSS served on this documentation is processed with [`autoprefixer`](https:// ## React +<!-- #react-peer-version --> + Material-UI supports the most recent versions of React, starting with ^16.8.0 (the one with the hooks). Have a look at the older [versions](https://material-ui.com/versions/) for backward compatibility. ## TypeScript diff --git a/docs/src/pages/getting-started/supported-platforms/supported-platforms-ja.md b/docs/src/pages/getting-started/supported-platforms/supported-platforms-ja.md index 5583532e0eb68b..adcac6b21a96d2 100644 --- a/docs/src/pages/getting-started/supported-platforms/supported-platforms-ja.md +++ b/docs/src/pages/getting-started/supported-platforms/supported-platforms-ja.md @@ -1,39 +1,55 @@ # サポートされているプラットフォーム -<p class="description">Material-UIがサポートする古いプラットフォームからモダンなものまでについて学びます。</p> +<p class="description">モダンなものから古いものまで、Material-UIがサポートするプラットフォームについて学びましょう。</p> ## ブラウザ -Material-UIは主要なブラウザとプラットフォームの最新の安定版リリースをサポートしています。 Internet Explorer 11もサポートしています。 JavaScriptポリフィルは、サポートされていないブラウザー機能を内部で個別に管理するため、提供する必要はありません。 JavaScriptポリフィルは、サポートされていないブラウザー機能を内部で個別に管理するため、提供する必要はありません。 +Material-UIは主要なブラウザとプラットフォームの最新の安定版リリースをサポートしています。 ブラウザのサポートされていない機能は内部的に独立して管理されているので、JavaScriptポリフィルを導入する必要はありません。 <!-- #stable-snapshot --> -| Edge | Firefox | Chrome | Safari (macOS) | Safari (iOS) | -|:----- |:------- |:------ |:-------------- |:------------ | -| >= 85 | >= 78 | >= 84 | >= 13 | >= 12.1 | +| Edge | Firefox | Chrome | Safari (macOS) | Safari (iOS) | IE | +|:----- |:------- |:------ |:-------------- |:------------ |:-------------------- | +| >= 85 | >= 78 | >= 84 | >= 13 | >= 12.1 | 11 (partial support) | <!-- #default-branch-switch --> -An extensive list can be found in our [.browserlistrc](https://github.com/mui-org/material-ui/blob/next/.browserslistrc#L12-L27) (check the `stable` entry). If you need to support IE 11, check out our [legacy bundle](/guides/minimizing-bundle-size/#legacy-bundle). +An extensive list can be found in our [.browserlistrc](https://github.com/mui-org/material-ui/blob/next/.browserslistrc#L12-L27) (check the `stable` entry). -Googlebotはページコンテンツのインデックス作成にweb rendering service (WRS) を使用するので、Material-UIがそれをサポートすることは重要です。 [WRSは、使用するレンダリングエンジンを定期的に更新します](https://webmasters.googleblog.com/2019/05/the-new-evergreen-googlebot.html)。 特に支障なくレンダリングできるMaterial-UIのコンポーネントを期待できます。 [WRSは、使用するレンダリングエンジンを定期的に更新します](https://webmasters.googleblog.com/2019/05/the-new-evergreen-googlebot.html)。 特に支障なくレンダリングできるMaterial-UIのコンポーネントを期待できます。 [WRSは、使用するレンダリングエンジンを定期的に更新します](https://webmasters.googleblog.com/2019/05/the-new-evergreen-googlebot.html)。 特に支障なくレンダリングできるMaterial-UIのコンポーネントを期待できます。 [WRSは、使用するレンダリングエンジンを定期的に更新します](https://webmasters.googleblog.com/2019/05/the-new-evergreen-googlebot.html)。 特に支障なくレンダリングできるMaterial-UIのコンポーネントを期待できます。 [WRSは、使用するレンダリングエンジンを定期的に更新します](https://webmasters.googleblog.com/2019/05/the-new-evergreen-googlebot.html)。 特に支障なくレンダリングできるMaterial-UIのコンポーネントを期待できます。 +Googlebotはページコンテンツのインデックス作成にweb rendering service (WRS) を使用するので、Material-UIがそれをサポートすることは重要です。 [WRSは、使用するレンダリングエンジンを定期的に更新します](https://webmasters.googleblog.com/2019/05/the-new-evergreen-googlebot.html)。 特に支障なくレンダリングできるMaterial-UIのコンポーネントを期待できます。 + +### IE 11 + +Material-UI provides **partial** supports for IE 11. Be aware of the following: + +- Some of the components have no support. For instance, the new components, the data grid, the date picker. +- Some of the components have degraded support. For instance, the outlined input border radius is missing, the combobox doesn't remove diacritics, the circular progress animation is wobbling. +- The documentaton itself might crash. +- You need install the [legacy bundle](/guides/minimizing-bundle-size/#legacy-bundle). +- You might need to install polyfills. For instance for the [popper.js transitive dependency](https://popper.js.org/docs/v2/browser-support/#ie11). + +Overall, the library doesn't prioritize the support of IE 11 if it harms the most common use cases. For instance, we will close new issues opened about IE 11 and might not merge pull requests that improve IE 11 support. + +v6 will completely remove the support of IE 11. ## サーバ <!-- #stable-snapshot --> -We support [Node.js](https://github.com/nodejs/node) starting with version 10 for server-side rendering. Where possible, the [LTS versions that are in maintenance](https://github.com/nodejs/Release#release-schedule) are supported. +Material-UI supports [Node.js](https://github.com/nodejs/node) starting with version 12.17 (or 12.0 with `--experimental-modules` enabled) for server-side rendering. Where possible, the [LTS versions that are in maintenance](https://github.com/nodejs/Release#release-schedule) are supported. ### CSSプレフィックス -Be aware that some CSS features [require](https://github.com/cssinjs/jss/issues/279) an additional postprocessing step that adds vendor-specific prefixes. These prefixes are automatically added to the client thanks to [`jss-plugin-vendor-prefixer`](https://www.npmjs.com/package/jss-plugin-vendor-prefixer). +一部のCSS機能では、ベンダープレフィックスを追加するための後処理が[必要](https://github.com/cssinjs/jss/issues/279)になることに注意してください。 これらのプレフィックスは [`jss-plugin-vendor-prefixer`](https://www.npmjs.com/package/jss-plugin-vendor-prefixer) のおかげで自動的にクライアントに追加されます。 -ドキュメントで記述されているCSSは、[`autoprefixer`](https://www.npmjs.com/package/autoprefixer)で処理されます。 インスピレーションとして[ドキュメントの実装](https://github.com/mui-org/material-ui/blob/47aa5aeaec1d4ac2c08fd0e84277d6b91e497557/pages/_document.js#L123)を用いることができます。 ページのパフォーマンスに影響することに注意してください。 It's a must-do for static pages, but it needs to be put in balance with not doing anything when rendering dynamic pages. インスピレーションとして[ドキュメントの実装](https://github.com/mui-org/material-ui/blob/47aa5aeaec1d4ac2c08fd0e84277d6b91e497557/pages/_document.js#L123)を用いることができます。 ページのパフォーマンスに影響することに注意してください。 It's a must-do for static pages, but it needs to be put in balance with not doing anything when rendering dynamic pages. ページのパフォーマンスに影響することに注意してください。 ページのパフォーマンスに影響することに注意してください。 ページのパフォーマンスに影響することに注意してください。 It's a must-do for static pages, but it needs to be put in balance with not doing anything when rendering dynamic pages. +ドキュメントで記述されているCSSは、[`autoprefixer`](https://www.npmjs.com/package/autoprefixer)で処理されます。 インスピレーションとして[ドキュメントの実装](https://github.com/mui-org/material-ui/blob/47aa5aeaec1d4ac2c08fd0e84277d6b91e497557/pages/_document.js#L123)を用いることができます。 ページのパフォーマンスに影響することに注意してください。 これは静的ページには必須ですが、動的ページをレンダリングする時には、何もしない事のバランスを取る必要があります。 ## React -Material-UIは、^16.8. 0(フックのついた方) 以降のReactの最新バージョンをサポートします。 Have a look at the older [versions](https://material-ui.com/versions/) for backward compatibility. Material-UIは、^16.8. 0(フックのついた方) 以降のReactの最新バージョンをサポートします。 Have a look at the older [versions](https://material-ui.com/versions/) for backward compatibility. +<!-- #react-peer-version --> + +Material-UI supports the most recent versions of React, starting with ^17.0.0 (the one with event delegation at the React root). 下位互換性については、古い [バージョン](https://material-ui.com/versions/) を参照してください。 ## TypeScript -Material-UI requires a minimum version of TypeScript 3.2. +Material-UI requires a minimum version of TypeScript 3.5. diff --git a/docs/src/pages/getting-started/supported-platforms/supported-platforms-pt.md b/docs/src/pages/getting-started/supported-platforms/supported-platforms-pt.md index ddabde5b4fc85d..70ac65c77d92b5 100644 --- a/docs/src/pages/getting-started/supported-platforms/supported-platforms-pt.md +++ b/docs/src/pages/getting-started/supported-platforms/supported-platforms-pt.md @@ -8,21 +8,35 @@ O Material-UI suporta as versões mais recentes e estáveis de todos os principa <!-- #stable-snapshot --> -| Edge | Firefox | Chrome | Safari (macOS) | Safari (iOS) | -|:----- |:------- |:------ |:-------------- |:------------ | -| >= 85 | >= 78 | >= 84 | >= 13 | >= 12.1 | +| Edge | Firefox | Chrome | Safari (macOS) | Safari (iOS) | IE | +|:----- |:------- |:------ |:-------------- |:------------ |:-------------------- | +| >= 85 | >= 78 | >= 84 | >= 13 | >= 12.1 | 11 (partial support) | <!-- #default-branch-switch --> -Uma extensa lista pode ser encontrada em nosso [.browserlistrc](https://github.com/mui-org/material-ui/blob/next/.browserslistrc#L12-L27) (verifique a entrada `stable`). Se você precisar do suporte para o IE 11, confira nosso [pacote legado](/guides/minimizing-bundle-size/#legacy-bundle). +An extensive list can be found in our [.browserlistrc](https://github.com/mui-org/material-ui/blob/next/.browserslistrc#L12-L27) (check the `stable` entry). Como o Googlebot usa um serviço de renderização da Web (WRS) para indexar o conteúdo da página, é essencial que o Material-UI o suporte. [O WRS atualiza regularmente o mecanismo de renderização usado por ele](https://webmasters.googleblog.com/2019/05/the-new-evergreen-googlebot.html). Você pode esperar que os componentes do Material-UI sejam renderizados sem grandes problemas. +### IE 11 + +Material-UI provides **partial** supports for IE 11. Be aware of the following: + +- Some of the components have no support. For instance, the new components, the data grid, the date picker. +- Some of the components have degraded support. For instance, the outlined input border radius is missing, the combobox doesn't remove diacritics, the circular progress animation is wobbling. +- The documentaton itself might crash. +- You need install the [legacy bundle](/guides/minimizing-bundle-size/#legacy-bundle). +- You might need to install polyfills. For instance for the [popper.js transitive dependency](https://popper.js.org/docs/v2/browser-support/#ie11). + +Overall, the library doesn't prioritize the support of IE 11 if it harms the most common use cases. For instance, we will close new issues opened about IE 11 and might not merge pull requests that improve IE 11 support. + +v6 will completely remove the support of IE 11. + ## Servidor <!-- #stable-snapshot --> -Nós suportamos [Node.js](https://github.com/nodejs/node) a partir da versão 10 para renderização do lado do servidor. Sempre que possível, as versões [ LTS que estão em manutenção ](https://github.com/nodejs/Release#release-schedule) são suportados. +Material-UI supports [Node.js](https://github.com/nodejs/node) starting with version 12.17 (or 12.0 with `--experimental-modules` enabled) for server-side rendering. Where possible, the [LTS versions that are in maintenance](https://github.com/nodejs/Release#release-schedule) are supported. ### Prefixos CSS @@ -32,8 +46,10 @@ O CSS exibido nesta documentação é processado com [`autoprefixer`](https://ww ## React -Material-UI suporta as versões mais recentes do React, começando com ^16.8.0 (o que possui os hooks). Dê uma olhada nas [versões](https://material-ui.com/versions/) mais antigas para compatibilidade. +<!-- #react-peer-version --> + +Material-UI supports the most recent versions of React, starting with ^17.0.0 (the one with event delegation at the React root). Dê uma olhada nas [versões](https://material-ui.com/versions/) mais antigas para compatibilidade. ## TypeScript -Material-UI requer como versão mínima o TypeScript 3.2. +Material-UI requires a minimum version of TypeScript 3.5. diff --git a/docs/src/pages/getting-started/supported-platforms/supported-platforms-ru.md b/docs/src/pages/getting-started/supported-platforms/supported-platforms-ru.md index b0092f7267908b..62cf49f024c213 100644 --- a/docs/src/pages/getting-started/supported-platforms/supported-platforms-ru.md +++ b/docs/src/pages/getting-started/supported-platforms/supported-platforms-ru.md @@ -8,21 +8,35 @@ Material-UI поддерживает все последние, стабильн <!-- #stable-snapshot --> -| Edge | Firefox | Chrome | Safari (macOS) | Safari (iOS) | -|:----- |:------- |:------ |:-------------- |:------------ | -| >= 85 | >= 78 | >= 84 | >= 13 | >= 12.1 | +| Edge | Firefox | Chrome | Safari (macOS) | Safari (iOS) | IE | +|:----- |:------- |:------ |:-------------- |:------------ |:-------------------- | +| >= 85 | >= 78 | >= 84 | >= 13 | >= 12.1 | 11 (partial support) | <!-- #default-branch-switch --> -An extensive list can be found in our [.browserlistrc](https://github.com/mui-org/material-ui/blob/next/.browserslistrc#L12-L27) (check the `stable` entry). Если вам нужна поддержка IE 11, воспользуйтесь [устаревшим пакетом](/guides/minimizing-bundle-size/#legacy-bundle). +An extensive list can be found in our [.browserlistrc](https://github.com/mui-org/material-ui/blob/next/.browserslistrc#L12-L27) (check the `stable` entry). Because Googlebot uses a web rendering service (WRS) to index the page content, it's critical that Material-UI supports it. [WRS regularly updates the rendering engine it uses](https://webmasters.googleblog.com/2019/05/the-new-evergreen-googlebot.html). You can expect Material-UI's components to render without major issues. +### IE 11 + +Material-UI provides **partial** supports for IE 11. Be aware of the following: + +- Some of the components have no support. For instance, the new components, the data grid, the date picker. +- Some of the components have degraded support. For instance, the outlined input border radius is missing, the combobox doesn't remove diacritics, the circular progress animation is wobbling. +- The documentaton itself might crash. +- You need install the [legacy bundle](/guides/minimizing-bundle-size/#legacy-bundle). +- You might need to install polyfills. For instance for the [popper.js transitive dependency](https://popper.js.org/docs/v2/browser-support/#ie11). + +Overall, the library doesn't prioritize the support of IE 11 if it harms the most common use cases. For instance, we will close new issues opened about IE 11 and might not merge pull requests that improve IE 11 support. + +v6 will completely remove the support of IE 11. + ## Server <!-- #stable-snapshot --> -Для рендеринга на стороне сервера мы поддерживаем версии [Node.js](https://github.com/nodejs/node) начиная с 10. Where possible, the [LTS versions that are in maintenance](https://github.com/nodejs/Release#release-schedule) are supported. +Material-UI supports [Node.js](https://github.com/nodejs/node) starting with version 12.17 (or 12.0 with `--experimental-modules` enabled) for server-side rendering. Where possible, the [LTS versions that are in maintenance](https://github.com/nodejs/Release#release-schedule) are supported. ### CSS prefixing @@ -32,8 +46,10 @@ The CSS served on this documentation is processed with [`autoprefixer`](https:// ## React -Material-UI supports the most recent versions of React, starting with ^16.8.0 (the one with the hooks). Have a look at the older [versions](https://material-ui.com/versions/) for backward compatibility. +<!-- #react-peer-version --> + +Material-UI supports the most recent versions of React, starting with ^17.0.0 (the one with event delegation at the React root). Have a look at the older [versions](https://material-ui.com/versions/) for backward compatibility. ## TypeScript -Material-UI requires a minimum version of TypeScript 3.2. +Material-UI requires a minimum version of TypeScript 3.5. diff --git a/docs/src/pages/getting-started/supported-platforms/supported-platforms-zh.md b/docs/src/pages/getting-started/supported-platforms/supported-platforms-zh.md index 51655ec0652d9d..9225568d5a1a63 100644 --- a/docs/src/pages/getting-started/supported-platforms/supported-platforms-zh.md +++ b/docs/src/pages/getting-started/supported-platforms/supported-platforms-zh.md @@ -8,21 +8,35 @@ Material-UI 支持所有主流浏览器和平台的最新稳定版本。 您不 <!-- #stable-snapshot --> -| Edge | Firefox | Chrome | Safari (macOS) | Safari (iOS) | -|:----- |:------- |:------ |:-------------- |:------------ | -| >= 85 | >= 78 | >= 84 | >= 13 | >= 12.1 | +| Edge | Firefox | Chrome | Safari (macOS) | Safari (iOS) | IE | +|:----- |:------- |:------ |:-------------- |:------------ |:-------------------- | +| >= 85 | >= 78 | >= 84 | >= 13 | >= 12.1 | 11 (partial support) | <!-- #default-branch-switch --> -详细列表可以在我们的 [.browserlistrc](https://github.com/mui-org/material-ui/blob/next/.browserslistrc#L12-L27) 中找到(检查 `stable` 条目)。 如果你需要对 IE 11 进行兼容性支持,请查看我们的 [旧版本包](/guides/minimizing-bundle-size/#legacy-bundle)。 +An extensive list can be found in our [.browserlistrc](https://github.com/mui-org/material-ui/blob/next/.browserslistrc#L12-L27) (check the `stable` entry). 因为 Googlebot 使用了Web rendering service - WRS (网络渲染服务)对页面进行索引,所以Material-UI能提供对它的支持非常重要。 [WRS 定期更新它使用的渲染引擎](https://webmasters.googleblog.com/2019/05/the-new-evergreen-googlebot.html)。 您可以依赖 Material-UI 组件的渲染,并不会出现重大的问题。 +### IE 11 + +Material-UI provides **partial** supports for IE 11. Be aware of the following: + +- Some of the components have no support. For instance, the new components, the data grid, the date picker. +- Some of the components have degraded support. For instance, the outlined input border radius is missing, the combobox doesn't remove diacritics, the circular progress animation is wobbling. +- The documentaton itself might crash. +- You need install the [legacy bundle](/guides/minimizing-bundle-size/#legacy-bundle). +- You might need to install polyfills. For instance for the [popper.js transitive dependency](https://popper.js.org/docs/v2/browser-support/#ie11). + +Overall, the library doesn't prioritize the support of IE 11 if it harms the most common use cases. For instance, we will close new issues opened about IE 11 and might not merge pull requests that improve IE 11 support. + +v6 will completely remove the support of IE 11. + ## 服务器 <!-- #stable-snapshot --> -我们从 [Node.js](https://github.com/nodejs/node) 第十个版本开始支持服务端渲染。 我们还会尽可能的支持 [维护中的 LTS 版本](https://github.com/nodejs/Release#release-schedule) 。 +Material-UI supports [Node.js](https://github.com/nodejs/node) starting with version 12.17 (or 12.0 with `--experimental-modules` enabled) for server-side rendering. Where possible, the [LTS versions that are in maintenance](https://github.com/nodejs/Release#release-schedule) are supported. ### CSS 前缀 @@ -32,8 +46,10 @@ Material-UI 支持所有主流浏览器和平台的最新稳定版本。 您不 ## React -Material-UI 支持最新版本的 React,从 16.8.0 开始(带有 hook 的版本)。 我们同时提供了向后兼容的 [版本](https://material-ui.com/versions/)。 +<!-- #react-peer-version --> + +Material-UI supports the most recent versions of React, starting with ^17.0.0 (the one with event delegation at the React root). 我们同时提供了向后兼容的 [版本](https://material-ui.com/versions/)。 ## TypeScript -Material-UI 需要的最低 TypeScript 的版本为 3.2。 +Material-UI requires a minimum version of TypeScript 3.5. diff --git a/docs/src/pages/getting-started/templates/templates-ja.md b/docs/src/pages/getting-started/templates/templates-ja.md index d9248d5cd8b36d..b978ddd39cef96 100644 --- a/docs/src/pages/getting-started/templates/templates-ja.md +++ b/docs/src/pages/getting-started/templates/templates-ja.md @@ -4,15 +4,15 @@ title: 9+ Free React Templates # Reactテンプレート -<p class="description">A selection of free react templates to help you get started building your app. The collection contains react dashboard, react admin, and more.</p> +<p class="description">このページでは自由に使えるReactアプリのテンプレートを紹介しています。これらを用いてアプリ開発を始めることができます。 アプリのダッシュボード画面や、管理画面、などなどさまざまなページを作ることができます。</p> -テンプレートを [サンプルアプリケーション](https://github.com/mui-org/material-ui/tree/master/examples) いずれかと組み合わせて、完全なスターターを形成できます。 +これらのテンプレートは [別なページで紹介しているサンプルアプリ](https://github.com/mui-org/material-ui/tree/master/examples)と組み合わせることができ、しっかりしたアプリを作り始めることができます。 -各レイアウトのセクションは、コメントまたは個別のファイルの使用によって明確に定義されます。 ページの一部を簡単に抽出できるようになりました(たとえば、「ヒーローユニット」やフッタなど)。 他のページで再利用できます。 マルチパートの例については、リンクされたソースコードの場所にあるREADMEの表に各ファイルの目的が説明されています。 マルチパートの例については、リンクされたソースコードの場所にあるREADMEの表に各ファイルの目的が説明されています。 +各レイアウトのセクションは、コメントまたは別ファイルを使用して明確に定義されているため、ページの一部(例えば、「ヒーローユニット」やフッターなど)を簡単に抽出して他のページで再利用することができます。 マルチパートの例については、リンクされたソースコードの場所にあるREADMEの表に各ファイルの目的が説明されています。 {{"demo": "pages/getting-started/templates/Templates.js", "hideToolbar": true, "bg": true}} -これらのサンプルを使用している間に、開発者のエクスペリエンスを改善する可能性のある変更や拡張を行ったり、追加のサンプルを提供したい場合は、GitHub</a>でプルリクエストを作成することを検討してください。 +これらのサンプルを使用している間に、開発者のエクスペリエンスを改善させるための変更や拡張を行ったり、追加のサンプルを提供したい場合は、[GitHubでプルリクエスト](https://github.com/mui-org/material-ui/pulls)を作成することを検討してください。 So far we have demos for a dashboard, sign in page, sign up page, blog page, checkout flow, album page, pricing page, and sticky footer page. diff --git a/docs/src/pages/getting-started/usage/usage-ja.md b/docs/src/pages/getting-started/usage/usage-ja.md index bbc222878e71a7..bc65f6f0c16b96 100644 --- a/docs/src/pages/getting-started/usage/usage-ja.md +++ b/docs/src/pages/getting-started/usage/usage-ja.md @@ -2,9 +2,9 @@ <p class="description">Material-UIとReactを今すぐ始めましょう。</p> -Material-UIコンポーネントは独立して機能します。 **これらは自立しており**、表示するのに必要なスタイルだけを加えます。 Material-UIコンポーネントは独立して機能します。 **これらは自立しており**、表示するのに必要なスタイルだけを加えます。 それらは[normalize.css](https://github.com/necolas/normalize.css/)のようなグローバルのスタイルシートには依存しません。 +Material-UIコンポーネントは独立して機能します。 **これらは自立しており**、表示するのに必要なスタイルだけを加えます。 それらは[normalize.css](https://github.com/necolas/normalize.css/)のようなグローバルのスタイルシートには依存しません。 -ドキュメントに示されているように、任意のコンポーネントを使用できます。 ドキュメントに示されているように、任意のコンポーネントを使用できます。 ドキュメントに示されているように、任意のコンポーネントを使用できます。 ドキュメントに示されているように、任意のコンポーネントを使用できます。 ドキュメントに示されているように、任意のコンポーネントを使用できます。 ドキュメントに示されているように、任意のコンポーネントを使用できます。 どのようにインポートされるか確認する為にそれぞれのコンポーネントの[デモページ](/components/buttons/)を参照してください。 +ドキュメントに示されているように、任意のコンポーネントを使用できます。 どのようにインポートされるか確認する為にそれぞれのコンポーネントの[デモページ](/components/buttons/)を参照してください。 ## 今すぐ始める @@ -36,7 +36,7 @@ Material-UI usage experience can be improved with a handful of important globals ### Responsive meta tag -すべてのデバイスで適切なレンダリングとタッチズームを確実なものにするには、responsive viewport metaタグを`<head>`に追加します。 すべてのデバイスで適切なレンダリングとタッチズームを確実なものにするには、responsive viewport metaタグを`<head>`に追加します。 すべてのデバイスで適切なレンダリングとタッチズームを確実なものにするには、responsive viewport metaタグを`<head>`に追加します。 すべてのデバイスで適切なレンダリングとタッチズームを確実なものにするには、responsive viewport metaタグを`<head>`に追加します。 すべてのデバイスで適切なレンダリングとタッチズームを確実なものにするには、responsive viewport metaタグを`<head>`に追加します。 すべてのデバイスで適切なレンダリングとタッチズームを確実なものにするには、responsive viewport metaタグを`<head>`に追加します。 +Material-UIはモバイルファーストで開発されています。最初にモバイル端末用のコードを記述し、次にCSSメディアクエリを使用して必要に応じてコンポーネントを拡張するという方法を用いています。 すべてのデバイスで適切なレンダリングとタッチズームを確実に行うには、responsive viewport meta tagを `<head>` 要素に追加します。 ```html <meta name="viewport" content="initial-scale=1, width=device-width" /> @@ -44,11 +44,11 @@ Material-UI usage experience can be improved with a handful of important globals ### CssBaseline -Material-UIはオプションで[CssBaseline](/components/css-baseline/)コンポーネントを提供しています。 それらは[normalize.css](https://github.com/necolas/normalize.css/)のようなグローバルのスタイルシートには依存しません。 それらは[normalize.css](https://github.com/necolas/normalize.css/)のようなグローバルのスタイルシートには依存しません。 それらは[normalize.css](https://github.com/necolas/normalize.css/)のようなグローバルのスタイルシートには依存しません。 それらは[normalize.css](https://github.com/necolas/normalize.css/)のようなグローバルのスタイルシートには依存しません。 それらは[normalize.css](https://github.com/necolas/normalize.css/)のようなグローバルのスタイルシートには依存しません。 +Material-UIはオプションで[CssBaseline](/components/css-baseline/)コンポーネントを提供しています。 これは、ブラウザやデバイス間の不整合を修正すると同時に、一般的なHTML要素に対して少しだけ独自のリセットを提供します。 ## バージョン管理されたドキュメント -このドキュメントは常に最新の安定版のMaterial-UIを反映しています。 古いバージョンのドキュメントは、[別のページ ](https://material-ui.com/versions/)にあります。 このドキュメントは常に最新の安定版のMaterial-UIを反映しています。 古いバージョンのドキュメントは、[別のページ ](https://material-ui.com/versions/)にあります。 このドキュメントは常に最新の安定版のMaterial-UIを反映しています。 古いバージョンのドキュメントは、[別のページ ](https://material-ui.com/versions/)にあります。 このドキュメントは常に最新の安定版のMaterial-UIを反映しています。 古いバージョンのドキュメントは、[別のページ ](https://material-ui.com/versions/)にあります。 このドキュメントは常に最新の安定版のMaterial-UIを反映しています。 古いバージョンのドキュメントは、[別のページ ](https://material-ui.com/versions/)にあります。 このドキュメントは常に最新の安定版のMaterial-UIを反映しています。 古いバージョンのドキュメントは、[別のページ ](https://material-ui.com/versions/)にあります。 このドキュメントは常に最新の安定版のMaterial-UIを反映しています。 古いバージョンのドキュメントは、[別のページ ](https://material-ui.com/versions/)にあります。 このドキュメントは常に最新の安定版のMaterial-UIを反映しています。 古いバージョンのドキュメントは、[別のページ ](https://material-ui.com/versions/)にあります。 このドキュメントは常に最新の安定版のMaterial-UIを反映しています。 古いバージョンのドキュメントは、[別のページ ](https://material-ui.com/versions/)にあります。 このドキュメントは常に最新の安定版のMaterial-UIを反映しています。 古いバージョンのドキュメントは、[別のページ ](https://material-ui.com/versions/)にあります。 このドキュメントは常に最新の安定版のMaterial-UIを反映しています。 古いバージョンのドキュメントは、[別のページ ](https://material-ui.com/versions/)にあります。 +このドキュメントは常に最新の安定版のMaterial-UIを反映しています。 古いバージョンのドキュメントは、[別のページ ](https://material-ui.com/versions/)にあります。 ## 次のステップ diff --git a/docs/src/pages/guides/api/api-de.md b/docs/src/pages/guides/api/api-de.md index f0d502bca2645f..ec4a393618fb98 100644 --- a/docs/src/pages/guides/api/api-de.md +++ b/docs/src/pages/guides/api/api-de.md @@ -38,7 +38,7 @@ Wir vermeiden, die vom DOM unterstützten nativen Eigenschaften wie [`className` ### CSS-Klassen -All components accept a [`classes`](/customization/how-to-customize/#overriding-styles-with-classes) prop to customize the styles. Das Design der classes beantwortet zwei Bedingungen: Die Klassenstruktur so einfach wie möglich zu gestalten, aber trotzdem ausreichend, um die Material Design-Spezifikation zu implementieren. +All components accept a [`classes`](/customization/how-to-customize/#overriding-styles-with-classes) prop to customize the styles. The classes design answers two constraints: to make the classes structure as simple as possible, while sufficient to implement the Material Design guidelines. - Die auf das Wurzelelement angewendete Klasse wird immer als `root` bezeichnet. - Alle Standardstile sind in einer einzigen Klasse zusammengefasst. @@ -82,7 +82,7 @@ Der Name einer booleschen Eigenschaft sollte basierend auf dem **Standardwert** Der überwiegende Teil der kontrollierten Komponente wird über die `value` und `onChange` Eigenschaften gesteuert, jedoch werden die `open` / `onClose` / `onOpen` Kombination wird für den Anzeigezustand verwendet. In the cases where there are more events, we put the noun first, and then the verb, for example: `onPageChange`, `onRowsChange`. -### boolean vs enum +### boolean vs. enum Es gibt zwei Möglichkeiten, die API für die Variationen einer Komponente zu entwerfen: mit einem * Booleschen Wert*; oder mit einer *Aufzählung (enum)*. Nehmen wir zum Beispiel einen Button, die verschiedene Typen hat. Jede Option hat ihre Vor- und Nachteile: @@ -107,7 +107,7 @@ Es gibt zwei Möglichkeiten, die API für die Variationen einer Komponente zu en Diese API ist ausführlicher: `<Button>`, `<Button variant="contained">`, `<Button variant="fab">`. - However it prevents an invalid combination from being used, bounds the number of properties exposed, and can easily support new values in the future. + However, it prevents an invalid combination from being used, bounds the number of props exposed, and can easily support new values in the future. Die Komponenten der Material-UI verwenden eine Kombination der beiden Ansätze gemäß den folgenden Regeln: diff --git a/docs/src/pages/guides/api/api-es.md b/docs/src/pages/guides/api/api-es.md index 26418f339036c7..c3dc4ba512ab17 100644 --- a/docs/src/pages/guides/api/api-es.md +++ b/docs/src/pages/guides/api/api-es.md @@ -38,7 +38,7 @@ We avoid documenting native properties supported by the DOM like [`className`](/ ### CSS Classes -All components accept a [`classes`](/customization/how-to-customize/#overriding-styles-with-classes) prop to customize the styles. The classes design answers two constraints: to make the classes structure as simple as possible, while sufficient to implement the Material Design specification. +All components accept a [`classes`](/customization/how-to-customize/#overriding-styles-with-classes) prop to customize the styles. The classes design answers two constraints: to make the classes structure as simple as possible, while sufficient to implement the Material Design guidelines. - The class applied to the root element is always called `root`. - All the default styles are grouped in a single class. @@ -82,7 +82,7 @@ The name of a boolean property should be chosen based on the **default value**. Most of the controlled component are controlled via the `value` and the `onChange` properties, however, the `open` / `onClose` / `onOpen` combination is used for display related state. In the cases where there are more events, we put the noun first, and then the verb, for example: `onPageChange`, `onRowsChange`. -### boolean vs enum +### boolean vs. enum There are two options to design the API for the variations of a component: with a *boolean*; or with an *enum*. For example, let's take a button that has different types. Each option has its pros and cons: @@ -107,7 +107,7 @@ There are two options to design the API for the variations of a component: with This API is more verbose: `<Button>`, `<Button variant="contained">`, `<Button variant="fab">`. - However it prevents an invalid combination from being used, bounds the number of properties exposed, and can easily support new values in the future. + However, it prevents an invalid combination from being used, bounds the number of props exposed, and can easily support new values in the future. The Material-UI components use a combination of the two approaches according to the following rules: diff --git a/docs/src/pages/guides/api/api-ja.md b/docs/src/pages/guides/api/api-ja.md index 4321aaf8f6e215..884aa6f81b2cea 100644 --- a/docs/src/pages/guides/api/api-ja.md +++ b/docs/src/pages/guides/api/api-ja.md @@ -38,7 +38,7 @@ Props supplied to a component which are not explicitly documented are spread to ### CSS クラス -All components accept a [`classes`](/customization/how-to-customize/#overriding-styles-with-classes) prop to customize the styles. クラス設計は、次の2つの制約に答えます: Material Design仕様を実装するのに十分なだけで、可能な限りクラス構造を単純にします。 +All components accept a [`classes`](/customization/how-to-customize/#overriding-styles-with-classes) prop to customize the styles. The classes design answers two constraints: to make the classes structure as simple as possible, while sufficient to implement the Material Design guidelines. - ルート要素に適用されるクラスは、常に`root`と呼ばれます。 - 既定のスタイルはすべて1つのクラスにグループ化されます。 @@ -82,7 +82,7 @@ const styles = { ほとんどの制御対象コンポーネントは、`値`および`onChange`プロパティによって制御されます。 ただし、ディスプレイ関連の状態には、`open`/`onClose`/`onOpen`の組み合わせが使用されます。 In the cases where there are more events, we put the noun first, and then the verb, for example: `onPageChange`, `onRowsChange`. -### boolean vs enum +### boolean vs. enum コンポーネントのバリエーションのためのAPIを設計するには、次の二つのオプションがあります。 *boolean*; または*enum*を使用します。 たとえば、異なるタイプのボタンを選択します。 各オプションには長所と短所があります。 @@ -107,7 +107,7 @@ const styles = { このAPIはより冗長です: `<Button>`、`<Button variant="contained">`、`<Button variant="fab">`。 - ただし、無効な組み合わせの使用を防ぎ、 は公開されるプロパティの数を制限し、 は将来新しい値を簡単にサポートできます。 + However, it prevents an invalid combination from being used, bounds the number of props exposed, and can easily support new values in the future. Material-UIコンポーネントは、次の規則に従って2つのアプローチの組み合わせを使用します。 @@ -118,7 +118,7 @@ Going back to the previous button example; since it requires 3 possible values, ### Ref -`ref`はルート要素に転送されます。 `ref`はルート要素に転送されます。 This means that, without changing the rendered root element via the `component` prop, it is forwarded to the outermost DOM element which the component renders. `ref`はルート要素に転送されます。 This means that, without changing the rendered root element via the `component` prop, it is forwarded to the outermost DOM element which the component renders. If you pass a different component via the `component` prop, the ref will be attached to that component instead. +` ref `はルート要素に転送されます。 `ref`はルート要素に転送されます。 This means that, without changing the rendered root element via the `component` prop, it is forwarded to the outermost DOM element which the component renders. If you pass a different component via the `component` prop, the ref will be attached to that component instead. ## 用語集 diff --git a/docs/src/pages/guides/api/api-pt.md b/docs/src/pages/guides/api/api-pt.md index 98b2fc8dc90ce5..bbe62f8e60ff8f 100644 --- a/docs/src/pages/guides/api/api-pt.md +++ b/docs/src/pages/guides/api/api-pt.md @@ -38,7 +38,7 @@ Evitamos documentar propriedades nativas suportadas pelo DOM como [`className`]( ### Classes CSS -Todos os componentes aceitam uma propriedade [`classes`](/customization/how-to-customize/#overriding-styles-with-classes) para customizar os estilos. O design de classes responde a duas restrições: para tornar a estrutura das classes o mais simples possível, enquanto que faz a implementação da especificação do Material Design. +Todos os componentes aceitam uma propriedade [`classes`](/customization/how-to-customize/#overriding-styles-with-classes) para customizar os estilos. The classes design answers two constraints: to make the classes structure as simple as possible, while sufficient to implement the Material Design guidelines. - A classe aplicada ao elemento raiz é sempre chamada de `root`. - Todos os estilos padrão são agrupados em uma única classe. @@ -82,7 +82,7 @@ O nome de uma propriedade booleana deve ser escolhido com base no **valor padrã A maior parte de componentes controlados, é controlado pelas propriedades `value` e `onChange`, no entanto, o `open` / `onClose` / `onOpen` é uma combinação usada para o estado relacionado à exibição. Nos casos em que há mais eventos, colocamos o substantivo em primeiro lugar e depois o verbo, por exemplo: `onPageChange`, `onRowsChange`. -### booleano vs enumerador +### boolean vs. enum Existem duas opções para projetar a API para as variações de um componente: com um *boolean*; ou com um *enum*. Por exemplo, vamos pegar um botão que tenha tipos diferentes. Cada opção tem seus prós e contras: @@ -107,7 +107,7 @@ Existem duas opções para projetar a API para as variações de um componente: Esta API é mais verbosa: `<Button>`, `<Button variant="contained">`, `<Button variant="fab">`. - No entanto, isso impede que uma combinação inválida seja usada, limita o número de propriedades expostas, e pode facilmente suportar novos valores no futuro. + However, it prevents an invalid combination from being used, bounds the number of props exposed, and can easily support new values in the future. Os componentes do Material-UI usam uma combinação das duas abordagens de acordo com as seguintes regras: diff --git a/docs/src/pages/guides/api/api-ru.md b/docs/src/pages/guides/api/api-ru.md index 98681f36ff54dc..95c86a1522b9cd 100644 --- a/docs/src/pages/guides/api/api-ru.md +++ b/docs/src/pages/guides/api/api-ru.md @@ -38,7 +38,7 @@ We avoid documenting native properties supported by the DOM like [`className`](/ ### CSS Classes -All components accept a [`classes`](/customization/how-to-customize/#overriding-styles-with-classes) prop to customize the styles. The classes design answers two constraints: to make the classes structure as simple as possible, while sufficient to implement the Material Design specification. +All components accept a [`classes`](/customization/how-to-customize/#overriding-styles-with-classes) prop to customize the styles. The classes design answers two constraints: to make the classes structure as simple as possible, while sufficient to implement the Material Design guidelines. - The class applied to the root element is always called `root`. - All the default styles are grouped in a single class. @@ -82,7 +82,7 @@ The name of a boolean property should be chosen based on the **default value**. Большинство управляемых компонентов контролируются параметрами `value` и `onChange`, хотя комбинация `open` / `onClose` / `onOpen` используется с отвечающим за отображение состоянием. Если же событий несколько, то мы ставим в начало существительное, а затем глагол, например: `onPageChange`, `onRowsChange`. -### boolean vs enum +### boolean vs. enum There are two options to design the API for the variations of a component: with a *boolean*; or with an *enum*. For example, let's take a button that has different types. Each option has its pros and cons: @@ -107,7 +107,7 @@ There are two options to design the API for the variations of a component: with This API is more verbose: `<Button>`, `<Button variant="contained">`, `<Button variant="fab">`. - However it prevents an invalid combination from being used, bounds the number of properties exposed, and can easily support new values in the future. + However, it prevents an invalid combination from being used, bounds the number of props exposed, and can easily support new values in the future. The Material-UI components use a combination of the two approaches according to the following rules: diff --git a/docs/src/pages/guides/api/api-zh.md b/docs/src/pages/guides/api/api-zh.md index 4379ac6adeaa52..84afae1926c109 100644 --- a/docs/src/pages/guides/api/api-zh.md +++ b/docs/src/pages/guides/api/api-zh.md @@ -38,7 +38,7 @@ ### CSS classes -为了自定义样式,所有组件都接受 [`classes`](/customization/how-to-customize/#overriding-styles-with-classes) 属性。 类的设计解决了两个约束:使类的结构尽可能简单,同时足以实现 Material Design 的规范。 +为了自定义样式,所有组件都接受 [`classes`](/customization/how-to-customize/#overriding-styles-with-classes) 属性。 The classes design answers two constraints: to make the classes structure as simple as possible, while sufficient to implement the Material Design guidelines. - 应用于根元素的类始终称为 `root`。 - 所有默认样式都分组在单个类中。 @@ -82,7 +82,7 @@ const styles = { 大多数受控组件通过 `value` 和 `onChange` 属性进行控制, 但是, `onChange`/`onClose`/`onOpen` 组合用于显示相关状态。 在事件较多的情况下,我们先放名词,再放动词,例如:`onPageChange`,`onRowsChange`。 -### boolean vs enum +### boolean vs. enum 为组件的变体设计API有两种选择:使用* boolean*; 或者使用* enum *。 比如说,我们选取了一个有着不同类型的按钮组件。 每个选项都有其优缺点: @@ -107,7 +107,7 @@ const styles = { 这个 API 会更加详细:`<Button>`,`<Button variant="contained">`, `<Button variant="fab">`。 - 但是它可以防止无效的组合被使用,约束暴露的属性数量,并且可以在未来轻松支持新的值。 + However, it prevents an invalid combination from being used, bounds the number of props exposed, and can easily support new values in the future. Material-UI 组件根据以下规则将两种方法结合使用: diff --git a/docs/src/pages/guides/composition/composition-de.md b/docs/src/pages/guides/composition/composition-de.md index 9e674c27ca56d9..bcf230509877f9 100644 --- a/docs/src/pages/guides/composition/composition-de.md +++ b/docs/src/pages/guides/composition/composition-de.md @@ -4,7 +4,7 @@ ## Komponenten verpacken -Um maximale Flexibilität und Leistung zu gewährleisten, benötigen wir einen Weg, um die Art der untergeordneten Elemente einer Komponente zu kennen. To solve this problem we tag some of the components with a `muiName` static property when needed. +Um maximale Flexibilität und Leistung zu gewährleisten, benötigen wir einen Weg, um die Art der untergeordneten Elemente einer Komponente zu kennen. To solve this problem, we tag some of the components with a `muiName` static property when needed. You may, however, need to wrap a component in order to enhance it, which can conflict with the `muiName` solution. If you wrap a component, verify if that component has this static property set. @@ -74,16 +74,19 @@ function ListItemLink(props) { The solution is simple: **avoid inline functions and pass a static component to the `component` prop** instead. Let's change the `ListItemLink` component so `CustomLink` always reference the same component: ```tsx -import { Link } from 'react-router-dom'; +import { Link, LinkProps } from 'react-router-dom'; function ListItemLink(props) { const { icon, primary, to } = props; const CustomLink = React.useMemo( () => - React.forwardRef((linkProps, ref) => ( - <Link ref={ref} to={to} {...linkProps} /> - )), + React.forwardRef<HTMLAnchorElement, Omit<RouterLinkProps, 'to'>>(function Link( + linkProps, + ref, + ) { + return <Link ref={ref} to={to} {...linkProps} />; + }), [to], ); @@ -114,22 +117,6 @@ import { Link } from 'react-router-dom'; You can find the details in the [TypeScript guide](/guides/typescript/#usage-of-component-prop). -## Routing libraries - -The integration with third-party routing libraries is achieved with the `component` prop. The behavior is identical to the description of the prop above. Here are a few demos with [react-router-dom](https://github.com/ReactTraining/react-router). They cover the Button, Link, and List components. You can apply the same strategy with all the components (BottomNavigation, Card, etc.). - -### Button - -{{"demo": "pages/guides/composition/ButtonRouter.js"}} - -### Link - -{{"demo": "pages/guides/composition/LinkRouter.js"}} - -### List (liste) - -{{"demo": "pages/guides/composition/ListRouter.js"}} - ## Vorbehalt bei Refs This section covers caveats when using a custom component as `children` or for the `component` prop. diff --git a/docs/src/pages/guides/composition/composition-es.md b/docs/src/pages/guides/composition/composition-es.md index 0442542088945f..e3c4aeeec11002 100644 --- a/docs/src/pages/guides/composition/composition-es.md +++ b/docs/src/pages/guides/composition/composition-es.md @@ -4,7 +4,7 @@ ## Envolviendo componentes -Para proporcionar la máxima flexibilidad y rendimiento, necesitamos una forma de conocer la naturaleza de los elementos secundarios que recibe un componente. Para resolver este problema, etiquetamos algunos de los componentes con una propiedad estática `muiName` cuando es necesario. +Para proporcionar la máxima flexibilidad y rendimiento, necesitamos una forma de conocer la naturaleza de los elementos secundarios que recibe un componente. To solve this problem, we tag some of the components with a `muiName` static property when needed. You may, however, need to wrap a component in order to enhance it, which can conflict with the `muiName` solution. If you wrap a component, verify if that component has this static property set. @@ -74,16 +74,19 @@ function ListItemLink(props) { The solution is simple: **avoid inline functions and pass a static component to the `component` prop** instead. Let's change the `ListItemLink` component so `CustomLink` always reference the same component: ```tsx -import { Link } from 'react-router-dom'; +import { Link, LinkProps } from 'react-router-dom'; function ListItemLink(props) { const { icon, primary, to } = props; const CustomLink = React.useMemo( () => - React.forwardRef((linkProps, ref) => ( - <Link ref={ref} to={to} {...linkProps} /> - )), + React.forwardRef<HTMLAnchorElement, Omit<RouterLinkProps, 'to'>>(function Link( + linkProps, + ref, + ) { + return <Link ref={ref} to={to} {...linkProps} />; + }), [to], ); @@ -114,22 +117,6 @@ import { Link } from 'react-router-dom'; You can find the details in the [TypeScript guide](/guides/typescript/#usage-of-component-prop). -## Routing libraries - -The integration with third-party routing libraries is achieved with the `component` prop. The behavior is identical to the description of the prop above. Here are a few demos with [react-router-dom](https://github.com/ReactTraining/react-router). They cover the Button, Link, and List components. You can apply the same strategy with all the components (BottomNavigation, Card, etc.). - -### Button (Botón) - -{{"demo": "pages/guides/composition/ButtonRouter.js"}} - -### Link - -{{"demo": "pages/guides/composition/LinkRouter.js"}} - -### List - -{{"demo": "pages/guides/composition/ListRouter.js"}} - ## Caveat with refs This section covers caveats when using a custom component as `children` or for the `component` prop. @@ -167,7 +154,7 @@ Only the two most common use cases are covered. For more information see [this s <Tooltip title="Hello, again."><SomeContent /></Tooltip>; ``` -Para averiguar si el componente de Material-UI que estás utilizando tiene este requisito, revisa la documentación de los accesorios de ese componente. If you need to forward refs the description will link to this section. +To find out if the Material-UI component you're using has this requirement, check out the the props API documentation for that component. If you need to forward refs the description will link to this section. ### Caveat with StrictMode diff --git a/docs/src/pages/guides/composition/composition-fr.md b/docs/src/pages/guides/composition/composition-fr.md index 6bf2d3b1e56a3f..9cf284bfa081c5 100644 --- a/docs/src/pages/guides/composition/composition-fr.md +++ b/docs/src/pages/guides/composition/composition-fr.md @@ -114,22 +114,6 @@ import { Link } from 'react-router-dom'; You can find the details in the [TypeScript guide](/guides/typescript/#usage-of-component-prop). -## Routing libraries - -The integration with third-party routing libraries is achieved with the `component` prop. The behavior is identical to the description of the prop above. Here are a few demos with [react-router-dom](https://github.com/ReactTraining/react-router). They cover the Button, Link, and List components. You can apply the same strategy with all the components (BottomNavigation, Card, etc.). - -### Button - -{{"demo": "pages/guides/composition/ButtonRouter.js"}} - -### Link - -{{"demo": "pages/guides/composition/LinkRouter.js"}} - -### List (Liste) - -{{"demo": "pages/guides/composition/ListRouter.js"}} - ## Caveat with refs This section covers caveats when using a custom component as `children` or for the `component` prop. diff --git a/docs/src/pages/guides/composition/composition-ja.md b/docs/src/pages/guides/composition/composition-ja.md index 69ad2f59039235..98bbca01335ba8 100644 --- a/docs/src/pages/guides/composition/composition-ja.md +++ b/docs/src/pages/guides/composition/composition-ja.md @@ -4,9 +4,9 @@ ## ラッピングコンポーネント -最大限の柔軟性とパフォーマンスを提供するために、 コンポーネントが受け取る子要素の性質を知る方法が必要です。 To solve this problem we tag some of the components with a `muiName` static property when needed. 最大限の柔軟性とパフォーマンスを提供するために、 コンポーネントが受け取る子要素の性質を知る方法が必要です。 To solve this problem we tag some of the components with a `muiName` static property when needed. +最大限の柔軟性とパフォーマンスを提供するために、 コンポーネントが受け取る子要素の性質を知る方法が必要です。 To solve this problem, we tag some of the components with a `muiName` static property when needed. -Invalid prop `component` supplied to `ComponentName`. Expected an element type that can hold a ref. +ただし、拡張するためにコンポーネントをラップする必要がある場合があり、これは`muiName`ソリューションと競合する可能性があります。 コンポーネントをラップする場合は、そのコンポーネントにこの静的プロパティーが設定されているかどうかを確認します。 To find out if the Material-UI component you're using has this requirement, check out the the props API documentation for that component. さらに、親コンポーネントがラップされたコンポーネントプロパティをコントロールする必要がある場合があるため、プロパティを転送する必要があります。 @@ -19,19 +19,19 @@ WrappedIcon.muiName = Icon.muiName; {{"demo": "pages/guides/composition/Composition.js"}} -## Component prop +## Component プロパティ -Material-UI allows you to change the root element that will be rendered via a prop called `component`. +Material-UIは、`component`プロパティによって、レンダリングされるルート要素を変更することが可能です。 ### どのように機能しますか? -The custom component will be rendered by Material-UI like this: +カスタマイズされたコンポーネントは Material-UI によって次にようにレンダリングされます。 ```js return React.createElement(props.component, props) ``` -For example, by default a `List` component will render a `<ul>` element. This can be changed by passing a [React component](https://reactjs.org/docs/components-and-props.html#function-and-class-components) to the `component` prop. The following example will render the `List` component with a `<nav>` element as root element instead: +例えば、 デフォルトの`List`コンポーネントは、 `<ul>` 要素をレンダリングしますが、 これは[Reactのコンポーネント](https://reactjs.org/docs/components-and-props.html#function-and-class-components)に `component`プロパティを渡すことで変更できます。 次の例は、 `List` コンポーネントのルート要素を`<nav>` 要素としてレンダリングします。 ```jsx <List component="nav"> @@ -44,9 +44,9 @@ For example, by default a `List` component will render a `<ul>` element. This ca </List> ``` -This pattern is very powerful and allows for great flexibility, as well as a way to interoperate with other libraries, such as your favorite routing or forms library. But it also **comes with a small caveat!** +この手法は非常に強力であり、あなたが使用したいと思っているルーティングやフォームなどの他のライブラリとの相互利用を可能とする優れた柔軟性を持っています。 しかし、 これには、**小さな警告を伴います!** -### インラインのある警告 +### インラインについての注意 Using an inline function as an argument for the `component` prop may result in **unexpected unmounting**, since a new component is passed every time React renders. Not only will React update the DOM unnecessarily, the ripple effect of the `ListItem` will also not work correctly. @@ -69,21 +69,24 @@ function ListItemLink(props) { } ``` -⚠️ However, since we are using an inline function to change the rendered component, React will unmount the link every time `ListItemLink` is rendered. Not only will React update the DOM unnecessarily, the ripple effect of the `ListItem` will also not work correctly. +⚠️ しかし、レンダリングされたコンポーネントを変更するためにインライン関数を使用している事から、React は `ListItemLink` がレンダリングされるたびにリンクのマウントを解除します。 ReactがDOMを不必要に更新するだけでなく、 `ListItem`の変更の波及も正しく動作しません。 -The solution is simple: **avoid inline functions and pass a static component to the `component` prop** instead. Let's change the `ListItemLink` component so `CustomLink` always reference the same component: +解決方法はシンプルです。インライン関数を避け、代わりに、**静的なコンポーネントを`component` プロパティに渡します。** `CustomLink` が常に、同じコンポーネントを参照できるように、`ListItemLink` コンポーネントを変更しましょう。 ```tsx -import { Link } from 'react-router-dom'; +import { Link, LinkProps } from 'react-router-dom'; function ListItemLink(props) { const { icon, primary, to } = props; const CustomLink = React.useMemo( () => - React.forwardRef((linkProps, ref) => ( - <Link ref={ref} to={to} {...linkProps} /> - )), + React.forwardRef<HTMLAnchorElement, Omit<RouterLinkProps, 'to'>>(function Link( + linkProps, + ref, + ) { + return <Link ref={ref} to={to} {...linkProps} />; + }), [to], ); @@ -98,9 +101,9 @@ function ListItemLink(props) { } ``` -### Caveat with prop forwarding +### プロパティ転送についての注意 -You can take advantage of the prop forwarding to simplify the code. In this example, we don't create any intermediary component: +プロパティの転送を利用して、コードをシンプルにする事ができます。 この例では、中間コンポーネントを作成しません。 ```jsx import { Link } from 'react-router-dom'; @@ -108,33 +111,17 @@ import { Link } from 'react-router-dom'; <ListItem button component={Link} to="/"> ``` -⚠️ However, this strategy suffers from a limitation: prop collisions. The component providing the `component` prop (e.g. ListItem) might not forward all the props (for example dense) to the root element. - -### With TypeScript - -You can find the details in the [TypeScript guide](/guides/typescript/#usage-of-component-prop). - -## Routing libraries - -The integration with third-party routing libraries is achieved with the `component` prop. The behavior is identical to the description of the prop above. Here are a few demos with [react-router-dom](https://github.com/ReactTraining/react-router). They cover the Button, Link, and List components. You can apply the same strategy with all the components (BottomNavigation, Card, etc.). - -### Button (ボタン) - -{{"demo": "pages/guides/composition/ButtonRouter.js"}} - -### Link - -{{"demo": "pages/guides/composition/LinkRouter.js"}} +しかし、この方法はプロパティの衝突から制限されます。 `component`プロパティを持つコンポーネントは、すべてのプロパティ(例:dense)をルート要素へ転送するわけではありません。 -### List (リスト) +### TypeScriptの使用 -{{"demo": "pages/guides/composition/ListRouter.js"}} +詳細については、[TypeScript guide](/guides/typescript/#usage-of-component-prop)を参照してください。 -## Caveat with refs +## refsについての注意 -This section covers caveats when using a custom component as `children` or for the `component` prop. +このセクションでは、カスタムコンポーネントを `子要素` または `component` プロパティとして使用する場合の注意点について説明します。 -Some of the components need access to the DOM node. This was previously possible by using `ReactDOM.findDOMNode`. This function is deprecated in favor of `ref` and ref forwarding. However, only the following component types can be given a `ref`: +一部のコンポーネントは DOM ノードにアクセスする必要があります。 以前は `ReactDOM.findDOMNode` を使用することで可能でしたが、 この関数は `ref` とrefの転送の登場から、非推奨となっています。 ただし、 `ref` が与えられるコンポーネント型は次のものだけです。 - Any Material-UI component - class components i.e. `React.Component` or `React.PureComponent` diff --git a/docs/src/pages/guides/composition/composition-pt.md b/docs/src/pages/guides/composition/composition-pt.md index f08bebb870c146..7c49ee81e9df40 100644 --- a/docs/src/pages/guides/composition/composition-pt.md +++ b/docs/src/pages/guides/composition/composition-pt.md @@ -4,7 +4,7 @@ ## Encapsulando componentes -Para fornecer o máximo de flexibilidade e desempenho, precisamos de uma maneira de conhecer a natureza dos elementos filhos que um componente recebe. Para resolver esse problema, quando necessário, identificamos alguns dos componentes com uma propriedade estática `muiName`. +Para fornecer o máximo de flexibilidade e desempenho, precisamos de uma maneira de conhecer a natureza dos elementos filhos que um componente recebe. To solve this problem, we tag some of the components with a `muiName` static property when needed. Você pode, no entanto, precisar encapsular um componente para melhorá-lo, o que pode entrar em conflito com a solução `muiName`. Se você encapsular um componente, verifique se ele tem esta propriedade estática definida. @@ -73,16 +73,19 @@ function ListItemLink(props) { A solução é simples: **evite funções em linha e passe um componente estático para a propriedade `component`**. Vamos mudar o componente `ListItemLink` para que `CustomLink` sempre referencie o mesmo componente: ```tsx -import { Link } from 'react-router-dom'; +import { Link, LinkProps } from 'react-router-dom'; function ListItemLink(props) { const { icon, primary, to } = props; const CustomLink = React.useMemo( () => - React.forwardRef((linkProps, ref) => ( - <Link ref={ref} to={to} {...linkProps} /> - )), + React.forwardRef<HTMLAnchorElement, Omit<RouterLinkProps, 'to'>>(function Link( + linkProps, + ref, + ) { + return <Link ref={ref} to={to} {...linkProps} />; + }), [to], ); @@ -113,22 +116,6 @@ import { Link } from 'react-router-dom'; Você pode encontrar os detalhes no [guia TypeScript](/guides/typescript/#usage-of-component-prop). -## Bibliotecas de roteamento - -A integração com bibliotecas de roteamento de terceiros é resolvida com a propriedade `component`. O comportamento é idêntico à descrição da propriedade acima. Aqui estão algumas demonstrações com [react-router-dom](https://github.com/ReactTraining/react-router). Elas cobrem os componentes Button, Link e List. Você pode aplicar a mesma estratégia com todos os componentes (BottomNavigation, Card, etc.). - -### Button - -{{"demo": "pages/guides/composition/ButtonRouter.js"}} - -### Link - -{{"demo": "pages/guides/composition/LinkRouter.js"}} - -### Lista - -{{"demo": "pages/guides/composition/ListRouter.js"}} - ## Advertência com refs Esta seção aborda advertências ao usar um componente customizado como `children` ou para a propriedade `component`. diff --git a/docs/src/pages/guides/composition/composition-ru.md b/docs/src/pages/guides/composition/composition-ru.md index 1cdbc6dba9c16a..41cea491a8d9a4 100644 --- a/docs/src/pages/guides/composition/composition-ru.md +++ b/docs/src/pages/guides/composition/composition-ru.md @@ -4,7 +4,7 @@ ## Wrapping components -In order to provide the maximum flexibility and performance, we need a way to know the nature of the child elements a component receives. To solve this problem we tag some of the components with a `muiName` static property when needed. +In order to provide the maximum flexibility and performance, we need a way to know the nature of the child elements a component receives. To solve this problem, we tag some of the components with a `muiName` static property when needed. You may, however, need to wrap a component in order to enhance it, which can conflict with the `muiName` solution. If you wrap a component, verify if that component has this static property set. @@ -73,16 +73,19 @@ function ListItemLink(props) { The solution is simple: **avoid inline functions and pass a static component to the `component` prop** instead. Let's change the `ListItemLink` component so `CustomLink` always reference the same component: ```tsx -import { Link } from 'react-router-dom'; +import { Link, LinkProps } from 'react-router-dom'; function ListItemLink(props) { const { icon, primary, to } = props; const CustomLink = React.useMemo( () => - React.forwardRef((linkProps, ref) => ( - <Link ref={ref} to={to} {...linkProps} /> - )), + React.forwardRef<HTMLAnchorElement, Omit<RouterLinkProps, 'to'>>(function Link( + linkProps, + ref, + ) { + return <Link ref={ref} to={to} {...linkProps} />; + }), [to], ); @@ -113,22 +116,6 @@ import { Link } from 'react-router-dom'; You can find the details in the [TypeScript guide](/guides/typescript/#usage-of-component-prop). -## Routing libraries - -The integration with third-party routing libraries is achieved with the `component` prop. The behavior is identical to the description of the prop above. Here are a few demos with [react-router-dom](https://github.com/ReactTraining/react-router). They cover the Button, Link, and List components. You can apply the same strategy with all the components (BottomNavigation, Card, etc.). - -### Button - -{{"demo": "pages/guides/composition/ButtonRouter.js"}} - -### Link - -{{"demo": "pages/guides/composition/LinkRouter.js"}} - -### Список - -{{"demo": "pages/guides/composition/ListRouter.js"}} - ## Caveat with refs This section covers caveats when using a custom component as `children` or for the `component` prop. diff --git a/docs/src/pages/guides/composition/composition-zh.md b/docs/src/pages/guides/composition/composition-zh.md index 4f915edc15a634..5e9c9e114c7295 100644 --- a/docs/src/pages/guides/composition/composition-zh.md +++ b/docs/src/pages/guides/composition/composition-zh.md @@ -4,7 +4,7 @@ ## 封装组件 -我们需要一种了解组件接收的子元素的本质的方式,这样可以尽可能提供最大的灵活性和最好的性能。 我们会用 `muiName` 静态属性来标记一些我们的组件,这样能够解决这个问题。 +我们需要一种了解组件接收的子元素的本质的方式,这样可以尽可能提供最大的灵活性和最好的性能。 To solve this problem, we tag some of the components with a `muiName` static property when needed. 但是,您仍可能需要封装一个组件以增强它的功能,而这可能与 `muiName` 的解决方案相冲突。 若你要封装一个组件,那么得验证该组件是否具有此静态属性的集合。 @@ -74,16 +74,19 @@ function ListItemLink(props) { 解决方案很简单: **避免内联函数,取而代之的是将一个静态组件传递给 `component` 属性**。 我们可以改变 `ListItemLink` 组件,这样一来 `CustomLink` 总是引用相同的组件: ```tsx -import { Link } from 'react-router-dom'; +import { Link, LinkProps } from 'react-router-dom'; function ListItemLink(props) { const { icon, primary, to } = props; const CustomLink = React.useMemo( () => - React.forwardRef((linkProps, ref) => ( - <Link ref={ref} to={to} {...linkProps} /> - )), + React.forwardRef<HTMLAnchorElement, Omit<RouterLinkProps, 'to'>>(function Link( + linkProps, + ref, + ) { + return <Link ref={ref} to={to} {...linkProps} />; + }), [to], ); @@ -114,22 +117,6 @@ import { Link } from 'react-router-dom'; 您可以在 [TypeScript 指南](/guides/typescript/#usage-of-component-prop) 中找到详细信息 。 -## 路由库 - -通过 `component` 属性实现了与第三方路由库的整合。 该行为与上面的属性描述完全相同。 以下是一些 [react-router-dom](https://github.com/ReactTraining/react-router) 的示例: 这几个示例涵盖了按钮,链接和列表组件。 你可以对所有的组件(BottomNavigation,Card 等)使用同样的方式来整合它。 - -### Button - -{{"demo": "pages/guides/composition/ButtonRouter.js"}} - -### Link - -{{"demo": "pages/guides/composition/LinkRouter.js"}} - -### Lists(列表) - -{{"demo": "pages/guides/composition/ListRouter.js"}} - ## 使用 refs 时的一些注意事项 本节介绍了将一个自定义组件用作`子组件`或 作为 `component` 的属性时的一些注意事项。 @@ -167,7 +154,7 @@ import { Link } from 'react-router-dom'; <Tooltip title="Hello, again."><SomeContent /></Tooltip>; ``` -要确定你使用的 Material-UI 组件是否具有此要求,请查阅该组件的 props API 文档。 如果您需要转递 refs,描述会关联到此章节。 +要确定您使用的Material-UI组件是否具有此需求,请查阅该组件的props API文档。 如果您需要转递 refs,描述会关联到此章节。 ### 使用 StrictMode 的注意事项 diff --git a/docs/src/pages/guides/content-security-policy/content-security-policy-de.md b/docs/src/pages/guides/content-security-policy/content-security-policy-de.md index 84b5833ccfa55f..59e7fd25542184 100644 --- a/docs/src/pages/guides/content-security-policy/content-security-policy-de.md +++ b/docs/src/pages/guides/content-security-policy/content-security-policy-de.md @@ -52,9 +52,9 @@ You should pass the nonce in the `<style>` tag on the server. JSS will then, by convention, look for a `<meta property="csp-nonce"` tag and use the `content` value as the nonce. -The way that you do this is by passing a `<meta property="csp-nonce" content={nonce} />` tag in the `<head>` of your HTML. JSS will then, by convention, look for a `<meta property="csp-nonce"` tag and use the `content` value as the nonce. +Die Art und Weise, wie Sie dies tun, besteht darin, ein `<meta property="csp-nonce" content={nonce} />`Tag im `<head>`ihren HTML-Codes zu Übergebe. JSS wird dann nach einem `<meta property="csp-nonce"`Tag und Suchen den`inhalt` wert als Nonce Verwenden. -Here is an example of what a fictional header could look like: +Hier ist ein Beispiel, wie ein fiktiver Header aussehen könnte: ```html <head> diff --git a/docs/src/pages/guides/content-security-policy/content-security-policy-fr.md b/docs/src/pages/guides/content-security-policy/content-security-policy-fr.md index 1f895762fa9dae..e6970e218bc01a 100644 --- a/docs/src/pages/guides/content-security-policy/content-security-policy-fr.md +++ b/docs/src/pages/guides/content-security-policy/content-security-policy-fr.md @@ -1,10 +1,10 @@ # Politique de sécurité du contenu (CSP) -<p class="description">This section covers the details of setting up a CSP.</p> +<p class="description">Cette section couvre les détails de la mise en place d'un CSP.</p> ## Qu'est-ce que le CSP et en quoi est-ce utile ? -CSP mitigates cross-site scripting (XSS) attacks by requiring developers to whitelist the sources their assets are retrieved from. Cette liste est renvoyée en tant qu'en-tête du serveur. Par exemple, disons que vous avez un site hébergé à `https://example.com` l'en-tête CSP `default-src: 'self';` autorisera toutes les requêtes à destination de `https://example.com/*` et refusera tous les autres. Si une section de votre site Web est vulnérable au XSS dans laquelle une entrée d'utilisateur non échappée est affichée, un attaquant pourrait saisir quelque chose du genre : +CSP atténue les attaques de scripts intersites (XSS) en obligeant les développeurs à mettre sur liste blanche les sources à partir desquelles leurs actifs sont récupérés. Cette liste est renvoyée en tant qu'en-tête du serveur. Par exemple, disons que vous avez un site hébergé à `https://example.com` l'en-tête CSP `default-src: 'self';` autorisera toutes les requêtes à destination de `https://example.com/*` et refusera tous les autres. Si une section de votre site Web est vulnérable au XSS dans laquelle une entrée d'utilisateur non échappée est affichée, un attaquant pourrait saisir quelque chose du genre : ```html <script> @@ -18,9 +18,9 @@ You can read more about CSP on the [MDN Web Docs](https://developer.mozilla.org/ ## Comment met-on en place un CSP? -### Server-Side Rendering (SSR) +### Rendu côté serveur (SSR) -To use CSP with Material-UI (and JSS), you need to use a nonce. A nonce is a randomly generated string that is only used once, therefore you need to add server middleware to generate one on each request. JSS a un [ excellent tutoriel ](https://github.com/cssinjs/jss/blob/master/docs/csp.md) comment y parvenir avec Express et React Helmet. Pour un aperçu de base, continuez à lire. +Pour utiliser CSP avec Material-UI (et JSS), vous devez utiliser un nonce. A nonce is a randomly generated string that is only used once, therefore you need to add server middleware to generate one on each request. JSS a un [ excellent tutoriel ](https://github.com/cssinjs/jss/blob/master/docs/csp.md) comment y parvenir avec Express et React Helmet. Pour un aperçu de base, continuez à lire. Un nonce CSP est une chaîne codée en Base 64. Vous pouvez en générer un comme ceci: @@ -30,7 +30,7 @@ import uuidv4 from 'uuid/v4'; const nonce = new Buffer(uuidv4()).toString('base64'); ``` -You must use UUID version 4, as it generates an **unpredictable** string. Vous appliquez ensuite ce nonce à l'en-tête CSP. Un en-tête CSP pourrait ressembler à ceci avec le nonce appliqué: +Vous devez utiliser l'UUID version 4, car il génère une chaîne **imprévisible**. Vous appliquez ensuite ce nonce à l'en-tête CSP. Un en-tête CSP pourrait ressembler à ceci avec le nonce appliqué: ```js header('Content-Security-Policy').set( @@ -38,7 +38,7 @@ header('Content-Security-Policy').set( ); ``` -You should pass the nonce in the `<style>` tag on the server. +Vous devez passer le nonce dans la balise `<style>` sur le serveur. ```jsx <style @@ -62,8 +62,8 @@ Here is an example of what a fictional header could look like: </head> ``` -### Create React App (CRA) +### Créer une application React (CRA) -According to the [Create React App Docs](https://create-react-app.dev/docs/advanced-configuration/), a Create React App will dynamically embed the runtime script into index.html during the production build by default. This will require a new hash to be set in your CSP during each deployment. +Selon les [Create React App Docs](https://create-react-app.dev/docs/advanced-configuration/), une Create React App intégrera dynamiquement le script d'exécution dans index.html lors de la génération de production par défaut. Cela nécessitera la définition d'un nouveau hachage dans votre CSP lors de chaque déploiement. -To use a CSP with a project initialized as a Create React App, you will need to set the `INLINE_RUNTIME_CHUNK=false` variable in the `.env` file used for your production build. This will import the runtime script as usual instead of embedding it, avoiding the need to set a new hash during each deployment. +Pour utiliser un CSP avec un projet initialisé en tant qu'application Create React, vous devrez définir la variable `INLINE_RUNTIME_CHUNK=false` dans le fichier `.env` utilisé pour votre build de production. Cela importera le script d'exécution comme d'habitude au lieu de l'incorporer, évitant ainsi d'avoir à définir un nouveau hachage lors de chaque déploiement. diff --git a/docs/src/pages/guides/interoperability/interoperability-de.md b/docs/src/pages/guides/interoperability/interoperability-de.md index 1b93327ce72fef..52e69e09fa6587 100644 --- a/docs/src/pages/guides/interoperability/interoperability-de.md +++ b/docs/src/pages/guides/interoperability/interoperability-de.md @@ -52,7 +52,13 @@ export default function PlainCssSlider() { **Note:** Most CSS-in-JS solutions inject their styles at the bottom of the HTML `<head>`, which gives Material-UI precedence over your custom styles. To remove the need for **!important**, you need to change the CSS injection order. Here's a demo of how it can be done in Material-UI: ```jsx -Now you can override Material-UI's styles. import * as React from 'react'; +import * as React from 'react'; +import { StyledEngineProvider } from '@material-ui/core/styles'; + +export default function GlobalCssPriority() { + return ( + <StyledEngineProvider injectFirst> + {/* Your component tree. import * as React from 'react'; import { StylesProvider } from '@material-ui/core'; export default function GlobalCssPriority() { @@ -68,17 +74,11 @@ export default function GlobalCssPriority() { ```jsx import * as React from 'react'; -import { CacheProvider } from '@emotion/react'; -import createCache from '@emotion/cache'; - -const cache = createCache({ - key: 'css', - prepend: true, -}); +import { StylesProvider } from '@material-ui/core'; -export default function PlainCssPriority() { +export default function GlobalCssPriority() { return ( - <CacheProvider value={cache}> + <StylesProvider injectFirst> {/* Your component tree. import * as React from 'react'; import { StylesProvider } from '@material-ui/core'; @@ -86,7 +86,7 @@ export default function GlobalCssPriority() { return ( <StylesProvider injectFirst> {/* Your component tree. */} - </CacheProvider> + </StylesProvider> ); } ``` @@ -208,7 +208,13 @@ export default function GlobalCssSlider() { **Note:** Most CSS-in-JS solutions inject their styles at the bottom of the HTML `<head>`, which gives Material-UI precedence over your custom styles. To remove the need for **!important**, you need to change the CSS injection order. Here's a demo of how it can be done in Material-UI: ```jsx -Now you can override Material-UI's styles. import * as React from 'react'; +import * as React from 'react'; +import { StyledEngineProvider } from '@material-ui/core/styles'; + +export default function GlobalCssPriority() { + return ( + <StyledEngineProvider injectFirst> + {/* Your component tree. import * as React from 'react'; import { StylesProvider } from '@material-ui/core'; export default function GlobalCssPriority() { @@ -242,7 +248,7 @@ export default function GlobalCssPriority() { return ( <StylesProvider injectFirst> {/* Your component tree. */} - </CacheProvider> + </StylesProvider> ); } ``` @@ -287,13 +293,13 @@ export default function GlobalCssSliderDeep() { ## Styled Components -![stars](https://img.shields.io/github/stars/styled-components/styled-components.svg?style=social&label=Star) ![npm](https://img.shields.io/npm/dm/styled-components.svg?) +![sterne](https://img.shields.io/github/stars/styled-components/styled-components.svg?style=social&label=Star) ![npm](https://img.shields.io/npm/dm/styled-components.svg) ### Change the default styled engine By default, Material-UI components come with emotion as their style engine. If, however, you would like to use `styled-components`, you can configure your app by following this [example project](https://github.com/mui-org/material-ui/blob/next/examples/create-react-app-with-styled-components). Following this approach reduces the bundle size, and removes the need to configure the CSS injection order. -After the style engine is configured properly, you can use the `styled()` utility from `@material-ui/core/styles` and have direct access to the theme. +After the style engine is configured properly, you can use the [`styled()`](/customization/styled/) utility from `@material-ui/core/styles` and have direct access to the theme. {{"demo": "pages/guides/interoperability/StyledComponents.js", "hideToolbar": true}} @@ -323,34 +329,7 @@ If you attempt to style the Slider, you will likely need to affect some of the S The following examples override the slider's `thumb` style in addition to the custom styles on the slider itself. -{{"demo": "pages/guides/interoperability/StyledComponentsDeep.js", "defaultCodeOpen": false}} - -```jsx -import * as React from 'react'; -import Slider from '@material-ui/core/Slider'; -import { styled } from '@material-ui/core/styles'; - -const CustomizedSlider = styled(Slider)` - color: #20b2aa; - - :hover { - color: #2e8b57; - } - - & .MuiSlider-thumb { - border-radius: 1px; - } -`; - -export default function StyledComponentsDeep1() { - return ( - <div> - <Slider defaultValue={30} /> - <CustomizedSlider defaultValue={30} /> - </div> - ); -} -``` +{{"demo": "pages/guides/interoperability/StyledComponentsDeep.js", "defaultCodeOpen": true}} The above demo relies on the [default `className` values](/styles/advanced/#with-material-ui-core), but you can provide your own class name with the `componentsProps` API. @@ -407,11 +386,30 @@ const CustomizedSlider = styled(Slider)( ### Portale -TODO: fill this section after the portal is implemented with the new styled engine. +The [Portal](/components/portal/) provides a first-class way to render children into a DOM node that exists outside the DOM hierarchy of the parent component. Aufgrund der Art und Weise, in der styled-components das CSS erfasst, können Probleme auftreten, bei denen das Styling nicht angewendet wird. + +For example, if you attempt to style the `tooltip` generated by the [Tooltip](/components/tooltip/) component, you will need to pass along the `className` property to the element being rendered outside of it's DOM hierarchy. Das folgende Beispiel zeigt eine Problemumgehung: + +```jsx +import * as React from 'react'; +import { styled } from '@material-ui/core/styles'; +import Button from '@material-ui/core/Button'; +import Tooltip from '@material-ui/core/Tooltip'; + +const StyledTooltip = styled(({ className, ...props }) => ( + <Tooltip {...props} classes={{ popper: className }} /> +))` + & .MuiTooltip-tooltip { + background: navy; + } +`; +``` + +{{"demo": "pages/guides/interoperability/StyledComponentsPortal.js"}} ## CSS Modules -![stars](https://img.shields.io/github/stars/css-modules/css-modules.svg?style=social&label=Star) +![sterne](https://img.shields.io/github/stars/css-modules/css-modules.svg?style=social&label=Star) Es ist schwer zu wissen, welchen Marktanteil [diese Styling-Lösung](https://github.com/css-modules/css-modules) hat, da es von der Bündelungslösung, die die Leute verwenden abhängig ist. @@ -454,7 +452,13 @@ export default function CssModulesSlider() { **Note:** Most CSS-in-JS solutions inject their styles at the bottom of the HTML `<head>`, which gives Material-UI precedence over your custom styles. To remove the need for **!important**, you need to change the CSS injection order. Here's a demo of how it can be done in Material-UI: ```jsx -Now you can override Material-UI's styles. import * as React from 'react'; +import * as React from 'react'; +import { StyledEngineProvider } from '@material-ui/core/styles'; + +export default function GlobalCssPriority() { + return ( + <StyledEngineProvider injectFirst> + {/* Your component tree. import * as React from 'react'; import { StylesProvider } from '@material-ui/core'; export default function GlobalCssPriority() { @@ -488,7 +492,7 @@ export default function GlobalCssPriority() { return ( <StylesProvider injectFirst> {/* Your component tree. */} - </CacheProvider> + </StylesProvider> ); } ``` @@ -579,39 +583,13 @@ export default function CssModulesSliderDeep2() { ## Emotion -![stars](https://img.shields.io/github/stars/emotion-js/emotion.svg?style=social&label=Star) ![npm](https://img.shields.io/npm/dm/emotion.svg?) +![sterne](https://img.shields.io/github/stars/emotion-js/emotion.svg?style=social&label=Star) ![npm](https://img.shields.io/npm/dm/@emotion/react.svg) ### Die `css` Eigenschaft Die Emotion **css()** Methode funktioniert nahtlos mit der Material-UI. -{{"demo": "pages/guides/interoperability/EmotionCSS.js", "hideToolbar": true}} - -[![Edit Button](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/emotion-interoperability-idymy) - -```jsx -/** @jsx jsx */ -import { jsx, css } from '@emotion/react'; -import Slider from '@material-ui/core/Slider'; - -export default function EmotionCSS() { - return ( - <div> - <Slider defaultValue={30} /> - <Slider - defaultValue={30} - css={css` - color: #20b2aa; - - :hover { - color: #2e8b57; - } - `} - /> - </div> - ); -} -``` +{{"demo": "pages/guides/interoperability/EmotionCSS.js", "defaultCodeOpen": true}} ### Theme diff --git a/docs/src/pages/guides/interoperability/interoperability-es.md b/docs/src/pages/guides/interoperability/interoperability-es.md index 226f5ecc25bf8d..7d4b29a5ed1579 100644 --- a/docs/src/pages/guides/interoperability/interoperability-es.md +++ b/docs/src/pages/guides/interoperability/interoperability-es.md @@ -52,7 +52,13 @@ export default function PlainCssSlider() { **Note:** Most CSS-in-JS solutions inject their styles at the bottom of the HTML `<head>`, which gives Material-UI precedence over your custom styles. To remove the need for **!important**, you need to change the CSS injection order. Here's a demo of how it can be done in Material-UI: ```jsx -Now you can override Material-UI's styles. import * as React from 'react'; +import * as React from 'react'; +import { StyledEngineProvider } from '@material-ui/core/styles'; + +export default function GlobalCssPriority() { + return ( + <StyledEngineProvider injectFirst> + {/* Your component tree. import * as React from 'react'; import { StylesProvider } from '@material-ui/core'; export default function GlobalCssPriority() { @@ -68,17 +74,11 @@ export default function GlobalCssPriority() { ```jsx import * as React from 'react'; -import { CacheProvider } from '@emotion/react'; -import createCache from '@emotion/cache'; - -const cache = createCache({ - key: 'css', - prepend: true, -}); +import { StylesProvider } from '@material-ui/core'; -export default function PlainCssPriority() { +export default function GlobalCssPriority() { return ( - <CacheProvider value={cache}> + <StylesProvider injectFirst> {/* Your component tree. import * as React from 'react'; import { StylesProvider } from '@material-ui/core'; @@ -86,7 +86,7 @@ export default function GlobalCssPriority() { return ( <StylesProvider injectFirst> {/* Your component tree. */} - </CacheProvider> + </StylesProvider> ); } ``` @@ -208,7 +208,13 @@ export default function GlobalCssSlider() { **Note:** Most CSS-in-JS solutions inject their styles at the bottom of the HTML `<head>`, which gives Material-UI precedence over your custom styles. To remove the need for **!important**, you need to change the CSS injection order. Here's a demo of how it can be done in Material-UI: ```jsx -Now you can override Material-UI's styles. import * as React from 'react'; +import * as React from 'react'; +import { StyledEngineProvider } from '@material-ui/core/styles'; + +export default function GlobalCssPriority() { + return ( + <StyledEngineProvider injectFirst> + {/* Your component tree. import * as React from 'react'; import { StylesProvider } from '@material-ui/core'; export default function GlobalCssPriority() { @@ -242,7 +248,7 @@ export default function GlobalCssPriority() { return ( <StylesProvider injectFirst> {/* Your component tree. */} - </CacheProvider> + </StylesProvider> ); } ``` @@ -287,13 +293,13 @@ export default function GlobalCssSliderDeep() { ## Styled Components -![estrellas](https://img.shields.io/github/stars/styled-components/styled-components.svg?style=social&label=Star) ![npm](https://img.shields.io/npm/dm/styled-components.svg?) +![estrellas](https://img.shields.io/github/stars/styled-components/styled-components.svg?style=social&label=Star) ![npm](https://img.shields.io/npm/dm/styled-components.svg) ### Change the default styled engine By default, Material-UI components come with emotion as their style engine. If, however, you would like to use `styled-components`, you can configure your app by following this [example project](https://github.com/mui-org/material-ui/blob/next/examples/create-react-app-with-styled-components). Following this approach reduces the bundle size, and removes the need to configure the CSS injection order. -After the style engine is configured properly, you can use the `styled()` utility from `@material-ui/core/styles` and have direct access to the theme. +After the style engine is configured properly, you can use the [`styled()`](/customization/styled/) utility from `@material-ui/core/styles` and have direct access to the theme. {{"demo": "pages/guides/interoperability/StyledComponents.js", "hideToolbar": true}} @@ -323,34 +329,7 @@ If you attempt to style the Slider, you will likely need to affect some of the S The following examples override the slider's `thumb` style in addition to the custom styles on the slider itself. -{{"demo": "pages/guides/interoperability/StyledComponentsDeep.js", "defaultCodeOpen": false}} - -```jsx -import * as React from 'react'; -import Slider from '@material-ui/core/Slider'; -import { styled } from '@material-ui/core/styles'; - -const CustomizedSlider = styled(Slider)` - color: #20b2aa; - - :hover { - color: #2e8b57; - } - - & .MuiSlider-thumb { - border-radius: 1px; - } -`; - -export default function StyledComponentsDeep1() { - return ( - <div> - <Slider defaultValue={30} /> - <CustomizedSlider defaultValue={30} /> - </div> - ); -} -``` +{{"demo": "pages/guides/interoperability/StyledComponentsDeep.js", "defaultCodeOpen": true}} The above demo relies on the [default `className` values](/styles/advanced/#with-material-ui-core), but you can provide your own class name with the `componentsProps` API. @@ -407,7 +386,26 @@ const CustomizedSlider = styled(Slider)( ### Portals -TODO: fill this section after the portal is implemented with the new styled engine. +The [Portal](/components/portal/) provides a first-class way to render children into a DOM node that exists outside the DOM hierarchy of the parent component. Because of the way styled-components scopes its CSS, you may run into issues where styling is not applied. + +For example, if you attempt to style the `tooltip` generated by the [Tooltip](/components/tooltip/) component, you will need to pass along the `className` property to the element being rendered outside of it's DOM hierarchy. The following example shows a workaround: + +```jsx +import * as React from 'react'; +import { styled } from '@material-ui/core/styles'; +import Button from '@material-ui/core/Button'; +import Tooltip from '@material-ui/core/Tooltip'; + +const StyledTooltip = styled(({ className, ...props }) => ( + <Tooltip {...props} classes={{ popper: className }} /> +))` + & .MuiTooltip-tooltip { + background: navy; + } +`; +``` + +{{"demo": "pages/guides/interoperability/StyledComponentsPortal.js"}} ## CSS Modules @@ -454,7 +452,13 @@ export default function CssModulesSlider() { **Note:** Most CSS-in-JS solutions inject their styles at the bottom of the HTML `<head>`, which gives Material-UI precedence over your custom styles. To remove the need for **!important**, you need to change the CSS injection order. Here's a demo of how it can be done in Material-UI: ```jsx -Now you can override Material-UI's styles. import * as React from 'react'; +import * as React from 'react'; +import { StyledEngineProvider } from '@material-ui/core/styles'; + +export default function GlobalCssPriority() { + return ( + <StyledEngineProvider injectFirst> + {/* Your component tree. import * as React from 'react'; import { StylesProvider } from '@material-ui/core'; export default function GlobalCssPriority() { @@ -488,7 +492,7 @@ export default function GlobalCssPriority() { return ( <StylesProvider injectFirst> {/* Your component tree. */} - </CacheProvider> + </StylesProvider> ); } ``` @@ -579,39 +583,13 @@ export default function CssModulesSliderDeep2() { ## Emotion -![estrellas](https://img.shields.io/github/stars/emotion-js/emotion.svg?style=social&label=Star) ![npm](https://img.shields.io/npm/dm/emotion.svg?) +![estrellas](https://img.shields.io/github/stars/emotion-js/emotion.svg?style=social&label=Star) ![npm](https://img.shields.io/npm/dm/@emotion/react.svg) ### The `css` prop Emotion's **css()** method works seamlessly with Material-UI. -{{"demo": "pages/guides/interoperability/EmotionCSS.js", "hideToolbar": true}} - -[![Edit Button](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/emotion-interoperability-idymy) - -```jsx -/** @jsx jsx */ -import { jsx, css } from '@emotion/react'; -import Slider from '@material-ui/core/Slider'; - -export default function EmotionCSS() { - return ( - <div> - <Slider defaultValue={30} /> - <Slider - defaultValue={30} - css={css` - color: #20b2aa; - - :hover { - color: #2e8b57; - } - `} - /> - </div> - ); -} -``` +{{"demo": "pages/guides/interoperability/EmotionCSS.js", "defaultCodeOpen": true}} ### Tema diff --git a/docs/src/pages/guides/interoperability/interoperability-fr.md b/docs/src/pages/guides/interoperability/interoperability-fr.md index 5f762f7eb0594e..be45c3a0b36f05 100644 --- a/docs/src/pages/guides/interoperability/interoperability-fr.md +++ b/docs/src/pages/guides/interoperability/interoperability-fr.md @@ -52,7 +52,13 @@ export default function PlainCssSlider() { **Note:** Most CSS-in-JS solutions inject their styles at the bottom of the HTML `<head>`, which gives Material-UI precedence over your custom styles. To remove the need for **!important**, you need to change the CSS injection order. Here's a demo of how it can be done in Material-UI: ```jsx -Now you can override Material-UI's styles. import * as React from 'react'; +import * as React from 'react'; +import { StylesProvider } from '@material-ui/core'; + +export default function GlobalCssPriority() { + return ( + <StylesProvider injectFirst> + {/* Your component tree. import * as React from 'react'; import { StylesProvider } from '@material-ui/core'; export default function GlobalCssPriority() { @@ -68,17 +74,11 @@ export default function GlobalCssPriority() { ```jsx import * as React from 'react'; -import { CacheProvider } from '@emotion/react'; -import createCache from '@emotion/cache'; - -const cache = createCache({ - key: 'css', - prepend: true, -}); +import { StylesProvider } from '@material-ui/core'; -export default function PlainCssPriority() { +export default function GlobalCssPriority() { return ( - <CacheProvider value={cache}> + <StylesProvider injectFirst> {/* Your component tree. import * as React from 'react'; import { StylesProvider } from '@material-ui/core'; @@ -86,7 +86,7 @@ export default function GlobalCssPriority() { return ( <StylesProvider injectFirst> {/* Your component tree. */} - </CacheProvider> + </StylesProvider> ); } ``` @@ -208,7 +208,13 @@ export default function GlobalCssSlider() { **Note:** Most CSS-in-JS solutions inject their styles at the bottom of the HTML `<head>`, which gives Material-UI precedence over your custom styles. To remove the need for **!important**, you need to change the CSS injection order. Here's a demo of how it can be done in Material-UI: ```jsx -Now you can override Material-UI's styles. import * as React from 'react'; +import * as React from 'react'; +import { StylesProvider } from '@material-ui/core'; + +export default function GlobalCssPriority() { + return ( + <StylesProvider injectFirst> + {/* Your component tree. import * as React from 'react'; import { StylesProvider } from '@material-ui/core'; export default function GlobalCssPriority() { @@ -242,7 +248,7 @@ export default function GlobalCssPriority() { return ( <StylesProvider injectFirst> {/* Your component tree. */} - </CacheProvider> + </StylesProvider> ); } ``` @@ -287,7 +293,7 @@ export default function GlobalCssSliderDeep() { ## Styled Components -![stars](https://img.shields.io/github/stars/styled-components/styled-components.svg?style=social&label=Star) ![npm](https://img.shields.io/npm/dm/styled-components.svg?) +![stars](https://img.shields.io/github/stars/styled-components/styled-components.svg?style=social&label=Star) ![npm](https://img.shields.io/npm/dm/styled-components.svg) ### Change the default styled engine @@ -325,33 +331,6 @@ The following examples override the slider's `thumb` style in addition to the cu {{"demo": "pages/guides/interoperability/StyledComponentsDeep.js", "defaultCodeOpen": false}} -```jsx -import * as React from 'react'; -import Slider from '@material-ui/core/Slider'; -import { styled } from '@material-ui/core/styles'; - -const CustomizedSlider = styled(Slider)` - color: #20b2aa; - - :hover { - color: #2e8b57; - } - - & .MuiSlider-thumb { - border-radius: 1px; - } -`; - -export default function StyledComponentsDeep1() { - return ( - <div> - <Slider defaultValue={30} /> - <CustomizedSlider defaultValue={30} /> - </div> - ); -} -``` - The above demo relies on the [default `className` values](/styles/advanced/#with-material-ui-core), but you can provide your own class name with the `componentsProps` API. ```jsx @@ -407,7 +386,38 @@ const CustomizedSlider = styled(Slider)( ### Portals -TODO: fill this section after the portal is implemented with the new styled engine. +The [Portal](/components/portal/) provides a first-class way to render children into a DOM node that exists outside the DOM hierarchy of the parent component. Because of the way styled-components scopes its CSS, you may run into issues where styling is not applied. + +For example, if you attempt to style the `tooltip` generated by the [Tooltip](/components/tooltip/) component, you will need to pass along the `className` property to the element being rendered outside of it's DOM hierarchy. The following example shows a workaround: + +```jsx +import * as React from 'react'; +import Slider from '@material-ui/core/Slider'; +import { styled } from '@material-ui/core/styles'; + +const CustomizedSlider = styled(Slider)` + color: #20b2aa; + + :hover { + color: #2e8b57; + } + + & .MuiSlider-thumb { + border-radius: 1px; + } +`; + +export default function StyledComponentsDeep1() { + return ( + <div> + <Slider defaultValue={30} /> + <CustomizedSlider defaultValue={30} /> + </div> + ); +} +``` + +{{"demo": "pages/guides/interoperability/StyledComponentsPortal.js"}} ## CSS Modules @@ -454,7 +464,13 @@ export default function CssModulesSlider() { **Note:** Most CSS-in-JS solutions inject their styles at the bottom of the HTML `<head>`, which gives Material-UI precedence over your custom styles. To remove the need for **!important**, you need to change the CSS injection order. Here's a demo of how it can be done in Material-UI: ```jsx -Now you can override Material-UI's styles. import * as React from 'react'; +import * as React from 'react'; +import { StylesProvider } from '@material-ui/core'; + +export default function GlobalCssPriority() { + return ( + <StylesProvider injectFirst> + {/* Your component tree. import * as React from 'react'; import { StylesProvider } from '@material-ui/core'; export default function GlobalCssPriority() { @@ -488,7 +504,7 @@ export default function GlobalCssPriority() { return ( <StylesProvider injectFirst> {/* Your component tree. */} - </CacheProvider> + </StylesProvider> ); } ``` @@ -579,7 +595,7 @@ export default function CssModulesSliderDeep2() { ## Emotion -![stars](https://img.shields.io/github/stars/emotion-js/emotion.svg?style=social&label=Star) ![npm](https://img.shields.io/npm/dm/emotion.svg?) +![stars](https://img.shields.io/github/stars/emotion-js/emotion.svg?style=social&label=Star) ![npm](https://img.shields.io/npm/dm/@emotion/react.svg) ### The `css` prop @@ -587,32 +603,6 @@ Emotion's **css()** method works seamlessly with Material-UI. {{"demo": "pages/guides/interoperability/EmotionCSS.js", "hideToolbar": true}} -[![Edit Button](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/emotion-interoperability-idymy) - -```jsx -/** @jsx jsx */ -import { jsx, css } from '@emotion/react'; -import Slider from '@material-ui/core/Slider'; - -export default function EmotionCSS() { - return ( - <div> - <Slider defaultValue={30} /> - <Slider - defaultValue={30} - css={css` - color: #20b2aa; - - :hover { - color: #2e8b57; - } - `} - /> - </div> - ); -} -``` - ### Thème It works exactly like styled components. You can [use the same guide](/guides/interoperability/#styled-components). diff --git a/docs/src/pages/guides/interoperability/interoperability-ja.md b/docs/src/pages/guides/interoperability/interoperability-ja.md index 638bfb9051292f..d13411d6a0c171 100644 --- a/docs/src/pages/guides/interoperability/interoperability-ja.md +++ b/docs/src/pages/guides/interoperability/interoperability-ja.md @@ -52,7 +52,13 @@ export default function PlainCssSlider() { **Note:** Most CSS-in-JS solutions inject their styles at the bottom of the HTML `<head>`, which gives Material-UI precedence over your custom styles. To remove the need for **!important**, you need to change the CSS injection order. Here's a demo of how it can be done in Material-UI: ```jsx -Now you can override Material-UI's styles. import * as React from 'react'; +import * as React from 'react'; +import { StyledEngineProvider } from '@material-ui/core/styles'; + +export default function GlobalCssPriority() { + return ( + <StyledEngineProvider injectFirst> + {/* Your component tree. import * as React from 'react'; import { StylesProvider } from '@material-ui/core'; export default function GlobalCssPriority() { @@ -68,17 +74,11 @@ export default function GlobalCssPriority() { ```jsx import * as React from 'react'; -import { CacheProvider } from '@emotion/react'; -import createCache from '@emotion/cache'; - -const cache = createCache({ - key: 'css', - prepend: true, -}); +import { StylesProvider } from '@material-ui/core'; -export default function PlainCssPriority() { +export default function GlobalCssPriority() { return ( - <CacheProvider value={cache}> + <StylesProvider injectFirst> {/* Your component tree. import * as React from 'react'; import { StylesProvider } from '@material-ui/core'; @@ -86,7 +86,7 @@ export default function GlobalCssPriority() { return ( <StylesProvider injectFirst> {/* Your component tree. */} - </CacheProvider> + </StylesProvider> ); } ``` @@ -208,7 +208,13 @@ export default function GlobalCssSlider() { **Note:** Most CSS-in-JS solutions inject their styles at the bottom of the HTML `<head>`, which gives Material-UI precedence over your custom styles. To remove the need for **!important**, you need to change the CSS injection order. Here's a demo of how it can be done in Material-UI: ```jsx -Now you can override Material-UI's styles. import * as React from 'react'; +import * as React from 'react'; +import { StyledEngineProvider } from '@material-ui/core/styles'; + +export default function GlobalCssPriority() { + return ( + <StyledEngineProvider injectFirst> + {/* Your component tree. import * as React from 'react'; import { StylesProvider } from '@material-ui/core'; export default function GlobalCssPriority() { @@ -242,7 +248,7 @@ export default function GlobalCssPriority() { return ( <StylesProvider injectFirst> {/* Your component tree. */} - </CacheProvider> + </StylesProvider> ); } ``` @@ -287,13 +293,13 @@ export default function GlobalCssSliderDeep() { ## Styled Components -![Stars](https://img.shields.io/github/stars/styled-components/styled-components.svg?style=social&label=Star) ![npm](https://img.shields.io/npm/dm/styled-components.svg?) +![Stars](https://img.shields.io/github/stars/styled-components/styled-components.svg?style=social&label=Star) ![npm](https://img.shields.io/npm/dm/styled-components.svg) ### Change the default styled engine By default, Material-UI components come with emotion as their style engine. If, however, you would like to use `styled-components`, you can configure your app by following this [example project](https://github.com/mui-org/material-ui/blob/next/examples/create-react-app-with-styled-components). Following this approach reduces the bundle size, and removes the need to configure the CSS injection order. -After the style engine is configured properly, you can use the `styled()` utility from `@material-ui/core/styles` and have direct access to the theme. +After the style engine is configured properly, you can use the [`styled()`](/customization/styled/) utility from `@material-ui/core/styles` and have direct access to the theme. {{"demo": "pages/guides/interoperability/StyledComponents.js", "hideToolbar": true}} @@ -323,34 +329,7 @@ If you attempt to style the Slider, you will likely need to affect some of the S The following examples override the slider's `thumb` style in addition to the custom styles on the slider itself. -{{"demo": "pages/guides/interoperability/StyledComponentsDeep.js", "defaultCodeOpen": false}} - -```jsx -import * as React from 'react'; -import Slider from '@material-ui/core/Slider'; -import { styled } from '@material-ui/core/styles'; - -const CustomizedSlider = styled(Slider)` - color: #20b2aa; - - :hover { - color: #2e8b57; - } - - & .MuiSlider-thumb { - border-radius: 1px; - } -`; - -export default function StyledComponentsDeep1() { - return ( - <div> - <Slider defaultValue={30} /> - <CustomizedSlider defaultValue={30} /> - </div> - ); -} -``` +{{"demo": "pages/guides/interoperability/StyledComponentsDeep.js", "defaultCodeOpen": true}} The above demo relies on the [default `className` values](/styles/advanced/#with-material-ui-core), but you can provide your own class name with the `componentsProps` API. @@ -407,7 +386,26 @@ const CustomizedSlider = styled(Slider)( ### Portals -TODO: fill this section after the portal is implemented with the new styled engine. +The [Portal](/components/portal/) provides a first-class way to render children into a DOM node that exists outside the DOM hierarchy of the parent component. Because of the way styled-components scopes its CSS, you may run into issues where styling is not applied. + +For example, if you attempt to style the `tooltip` generated by the [Tooltip](/components/tooltip/) component, you will need to pass along the `className` property to the element being rendered outside of it's DOM hierarchy. The following example shows a workaround: + +```jsx +import * as React from 'react'; +import { styled } from '@material-ui/core/styles'; +import Button from '@material-ui/core/Button'; +import Tooltip from '@material-ui/core/Tooltip'; + +const StyledTooltip = styled(({ className, ...props }) => ( + <Tooltip {...props} classes={{ popper: className }} /> +))` + & .MuiTooltip-tooltip { + background: navy; + } +`; +``` + +{{"demo": "pages/guides/interoperability/StyledComponentsPortal.js"}} ## CSS Modules @@ -454,7 +452,13 @@ export default function CssModulesSlider() { **Note:** Most CSS-in-JS solutions inject their styles at the bottom of the HTML `<head>`, which gives Material-UI precedence over your custom styles. To remove the need for **!important**, you need to change the CSS injection order. Here's a demo of how it can be done in Material-UI: ```jsx -Now you can override Material-UI's styles. import * as React from 'react'; +import * as React from 'react'; +import { StyledEngineProvider } from '@material-ui/core/styles'; + +export default function GlobalCssPriority() { + return ( + <StyledEngineProvider injectFirst> + {/* Your component tree. import * as React from 'react'; import { StylesProvider } from '@material-ui/core'; export default function GlobalCssPriority() { @@ -488,7 +492,7 @@ export default function GlobalCssPriority() { return ( <StylesProvider injectFirst> {/* Your component tree. */} - </CacheProvider> + </StylesProvider> ); } ``` @@ -579,39 +583,13 @@ export default function CssModulesSliderDeep2() { ## Emotion -![Stars](https://img.shields.io/github/stars/emotion-js/emotion.svg?style=social&label=Star) ![npm](https://img.shields.io/npm/dm/emotion.svg?) +![Stars](https://img.shields.io/github/stars/emotion-js/emotion.svg?style=social&label=Star) ![npm](https://img.shields.io/npm/dm/@emotion/react.svg) ### The `css` prop Emotion's **css()** method works seamlessly with Material-UI. -{{"demo": "pages/guides/interoperability/EmotionCSS.js", "hideToolbar": true}} - -[![Edit Button](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/emotion-interoperability-idymy) - -```jsx -/** @jsx jsx */ -import { jsx, css } from '@emotion/react'; -import Slider from '@material-ui/core/Slider'; - -export default function EmotionCSS() { - return ( - <div> - <Slider defaultValue={30} /> - <Slider - defaultValue={30} - css={css` - color: #20b2aa; - - :hover { - color: #2e8b57; - } - `} - /> - </div> - ); -} -``` +{{"demo": "pages/guides/interoperability/EmotionCSS.js", "defaultCodeOpen": true}} ### テーマ diff --git a/docs/src/pages/guides/interoperability/interoperability-pt.md b/docs/src/pages/guides/interoperability/interoperability-pt.md index d9166170d1e115..abe8c8714390e1 100644 --- a/docs/src/pages/guides/interoperability/interoperability-pt.md +++ b/docs/src/pages/guides/interoperability/interoperability-pt.md @@ -52,14 +52,26 @@ export default function PlainCssSlider() { **Nota:** A maioria das soluções CSS-in-JS injetam seus estilos na parte inferior do HTML `<head>`, que dá precedência ao Material-UI sobre seus estilos customizados. Para remover a necessidade de **!important**, você precisa alterar a ordem de injeção do CSS. Here's a demo of how it can be done in Material-UI: ```jsx -Agora você pode sobrescrever os estilos do Material-UI. import * as React from 'react'; -import { StylesProvider } from '@material-ui/core'; +import * as React from 'react'; +import { StyledEngineProvider } from '@material-ui/core/styles'; export default function GlobalCssPriority() { return ( - <StylesProvider injectFirst> - {/* Your component tree. */} - </StylesProvider> + <StyledEngineProvider injectFirst> + {/* Your component tree. import * as React from 'react'; +import { CacheProvider } from '@emotion/react'; +import createCache from '@emotion/cache'; + +const cache = createCache({ + key: 'css', + prepend: true, +}); + +export default function CssModulesPriority() { + return ( + <CacheProvider value={cache}> + {/* Sua árvore de componentes. */} + </CacheProvider> ); } ``` @@ -67,7 +79,13 @@ export default function GlobalCssPriority() { **Note:** If you are using emotion and have a custom cache in your app, that one will override the one coming from Material-UI. In order for the injection order to still be correct, you need to add the prepend option. Aqui está um exemplo: ```jsx -import * as React from 'react'; +Agora você pode sobrescrever os estilos do Material-UI. import * as React from 'react'; +import { StylesProvider } from '@material-ui/core'; + +export default function GlobalCssPriority() { + return ( + <StylesProvider injectFirst> + {/* Your component tree. import * as React from 'react'; import { CacheProvider } from '@emotion/react'; import createCache from '@emotion/cache'; @@ -76,17 +94,11 @@ const cache = createCache({ prepend: true, }); -export default function PlainCssPriority() { +export default function CssModulesPriority() { return ( <CacheProvider value={cache}> - {/* Sua árvore de componentes. import * as React from 'react'; -import { StylesProvider } from '@material-ui/core'; - -export default function GlobalCssPriority() { - return ( - <StylesProvider injectFirst> - {/* Your component tree. */} - </CacheProvider> + {/* Sua árvore de componentes. */} + </StylesProvider> ); } ``` @@ -208,14 +220,26 @@ export default function GlobalCssSlider() { **Nota:** A maioria das soluções CSS-in-JS injetam seus estilos na parte inferior do HTML `<head>`, que dá precedência ao Material-UI sobre seus estilos customizados. Para remover a necessidade de **!important**, você precisa alterar a ordem de injeção do CSS. Here's a demo of how it can be done in Material-UI: ```jsx -Agora você pode sobrescrever os estilos do Material-UI. import * as React from 'react'; -import { StylesProvider } from '@material-ui/core'; +import * as React from 'react'; +import { StyledEngineProvider } from '@material-ui/core/styles'; export default function GlobalCssPriority() { return ( - <StylesProvider injectFirst> - {/* Your component tree. */} - </StylesProvider> + <StyledEngineProvider injectFirst> + {/* Your component tree. import * as React from 'react'; +import { CacheProvider } from '@emotion/react'; +import createCache from '@emotion/cache'; + +const cache = createCache({ + key: 'css', + prepend: true, +}); + +export default function CssModulesPriority() { + return ( + <CacheProvider value={cache}> + {/* Sua árvore de componentes. */} + </CacheProvider> ); } ``` @@ -236,13 +260,19 @@ export default function GlobalCssPriority() { return ( <CacheProvider value={cache}> {/* Sua árvore de componentes. import * as React from 'react'; -import { StylesProvider } from '@material-ui/core'; +import { CacheProvider } from '@emotion/react'; +import createCache from '@emotion/cache'; -export default function GlobalCssPriority() { +const cache = createCache({ + key: 'css', + prepend: true, +}); + +export default function CssModulesPriority() { return ( - <StylesProvider injectFirst> - {/* Your component tree. */} - </CacheProvider> + <CacheProvider value={cache}> + {/* Sua árvore de componentes. */} + </StylesProvider> ); } ``` @@ -287,13 +317,13 @@ export default function GlobalCssSliderDeep() { ## Styled Components -![estrelas](https://img.shields.io/github/stars/styled-components/styled-components.svg?style=social&label=Star) ![npm](https://img.shields.io/npm/dm/styled-components.svg?) +![estrelas](https://img.shields.io/github/stars/styled-components/styled-components.svg?style=social&label=Star) ![npm](https://img.shields.io/npm/dm/styled-components.svg) ### Alterar o motor de estilo padrão Por padrão, os componentes do Material-UI vêm com emotion como seu motor de estilo. Se, no entanto, você gostaria de usar `styled-components`, você pode configurar sua aplicação seguindo este [projeto de exemplo](https://github.com/mui-org/material-ui/blob/next/examples/create-react-app-with-styled-components). Seguir esta abordagem reduz o tamanho do pacote e remove a necessidade de configurar a ordem de injeção de CSS. -Após o motor de estilo estar configurando adequadamente, você pode usar o utilitário `styled()` de `@material-ui/core/styles` e ter acesso direto para o tema. +After the style engine is configured properly, you can use the [`styled()`](/customization/styled/) utility from `@material-ui/core/styles` and have direct access to the theme. {{"demo": "pages/guides/interoperability/StyledComponents.js", "hideToolbar": true}} @@ -323,34 +353,7 @@ Se você tentar estilizar o Slider, você provavelmente gostaria de afetar algun Os exemplos a seguir substituem o estilo de `thumb` do controle slider, além dos estilos customizados no slider em si. -{{"demo": "pages/guides/interoperability/StyledComponentsDeep.js", "defaultCodeOpen": false}} - -```jsx -import * as React from 'react'; -import Slider from '@material-ui/core/Slider'; -import { styled } from '@material-ui/core/styles'; - -const CustomizedSlider = styled(Slider)` - color: #20b2aa; - - :hover { - color: #2e8b57; - } - - & . MuiSlider-thumb { - border-radius: 1px; - } -`; - -export default function StyledComponentsDeep1() { - return ( - <div> - <Slider defaultValue={30} /> - <CustomizedSlider defaultValue={30} /> - </div> - ); -} -``` +{{"demo": "pages/guides/interoperability/StyledComponentsDeep.js", "defaultCodeOpen": true}} A demonstração acima depende dos [valores padrão de `className`](/styles/advanced/#with-material-ui-core), mas você pode fornecer seu próprio nome de classe com a API `componentsProps`. @@ -407,7 +410,26 @@ const CustomizedSlider = styled(Slider)( ### Portais -A fazer: preencha esta seção após o portal ser implementado com o novo motor de estilo. +O [Portal](/components/portal/) fornece uma maneira de elegante para renderizar filhos em um nó DOM que existe fora da hierarquia DOM do componente pai. Devido a maneira como o escopo de CSS do styled-components funciona, você pode encontrar problemas nos quais o estilo não é aplicado. + +For example, if you attempt to style the `tooltip` generated by the [Tooltip](/components/tooltip/) component, you will need to pass along the `className` property to the element being rendered outside of it's DOM hierarchy. O exemplo a seguir mostra uma solução alternativa: + +```jsx +import * as React from 'react'; +import { styled } from '@material-ui/core/styles'; +import Button from '@material-ui/core/Button'; +import Tooltip from '@material-ui/core/Tooltip'; + +const StyledTooltip = styled(({ className, ...props }) => ( + <Tooltip {...props} classes={{ popper: className }} /> +))` + & .MuiTooltip-tooltip { + background: navy; + } +`; +``` + +{{"demo": "pages/guides/interoperability/StyledComponentsPortal.js"}} ## Módulos CSS @@ -454,14 +476,26 @@ export default function CssModulesSlider() { **Nota:** A maioria das soluções CSS-in-JS injetam seus estilos na parte inferior do HTML `<head>`, que dá precedência ao Material-UI sobre seus estilos customizados. Para remover a necessidade de **!important**, você precisa alterar a ordem de injeção do CSS. Here's a demo of how it can be done in Material-UI: ```jsx -Agora você pode sobrescrever os estilos do Material-UI. import * as React from 'react'; -import { StylesProvider } from '@material-ui/core'; +import * as React from 'react'; +import { StyledEngineProvider } from '@material-ui/core/styles'; export default function GlobalCssPriority() { return ( - <StylesProvider injectFirst> - {/* Your component tree. */} - </StylesProvider> + <StyledEngineProvider injectFirst> + {/* Your component tree. import * as React from 'react'; +import { CacheProvider } from '@emotion/react'; +import createCache from '@emotion/cache'; + +const cache = createCache({ + key: 'css', + prepend: true, +}); + +export default function CssModulesPriority() { + return ( + <CacheProvider value={cache}> + {/* Sua árvore de componentes. */} + </CacheProvider> ); } ``` @@ -478,17 +512,23 @@ const cache = createCache({ prepend: true, }); -export default function CssModulesPriority() { +export default function PlainCssPriority() { return ( <CacheProvider value={cache}> {/* Sua árvore de componentes. import * as React from 'react'; -import { StylesProvider } from '@material-ui/core'; +import { CacheProvider } from '@emotion/react'; +import createCache from '@emotion/cache'; -export default function GlobalCssPriority() { +const cache = createCache({ + key: 'css', + prepend: true, +}); + +export default function CssModulesPriority() { return ( - <StylesProvider injectFirst> - {/* Your component tree. */} - </CacheProvider> + <CacheProvider value={cache}> + {/* Sua árvore de componentes. */} + </StylesProvider> ); } ``` @@ -579,39 +619,13 @@ export default function CssModulesSliderDeep2() { ## Emotion -![estrelas](https://img.shields.io/github/stars/emotion-js/emotion.svg?style=social&label=Star) ![npm](https://img.shields.io/npm/dm/emotion.svg?) +![estrelas](https://img.shields.io/github/stars/emotion-js/emotion.svg?style=social&label=Star) ![npm](https://img.shields.io/npm/dm/@emotion/react.svg) ### A propriedade `css` O método **css()** do Emotion funciona perfeitamente com Material-UI. -{{"demo": "pages/guides/interoperability/EmotionCSS.js", "hideToolbar": true}} - -[![Botão editar](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/emotion-interoperability-idymy) - -```jsx -/** @jsx jsx */ -import { jsx, css } from '@emotion/react'; -import Slider from '@material-ui/core/Slider'; - -export default function EmotionCSS() { - return ( - <div> - <Slider defaultValue={30} /> - <Slider - defaultValue={30} - css={css` - color: #20b2aa; - - :hover { - color: #2e8b57; - } - `} - /> - </div> - ); -} -``` +{{"demo": "pages/guides/interoperability/EmotionCSS.js", "defaultCodeOpen": true}} ### Tema diff --git a/docs/src/pages/guides/interoperability/interoperability-ru.md b/docs/src/pages/guides/interoperability/interoperability-ru.md index e6d9927675fea3..3dfa98f7077062 100644 --- a/docs/src/pages/guides/interoperability/interoperability-ru.md +++ b/docs/src/pages/guides/interoperability/interoperability-ru.md @@ -52,7 +52,13 @@ export default function PlainCssSlider() { **Note:** Most CSS-in-JS solutions inject their styles at the bottom of the HTML `<head>`, which gives Material-UI precedence over your custom styles. To remove the need for **!important**, you need to change the CSS injection order. Here's a demo of how it can be done in Material-UI: ```jsx -Now you can override Material-UI's styles. import * as React from 'react'; +import * as React from 'react'; +import { StyledEngineProvider } from '@material-ui/core/styles'; + +export default function GlobalCssPriority() { + return ( + <StyledEngineProvider injectFirst> + {/* Your component tree. import * as React from 'react'; import { StylesProvider } from '@material-ui/core'; export default function GlobalCssPriority() { @@ -68,17 +74,11 @@ export default function GlobalCssPriority() { ```jsx import * as React from 'react'; -import { CacheProvider } from '@emotion/react'; -import createCache from '@emotion/cache'; - -const cache = createCache({ - key: 'css', - prepend: true, -}); +import { StylesProvider } from '@material-ui/core'; -export default function PlainCssPriority() { +export default function GlobalCssPriority() { return ( - <CacheProvider value={cache}> + <StylesProvider injectFirst> {/* Your component tree. import * as React from 'react'; import { StylesProvider } from '@material-ui/core'; @@ -86,7 +86,7 @@ export default function GlobalCssPriority() { return ( <StylesProvider injectFirst> {/* Your component tree. */} - </CacheProvider> + </StylesProvider> ); } ``` @@ -208,7 +208,13 @@ export default function GlobalCssSlider() { **Note:** Most CSS-in-JS solutions inject their styles at the bottom of the HTML `<head>`, which gives Material-UI precedence over your custom styles. To remove the need for **!important**, you need to change the CSS injection order. Here's a demo of how it can be done in Material-UI: ```jsx -Now you can override Material-UI's styles. import * as React from 'react'; +import * as React from 'react'; +import { StyledEngineProvider } from '@material-ui/core/styles'; + +export default function GlobalCssPriority() { + return ( + <StyledEngineProvider injectFirst> + {/* Your component tree. import * as React from 'react'; import { StylesProvider } from '@material-ui/core'; export default function GlobalCssPriority() { @@ -242,7 +248,7 @@ export default function GlobalCssPriority() { return ( <StylesProvider injectFirst> {/* Your component tree. */} - </CacheProvider> + </StylesProvider> ); } ``` @@ -287,13 +293,13 @@ export default function GlobalCssSliderDeep() { ## Styled Components -![stars](https://img.shields.io/github/stars/styled-components/styled-components.svg?style=social&label=Star) ![npm](https://img.shields.io/npm/dm/styled-components.svg?) +![stars](https://img.shields.io/github/stars/styled-components/styled-components.svg?style=social&label=Star) ![npm](https://img.shields.io/npm/dm/styled-components.svg) ### Change the default styled engine By default, Material-UI components come with emotion as their style engine. If, however, you would like to use `styled-components`, you can configure your app by following this [example project](https://github.com/mui-org/material-ui/blob/next/examples/create-react-app-with-styled-components). Following this approach reduces the bundle size, and removes the need to configure the CSS injection order. -After the style engine is configured properly, you can use the `styled()` utility from `@material-ui/core/styles` and have direct access to the theme. +After the style engine is configured properly, you can use the [`styled()`](/customization/styled/) utility from `@material-ui/core/styles` and have direct access to the theme. {{"demo": "pages/guides/interoperability/StyledComponents.js", "hideToolbar": true}} @@ -323,34 +329,7 @@ If you attempt to style the Slider, you will likely need to affect some of the S The following examples override the slider's `thumb` style in addition to the custom styles on the slider itself. -{{"demo": "pages/guides/interoperability/StyledComponentsDeep.js", "defaultCodeOpen": false}} - -```jsx -import * as React from 'react'; -import Slider from '@material-ui/core/Slider'; -import { styled } from '@material-ui/core/styles'; - -const CustomizedSlider = styled(Slider)` - color: #20b2aa; - - :hover { - color: #2e8b57; - } - - & .MuiSlider-thumb { - border-radius: 1px; - } -`; - -export default function StyledComponentsDeep1() { - return ( - <div> - <Slider defaultValue={30} /> - <CustomizedSlider defaultValue={30} /> - </div> - ); -} -``` +{{"demo": "pages/guides/interoperability/StyledComponentsDeep.js", "defaultCodeOpen": true}} The above demo relies on the [default `className` values](/styles/advanced/#with-material-ui-core), but you can provide your own class name with the `componentsProps` API. @@ -407,7 +386,26 @@ const CustomizedSlider = styled(Slider)( ### Portals -TODO: fill this section after the portal is implemented with the new styled engine. +The [Portal](/components/portal/) provides a first-class way to render children into a DOM node that exists outside the DOM hierarchy of the parent component. Because of the way styled-components scopes its CSS, you may run into issues where styling is not applied. + +For example, if you attempt to style the `tooltip` generated by the [Tooltip](/components/tooltip/) component, you will need to pass along the `className` property to the element being rendered outside of it's DOM hierarchy. The following example shows a workaround: + +```jsx +import * as React from 'react'; +import { styled } from '@material-ui/core/styles'; +import Button from '@material-ui/core/Button'; +import Tooltip from '@material-ui/core/Tooltip'; + +const StyledTooltip = styled(({ className, ...props }) => ( + <Tooltip {...props} classes={{ popper: className }} /> +))` + & .MuiTooltip-tooltip { + background: navy; + } +`; +``` + +{{"demo": "pages/guides/interoperability/StyledComponentsPortal.js"}} ## CSS Modules @@ -454,7 +452,13 @@ export default function CssModulesSlider() { **Note:** Most CSS-in-JS solutions inject their styles at the bottom of the HTML `<head>`, which gives Material-UI precedence over your custom styles. To remove the need for **!important**, you need to change the CSS injection order. Here's a demo of how it can be done in Material-UI: ```jsx -Now you can override Material-UI's styles. import * as React from 'react'; +import * as React from 'react'; +import { StyledEngineProvider } from '@material-ui/core/styles'; + +export default function GlobalCssPriority() { + return ( + <StyledEngineProvider injectFirst> + {/* Your component tree. import * as React from 'react'; import { StylesProvider } from '@material-ui/core'; export default function GlobalCssPriority() { @@ -488,7 +492,7 @@ export default function GlobalCssPriority() { return ( <StylesProvider injectFirst> {/* Your component tree. */} - </CacheProvider> + </StylesProvider> ); } ``` @@ -579,39 +583,13 @@ export default function CssModulesSliderDeep2() { ## Emotion -![stars](https://img.shields.io/github/stars/emotion-js/emotion.svg?style=social&label=Star) ![npm](https://img.shields.io/npm/dm/emotion.svg?) +![stars](https://img.shields.io/github/stars/emotion-js/emotion.svg?style=social&label=Star) ![npm](https://img.shields.io/npm/dm/@emotion/react.svg) ### The `css` prop Emotion's **css()** method works seamlessly with Material-UI. -{{"demo": "pages/guides/interoperability/EmotionCSS.js", "hideToolbar": true}} - -[![Edit Button](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/emotion-interoperability-idymy) - -```jsx -/** @jsx jsx */ -import { jsx, css } from '@emotion/react'; -import Slider from '@material-ui/core/Slider'; - -export default function EmotionCSS() { - return ( - <div> - <Slider defaultValue={30} /> - <Slider - defaultValue={30} - css={css` - color: #20b2aa; - - :hover { - color: #2e8b57; - } - `} - /> - </div> - ); -} -``` +{{"demo": "pages/guides/interoperability/EmotionCSS.js", "defaultCodeOpen": true}} ### Темы diff --git a/docs/src/pages/guides/interoperability/interoperability-zh.md b/docs/src/pages/guides/interoperability/interoperability-zh.md index 795fed61686ff0..5536cf2dccde34 100644 --- a/docs/src/pages/guides/interoperability/interoperability-zh.md +++ b/docs/src/pages/guides/interoperability/interoperability-zh.md @@ -53,18 +53,18 @@ export default function PlainCssSlider() { ```jsx import * as React from 'react'; -import { StylesProvider } from '@material-ui/core'; +import { StyledEngineProvider } from '@material-ui/core/styles'; export default function GlobalCssPriority() { return ( - <StylesProvider injectFirst> + <StyledEngineProvider injectFirst> {/* Your component tree. 现在你可以覆盖 Material-UI 的样式。 */} - </StylesProvider> + </StyledEngineProvider> ); } ``` -**Note:** If you are using emotion and have a custom cache in your app, that one will override the one coming from Material-UI. In order for the injection order to still be correct, you need to add the prepend option. 下面是一个示例: In order for the injection order to still be correct, you need to add the prepend option. 下面是一个示例: +**Note:** If you are using emotion and have a custom cache in your app, that one will override the one coming from Material-UI. In order for the injection order to still be correct, you need to add the prepend option. 下面是一个示例: ```jsx import * as React from 'react'; @@ -79,13 +79,13 @@ const cache = createCache({ export default function PlainCssPriority() { return ( <CacheProvider value={cache}> - {/* Your component tree. 现在你可以覆盖 Material-UI 的样式。 */} + {这里编写你的组件树。 现在你可以覆盖 Material-UI 的样式。 */} </CacheProvider> ); } ``` -**Note:** If you are using styled-components and have `StyleSheetManager` with a custom `target`, make sure that the target is the first element in the HTML `<head>`. If you are curious to see how it can be done, you can take a look on the `StylesProvider` implementation in the `@material-ui/styled-engine-sc` package. If you are curious to see how it can be done, you can take a look on the `StylesProvider` implementation in the `@material-ui/styled-engine-sc` package. +**Note:** If you are using styled-components and have `StyleSheetManager` with a custom `target`, make sure that the target is the first element in the HTML `<head>`. If you are curious to see how it can be done, you can take a look on the `StylesProvider` implementation in the `@material-ui/styled-engine-sc` package. ### 更深层的元素 @@ -203,18 +203,18 @@ export default function GlobalCssSlider() { ```jsx import * as React from 'react'; -import { StylesProvider } from '@material-ui/core'; +import { StyledEngineProvider } from '@material-ui/core/styles'; export default function GlobalCssPriority() { return ( - <StylesProvider injectFirst> + <StyledEngineProvider injectFirst> {/* Your component tree. 现在你可以覆盖 Material-UI 的样式。 */} - </StylesProvider> + </StyledEngineProvider> ); } ``` -**Note:** If you are using emotion and have a custom cache in your app, that one will override the one coming from Material-UI. In order for the injection order to still be correct, you need to add the prepend option. 下面是一个示例: In order for the injection order to still be correct, you need to add the prepend option. 下面是一个示例: +**Note:** If you are using emotion and have a custom cache in your app, that one will override the one coming from Material-UI. In order for the injection order to still be correct, you need to add the prepend option. 下面是一个示例: ```jsx import * as React from 'react'; @@ -235,7 +235,7 @@ export default function GlobalCssPriority() { } ``` -**Note:** If you are using styled-components and have `StyleSheetManager` with a custom `target`, make sure that the target is the first element in the HTML `<head>`. If you are curious to see how it can be done, you can take a look on the `StylesProvider` implementation in the `@material-ui/styled-engine-sc` package. If you are curious to see how it can be done, you can take a look on the `StylesProvider` implementation in the `@material-ui/styled-engine-sc` package. +**Note:** If you are using styled-components and have `StyleSheetManager` with a custom `target`, make sure that the target is the first element in the HTML `<head>`. If you are curious to see how it can be done, you can take a look on the `StylesProvider` implementation in the `@material-ui/styled-engine-sc` package. ### 更深层的元素 @@ -275,13 +275,13 @@ export default function GlobalCssSliderDeep() { ## Styled Components -![stars](https://img.shields.io/github/stars/styled-components/styled-components.svg?style=social&label=Star) ![npm](https://img.shields.io/npm/dm/styled-components.svg?) +![stars](https://img.shields.io/github/stars/styled-components/styled-components.svg?style=social&label=Star) ![npm](https://img.shields.io/npm/dm/styled-components.svg) ### 改变默认的样式引擎 默认情况下,Material-UI 组件使用 emotion 来作为它们的样式引擎。 但是,如果你想使用 `styled-components` 的话,那么你可以参考这个 [示例项目](https://github.com/mui-org/material-ui/blob/next/examples/create-react-app-with-styled-components) 来配置你的应用程序。 按照这种方法来配置的话,则可以减少捆绑包的大小,并且无需配置 CSS 注入顺序。 -在正确配置了样式引擎之后,你可以使用 `@material-ui/core/styles` 中的 `styled()` 工具集来直接访问主题。 +After the style engine is configured properly, you can use the [`styled()`](/customization/styled/) utility from `@material-ui/core/styles` and have direct access to the theme. {{"demo": "pages/guides/interoperability/StyledComponents.js", "hideToolbar": true}} @@ -311,34 +311,7 @@ export default function StyledComponents() { 以下示例除了覆盖滑块本身的自定义样式外,还覆盖了滑块的 `thumb` 样式。 -{{"demo": "pages/guides/interoperability/StyledComponentsDeep.js", "defaultCodeOpen": false}} - -```jsx -import * as React from 'react'; -import Slider from '@material-ui/core/Slider'; -import { styled } from '@material-ui/core/styles'; - -const CustomizedSlider = styled(Slider)` - color: #20b2aa; - - :hover { - color: #2e8b57; - } - - & .MuiSlider-thumb { - border-radius: 1px; - } -`; - -export default function StyledComponentsDeep1() { - return ( - <div> - <Slider defaultValue={30} /> - <CustomizedSlider defaultValue={30} /> - </div> - ); -} -``` +{{"demo": "pages/guides/interoperability/StyledComponentsDeep.js", "defaultCodeOpen": true}} 上面的演示依赖于 [默认的`className`值](/styles/advanced/#with-material-ui-core),但是你也可以使用 `componentsProps` API 来提供你自己的类名。 @@ -395,7 +368,26 @@ const CustomizedSlider = styled(Slider)( ### Portals(传送门组件) -代办:在使用新的样式引擎实现传送门(portal)后,将会填写这部分内容。 +[传送门组件](/components/portal/)提供了一种一流的方法,它将子元素渲染在其父组件的 DOM 层次结构之外的 DOM 节点中。 当您使用这样的 styled-components 规范其 CSS 的方式时,可能会遇到一些无法附着样式的问题。 + +For example, if you attempt to style the `tooltip` generated by the [Tooltip](/components/tooltip/) component, you will need to pass along the `className` property to the element being rendered outside of it's DOM hierarchy. 下面的示例演示了一个变通办法: + +```jsx +import * as React from 'react'; +import { styled } from '@material-ui/core/styles'; +import Button from '@material-ui/core/Button'; +import Tooltip from '@material-ui/core/Tooltip'; + +const StyledTooltip = styled(({ className, ...props }) => ( + <Tooltip {...props} classes={{ popper: className }} /> +))` + & .MuiTooltip-tooltip { + background: navy; + } +`; +``` + +{{"demo": "pages/guides/interoperability/StyledComponentsPortal.js"}} ## CSS Modules @@ -443,18 +435,18 @@ export default function CssModulesSlider() { ```jsx import * as React from 'react'; -import { StylesProvider } from '@material-ui/core'; +import { StyledEngineProvider } from '@material-ui/core/styles'; export default function GlobalCssPriority() { return ( - <StylesProvider injectFirst> + <StyledEngineProvider injectFirst> {/* Your component tree. 现在你可以覆盖 Material-UI 的样式。 */} - </StylesProvider> + </StyledEngineProvider> ); } ``` -**Note:** If you are using emotion and have a custom cache in your app, that one will override the one coming from Material-UI. In order for the injection order to still be correct, you need to add the prepend option. 下面是一个示例: In order for the injection order to still be correct, you need to add the prepend option. 下面是一个示例: +**Note:** If you are using emotion and have a custom cache in your app, that one will override the one coming from Material-UI. In order for the injection order to still be correct, you need to add the prepend option. 下面是一个示例: ```jsx import * as React from 'react'; @@ -475,7 +467,7 @@ export default function CssModulesPriority() { } ``` -**Note:** If you are using styled-components and have `StyleSheetManager` with a custom `target`, make sure that the target is the first element in the HTML `<head>`. If you are curious to see how it can be done, you can take a look on the `StylesProvider` implementation in the `@material-ui/styled-engine-sc` package. If you are curious to see how it can be done, you can take a look on the `StylesProvider` implementation in the `@material-ui/styled-engine-sc` package. +**Note:** If you are using styled-components and have `StyleSheetManager` with a custom `target`, make sure that the target is the first element in the HTML `<head>`. If you are curious to see how it can be done, you can take a look on the `StylesProvider` implementation in the `@material-ui/styled-engine-sc` package. ### 更深层的元素 @@ -561,39 +553,13 @@ export default function CssModulesSliderDeep2() { ## Emotion -![stars](https://img.shields.io/github/stars/emotion-js/emotion.svg?style=social&label=Star) ![npm](https://img.shields.io/npm/dm/emotion.svg?) +![stars](https://img.shields.io/github/stars/emotion-js/emotion.svg?style=social&label=Star) ![npm](https://img.shields.io/npm/dm/@emotion/react.svg) ### `css` 属性 Emotion 的 **css()** 方法与 Material-UI 无缝协作。 -{{"demo": "pages/guides/interoperability/EmotionCSS.js", "hideToolbar": true}} - -[![编辑按钮](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/emotion-interoperability-idymy) - -```jsx -/** @jsx jsx */ -import { jsx, css } from '@emotion/react'; -import Slider from '@material-ui/core/Slider'; - -export default function EmotionCSS() { - return ( - <div> - <Slider defaultValue={30} /> - <Slider - defaultValue={30} - css={css` - color: #20b2aa; - - :hover { - color: #2e8b57; - } - `} - /> - </div> - ); -} -``` +{{"demo": "pages/guides/interoperability/EmotionCSS.js", "defaultCodeOpen": true}} ### 主题 diff --git a/docs/src/pages/guides/localization/localization-de.md b/docs/src/pages/guides/localization/localization-de.md index 4daf41dc083349..40392c340f5641 100644 --- a/docs/src/pages/guides/localization/localization-de.md +++ b/docs/src/pages/guides/localization/localization-de.md @@ -12,15 +12,18 @@ Use the theme to configure the locale text globally: import { createTheme, ThemeProvider } from '@material-ui/core/styles'; import { zhCN } from '@material-ui/core/locale'; -const theme = createTheme({ - palette: { - primary: { main: '#1976d2' }, +const theme = createTheme( + { + palette: { + primary: { main: '#1976d2' }, + }, }, -}, zhCN); + zhCN, +); <ThemeProvider theme={theme}> <App /> -</ThemeProvider> +</ThemeProvider>; ``` ### Beispiel @@ -34,9 +37,12 @@ const theme = createTheme({ | Arabic (Egypt) | ar-EG | `arEG` | | Armenian | hy-AM | `hyAM` | | Azerbaijani | az-AZ | `azAZ` | +| Bangla | bn-BD | `bnBD` | | Bulgarian | bg-BG | `bgBG` | | Catalan | ca-ES | `caES` | +| Chinese (Hong Kong) | zh-HK | `zhHK` | | Chinese (Simplified) | zh-CN | `zhCN` | +| Chinese (Taiwan) | zh-TW | `zhTW` | | Czech | cs-CZ | `csCZ` | | Dutch | nl-NL | `nlNL` | | English (United States) | en-US | `enUS` | diff --git a/docs/src/pages/guides/localization/localization-es.md b/docs/src/pages/guides/localization/localization-es.md index be5e8daf9c8eaa..857eb70ee9cf56 100644 --- a/docs/src/pages/guides/localization/localization-es.md +++ b/docs/src/pages/guides/localization/localization-es.md @@ -12,15 +12,18 @@ Utilice el tema para configurar el texto regional globalmente: import { createTheme, ThemeProvider } from '@material-ui/core/styles'; import { zhCN } from '@material-ui/core/locale'; -const theme = createTheme({ - palette: { - primary: { main: '#1976d2' }, +const theme = createTheme( + { + palette: { + primary: { main: '#1976d2' }, + }, }, -}, zhCN); + zhCN, +); <ThemeProvider theme={theme}> <App /> -</ThemeProvider> +</ThemeProvider>; ``` ### Ejemplo @@ -34,9 +37,12 @@ const theme = createTheme({ | Arabic (Egypt) | ar-EG | `arEG` | | Armenio | hy-AM | `hyAM` | | Azerbaiyano | az-AZ | `azAZ` | +| Bangla | bn-BD | `bnBD` | | Búlgaro | bg-BG | `bgBG` | | Catalán | ca-ES | `caES` | +| Chinese (Hong Kong) | zh-HK | `zhHK` | | Chino (simplificado) | zh-CN | `zhCN` | +| Chinese (Taiwan) | zh-TW | `zhTW` | | Checo | cs-CZ | `csCZ` | | Holandés | nl-NL | `nlNL` | | Inglés (Estados Unidos) | en-US | `enUS` | diff --git a/docs/src/pages/guides/localization/localization-fr.md b/docs/src/pages/guides/localization/localization-fr.md index e4b2a052700c5f..7c8e663cbbdd51 100644 --- a/docs/src/pages/guides/localization/localization-fr.md +++ b/docs/src/pages/guides/localization/localization-fr.md @@ -29,14 +29,17 @@ const theme = createTheme({ ### Supported locales -| Locale | BCP 47 language tag | Import name | +| Locale | BCP 47 language tag | Nom importé | |:----------------------- |:------------------- |:----------- | | Arabe (Égypte) | ar-EG | `arEG` | | Armenian | hy-AM | `hyAM` | | Azerbaijani | az-AZ | `azAZ` | +| Bangla | bn-BD | `bnBD` | | Bulgarian | bg-BG | `bgBG` | | Catalan | ca-ES | `caES` | +| Chinese (Hong Kong) | zh-HK | `zhHK` | | Chinese (Simplified) | zh-CN | `zhCN` | +| Chinese (Taiwan) | zh-TW | `zhTW` | | Czech | cs-CZ | `csCZ` | | Dutch | nl-NL | `nlNL` | | English (United States) | en-US | `enUS` | diff --git a/docs/src/pages/guides/localization/localization-ja.md b/docs/src/pages/guides/localization/localization-ja.md index b327937823574d..e91da94d1c26ef 100644 --- a/docs/src/pages/guides/localization/localization-ja.md +++ b/docs/src/pages/guides/localization/localization-ja.md @@ -12,15 +12,18 @@ Use the theme to configure the locale text globally: import { createTheme, ThemeProvider } from '@material-ui/core/styles'; import { zhCN } from '@material-ui/core/locale'; -const theme = createTheme({ - palette: { - primary: { main: '#1976d2' }, +const theme = createTheme( + { + palette: { + primary: { main: '#1976d2' }, + }, }, -}, zhCN); + zhCN, +); <ThemeProvider theme={theme}> <App /> -</ThemeProvider> +</ThemeProvider>; ``` ### 例 @@ -34,9 +37,12 @@ const theme = createTheme({ | Arabic (Egypt) | ar-EG | `arEG` | | Armenian | hy-AM | `hyAM` | | Azerbaijani | az-AZ | `azAZ` | +| Bangla | bn-BD | `bnBD` | | Bulgarian | bg-BG | `bgBG` | | Catalan | ca-ES | `caES` | +| Chinese (Hong Kong) | zh-HK | `zhHK` | | Chinese (Simplified) | zh-CN | `zhCN` | +| Chinese (Taiwan) | zh-TW | `zhTW` | | Czech | cs-CZ | `csCZ` | | Dutch | nl-NL | `nlNL` | | English (United States) | en-US | `enUS` | diff --git a/docs/src/pages/guides/localization/localization-pt.md b/docs/src/pages/guides/localization/localization-pt.md index 12a9174a68162e..60c7eddce3675b 100644 --- a/docs/src/pages/guides/localization/localization-pt.md +++ b/docs/src/pages/guides/localization/localization-pt.md @@ -12,15 +12,18 @@ Use o tema para configurar os textos da localização globalmente: import { createTheme, ThemeProvider } from '@material-ui/core/styles'; import { zhCN } from '@material-ui/core/locale'; -const theme = createTheme({ - palette: { - primary: { main: '#1976d2' }, +const theme = createTheme( + { + palette: { + primary: { main: '#1976d2' }, + }, }, -}, zhCN); + zhCN, +); <ThemeProvider theme={theme}> <App /> -</ThemeProvider> +</ThemeProvider>; ``` ### Exemplo @@ -34,9 +37,12 @@ const theme = createTheme({ | Árabe (Egito) | ar-EG | `arEG` | | Armênio | hy-AM | `hyAM` | | Azerbaijano | az-AZ | `azAZ` | +| Bangla | bn-BD | `bnBD` | | Búlgaro | bg-BG | `bgBG` | | Catalão | ca-ES | `caES` | +| Chinese (Hong Kong) | zh-HK | `zhHK` | | Chinês (Simplificado) | zh-CN | `zhCN` | +| Chinese (Taiwan) | zh-TW | `zhTW` | | Tcheco | cs-CZ | `csCZ` | | Holandês | nl-NL | `nlNL` | | Inglês (Estados Unidos) | en-US | `enUS` | diff --git a/docs/src/pages/guides/localization/localization-ru.md b/docs/src/pages/guides/localization/localization-ru.md index 394f69f52f105d..d6b778ae8153c0 100644 --- a/docs/src/pages/guides/localization/localization-ru.md +++ b/docs/src/pages/guides/localization/localization-ru.md @@ -12,15 +12,18 @@ Use the theme to configure the locale text globally: import { createTheme, ThemeProvider } from '@material-ui/core/styles'; import { zhCN } from '@material-ui/core/locale'; -const theme = createTheme({ - palette: { - primary: { main: '#1976d2' }, +const theme = createTheme( + { + palette: { + primary: { main: '#1976d2' }, + }, }, -}, zhCN); + zhCN, +); <ThemeProvider theme={theme}> <App /> -</ThemeProvider> +</ThemeProvider>; ``` ### Пример @@ -34,9 +37,12 @@ const theme = createTheme({ | Arabic (Egypt) | ar-EG | `arEG` | | Armenian | hy-AM | `hyAM` | | Azerbaijani | az-AZ | `azAZ` | +| Bangla | bn-BD | `bnBD` | | Bulgarian | bg-BG | `bgBG` | | Catalan | ca-ES | `caES` | +| Chinese (Hong Kong) | zh-HK | `zhHK` | | Chinese (Simplified) | zh-CN | `zhCN` | +| Chinese (Taiwan) | zh-TW | `zhTW` | | Czech | cs-CZ | `csCZ` | | Dutch | nl-NL | `nlNL` | | English (United States) | en-US | `enUS` | diff --git a/docs/src/pages/guides/localization/localization-zh.md b/docs/src/pages/guides/localization/localization-zh.md index b6d3a94541a698..211c7a522577af 100644 --- a/docs/src/pages/guides/localization/localization-zh.md +++ b/docs/src/pages/guides/localization/localization-zh.md @@ -32,44 +32,47 @@ const theme = createTheme( ### 支持的地区 -| 地区 | BCP 47 语言标签 | 导入名称 | -|:-------- |:----------- |:------ | -| 阿拉伯语(埃及) | ar-EG | `arEG` | -| 亚美尼亚语 | hy-AM | `hyAM` | -| 阿塞拜疆语 | az-AZ | `azAZ` | -| 保加利亚语 | bg-BG | `bgBG` | -| 加泰罗尼亚语 | ca-ES | `caES` | -| 简体中文 | zh-CN | `zhCN` | -| 捷克语 | cs-CZ | `csCZ` | -| 荷兰语 | nl-NL | `nlNL` | -| 英语(美式) | en-US | `enUS` | -| 爱沙尼亚语 | et-EE | `etEE` | -| 芬兰语 | fi-FI | `fiFI` | -| 法语 | fr-FR | `frFR` | -| 德语 | de-DE | `deDE` | -| 希腊语 | el-GR | `elGR` | -| 希伯来语 | he-IL | `heIL` | -| 印地语 | hi-IN | `hiIN` | -| 匈牙利语 | hu-HU | `huHU` | -| 冰岛语 | is-IS | `isIS` | -| 印度尼西亚语 | id-ID | `idID` | -| 意大利语 | it-IT | `itIT` | -| 日语 | ja-JP | `jaJP` | -| 哈萨克语 | kz-KZ | `kzKZ` | -| 韩语/朝鲜语 | ko-KR | `koKR` | -| 波斯语 | fa-IR | `faIR` | -| 波兰语 | pl-PL | `plPL` | -| 葡萄牙语(巴西) | pt-BR | `ptBR` | -| 葡萄牙语 | pt-PT | `ptPT` | -| 罗马尼亚语 | ro-RO | `roRO` | -| 俄罗斯语 | ru-RU | `ruRU` | -| 斯洛伐克语 | sk-SK | `skSK` | -| 西班牙语 | es-ES | `esES` | -| 瑞典语 | sv-SE | `svSE` | -| 土耳其语 | tr-TR | `trTR` | -| 越南语 | th-TH | `thTH` | -| 乌克兰语 | uk-UA | `ukUA` | -| 越南语 | vi-VN | `viVN` | +| 地区 | BCP 47 语言标签 | 导入名称 | +|:------------------- |:----------- |:----------- | +| 阿拉伯语(埃及) | ar-EG | `arEG` | +| 亚美尼亚语 | hy-AM | `hyAM` | +| 阿塞拜疆语 | az-AZ | `azAZ` | +| Bangla | bn-BD | `bnBD` | +| 保加利亚语 | bg-BG | `bgBG` | +| 加泰罗尼亚语 | ca-ES | `caES` | +| Chinese (Hong Kong) | zh-HK | `zhHK` | +| 简体中文 | zh-CN | `zhCN` | +| Chinese (Taiwan) | zh-TW | `zhTW` | +| 捷克语 | cs-CZ | `csCZ` | +| 荷兰语 | nl-NL | `nlNL` | +| 英语(美式) | en-US | `enUS` | +| 爱沙尼亚语 | et-EE | `etEE` | +| 芬兰语 | fi-FI | `fiFI` | +| 法语 | fr-FR | `frFR` | +| 德语 | de-DE | `deDE` | +| 匈牙利语 | el-GR | `` `elGR `` | +| 希伯来语 | he-IL | `heIL` | +| 印地语 | hi-IN | `hiIN` | +| 匈牙利语 | hu-HU | `huHU` | +| 冰岛语 | is-IS | `isIS` | +| 印度尼西亚语 | id-ID | `idID` | +| 意大利语 | it-IT | `itIT` | +| 日语 | ja-JP | `jaJP` | +| 哈萨克语 | kz-KZ | `kzKZ` | +| 韩语/朝鲜语 | ko-KR | `koKR` | +| 波斯语 | fa-IR | `faIR` | +| 波兰语 | pl-PL | `plPL` | +| 葡萄牙语(巴西) | pt-BR | `ptBR` | +| 葡萄牙语 | pt-PT | `ptPT` | +| 罗马尼亚语 | ro-RO | `roRO` | +| 俄罗斯语 | ru-RU | `ruRU` | +| 斯洛伐克语 | sk-SK | `skSK` | +| 西班牙语 | es-ES | `esES` | +| 瑞典语 | sv-SE | `svSE` | +| 土耳其语 | tr-TR | `trTR` | +| 越南语 | th-TH | `thTH` | +| 乌克兰语 | uk-UA | `ukUA` | +| 越南语 | vi-VN | `viVN` | <!-- #default-branch-switch --> diff --git a/docs/src/pages/guides/localization/localization.md b/docs/src/pages/guides/localization/localization.md index ab4f3df0c3645f..cc6b53bfc6a9ec 100644 --- a/docs/src/pages/guides/localization/localization.md +++ b/docs/src/pages/guides/localization/localization.md @@ -62,15 +62,16 @@ const theme = createTheme( | Korean | ko-KR | `koKR` | | Persian | fa-IR | `faIR` | | Polish | pl-PL | `plPL` | -| Portuguese (Brazil) | pt-BR | `ptBR` | | Portuguese | pt-PT | `ptPT` | +| Portuguese (Brazil) | pt-BR | `ptBR` | | Romanian | ro-RO | `roRO` | | Russian | ru-RU | `ruRU` | +| Sinhalese | si-LK | `siLK` | | Slovak | sk-SK | `skSK` | | Spanish | es-ES | `esES` | | Swedish | sv-SE | `svSE` | -| Turkish | tr-TR | `trTR` | | Thai | th-TH | `thTH` | +| Turkish | tr-TR | `trTR` | | Ukrainian | uk-UA | `ukUA` | | Vietnamese | vi-VN | `viVN` | diff --git a/docs/src/pages/guides/migration-v4/migration-v4-de.md b/docs/src/pages/guides/migration-v4/migration-v4-de.md index b23605cfdfe83d..49eaa78aa98151 100644 --- a/docs/src/pages/guides/migration-v4/migration-v4-de.md +++ b/docs/src/pages/guides/migration-v4/migration-v4-de.md @@ -2,13 +2,13 @@ <p class="description">Yeah, v5 has been released!</p> -Looking for the v4 docs? [Find them here](https://material-ui.com/versions/). +If you're looking for the v4 docs, you can [find them here](https://material-ui.com/versions/). -> This document is a work in progress. Have you upgraded your site and run into something that's not covered here? [Add your changes on GitHub](https://github.com/mui-org/material-ui/blob/HEAD/docs/src/pages/guides/migration-v4/migration-v4.md). +> This document is a work in progress. If you have upgraded your site and run into something that's not covered here, please [add your changes on GitHub](https://github.com/mui-org/material-ui/blob/HEAD/docs/src/pages/guides/migration-v4/migration-v4.md). ## Introduction -This is a reference for upgrading your site from Material-UI v4 to v5. While there's a lot covered here, you probably won't need to do everything for your site. We'll do our best to keep things easy to follow, and as sequential as possible so you can quickly get rocking on v5! +This is a reference for upgrading your site from Material-UI v4 to v5. While there's a lot covered here, you probably won't need to do everything. We'll do our best to keep things easy to follow, and as sequential as possible, so you can quickly get rocking on v5! ## Why you should migrate @@ -46,11 +46,11 @@ yarn add @material-ui/core@next @emotion/react @emotion/styled The targets of the default bundle have changed. The exact versions will be pinned on release from the browserslist query `"> 0.5%, last 2 versions, Firefox ESR, not dead, not IE 11, maintained node versions"`. -The default bundle now supports: +The default bundle supports the following minimum versions: <!-- #stable-snapshot --> -- Node 10 (up from 8) +- Node 12 (up from 8) - Chrome 84 (up from 49) - Edge 85 (up from 14) - Firefox 78 (up from 52) @@ -63,12 +63,26 @@ It no longer supports IE 11. If you need to support IE 11, check out our [legacy Support for non-ref-forwarding class components in the `component` prop or as immediate `children` has been dropped. If you were using `unstable_createStrictModeTheme` or didn't see any warnings related to `findDOMNode` in `React.StrictMode` then you don't need to do anything. Otherwise check out the ["Caveat with refs" section in our composition guide](/guides/composition/#caveat-with-refs) to find out how to migrate. This change affects almost all components where you're using the `component` prop or passing `children` to components that require `children` to be elements (e.g. `<MenuList><CustomMenuItem /></MenuList>`) -### Styled engine +### Supported React version -The styled engine used in v5 by default is [`emotion`](https://github.com/emotion-js/emotion). While migration from JSS to emotion, if you are using JSS style overrides for your components (for example overrides created by `makeStyles`), you need to take care of the CSS injection order. In order to do this, you need to have on the top of your application the `StylesProvider` with the `injectFirst` option. Here is an example of it: +The minimum supported version of React was increased from v16.8.0 to v17.0.0. + +### Supported TypeScript version + +The minimum supported version of TypeScript was increased from v3.2 to v3.5. We try to align with types released from [DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped) (i.e. packages published on npm under the `@types` namespace). We will not change the minimum supported version in a major version of Material-UI. However, we generally recommend to not use a TypeScript version older than the [lowest supported version of DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped#older-versions-of-typescript-33-and-earlier) + +### Style library + +The style library used by default in v5 is [`emotion`](https://github.com/emotion-js/emotion). While migrating from JSS to emotion, and if you are using JSS style overrides for your components (for example overrides created by `makeStyles`), you will need to take care of the CSS injection order. To do so, you need to have the `StyledEngineProvider` with the `injectFirst` option at the top of your component tree. Hier ist ein Beispiel: ```jsx -Now you can override Material-UI's styles. import * as React from 'react'; +import * as React from 'react'; +import { StyledEngineProvider } from '@material-ui/core/styles'; + +export default function GlobalCssPriority() { + return ( + <StyledEngineProvider injectFirst> + {/* Your component tree. import * as React from 'react'; import { StylesProvider } from '@material-ui/core'; export default function GlobalCssPriority() { @@ -80,21 +94,15 @@ export default function GlobalCssPriority() { } ``` -**Note:** If you are using emotion and have a custom cache in your app, that one will override the one coming from Material-UI. In order for the injection order to still be correct, you need to add the prepend option. Hier ist ein Beispiel: +> **Note:** If you are using emotion to style your app, and have a custom cache, it will override the one provided by Material-UI. In order for the injection order to still be correct, you need to add the `prepend` option to `createCache`. Hier ist ein Beispiel: ```jsx import * as React from 'react'; -import { CacheProvider } from '@emotion/react'; -import createCache from '@emotion/cache'; - -const cache = createCache({ - key: 'css', - prepend: true, -}); +import { StylesProvider } from '@material-ui/core'; -export default function PlainCssPriority() { +export default function GlobalCssPriority() { return ( - <CacheProvider value={cache}> + <StylesProvider injectFirst> {/* Your component tree. import * as React from 'react'; import { StylesProvider } from '@material-ui/core'; @@ -102,16 +110,29 @@ export default function GlobalCssPriority() { return ( <StylesProvider injectFirst> {/* Your component tree. */} - </CacheProvider> + </StylesProvider> ); } ``` -**Note:** If you are using styled-components and have `StyleSheetManager` with a custom `target`, make sure that the target is the first element in the HTML `<head>`. If you are curious to see how it can be done, you can take a look on the `StylesProvider` implementation in the `@material-ui/styled-engine-sc` package. +> **Note:** If you are using styled-components and have `StyleSheetManager` with a custom `target`, make sure that the target is the first element in the HTML `<head>`. To see how it can be done, take a look at the [`StyledEngineProvider` implementation](https://github.com/mui-org/material-ui/blob/next/packages/material-ui-styled-engine-sc/src/StyledEngineProvider/StyledEngineProvider.js) in the `@material-ui/styled-engine-sc` package. ### Theme -- Breakpoints are now treated as values instead of ranges. The behavior of `down(key)` was changed to define media query less than the value defined with the corresponding breakpoint (exclusive). The `between(start, end)` was also updated to define media query for the values between the actual values of start (inclusive) and end (exclusive). When using the `down()` breakpoints utility you need to update the breakpoint key by one step up. When using the `between(start, end)` the end breakpoint should also be updated by one step up. The same should be done when using the `Hidden` component. Find examples of the changes required defined below: +- The function `createMuiTheme` was renamed to `createTheme` to make more intuitive to use with `ThemeProvider`. + + ```diff + -import { createMuiTheme } from '@material-ui/core/styles'; + +import { createTheme } from '@material-ui/core/styles'; + + -const theme = createMuiTheme({ + +const theme = createTheme({ + ``` + +- The default background color is now `#fff` in light mode and `#121212` in dark mode. This matches the Material Design guidelines. +- Breakpoints are now treated as values instead of [ranges](https://v4.material-ui.com/customization/breakpoints/#default-breakpoints). The behavior of `down(key)` was changed to define a media query below the value defined by the corresponding breakpoint (exclusive), rather than the breakpoint above. `between(start, end)` was also updated to define a media query for the values between the actual values of start (inclusive) and end (exclusive). When using the `down()` breakpoints utility you need to update the breakpoint key by one step up. When using the `between(start, end)` the end breakpoint should also be updated by one step up. + + Here are some examples of the changes required: ```diff -theme.breakpoints.down('sm') // '@media (max-width:959.95px)' - [0, sm + 1) => [0, md) @@ -128,11 +149,22 @@ export default function GlobalCssPriority() { +theme.breakpoints.up('sm') // '@media (min-width:600px)' ``` + You can use the [`theme-breakpoints` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#theme-breakpoints) for automatic migration of `theme.breakpoints`. + + The same should be done when using the `Hidden` component: + ```diff -<Hidden smDown>{...}</Hidden> // '@media (min-width:600px)' +<Hidden mdDown>{...}</Hidden> // '@media (min-width:600px)' ``` +- The `theme.breakpoints.width` utility was removed because it's redundant. Use `theme.breakpoints.values` to get the same values. + + ```diff + -theme.breakpoints.width('md') + +theme.breakpoints.values.md + ``` + - The signature of `theme.palette.augmentColor` helper has changed: ```diff @@ -140,24 +172,65 @@ export default function GlobalCssPriority() { +theme.palette.augmentColor({ color: red, name: 'brand' }); ``` +- The `theme.typography.round` helper was removed because it was no longer used. If you need it, use the function below: + + ```js + function round(value) { + return Math.round(value * 1e5) / 1e5; + } + ``` + +- The default breakpoints were changed to better match the common use cases. They also better match the Material Design guidelines. [Read more about the change](https://github.com/mui-org/material-ui/issues/21902) + + ```diff + { + xs: 0, + sm: 600, + - md: 960, + + md: 900, + - lg: 1280, + + lg: 1200, + - xl: 1920, + + xl: 1536, + } + ``` + + If you prefer the old breakpoint values, use the snippet below. + + ```js + import { createTheme } from '@material-ui/core/styles'; + + const theme = createTheme({ + breakpoints: { + values: { + xs: 0, + sm: 600, + md: 960, + lg: 1280, + xl: 1920, + }, + }, + }); + ``` + #### Upgrade helper For a smoother transition, the `adaptV4Theme` helper allows you to iteratively upgrade to the new theme structure. ```diff -import { createMuiTheme } from '@material-ui/core/styles'; -+import { createMuiTheme, adaptV4Theme } from '@material-ui/core/styles'; ++import { createTheme, adaptV4Theme } from '@material-ui/core/styles'; -const theme = createMuiTheme({ -+const theme = createMuiTheme(adaptV4Theme({ ++const theme = createTheme(adaptV4Theme({ // v4 theme -}); +})); ``` -The following changes are supported by the adapter. +##### Supported changes -#### Changes +The following changes are supported by the adapter: - The "gutters" abstraction hasn't proven to be used frequently enough to be valuable. @@ -185,38 +258,40 @@ The following changes are supported by the adapter. theme.spacing(2) => '16px' ``` -- The `theme.palette.type` was renamed to `theme.palette.mode`, to better follow the "dark mode" term that is usually used for describing this feature. + You can use the [`theme-spacing` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#theme-spacing) to remove any 'px' suffix from `theme.spacing` calls in a template string. + +- The `theme.palette.type` key was renamed to `theme.palette.mode`, to better follow the "dark mode" term that is usually used for describing this feature. ```diff - import { createMuiTheme } from '@material-ui/core/styles'; - -const theme = createMuiTheme({palette: { type: 'dark' }}), - +const theme = createMuiTheme({palette: { mode: 'dark' }}), + import { createTheme } from '@material-ui/core/styles'; + -const theme = createTheme({palette: { type: 'dark' }}), + +const theme = createTheme({palette: { mode: 'dark' }}), ``` - The `theme.palette.text.hint` key was unused in Material-UI components, and has been removed. If you depend on it, you can add it back: ```diff - import { createMuiTheme } from '@material-ui/core/styles'; + import { createTheme } from '@material-ui/core/styles'; - -const theme = createMuiTheme(), - +const theme = createMuiTheme({ + -const theme = createTheme(), + +const theme = createTheme({ + palette: { text: { hint: 'rgba(0, 0, 0, 0.38)' } }, +}); ``` -- The components' definition inside the theme were restructure under the `components` key, to allow people easier discoverability about the definitions regarding one component. +- The components' definitions in the theme were restructure under the `components` key, to allow for easier discoverability of the definitions related to any one component. 1. `eigenschaften` ```diff -import { createMuiTheme } from '@material-ui/core/styles'; - -const theme = createMuiTheme({ -- props: { -- MuiButton: { -- disableRipple: true, -- }, -- }, +import { createTheme } from '@material-ui/core/styles'; + +const theme = createTheme({ +- props: { +- MuiButton: { +- disableRipple: true, +- }, +- }, + components: { + MuiButton: { + defaultProps: { @@ -230,14 +305,14 @@ const theme = createMuiTheme({ 2. `überschreibungen` ```diff -import { createMuiTheme } from '@material-ui/core/styles'; - -const theme = createMuiTheme({ -- overrides: { -- MuiButton: { -- root: { padding: 0 }, -- }, -- }, +import { createTheme } from '@material-ui/core/styles'; + +const theme = createTheme({ +- overrides: { +- MuiButton: { +- root: { padding: 0 }, +- }, +- }, + components: { + MuiButton: { + styleOverrides: { @@ -252,33 +327,67 @@ const theme = createMuiTheme({ - Renamed `fade` to `alpha` to better describe its functionality. The previous name was leading to confusion when the input color already had an alpha value. The helper **overrides** the alpha value of the color. -```diff -- import { fade } from '@material-ui/core/styles'; -+ import { alpha } from '@material-ui/core/styles'; + ```diff + - import { fade } from '@material-ui/core/styles'; + + import { alpha } from '@material-ui/core/styles'; -const classes = makeStyles(theme => ({ -- backgroundColor: fade(theme.palette.primary.main, theme.palette.action.selectedOpacity), -+ backgroundColor: alpha(theme.palette.primary.main, theme.palette.action.selectedOpacity), -})); + const classes = makeStyles(theme => ({ + - backgroundColor: fade(theme.palette.primary.main, theme.palette.action.selectedOpacity), + + backgroundColor: alpha(theme.palette.primary.main, theme.palette.action.selectedOpacity), + })); + ``` + + You can use the [`fade-rename-alpha` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#fade-rename-alpha) for automatic migration. + +- The `createStyles` function from `@material-ui/core/styles` was moved to the one exported from `@material-ui/styles`. It is necessary for removing the dependency to `@material-ui/styles` in the core package. + +```diff +-import { createStyles } from '@material-ui/core/styles'; ++import { createStyles } from '@material-ui/styles'; ``` ### System -- The following system functions (and properties) were renamed, because they are considered deprecated CSS: +- The following system functions (and properties) were renamed because they are considered deprecated CSS: + + 1. `gridGap` to `gap` + 1. `gridRowGap` to `rowGap` + 1. `gridColumnGap` to `columnGap` + +- Use spacing unit in `gap`, `rowGap`, and `columnGap`. If you were using a number previously, you need to mention the px to bypass the new transformation with `theme.spacing`. + + ```diff + <Box + - gap={2} + + gap="2px" + > + ``` + +- Replace `css` prop with `sx` to avoid collision with styled-components & emotion `css` prop. + + ```diff + -<Box css={{ color: 'primary.main' }} /> + +<Box sx={{ color: 'primary.main' }} /> + ``` -1. `gridGap` to `gap` -2. `gridColumnGap` to `columnGap` -3. `gridRowGap` to `rowGap` + > Note that the system grid function wasn't documented in v4. ### Core components -As the core components use emotion as a styled engine, the props used by emotion are not intercepted. The prop `as` in the following codesnippet will not be propagated to the `SomeOtherComponent`. +As the core components use emotion as their style engine, the props used by emotion are not intercepted. The prop `as` in the following code snippet will not be propagated to `SomeOtherComponent`. -`<MuiComponent component={SomeOtherComponent} as="button" />` +```jsx +<MuiComponent component={SomeOtherComponent} as="button" /> +``` ### AppBar -- [AppBar] Remove z-index when position static and relative +- Remove z-index when position static and relative. This avoids the creation of a stacking context and rendering issues. +- The `color` prop has no longer any effect in dark mode. The app bar uses the background color required by the elevation to follow the [Material Design guidelines](https://material.io/design/color/dark-theme.html). Use `enableColorOnDark` to restore the behavior of v4. + + ```jsx + <AppBar enableColorOnDark /> + ``` ### Hinweis (Alert) @@ -291,7 +400,7 @@ As the core components use emotion as a styled engine, the props used by emotion +import AlertTitle from '@material-ui/core/AlertTitle'; ``` - You can use the [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. +You can use the [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. ### Autovervollständigung (Autocomplete) @@ -304,7 +413,7 @@ As the core components use emotion as a styled engine, the props used by emotion +import useAutoComplete from '@material-ui/core/useAutocomplete'; ``` - You can use our [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. + You can use the [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. - Remove `debug` prop. There are a couple of simpler alternatives: `open={true}`, Chrome devtools ["Emulate focused"](https://twitter.com/sulco/status/1305841873945272321), or React devtools prop setter. - `renderOption` should now return the full DOM structure of the option. It makes customizations easier. You can recover from the change with: @@ -328,16 +437,39 @@ As the core components use emotion as a styled engine, the props used by emotion /> ``` -- Rename `closeIcon` prop with `clearIcon` to avoid confusion. +- Rename `closeIcon` prop to `clearIcon` to avoid confusion. ```diff -<Autocomplete closeIcon={defaultClearIcon} /> +<Autocomplete clearIcon={defaultClearIcon} /> ``` + You can use the [`autocomplete-rename-closeicon` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#autocomplete-rename-closeicon) for automatic migration. + +- The following values of the reason argument in `onChange` and `onClose` were renamed for consistency: + + 1. `create-option` to `createOption` + 2. `select-option` to `selectOption` + 3. `remove-option` to `removeOption` + +- Change the CSS rules that use `[data-focus="true"]` to use `.Mui-focused`. The `data-focus` attribute is not set on the focused option anymore, instead, global class names are used. + + ```diff + -'.MuiAutocomplete-option[data-focus="true"]': { + +'.MuiAutocomplete-option.Mui-focused': { + ``` + +- Rename `getOptionSelected` to `isOptionEqualToValue` to better describe its purpose. + + ```diff + <Autocomplete + - getOptionSelected={(option, value) => option.title === value.title} + + isOptionEqualToValue={(option, value) => option.title === value.title} + ``` + ### Avatar -- Rename `circle` to `circular` for consistency. The possible values should be adjectives, not nouns: +- Rename `circle` to `circular` for consistency: ```diff -<Avatar variant="circle"> @@ -346,6 +478,15 @@ As the core components use emotion as a styled engine, the props used by emotion +<Avatar classes={{ circular: 'className' }}> ``` + Since `circular` is the default value, the variant prop can be deleted: + + ```diff + -<Avatar variant="circle"> + +<Avatar> + ``` + + You can use the [`avatar-circle-circular` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#avatar-circle-circular) for automatic migration. + - Move the AvatarGroup from the lab to the core. ```diff @@ -353,9 +494,11 @@ As the core components use emotion as a styled engine, the props used by emotion +import AvatarGroup from '@material-ui/core/AvatarGroup'; ``` + You can use the [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. + ### Badge -- Rename `circle` to `circular` and `rectangle` to `rectangular` for consistency. The possible values should be adjectives, not nouns: +- Rename `circle` to `circular` and `rectangle` to `rectangular` for consistency. ```diff -<Badge overlap="circle"> @@ -363,23 +506,25 @@ As the core components use emotion as a styled engine, the props used by emotion +<Badge overlap="circular"> +<Badge overlap="rectangular"> <Badge classes={{ - - anchorOriginTopRightRectangle: 'className' - - anchorOriginBottomRightRectangle: 'className' - - anchorOriginTopLeftRectangle: 'className' - - anchorOriginBottomLeftRectangle: 'className' - - anchorOriginTopRightCircle: 'className' - - anchorOriginBottomRightCircle: 'className' - - anchorOriginTopLeftCircle: 'className' - + anchorOriginTopRightRectangular: 'className' - + anchorOriginBottomRightRectangular: 'className' - + anchorOriginTopLeftRectangular: 'className' - + anchorOriginBottomLeftRectangular: 'className' - + anchorOriginTopRightCircular: 'className' - + anchorOriginBottomRightCircular: 'className' - + anchorOriginTopLeftCircular: 'className' + - anchorOriginTopRightRectangle: 'className', + - anchorOriginBottomRightRectangle: 'className', + - anchorOriginTopLeftRectangle: 'className', + - anchorOriginBottomLeftRectangle: 'className', + - anchorOriginTopRightCircle: 'className', + - anchorOriginBottomRightCircle: 'className', + - anchorOriginTopLeftCircle: 'className', + + anchorOriginTopRightRectangular: 'className', + + anchorOriginBottomRightRectangular: 'className', + + anchorOriginTopLeftRectangular: 'className', + + anchorOriginBottomLeftRectangular: 'className', + + anchorOriginTopRightCircular: 'className', + + anchorOriginBottomRightCircular: 'className', + + anchorOriginTopLeftCircular: 'className', }}> ``` + You can use the [`badge-overlap-value` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#badge-overlap-value) for automatic migration. + ### BottomNavigation - TypeScript: The `event` in `onChange` is no longer typed as a `React.ChangeEvent` but `React.SyntheticEvent`. @@ -391,75 +536,134 @@ As the core components use emotion as a styled engine, the props used by emotion ### Box -- The system props have been deprecated in v5, and replaced with the `sx` prop. +- The `borderRadius` system prop value transformation has been changed. If it receives a number, it multiplies this value with the `theme.shape.borderRadius` value. Use a string to provide an explicit `px` value. + + ```diff + -<Box borderRadius="borderRadius"> + +<Box borderRadius={1}> + ``` + + ```diff + -<Box borderRadius={16}> + +<Box borderRadius="16px"> + ``` + + You can use the [`box-borderradius-values` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#box-borderradius-values) for automatic migration. + +- The Box system props have an optional alternative API in v5, using the `sx` prop. You can [read this section](/system/basics/#api-tradeoff) for the "why" behind this new API. ```diff -<Box border="1px dashed grey" p={[2, 3, 4]} m={2}> +<Box sx={{ border: "1px dashed grey", p: [2, 3, 4], m: 2 }}> ``` - [This codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#box-sx-prop) will automatically update your code to the new syntax. You can [read this section](/system/basics/#api-tradeoff) for the why behind the change of API. + If you prefer the new syntax, you can use the [`box-sx-prop` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#box-sx-prop) for automatic migration. + +- The following properties have been renamed because they are considered deprecated CSS properties by the CSS specification: -- The `borderRadius` system prop value transformation has been changed. If it receives a number, it multiplies this value with the `theme.shape.borderRadius` value. Use a string to provide an explicit value, in `px`. + 1. `gridGap` to `gap` + 2. `gridColumnGap` to `columnGap` + 3. `gridRowGap` to `rowGap` ```diff - -<Box sx={{ borderRadius: 'borderRadius' }}> - +<Box sx={{ borderRadius: 1 }}> + -<Box gridGap={1}> + -<Box gridColumnGap={2}> + -<Box gridRowGap={3}> + +<Box gap={1}> + +<Box columnGap={2}> + +<Box rowGap={3}> ``` + (Note that the system grid function wasn't documented in v4.) + + You can use the [`box-rename-gap` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#box-rename-gap) for automatic migration. + +- The `clone` prop was removed because its behavior can be obtained by applying the `sx` prop directly to the child if it is a Material-UI component. + ```diff - -<Box sx={{ borderRadius: 16 }}> - +<Box sx={{ borderRadius: '16px' }}> + -<Box sx={{ border: '1px dashed grey' }} clone> + - <Button>Save</Button> + -</Box> + +<Button sx={{ border: '1px dashed grey' }}>Save</Button> ``` -- The following properties were renamed, because they are considered deprecated CSS proeprties: +- The ability to pass a render prop was removed because its behavior can be obtained by applying the `sx` prop directly to the child if it is a Material-UI component. -1. `gridGap` to `gap` -2. `gridColumnGap` to `columnGap` -3. `gridRowGap` to `rowGap` + ```diff + -<Box sx={{ border: '1px dashed grey' }}> + - {(props) => <Button {...props}>Save</Button>} + -</Box> + +<Button sx={{ border: '1px dashed grey' }}>Save</Button> + ``` -```diff --<Box gridGap="10px"> -+<Box sx={{ gap: '10px' }}> -``` + For non-Material-UI components, use the `component` prop. -```diff --<Box gridColumnGap="10px" gridRowGap="20px"> -+<Box sx={{ columnGap: '10px', rowGap: '20px' }}> -``` + ```diff + -<Box sx={{ border: '1px dashed grey' }}> + - {(props) => <button {...props}>Save</button>} + -</Box> + +<Box component="button" sx={{ border: '1px dashed grey' }}>Save</Box> + ``` ### Button -- The button `color` prop is now "primary" by default, and "default" has been removed. This makes the button closer to the Material Design specification and simplifies the API. +- The button `color` prop is now "primary" by default, and "default" has been removed. This makes the button closer to the Material Design guidelines and simplifies the API. + + ```diff + -<Button color="primary"> + -<Button color="default"> + +<Button> + +<Button> + ``` + + You can use the [`button-color-prop` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#button-color-prop) for automatic migration. + +- `span` element that wraps children has been removed. `label` classKey is also removed. Weitere Einzelheiten über [diese Änderung](https://github.com/mui-org/material-ui/pull/26666). ```diff - -<Button color="primary" /> - -<Button color="default" /> - +<Button /> - +<Button /> + <button class="MuiButton-root"> + - <span class="MuiButton-label"> + children + - </span> + </button> ``` ### Chip - Rename `default` variant to `filled` for consistency. + + Since `filled` is the default value, the variant prop can be deleted: + ```diff -<Chip variant="default"> - +<Chip variant="filled"> + +<Chip> ``` -### Fortschritt als Gruppe + You can use the [`chip-variant-prop` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#chip-variant-prop) for automatic migration. + +### Checkbox -- The `static` variant has been merged into the `determinate` variant, with the latter assuming the appearance of the former. The removed variant was rarely useful. It was an exception to Material Design, and was removed from the specification. +- The component doesn't have `.MuiIconButton-root` and `.MuiIconButton-label` class names anymore, target `.MuiButtonBase-root` instead. ```diff - -<CircularProgress variant="determinate" /> + - <span class="MuiIconButton-root MuiButtonBase-root MuiCheckbox-root PrivateSwitchBase-root"> + - <span class="MuiIconButton-label"> + - <input class="PrivateSwitchBase-input"> + + <span class="MuiButtonBase-root MuiCheckbox-root PrivateSwitchBase-root"> + + <span class="PrivateSwitchBase-input"> ``` +### Fortschritt als Gruppe + +- The `static` variant has been renamed to `determinate`, and the previous appearance of `determinate` has been replaced by that of `static`. It was an exception to Material Design, and was removed from the specification. + ```diff - -<CircularProgress variant="static" classes={{ static: 'className' }} /> + <CircularProgress variant="static" classes={{ static: 'className' }} /> +<CircularProgress variant="determinate" classes={{ determinate: 'className' }} /> ``` +You can use the [`circularprogress-variant` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#circularprogress-variant) for automatic migration. + > NB: If you had previously customized determinate, your customizations are probably no longer valid. Please remove them. ### Collapse @@ -478,21 +682,28 @@ As the core components use emotion as a styled engine, the props used by emotion +<Collapse classes={{ root: 'collapse' }}> ``` -###  CssBaseline +You can use the [`collapse-rename-collapsedheight` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#collapse-rename-collapsedheight) for automatic migration of both the prop and the classes key. -- The component was migrated to use the `@material-ui/styled-engine` (`emotion` or `styled-components`) instead of `jss`. You should remove the `@global` key when defining the style overrides for it. +### CssBaseline + +- The component was migrated to use the `@material-ui/styled-engine` (`emotion` or `styled-components`) instead of `jss`. You should remove the `@global` key when defining the style overrides for it. You could also start using the CSS template syntax over the JavaScript object syntax. ```diff - const theme = createMuiTheme({ + const theme = createTheme({ components: { MuiCssBaseline: { - styleOverrides: { + - styleOverrides: { - '@global': { - html: { - WebkitFontSmoothing: 'auto', - }, + - html: { + - WebkitFontSmoothing: 'auto', + - }, - }, - }, + - }, + + styleOverrides: ` + + html { + + -webkit-font-smoothing: auto; + + } + + ` }, }, }); @@ -501,7 +712,7 @@ As the core components use emotion as a styled engine, the props used by emotion - The `body` font size has changed from `theme.typography.body2` (`0.875rem`) to `theme.typography.body1` (`1rem`). To return to the previous size, you can override it in the theme: ```js - const theme = createMuiTheme({ + const theme = createTheme({ typography: { body1: { fontSize: '0.875rem', @@ -518,12 +729,12 @@ As the core components use emotion as a styled engine, the props used by emotion ```diff <Dialog - - onEnter={onEnter} - - onEntered={onEntered}, - - onEntering={onEntered}, - - onExit={onEntered}, - - onExited={onEntered}, - - onExiting={onEntered} + - onEnter={onEnter} + - onEntered={onEntered} + - onEntering={onEntering} + - onExit={onExit} + - onExited={onExited} + - onExiting={onExiting} + TransitionProps={{ + onEnter, + onEntered, @@ -535,7 +746,9 @@ As the core components use emotion as a styled engine, the props used by emotion /> ``` -- Remove the `disableBackdropClick` prop because redundant. Ignore close events from `onClose` when `reason === 'backdropClick'` instead. + You can use the [`use-transitionprops` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#use-transitionprops) for automatic migration. + +- Remove the `disableBackdropClick` prop because it is redundant. Ignore close events from `onClose` when `reason === 'backdropClick'` instead. ```diff <Dialog @@ -549,7 +762,7 @@ As the core components use emotion as a styled engine, the props used by emotion /> ``` -- [withMobileDialog] Remove this higher-order component. The hook API allows a simpler and more flexible solution: +- Remove the `withMobileDialog` higher-order component. The hook API allows a simpler and more flexible solution: ```diff -import withMobileDialog from '@material-ui/core/withMobileDialog'; @@ -569,9 +782,20 @@ As the core components use emotion as a styled engine, the props used by emotion +export default ResponsiveDialog; ``` +- Flatten DialogTitle DOM structure, remove `disableTypography` prop + + ```diff + -<DialogTitle disableTypography> + - <Typography variant="h4" component="h2"> + +<DialogTitle> + + <Typography variant="h4" component="span"> + My header + </Typography> + ``` + ### Divider -- Use border instead of background color. It prevents inconsistent height on scaled screens. For people customizing the color of the border, the change requires changing the override CSS property: +- Use border instead of background color. It prevents inconsistent height on scaled screens. If you have customized the color of the border, you will need to update the CSS property override: ```diff .MuiDivider-root { @@ -642,27 +866,66 @@ As the core components use emotion as a styled engine, the props used by emotion ### Fab -- Rename `round` to `circular` for consistency. The possible values should be adjectives, not nouns: +- Rename `round` to `circular` for consistency: ```diff -<Fab variant="round"> +<Fab variant="circular"> ``` +### FormControl + +- Change the default variant from `standard` to `outlined`. Standard has been removed from the Material Design guidelines. + + ```diff + -<FormControl value="Standard" /> + -<FormControl value="Outlined" variant="outlined" /> + +<FormControl value="Standard" variant="standard" /> + +<FormControl value="Outlined" /> + ``` + +[This codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#variant-prop) will automatically update your code. + ### Grid -- Rename `justify` prop with `justifyContent` to be aligned with the CSS property name. +- Rename `justify` prop to `justifyContent` to align with the CSS property name. ```diff -<Grid justify="center"> +<Grid justifyContent="center"> ``` + You can use the [`component-rename-prop` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#component-rename-prop) for automatic migration. + +- The props: `alignItems` `alignContent` and `justifyContent` and their `classes` and style overrides keys were removed: "align-items-xs-center", "align-items-xs-flex-start", "align-items-xs-flex-end", "align-items-xs-baseline", "align-content-xs-center", "align-content-xs-flex-start", "align-content-xs-flex-end", "align-content-xs-space-between", "align-content-xs-space-around", "justify-content-xs-center", "justify-content-xs-flex-end", "justify-content-xs-space-between", "justify-content-xs-space-around" and "justify-content-xs-space-evenly". These props are now considered part of the system, not on the `Grid` component itself. If you still wish to add overrides for them, you can use the `theme.components.MuiGrid.variants` options. For example + + ```diff + const theme = createTheme({ + components: { + MuiGrid: { + - styleOverrides: { + - "align-items-xs-flex-end": { + - marginTop: '20px', + - }, + - }, + + variants: { + + props: { alignItems: "flex-end" }, + + style: { + + marginTop: '20px', + + }, + + }], + }, + }, + }); + ``` + + You can use the [`grid-justify-justifycontent` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#grid-justify-justifycontent) for automatic migration. + ### GridList - Rename the `GridList` components to `ImageList` to align with the current Material Design naming. - Rename the GridList `spacing` prop to `gap` to align with the CSS attribute. -- Rename the GridList `cellHeight` prop to `rowHieght`. +- Rename the GridList `cellHeight` prop to `rowHeight`. - Add the `variant` prop to GridList. - Rename the GridListItemBar `actionPosition` prop to `position`. (Note also the related classname changes.) - Use CSS object-fit. For IE11 support either use a polyfill such as https://www.npmjs.com/package/object-fit-images, or continue to use the v4 component. @@ -691,27 +954,74 @@ As the core components use emotion as a styled engine, the props used by emotion +</ImageList> ``` +### Hidden + +- This component was removed because its functionality can be created with the [`sx`](/system/basics/#the-sx-prop) prop or the [`useMediaQuery`](/components/use-media-query) hook. + + Use the `sx` prop to replace `implementation="css"`: + + ```diff + -<Hidden implementation="css" xlUp><Paper /></Hidden> + -<Hidden implementation="css" xlUp><button /></Hidden> + +<Paper sx={{ display: { xl: 'none', xs: 'block' } }} /> + +<Box component="button" sx={{ display: { xl: 'none', xs: 'block' } }} /> + ``` + + ```diff + -<Hidden implementation="css" mdDown><Paper /></Hidden> + -<Hidden implementation="css" mdDown><button /></Hidden> + +<Paper sx={{ display: { xs: 'none', md: 'block' } }} /> + +<Box component="button" sx={{ display: { xs: 'none', md: 'block' } }} /> + ``` + + Use the `useMediaQuery` hook to replace `implementation="js"`: + + ```diff + -<Hidden implementation="js" xlUp><Paper /></Hidden> + +const hidden = useMediaQuery(theme => theme.breakpoints.up('xl')); + +return hidden ? null : <Paper />; + ``` + ### Icon -- The default value of `fontSize` was changed from `default` to `medium` for consistency. In the unlikey event that you were using the value `default`, the prop can be removed: +- The default value of `fontSize` was changed from `default` to `medium` for consistency. In the unlikely event that you were using the value `default`, the prop can be removed: ```diff -<Icon fontSize="default">icon-name</Icon> +<Icon>icon-name</Icon> ``` +### IconButton + +- The default size's padding is reduced to `8px` which makes the default IconButton size of `40px`. To get the old default size (`48px`), use `size="large"`. The change was done to better match Google's products when Material Design stopped documenting the icon button pattern. + + ```diff + - <IconButton> + + <IconButton size="large"> + ``` + +- `span` element that wraps children has been removed. `label` classKey is also removed. Weitere Einzelheiten über [diese Änderung](https://github.com/mui-org/material-ui/pull/26666). + + ```diff + <button class="MuiIconButton-root"> + - <span class="MuiIconButton-label"> + <svg /> + - </span> + </button> + ``` + ### Menu - The onE\* transition props were removed. Use TransitionProps instead. ```diff <Menu - - onEnter={onEnter} - - onEntered={onEntered}, - - onEntering={onEntered}, - - onExit={onEntered}, - - onExited={onEntered}, - - onExiting={onEntered} + - onEnter={onEnter} + - onEntered={onEntered} + - onEntering={onEntering} + - onExit={onExit} + - onExited={onExited} + - onExiting={onExiting} + TransitionProps={{ + onEnter, + onEntered, @@ -723,9 +1033,41 @@ As the core components use emotion as a styled engine, the props used by emotion > ``` + > Note: The `selectedMenu` variant will no longer vertically align the selected item with the anchor. + + You can use the [`use-transitionprops` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#use-transitionprops) for automatic migration. + +- Change the default value of `anchorOrigin.vertical` to follow the Material Design guidelines. The menu now displays below the anchor instead of on top of it. You can restore the previous behavior with: + + ```diff + <Menu + + anchorOrigin={{ + + vertical: 'top', + + horizontal: 'left', + + }} + ``` + +### MenuItem + +- The `MenuItem` component inherits the `ButtonBase` component instead of `ListItem`. The class names related to "MuiListItem-\*" are removed and theming `ListItem` is no longer affecting `MenuItem`. + + ```diff + -<li className="MuiButtonBase-root MuiMenuItem-root MuiListItem-root"> + +<li className="MuiButtonBase-root MuiMenuItem-root"> + ``` + +- prop `listItemClasses` is removed, use `classes` instead. + + ```diff + -<MenuItem listItemClasses={{...}}> + +<MenuItem classes={{...}}> + ``` + + Read more about [MenuItem CSS API](/api/menu-item/#css) + ### Modal -- Remove the `disableBackdropClick` prop because redundant. Ignore close events from `onClose` when `reason === 'backdropClick'` instead. +- Remove the `disableBackdropClick` prop because it is redundant. Use `onClose` with `reason === 'backdropClick'` instead. ```diff <Modal @@ -739,7 +1081,7 @@ As the core components use emotion as a styled engine, the props used by emotion /> ``` -- Remove the `onEscapeKeyDown` prop because redundant. Use `onClose` with `reason === "escapeKeyDown"` instead. +- Remove the `onEscapeKeyDown` prop because it is redundant. Use `onClose` with `reason === "escapeKeyDown"` instead. ```diff <Modal @@ -754,6 +1096,38 @@ As the core components use emotion as a styled engine, the props used by emotion - Remove `onRendered` prop. Depending on your use case either use a [callback ref](https://reactjs.org/docs/refs-and-the-dom.html#callback-refs) on the child element or an effect hook in the child component. +### NativeSelect + +- Merge the `selectMenu` slot into `select`. Slot `selectMenu` was redundant. The `root` slot is no longer applied to the select, but to the root. + + ```diff + -<NativeSelect classes={{ root: 'class1', select: 'class2', selectMenu: 'class3' }} /> + +<NativeSelect classes={{ select: 'class1 class2 class3' }} /> + ``` + +### OutlinedInput + +- Remove the `labelWidth` prop. The `label` prop now fulfills the same purpose, using CSS layout instead of JavaScript measurement to render the gap in the outlined. + + ```diff + -<OutlinedInput labelWidth={20} /> + +<OutlinedInput label="First Name" /> + ``` + +### Paper + +- Change the background opacity based on the elevation in dark mode. This change was done to follow the Material Design guidelines. You can revert it in the theme: + + ```diff + const theme = createTheme({ + components: { + MuiPaper: { + + styleOverrides: { root: { backgroundImage: 'unset' } }, + }, + }, + }); + ``` + ### Paginierung - Move the component from the lab to the core. The component is now stable. @@ -767,9 +1141,9 @@ As the core components use emotion as a styled engine, the props used by emotion +import usePagination from '@material-ui/core/usePagination'; ``` - You can use our [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. + You can use the [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. -- Rename `round` to `circular` for consistency. The possible values should be adjectives, not nouns: +- Rename `round` to `circular` for consistency: ```diff -<Pagination shape="round"> @@ -784,12 +1158,12 @@ As the core components use emotion as a styled engine, the props used by emotion ```diff <Popover - - onEnter={onEnter} - - onEntered={onEntered}, - - onEntering={onEntered}, - - onExit={onEntered}, - - onExited={onEntered}, - - onExiting={onEntered} + - onEnter={onEnter} + - onEntered={onEntered} + - onEntering={onEntering} + - onExit={onExit} + - onExited={onExited} + - onExiting={onExiting} + TransitionProps={{ + onEnter, + onEntered, @@ -801,6 +1175,10 @@ As the core components use emotion as a styled engine, the props used by emotion /> ``` + You can use the [`use-transitionprops` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#use-transitionprops) for automatic migration. + +- The `getContentAnchorEl` prop was removed to simplify the positioning logic. + ### Popper - Upgrade [Popper.js](https://github.com/popperjs/popper-core) from v1 to v2. This third-party library has introduced a lot of changes.<br /> You can read [their migration guide](https://popper.js.org/docs/v2/migration-guide/) or the following summary: @@ -812,7 +1190,7 @@ As the core components use emotion as a styled engine, the props used by emotion - '&[x-placement*="bottom"] $arrow': { + '&[data-popper-placement*="bottom"] $arrow': { ``` - - Method names have changed. + - Method names have changed: ```diff -popperRef.current.scheduleUpdate() @@ -830,6 +1208,25 @@ As the core components use emotion as a styled engine, the props used by emotion - Remove `onRendered` prop. Depending on your use case either use a [callback ref](https://reactjs.org/docs/refs-and-the-dom.html#callback-refs) on the child element or an effect hook in the child component. +### Auswahlfeld + +- The radio color prop is now "primary" by default. To continue using the "secondary" color, you must explicitly indicate `secondary`. This brings the radio closer to the Material Design guidelines. + + ```diff + -<Radio /> + +<Radio color="secondary /> + ``` + +- The component doesn't have `.MuiIconButton-root` and `.MuiIconButton-label` class names anymore, target `.MuiButtonBase-root` instead. + + ```diff + - <span class="MuiIconButton-root MuiButtonBase-root MuiRadio-root PrivateSwitchBase-root"> + - <span class="MuiIconButton-label"> + - <input class="PrivateSwitchBase-input"> + + <span class="MuiButtonBase-root MuiRadio-root PrivateSwitchBase-root"> + + <span class="PrivateSwitchBase-input"> + ``` + ### Bewertung - Move the component from the lab to the core. The component is now stable. @@ -839,7 +1236,7 @@ As the core components use emotion as a styled engine, the props used by emotion +import Rating from '@material-ui/core/Rating'; ``` - You can use our [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. + You can use the [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. - Change the default empty icon to improve accessibility. If you have a custom `icon` prop but no `emptyIcon` prop, you can restore the previous behavior with: @@ -872,6 +1269,33 @@ As the core components use emotion as a styled engine, the props used by emotion +<Button ref={ref} /> ``` +### Selects (auswähler) + +- Change the default variant from `standard` to `outlined`. Standard has been removed from the Material Design guidelines. If you are composing the Select with a form control component, you only need to update `FormControl`, the select inherits the variant from its context. + + ```diff + -<Select value="Standard" /> + -<Select value="Outlined" variant="outlined" /> + +<Select value="Standard" variant="standard" /> + +<Select value="Outlined" /> + ``` + +[This codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#variant-prop) will automatically update your code. + +- Remove the `labelWidth` prop. The `label` prop now fulfills the same purpose, using CSS layout instead of JavaScript measurement to render the gap in the outlined. The TextField already handles it by default. + + ```diff + -<Select variant="outlined" labelWidth={20} /> + +<Select variant="outlined" label="Gender" /> + ``` + +- Merge the `selectMenu` slot into `select`. Slot `selectMenu` was redundant. The `root` slot is no longer applied to the select, but to the root. + + ```diff + -<Select classes={{ root: 'class1', select: 'class2', selectMenu: 'class3' }} /> + +<Select classes={{ select: 'class1 class2 class3' }} /> + ``` + ### Skeleton - Move the component from the lab to the core. The component is now stable. @@ -881,9 +1305,9 @@ As the core components use emotion as a styled engine, the props used by emotion +import Skeleton from '@material-ui/core/Skeleton'; ``` - You can use our [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. + You can use the [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. -- Rename `circle` to `circular` and `rect` to `rectangular` for consistency. The possible values should be adjectives, not nouns: +- Rename `circle` to `circular` and `rect` to `rectangular` for consistency: ```diff -<Skeleton variant="circle" /> @@ -903,23 +1327,26 @@ As the core components use emotion as a styled engine, the props used by emotion +<Slider onChange={(event: React.SyntheticEvent, value: unknown) => {}} /> ``` -- The `ValueLabelComponent` prop is now part of the `components` prop. +- The `ValueLabelComponent` and `ThumbComponent` prop is now part of the `components` prop. ```diff - -<Slider ValueLabelComponent={CustomValueLabel} /> - +<Slider components={{ ValueLabel: CustomValueLabel }} /> + <Slider + - ValueLabelComponent={CustomValueLabel} + - ThumbComponent={CustomThumb} + + components={{ + + ValueLabel: CustomValueLabel, + + Thumb: CustomThumb, + + }} + /> ``` -- The `ThumbComponent` prop is not part of the `components` prop. +- Rework the CSS to match the latest [Material Design guidelines](https://material.io/components/sliders) and make custom styles more intuitive. [See documentation](/components/slider/). <a href="/components/slider/#continuous-sliders"><img width="247" alt="" src="https://user-images.githubusercontent.com/3165635/121884800-a8808600-cd13-11eb-8cdf-e25de8f1ba73.png" style="margin: auto"></a> - ```diff - -<Slider ThumbComponent={CustomThumb} /> - +<Slider components={{ Thumb: CustomThumb }} /> - ``` + You can reduce the density of the slider, closer to v4 with the [`size="small"` prop](/components/slider/#sizes). ### Snackbar -- The notification now displays at the bottom left on large screens. This better matches the behavior of Gmail, Google Keep, material.io, etc. You can restore the previous behavior with: You can restore the previous behavior with: You can restore the previous behavior with: +- The notification now displays at the bottom left on large screens. This better matches the behavior of Gmail, Google Keep, material.io, etc. You can restore the previous behavior with: You can restore the previous behavior with: ```diff -<Snackbar /> @@ -930,12 +1357,12 @@ As the core components use emotion as a styled engine, the props used by emotion ```diff <Snackbar - - onEnter={onEnter} - - onEntered={onEntered}, - - onEntering={onEntered}, - - onExit={onEntered}, - - onExited={onEntered}, - - onExiting={onEntered} + - onEnter={onEnter} + - onEntered={onEntered} + - onEntering={onEntering} + - onExit={onExit} + - onExited={onExited} + - onExiting={onExiting} + TransitionProps={{ + onEnter, + onEntered, @@ -947,6 +1374,8 @@ As the core components use emotion as a styled engine, the props used by emotion /> ``` + You can use the [`use-transitionprops` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#use-transitionprops) for automatic migration. + ### SpeedDial - Move the component from the lab to the core. The component is now stable. @@ -960,7 +1389,7 @@ As the core components use emotion as a styled engine, the props used by emotion +import SpeedDialIcon from '@material-ui/core/SpeedDialIcon'; ``` - You can use our [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. + You can use the [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. ### Stepper @@ -1007,6 +1436,39 @@ As the core components use emotion as a styled engine, the props used by emotion </SvgIcon> ``` +### Switch + +- Remove the second argument from `onChange`. You can pull out the checked state by accessing `event.target.checked`. + + ```diff + function MySwitch() { + - const handleChange = (event: React.ChangeEvent<HTMLInputElement>, checked: boolean) => { + + const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => { + + const checked = event.target.checked; + }; + + return <Switch onChange={handleChange} />; + } + ``` + +- The switch color prop is now "primary" by default. To continue using the "secondary" color, you must explicitly indicate `secondary`. This brings the switch closer to the Material Design guidelines. + + ```diff + -<Switch /> + +<Switch color="secondary" /> + ``` + +- The component doesn't have `.MuiIconButton-root` and `.MuiIconButton-label` class names anymore, target `.MuiButtonBase-root` instead. + + ```diff + <span class="MuiSwitch-root"> + - <span class="MuiIconButton-root MuiButtonBase-root MuiSwitch-switchBase PrivateSwitchBase-root"> + - <span class="MuiIconButton-label"> + - <input class="MuiSwitch-input PrivateSwitchBase-input"> + + <span class="MuiButtonBase-root MuiSwitch-switchBase PrivateSwitchBase-root"> + + <span class="MuiSwitch-input PrivateSwitchBase-input"> + ``` + ### Tabelle - The customization of the table pagination's actions labels must be done with the `getItemAriaLabel` prop. This increases consistency with the `Pagination` component. @@ -1014,7 +1476,7 @@ As the core components use emotion as a styled engine, the props used by emotion ```diff <TablePagination - backIconButtonText="Avant" - - nextIconButtonText="Après + - nextIconButtonText="Après" + getItemAriaLabel={…} ``` @@ -1028,8 +1490,42 @@ As the core components use emotion as a styled engine, the props used by emotion + onPageChange={()=>{}} ``` +- Separate classes for different table pagination labels. This allows simpler customizations. + + ```diff + <TablePagination + - classes={{ caption: 'foo' }} + + classes={{ selectLabel: 'foo', displayedRows: 'foo' }} + /> + ``` + +- Move the custom class on `input` to `select`. The `input` key is being applied on another element. + + ```diff + <TablePagination + - classes={{ input: 'foo' }} + + classes={{ select: 'foo' }} + /> + ``` + +- Rename the `default` value of the `padding` prop to `normal`. + + ```diff + -<Table padding="default" /> + -<TableCell padding="default" /> + +<Table padding="normal" /> + +<TableCell padding="normal" /> + ``` + ### Tabs +- Change the default `indicatorColor` and `textColor` prop values to "primary". This is done to match the most common use cases with Material Design. + + ```diff + -<Tabs /> + +<Tabs indicatorColor="primary" textColor="inherit" /> + ``` + - TypeScript: The `event` in `onChange` is no longer typed as a `React.ChangeEvent` but `React.SyntheticEvent`. ```diff @@ -1051,9 +1547,12 @@ As the core components use emotion as a styled engine, the props used by emotion +<Tabs scrollButtons={false} /> ``` +- Tab `minWidth` changed from `72px` => `90px` (without media-query) according to [material-design spec](https://material.io/components/tabs#specs) +- Tab `maxWidth` changed from `264px` => `360px` according to [material-design spec](https://material.io/components/tabs#specs) + ### TextField -- Change the default variant from `standard` to `outlined`. Standard has been removed from the Material Design Guidelines. +- Change the default variant from `standard` to `outlined`. Standard has been removed from the Material Design guidelines. ```diff -<TextField value="Standard" /> @@ -1062,7 +1561,7 @@ As the core components use emotion as a styled engine, the props used by emotion +<TextField value="Outlined" /> ``` -[This codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#textfield-variant-prop) will automatically update your code. + You can use the [`variant-prop` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#variant-prop) for automatic migration. - Rename `rowsMax` prop with `maxRows` for consistency with HTML attributes. @@ -1103,6 +1602,15 @@ As the core components use emotion as a styled engine, the props used by emotion +<Input size="small" /> ``` +- Set the InputAdornment `position` prop to `start` or `end`. Use `start` if used as the value of the `startAdornment` prop. Use `end` if used as the value of the `endAdornment` prop. + + ```diff + -<TextField startAdornment={<InputAdornment>Kg</InputAdornment>} /> + -<TextField endAdornment={<InputAdornment>Kg</InputAdornment>} /> + +<TextField startAdornment={<InputAdornment position="start">Kg</InputAdornment>} /> + +<TextField endAdornment={<InputAdornment position="end">Kg</InputAdornment>} /> + ``` + ### TextareaAutosize - Remove the `rows` prop, use the `minRows` prop instead. This change aims to clarify the behavior of the prop. @@ -1137,7 +1645,7 @@ As the core components use emotion as a styled engine, the props used by emotion +import ToggleButtonGroup from '@material-ui/core/ToggleButtonGroup'; ``` - You can use our [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. + You can use the [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. ### Tooltip @@ -1156,24 +1664,241 @@ As the core components use emotion as a styled engine, the props used by emotion ### Typografie -- Replace the `srOnly` prop so as to not duplicate the capabilities of [System](https://material-ui.com/system/basics/): +- Remove the `srOnly` variant. You can use the `visuallyHidden` utility in conjunction with the `sx` prop instead. ```diff - -import Typography from '@material-ui/core/Typography'; - +import { visuallyHidden } from '@material-ui/system'; - +import styled from 'styled-component'; - - +const Span = styled('span')(visuallyHidden); + +import { visuallyHidden } from '@material-ui/utils'; -<Typography variant="srOnly">Create a user</Typography> - +<Span>Create a user</Span> + +<span style={visuallyHidden}>Create a user</span> ``` -### System +- The following `classes` and style overrides keys were removed: "colorInherit", "colorPrimary", "colorSecondary", "colorTextPrimary", "colorTextSecondary", "colorError", "displayInline" and "displayBlock". These props are now considered part of the system, not on the `Typography` component itself. If you still wish to add overrides for them, you can use the `theme.components.MuiTypography.variants` options. For example -- Replace `css` prop with `sx` to avoid collision with styled-components & emotion CSS props. + ```diff + const theme = createTheme({ + components: { + MuiTypography: { + - styleOverrides: { + - colorSecondary: { + - marginTop: '20px', + - }, + - }, + + variants: { + + props: { color: "secondary" }, + + style: { + + marginTop: '20px', + + }, + + }], + }, + }, + }); + ``` + +### `@material-ui/core/styles` + +#### createGenerateClassName + +- The `createGenerateClassName` function is no longer exported from `@material-ui/core/styles`. You should import it directly from `@material-ui/styles`. + + ```diff + -import { createGenerateClassName } from '@material-ui/core/styles'; + +import { createGenerateClassName } from '@material-ui/styles'; + ``` + +#### jssPreset + +- The `jssPreset` object is no longer exported from `@material-ui/core/styles`. You should import it directly from `@material-ui/styles`. + + ```diff + -import { jssPreset } from '@material-ui/core/styles'; + +import { jssPreset } from '@material-ui/styles'; + ``` + +#### makeStyles + +- The `makeStyles` JSS utility is no longer exported from `@material-ui/core/styles`. You can use `@material-ui/styles/makeStyles` instead. Make sure to add a `ThemeProvider` at the root of your application, as the `defaultTheme` is no longer available. If you are using this utility together with `@material-ui/core`, it's recommended you use the `ThemeProvider` component from `@material-ui/core/styles` instead. + + ```diff + -import { makeStyles } from '@material-ui/core/styles'; + +import { makeStyles } from '@material-ui/styles'; + +import { createTheme, ThemeProvider } from '@material-ui/core/styles'; + + +const theme = createTheme(); + const useStyles = makeStyles((theme) => ({ + background: theme.palette.primary.main, + })); + function Component() { + const classes = useStyles(); + return <div className={classes.root} /> + } + + // In the root of your app + function App(props) { + - return <Component />; + + return <ThemeProvider theme={theme}><Component {...props} /></ThemeProvider>; + } + ``` + +#### MuiThemeProvider + +- The `MuiThemeProvider` component is no longer exported from `@material-ui/core/styles`. Use `ThemeProvider` instead. + + ```diff + -import { MuiThemeProvider } from '@material-ui/core/styles'; + +import { ThemeProvider } from '@material-ui/core/styles'; + ``` + +#### ServerStyleSheets + +- The `ServerStyleSheets` component is no longer exported from `@material-ui/core/styles`. You should import it directly from `@material-ui/styles`. + + ```diff + -import { ServerStyleSheets } from '@material-ui/core/styles'; + +import { ServerStyleSheets } from '@material-ui/styles'; + ``` + +#### styled + +- The `styled` JSS utility is no longer exported from `@material-ui/core/styles`. You can use `@material-ui/styles/styled` instead. Make sure to add a `ThemeProvider` at the root of your application, as the `defaultTheme` is no longer available. If you are using this utility together with `@material-ui/core`, it's recommended you use the `ThemeProvider` component from `@material-ui/core/styles` instead. + + ```diff + -import { styled } from '@material-ui/core/styles'; + +import { styled } from '@material-ui/styles'; + +import { createTheme, ThemeProvider } from '@material-ui/core/styles'; + + +const theme = createTheme(); + const MyComponent = styled('div')(({ theme }) => ({ background: theme.palette.primary.main })); + + function App(props) { + - return <MyComponent />; + + return <ThemeProvider theme={theme}><MyComponent {...props} /></ThemeProvider>; + } + ``` + +#### StylesProvider + +- The `StylesProvider` component is no longer exported from `@material-ui/core/styles`. You should import it directly from `@material-ui/styles`. + + ```diff + -import { StylesProvider } from '@material-ui/core/styles'; + +import { StylesProvider } from '@material-ui/styles'; + ``` + +#### useThemeVariants + +- The `useThemeVariants` hook is no longer exported from `@material-ui/core/styles`. You should import it directly from `@material-ui/styles`. + + ```diff + -import { useThemeVariants } from '@material-ui/core/styles'; + +import { useThemeVariants } from '@material-ui/styles'; + ``` + +#### withStyles + +- Replace the `innerRef` prop with the `ref` prop. Refs are now automatically forwarded to the inner component. + + ```diff + import * as React from 'react'; + import { withStyles } from '@material-ui/styles'; + + const MyComponent = withStyles({ + root: { + backgroundColor: 'red', + }, + })(({ classes }) => <div className={classes.root} />); + + function MyOtherComponent(props) { + const ref = React.useRef(); + - return <MyComponent innerRef={ref} />; + + return <MyComponent ref={ref} />; + } + ``` + +- The `withStyles` JSS utility is no longer exported from `@material-ui/core/styles`. You can use `@material-ui/styles/withStyles` instead. Make sure to add a `ThemeProvider` at the root of your application, as the `defaultTheme` is no longer available. If you are using this utility together with `@material-ui/core`, you should use the `ThemeProvider` component from `@material-ui/core/styles` instead. + + ```diff + -import { withStyles } from '@material-ui/core/styles'; + +import { withStyles } from '@material-ui/styles'; + +import { createTheme, ThemeProvider } from '@material-ui/core/styles'; + + +const defaultTheme = createTheme(); + const MyComponent = withStyles((props) => { + const { classes, className, ...other } = props; + return <div className={clsx(className, classes.root)} {...other} /> + })(({ theme }) => ({ root: { background: theme.palette.primary.main }})); + + function App() { + - return <MyComponent />; + + return <ThemeProvider theme={defaultTheme}><MyComponent /></ThemeProvider>; + } + ``` + +#### withTheme + +- The `withTheme` HOC utility has been removed from the `@material-ui/core/styles` package. You can use `@material-ui/styles/withTheme` instead. Make sure to add a `ThemeProvider` at the root of your application, as the `defaultTheme` is no longer available. If you are using this utility together with `@material-ui/core`, it's recommended you use the `ThemeProvider` component from `@material-ui/core/styles` instead. + + ```diff + -import { withTheme } from '@material-ui/core/styles'; + +import { withTheme } from '@material-ui/styles'; + +import { createTheme, ThemeProvider } from '@material-ui/core/styles'; + + +const theme = createTheme(); + const MyComponent = withTheme(({ theme }) => <div>{props.theme.direction}</div>); + + function App(props) { + - return <MyComponent />; + + return <ThemeProvider theme={theme}><MyComponent {...props} /></ThemeProvider>; + } + ``` + +- Replace the `innerRef` prop with the `ref` prop. Refs are now automatically forwarded to the inner component. + + ```diff + import * as React from 'react'; + import { withTheme } from '@material-ui/core/styles'; + + const MyComponent = withTheme(({ theme }) => <div>{props.theme.direction}</div>); + + function MyOtherComponent(props) { + const ref = React.useRef(); + - return <MyComponent innerRef={ref} />; + + return <MyComponent ref={ref} />; + } + ``` + +#### withWidth + +- This HOC was removed. There's an alternative using the `useMediaQuery` hook on [this page](/components/use-media-query/#migrating-from-withwidth). + +### `@material-ui/types` + +- Rename the exported `Omit` type in `@material-ui/types`. The module is now called `DistributiveOmit`. The change removes the confusion with the built-in `Omit` helper introduced in TypeScript v3.5. The built-in `Omit`, while similar, is non-distributive. This leads to differences when applied to union types. [See this StackOverflow answer for further details](https://stackoverflow.com/a/57103940/1009797). + + ```diff + -import { Omit } from '@material-ui/types'; + +import { DistributiveOmit } from '@material-ui/types'; + ``` + +### `@material-ui/styles` + +#### ThemeProvider + +If you are using the utilities from `@material-ui/styles` together with the `@material-ui/core`, you should replace the use of `ThemeProvider` from `@material-ui/styles` with the one exported from `@material-ui/core/styles`. This way, the `theme` provided in the context will be available in both the styling utilities exported from `@material-ui/styles`, like `makeStyles`, `withStyles` etc. and the Material-UI components. ```diff --<Box css={{ color: 'primary.main' }} /> -+<Box sx={{ color: 'primary.main' }} /> +-import { ThemeProvider } from '@material-ui/styles'; ++import { ThemeProvider } from '@material-ui/core/styles'; +``` + +#### Default theme (TypeScript) + +The `@material-ui/styles` package is no longer part of `@material-ui/core/styles`. If you are using `@material-ui/styles` together with `@material-ui/core` you need to add a module augmentation for the `DefaultTheme`. + +```ts +import { Theme } from '@material-ui/core/styles'; + +declare module '@material-ui/styles' { + interface DefaultTheme extends Theme {} +} ``` diff --git a/docs/src/pages/guides/migration-v4/migration-v4-es.md b/docs/src/pages/guides/migration-v4/migration-v4-es.md index 8988a7f5a69878..e0c941becc2932 100644 --- a/docs/src/pages/guides/migration-v4/migration-v4-es.md +++ b/docs/src/pages/guides/migration-v4/migration-v4-es.md @@ -2,13 +2,13 @@ <p class="description">¡Sí, v5 ha sido lanzada!</p> -¿Buscando la documentación v4? [Encuéntralos aquí](https://material-ui.com/versions/). +If you're looking for the v4 docs, you can [find them here](https://material-ui.com/versions/). -> Este documento es un trabajo en curso. ¿Ha actualizado su sitio y se ha topado con algo que no está cubierto aquí? ¿Ha actualizado su sitio y se ha topado con algo que no está cubierto aquí? [Añade tus cambios en GitHub](https://github.com/mui-org/material-ui/blob/HEAD/docs/src/pages/guides/migration-v4/migration-v4.md). +> Este documento es un trabajo en curso. If you have upgraded your site and run into something that's not covered here, please [add your changes on GitHub](https://github.com/mui-org/material-ui/blob/HEAD/docs/src/pages/guides/migration-v4/migration-v4.md). ## Introducción -Esta es una referencia para actualizar su sitio de Material-UI v4 a v5. Aunque hay mucho cubierto aquí, probablemente no tendrá que hacer todo por su sitio. Haremos todo lo posible para mantener las cosas fáciles de seguir, y tan secuencial como sea posible para que pueda rápidamente ponerse usando la v5! +Esta es una referencia para actualizar su sitio de Material-UI v4 a v5. While there's a lot covered here, you probably won't need to do everything. We'll do our best to keep things easy to follow, and as sequential as possible, so you can quickly get rocking on v5! ## Por qué debería migrar @@ -46,11 +46,11 @@ yarn add @material-ui/core@next @emotion/react @emotion/styled The targets of the default bundle have changed. The exact versions will be pinned on release from the browserslist query `"> 0.5%, last 2 versions, Firefox ESR, not dead, not IE 11, maintained node versions"`. -The default bundle now supports: +The default bundle supports the following minimum versions: <!-- #stable-snapshot --> -- Node 10 (up from 8) +- Node 12 (up from 8) - Chrome 84 (up from 49) - Edge 85 (up from 14) - Firefox 78 (up from 52) @@ -63,12 +63,26 @@ It no longer supports IE 11. If you need to support IE 11, check out our [legacy Support for non-ref-forwarding class components in the `component` prop or as immediate `children` has been dropped. If you were using `unstable_createStrictModeTheme` or didn't see any warnings related to `findDOMNode` in `React.StrictMode` then you don't need to do anything. Otherwise check out the ["Caveat with refs" section in our composition guide](/guides/composition/#caveat-with-refs) to find out how to migrate. This change affects almost all components where you're using the `component` prop or passing `children` to components that require `children` to be elements (e.g. `<MenuList><CustomMenuItem /></MenuList>`) -### Styled engine +### Supported React version -The styled engine used in v5 by default is [`emotion`](https://github.com/emotion-js/emotion). While migration from JSS to emotion, if you are using JSS style overrides for your components (for example overrides created by `makeStyles`), you need to take care of the CSS injection order. In order to do this, you need to have on the top of your application the `StylesProvider` with the `injectFirst` option. Here is an example of it: +The minimum supported version of React was increased from v16.8.0 to v17.0.0. + +### Supported TypeScript version + +The minimum supported version of TypeScript was increased from v3.2 to v3.5. We try to align with types released from [DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped) (i.e. packages published on npm under the `@types` namespace). We will not change the minimum supported version in a major version of Material-UI. However, we generally recommend to not use a TypeScript version older than the [lowest supported version of DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped#older-versions-of-typescript-33-and-earlier) + +### Style library + +The style library used by default in v5 is [`emotion`](https://github.com/emotion-js/emotion). While migrating from JSS to emotion, and if you are using JSS style overrides for your components (for example overrides created by `makeStyles`), you will need to take care of the CSS injection order. To do so, you need to have the `StyledEngineProvider` with the `injectFirst` option at the top of your component tree. Here is an example: ```jsx -Now you can override Material-UI's styles. import * as React from 'react'; +import * as React from 'react'; +import { StyledEngineProvider } from '@material-ui/core/styles'; + +export default function GlobalCssPriority() { + return ( + <StyledEngineProvider injectFirst> + {/* Your component tree. import * as React from 'react'; import { StylesProvider } from '@material-ui/core'; export default function GlobalCssPriority() { @@ -80,21 +94,15 @@ export default function GlobalCssPriority() { } ``` -**Note:** If you are using emotion and have a custom cache in your app, that one will override the one coming from Material-UI. In order for the injection order to still be correct, you need to add the prepend option. Here is an example: +> **Note:** If you are using emotion to style your app, and have a custom cache, it will override the one provided by Material-UI. In order for the injection order to still be correct, you need to add the `prepend` option to `createCache`. Here is an example: ```jsx import * as React from 'react'; -import { CacheProvider } from '@emotion/react'; -import createCache from '@emotion/cache'; - -const cache = createCache({ - key: 'css', - prepend: true, -}); +import { StylesProvider } from '@material-ui/core'; -export default function PlainCssPriority() { +export default function GlobalCssPriority() { return ( - <CacheProvider value={cache}> + <StylesProvider injectFirst> {/* Your component tree. import * as React from 'react'; import { StylesProvider } from '@material-ui/core'; @@ -102,16 +110,29 @@ export default function GlobalCssPriority() { return ( <StylesProvider injectFirst> {/* Your component tree. */} - </CacheProvider> + </StylesProvider> ); } ``` -**Note:** If you are using styled-components and have `StyleSheetManager` with a custom `target`, make sure that the target is the first element in the HTML `<head>`. If you are curious to see how it can be done, you can take a look on the `StylesProvider` implementation in the `@material-ui/styled-engine-sc` package. +> **Note:** If you are using styled-components and have `StyleSheetManager` with a custom `target`, make sure that the target is the first element in the HTML `<head>`. To see how it can be done, take a look at the [`StyledEngineProvider` implementation](https://github.com/mui-org/material-ui/blob/next/packages/material-ui-styled-engine-sc/src/StyledEngineProvider/StyledEngineProvider.js) in the `@material-ui/styled-engine-sc` package. ### Tema -- Los puntos de interrupción ahora son tratados como valores en lugar de rangos. The behavior of `down(key)` was changed to define media query less than the value defined with the corresponding breakpoint (exclusive). The `between(start, end)` was also updated to define media query for the values between the actual values of start (inclusive) and end (exclusive). When using the `down()` breakpoints utility you need to update the breakpoint key by one step up. When using the `between(start, end)` the end breakpoint should also be updated by one step up. The same should be done when using the `Hidden` component. Find examples of the changes required defined below: +- The function `createMuiTheme` was renamed to `createTheme` to make more intuitive to use with `ThemeProvider`. + + ```diff + -import { createMuiTheme } from '@material-ui/core/styles'; + +import { createTheme } from '@material-ui/core/styles'; + + -const theme = createMuiTheme({ + +const theme = createTheme({ + ``` + +- The default background color is now `#fff` in light mode and `#121212` in dark mode. This matches the Material Design guidelines. +- Breakpoints are now treated as values instead of [ranges](https://v4.material-ui.com/customization/breakpoints/#default-breakpoints). The behavior of `down(key)` was changed to define a media query below the value defined by the corresponding breakpoint (exclusive), rather than the breakpoint above. `between(start, end)` was also updated to define a media query for the values between the actual values of start (inclusive) and end (exclusive). When using the `down()` breakpoints utility you need to update the breakpoint key by one step up. When using the `between(start, end)` the end breakpoint should also be updated by one step up. + + Here are some examples of the changes required: ```diff -theme.breakpoints.down('sm') // '@media (max-width:959.95px)' - [0, sm + 1) => [0, md) @@ -128,11 +149,22 @@ export default function GlobalCssPriority() { +theme.breakpoints.up('sm') // '@media (min-width:600px)' ``` + You can use the [`theme-breakpoints` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#theme-breakpoints) for automatic migration of `theme.breakpoints`. + + The same should be done when using the `Hidden` component: + ```diff -<Hidden smDown>{...}</Hidden> // '@media (min-width:600px)' +<Hidden mdDown>{...}</Hidden> // '@media (min-width:600px)' ``` +- The `theme.breakpoints.width` utility was removed because it's redundant. Use `theme.breakpoints.values` to get the same values. + + ```diff + -theme.breakpoints.width('md') + +theme.breakpoints.values.md + ``` + - The signature of `theme.palette.augmentColor` helper has changed: ```diff @@ -140,24 +172,65 @@ export default function GlobalCssPriority() { +theme.palette.augmentColor({ color: red, name: 'brand' }); ``` +- The `theme.typography.round` helper was removed because it was no longer used. If you need it, use the function below: + + ```js + function round(value) { + return Math.round(value * 1e5) / 1e5; + } + ``` + +- The default breakpoints were changed to better match the common use cases. They also better match the Material Design guidelines. [Read more about the change](https://github.com/mui-org/material-ui/issues/21902) + + ```diff + { + xs: 0, + sm: 600, + - md: 960, + + md: 900, + - lg: 1280, + + lg: 1200, + - xl: 1920, + + xl: 1536, + } + ``` + + If you prefer the old breakpoint values, use the snippet below. + + ```js + import { createTheme } from '@material-ui/core/styles'; + + const theme = createTheme({ + breakpoints: { + values: { + xs: 0, + sm: 600, + md: 960, + lg: 1280, + xl: 1920, + }, + }, + }); + ``` + #### Mejorar ayudante Para una transición más suave, el ayudante `adaptV4Theme` te permite actualizar iterativamente algunos de los cambios del tema a la nueva estructura del tema. ```diff -import { createMuiTheme } from '@material-ui/core/styles'; -+import { createMuiTheme, adaptV4Theme } from '@material-ui/core/styles'; ++import { createTheme, adaptV4Theme } from '@material-ui/core/styles'; -const theme = createMuiTheme({ -+const theme = createMuiTheme(adaptV4Theme({ ++const theme = createTheme(adaptV4Theme({ // v4 theme -}); +})); ``` -El adaptador soporta los siguientes cambios. +##### Supported changes -#### Cambios +El adaptador soporta los siguientes cambios: - La abstracción "gutters" no ha demostrado ser usada con suficiente frecuencia como para ser valiosa. @@ -185,33 +258,35 @@ El adaptador soporta los siguientes cambios. theme.spacing(2) => '16px' ``` -- The `theme.palette.type` was renamed to `theme.palette.mode`, to better follow the "dark mode" term that is usually used for describing this feature. + You can use the [`theme-spacing` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#theme-spacing) to remove any 'px' suffix from `theme.spacing` calls in a template string. + +- The `theme.palette.type` key was renamed to `theme.palette.mode`, to better follow the "dark mode" term that is usually used for describing this feature. ```diff - import { createMuiTheme } from '@material-ui/core/styles'; - -const theme = createMuiTheme({palette: { type: 'dark' }}), - +const theme = createMuiTheme({palette: { mode: 'dark' }}), + import { createTheme } from '@material-ui/core/styles'; + -const theme = createTheme({palette: { type: 'dark' }}), + +const theme = createTheme({palette: { mode: 'dark' }}), ``` - La clave `theme.palette.text.hint` no fue usada en componentes de Material-UI y ha sido eliminada. If you depend on it, you can add it back: ```diff - import { createMuiTheme } from '@material-ui/core/styles'; + import { createTheme } from '@material-ui/core/styles'; - -const theme = createMuiTheme(), - +const theme = createMuiTheme({ + -const theme = createTheme(), + +const theme = createTheme({ + palette: { text: { hint: 'rgba(0, 0, 0, 0.38)' } }, +}); ``` -- The components' definition inside the theme were restructure under the `components` key, to allow people easier discoverability about the definitions regarding one component. +- The components' definitions in the theme were restructure under the `components` key, to allow for easier discoverability of the definitions related to any one component. 1. `props` ```diff -import { createMuiTheme } from '@material-ui/core/styles'; +import { createTheme } from '@material-ui/core/styles'; -const theme = createMuiTheme({ +const theme = createTheme({ - props: { - MuiButton: { - disableRipple: true, @@ -230,9 +305,9 @@ const theme = createMuiTheme({ 2. `overrides` ```diff -import { createMuiTheme } from '@material-ui/core/styles'; +import { createTheme } from '@material-ui/core/styles'; -const theme = createMuiTheme({ +const theme = createTheme({ - overrides: { - MuiButton: { - root: { padding: 0 }, @@ -252,33 +327,67 @@ const theme = createMuiTheme({ - Renamed `fade` to `alpha` to better describe its functionality. The previous name was leading to confusion when the input color already had an alpha value. The helper **overrides** the alpha value of the color. -```diff -- import { fade } from '@material-ui/core/styles'; -+ import { alpha } from '@material-ui/core/styles'; + ```diff + - import { fade } from '@material-ui/core/styles'; + + import { alpha } from '@material-ui/core/styles'; -const classes = makeStyles(theme => ({ -- backgroundColor: fade(theme.palette.primary.main, theme.palette.action.selectedOpacity), -+ backgroundColor: alpha(theme.palette.primary.main, theme.palette.action.selectedOpacity), -})); + const classes = makeStyles(theme => ({ + - backgroundColor: fade(theme.palette.primary.main, theme.palette.action.selectedOpacity), + + backgroundColor: alpha(theme.palette.primary.main, theme.palette.action.selectedOpacity), + })); + ``` + + You can use the [`fade-rename-alpha` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#fade-rename-alpha) for automatic migration. + +- The `createStyles` function from `@material-ui/core/styles` was moved to the one exported from `@material-ui/styles`. It is necessary for removing the dependency to `@material-ui/styles` in the core package. + +```diff +-import { createStyles } from '@material-ui/core/styles'; ++import { createStyles } from '@material-ui/styles'; ``` ### Sistema -- The following system functions (and properties) were renamed, because they are considered deprecated CSS: +- The following system functions (and properties) were renamed because they are considered deprecated CSS: + + 1. `gridGap` to `gap` + 1. `gridRowGap` to `rowGap` + 1. `gridColumnGap` to `columnGap` + +- Use spacing unit in `gap`, `rowGap`, and `columnGap`. If you were using a number previously, you need to mention the px to bypass the new transformation with `theme.spacing`. + + ```diff + <Box + - gap={2} + + gap="2px" + > + ``` + +- Replace `css` prop with `sx` to avoid collision with styled-components & emotion `css` prop. + + ```diff + -<Box css={{ color: 'primary.main' }} /> + +<Box sx={{ color: 'primary.main' }} /> + ``` -1. `gridGap` to `gap` -2. `gridColumnGap` to `columnGap` -3. `gridRowGap` to `rowGap` + > Note that the system grid function wasn't documented in v4. ### Core components -As the core components use emotion as a styled engine, the props used by emotion are not intercepted. The prop `as` in the following codesnippet will not be propagated to the `SomeOtherComponent`. +As the core components use emotion as their style engine, the props used by emotion are not intercepted. The prop `as` in the following code snippet will not be propagated to `SomeOtherComponent`. -`<MuiComponent component={SomeOtherComponent} as="button" />` +```jsx +<MuiComponent component={SomeOtherComponent} as="button" /> +``` ### Un App Bar prominente. -- [AppBar] Remove z-index when position static and relative +- Remove z-index when position static and relative. This avoids the creation of a stacking context and rendering issues. +- The `color` prop has no longer any effect in dark mode. The app bar uses the background color required by the elevation to follow the [Material Design guidelines](https://material.io/design/color/dark-theme.html). Use `enableColorOnDark` to restore the behavior of v4. + + ```jsx + <AppBar enableColorOnDark /> + ``` ### Alerta @@ -291,7 +400,7 @@ As the core components use emotion as a styled engine, the props used by emotion +import AlertTitle from '@material-ui/core/AlertTitle'; ``` - You can use the [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. +You can use the [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. ### Autocompletado @@ -304,7 +413,7 @@ As the core components use emotion as a styled engine, the props used by emotion +import useAutoComplete from '@material-ui/core/useAutocomplete'; ``` - You can use our [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. + You can use the [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. - Remove `debug` prop. There are a couple of simpler alternatives: `open={true}`, Chrome devtools ["Emulate focused"](https://twitter.com/sulco/status/1305841873945272321), or React devtools prop setter. - `renderOption` should now return the full DOM structure of the option. It makes customizations easier. You can recover from the change with: @@ -328,16 +437,39 @@ As the core components use emotion as a styled engine, the props used by emotion /> ``` -- Rename `closeIcon` prop with `clearIcon` to avoid confusion. +- Rename `closeIcon` prop to `clearIcon` to avoid confusion. ```diff -<Autocomplete closeIcon={defaultClearIcon} /> +<Autocomplete clearIcon={defaultClearIcon} /> ``` + You can use the [`autocomplete-rename-closeicon` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#autocomplete-rename-closeicon) for automatic migration. + +- The following values of the reason argument in `onChange` and `onClose` were renamed for consistency: + + 1. `create-option` to `createOption` + 2. `select-option` to `selectOption` + 3. `remove-option` to `removeOption` + +- Change the CSS rules that use `[data-focus="true"]` to use `.Mui-focused`. The `data-focus` attribute is not set on the focused option anymore, instead, global class names are used. + + ```diff + -'.MuiAutocomplete-option[data-focus="true"]': { + +'.MuiAutocomplete-option.Mui-focused': { + ``` + +- Rename `getOptionSelected` to `isOptionEqualToValue` to better describe its purpose. + + ```diff + <Autocomplete + - getOptionSelected={(option, value) => option.title === value.title} + + isOptionEqualToValue={(option, value) => option.title === value.title} + ``` + ### Avatar -- Rename `round` to `circular` for consistency. Los valores posibles deben ser adjetivos, no sustantivos: +- Renombrar `circle` a `circular` por consistencia: ```diff -<Avatar variant="circle"> @@ -346,6 +478,15 @@ As the core components use emotion as a styled engine, the props used by emotion +<Avatar classes={{ circular: 'className' }}> ``` + Since `circular` is the default value, the variant prop can be deleted: + + ```diff + -<Avatar variant="circle"> + +<Avatar> + ``` + + You can use the [`avatar-circle-circular` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#avatar-circle-circular) for automatic migration. + - Move the AvatarGroup from the lab to the core. ```diff @@ -353,9 +494,11 @@ As the core components use emotion as a styled engine, the props used by emotion +import AvatarGroup from '@material-ui/core/AvatarGroup'; ``` + You can use the [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. + ### Badge -- Rename `circle` to `circular` and `rect` to `rectangular` for consistency. Los valores posibles deben ser adjetivos, no sustantivos: +- Renombrar `circle` a `circular` y `rectangle` a `rectangular` para consistencia. ```diff -<Badge overlap="circle"> @@ -363,23 +506,25 @@ As the core components use emotion as a styled engine, the props used by emotion +<Badge overlap="circular"> +<Badge overlap="rectangular"> <Badge classes={{ - - anchorOriginTopRightRectangle: 'className' - - anchorOriginBottomRightRectangle: 'className' - - anchorOriginTopLeftRectangle: 'className' - - anchorOriginBottomLeftRectangle: 'className' - - anchorOriginTopRightCircle: 'className' - - anchorOriginBottomRightCircle: 'className' - - anchorOriginTopLeftCircle: 'className' - + anchorOriginTopRightRectangular: 'className' - + anchorOriginBottomRightRectangular: 'className' - + anchorOriginTopLeftRectangular: 'className' - + anchorOriginBottomLeftRectangular: 'className' - + anchorOriginTopRightCircular: 'className' - + anchorOriginBottomRightCircular: 'className' - + anchorOriginTopLeftCircular: 'className' + - anchorOriginTopRightRectangle: 'className', + - anchorOriginBottomRightRectangle: 'className', + - anchorOriginTopLeftRectangle: 'className', + - anchorOriginBottomLeftRectangle: 'className', + - anchorOriginTopRightCircle: 'className', + - anchorOriginBottomRightCircle: 'className', + - anchorOriginTopLeftCircle: 'className', + + anchorOriginTopRightRectangular: 'className', + + anchorOriginBottomRightRectangular: 'className', + + anchorOriginTopLeftRectangular: 'className', + + anchorOriginBottomLeftRectangular: 'className', + + anchorOriginTopRightCircular: 'className', + + anchorOriginBottomRightCircular: 'className', + + anchorOriginTopLeftCircular: 'className', }}> ``` + You can use the [`badge-overlap-value` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#badge-overlap-value) for automatic migration. + ### BottomNavigation - TypeScript: The `event` in `onChange` is no longer typed as a `React.ChangeEvent` but `React.SyntheticEvent`. @@ -391,75 +536,134 @@ As the core components use emotion as a styled engine, the props used by emotion ### Cuadro -- The system props have been deprecated in v5, and replaced with the `sx` prop. +- The `borderRadius` system prop value transformation has been changed. If it receives a number, it multiplies this value with the `theme.shape.borderRadius` value. Use a string to provide an explicit `px` value. + + ```diff + -<Box borderRadius="borderRadius"> + +<Box borderRadius={1}> + ``` + + ```diff + -<Box borderRadius={16}> + +<Box borderRadius="16px"> + ``` + + You can use the [`box-borderradius-values` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#box-borderradius-values) for automatic migration. + +- The Box system props have an optional alternative API in v5, using the `sx` prop. You can [read this section](/system/basics/#api-tradeoff) for the "why" behind this new API. ```diff -<Box border="1px dashed grey" p={[2, 3, 4]} m={2}> +<Box sx={{ border: "1px dashed grey", p: [2, 3, 4], m: 2 }}> ``` - [This codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#box-sx-prop) will automatically update your code to the new syntax. You can [read this section](/system/basics/#api-tradeoff) for the why behind the change of API. + If you prefer the new syntax, you can use the [`box-sx-prop` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#box-sx-prop) for automatic migration. + +- The following properties have been renamed because they are considered deprecated CSS properties by the CSS specification: -- The `borderRadius` system prop value transformation has been changed. If it receives a number, it multiplies this value with the `theme.shape.borderRadius` value. Use a string to provide an explicit value, in `px`. + 1. `gridGap` to `gap` + 2. `gridColumnGap` to `columnGap` + 3. `gridRowGap` to `rowGap` ```diff - -<Box sx={{ borderRadius: 'borderRadius' }}> - +<Box sx={{ borderRadius: 1 }}> + -<Box gridGap={1}> + -<Box gridColumnGap={2}> + -<Box gridRowGap={3}> + +<Box gap={1}> + +<Box columnGap={2}> + +<Box rowGap={3}> ``` + (Note that the system grid function wasn't documented in v4.) + + You can use the [`box-rename-gap` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#box-rename-gap) for automatic migration. + +- The `clone` prop was removed because its behavior can be obtained by applying the `sx` prop directly to the child if it is a Material-UI component. + ```diff - -<Box sx={{ borderRadius: 16 }}> - +<Box sx={{ borderRadius: '16px' }}> + -<Box sx={{ border: '1px dashed grey' }} clone> + - <Button>Save</Button> + -</Box> + +<Button sx={{ border: '1px dashed grey' }}>Save</Button> ``` -- The following properties were renamed, because they are considered deprecated CSS proeprties: +- The ability to pass a render prop was removed because its behavior can be obtained by applying the `sx` prop directly to the child if it is a Material-UI component. -1. `gridGap` to `gap` -2. `gridColumnGap` to `columnGap` -3. `gridRowGap` to `rowGap` + ```diff + -<Box sx={{ border: '1px dashed grey' }}> + - {(props) => <Button {...props}>Save</Button>} + -</Box> + +<Button sx={{ border: '1px dashed grey' }}>Save</Button> + ``` -```diff --<Box gridGap="10px"> -+<Box sx={{ gap: '10px' }}> -``` + El componente Box tiene una propiedad `clone` para permitir el uso del método de elemento clon de React. -```diff --<Box gridColumnGap="10px" gridRowGap="20px"> -+<Box sx={{ columnGap: '10px', rowGap: '20px' }}> -``` + ```diff + -<Box sx={{ border: '1px dashed grey' }}> + - {(props) => <button {...props}>Save</button>} + -</Box> + +<Box component="button" sx={{ border: '1px dashed grey' }}>Save</Box> + ``` ### Button (Botón) -- El prop `color` del botón ahora es "primary" por defecto, y "default" ha sido eliminado. Esto hace que el botón se acerque a la especificación de Material Design y simplifica la API. +- El prop `color` del botón ahora es "primary" por defecto, y "default" ha sido eliminado. This makes the button closer to the Material Design guidelines and simplifies the API. + + ```diff + -<Button color="primary"> + -<Button color="default"> + +<Button> + +<Button> + ``` + + You can use the [`button-color-prop` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#button-color-prop) for automatic migration. + +- `span` element that wraps children has been removed. `label` classKey is also removed. More details about [this change](https://github.com/mui-org/material-ui/pull/26666). ```diff - -<Button color="primary" /> - -<Button color="default" /> - +<Button /> - +<Button /> + <button class="MuiButton-root"> + - <span class="MuiButton-label"> + children + - </span> + </button> ``` ### Chip - Rename `default` variant to `filled` for consistency. + + Since `filled` is the default value, the variant prop can be deleted: + ```diff -<Chip variant="default"> - +<Chip variant="filled"> + +<Chip> ``` -### Progreso circular + You can use the [`chip-variant-prop` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#chip-variant-prop) for automatic migration. + +### Checkbox -- The `static` variant has been merged into the `determinate` variant, with the latter assuming the appearance of the former. The removed variant was rarely useful. It was an exception to Material Design, and was removed from the specification. +- The component doesn't have `.MuiIconButton-root` and `.MuiIconButton-label` class names anymore, target `.MuiButtonBase-root` instead. ```diff - -<CircularProgress variant="determinate" /> + - <span class="MuiIconButton-root MuiButtonBase-root MuiCheckbox-root PrivateSwitchBase-root"> + - <span class="MuiIconButton-label"> + - <input class="PrivateSwitchBase-input"> + + <span class="MuiButtonBase-root MuiCheckbox-root PrivateSwitchBase-root"> + + <span class="PrivateSwitchBase-input"> ``` +### Progreso circular + +- The `static` variant has been renamed to `determinate`, and the previous appearance of `determinate` has been replaced by that of `static`. It was an exception to Material Design, and was removed from the specification. + ```diff - -<CircularProgress variant="static" classes={{ static: 'className' }} /> + <CircularProgress variant="static" classes={{ static: 'className' }} /> +<CircularProgress variant="determinate" classes={{ determinate: 'className' }} /> ``` +You can use the [`circularprogress-variant` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#circularprogress-variant) for automatic migration. + > NB: If you had previously customized determinate, your customizations are probably no longer valid. Please remove them. ### Collapse @@ -478,21 +682,28 @@ As the core components use emotion as a styled engine, the props used by emotion +<Collapse classes={{ root: 'collapse' }}> ``` -###  CssBaseline +You can use the [`collapse-rename-collapsedheight` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#collapse-rename-collapsedheight) for automatic migration of both the prop and the classes key. -- The component was migrated to use the `@material-ui/styled-engine` (`emotion` or `styled-components`) instead of `jss`. You should remove the `@global` key when defining the style overrides for it. +### CssBaseline + +- The component was migrated to use the `@material-ui/styled-engine` (`emotion` or `styled-components`) instead of `jss`. You should remove the `@global` key when defining the style overrides for it. You could also start using the CSS template syntax over the JavaScript object syntax. ```diff - const theme = createMuiTheme({ + const theme = createTheme({ components: { MuiCssBaseline: { - styleOverrides: { + - styleOverrides: { - '@global': { - html: { - WebkitFontSmoothing: 'auto', - }, + - html: { + - WebkitFontSmoothing: 'auto', + - }, - }, - }, + - }, + + styleOverrides: ` + + html { + + -webkit-font-smoothing: auto; + + } + + ` }, }, }); @@ -501,7 +712,7 @@ As the core components use emotion as a styled engine, the props used by emotion - The `body` font size has changed from `theme.typography.body2` (`0.875rem`) to `theme.typography.body1` (`1rem`). To return to the previous size, you can override it in the theme: ```js - const theme = createMuiTheme({ + const theme = createTheme({ typography: { body1: { fontSize: '0.875rem', @@ -519,11 +730,11 @@ As the core components use emotion as a styled engine, the props used by emotion ```diff <Dialog - onEnter={onEnter} - - onEntered={onEntered}, - - onEntering={onEntered}, - - onExit={onEntered}, - - onExited={onEntered}, - - onExiting={onEntered} + - onEntered={onEntered} + - onEntering={onEntering} + - onExit={onExit} + - onExited={onExited} + - onExiting={onExiting} + TransitionProps={{ + onEnter, + onEntered, @@ -535,7 +746,9 @@ As the core components use emotion as a styled engine, the props used by emotion /> ``` -- Remove the `disableBackdropClick` prop because redundant. Ignore close events from `onClose` when `reason === 'backdropClick'` instead. + You can use the [`use-transitionprops` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#use-transitionprops) for automatic migration. + +- Remove the `disableBackdropClick` prop because it is redundant. Ignore close events from `onClose` when `reason === 'backdropClick'` instead. ```diff <Dialog @@ -549,7 +762,7 @@ As the core components use emotion as a styled engine, the props used by emotion /> ``` -- [withMobileDialog] Remove this higher-order component. The hook API allows a simpler and more flexible solution: +- Remove the `withMobileDialog` higher-order component. The hook API allows a simpler and more flexible solution: ```diff -import withMobileDialog from '@material-ui/core/withMobileDialog'; @@ -567,9 +780,20 @@ As the core components use emotion as a styled engine, the props used by emotion +export default ResponsiveDialog; ``` +- Flatten DialogTitle DOM structure, remove `disableTypography` prop + + ```diff + -<DialogTitle disableTypography> + - <Typography variant="h4" component="h2"> + +<DialogTitle> + + <Typography variant="h4" component="span"> + My header + </Typography> + ``` + ### Divider -- Use border instead of background color. It prevents inconsistent height on scaled screens. For people customizing the color of the border, the change requires changing the override CSS property: +- Use border instead of background color. It prevents inconsistent height on scaled screens. If you have customized the color of the border, you will need to update the CSS property override: ```diff .MuiDivider-root { @@ -640,27 +864,66 @@ As the core components use emotion as a styled engine, the props used by emotion ### Fab -- Rename `round` to `circular` for consistency. Los valores posibles deben ser adjetivos, no sustantivos: +- Rename `round` to `circular` for consistency: ```diff -<Fab variant="round"> +<Fab variant="circular"> ``` +### FormControl (Control de formulario) + +- Change the default variant from `standard` to `outlined`. Standard has been removed from the Material Design guidelines. + + ```diff + -<FormControl value="Standard" /> + -<FormControl value="Outlined" variant="outlined" /> + +<FormControl value="Standard" variant="standard" /> + +<FormControl value="Outlined" /> + ``` + +[This codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#variant-prop) will automatically update your code. + ### Grid -- Renombrar prop `justify` con `justifyContent` para estar alineado con el nombre de propiedad CSS. +- Rename `justify` prop to `justifyContent` to align with the CSS property name. ```diff -<Grid justify="center"> +<Grid justifyContent="center"> ``` + You can use the [`component-rename-prop` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#component-rename-prop) for automatic migration. + +- The props: `alignItems` `alignContent` and `justifyContent` and their `classes` and style overrides keys were removed: "align-items-xs-center", "align-items-xs-flex-start", "align-items-xs-flex-end", "align-items-xs-baseline", "align-content-xs-center", "align-content-xs-flex-start", "align-content-xs-flex-end", "align-content-xs-space-between", "align-content-xs-space-around", "justify-content-xs-center", "justify-content-xs-flex-end", "justify-content-xs-space-between", "justify-content-xs-space-around" and "justify-content-xs-space-evenly". These props are now considered part of the system, not on the `Grid` component itself. If you still wish to add overrides for them, you can use the `theme.components.MuiGrid.variants` options. For example + + ```diff + const theme = createTheme({ + components: { + MuiGrid: { + - styleOverrides: { + - "align-items-xs-flex-end": { + - marginTop: '20px', + - }, + - }, + + variants: { + + props: { alignItems: "flex-end" }, + + style: { + + marginTop: '20px', + + }, + + }], + }, + }, + }); + ``` + + You can use the [`grid-justify-justifycontent` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#grid-justify-justifycontent) for automatic migration. + ### GridList - Rename the `GridList` components to `ImageList` to align with the current Material Design naming. - Rename the GridList `spacing` prop to `gap` to align with the CSS attribute. -- Rename the GridList `cellHeight` prop to `rowHieght`. +- Rename the GridList `cellHeight` prop to `rowHeight`. - Add the `variant` prop to GridList. - Rename the GridListItemBar `actionPosition` prop to `position`. (Note also the related classname changes.) - Use CSS object-fit. For IE11 support either use a polyfill such as https://www.npmjs.com/package/object-fit-images, or continue to use the v4 component. @@ -689,15 +952,62 @@ As the core components use emotion as a styled engine, the props used by emotion +</ImageList> ``` -### Icon +### Hidden -- The default value of `fontSize` was changed from `default` to `medium` for consistency. In the unlikey event that you were using the value `default`, the prop can be removed: +- This component was removed because its functionality can be created with the [`sx`](/system/basics/#the-sx-prop) prop or the [`useMediaQuery`](/components/use-media-query) hook. + + Use the `sx` prop to replace `implementation="css"`: + + ```diff + -<Hidden implementation="css" xlUp><Paper /></Hidden> + -<Hidden implementation="css" xlUp><button /></Hidden> + +<Paper sx={{ display: { xl: 'none', xs: 'block' } }} /> + +<Box component="button" sx={{ display: { xl: 'none', xs: 'block' } }} /> + ``` + + ```diff + -<Hidden implementation="css" mdDown><Paper /></Hidden> + -<Hidden implementation="css" mdDown><button /></Hidden> + +<Paper sx={{ display: { xs: 'none', md: 'block' } }} /> + +<Box component="button" sx={{ display: { xs: 'none', md: 'block' } }} /> + ``` + + Use the `useMediaQuery` hook to replace `implementation="js"`: + + ```diff + -<Hidden implementation="js" xlUp><Paper /></Hidden> + +const hidden = useMediaQuery(theme => theme.breakpoints.up('xl')); + +return hidden ? null : <Paper />; + ``` + +### Ubicación de Etiqueta + +- The default value of `fontSize` was changed from `default` to `medium` for consistency. In the unlikely event that you were using the value `default`, the prop can be removed: ```diff -<Icon fontSize="default">icon-name</Icon> +<Icon>icon-name</Icon> ``` +### IconButton (Botón de ícono) + +- The default size's padding is reduced to `8px` which makes the default IconButton size of `40px`. To get the old default size (`48px`), use `size="large"`. The change was done to better match Google's products when Material Design stopped documenting the icon button pattern. + + ```diff + - <IconButton> + + <IconButton size="large"> + ``` + +- `span` element that wraps children has been removed. `label` classKey is also removed. More details about [this change](https://github.com/mui-org/material-ui/pull/26666). + + ```diff + <button class="MuiIconButton-root"> + - <span class="MuiIconButton-label"> + <svg /> + - </span> + </button> + ``` + ### Menu - The onE\* transition props were removed. Use TransitionProps instead. @@ -705,11 +1015,11 @@ As the core components use emotion as a styled engine, the props used by emotion ```diff <Menu - onEnter={onEnter} - - onEntered={onEntered}, - - onEntering={onEntered}, - - onExit={onEntered}, - - onExited={onEntered}, - - onExiting={onEntered} + - onEntered={onEntered} + - onEntering={onEntering} + - onExit={onExit} + - onExited={onExited} + - onExiting={onExiting} + TransitionProps={{ + onEnter, + onEntered, @@ -721,9 +1031,41 @@ As the core components use emotion as a styled engine, the props used by emotion > ``` + > Note: The `selectedMenu` variant will no longer vertically align the selected item with the anchor. + + You can use the [`use-transitionprops` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#use-transitionprops) for automatic migration. + +- Change the default value of `anchorOrigin.vertical` to follow the Material Design guidelines. The menu now displays below the anchor instead of on top of it. You can restore the previous behavior with: + + ```diff + <Menu + + anchorOrigin={{ + + vertical: 'top', + + horizontal: 'left', + + }} + ``` + +### MenuItem + +- The `MenuItem` component inherits the `ButtonBase` component instead of `ListItem`. The class names related to "MuiListItem-\*" are removed and theming `ListItem` is no longer affecting `MenuItem`. + + ```diff + -<li className="MuiButtonBase-root MuiMenuItem-root MuiListItem-root"> + +<li className="MuiButtonBase-root MuiMenuItem-root"> + ``` + +- prop `listItemClasses` is removed, use `classes` instead. + + ```diff + -<MenuItem listItemClasses={{...}}> + +<MenuItem classes={{...}}> + ``` + + Read more about [MenuItem CSS API](/api/menu-item/#css) + ### Modal -- Remove the `disableBackdropClick` prop because redundant. Ignore close events from `onClose` when `reason === 'backdropClick'` instead. +- Remove the `disableBackdropClick` prop because it is redundant. Use `onClose` with `reason === 'backdropClick'` instead. ```diff <Modal @@ -737,7 +1079,7 @@ As the core components use emotion as a styled engine, the props used by emotion /> ``` -- Remove the `onEscapeKeyDown` prop because redundant. Use `onClose` with `reason === "escapeKeyDown"` instead. +- Remove the `onEscapeKeyDown` prop because it is redundant. Use `onClose` with `reason === "escapeKeyDown"` instead. ```diff <Modal @@ -752,6 +1094,38 @@ As the core components use emotion as a styled engine, the props used by emotion - Remove `onRendered` prop. Depending on your use case either use a [callback ref](https://reactjs.org/docs/refs-and-the-dom.html#callback-refs) on the child element or an effect hook in the child component. +### NativeSelect + +- Merge the `selectMenu` slot into `select`. Slot `selectMenu` was redundant. The `root` slot is no longer applied to the select, but to the root. + + ```diff + -<NativeSelect classes={{ root: 'class1', select: 'class2', selectMenu: 'class3' }} /> + +<NativeSelect classes={{ select: 'class1 class2 class3' }} /> + ``` + +### OutlinedInput (Campo de entrada delineado) + +- Remove the `labelWidth` prop. The `label` prop now fulfills the same purpose, using CSS layout instead of JavaScript measurement to render the gap in the outlined. + + ```diff + -<OutlinedInput labelWidth={20} /> + +<OutlinedInput label="First Name" /> + ``` + +### Paper + +- Change the background opacity based on the elevation in dark mode. This change was done to follow the Material Design guidelines. You can revert it in the theme: + + ```diff + const theme = createTheme({ + components: { + MuiPaper: { + + styleOverrides: { root: { backgroundImage: 'unset' } }, + }, + }, + }); + ``` + ### Pagination - Mueve el componente del laboratorio al core. El componente ahora es estable. @@ -765,9 +1139,9 @@ As the core components use emotion as a styled engine, the props used by emotion +import usePagination from '@material-ui/core/usePagination'; ``` - You can use our [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. + You can use the [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. -- Rename `round` to `circular` for consistency. Los valores posibles deben ser adjetivos, no sustantivos: +- Rename `round` to `circular` for consistency: ```diff -<Pagination shape="round"> @@ -783,11 +1157,11 @@ As the core components use emotion as a styled engine, the props used by emotion ```diff <Popover - onEnter={onEnter} - - onEntered={onEntered}, - - onEntering={onEntered}, - - onExit={onEntered}, - - onExited={onEntered}, - - onExiting={onEntered} + - onEntered={onEntered} + - onEntering={onEntering} + - onExit={onExit} + - onExited={onExited} + - onExiting={onExiting} + TransitionProps={{ + onEnter, + onEntered, @@ -799,6 +1173,10 @@ As the core components use emotion as a styled engine, the props used by emotion /> ``` + You can use the [`use-transitionprops` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#use-transitionprops) for automatic migration. + +- The `getContentAnchorEl` prop was removed to simplify the positioning logic. + ### Popper - Upgrade [Popper.js](https://github.com/popperjs/popper-core) from v1 to v2. This third-party library has introduced a lot of changes.<br /> You can read [their migration guide](https://popper.js.org/docs/v2/migration-guide/) or the following summary: @@ -810,7 +1188,7 @@ As the core components use emotion as a styled engine, the props used by emotion - '&[x-placement*="bottom"] $arrow': { + '&[data-popper-placement*="bottom"] $arrow': { ``` - - Method names have changed. + - Method names have changed: ```diff -popperRef.current.scheduleUpdate() @@ -828,6 +1206,25 @@ As the core components use emotion as a styled engine, the props used by emotion - Remove `onRendered` prop. Depending on your use case either use a [callback ref](https://reactjs.org/docs/refs-and-the-dom.html#callback-refs) on the child element or an effect hook in the child component. +### Radio + +- The radio color prop is now "primary" by default. To continue using the "secondary" color, you must explicitly indicate `secondary`. This brings the radio closer to the Material Design guidelines. + + ```diff + -<Radio /> + +<Radio color="secondary /> + ``` + +- The component doesn't have `.MuiIconButton-root` and `.MuiIconButton-label` class names anymore, target `.MuiButtonBase-root` instead. + + ```diff + - <span class="MuiIconButton-root MuiButtonBase-root MuiRadio-root PrivateSwitchBase-root"> + - <span class="MuiIconButton-label"> + - <input class="PrivateSwitchBase-input"> + + <span class="MuiButtonBase-root MuiRadio-root PrivateSwitchBase-root"> + + <span class="PrivateSwitchBase-input"> + ``` + ### Rating - Mueve el componente del laboratorio al core. El componente ahora es estable. @@ -837,7 +1234,7 @@ As the core components use emotion as a styled engine, the props used by emotion +import Rating from '@material-ui/core/Rating'; ``` - You can use our [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. + You can use the [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. - Change the default empty icon to improve accessibility. If you have a custom `icon` prop but no `emptyIcon` prop, you can restore the previous behavior with: @@ -870,6 +1267,33 @@ As the core components use emotion as a styled engine, the props used by emotion +<Button ref={ref} /> ``` +### Selección + +- Change the default variant from `standard` to `outlined`. Standard has been removed from the Material Design guidelines. If you are composing the Select with a form control component, you only need to update `FormControl`, the select inherits the variant from its context. + + ```diff + -<Select value="Standard" /> + -<Select value="Outlined" variant="outlined" /> + +<Select value="Standard" variant="standard" /> + +<Select value="Outlined" /> + ``` + +[This codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#variant-prop) will automatically update your code. + +- Remove the `labelWidth` prop. The `label` prop now fulfills the same purpose, using CSS layout instead of JavaScript measurement to render the gap in the outlined. The TextField already handles it by default. + + ```diff + -<Select variant="outlined" labelWidth={20} /> + +<Select variant="outlined" label="Gender" /> + ``` + +- Merge the `selectMenu` slot into `select`. Slot `selectMenu` was redundant. The `root` slot is no longer applied to the select, but to the root. + + ```diff + -<Select classes={{ root: 'class1', select: 'class2', selectMenu: 'class3' }} /> + +<Select classes={{ select: 'class1 class2 class3' }} /> + ``` + ### Skeleton - Mueve el componente del laboratorio al core. El componente ahora es estable. @@ -879,9 +1303,9 @@ As the core components use emotion as a styled engine, the props used by emotion +import Skeleton from '@material-ui/core/Skeleton'; ``` - You can use our [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. + You can use the [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. -- Renombrar `circle` a `circular` y `rectangle` a `rectangular` para consistencia. Los valores posibles deben ser adjetivos, no sustantivos: +- Rename `circle` to `circular` and `rect` to `rectangular` for consistency: ```diff -<Skeleton variant="circle" /> @@ -901,19 +1325,22 @@ As the core components use emotion as a styled engine, the props used by emotion +<Slider onChange={(event: React. SyntheticEvent, value: unknown) => {}} /> ``` -- The `ValueLabelComponent` prop is now part of the `components` prop. +- The `ValueLabelComponent` and `ThumbComponent` prop is now part of the `components` prop. ```diff - -<Slider ValueLabelComponent={CustomValueLabel} /> - +<Slider components={{ ValueLabel: CustomValueLabel }} /> + <Slider + - ValueLabelComponent={CustomValueLabel} + - ThumbComponent={CustomThumb} + + components={{ + + ValueLabel: CustomValueLabel, + + Thumb: CustomThumb, + + }} + /> ``` -- The `ThumbComponent` prop is not part of the `components` prop. +- Rework the CSS to match the latest [Material Design guidelines](https://material.io/components/sliders) and make custom styles more intuitive. [See documentation](/components/slider/). <a href="/components/slider/#continuous-sliders"><img width="247" alt="" src="https://user-images.githubusercontent.com/3165635/121884800-a8808600-cd13-11eb-8cdf-e25de8f1ba73.png" style="margin: auto"></a> - ```diff - -<Slider ThumbComponent={CustomThumb} /> - +<Slider components={{ Thumb: CustomThumb }} /> - ``` + You can reduce the density of the slider, closer to v4 with the [`size="small"` prop](/components/slider/#sizes). ### Snackbar @@ -929,11 +1356,11 @@ As the core components use emotion as a styled engine, the props used by emotion ```diff <Snackbar - onEnter={onEnter} - - onEntered={onEntered}, - - onEntering={onEntered}, - - onExit={onEntered}, - - onExited={onEntered}, - - onExiting={onEntered} + - onEntered={onEntered} + - onEntering={onEntering} + - onExit={onExit} + - onExited={onExited} + - onExiting={onExiting} + TransitionProps={{ + onEnter, + onEntered, @@ -945,6 +1372,8 @@ As the core components use emotion as a styled engine, the props used by emotion /> ``` + You can use the [`use-transitionprops` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#use-transitionprops) for automatic migration. + ### SpeedDial - Mueve el componente del laboratorio al core. El componente ahora es estable. @@ -958,7 +1387,7 @@ As the core components use emotion as a styled engine, the props used by emotion +import SpeedDialIcon from '@material-ui/core/SpeedDialIcon'; ``` - You can use our [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. + You can use the [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. ### Stepper (Pasos a pasos) @@ -1005,6 +1434,39 @@ As the core components use emotion as a styled engine, the props used by emotion </SvgIcon> ``` +### Switch + +- Remove the second argument from `onChange`. You can pull out the checked state by accessing `event.target.checked`. + + ```diff + function MySwitch() { + - const handleChange = (event: React.ChangeEvent<HTMLInputElement>, checked: boolean) => { + + const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => { + + const checked = event.target.checked; + }; + + return <Switch onChange={handleChange} />; + } + ``` + +- The switch color prop is now "primary" by default. To continue using the "secondary" color, you must explicitly indicate `secondary`. This brings the switch closer to the Material Design guidelines. + + ```diff + -<Switch /> + +<Switch color="secondary" /> + ``` + +- The component doesn't have `.MuiIconButton-root` and `.MuiIconButton-label` class names anymore, target `.MuiButtonBase-root` instead. + + ```diff + <span class="MuiSwitch-root"> + - <span class="MuiIconButton-root MuiButtonBase-root MuiSwitch-switchBase PrivateSwitchBase-root"> + - <span class="MuiIconButton-label"> + - <input class="MuiSwitch-input PrivateSwitchBase-input"> + + <span class="MuiButtonBase-root MuiSwitch-switchBase PrivateSwitchBase-root"> + + <span class="MuiSwitch-input PrivateSwitchBase-input"> + ``` + ### Table (Tabla) - The customization of the table pagination's actions labels must be done with the `getItemAriaLabel` prop. This increases consistency with the `Pagination` component. @@ -1012,7 +1474,7 @@ As the core components use emotion as a styled engine, the props used by emotion ```diff <TablePagination - backIconButtonText="Avant" - - nextIconButtonText="Après + - nextIconButtonText="Après" + getItemAriaLabel={…} ``` @@ -1026,8 +1488,42 @@ As the core components use emotion as a styled engine, the props used by emotion + onPageChange={()=>{}} ``` +- Separate classes for different table pagination labels. This allows simpler customizations. + + ```diff + <TablePagination + - classes={{ caption: 'foo' }} + + classes={{ selectLabel: 'foo', displayedRows: 'foo' }} + /> + ``` + +- Move the custom class on `input` to `select`. The `input` key is being applied on another element. + + ```diff + <TablePagination + - classes={{ input: 'foo' }} + + classes={{ select: 'foo' }} + /> + ``` + +- Rename the `default` value of the `padding` prop to `normal`. + + ```diff + -<Table padding="default" /> + -<TableCell padding="default" /> + +<Table padding="normal" /> + +<TableCell padding="normal" /> + ``` + ### Pestañas +- Change the default `indicatorColor` and `textColor` prop values to "primary". This is done to match the most common use cases with Material Design. + + ```diff + -<Tabs /> + +<Tabs indicatorColor="primary" textColor="inherit" /> + ``` + - TypeScript: The `event` in `onChange` is no longer typed as a `React.ChangeEvent` but `React.SyntheticEvent`. ```diff @@ -1049,9 +1545,12 @@ As the core components use emotion as a styled engine, the props used by emotion +<Tabs scrollButtons={false} /> ``` +- Tab `minWidth` changed from `72px` => `90px` (without media-query) according to [material-design spec](https://material.io/components/tabs#specs) +- Tab `maxWidth` changed from `264px` => `360px` according to [material-design spec](https://material.io/components/tabs#specs) + ### TextField -- Change the default variant from `standard` to `outlined`. Standard has been removed from the Material Design Guidelines. +- Change the default variant from `standard` to `outlined`. Standard has been removed from the Material Design guidelines. ```diff -<TextField value="Standard" /> @@ -1060,7 +1559,7 @@ As the core components use emotion as a styled engine, the props used by emotion +<TextField value="Outlined" /> ``` -[This codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#textfield-variant-prop) will automatically update your code. + You can use the [`variant-prop` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#variant-prop) for automatic migration. - Rename `rowsMax` prop with `maxRows` for consistency with HTML attributes. @@ -1101,6 +1600,15 @@ As the core components use emotion as a styled engine, the props used by emotion +<Input size="small" /> ``` +- Set the InputAdornment `position` prop to `start` or `end`. Use `start` if used as the value of the `startAdornment` prop. Use `end` if used as the value of the `endAdornment` prop. + + ```diff + -<TextField startAdornment={<InputAdornment>Kg</InputAdornment>} /> + -<TextField endAdornment={<InputAdornment>Kg</InputAdornment>} /> + +<TextField startAdornment={<InputAdornment position="start">Kg</InputAdornment>} /> + +<TextField endAdornment={<InputAdornment position="end">Kg</InputAdornment>} /> + ``` + ### TextareaAutosize - Remove the `rows` prop, use the `minRows` prop instead. This change aims to clarify the behavior of the prop. @@ -1135,7 +1643,7 @@ As the core components use emotion as a styled engine, the props used by emotion +import ToggleButtonGroup from '@material-ui/core/ToggleButtonGroup'; ``` - You can use our [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. + You can use the [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. ### Tooltip @@ -1154,24 +1662,241 @@ As the core components use emotion as a styled engine, the props used by emotion ### Tipografía -- Replace the `srOnly` prop so as to not duplicate the capabilities of [System](https://material-ui.com/system/basics/): +- Remove the `srOnly` variant. You can use the `visuallyHidden` utility in conjunction with the `sx` prop instead. ```diff - -import Typography from '@material-ui/core/Typography'; - +import { visuallyHidden } from '@material-ui/system'; - +import styled from 'styled-component'; - - +const Span = styled('span')(visuallyHidden); + +import { visuallyHidden } from '@material-ui/utils'; -<Typography variant="srOnly">Create a user</Typography> - +<Span>Create a user</Span> + +<span style={visuallyHidden}>Create a user</span> ``` -### Sistema +- The following `classes` and style overrides keys were removed: "colorInherit", "colorPrimary", "colorSecondary", "colorTextPrimary", "colorTextSecondary", "colorError", "displayInline" and "displayBlock". These props are now considered part of the system, not on the `Typography` component itself. If you still wish to add overrides for them, you can use the `theme.components.MuiTypography.variants` options. For example -- Replace `css` prop with `sx` to avoid collision with styled-components & emotion CSS props. + ```diff + const theme = createTheme({ + components: { + MuiTypography: { + - styleOverrides: { + - colorSecondary: { + - marginTop: '20px', + - }, + - }, + + variants: { + + props: { color: "secondary" }, + + style: { + + marginTop: '20px', + + }, + + }], + }, + }, + }); + ``` + +### `@material-ui/core/styles` + +#### createGenerateClassName + +- The `createGenerateClassName` function is no longer exported from `@material-ui/core/styles`. You should import it directly from `@material-ui/styles`. + + ```diff + -import { createGenerateClassName } from '@material-ui/core/styles'; + +import { createGenerateClassName } from '@material-ui/styles'; + ``` + +#### jssPreset + +- The `jssPreset` object is no longer exported from `@material-ui/core/styles`. You should import it directly from `@material-ui/styles`. + + ```diff + -import { jssPreset } from '@material-ui/core/styles'; + +import { jssPreset } from '@material-ui/styles'; + ``` + +#### makeStyles + +- The `makeStyles` JSS utility is no longer exported from `@material-ui/core/styles`. You can use `@material-ui/styles/makeStyles` instead. Make sure to add a `ThemeProvider` at the root of your application, as the `defaultTheme` is no longer available. If you are using this utility together with `@material-ui/core`, it's recommended you use the `ThemeProvider` component from `@material-ui/core/styles` instead. + + ```diff + -import { makeStyles } from '@material-ui/core/styles'; + +import { makeStyles } from '@material-ui/styles'; + +import { createTheme, ThemeProvider } from '@material-ui/core/styles'; + + +const theme = createTheme(); + const useStyles = makeStyles((theme) => ({ + background: theme.palette.primary.main, + })); + function Component() { + const classes = useStyles(); + return <div className={classes.root} /> + } + + // In the root of your app + function App(props) { + - return <Component />; + + return <ThemeProvider theme={theme}><Component {...props} /></ThemeProvider>; + } + ``` + +#### MuiThemeProvider + +- The `MuiThemeProvider` component is no longer exported from `@material-ui/core/styles`. Use `ThemeProvider` instead. + + ```diff + -import { MuiThemeProvider } from '@material-ui/core/styles'; + +import { ThemeProvider } from '@material-ui/core/styles'; + ``` + +#### ServerStyleSheets + +- The `ServerStyleSheets` component is no longer exported from `@material-ui/core/styles`. You should import it directly from `@material-ui/styles`. + + ```diff + -import { ServerStyleSheets } from '@material-ui/core/styles'; + +import { ServerStyleSheets } from '@material-ui/styles'; + ``` + +#### styled + +- The `styled` JSS utility is no longer exported from `@material-ui/core/styles`. You can use `@material-ui/styles/styled` instead. Make sure to add a `ThemeProvider` at the root of your application, as the `defaultTheme` is no longer available. If you are using this utility together with `@material-ui/core`, it's recommended you use the `ThemeProvider` component from `@material-ui/core/styles` instead. + + ```diff + -import { styled } from '@material-ui/core/styles'; + +import { styled } from '@material-ui/styles'; + +import { createTheme, ThemeProvider } from '@material-ui/core/styles'; + + +const theme = createTheme(); + const MyComponent = styled('div')(({ theme }) => ({ background: theme.palette.primary.main })); + + function App(props) { + - return <MyComponent />; + + return <ThemeProvider theme={theme}><MyComponent {...props} /></ThemeProvider>; + } + ``` + +#### StylesProvider + +- The `StylesProvider` component is no longer exported from `@material-ui/core/styles`. You should import it directly from `@material-ui/styles`. + + ```diff + -import { StylesProvider } from '@material-ui/core/styles'; + +import { StylesProvider } from '@material-ui/styles'; + ``` + +#### useThemeVariants + +- The `useThemeVariants` hook is no longer exported from `@material-ui/core/styles`. You should import it directly from `@material-ui/styles`. + + ```diff + -import { useThemeVariants } from '@material-ui/core/styles'; + +import { useThemeVariants } from '@material-ui/styles'; + ``` + +#### withStyles + +- Replace the `innerRef` prop with the `ref` prop. Refs are now automatically forwarded to the inner component. + + ```diff + import * as React from 'react'; + import { withStyles } from '@material-ui/styles'; + + const MyComponent = withStyles({ + root: { + backgroundColor: 'red', + }, + })(({ classes }) => <div className={classes.root} />); + + function MyOtherComponent(props) { + const ref = React.useRef(); + - return <MyComponent innerRef={ref} />; + + return <MyComponent ref={ref} />; + } + ``` + +- The `withStyles` JSS utility is no longer exported from `@material-ui/core/styles`. You can use `@material-ui/styles/withStyles` instead. Make sure to add a `ThemeProvider` at the root of your application, as the `defaultTheme` is no longer available. If you are using this utility together with `@material-ui/core`, you should use the `ThemeProvider` component from `@material-ui/core/styles` instead. + + ```diff + -import { withStyles } from '@material-ui/core/styles'; + +import { withStyles } from '@material-ui/styles'; + +import { createTheme, ThemeProvider } from '@material-ui/core/styles'; + + +const defaultTheme = createTheme(); + const MyComponent = withStyles((props) => { + const { classes, className, ...other } = props; + return <div className={clsx(className, classes.root)} {...other} /> + })(({ theme }) => ({ root: { background: theme.palette.primary.main }})); + + function App() { + - return <MyComponent />; + + return <ThemeProvider theme={defaultTheme}><MyComponent /></ThemeProvider>; + } + ``` + +#### withTheme + +- The `withTheme` HOC utility has been removed from the `@material-ui/core/styles` package. You can use `@material-ui/styles/withTheme` instead. Make sure to add a `ThemeProvider` at the root of your application, as the `defaultTheme` is no longer available. If you are using this utility together with `@material-ui/core`, it's recommended you use the `ThemeProvider` component from `@material-ui/core/styles` instead. + + ```diff + -import { withTheme } from '@material-ui/core/styles'; + +import { withTheme } from '@material-ui/styles'; + +import { createTheme, ThemeProvider } from '@material-ui/core/styles'; + + +const theme = createTheme(); + const MyComponent = withTheme(({ theme }) => <div>{props.theme.direction}</div>); + + function App(props) { + - return <MyComponent />; + + return <ThemeProvider theme={theme}><MyComponent {...props} /></ThemeProvider>; + } + ``` + +- Replace the `innerRef` prop with the `ref` prop. Refs are now automatically forwarded to the inner component. + + ```diff + import * as React from 'react'; + import { withTheme } from '@material-ui/core/styles'; + + const MyComponent = withTheme(({ theme }) => <div>{props.theme.direction}</div>); + + function MyOtherComponent(props) { + const ref = React.useRef(); + - return <MyComponent innerRef={ref} />; + + return <MyComponent ref={ref} />; + } + ``` + +#### withWidth + +- This HOC was removed. There's an alternative using the `useMediaQuery` hook on [this page](/components/use-media-query/#migrating-from-withwidth). + +### `@material-ui/types` + +- Rename the exported `Omit` type in `@material-ui/types`. The module is now called `DistributiveOmit`. The change removes the confusion with the built-in `Omit` helper introduced in TypeScript v3.5. The built-in `Omit`, while similar, is non-distributive. This leads to differences when applied to union types. [See this StackOverflow answer for further details](https://stackoverflow.com/a/57103940/1009797). + + ```diff + -import { Omit } from '@material-ui/types'; + +import { DistributiveOmit } from '@material-ui/types'; + ``` + +### `@material-ui/styles` + +#### ThemeProvider + +If you are using the utilities from `@material-ui/styles` together with the `@material-ui/core`, you should replace the use of `ThemeProvider` from `@material-ui/styles` with the one exported from `@material-ui/core/styles`. This way, the `theme` provided in the context will be available in both the styling utilities exported from `@material-ui/styles`, like `makeStyles`, `withStyles` etc. and the Material-UI components. ```diff --<Box css={{ color: 'primary.main' }} /> -+<Box sx={{ color: 'primary.main' }} /> +-import { ThemeProvider } from '@material-ui/styles'; ++import { ThemeProvider } from '@material-ui/core/styles'; +``` + +#### Default theme (TypeScript) + +The `@material-ui/styles` package is no longer part of `@material-ui/core/styles`. If you are using `@material-ui/styles` together with `@material-ui/core` you need to add a module augmentation for the `DefaultTheme`. + +```ts +import { Theme } from '@material-ui/core/styles'; + +declare module '@material-ui/styles' { + interface DefaultTheme extends Theme {} +} ``` diff --git a/docs/src/pages/guides/migration-v4/migration-v4-fr.md b/docs/src/pages/guides/migration-v4/migration-v4-fr.md index 3c20a3b40b571f..81e15c02e1ae5e 100644 --- a/docs/src/pages/guides/migration-v4/migration-v4-fr.md +++ b/docs/src/pages/guides/migration-v4/migration-v4-fr.md @@ -65,10 +65,24 @@ Support for non-ref-forwarding class components in the `component` prop or as im ### Styled engine -The styled engine used in v5 by default is [`emotion`](https://github.com/emotion-js/emotion). While migration from JSS to emotion, if you are using JSS style overrides for your components (for example overrides created by `makeStyles`), you need to take care of the CSS injection order. In order to do this, you need to have on the top of your application the `StylesProvider` with the `injectFirst` option. Here is an example of it: +The minimum supported version of React was increased from v16.8.0 to v17.0.0. + +### Thème + +The minimum supported version of TypeScript was increased from v3.2 to v3.5. We try to align with types released from [DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped) (i.e. packages published on npm under the `@types` namespace). We will not change the minimum supported version in a major version of Material-UI. However, we generally recommend to not use a TypeScript version older than the [lowest supported version of DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped#older-versions-of-typescript-33-and-earlier) + +### Style library + +The styled engine used in v5 by default is [`emotion`](https://github.com/emotion-js/emotion). While migration from JSS to emotion, if you are using JSS style overrides for your components (for example overrides created by `makeStyles`), you need to take care of the CSS injection order. To do so, you need to have the `StyledEngineProvider` with the `injectFirst` option at the top of your component tree. Here is an example: ```jsx -Now you can override Material-UI's styles. import * as React from 'react'; +import * as React from 'react'; +import { StylesProvider } from '@material-ui/core'; + +export default function GlobalCssPriority() { + return ( + <StylesProvider injectFirst> + {/* Your component tree. import * as React from 'react'; import { StylesProvider } from '@material-ui/core'; export default function GlobalCssPriority() { @@ -80,21 +94,15 @@ export default function GlobalCssPriority() { } ``` -**Note:** If you are using emotion and have a custom cache in your app, that one will override the one coming from Material-UI. In order for the injection order to still be correct, you need to add the prepend option. Here is an example: +> **Note:** If you are using emotion and have a custom cache in your app, that one will override the one coming from Material-UI. In order for the injection order to still be correct, you need to add the prepend option. Here is an example: ```jsx import * as React from 'react'; -import { CacheProvider } from '@emotion/react'; -import createCache from '@emotion/cache'; - -const cache = createCache({ - key: 'css', - prepend: true, -}); +import { StylesProvider } from '@material-ui/core'; -export default function PlainCssPriority() { +export default function GlobalCssPriority() { return ( - <CacheProvider value={cache}> + <StylesProvider injectFirst> {/* Your component tree. import * as React from 'react'; import { StylesProvider } from '@material-ui/core'; @@ -102,16 +110,31 @@ export default function GlobalCssPriority() { return ( <StylesProvider injectFirst> {/* Your component tree. */} - </CacheProvider> + </StylesProvider> ); } ``` -**Note:** If you are using styled-components and have `StyleSheetManager` with a custom `target`, make sure that the target is the first element in the HTML `<head>`. If you are curious to see how it can be done, you can take a look on the `StylesProvider` implementation in the `@material-ui/styled-engine-sc` package. +> **Note:** If you are using styled-components and have `StyleSheetManager` with a custom `target`, make sure that the target is the first element in the HTML `<head>`. If you are curious to see how it can be done, you can take a look on the `StylesProvider` implementation in the `@material-ui/styled-engine-sc` package. ### Thème -- Breakpoints are now treated as values instead of ranges. The behavior of `down(key)` was changed to define media query less than the value defined with the corresponding breakpoint (exclusive). The `between(start, end)` was also updated to define media query for the values between the actual values of start (inclusive) and end (exclusive). When using the `down()` breakpoints utility you need to update the breakpoint key by one step up. When using the `between(start, end)` the end breakpoint should also be updated by one step up. The same should be done when using the `Hidden` component. Find examples of the changes required defined below: +- The function `createMuiTheme` was renamed to `createTheme` to make more intuitive to use with `ThemeProvider`. + + ```diff + - import { fade } from '@material-ui/core/styles'; ++ import { alpha } from '@material-ui/core/styles'; + +const classes = makeStyles(theme => ({ +- backgroundColor: fade(theme.palette.primary.main, theme.palette.action.selectedOpacity), ++ backgroundColor: alpha(theme.palette.primary.main, theme.palette.action.selectedOpacity), +})); + ``` + +- Change the default variant from `standard` to `outlined`. Standard has been removed from the Material Design Guidelines. +- Breakpoints are now treated as values instead of ranges. The behavior of `down(key)` was changed to define media query less than the value defined with the corresponding breakpoint (exclusive). The `between(start, end)` was also updated to define media query for the values between the actual values of start (inclusive) and end (exclusive). When using the `down()` breakpoints utility you need to update the breakpoint key by one step up. When using the `between(start, end)` the end breakpoint should also be updated by one step up. + + Here are some examples of the changes required: ```diff -theme.breakpoints.down('sm') // '@media (max-width:959.95px)' - [0, sm + 1) => [0, md) @@ -128,11 +151,22 @@ export default function GlobalCssPriority() { +theme.breakpoints.up('sm') // '@media (min-width:600px)' ``` + For a smoother transition, the `adaptV4Theme` helper allows you to iteratively upgrade to the new theme structure. + + The same should be done when using the `Hidden` component: + ```diff -<Hidden smDown>{...}</Hidden> // '@media (min-width:600px)' +<Hidden mdDown>{...}</Hidden> // '@media (min-width:600px)' ``` +- Remove the `onEscapeKeyDown` prop because redundant. Use `onClose` with `reason === "escapeKeyDown"` instead. + + ```diff + -theme.breakpoints.width('md') + +theme.breakpoints.values.md + ``` + - The signature of `theme.palette.augmentColor` helper has changed: ```diff @@ -140,24 +174,65 @@ export default function GlobalCssPriority() { +theme.palette.augmentColor({ color: red, name: 'brand' }); ``` +- The `theme.typography.round` helper was removed because it was no longer used. If you need it, use the function below: + + ```js + function round(value) { + return Math.round(value * 1e5) / 1e5; + } + ``` + +- The default breakpoints were changed to better match the common use cases. They also better match the Material Design guidelines. [Read more about the change](https://github.com/mui-org/material-ui/issues/21902) + + ```diff + { + xs: 0, + sm: 600, + - md: 960, + + md: 900, + - lg: 1280, + + lg: 1200, + - xl: 1920, + + xl: 1536, + } + ``` + + If you prefer the old breakpoint values, use the snippet below. + + ```js + import { createTheme } from '@material-ui/core/styles'; + + const theme = createTheme({ + breakpoints: { + values: { + xs: 0, + sm: 600, + md: 960, + lg: 1280, + xl: 1920, + }, + }, + }); + ``` + #### Upgrade helper For a smoother transition, the `adaptV4Theme` helper allows you to iteratively upgrade to the new theme structure. ```diff --import { createMuiTheme } from '@material-ui/core/styles'; -+import { createMuiTheme, adaptV4Theme } from '@material-ui/core/styles'; +-import Typography from '@material-ui/core/Typography'; + +import { visuallyHidden } from '@material-ui/system'; + +import styled from 'styled-component'; --const theme = createMuiTheme({ -+const theme = createMuiTheme(adaptV4Theme({ - // v4 theme --}); -+})); + +const Span = styled('span')(visuallyHidden); + + -<Typography variant="srOnly">Create a user</Typography> + +<Span>Create a user</Span> ``` -The following changes are supported by the adapter. +##### The following changes are supported by the adapter. -#### Changes +The following changes are supported by the adapter: - The "gutters" abstraction hasn't proven to be used frequently enough to be valuable. @@ -185,6 +260,8 @@ The following changes are supported by the adapter. theme.spacing(2) => '16px' ``` + You can use our [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. + - The `theme.palette.type` was renamed to `theme.palette.mode`, to better follow the "dark mode" term that is usually used for describing this feature. ```diff @@ -208,6 +285,19 @@ The following changes are supported by the adapter. 1. `props` +```diff +-import { createMuiTheme } from '@material-ui/core/styles'; ++import { createMuiTheme, adaptV4Theme } from '@material-ui/core/styles'; + +-const theme = createMuiTheme({ ++const theme = createMuiTheme(adaptV4Theme({ + // v4 theme +-}); ++})); +``` + +2. `surcharges` + ```diff import { createMuiTheme } from '@material-ui/core/styles'; @@ -227,7 +317,23 @@ const theme = createMuiTheme({ }); ``` -2. `surcharges` +### Styles + +- Renamed `fade` to `alpha` to better describe its functionality. The previous name was leading to confusion when the input color already had an alpha value. The helper **overrides** the alpha value of the color. + + ```diff + - import { fade } from '@material-ui/core/styles'; + + import { alpha } from '@material-ui/core/styles'; + + const classes = makeStyles(theme => ({ + - backgroundColor: fade(theme.palette.primary.main, theme.palette.action.selectedOpacity), + + backgroundColor: alpha(theme.palette.primary.main, theme.palette.action.selectedOpacity), + })); + ``` + + You can use our [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. + +- The component was migrated to use the `@material-ui/styled-engine` (`emotion` or `styled-components`) instead of `jss`. You should remove the `@global` key when defining the style overrides for it. ```diff import { createMuiTheme } from '@material-ui/core/styles'; @@ -248,37 +354,46 @@ const theme = createMuiTheme({ }); ``` -### Styles +### Système -- Renamed `fade` to `alpha` to better describe its functionality. The previous name was leading to confusion when the input color already had an alpha value. The helper **overrides** the alpha value of the color. +- The following system functions (and properties) were renamed, because they are considered deprecated CSS: -```diff -- import { fade } from '@material-ui/core/styles'; -+ import { alpha } from '@material-ui/core/styles'; + 1. `gridGap` to `gap` + 1. `gridRowGap` to `rowGap` + 1. `gridColumnGap` to `columnGap` -const classes = makeStyles(theme => ({ -- backgroundColor: fade(theme.palette.primary.main, theme.palette.action.selectedOpacity), -+ backgroundColor: alpha(theme.palette.primary.main, theme.palette.action.selectedOpacity), -})); -``` +- Use spacing unit in `gap`, `rowGap`, and `columnGap`. If you were using a number previously, you need to mention the px to bypass the new transformation with `theme.spacing`. -### Système + ```diff + -<Box gridColumnGap="10px" gridRowGap="20px"> ++<Box sx={{ columnGap: '10px', rowGap: '20px' }}> + ``` -- The following system functions (and properties) were renamed, because they are considered deprecated CSS: +- Replace `css` prop with `sx` to avoid collision with styled-components & emotion CSS props. -1. `gridGap` to `gap` -2. `gridColumnGap` to `columnGap` -3. `gridRowGap` to `rowGap` + ```diff + -<Box css={{ color: 'primary.main' }} /> ++<Box sx={{ color: 'primary.main' }} /> + ``` + + > Note that the system grid function wasn't documented in v4. ### Core components As the core components use emotion as a styled engine, the props used by emotion are not intercepted. The prop `as` in the following codesnippet will not be propagated to the `SomeOtherComponent`. -`<MuiComponent component={SomeOtherComponent} as="button" />` +```jsx +<MuiComponent component={SomeOtherComponent} as="button" /> +``` ### AppBar -- [AppBar] Remove z-index when position static and relative +- [AppBar] Remove z-index when position static and relative This avoids the creation of a stacking context and rendering issues. +- The `color` prop has no longer any effect in dark mode. The app bar uses the background color required by the elevation to follow the [Material Design guidelines](https://material.io/design/color/dark-theme.html). Use `enableColorOnDark` to restore the behavior of v4. + + ```jsx + <AppBar enableColorOnDark /> + ``` ### Alert @@ -291,7 +406,7 @@ As the core components use emotion as a styled engine, the props used by emotion +import AlertTitle from '@material-ui/core/AlertTitle'; ``` - You can use the [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. +You can use the [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. ### Autocomplete (Auto-complétion) @@ -304,7 +419,7 @@ As the core components use emotion as a styled engine, the props used by emotion +import useAutoComplete from '@material-ui/core/useAutocomplete'; ``` - You can use our [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. + You can use the [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. - Remove `debug` prop. There are a couple of simpler alternatives: `open={true}`, Chrome devtools ["Emulate focused"](https://twitter.com/sulco/status/1305841873945272321), or React devtools prop setter. - `renderOption` should now return the full DOM structure of the option. It makes customizations easier. You can recover from the change with: @@ -335,9 +450,32 @@ As the core components use emotion as a styled engine, the props used by emotion +<Autocomplete clearIcon={defaultClearIcon} /> ``` + You can use our [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. + +- The following values of the reason argument in `onChange` and `onClose` were renamed for consistency: + + 1. `create-option` to `createOption` + 2. `select-option` to `selectOption` + 3. `remove-option` to `removeOption` + +- Change the CSS rules that use `[data-focus="true"]` to use `.Mui-focused`. The `data-focus` attribute is not set on the focused option anymore, instead, global class names are used. + + ```diff + -'.MuiAutocomplete-option[data-focus="true"]': { + +'.MuiAutocomplete-option.Mui-focused': { + ``` + +- Rename `getOptionSelected` to `isOptionEqualToValue` to better describe its purpose. + + ```diff + <Autocomplete + - getOptionSelected={(option, value) => option.title === value.title} + + isOptionEqualToValue={(option, value) => option.title === value.title} + ``` + ### Avatar -- Rename `circle` to `circular` for consistency. The possible values should be adjectives, not nouns: +- Rename `circle` to `circular` for consistency. ```diff -<Avatar variant="circle"> @@ -346,6 +484,15 @@ As the core components use emotion as a styled engine, the props used by emotion +<Avatar classes={{ circular: 'className' }}> ``` + Since `circular` is the default value, the variant prop can be deleted: + + ```diff + -<Avatar variant="circle"> ++<Avatar> + ``` + + You can use our [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. + - Move the AvatarGroup from the lab to the core. ```diff @@ -353,9 +500,11 @@ As the core components use emotion as a styled engine, the props used by emotion +import AvatarGroup from '@material-ui/core/AvatarGroup'; ``` + You can use the [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. + ### Badge -- Rename `circle` to `circular` and `rectangle` to `rectangular` for consistency. The possible values should be adjectives, not nouns: +- Rename `circle` to `circular` and `rectangle` to `rectangular` for consistency. ```diff -<Badge overlap="circle"> @@ -380,6 +529,8 @@ As the core components use emotion as a styled engine, the props used by emotion }}> ``` + You can use our [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. + ### BottomNavigation - TypeScript: The `event` in `onChange` is no longer typed as a `React.ChangeEvent` but `React.SyntheticEvent`. @@ -391,15 +542,6 @@ As the core components use emotion as a styled engine, the props used by emotion ### Box (Boite) -- The system props have been deprecated in v5, and replaced with the `sx` prop. - - ```diff - -<Box border="1px dashed grey" p={[2, 3, 4]} m={2}> - +<Box sx={{ border: "1px dashed grey", p: [2, 3, 4], m: 2 }}> - ``` - - [This codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#box-sx-prop) will automatically update your code to the new syntax. You can [read this section](/system/basics/#api-tradeoff) for the why behind the change of API. - - The `borderRadius` system prop value transformation has been changed. If it receives a number, it multiplies this value with the `theme.shape.borderRadius` value. Use a string to provide an explicit value, in `px`. ```diff @@ -412,25 +554,37 @@ As the core components use emotion as a styled engine, the props used by emotion +<Box sx={{ borderRadius: '16px' }}> ``` + [This codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#textfield-variant-prop) will automatically update your code. + +- [This codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#box-sx-prop) will automatically update your code to the new syntax. You can [read this section](/system/basics/#api-tradeoff) for the why behind the change of API. + + ```diff + -<Box border="1px dashed grey" p={[2, 3, 4]} m={2}> + +<Box sx={{ border: "1px dashed grey", p: [2, 3, 4], m: 2 }}> + ``` + + Replace the `srOnly` prop so as to not duplicate the capabilities of [System](https://material-ui.com/system/basics/): + - The following properties were renamed, because they are considered deprecated CSS proeprties: -1. `gridGap` to `gap` -2. `gridColumnGap` to `columnGap` -3. `gridRowGap` to `rowGap` + 1. `gridGap` to `gap` + 2. `gridColumnGap` to `columnGap` + 3. `gridRowGap` to `rowGap` -```diff --<Box gridGap="10px"> -+<Box sx={{ gap: '10px' }}> -``` + ```diff + -<Box gridGap={1}> + -<Box gridColumnGap={2}> + -<Box gridRowGap={3}> + +<Box gap={1}> + +<Box columnGap={2}> + +<Box rowGap={3}> + ``` -```diff --<Box gridColumnGap="10px" gridRowGap="20px"> -+<Box sx={{ columnGap: '10px', rowGap: '20px' }}> -``` + (Note that the system grid function wasn't documented in v4.) -### Button + You can use the [`box-rename-gap` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#box-rename-gap) for automatic migration. -- The button `color` prop is now "primary" by default, and "default" has been removed. This makes the button closer to the Material Design specification and simplifies the API. +- The `clone` prop was removed because its behavior can be obtained by applying the `sx` prop directly to the child if it is a Material-UI component. ```diff -<Button color="primary" /> @@ -439,27 +593,79 @@ As the core components use emotion as a styled engine, the props used by emotion +<Button /> ``` +- The ability to pass a render prop was removed because its behavior can be obtained by applying the `sx` prop directly to the child if it is a Material-UI component. + + ```diff + -<Box sx={{ border: '1px dashed grey' }}> + - {(props) => <Button {...props}>Save</Button>} + -</Box> + +<Button sx={{ border: '1px dashed grey' }}>Save</Button> + ``` + + The Box component has a `clone` property to enable the usage of the clone element method of React. + + ```diff + -<Box sx={{ border: '1px dashed grey' }}> + - {(props) => <button {...props}>Save</button>} + -</Box> + +<Box component="button" sx={{ border: '1px dashed grey' }}>Save</Box> + ``` + +### Button + +- The button `color` prop is now "primary" by default, and "default" has been removed. This makes the button closer to the Material Design specification and simplifies the API. + + ```diff + <TablePagination + - backIconButtonText="Avant" + - nextIconButtonText="Après + + getItemAriaLabel={…} + ``` + + You can use the [`button-color-prop` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#button-color-prop) for automatic migration. + +- `span` element that wraps children has been removed. `label` classKey is also removed. More details about [this change](https://github.com/mui-org/material-ui/pull/26666). + + ```diff + <button class="MuiButton-root"> + - <span class="MuiButton-label"> + children + - </span> + </button> + ``` + ### Chip - Rename `default` variant to `filled` for consistency. + + Since `filled` is the default value, the variant prop can be deleted: + ```diff -<Chip variant="default"> +<Chip variant="filled"> ``` -### Barres de progression groupées + You can use the [`chip-variant-prop` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#chip-variant-prop) for automatic migration. + +### Case à cocher -- The `static` variant has been merged into the `determinate` variant, with the latter assuming the appearance of the former. The removed variant was rarely useful. It was an exception to Material Design, and was removed from the specification. +- The component doesn't have `.MuiIconButton-root` and `.MuiIconButton-label` class names anymore, target `.MuiButtonBase-root` instead. ```diff -<CircularProgress variant="determinate" /> ``` +### Barres de progression groupées + +- The `static` variant has been merged into the `determinate` variant, with the latter assuming the appearance of the former. It was an exception to Material Design, and was removed from the specification. + ```diff - -<CircularProgress variant="static" classes={{ static: 'className' }} /> + <CircularProgress variant="static" classes={{ static: 'className' }} /> +<CircularProgress variant="determinate" classes={{ determinate: 'className' }} /> ``` +You can use the [`circularprogress-variant` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#circularprogress-variant) for automatic migration. + > NB: If you had previously customized determinate, your customizations are probably no longer valid. Please remove them. ### Collapse @@ -478,24 +684,29 @@ As the core components use emotion as a styled engine, the props used by emotion +<Collapse classes={{ root: 'collapse' }}> ``` -###  CssBaseline +You can use the [`collapse-rename-collapsedheight` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#collapse-rename-collapsedheight) for automatic migration of both the prop and the classes key. -- The component was migrated to use the `@material-ui/styled-engine` (`emotion` or `styled-components`) instead of `jss`. You should remove the `@global` key when defining the style overrides for it. +### CssBaseline + +- The component was migrated to use the `@material-ui/styled-engine` (`emotion` or `styled-components`) instead of `jss`. You should remove the `@global` key when defining the style overrides for it. You could also start using the CSS template syntax over the JavaScript object syntax. ```diff - const theme = createMuiTheme({ - components: { - MuiCssBaseline: { - styleOverrides: { - - '@global': { - html: { - WebkitFontSmoothing: 'auto', - }, - - }, - }, - }, - }, - }); + <Dialog + - onEnter={onEnter} + - onEntered={onEntered}, + - onEntering={onEntered}, + - onExit={onEntered}, + - onExited={onEntered}, + - onExiting={onEntered} + + TransitionProps={{ + + onEnter, + + onEntered, + + onEntering, + + onExit, + + onExited, + + onExiting, + + }} + /> ``` - The `body` font size has changed from `theme.typography.body2` (`0.875rem`) to `theme.typography.body1` (`1rem`). To return to the previous size, you can override it in the theme: @@ -517,7 +728,7 @@ As the core components use emotion as a styled engine, the props used by emotion - The onE\* transition props were removed. Use TransitionProps instead. ```diff - <Dialog + <Menu - onEnter={onEnter} - onEntered={onEntered}, - onEntering={onEntered}, @@ -532,9 +743,11 @@ As the core components use emotion as a styled engine, the props used by emotion + onExited, + onExiting, + }} - /> + > ``` + You can use the [`use-transitionprops` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#use-transitionprops) for automatic migration. + - Remove the `disableBackdropClick` prop because redundant. Ignore close events from `onClose` when `reason === 'backdropClick'` instead. ```diff @@ -567,6 +780,17 @@ As the core components use emotion as a styled engine, the props used by emotion +export default ResponsiveDialog; ``` +- Flatten DialogTitle DOM structure, remove `disableTypography` prop + + ```diff + -<DialogTitle disableTypography> + - <Typography variant="h4" component="h2"> + +<DialogTitle> + + <Typography variant="h4" component="span"> + My header + </Typography> + ``` + ### Divider - Use border instead of background color. It prevents inconsistent height on scaled screens. For people customizing the color of the border, the change requires changing the override CSS property: @@ -640,27 +864,62 @@ As the core components use emotion as a styled engine, the props used by emotion ### Fab -- Rename `round` to `circular` for consistency. The possible values should be adjectives, not nouns: +- Rename `justify` prop with `justifyContent` to be aligned with the CSS property name. ```diff -<Fab variant="round"> +<Fab variant="circular"> ``` +### FormControl + +- Change the default variant from `standard` to `outlined`. Standard has been removed from the Material Design guidelines. + + ```diff + -<FormControl value="Standard" /> + -<FormControl value="Outlined" variant="outlined" /> + +<FormControl value="Standard" variant="standard" /> + +<FormControl value="Outlined" /> + ``` + +[This codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#variant-prop) will automatically update your code. + ### Grid -- Rename `justify` prop with `justifyContent` to be aligned with the CSS property name. +- Rename `justify` prop to `justifyContent` to align with the CSS property name. ```diff -<Grid justify="center"> +<Grid justifyContent="center"> ``` -### GridList + You can use the [`component-rename-prop` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#component-rename-prop) for automatic migration. -- Rename the `GridList` components to `ImageList` to align with the current Material Design naming. -- Rename the GridList `spacing` prop to `gap` to align with the CSS attribute. -- Rename the GridList `cellHeight` prop to `rowHieght`. +- The props: `alignItems` `alignContent` and `justifyContent` and their `classes` and style overrides keys were removed: "align-items-xs-center", "align-items-xs-flex-start", "align-items-xs-flex-end", "align-items-xs-baseline", "align-content-xs-center", "align-content-xs-flex-start", "align-content-xs-flex-end", "align-content-xs-space-between", "align-content-xs-space-around", "justify-content-xs-center", "justify-content-xs-flex-end", "justify-content-xs-space-between", "justify-content-xs-space-around" and "justify-content-xs-space-evenly". These props are now considered part of the system, not on the `Grid` component itself. If you still wish to add overrides for them, you can use the `theme.components.MuiGrid.variants` options. For example + + ```diff + const theme = createMuiTheme({ + components: { + MuiCssBaseline: { + styleOverrides: { + - '@global': { + html: { + WebkitFontSmoothing: 'auto', + }, + - }, + }, + }, + }, + }); + ``` + + You can use the [`grid-justify-justifycontent` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#grid-justify-justifycontent) for automatic migration. + +### GridList + +- Rename the `GridList` components to `ImageList` to align with the current Material Design naming. +- Rename the GridList `spacing` prop to `gap` to align with the CSS attribute. +- Rename the GridList `cellHeight` prop to `rowHieght`. - Add the `variant` prop to GridList. - Rename the GridListItemBar `actionPosition` prop to `position`. (Note also the related classname changes.) - Use CSS object-fit. For IE11 support either use a polyfill such as https://www.npmjs.com/package/object-fit-images, or continue to use the v4 component. @@ -689,21 +948,66 @@ As the core components use emotion as a styled engine, the props used by emotion +</ImageList> ``` -### Icon +### Hidden -- The default value of `fontSize` was changed from `default` to `medium` for consistency. In the unlikey event that you were using the value `default`, the prop can be removed: +- This component was removed because its functionality can be created with the [`sx`](/system/basics/#the-sx-prop) prop or the [`useMediaQuery`](/components/use-media-query) hook. + + The system props have been deprecated in v5, and replaced with the `sx` prop. + + ```diff + -<Hidden implementation="css" xlUp><Paper /></Hidden> + -<Hidden implementation="css" xlUp><button /></Hidden> + +<Paper sx={{ display: { xl: 'none', xs: 'block' } }} /> + +<Box component="button" sx={{ display: { xl: 'none', xs: 'block' } }} /> + ``` + + ```diff + -<Box gridGap="10px"> ++<Box sx={{ gap: '10px' }}> + ``` + + Use the `useMediaQuery` hook to replace `implementation="js"`: + + ```diff + -<Hidden implementation="js" xlUp><Paper /></Hidden> + +const hidden = useMediaQuery(theme => theme.breakpoints.up('xl')); + +return hidden ? null : <Paper />; + ``` + +### Emplacement du label + +- The default value of `fontSize` was changed from `default` to `medium` for consistency. In the unlikely event that you were using the value `default`, the prop can be removed: ```diff -<Icon fontSize="default">icon-name</Icon> +<Icon>icon-name</Icon> ``` +### IconButton + +- The default size's padding is reduced to `8px` which makes the default IconButton size of `40px`. To get the old default size (`48px`), use `size="large"`. The change was done to better match Google's products when Material Design stopped documenting the icon button pattern. + + ```diff + - <IconButton> + + <IconButton size="large"> + ``` + +- `span` element that wraps children has been removed. `label` classKey is also removed. More details about [this change](https://github.com/mui-org/material-ui/pull/26666). + + ```diff + <button class="MuiIconButton-root"> + - <span class="MuiIconButton-label"> + <svg /> + - </span> + </button> + ``` + ### Menu - The onE\* transition props were removed. Use TransitionProps instead. ```diff - <Menu + <Popover - onEnter={onEnter} - onEntered={onEntered}, - onEntering={onEntered}, @@ -718,12 +1022,44 @@ As the core components use emotion as a styled engine, the props used by emotion + onExited, + onExiting, + }} - > + /> + ``` + + > Note: The `selectedMenu` variant will no longer vertically align the selected item with the anchor. + + You can use the [`use-transitionprops` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#use-transitionprops) for automatic migration. + +- Change the default value of `anchorOrigin.vertical` to follow the Material Design guidelines. The menu now displays below the anchor instead of on top of it. You can restore the previous behavior with: + + ```diff + <Menu + + anchorOrigin={{ + + vertical: 'top', + + horizontal: 'left', + + }} + ``` + +### MenuItem + +- The `MenuItem` component inherits the `ButtonBase` component instead of `ListItem`. The class names related to "MuiListItem-\*" are removed and theming `ListItem` is no longer affecting `MenuItem`. + + ```diff + -<li className="MuiButtonBase-root MuiMenuItem-root MuiListItem-root"> + +<li className="MuiButtonBase-root MuiMenuItem-root"> ``` +- prop `listItemClasses` is removed, use `classes` instead. + + ```diff + -<MenuItem listItemClasses={{...}}> + +<MenuItem classes={{...}}> + ``` + + Read more about [MenuItem CSS API](/api/menu-item/#css) + ### Modal -- Remove the `disableBackdropClick` prop because redundant. Ignore close events from `onClose` when `reason === 'backdropClick'` instead. +- Remove the `disableBackdropClick` prop because redundant. Remove the `disableBackdropClick` prop because redundant. ```diff <Modal @@ -737,7 +1073,7 @@ As the core components use emotion as a styled engine, the props used by emotion /> ``` -- Remove the `onEscapeKeyDown` prop because redundant. Use `onClose` with `reason === "escapeKeyDown"` instead. +- Remove the `onEscapeKeyDown` prop because it is redundant. Use `onClose` with `reason === "escapeKeyDown"` instead. ```diff <Modal @@ -752,6 +1088,38 @@ As the core components use emotion as a styled engine, the props used by emotion - Remove `onRendered` prop. Depending on your use case either use a [callback ref](https://reactjs.org/docs/refs-and-the-dom.html#callback-refs) on the child element or an effect hook in the child component. +### NativeSelect + +- Merge the `selectMenu` slot into `select`. Slot `selectMenu` was redundant. The `root` slot is no longer applied to the select, but to the root. + + ```diff + -<NativeSelect classes={{ root: 'class1', select: 'class2', selectMenu: 'class3' }} /> + +<NativeSelect classes={{ select: 'class1 class2 class3' }} /> + ``` + +### OutlinedInput + +- Remove `onRendered` prop. Depending on your use case either use a [callback ref](https://reactjs.org/docs/refs-and-the-dom.html#callback-refs) on the child element or an effect hook in the child component. + + ```diff + -<OutlinedInput labelWidth={20} /> + +<OutlinedInput label="First Name" /> + ``` + +### Paper + +- Change the background opacity based on the elevation in dark mode. This change was done to follow the Material Design guidelines. You can revert it in the theme: + + ```diff + const theme = createTheme({ + components: { + MuiPaper: { + + styleOverrides: { root: { backgroundImage: 'unset' } }, + }, + }, + }); + ``` + ### Pagination - Move the component from the lab to the core. The component is now stable. @@ -765,9 +1133,9 @@ As the core components use emotion as a styled engine, the props used by emotion +import usePagination from '@material-ui/core/usePagination'; ``` - You can use our [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. + You can use the [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. -- Rename `round` to `circular` for consistency. The possible values should be adjectives, not nouns: +- Rename `justify` prop with `justifyContent` to be aligned with the CSS property name. ```diff -<Pagination shape="round"> @@ -781,7 +1149,7 @@ As the core components use emotion as a styled engine, the props used by emotion - The onE\* transition props were removed. Use TransitionProps instead. ```diff - <Popover + <Snackbar - onEnter={onEnter} - onEntered={onEntered}, - onEntering={onEntered}, @@ -799,6 +1167,10 @@ As the core components use emotion as a styled engine, the props used by emotion /> ``` + You can use the [`use-transitionprops` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#use-transitionprops) for automatic migration. + +- The `getContentAnchorEl` prop was removed to simplify the positioning logic. + ### Popper - Upgrade [Popper.js](https://github.com/popperjs/popper-core) from v1 to v2. This third-party library has introduced a lot of changes.<br /> You can read [their migration guide](https://popper.js.org/docs/v2/migration-guide/) or the following summary: @@ -828,6 +1200,25 @@ As the core components use emotion as a styled engine, the props used by emotion - Remove `onRendered` prop. Depending on your use case either use a [callback ref](https://reactjs.org/docs/refs-and-the-dom.html#callback-refs) on the child element or an effect hook in the child component. +### Radio + +- The radio color prop is now "primary" by default. To continue using the "secondary" color, you must explicitly indicate `secondary`. This brings the radio closer to the Material Design guidelines. + + ```diff + -<Radio /> + +<Radio color="secondary /> + ``` + +- The component doesn't have `.MuiIconButton-root` and `.MuiIconButton-label` class names anymore, target `.MuiButtonBase-root` instead. + + ```diff + - <span class="MuiIconButton-root MuiButtonBase-root MuiRadio-root PrivateSwitchBase-root"> + - <span class="MuiIconButton-label"> + - <input class="PrivateSwitchBase-input"> + + <span class="MuiButtonBase-root MuiRadio-root PrivateSwitchBase-root"> + + <span class="PrivateSwitchBase-input"> + ``` + ### Rating (Notation) - Move the component from the lab to the core. The component is now stable. @@ -837,7 +1228,7 @@ As the core components use emotion as a styled engine, the props used by emotion +import Rating from '@material-ui/core/Rating'; ``` - You can use our [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. + You can use the [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. - Change the default empty icon to improve accessibility. If you have a custom `icon` prop but no `emptyIcon` prop, you can restore the previous behavior with: @@ -870,6 +1261,33 @@ As the core components use emotion as a styled engine, the props used by emotion +<Button ref={ref} /> ``` +### Liste à choix simple + +- Change the default variant from `standard` to `outlined`. Standard has been removed from the Material Design guidelines. If you are composing the Select with a form control component, you only need to update `FormControl`, the select inherits the variant from its context. + + ```diff + -<Select value="Standard" /> + -<Select value="Outlined" variant="outlined" /> + +<Select value="Standard" variant="standard" /> + +<Select value="Outlined" /> + ``` + +[This codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#variant-prop) will automatically update your code. + +- Remove `onRendered` prop. Depending on your use case either use a [callback ref](https://reactjs.org/docs/refs-and-the-dom.html#callback-refs) on the child element or an effect hook in the child component. The TextField already handles it by default. + + ```diff + -<Select variant="outlined" labelWidth={20} /> + +<Select variant="outlined" label="Gender" /> + ``` + +- Merge the `selectMenu` slot into `select`. Slot `selectMenu` was redundant. The `root` slot is no longer applied to the select, but to the root. + + ```diff + -<Select classes={{ root: 'class1', select: 'class2', selectMenu: 'class3' }} /> + +<Select classes={{ select: 'class1 class2 class3' }} /> + ``` + ### Skeleton (Squelette) - Move the component from the lab to the core. The component is now stable. @@ -879,9 +1297,9 @@ As the core components use emotion as a styled engine, the props used by emotion +import Skeleton from '@material-ui/core/Skeleton'; ``` - You can use our [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. + You can use the [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. -- Rename `circle` to `circular` and `rect` to `rectangular` for consistency. The possible values should be adjectives, not nouns: +- Rename `circle` to `circular` and `rect` to `rectangular` for consistency. ```diff -<Skeleton variant="circle" /> @@ -901,19 +1319,22 @@ As the core components use emotion as a styled engine, the props used by emotion +<Slider onChange={(event: React.SyntheticEvent, value: unknown) => {}} /> ``` -- The `ValueLabelComponent` prop is now part of the `components` prop. +- The `ValueLabelComponent` and `ThumbComponent` prop is now part of the `components` prop. ```diff - -<Slider ValueLabelComponent={CustomValueLabel} /> - +<Slider components={{ ValueLabel: CustomValueLabel }} /> + <Slider + - ValueLabelComponent={CustomValueLabel} + - ThumbComponent={CustomThumb} + + components={{ + + ValueLabel: CustomValueLabel, + + Thumb: CustomThumb, + + }} + /> ``` -- The `ThumbComponent` prop is not part of the `components` prop. +- Rework the CSS to match the latest [Material Design guidelines](https://material.io/components/sliders) and make custom styles more intuitive. [See documentation](/components/slider/). <a href="/components/slider/#continuous-sliders"><img width="247" alt="" src="https://user-images.githubusercontent.com/3165635/121884800-a8808600-cd13-11eb-8cdf-e25de8f1ba73.png" style="margin: auto"></a> - ```diff - -<Slider ThumbComponent={CustomThumb} /> - +<Slider components={{ Thumb: CustomThumb }} /> - ``` + You can reduce the density of the slider, closer to v4 with the [`size="small"` prop](/components/slider/#sizes). ### Snackbar @@ -929,11 +1350,11 @@ As the core components use emotion as a styled engine, the props used by emotion ```diff <Snackbar - onEnter={onEnter} - - onEntered={onEntered}, - - onEntering={onEntered}, - - onExit={onEntered}, - - onExited={onEntered}, - - onExiting={onEntered} + - onEntered={onEntered} + - onEntering={onEntering} + - onExit={onExit} + - onExited={onExited} + - onExiting={onExiting} + TransitionProps={{ + onEnter, + onEntered, @@ -945,6 +1366,8 @@ As the core components use emotion as a styled engine, the props used by emotion /> ``` + You can use the [`use-transitionprops` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#use-transitionprops) for automatic migration. + ### SpeedDial - Move the component from the lab to the core. The component is now stable. @@ -958,7 +1381,7 @@ As the core components use emotion as a styled engine, the props used by emotion +import SpeedDialIcon from '@material-ui/core/SpeedDialIcon'; ``` - You can use our [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. + You can use the [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. ### Stepper @@ -1005,6 +1428,39 @@ As the core components use emotion as a styled engine, the props used by emotion </SvgIcon> ``` +### Interrupteur (switch) + +- Remove the second argument from `onChange`. You can pull out the checked state by accessing `event.target.checked`. + + ```diff + function MySwitch() { + - const handleChange = (event: React.ChangeEvent<HTMLInputElement>, checked: boolean) => { + + const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => { + + const checked = event.target.checked; + }; + + return <Switch onChange={handleChange} />; + } + ``` + +- The switch color prop is now "primary" by default. To continue using the "secondary" color, you must explicitly indicate `secondary`. This brings the switch closer to the Material Design guidelines. + + ```diff + -<Switch /> + +<Switch color="secondary" /> + ``` + +- The component doesn't have `.MuiIconButton-root` and `.MuiIconButton-label` class names anymore, target `.MuiButtonBase-root` instead. + + ```diff + <span class="MuiSwitch-root"> + - <span class="MuiIconButton-root MuiButtonBase-root MuiSwitch-switchBase PrivateSwitchBase-root"> + - <span class="MuiIconButton-label"> + - <input class="MuiSwitch-input PrivateSwitchBase-input"> + + <span class="MuiButtonBase-root MuiSwitch-switchBase PrivateSwitchBase-root"> + + <span class="MuiSwitch-input PrivateSwitchBase-input"> + ``` + ### Table (Tableaux) - The customization of the table pagination's actions labels must be done with the `getItemAriaLabel` prop. This increases consistency with the `Pagination` component. @@ -1012,7 +1468,7 @@ As the core components use emotion as a styled engine, the props used by emotion ```diff <TablePagination - backIconButtonText="Avant" - - nextIconButtonText="Après + - nextIconButtonText="Après" + getItemAriaLabel={…} ``` @@ -1026,8 +1482,42 @@ As the core components use emotion as a styled engine, the props used by emotion + onPageChange={()=>{}} ``` +- Separate classes for different table pagination labels. This allows simpler customizations. + + ```diff + <TablePagination + - classes={{ caption: 'foo' }} + + classes={{ selectLabel: 'foo', displayedRows: 'foo' }} + /> + ``` + +- Change ref forwarding expectations on custom `inputComponent`. The component should forward the `ref` prop instead of the `inputRef` prop. + + ```diff + <TablePagination + - classes={{ input: 'foo' }} + + classes={{ select: 'foo' }} + /> + ``` + +- Rename the `default` value of the `padding` prop to `normal`. + + ```diff + -<Table padding="default" /> + -<TableCell padding="default" /> + +<Table padding="normal" /> + +<TableCell padding="normal" /> + ``` + ### Tabs (Onglets) +- Change the default `indicatorColor` and `textColor` prop values to "primary". This is done to match the most common use cases with Material Design. + + ```diff + -<Tabs /> + +<Tabs indicatorColor="primary" textColor="inherit" /> + ``` + - TypeScript: The `event` in `onChange` is no longer typed as a `React.ChangeEvent` but `React.SyntheticEvent`. ```diff @@ -1049,9 +1539,12 @@ As the core components use emotion as a styled engine, the props used by emotion +<Tabs scrollButtons={false} /> ``` +- Tab `minWidth` changed from `72px` => `90px` (without media-query) according to [material-design spec](https://material.io/components/tabs#specs) +- Tab `maxWidth` changed from `264px` => `360px` according to [material-design spec](https://material.io/components/tabs#specs) + ### TextField -- Change the default variant from `standard` to `outlined`. Standard has been removed from the Material Design Guidelines. +- Change the default variant from `standard` to `outlined`. Standard has been removed from the Material Design guidelines. ```diff -<TextField value="Standard" /> @@ -1060,7 +1553,7 @@ As the core components use emotion as a styled engine, the props used by emotion +<TextField value="Outlined" /> ``` -[This codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#textfield-variant-prop) will automatically update your code. + You can use the [`variant-prop` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#variant-prop) for automatic migration. - Rename `rowsMax` prop with `maxRows` for consistency with HTML attributes. @@ -1098,7 +1591,16 @@ As the core components use emotion as a styled engine, the props used by emotion ```diff -<Input margin="dense" /> - +<Input size="small" /> ++<Input size="small" /> + ``` + +- Set the InputAdornment `position` prop to `start` or `end`. Use `start` if used as the value of the `startAdornment` prop. Use `end` if used as the value of the `endAdornment` prop. + + ```diff + -<TextField startAdornment={<InputAdornment>Kg</InputAdornment>} /> + -<TextField endAdornment={<InputAdornment>Kg</InputAdornment>} /> + +<TextField startAdornment={<InputAdornment position="start">Kg</InputAdornment>} /> + +<TextField endAdornment={<InputAdornment position="end">Kg</InputAdornment>} /> ``` ### TextareaAutosize @@ -1135,7 +1637,7 @@ As the core components use emotion as a styled engine, the props used by emotion +import ToggleButtonGroup from '@material-ui/core/ToggleButtonGroup'; ``` - You can use our [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. + You can use the [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. ### Tooltip @@ -1149,29 +1651,246 @@ As the core components use emotion as a styled engine, the props used by emotion # Interactive tooltips no longer need the `interactive` prop. -<Tooltip interactive> - +<Tooltip> ++<Tooltip> ``` ### Typographie -- Replace the `srOnly` prop so as to not duplicate the capabilities of [System](https://material-ui.com/system/basics/): +- Remove the `srOnly` variant. You can use the `visuallyHidden` utility in conjunction with the `sx` prop instead. ```diff - -import Typography from '@material-ui/core/Typography'; - +import { visuallyHidden } from '@material-ui/system'; - +import styled from 'styled-component'; - - +const Span = styled('span')(visuallyHidden); + +import { visuallyHidden } from '@material-ui/utils'; -<Typography variant="srOnly">Create a user</Typography> - +<Span>Create a user</Span> + +<span style={visuallyHidden}>Create a user</span> ``` -### Système +- The following `classes` and style overrides keys were removed: "colorInherit", "colorPrimary", "colorSecondary", "colorTextPrimary", "colorTextSecondary", "colorError", "displayInline" and "displayBlock". These props are now considered part of the system, not on the `Typography` component itself. If you still wish to add overrides for them, you can use the `theme.components.MuiTypography.variants` options. For example -- Replace `css` prop with `sx` to avoid collision with styled-components & emotion CSS props. + ```diff + const theme = createTheme({ + components: { + MuiTypography: { + - styleOverrides: { + - colorSecondary: { + - marginTop: '20px', + - }, + - }, + + variants: { + + props: { color: "secondary" }, + + style: { + + marginTop: '20px', + + }, + + }], + }, + }, + }); + ``` + +### `@material-ui/core/styles` + +#### Changes + +- The `createGenerateClassName` function is no longer exported from `@material-ui/core/styles`. You should import it directly from `@material-ui/styles`. + + ```diff + -import { createGenerateClassName } from '@material-ui/core/styles'; + +import { createGenerateClassName } from '@material-ui/styles'; + ``` + +#### jssPreset + +- The `jssPreset` object is no longer exported from `@material-ui/core/styles`. You should import it directly from `@material-ui/styles`. + + ```diff + -import { jssPreset } from '@material-ui/core/styles'; + +import { jssPreset } from '@material-ui/styles'; + ``` + +#### makeStyles + +- The `makeStyles` JSS utility is no longer exported from `@material-ui/core/styles`. You can use `@material-ui/styles/makeStyles` instead. Make sure to add a `ThemeProvider` at the root of your application, as the `defaultTheme` is no longer available. If you are using this utility together with `@material-ui/core`, it's recommended you use the `ThemeProvider` component from `@material-ui/core/styles` instead. + + ```diff + -import { makeStyles } from '@material-ui/core/styles'; + +import { makeStyles } from '@material-ui/styles'; + +import { createTheme, ThemeProvider } from '@material-ui/core/styles'; + + +const theme = createTheme(); + const useStyles = makeStyles((theme) => ({ + background: theme.palette.primary.main, + })); + function Component() { + const classes = useStyles(); + return <div className={classes.root} /> + } + + // In the root of your app + function App(props) { + - return <Component />; + + return <ThemeProvider theme={theme}><Component {...props} /></ThemeProvider>; + } + ``` + +#### MuiThemeProvider + +- The `MuiThemeProvider` component is no longer exported from `@material-ui/core/styles`. Use `ThemeProvider` instead. + + ```diff + -import { MuiThemeProvider } from '@material-ui/core/styles'; + +import { ThemeProvider } from '@material-ui/core/styles'; + ``` + +#### ServerStyleSheets + +- The `ServerStyleSheets` component is no longer exported from `@material-ui/core/styles`. You should import it directly from `@material-ui/styles`. + + ```diff + -import { ServerStyleSheets } from '@material-ui/core/styles'; + +import { ServerStyleSheets } from '@material-ui/styles'; + ``` + +#### styled + +- The `styled` JSS utility is no longer exported from `@material-ui/core/styles`. You can use `@material-ui/styles/styled` instead. Make sure to add a `ThemeProvider` at the root of your application, as the `defaultTheme` is no longer available. If you are using this utility together with `@material-ui/core`, it's recommended you use the `ThemeProvider` component from `@material-ui/core/styles` instead. + + ```diff + -import { styled } from '@material-ui/core/styles'; + +import { styled } from '@material-ui/styles'; + +import { createTheme, ThemeProvider } from '@material-ui/core/styles'; + + +const theme = createTheme(); + const MyComponent = styled('div')(({ theme }) => ({ background: theme.palette.primary.main })); + + function App(props) { + - return <MyComponent />; + + return <ThemeProvider theme={theme}><MyComponent {...props} /></ThemeProvider>; + } + ``` + +#### StylesProvider + +- The `StylesProvider` component is no longer exported from `@material-ui/core/styles`. You should import it directly from `@material-ui/styles`. + + ```diff + -import { StylesProvider } from '@material-ui/core/styles'; + +import { StylesProvider } from '@material-ui/styles'; + ``` + +#### useThemeVariants + +- The `useThemeVariants` hook is no longer exported from `@material-ui/core/styles`. You should import it directly from `@material-ui/styles`. + + ```diff + -import { useThemeVariants } from '@material-ui/core/styles'; + +import { useThemeVariants } from '@material-ui/styles'; + ``` + +#### withStyles + +- Replace the `innerRef` prop with the `ref` prop. Refs are now automatically forwarded to the inner component. + + ```diff + import * as React from 'react'; + import { withStyles } from '@material-ui/styles'; + + const MyComponent = withStyles({ + root: { + backgroundColor: 'red', + }, + })(({ classes }) => <div className={classes.root} />); + + function MyOtherComponent(props) { + const ref = React.useRef(); + - return <MyComponent innerRef={ref} />; + + return <MyComponent ref={ref} />; + } + ``` + +- The `withStyles` JSS utility is no longer exported from `@material-ui/core/styles`. You can use `@material-ui/styles/withStyles` instead. Make sure to add a `ThemeProvider` at the root of your application, as the `defaultTheme` is no longer available. If you are using this utility together with `@material-ui/core`, you should use the `ThemeProvider` component from `@material-ui/core/styles` instead. + + ```diff + -import { withStyles } from '@material-ui/core/styles'; + +import { withStyles } from '@material-ui/styles'; + +import { createTheme, ThemeProvider } from '@material-ui/core/styles'; + + +const defaultTheme = createTheme(); + const MyComponent = withStyles((props) => { + const { classes, className, ...other } = props; + return <div className={clsx(className, classes.root)} {...other} /> + })(({ theme }) => ({ root: { background: theme.palette.primary.main }})); + + function App() { + - return <MyComponent />; + + return <ThemeProvider theme={defaultTheme}><MyComponent /></ThemeProvider>; + } + ``` + +#### withTheme + +- The `withTheme` HOC utility has been removed from the `@material-ui/core/styles` package. You can use `@material-ui/styles/withTheme` instead. Make sure to add a `ThemeProvider` at the root of your application, as the `defaultTheme` is no longer available. If you are using this utility together with `@material-ui/core`, it's recommended you use the `ThemeProvider` component from `@material-ui/core/styles` instead. + + ```diff + -import { withTheme } from '@material-ui/core/styles'; + +import { withTheme } from '@material-ui/styles'; + +import { createTheme, ThemeProvider } from '@material-ui/core/styles'; + + +const theme = createTheme(); + const MyComponent = withTheme(({ theme }) => <div>{props.theme.direction}</div>); + + function App(props) { + - return <MyComponent />; + + return <ThemeProvider theme={theme}><MyComponent {...props} /></ThemeProvider>; + } + ``` + +- Replace the `innerRef` prop with the `ref` prop. Refs are now automatically forwarded to the inner component. + + ```diff + import * as React from 'react'; + import { withTheme } from '@material-ui/core/styles'; + + const MyComponent = withTheme(({ theme }) => <div>{props.theme.direction}</div>); + + function MyOtherComponent(props) { + const ref = React.useRef(); + - return <MyComponent innerRef={ref} />; + + return <MyComponent ref={ref} />; + } + ``` + +#### withWidth + +- This HOC was removed. There's an alternative using the `useMediaQuery` hook on [this page](/components/use-media-query/#migrating-from-withwidth). + +### `@material-ui/types` + +- Rename the exported `Omit` type in `@material-ui/types`. The module is now called `DistributiveOmit`. The change removes the confusion with the built-in `Omit` helper introduced in TypeScript v3.5. The built-in `Omit`, while similar, is non-distributive. This leads to differences when applied to union types. [See this StackOverflow answer for further details](https://stackoverflow.com/a/57103940/1009797). + + ```diff + -import { Omit } from '@material-ui/types'; + +import { DistributiveOmit } from '@material-ui/types'; + ``` + +### `@material-ui/styles` + +#### ThemeProvider + +If you are using the utilities from `@material-ui/styles` together with the `@material-ui/core`, you should replace the use of `ThemeProvider` from `@material-ui/styles` with the one exported from `@material-ui/core/styles`. This way, the `theme` provided in the context will be available in both the styling utilities exported from `@material-ui/styles`, like `makeStyles`, `withStyles` etc. and the Material-UI components. ```diff --<Box css={{ color: 'primary.main' }} /> -+<Box sx={{ color: 'primary.main' }} /> +-<CircularProgress variant="static" classes={{ static: 'className' }} /> + +<CircularProgress variant="determinate" classes={{ determinate: 'className' }} /> +``` + +#### Default theme (TypeScript) + +The `@material-ui/styles` package is no longer part of `@material-ui/core/styles`. If you are using `@material-ui/styles` together with `@material-ui/core` you need to add a module augmentation for the `DefaultTheme`. + +```ts +import { Theme } from '@material-ui/core/styles'; + +declare module '@material-ui/styles' { + interface DefaultTheme extends Theme {} +} ``` diff --git a/docs/src/pages/guides/migration-v4/migration-v4-ja.md b/docs/src/pages/guides/migration-v4/migration-v4-ja.md index 39d522005a3c36..65c12619b5f2b7 100644 --- a/docs/src/pages/guides/migration-v4/migration-v4-ja.md +++ b/docs/src/pages/guides/migration-v4/migration-v4-ja.md @@ -2,13 +2,13 @@ <p class="description">Yeah, v5 has been released!</p> -Looking for the v4 docs? [Find them here](https://material-ui.com/versions/). +If you're looking for the v4 docs, you can [find them here](https://material-ui.com/versions/). -> This document is a work in progress. Have you upgraded your site and run into something that's not covered here? [Add your changes on GitHub](https://github.com/mui-org/material-ui/blob/HEAD/docs/src/pages/guides/migration-v4/migration-v4.md). +> This document is a work in progress. If you have upgraded your site and run into something that's not covered here, please [add your changes on GitHub](https://github.com/mui-org/material-ui/blob/HEAD/docs/src/pages/guides/migration-v4/migration-v4.md). ## Introduction -This is a reference for upgrading your site from Material-UI v4 to v5. While there's a lot covered here, you probably won't need to do everything for your site. We'll do our best to keep things easy to follow, and as sequential as possible so you can quickly get rocking on v5! +This is a reference for upgrading your site from Material-UI v4 to v5. While there's a lot covered here, you probably won't need to do everything. We'll do our best to keep things easy to follow, and as sequential as possible, so you can quickly get rocking on v5! ## Why you should migrate @@ -46,11 +46,11 @@ yarn add @material-ui/core@next @emotion/react @emotion/styled The targets of the default bundle have changed. The exact versions will be pinned on release from the browserslist query `"> 0.5%, last 2 versions, Firefox ESR, not dead, not IE 11, maintained node versions"`. -The default bundle now supports: +The default bundle supports the following minimum versions: <!-- #stable-snapshot --> -- Node 10 (up from 8) +- Node 12 (up from 8) - Chrome 84 (up from 49) - Edge 85 (up from 14) - Firefox 78 (up from 52) @@ -63,12 +63,26 @@ It no longer supports IE 11. If you need to support IE 11, check out our [legacy Support for non-ref-forwarding class components in the `component` prop or as immediate `children` has been dropped. If you were using `unstable_createStrictModeTheme` or didn't see any warnings related to `findDOMNode` in `React.StrictMode` then you don't need to do anything. Otherwise check out the ["Caveat with refs" section in our composition guide](/guides/composition/#caveat-with-refs) to find out how to migrate. This change affects almost all components where you're using the `component` prop or passing `children` to components that require `children` to be elements (e.g. `<MenuList><CustomMenuItem /></MenuList>`) -### Styled engine +### Supported React version -The styled engine used in v5 by default is [`emotion`](https://github.com/emotion-js/emotion). While migration from JSS to emotion, if you are using JSS style overrides for your components (for example overrides created by `makeStyles`), you need to take care of the CSS injection order. In order to do this, you need to have on the top of your application the `StylesProvider` with the `injectFirst` option. Here is an example of it: +The minimum supported version of React was increased from v16.8.0 to v17.0.0. + +### Supported TypeScript version + +The minimum supported version of TypeScript was increased from v3.2 to v3.5. We try to align with types released from [DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped) (i.e. packages published on npm under the `@types` namespace). We will not change the minimum supported version in a major version of Material-UI. However, we generally recommend to not use a TypeScript version older than the [lowest supported version of DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped#older-versions-of-typescript-33-and-earlier) + +### Style library + +The style library used by default in v5 is [`emotion`](https://github.com/emotion-js/emotion). While migrating from JSS to emotion, and if you are using JSS style overrides for your components (for example overrides created by `makeStyles`), you will need to take care of the CSS injection order. これを行うには、コンポーネントツリーの上部にある `StyledEngineProvider` に `injectFirst` を指定する必要があります。 Here is an example: ```jsx -Now you can override Material-UI's styles. import * as React from 'react'; +import * as React from 'react'; +import { StyledEngineProvider } from '@material-ui/core/styles'; + +export default function GlobalCssPriority() { + return ( + <StyledEngineProvider injectFirst> + {/* Your component tree. import * as React from 'react'; import { StylesProvider } from '@material-ui/core'; export default function GlobalCssPriority() { @@ -80,21 +94,15 @@ export default function GlobalCssPriority() { } ``` -**Note:** If you are using emotion and have a custom cache in your app, that one will override the one coming from Material-UI. In order for the injection order to still be correct, you need to add the prepend option. Here is an example: +> **Note:** If you are using emotion to style your app, and have a custom cache, it will override the one provided by Material-UI. In order for the injection order to still be correct, you need to add the `prepend` option to `createCache`. Here is an example: ```jsx import * as React from 'react'; -import { CacheProvider } from '@emotion/react'; -import createCache from '@emotion/cache'; - -const cache = createCache({ - key: 'css', - prepend: true, -}); +import { StylesProvider } from '@material-ui/core'; -export default function PlainCssPriority() { +export default function GlobalCssPriority() { return ( - <CacheProvider value={cache}> + <StylesProvider injectFirst> {/* Your component tree. import * as React from 'react'; import { StylesProvider } from '@material-ui/core'; @@ -102,16 +110,29 @@ export default function GlobalCssPriority() { return ( <StylesProvider injectFirst> {/* Your component tree. */} - </CacheProvider> + </StylesProvider> ); } ``` -**Note:** If you are using styled-components and have `StyleSheetManager` with a custom `target`, make sure that the target is the first element in the HTML `<head>`. If you are curious to see how it can be done, you can take a look on the `StylesProvider` implementation in the `@material-ui/styled-engine-sc` package. +> **Note:** If you are using styled-components and have `StyleSheetManager` with a custom `target`, make sure that the target is the first element in the HTML `<head>`. To see how it can be done, take a look at the [`StyledEngineProvider` implementation](https://github.com/mui-org/material-ui/blob/next/packages/material-ui-styled-engine-sc/src/StyledEngineProvider/StyledEngineProvider.js) in the `@material-ui/styled-engine-sc` package. ### テーマ -- Breakpoints are now treated as values instead of ranges. The behavior of `down(key)` was changed to define media query less than the value defined with the corresponding breakpoint (exclusive). The `between(start, end)` was also updated to define media query for the values between the actual values of start (inclusive) and end (exclusive). When using the `down()` breakpoints utility you need to update the breakpoint key by one step up. When using the `between(start, end)` the end breakpoint should also be updated by one step up. The same should be done when using the `Hidden` component. Find examples of the changes required defined below: +- The function `createMuiTheme` was renamed to `createTheme` to make more intuitive to use with `ThemeProvider`. + + ```diff + -import { createMuiTheme } from '@material-ui/core/styles'; + +import { createTheme } from '@material-ui/core/styles'; + + -const theme = createMuiTheme({ + +const theme = createTheme({ + ``` + +- The default background color is now `#fff` in light mode and `#121212` in dark mode. This matches the Material Design guidelines. +- Breakpoints are now treated as values instead of [ranges](https://v4.material-ui.com/customization/breakpoints/#default-breakpoints). The behavior of `down(key)` was changed to define a media query below the value defined by the corresponding breakpoint (exclusive), rather than the breakpoint above. `between(start, end)` was also updated to define a media query for the values between the actual values of start (inclusive) and end (exclusive). When using the `down()` breakpoints utility you need to update the breakpoint key by one step up. When using the `between(start, end)` the end breakpoint should also be updated by one step up. + + Here are some examples of the changes required: ```diff -theme.breakpoints.down('sm') // '@media (max-width:959.95px)' - [0, sm + 1) => [0, md) @@ -128,11 +149,22 @@ export default function GlobalCssPriority() { +theme.breakpoints.up('sm') // '@media (min-width:600px)' ``` + You can use the [`theme-breakpoints` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#theme-breakpoints) for automatic migration of `theme.breakpoints`. + + The same should be done when using the `Hidden` component: + ```diff -<Hidden smDown>{...}</Hidden> // '@media (min-width:600px)' +<Hidden mdDown>{...}</Hidden> // '@media (min-width:600px)' ``` +- The `theme.breakpoints.width` utility was removed because it's redundant. Use `theme.breakpoints.values` to get the same values. + + ```diff + -theme.breakpoints.width('md') + +theme.breakpoints.values.md + ``` + - The signature of `theme.palette.augmentColor` helper has changed: ```diff @@ -140,24 +172,65 @@ export default function GlobalCssPriority() { +theme.palette.augmentColor({ color: red, name: 'brand' }); ``` +- The `theme.typography.round` helper was removed because it was no longer used. If you need it, use the function below: + + ```js + function round(value) { + return Math.round(value * 1e5) / 1e5; + } + ``` + +- The default breakpoints were changed to better match the common use cases. They also better match the Material Design guidelines. [Read more about the change](https://github.com/mui-org/material-ui/issues/21902) + + ```diff + { + xs: 0, + sm: 600, + - md: 960, + + md: 900, + - lg: 1280, + + lg: 1200, + - xl: 1920, + + xl: 1536, + } + ``` + + If you prefer the old breakpoint values, use the snippet below. + + ```js + import { createTheme } from '@material-ui/core/styles'; + + const theme = createTheme({ + breakpoints: { + values: { + xs: 0, + sm: 600, + md: 960, + lg: 1280, + xl: 1920, + }, + }, + }); + ``` + #### Upgrade helper For a smoother transition, the `adaptV4Theme` helper allows you to iteratively upgrade to the new theme structure. ```diff -import { createMuiTheme } from '@material-ui/core/styles'; -+import { createMuiTheme, adaptV4Theme } from '@material-ui/core/styles'; ++import { createTheme, adaptV4Theme } from '@material-ui/core/styles'; -const theme = createMuiTheme({ -+const theme = createMuiTheme(adaptV4Theme({ ++const theme = createTheme(adaptV4Theme({ // v4 theme -}); +})); ``` -The following changes are supported by the adapter. +##### Supported changes -#### Changes +The following changes are supported by the adapter: - The "gutters" abstraction hasn't proven to be used frequently enough to be valuable. @@ -185,33 +258,35 @@ The following changes are supported by the adapter. theme.spacing(2) => '16px' ``` -- The `theme.palette.type` was renamed to `theme.palette.mode`, to better follow the "dark mode" term that is usually used for describing this feature. + You can use the [`theme-spacing` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#theme-spacing) to remove any 'px' suffix from `theme.spacing` calls in a template string. + +- The `theme.palette.type` key was renamed to `theme.palette.mode`, to better follow the "dark mode" term that is usually used for describing this feature. ```diff - import { createMuiTheme } from '@material-ui/core/styles'; - -const theme = createMuiTheme({palette: { type: 'dark' }}), - +const theme = createMuiTheme({palette: { mode: 'dark' }}), + import { createTheme } from '@material-ui/core/styles'; + -const theme = createTheme({palette: { type: 'dark' }}), + +const theme = createTheme({palette: { mode: 'dark' }}), ``` - The `theme.palette.text.hint` key was unused in Material-UI components, and has been removed. If you depend on it, you can add it back: ```diff - import { createMuiTheme } from '@material-ui/core/styles'; + import { createTheme } from '@material-ui/core/styles'; - -const theme = createMuiTheme(), - +const theme = createMuiTheme({ + -const theme = createTheme(), + +const theme = createTheme({ + palette: { text: { hint: 'rgba(0, 0, 0, 0.38)' } }, +}); ``` -- The components' definition inside the theme were restructure under the `components` key, to allow people easier discoverability about the definitions regarding one component. +- The components' definitions in the theme were restructure under the `components` key, to allow for easier discoverability of the definitions related to any one component. 1. `props` ```diff -import { createMuiTheme } from '@material-ui/core/styles'; +import { createTheme } from '@material-ui/core/styles'; -const theme = createMuiTheme({ +const theme = createTheme({ - props: { - MuiButton: { - disableRipple: true, @@ -230,9 +305,9 @@ const theme = createMuiTheme({ 2. `overrides` ```diff -import { createMuiTheme } from '@material-ui/core/styles'; +import { createTheme } from '@material-ui/core/styles'; -const theme = createMuiTheme({ +const theme = createTheme({ - overrides: { - MuiButton: { - root: { padding: 0 }, @@ -252,33 +327,67 @@ const theme = createMuiTheme({ - Renamed `fade` to `alpha` to better describe its functionality. The previous name was leading to confusion when the input color already had an alpha value. The helper **overrides** the alpha value of the color. -```diff -- import { fade } from '@material-ui/core/styles'; -+ import { alpha } from '@material-ui/core/styles'; + ```diff + - import { fade } from '@material-ui/core/styles'; + + import { alpha } from '@material-ui/core/styles'; -const classes = makeStyles(theme => ({ -- backgroundColor: fade(theme.palette.primary.main, theme.palette.action.selectedOpacity), -+ backgroundColor: alpha(theme.palette.primary.main, theme.palette.action.selectedOpacity), -})); + const classes = makeStyles(theme => ({ + - backgroundColor: fade(theme.palette.primary.main, theme.palette.action.selectedOpacity), + + backgroundColor: alpha(theme.palette.primary.main, theme.palette.action.selectedOpacity), + })); + ``` + + You can use the [`fade-rename-alpha` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#fade-rename-alpha) for automatic migration. + +- The `createStyles` function from `@material-ui/core/styles` was moved to the one exported from `@material-ui/styles`. It is necessary for removing the dependency to `@material-ui/styles` in the core package. + +```diff +-import { createStyles } from '@material-ui/core/styles'; ++import { createStyles } from '@material-ui/styles'; ``` ### システム -- The following system functions (and properties) were renamed, because they are considered deprecated CSS: +- The following system functions (and properties) were renamed because they are considered deprecated CSS: + + 1. `gridGap` to `gap` + 1. `gridRowGap` to `rowGap` + 1. `gridColumnGap` to `columnGap` + +- Use spacing unit in `gap`, `rowGap`, and `columnGap`. If you were using a number previously, you need to mention the px to bypass the new transformation with `theme.spacing`. + + ```diff + <Box + - gap={2} + + gap="2px" + > + ``` + +- Replace `css` prop with `sx` to avoid collision with styled-components & emotion `css` prop. + + ```diff + -<Box css={{ color: 'primary.main' }} /> + +<Box sx={{ color: 'primary.main' }} /> + ``` -1. `gridGap` to `gap` -2. `gridColumnGap` to `columnGap` -3. `gridRowGap` to `rowGap` + > Note that the system grid function wasn't documented in v4. ### Core components -As the core components use emotion as a styled engine, the props used by emotion are not intercepted. The prop `as` in the following codesnippet will not be propagated to the `SomeOtherComponent`. +As the core components use emotion as their style engine, the props used by emotion are not intercepted. The prop `as` in the following code snippet will not be propagated to `SomeOtherComponent`. -`<MuiComponent component={SomeOtherComponent} as="button" />` +```jsx +<MuiComponent component={SomeOtherComponent} as="button" /> +``` ### サイド検索バー -- [AppBar] Remove z-index when position static and relative +- Remove z-index when position static and relative. This avoids the creation of a stacking context and rendering issues. +- The `color` prop has no longer any effect in dark mode. The app bar uses the background color required by the elevation to follow the [Material Design guidelines](https://material.io/design/color/dark-theme.html). Use `enableColorOnDark` to restore the behavior of v4. + + ```jsx + <AppBar enableColorOnDark /> + ``` ### アラート @@ -291,7 +400,7 @@ As the core components use emotion as a styled engine, the props used by emotion +import AlertTitle from '@material-ui/core/AlertTitle'; ``` - You can use the [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. +You can use the [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. ### Autocomplete @@ -304,7 +413,7 @@ As the core components use emotion as a styled engine, the props used by emotion +import useAutoComplete from '@material-ui/core/useAutocomplete'; ``` - You can use our [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. + You can use the [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. - Remove `debug` prop. There are a couple of simpler alternatives: `open={true}`, Chrome devtools ["Emulate focused"](https://twitter.com/sulco/status/1305841873945272321), or React devtools prop setter. - `renderOption` should now return the full DOM structure of the option. It makes customizations easier. You can recover from the change with: @@ -328,16 +437,39 @@ As the core components use emotion as a styled engine, the props used by emotion /> ``` -- Rename `closeIcon` prop with `clearIcon` to avoid confusion. +- Rename `closeIcon` prop to `clearIcon` to avoid confusion. ```diff -<Autocomplete closeIcon={defaultClearIcon} /> +<Autocomplete clearIcon={defaultClearIcon} /> ``` + You can use the [`autocomplete-rename-closeicon` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#autocomplete-rename-closeicon) for automatic migration. + +- The following values of the reason argument in `onChange` and `onClose` were renamed for consistency: + + 1. `create-option` to `createOption` + 2. `select-option` to `selectOption` + 3. `remove-option` to `removeOption` + +- Change the CSS rules that use `[data-focus="true"]` to use `.Mui-focused`. The `data-focus` attribute is not set on the focused option anymore, instead, global class names are used. + + ```diff + -'.MuiAutocomplete-option[data-focus="true"]': { + +'.MuiAutocomplete-option.Mui-focused': { + ``` + +- Rename `getOptionSelected` to `isOptionEqualToValue` to better describe its purpose. + + ```diff + <Autocomplete + - getOptionSelected={(option, value) => option.title === value.title} + + isOptionEqualToValue={(option, value) => option.title === value.title} + ``` + ### Avatar -- Rename `circle` to `circular` for consistency. The possible values should be adjectives, not nouns: +- Rename `circle` to `circular` for consistency: ```diff -<Avatar variant="circle"> @@ -346,6 +478,15 @@ As the core components use emotion as a styled engine, the props used by emotion +<Avatar classes={{ circular: 'className' }}> ``` + Since `circular` is the default value, the variant prop can be deleted: + + ```diff + -<Avatar variant="circle"> + +<Avatar> + ``` + + You can use the [`avatar-circle-circular` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#avatar-circle-circular) for automatic migration. + - Move the AvatarGroup from the lab to the core. ```diff @@ -353,9 +494,11 @@ As the core components use emotion as a styled engine, the props used by emotion +import AvatarGroup from '@material-ui/core/AvatarGroup'; ``` + You can use the [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. + ### Badge -- Rename `circle` to `circular` and `rectangle` to `rectangular` for consistency. The possible values should be adjectives, not nouns: +- Rename `circle` to `circular` and `rectangle` to `rectangular` for consistency. ```diff -<Badge overlap="circle"> @@ -363,23 +506,25 @@ As the core components use emotion as a styled engine, the props used by emotion +<Badge overlap="circular"> +<Badge overlap="rectangular"> <Badge classes={{ - - anchorOriginTopRightRectangle: 'className' - - anchorOriginBottomRightRectangle: 'className' - - anchorOriginTopLeftRectangle: 'className' - - anchorOriginBottomLeftRectangle: 'className' - - anchorOriginTopRightCircle: 'className' - - anchorOriginBottomRightCircle: 'className' - - anchorOriginTopLeftCircle: 'className' - + anchorOriginTopRightRectangular: 'className' - + anchorOriginBottomRightRectangular: 'className' - + anchorOriginTopLeftRectangular: 'className' - + anchorOriginBottomLeftRectangular: 'className' - + anchorOriginTopRightCircular: 'className' - + anchorOriginBottomRightCircular: 'className' - + anchorOriginTopLeftCircular: 'className' + - anchorOriginTopRightRectangle: 'className', + - anchorOriginBottomRightRectangle: 'className', + - anchorOriginTopLeftRectangle: 'className', + - anchorOriginBottomLeftRectangle: 'className', + - anchorOriginTopRightCircle: 'className', + - anchorOriginBottomRightCircle: 'className', + - anchorOriginTopLeftCircle: 'className', + + anchorOriginTopRightRectangular: 'className', + + anchorOriginBottomRightRectangular: 'className', + + anchorOriginTopLeftRectangular: 'className', + + anchorOriginBottomLeftRectangular: 'className', + + anchorOriginTopRightCircular: 'className', + + anchorOriginBottomRightCircular: 'className', + + anchorOriginTopLeftCircular: 'className', }}> ``` + You can use the [`badge-overlap-value` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#badge-overlap-value) for automatic migration. + ### BottomNavigation - TypeScript: The `event` in `onChange` is no longer typed as a `React.ChangeEvent` but `React.SyntheticEvent`. @@ -391,75 +536,134 @@ As the core components use emotion as a styled engine, the props used by emotion ### Box -- The system props have been deprecated in v5, and replaced with the `sx` prop. +- The `borderRadius` system prop value transformation has been changed. If it receives a number, it multiplies this value with the `theme.shape.borderRadius` value. Use a string to provide an explicit `px` value. + + ```diff + -<Box borderRadius="borderRadius"> + +<Box borderRadius={1}> + ``` + + ```diff + -<Box borderRadius={16}> + +<Box borderRadius="16px"> + ``` + + You can use the [`box-borderradius-values` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#box-borderradius-values) for automatic migration. + +- The Box system props have an optional alternative API in v5, using the `sx` prop. You can [read this section](/system/basics/#api-tradeoff) for the "why" behind this new API. ```diff -<Box border="1px dashed grey" p={[2, 3, 4]} m={2}> +<Box sx={{ border: "1px dashed grey", p: [2, 3, 4], m: 2 }}> ``` - [This codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#box-sx-prop) will automatically update your code to the new syntax. You can [read this section](/system/basics/#api-tradeoff) for the why behind the change of API. + If you prefer the new syntax, you can use the [`box-sx-prop` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#box-sx-prop) for automatic migration. + +- The following properties have been renamed because they are considered deprecated CSS properties by the CSS specification: -- The `borderRadius` system prop value transformation has been changed. If it receives a number, it multiplies this value with the `theme.shape.borderRadius` value. Use a string to provide an explicit value, in `px`. + 1. `gridGap` to `gap` + 2. `gridColumnGap` to `columnGap` + 3. `gridRowGap` to `rowGap` ```diff - -<Box sx={{ borderRadius: 'borderRadius' }}> - +<Box sx={{ borderRadius: 1 }}> + -<Box gridGap={1}> + -<Box gridColumnGap={2}> + -<Box gridRowGap={3}> + +<Box gap={1}> + +<Box columnGap={2}> + +<Box rowGap={3}> ``` + (Note that the system grid function wasn't documented in v4.) + + You can use the [`box-rename-gap` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#box-rename-gap) for automatic migration. + +- The `clone` prop was removed because its behavior can be obtained by applying the `sx` prop directly to the child if it is a Material-UI component. + ```diff - -<Box sx={{ borderRadius: 16 }}> - +<Box sx={{ borderRadius: '16px' }}> + -<Box sx={{ border: '1px dashed grey' }} clone> + - <Button>Save</Button> + -</Box> + +<Button sx={{ border: '1px dashed grey' }}>Save</Button> ``` -- The following properties were renamed, because they are considered deprecated CSS proeprties: +- The ability to pass a render prop was removed because its behavior can be obtained by applying the `sx` prop directly to the child if it is a Material-UI component. -1. `gridGap` to `gap` -2. `gridColumnGap` to `columnGap` -3. `gridRowGap` to `rowGap` + ```diff + -<Box sx={{ border: '1px dashed grey' }}> + - {(props) => <Button {...props}>Save</Button>} + -</Box> + +<Button sx={{ border: '1px dashed grey' }}>Save</Button> + ``` -```diff --<Box gridGap="10px"> -+<Box sx={{ gap: '10px' }}> -``` + For non-Material-UI components, use the `component` prop. -```diff --<Box gridColumnGap="10px" gridRowGap="20px"> -+<Box sx={{ columnGap: '10px', rowGap: '20px' }}> -``` + ```diff + -<Box sx={{ border: '1px dashed grey' }}> + - {(props) => <button {...props}>Save</button>} + -</Box> + +<Box component="button" sx={{ border: '1px dashed grey' }}>Save</Box> + ``` ### Button (ボタン) -- The button `color` prop is now "primary" by default, and "default" has been removed. This makes the button closer to the Material Design specification and simplifies the API. +- The button `color` prop is now "primary" by default, and "default" has been removed. This makes the button closer to the Material Design guidelines and simplifies the API. + + ```diff + -<Button color="primary"> + -<Button color="default"> + +<Button> + +<Button> + ``` + + You can use the [`button-color-prop` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#button-color-prop) for automatic migration. + +- `span` element that wraps children has been removed. `label` classKey is also removed. [この変更](https://github.com/mui-org/material-ui/pull/26666)についての詳細 ```diff - -<Button color="primary" /> - -<Button color="default" /> - +<Button /> - +<Button /> + <button class="MuiButton-root"> + - <span class="MuiButton-label"> + children + - </span> + </button> ``` ### Chip - Rename `default` variant to `filled` for consistency. + + Since `filled` is the default value, the variant prop can be deleted: + ```diff -<Chip variant="default"> - +<Chip variant="filled"> + +<Chip> ``` -### CircularProgress + You can use the [`chip-variant-prop` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#chip-variant-prop) for automatic migration. + +### Checkbox -- The `static` variant has been merged into the `determinate` variant, with the latter assuming the appearance of the former. The removed variant was rarely useful. It was an exception to Material Design, and was removed from the specification. +- The component doesn't have `.MuiIconButton-root` and `.MuiIconButton-label` class names anymore, target `.MuiButtonBase-root` instead. ```diff - -<CircularProgress variant="determinate" /> + - <span class="MuiIconButton-root MuiButtonBase-root MuiCheckbox-root PrivateSwitchBase-root"> + - <span class="MuiIconButton-label"> + - <input class="PrivateSwitchBase-input"> + + <span class="MuiButtonBase-root MuiCheckbox-root PrivateSwitchBase-root"> + + <span class="PrivateSwitchBase-input"> ``` +### CircularProgress + +- The `static` variant has been renamed to `determinate`, and the previous appearance of `determinate` has been replaced by that of `static`. It was an exception to Material Design, and was removed from the specification. + ```diff - -<CircularProgress variant="static" classes={{ static: 'className' }} /> + <CircularProgress variant="static" classes={{ static: 'className' }} /> +<CircularProgress variant="determinate" classes={{ determinate: 'className' }} /> ``` +You can use the [`circularprogress-variant` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#circularprogress-variant) for automatic migration. + > NB: If you had previously customized determinate, your customizations are probably no longer valid. Please remove them. ### Collapse @@ -478,21 +682,28 @@ As the core components use emotion as a styled engine, the props used by emotion +<Collapse classes={{ root: 'collapse' }}> ``` -###  CssBaseline +You can use the [`collapse-rename-collapsedheight` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#collapse-rename-collapsedheight) for automatic migration of both the prop and the classes key. -- The component was migrated to use the `@material-ui/styled-engine` (`emotion` or `styled-components`) instead of `jss`. You should remove the `@global` key when defining the style overrides for it. +### CssBaseline + +- The component was migrated to use the `@material-ui/styled-engine` (`emotion` or `styled-components`) instead of `jss`. You should remove the `@global` key when defining the style overrides for it. You could also start using the CSS template syntax over the JavaScript object syntax. ```diff - const theme = createMuiTheme({ + const theme = createTheme({ components: { MuiCssBaseline: { - styleOverrides: { + - styleOverrides: { - '@global': { - html: { - WebkitFontSmoothing: 'auto', - }, + - html: { + - WebkitFontSmoothing: 'auto', + - }, - }, - }, + - }, + + styleOverrides: ` + + html { + + -webkit-font-smoothing: auto; + + } + + ` }, }, }); @@ -501,7 +712,7 @@ As the core components use emotion as a styled engine, the props used by emotion - The `body` font size has changed from `theme.typography.body2` (`0.875rem`) to `theme.typography.body1` (`1rem`). To return to the previous size, you can override it in the theme: ```js - const theme = createMuiTheme({ + const theme = createTheme({ typography: { body1: { fontSize: '0.875rem', @@ -519,11 +730,11 @@ As the core components use emotion as a styled engine, the props used by emotion ```diff <Dialog - onEnter={onEnter} - - onEntered={onEntered}, - - onEntering={onEntered}, - - onExit={onEntered}, - - onExited={onEntered}, - - onExiting={onEntered} + - onEntered={onEntered} + - onEntering={onEntering} + - onExit={onExit} + - onExited={onExited} + - onExiting={onExiting} + TransitionProps={{ + onEnter, + onEntered, @@ -535,7 +746,9 @@ As the core components use emotion as a styled engine, the props used by emotion /> ``` -- Remove the `disableBackdropClick` prop because redundant. Ignore close events from `onClose` when `reason === 'backdropClick'` instead. + You can use the [`use-transitionprops` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#use-transitionprops) for automatic migration. + +- Remove the `disableBackdropClick` prop because it is redundant. Ignore close events from `onClose` when `reason === 'backdropClick'` instead. ```diff <Dialog @@ -549,7 +762,7 @@ As the core components use emotion as a styled engine, the props used by emotion /> ``` -- [withMobileDialog] Remove this higher-order component. The hook API allows a simpler and more flexible solution: +- Remove the `withMobileDialog` higher-order component. The hook API allows a simpler and more flexible solution: ```diff -import withMobileDialog from '@material-ui/core/withMobileDialog'; @@ -567,9 +780,20 @@ As the core components use emotion as a styled engine, the props used by emotion +export default ResponsiveDialog; ``` +- Flatten DialogTitle DOM structure, remove `disableTypography` prop + + ```diff + -<DialogTitle disableTypography> + - <Typography variant="h4" component="h2"> + +<DialogTitle> + + <Typography variant="h4" component="span"> + My header + </Typography> + ``` + ### Divider -- Use border instead of background color. It prevents inconsistent height on scaled screens. For people customizing the color of the border, the change requires changing the override CSS property: +- Use border instead of background color. It prevents inconsistent height on scaled screens. If you have customized the color of the border, you will need to update the CSS property override: ```diff .MuiDivider-root { @@ -640,27 +864,66 @@ As the core components use emotion as a styled engine, the props used by emotion ### Fab -- Rename `round` to `circular` for consistency. The possible values should be adjectives, not nouns: +- Rename `round` to `circular` for consistency: ```diff -<Fab variant="round"> +<Fab variant="circular"> ``` +### FormControl + +- Change the default variant from `standard` to `outlined`. Standard has been removed from the Material Design guidelines. + + ```diff + -<FormControl value="Standard" /> + -<FormControl value="Outlined" variant="outlined" /> + +<FormControl value="Standard" variant="standard" /> + +<FormControl value="Outlined" /> + ``` + +[This codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#variant-prop) will automatically update your code. + ### Grid -- Rename `justify` prop with `justifyContent` to be aligned with the CSS property name. +- Rename `justify` prop to `justifyContent` to align with the CSS property name. ```diff -<Grid justify="center"> +<Grid justifyContent="center"> ``` + You can use the [`component-rename-prop` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#component-rename-prop) for automatic migration. + +- The props: `alignItems` `alignContent` and `justifyContent` and their `classes` and style overrides keys were removed: "align-items-xs-center", "align-items-xs-flex-start", "align-items-xs-flex-end", "align-items-xs-baseline", "align-content-xs-center", "align-content-xs-flex-start", "align-content-xs-flex-end", "align-content-xs-space-between", "align-content-xs-space-around", "justify-content-xs-center", "justify-content-xs-flex-end", "justify-content-xs-space-between", "justify-content-xs-space-around" and "justify-content-xs-space-evenly". These props are now considered part of the system, not on the `Grid` component itself. If you still wish to add overrides for them, you can use the `theme.components.MuiGrid.variants` options. For example + + ```diff + const theme = createTheme({ + components: { + MuiGrid: { + - styleOverrides: { + - "align-items-xs-flex-end": { + - marginTop: '20px', + - }, + - }, + + variants: { + + props: { alignItems: "flex-end" }, + + style: { + + marginTop: '20px', + + }, + + }], + }, + }, + }); + ``` + + You can use the [`grid-justify-justifycontent` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#grid-justify-justifycontent) for automatic migration. + ### GridList - Rename the `GridList` components to `ImageList` to align with the current Material Design naming. - Rename the GridList `spacing` prop to `gap` to align with the CSS attribute. -- Rename the GridList `cellHeight` prop to `rowHieght`. +- Rename the GridList `cellHeight` prop to `rowHeight`. - Add the `variant` prop to GridList. - Rename the GridListItemBar `actionPosition` prop to `position`. (Note also the related classname changes.) - Use CSS object-fit. For IE11 support either use a polyfill such as https://www.npmjs.com/package/object-fit-images, or continue to use the v4 component. @@ -689,15 +952,62 @@ As the core components use emotion as a styled engine, the props used by emotion +</ImageList> ``` +### Hidden + +- This component was removed because its functionality can be created with the [`sx`](/system/basics/#the-sx-prop) prop or the [`useMediaQuery`](/components/use-media-query) hook. + + Use the `sx` prop to replace `implementation="css"`: + + ```diff + -<Hidden implementation="css" xlUp><Paper /></Hidden> + -<Hidden implementation="css" xlUp><button /></Hidden> + +<Paper sx={{ display: { xl: 'none', xs: 'block' } }} /> + +<Box component="button" sx={{ display: { xl: 'none', xs: 'block' } }} /> + ``` + + ```diff + -<Hidden implementation="css" mdDown><Paper /></Hidden> + -<Hidden implementation="css" mdDown><button /></Hidden> + +<Paper sx={{ display: { xs: 'none', md: 'block' } }} /> + +<Box component="button" sx={{ display: { xs: 'none', md: 'block' } }} /> + ``` + + Use the `useMediaQuery` hook to replace `implementation="js"`: + + ```diff + -<Hidden implementation="js" xlUp><Paper /></Hidden> + +const hidden = useMediaQuery(theme => theme.breakpoints.up('xl')); + +return hidden ? null : <Paper />; + ``` + ### Icon -- The default value of `fontSize` was changed from `default` to `medium` for consistency. In the unlikey event that you were using the value `default`, the prop can be removed: +- The default value of `fontSize` was changed from `default` to `medium` for consistency. In the unlikely event that you were using the value `default`, the prop can be removed: ```diff -<Icon fontSize="default">icon-name</Icon> +<Icon>icon-name</Icon> ``` +### IconButton + +- デフォルトの余白が `8px` に縮小されることにより、デフォルトの IconButton のサイズが `40px` になります。 従来のデフォルトのサイズ (`48px`) にするには、 `size="large"` を使用します。 Material Designがアイコンボタンパターンのドキュメント化を廃止した際に、Googleの仕様に適合するように変更が行われました。 + + ```diff + - <IconButton> ++<IconButton size="large"> + ``` + +- `span` element that wraps children has been removed. `label` classKey is also removed. [この変更](https://github.com/mui-org/material-ui/pull/26666)についての詳細 + + ```diff + <button class="MuiIconButton-root"> + <span class="MuiIconButton-label"> + <svg /> + </span> +</button> + ``` + ### Menu - The onE\* transition props were removed. Use TransitionProps instead. @@ -705,11 +1015,11 @@ As the core components use emotion as a styled engine, the props used by emotion ```diff <Menu - onEnter={onEnter} - - onEntered={onEntered}, - - onEntering={onEntered}, - - onExit={onEntered}, - - onExited={onEntered}, - - onExiting={onEntered} + - onEntered={onEntered} + - onEntering={onEntering} + - onExit={onExit} + - onExited={onExited} + - onExiting={onExiting} + TransitionProps={{ + onEnter, + onEntered, @@ -721,9 +1031,41 @@ As the core components use emotion as a styled engine, the props used by emotion > ``` + > Note: The `selectedMenu` variant will no longer vertically align the selected item with the anchor. + + You can use the [`use-transitionprops` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#use-transitionprops) for automatic migration. + +- Change the default value of `anchorOrigin.vertical` to follow the Material Design guidelines. The menu now displays below the anchor instead of on top of it. You can restore the previous behavior with: + + ```diff + <Menu + + anchorOrigin={{ + + vertical: 'top', + + horizontal: 'left', + + }} + ``` + +### MenuItem + +- The `MenuItem` component inherits the `ButtonBase` component instead of `ListItem`. The class names related to "MuiListItem-\*" are removed and theming `ListItem` is no longer affecting `MenuItem`. + + ```diff + -<li className="MuiButtonBase-root MuiMenuItem-root MuiListItem-root"> + +<li className="MuiButtonBase-root MuiMenuItem-root"> + ``` + +- prop `listItemClasses` is removed, use `classes` instead. + + ```diff + -<MenuItem listItemClasses={{...}}> + +<MenuItem classes={{...}}> + ``` + + Read more about [MenuItem CSS API](/api/menu-item/#css) + ### Modal -- Remove the `disableBackdropClick` prop because redundant. Ignore close events from `onClose` when `reason === 'backdropClick'` instead. +- Remove the `disableBackdropClick` prop because it is redundant. Use `onClose` with `reason === 'backdropClick'` instead. ```diff <Modal @@ -737,7 +1079,7 @@ As the core components use emotion as a styled engine, the props used by emotion /> ``` -- Remove the `onEscapeKeyDown` prop because redundant. Use `onClose` with `reason === "escapeKeyDown"` instead. +- Remove the `onEscapeKeyDown` prop because it is redundant. Use `onClose` with `reason === "escapeKeyDown"` instead. ```diff <Modal @@ -752,6 +1094,38 @@ As the core components use emotion as a styled engine, the props used by emotion - Remove `onRendered` prop. Depending on your use case either use a [callback ref](https://reactjs.org/docs/refs-and-the-dom.html#callback-refs) on the child element or an effect hook in the child component. +### NativeSelect + +- Merge the `selectMenu` slot into `select`. Slot `selectMenu` was redundant. The `root` slot is no longer applied to the select, but to the root. + + ```diff + -<NativeSelect classes={{ root: 'class1', select: 'class2', selectMenu: 'class3' }} /> + +<NativeSelect classes={{ select: 'class1 class2 class3' }} /> + ``` + +### OutlinedInput + +- Remove the `labelWidth` prop. The `label` prop now fulfills the same purpose, using CSS layout instead of JavaScript measurement to render the gap in the outlined. + + ```diff + -<OutlinedInput labelWidth={20} /> + +<OutlinedInput label="First Name" /> + ``` + +### Paper + +- Change the background opacity based on the elevation in dark mode. This change was done to follow the Material Design guidelines. You can revert it in the theme: + + ```diff + const theme = createTheme({ + components: { + MuiPaper: { + + styleOverrides: { root: { backgroundImage: 'unset' } }, + }, + }, + }); + ``` + ### Pagination - Move the component from the lab to the core. The component is now stable. @@ -765,9 +1139,9 @@ As the core components use emotion as a styled engine, the props used by emotion +import usePagination from '@material-ui/core/usePagination'; ``` - You can use our [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. + You can use the [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. -- Rename `round` to `circular` for consistency. The possible values should be adjectives, not nouns: +- Rename `round` to `circular` for consistency: ```diff -<Pagination shape="round"> @@ -783,11 +1157,11 @@ As the core components use emotion as a styled engine, the props used by emotion ```diff <Popover - onEnter={onEnter} - - onEntered={onEntered}, - - onEntering={onEntered}, - - onExit={onEntered}, - - onExited={onEntered}, - - onExiting={onEntered} + - onEntered={onEntered} + - onEntering={onEntering} + - onExit={onExit} + - onExited={onExited} + - onExiting={onExiting} + TransitionProps={{ + onEnter, + onEntered, @@ -799,6 +1173,10 @@ As the core components use emotion as a styled engine, the props used by emotion /> ``` + You can use the [`use-transitionprops` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#use-transitionprops) for automatic migration. + +- The `getContentAnchorEl` prop was removed to simplify the positioning logic. + ### Popper - Upgrade [Popper.js](https://github.com/popperjs/popper-core) from v1 to v2. This third-party library has introduced a lot of changes.<br /> You can read [their migration guide](https://popper.js.org/docs/v2/migration-guide/) or the following summary: @@ -810,7 +1188,7 @@ As the core components use emotion as a styled engine, the props used by emotion - '&[x-placement*="bottom"] $arrow': { + '&[data-popper-placement*="bottom"] $arrow': { ``` - - Method names have changed. + - Method names have changed: ```diff -popperRef.current.scheduleUpdate() @@ -828,6 +1206,25 @@ As the core components use emotion as a styled engine, the props used by emotion - Remove `onRendered` prop. Depending on your use case either use a [callback ref](https://reactjs.org/docs/refs-and-the-dom.html#callback-refs) on the child element or an effect hook in the child component. +### Radio + +- The radio color prop is now "primary" by default. To continue using the "secondary" color, you must explicitly indicate `secondary`. This brings the radio closer to the Material Design guidelines. + + ```diff + -<Radio /> + +<Radio color="secondary /> + ``` + +- The component doesn't have `.MuiIconButton-root` and `.MuiIconButton-label` class names anymore, target `.MuiButtonBase-root` instead. + + ```diff + - <span class="MuiIconButton-root MuiButtonBase-root MuiRadio-root PrivateSwitchBase-root"> + - <span class="MuiIconButton-label"> + - <input class="PrivateSwitchBase-input"> + + <span class="MuiButtonBase-root MuiRadio-root PrivateSwitchBase-root"> + + <span class="PrivateSwitchBase-input"> + ``` + ### レート - Move the component from the lab to the core. The component is now stable. @@ -837,7 +1234,7 @@ As the core components use emotion as a styled engine, the props used by emotion +import Rating from '@material-ui/core/Rating'; ``` - You can use our [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. + You can use the [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. - Change the default empty icon to improve accessibility. If you have a custom `icon` prop but no `emptyIcon` prop, you can restore the previous behavior with: @@ -870,6 +1267,33 @@ As the core components use emotion as a styled engine, the props used by emotion +<Button ref={ref} /> ``` +### Select (選択) + +- Change the default variant from `standard` to `outlined`. Standard has been removed from the Material Design guidelines. If you are composing the Select with a form control component, you only need to update `FormControl`, the select inherits the variant from its context. + + ```diff + -<Select value="Standard" /> + -<Select value="Outlined" variant="outlined" /> + +<Select value="Standard" variant="standard" /> + +<Select value="Outlined" /> + ``` + +[This codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#variant-prop) will automatically update your code. + +- Remove the `labelWidth` prop. The `label` prop now fulfills the same purpose, using CSS layout instead of JavaScript measurement to render the gap in the outlined. The TextField already handles it by default. + + ```diff + -<Select variant="outlined" labelWidth={20} /> + +<Select variant="outlined" label="Gender" /> + ``` + +- Merge the `selectMenu` slot into `select`. Slot `selectMenu` was redundant. The `root` slot is no longer applied to the select, but to the root. + + ```diff + -<Select classes={{ root: 'class1', select: 'class2', selectMenu: 'class3' }} /> + +<Select classes={{ select: 'class1 class2 class3' }} /> + ``` + ### Skeleton - Move the component from the lab to the core. The component is now stable. @@ -879,9 +1303,9 @@ As the core components use emotion as a styled engine, the props used by emotion +import Skeleton from '@material-ui/core/Skeleton'; ``` - You can use our [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. + You can use the [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. -- Rename `circle` to `circular` and `rect` to `rectangular` for consistency. The possible values should be adjectives, not nouns: +- Rename `circle` to `circular` and `rect` to `rectangular` for consistency: ```diff -<Skeleton variant="circle" /> @@ -901,19 +1325,22 @@ As the core components use emotion as a styled engine, the props used by emotion +<Slider onChange={(event: React.SyntheticEvent, value: unknown) => {}} /> ``` -- The `ValueLabelComponent` prop is now part of the `components` prop. +- The `ValueLabelComponent` and `ThumbComponent` prop is now part of the `components` prop. ```diff - -<Slider ValueLabelComponent={CustomValueLabel} /> - +<Slider components={{ ValueLabel: CustomValueLabel }} /> + <Slider + - ValueLabelComponent={CustomValueLabel} + - ThumbComponent={CustomThumb} + + components={{ + + ValueLabel: CustomValueLabel, + + Thumb: CustomThumb, + + }} + /> ``` -- The `ThumbComponent` prop is not part of the `components` prop. +- Rework the CSS to match the latest [Material Design guidelines](https://material.io/components/sliders) and make custom styles more intuitive. [See documentation](/components/slider/). <a href="/components/slider/#continuous-sliders"><img width="247" alt="" src="https://user-images.githubusercontent.com/3165635/121884800-a8808600-cd13-11eb-8cdf-e25de8f1ba73.png" style="margin: auto"></a> - ```diff - -<Slider ThumbComponent={CustomThumb} /> - +<Slider components={{ Thumb: CustomThumb }} /> - ``` + You can reduce the density of the slider, closer to v4 with the [`size="small"` prop](/components/slider/#sizes). ### Snackbar @@ -929,11 +1356,11 @@ As the core components use emotion as a styled engine, the props used by emotion ```diff <Snackbar - onEnter={onEnter} - - onEntered={onEntered}, - - onEntering={onEntered}, - - onExit={onEntered}, - - onExited={onEntered}, - - onExiting={onEntered} + - onEntered={onEntered} + - onEntering={onEntering} + - onExit={onExit} + - onExited={onExited} + - onExiting={onExiting} + TransitionProps={{ + onEnter, + onEntered, @@ -945,6 +1372,8 @@ As the core components use emotion as a styled engine, the props used by emotion /> ``` + You can use the [`use-transitionprops` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#use-transitionprops) for automatic migration. + ### SpeedDial - Move the component from the lab to the core. The component is now stable. @@ -958,9 +1387,9 @@ As the core components use emotion as a styled engine, the props used by emotion +import SpeedDialIcon from '@material-ui/core/SpeedDialIcon'; ``` - You can use our [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. + You can use the [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. -### Stepper(ステッパー) +### Stepper ステッパー - The root component (Paper) was replaced with a div. Stepper no longer has elevation, nor inherits Paper's props. This change is meant to encourage composition. @@ -1005,6 +1434,39 @@ As the core components use emotion as a styled engine, the props used by emotion </SvgIcon> ``` +### Switch + +- Remove the second argument from `onChange`. You can pull out the checked state by accessing `event.target.checked`. + + ```diff + function MySwitch() { + - const handleChange = (event: React.ChangeEvent<HTMLInputElement>, checked: boolean) => { + + const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => { + + const checked = event.target.checked; + }; + + return <Switch onChange={handleChange} />; + } + ``` + +- The switch color prop is now "primary" by default. To continue using the "secondary" color, you must explicitly indicate `secondary`. This brings the switch closer to the Material Design guidelines. + + ```diff + -<Switch /> + +<Switch color="secondary" /> + ``` + +- The component doesn't have `.MuiIconButton-root` and `.MuiIconButton-label` class names anymore, target `.MuiButtonBase-root` instead. + + ```diff + <span class="MuiSwitch-root"> + - <span class="MuiIconButton-root MuiButtonBase-root MuiSwitch-switchBase PrivateSwitchBase-root"> + - <span class="MuiIconButton-label"> + - <input class="MuiSwitch-input PrivateSwitchBase-input"> + + <span class="MuiButtonBase-root MuiSwitch-switchBase PrivateSwitchBase-root"> + + <span class="MuiSwitch-input PrivateSwitchBase-input"> + ``` + ### テーブル - The customization of the table pagination's actions labels must be done with the `getItemAriaLabel` prop. This increases consistency with the `Pagination` component. @@ -1012,8 +1474,8 @@ As the core components use emotion as a styled engine, the props used by emotion ```diff <TablePagination - backIconButtonText="Avant" - - nextIconButtonText="Après - + getItemAriaLabel={… } + - nextIconButtonText="Après" + + getItemAriaLabel={…} ``` - Rename `onChangeRowsPerPage` to `onRowsPerPageChange` and `onChangePage` to `onPageChange` due to API consistency. @@ -1026,8 +1488,42 @@ As the core components use emotion as a styled engine, the props used by emotion + onPageChange={()=>{}} ``` +- Separate classes for different table pagination labels. This allows simpler customizations. + + ```diff + <TablePagination + - classes={{ caption: 'foo' }} + + classes={{ selectLabel: 'foo', displayedRows: 'foo' }} + /> + ``` + +- Move the custom class on `input` to `select`. The `input` key is being applied on another element. + + ```diff + <TablePagination + - classes={{ input: 'foo' }} + + classes={{ select: 'foo' }} + /> + ``` + +- Rename the `default` value of the `padding` prop to `normal`. + + ```diff + -<Table padding="default" /> + -<TableCell padding="default" /> + +<Table padding="normal" /> + +<TableCell padding="normal" /> + ``` + ### Tabs +- Change the default `indicatorColor` and `textColor` prop values to "primary". This is done to match the most common use cases with Material Design. + + ```diff + -<Tabs /> + +<Tabs indicatorColor="primary" textColor="inherit" /> + ``` + - TypeScript: The `event` in `onChange` is no longer typed as a `React.ChangeEvent` but `React.SyntheticEvent`. ```diff @@ -1049,9 +1545,12 @@ As the core components use emotion as a styled engine, the props used by emotion +<Tabs scrollButtons={false} /> ``` +- Tab `minWidth` changed from `72px` => `90px` (without media-query) according to [material-design spec](https://material.io/components/tabs#specs) +- Tab `maxWidth` changed from `264px` => `360px` according to [material-design spec](https://material.io/components/tabs#specs) + ### TextField -- Change the default variant from `standard` to `outlined`. Standard has been removed from the Material Design Guidelines. +- Change the default variant from `standard` to `outlined`. Standard has been removed from the Material Design guidelines. ```diff -<TextField value="Standard" /> @@ -1060,7 +1559,7 @@ As the core components use emotion as a styled engine, the props used by emotion +<TextField value="Outlined" /> ``` -[This codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#textfield-variant-prop) will automatically update your code. + You can use the [`variant-prop` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#variant-prop) for automatic migration. - Rename `rowsMax` prop with `maxRows` for consistency with HTML attributes. @@ -1101,6 +1600,15 @@ As the core components use emotion as a styled engine, the props used by emotion +<Input size="small" /> ``` +- Set the InputAdornment `position` prop to `start` or `end`. Use `start` if used as the value of the `startAdornment` prop. Use `end` if used as the value of the `endAdornment` prop. + + ```diff + -<TextField startAdornment={<InputAdornment>Kg</InputAdornment>} /> + -<TextField endAdornment={<InputAdornment>Kg</InputAdornment>} /> + +<TextField startAdornment={<InputAdornment position="start">Kg</InputAdornment>} /> + +<TextField endAdornment={<InputAdornment position="end">Kg</InputAdornment>} /> + ``` + ### TextareaAutosize - Remove the `rows` prop, use the `minRows` prop instead. This change aims to clarify the behavior of the prop. @@ -1135,7 +1643,7 @@ As the core components use emotion as a styled engine, the props used by emotion +import ToggleButtonGroup from '@material-ui/core/ToggleButtonGroup'; ``` - You can use our [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. + You can use the [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. ### Tooltip @@ -1154,24 +1662,241 @@ As the core components use emotion as a styled engine, the props used by emotion ### タイポグラフィ -- Replace the `srOnly` prop so as to not duplicate the capabilities of [System](https://material-ui.com/system/basics/): +- Remove the `srOnly` variant. You can use the `visuallyHidden` utility in conjunction with the `sx` prop instead. ```diff - -import Typography from '@material-ui/core/Typography'; - +import { visuallyHidden } from '@material-ui/system'; - +import styled from 'styled-component'; - - +const Span = styled('span')(visuallyHidden); + +import { visuallyHidden } from '@material-ui/utils'; -<Typography variant="srOnly">Create a user</Typography> - +<Span>Create a user</Span> + +<span style={visuallyHidden}>Create a user</span> ``` -### システム +- The following `classes` and style overrides keys were removed: "colorInherit", "colorPrimary", "colorSecondary", "colorTextPrimary", "colorTextSecondary", "colorError", "displayInline" and "displayBlock". These props are now considered part of the system, not on the `Typography` component itself. If you still wish to add overrides for them, you can use the `theme.components.MuiTypography.variants` options. For example -- Replace `css` prop with `sx` to avoid collision with styled-components & emotion CSS props. + ```diff + const theme = createTheme({ + components: { + MuiTypography: { + - styleOverrides: { + - colorSecondary: { + - marginTop: '20px', + - }, + - }, + + variants: { + + props: { color: "secondary" }, + + style: { + + marginTop: '20px', + + }, + + }], + }, + }, + }); + ``` + +### `@material-ui/core/styles` + +#### createGenerateClassName + +- The `createGenerateClassName` function is no longer exported from `@material-ui/core/styles`. You should import it directly from `@material-ui/styles`. + + ```diff + -import { createGenerateClassName } from '@material-ui/core/styles'; + +import { createGenerateClassName } from '@material-ui/styles'; + ``` + +#### jssPreset + +- The `jssPreset` object is no longer exported from `@material-ui/core/styles`. You should import it directly from `@material-ui/styles`. + + ```diff + -import { jssPreset } from '@material-ui/core/styles'; + +import { jssPreset } from '@material-ui/styles'; + ``` + +#### makeStyles + +- The `makeStyles` JSS utility is no longer exported from `@material-ui/core/styles`. You can use `@material-ui/styles/makeStyles` instead. Make sure to add a `ThemeProvider` at the root of your application, as the `defaultTheme` is no longer available. If you are using this utility together with `@material-ui/core`, it's recommended you use the `ThemeProvider` component from `@material-ui/core/styles` instead. + + ```diff + -import { makeStyles } from '@material-ui/core/styles'; + +import { makeStyles } from '@material-ui/styles'; + +import { createTheme, ThemeProvider } from '@material-ui/core/styles'; + + +const theme = createTheme(); + const useStyles = makeStyles((theme) => ({ + background: theme.palette.primary.main, + })); + function Component() { + const classes = useStyles(); + return <div className={classes.root} /> + } + + // In the root of your app + function App(props) { + - return <Component />; + + return <ThemeProvider theme={theme}><Component {...props} /></ThemeProvider>; + } + ``` + +#### MuiThemeProvider + +- The `MuiThemeProvider` component is no longer exported from `@material-ui/core/styles`. Use `ThemeProvider` instead. + + ```diff + -import { MuiThemeProvider } from '@material-ui/core/styles'; + +import { ThemeProvider } from '@material-ui/core/styles'; + ``` + +#### ServerStyleSheets + +- The `ServerStyleSheets` component is no longer exported from `@material-ui/core/styles`. You should import it directly from `@material-ui/styles`. + + ```diff + -import { ServerStyleSheets } from '@material-ui/core/styles'; + +import { ServerStyleSheets } from '@material-ui/styles'; + ``` + +#### styled + +- The `styled` JSS utility is no longer exported from `@material-ui/core/styles`. You can use `@material-ui/styles/styled` instead. Make sure to add a `ThemeProvider` at the root of your application, as the `defaultTheme` is no longer available. If you are using this utility together with `@material-ui/core`, it's recommended you use the `ThemeProvider` component from `@material-ui/core/styles` instead. + + ```diff + -import { styled } from '@material-ui/core/styles'; + +import { styled } from '@material-ui/styles'; + +import { createTheme, ThemeProvider } from '@material-ui/core/styles'; + + +const theme = createTheme(); + const MyComponent = styled('div')(({ theme }) => ({ background: theme.palette.primary.main })); + + function App(props) { + - return <MyComponent />; + + return <ThemeProvider theme={theme}><MyComponent {...props} /></ThemeProvider>; + } + ``` + +#### StylesProvider + +- The `StylesProvider` component is no longer exported from `@material-ui/core/styles`. You should import it directly from `@material-ui/styles`. + + ```diff + -import { StylesProvider } from '@material-ui/core/styles'; + +import { StylesProvider } from '@material-ui/styles'; + ``` + +#### useThemeVariants + +- The `useThemeVariants` hook is no longer exported from `@material-ui/core/styles`. You should import it directly from `@material-ui/styles`. + + ```diff + -import { useThemeVariants } from '@material-ui/core/styles'; + +import { useThemeVariants } from '@material-ui/styles'; + ``` + +#### withStyles + +- Replace the `innerRef` prop with the `ref` prop. Refs are now automatically forwarded to the inner component. + + ```diff + import * as React from 'react'; + import { withStyles } from '@material-ui/styles'; + + const MyComponent = withStyles({ + root: { + backgroundColor: 'red', + }, + })(({ classes }) => <div className={classes.root} />); + + function MyOtherComponent(props) { + const ref = React.useRef(); + - return <MyComponent innerRef={ref} />; + + return <MyComponent ref={ref} />; + } + ``` + +- The `withStyles` JSS utility is no longer exported from `@material-ui/core/styles`. You can use `@material-ui/styles/withStyles` instead. Make sure to add a `ThemeProvider` at the root of your application, as the `defaultTheme` is no longer available. If you are using this utility together with `@material-ui/core`, you should use the `ThemeProvider` component from `@material-ui/core/styles` instead. + + ```diff + -import { withStyles } from '@material-ui/core/styles'; + +import { withStyles } from '@material-ui/styles'; + +import { createTheme, ThemeProvider } from '@material-ui/core/styles'; + + +const defaultTheme = createTheme(); + const MyComponent = withStyles((props) => { + const { classes, className, ...other } = props; + return <div className={clsx(className, classes.root)} {...other} /> + })(({ theme }) => ({ root: { background: theme.palette.primary.main }})); + + function App() { + - return <MyComponent />; + + return <ThemeProvider theme={defaultTheme}><MyComponent /></ThemeProvider>; + } + ``` + +#### withTheme + +- The `withTheme` HOC utility has been removed from the `@material-ui/core/styles` package. You can use `@material-ui/styles/withTheme` instead. Make sure to add a `ThemeProvider` at the root of your application, as the `defaultTheme` is no longer available. If you are using this utility together with `@material-ui/core`, it's recommended you use the `ThemeProvider` component from `@material-ui/core/styles` instead. + + ```diff + -import { withTheme } from '@material-ui/core/styles'; + +import { withTheme } from '@material-ui/styles'; + +import { createTheme, ThemeProvider } from '@material-ui/core/styles'; + + +const theme = createTheme(); + const MyComponent = withTheme(({ theme }) => <div>{props.theme.direction}</div>); + + function App(props) { + - return <MyComponent />; + + return <ThemeProvider theme={theme}><MyComponent {...props} /></ThemeProvider>; + } + ``` + +- Replace the `innerRef` prop with the `ref` prop. Refs are now automatically forwarded to the inner component. + + ```diff + import * as React from 'react'; + import { withTheme } from '@material-ui/core/styles'; + + const MyComponent = withTheme(({ theme }) => <div>{props.theme.direction}</div>); + + function MyOtherComponent(props) { + const ref = React.useRef(); + - return <MyComponent innerRef={ref} />; + + return <MyComponent ref={ref} />; + } + ``` + +#### withWidth + +- This HOC was removed. There's an alternative using the `useMediaQuery` hook on [this page](/components/use-media-query/#migrating-from-withwidth). + +### `@material-ui/types` + +- Rename the exported `Omit` type in `@material-ui/types`. The module is now called `DistributiveOmit`. The change removes the confusion with the built-in `Omit` helper introduced in TypeScript v3.5. The built-in `Omit`, while similar, is non-distributive. This leads to differences when applied to union types. [See this StackOverflow answer for further details](https://stackoverflow.com/a/57103940/1009797). + + ```diff + -import { Omit } from '@material-ui/types'; + +import { DistributiveOmit } from '@material-ui/types'; + ``` + +### `@material-ui/styles` + +#### ThemeProvider + +If you are using the utilities from `@material-ui/styles` together with the `@material-ui/core`, you should replace the use of `ThemeProvider` from `@material-ui/styles` with the one exported from `@material-ui/core/styles`. This way, the `theme` provided in the context will be available in both the styling utilities exported from `@material-ui/styles`, like `makeStyles`, `withStyles` etc. and the Material-UI components. ```diff --<Box css={{ color: 'primary.main' }} /> -+<Box sx={{ color: 'primary.main' }} /> +-import { ThemeProvider } from '@material-ui/styles'; ++import { ThemeProvider } from '@material-ui/core/styles'; +``` + +#### Default theme (TypeScript) + +The `@material-ui/styles` package is no longer part of `@material-ui/core/styles`. If you are using `@material-ui/styles` together with `@material-ui/core` you need to add a module augmentation for the `DefaultTheme`. + +```ts +import { Theme } from '@material-ui/core/styles'; + +declare module '@material-ui/styles' { + interface DefaultTheme extends Theme {} +} ``` diff --git a/docs/src/pages/guides/migration-v4/migration-v4-pt.md b/docs/src/pages/guides/migration-v4/migration-v4-pt.md index 0b65265cab7c83..bc9c86b49f6629 100644 --- a/docs/src/pages/guides/migration-v4/migration-v4-pt.md +++ b/docs/src/pages/guides/migration-v4/migration-v4-pt.md @@ -2,13 +2,13 @@ <p class="description">Sim, v5 foi lançada!</p> -Procurando pelos documentos da v4? [Encontre-os aqui](https://material-ui.com/versions/). +If you're looking for the v4 docs, you can [find them here](https://material-ui.com/versions/). -> Este documento está em constante evolução. Você atualizou seu site e encontrou algo que não é abordado aqui? [Adicione suas alterações no GitHub](https://github.com/mui-org/material-ui/blob/HEAD/docs/src/pages/guides/migration-v4/migration-v4.md). +> Este documento está em constante evolução. If you have upgraded your site and run into something that's not covered here, please [add your changes on GitHub](https://github.com/mui-org/material-ui/blob/HEAD/docs/src/pages/guides/migration-v4/migration-v4.md). ## Introdução -Esta é uma referência para atualizar seu site de Material-UI v4 para v5. Embora haja muita coisa coberta por aqui, você provavelmente não precisará fazer tudo no seu site. Faremos o nosso melhor para manter as coisas fáceis de seguir e tão sequenciais quanto possível, para que você possa rapidamente agitar na v5! +Esta é uma referência para atualizar seu site de Material-UI v4 para v5. While there's a lot covered here, you probably won't need to do everything. We'll do our best to keep things easy to follow, and as sequential as possible, so you can quickly get rocking on v5! ## Por que você deve migrar @@ -46,11 +46,11 @@ yarn add @material-ui/core@next @emotion/react @emotion/styled Os indicativos de suporte do pacote padrão foram alterados. As versões exatas do suporte serão fixadas na consulta browserslist `"> 0.5%, last 2 versions, Firefox ESR, not dead, not IE 11, maintained node versions"`. -O pacote padrão agora suporta: +The default bundle supports the following minimum versions: <!-- #stable-snapshot --> -- Node 10 (antes era 8) +- Node 12 (antes era 8) - Chrome 84 (antes era 49) - Edge 85 (antes 14) - Firefox 78 (antes era 52) @@ -63,27 +63,26 @@ Não há mais o suporte para o IE 11. Se você precisar do suporte para o IE 11, O suporte para componentes de classe, sem o encaminhamento de refs, na propriedade `component` ou como um elemento `children` imediato foi removido. Se você estava usando `unstable_createStrictModeTheme` ou não recebeu quaisquer avisos relacionados a `findDOMNode` no `React. StrictMode`, então você não precisa fazer nada. Caso contrário, confira a seção ["Advertência com refs" em nosso guia de composição](/guides/composition/#caveat-with-refs) para descobrir como migrar. Esta alteração afeta quase todos os componentes no qual você está usando a propriedade `component` ou passando diretamente um `children` para componentes que requerem `children` como elemento (ou seja, `<MenuList><CustomMenuItem /></MenuList>`) -### Styled engine +### Supported React version -The styled engine used in v5 by default is [`emotion`](https://github.com/emotion-js/emotion). While migration from JSS to emotion, if you are using JSS style overrides for your components (for example overrides created by `makeStyles`), you need to take care of the CSS injection order. In order to do this, you need to have on the top of your application the `StylesProvider` with the `injectFirst` option. Here is an example of it: +The minimum supported version of React was increased from v16.8.0 to v17.0.0. -```jsx -Agora você pode sobrescrever os estilos do Material-UI. import * as React from 'react'; -import { StylesProvider } from '@material-ui/core'; +### Supported TypeScript version -export default function GlobalCssPriority() { - return ( - <StylesProvider injectFirst> - {/* Your component tree. */} - </StylesProvider> - ); -} -``` +The minimum supported version of TypeScript was increased from v3.2 to v3.5. We try to align with types released from [DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped) (i.e. packages published on npm under the `@types` namespace). We will not change the minimum supported version in a major version of Material-UI. However, we generally recommend to not use a TypeScript version older than the [lowest supported version of DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped#older-versions-of-typescript-33-and-earlier) -**Note:** If you are using emotion and have a custom cache in your app, that one will override the one coming from Material-UI. In order for the injection order to still be correct, you need to add the prepend option. Aqui está um exemplo: +### Style library + +The style library used by default in v5 is [`emotion`](https://github.com/emotion-js/emotion). While migrating from JSS to emotion, and if you are using JSS style overrides for your components (for example overrides created by `makeStyles`), you will need to take care of the CSS injection order. To do so, you need to have the `StyledEngineProvider` with the `injectFirst` option at the top of your component tree. Aqui está um exemplo: ```jsx import * as React from 'react'; +import { StyledEngineProvider } from '@material-ui/core/styles'; + +export default function GlobalCssPriority() { + return ( + <StyledEngineProvider injectFirst> + {/* Your component tree. import * as React from 'react'; import { CacheProvider } from '@emotion/react'; import createCache from '@emotion/cache'; @@ -92,26 +91,60 @@ const cache = createCache({ prepend: true, }); -export default function PlainCssPriority() { +export default function CssModulesPriority() { return ( <CacheProvider value={cache}> - {/* Sua árvore de componentes. import * as React from 'react'; + {/* Sua árvore de componentes. */} + </CacheProvider> + ); +} +``` + +> **Note:** If you are using emotion to style your app, and have a custom cache, it will override the one provided by Material-UI. In order for the injection order to still be correct, you need to add the `prepend` option to `createCache`. Aqui está um exemplo: + +```jsx +Agora você pode sobrescrever os estilos do Material-UI. import * as React from 'react'; import { StylesProvider } from '@material-ui/core'; export default function GlobalCssPriority() { return ( <StylesProvider injectFirst> - {/* Your component tree. */} - </CacheProvider> + {/* Your component tree. import * as React from 'react'; +import { CacheProvider } from '@emotion/react'; +import createCache from '@emotion/cache'; + +const cache = createCache({ + key: 'css', + prepend: true, +}); + +export default function CssModulesPriority() { + return ( + <CacheProvider value={cache}> + {/* Sua árvore de componentes. */} + </StylesProvider> ); } ``` -**Note:** If you are using styled-components and have `StyleSheetManager` with a custom `target`, make sure that the target is the first element in the HTML `<head>`. If you are curious to see how it can be done, you can take a look on the `StylesProvider` implementation in the `@material-ui/styled-engine-sc` package. +> **Note:** If you are using styled-components and have `StyleSheetManager` with a custom `target`, make sure that the target is the first element in the HTML `<head>`. To see how it can be done, take a look at the [`StyledEngineProvider` implementation](https://github.com/mui-org/material-ui/blob/next/packages/material-ui-styled-engine-sc/src/StyledEngineProvider/StyledEngineProvider.js) in the `@material-ui/styled-engine-sc` package. ### Tema -- Pontos de quebra agora são tratados como valores, em vez de intervalos. O comportamento de `down(key)` foi modificado para definir uma consulta de mídia menor do que o valor definido como ponto de quebra correspondente (de forma exclusiva). O `between(start, end)` também foi atualizado para definir uma consulta de mídia para os valores reais entre o início (de forma inclusiva) e fim (de forma exclusiva). Ao usar o utilitário de pontos de quebra `down()`, você precisa atualizar a chave de ponto de quebra em um passo. Ao usar o `between(start, end)`, o ponto de quebra de fim também deve ser atualizado em um passo. O mesmo deve ser feito ao usar o componente `Hidden`. Observe exemplos das definições de mudanças necessárias abaixo: +- The function `createMuiTheme` was renamed to `createTheme` to make more intuitive to use with `ThemeProvider`. + + ```diff + -import { createMuiTheme } from '@material-ui/core/styles'; + +import { createTheme } from '@material-ui/core/styles'; + + -const theme = createMuiTheme({ + +const theme = createTheme({ + ``` + +- The default background color is now `#fff` in light mode and `#121212` in dark mode. This matches the Material Design guidelines. +- Breakpoints are now treated as values instead of [ranges](https://v4.material-ui.com/customization/breakpoints/#default-breakpoints). The behavior of `down(key)` was changed to define a media query below the value defined by the corresponding breakpoint (exclusive), rather than the breakpoint above. `between(start, end)` was also updated to define a media query for the values between the actual values of start (inclusive) and end (exclusive). Ao usar o utilitário de pontos de quebra `down()`, você precisa atualizar a chave de ponto de quebra em um passo. Ao usar o `between(start, end)`, o ponto de quebra de fim também deve ser atualizado em um passo. + + Here are some examples of the changes required: ```diff -theme.breakpoints.down('sm') // '@media (max-width:959.95px)' - [0, sm + 1) => [0, md) @@ -128,11 +161,22 @@ export default function GlobalCssPriority() { +theme.breakpoints.up('sm') // '@media (min-width:600px)' ``` + You can use the [`theme-breakpoints` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#theme-breakpoints) for automatic migration of `theme.breakpoints`. + + O mesmo deve ser feito ao usar o componente `Hidden`: + ```diff -<Hidden smDown>{...}</Hidden> // '@media (min-width:600px)' +<Hidden mdDown>{...}</Hidden> // '@media (min-width:600px)' ``` +- The `theme.breakpoints.width` utility was removed because it's redundant. Use `theme.breakpoints.values` to get the same values. + + ```diff + -theme.breakpoints.width('md') + +theme.breakpoints.values.md + ``` + - A assinatura do utilitário `theme.palette.augmentColor` foi alterada: ```diff @@ -140,24 +184,65 @@ export default function GlobalCssPriority() { +theme.palette.augmentColor({ color: red, name: 'brand' }); ``` +- The `theme.typography.round` helper was removed because it was no longer used. If you need it, use the function below: + + ```js + function round(value) { + return Math.round(value * 1e5) / 1e5; + } + ``` + +- The default breakpoints were changed to better match the common use cases. They also better match the Material Design guidelines. [Read more about the change](https://github.com/mui-org/material-ui/issues/21902) + + ```diff + { + xs: 0, + sm: 600, + - md: 960, + + md: 900, + - lg: 1280, + + lg: 1200, + - xl: 1920, + + xl: 1536, + } + ``` + + If you prefer the old breakpoint values, use the snippet below. + + ```js + import { createTheme } from '@material-ui/core/styles'; + + const theme = createTheme({ + breakpoints: { + values: { + xs: 0, + sm: 600, + md: 960, + lg: 1280, + xl: 1920, + }, + }, + }); + ``` + #### Utilitário para atualização For a smoother transition, the `adaptV4Theme` helper allows you to iteratively upgrade to the new theme structure. ```diff -import { createMuiTheme } from '@material-ui/core/styles'; -+import { createMuiTheme, adaptV4Theme } from '@material-ui/core/styles'; ++import { createTheme, adaptV4Theme } from '@material-ui/core/styles'; -const theme = createMuiTheme({ -+const theme = createMuiTheme(adaptV4Theme({ ++const theme = createTheme(adaptV4Theme({ // v4 theme -}); +})); ``` -As seguintes alterações são aplicadas por este utilitário adaptador. +##### Supported changes -#### Alterações +As seguintes alterações são aplicadas por este utilitário adaptador: - A abstração com a função "gutters" não provou ser utilizada com frequência suficiente para ser valiosa. @@ -185,33 +270,35 @@ As seguintes alterações são aplicadas por este utilitário adaptador. theme.spacing(2) => '16px' ``` -- O `theme.palette.type` foi renomeado para `theme.palette.mode`, para melhor seguir o termo "modo escuro", que é geralmente usado para descrever este recurso. + You can use the [`theme-spacing` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#theme-spacing) to remove any 'px' suffix from `theme.spacing` calls in a template string. + +- The `theme.palette.type` key was renamed to `theme.palette.mode`, to better follow the "dark mode" term that is usually used for describing this feature. ```diff - import { createMuiTheme } from '@material-ui/core/styles'; - -const theme = createMuiTheme({palette: { type: 'dark' }}), - +const theme = createMuiTheme({palette: { mode: 'dark' }}), + import { createTheme } from '@material-ui/core/styles'; + -const theme = createTheme({palette: { type: 'dark' }}), + +const theme = createTheme({palette: { mode: 'dark' }}), ``` - A chave `theme.palette.text.hint` não era usada em componentes do Material-UI e foi removida. Se você depende dela, você pode adicioná-la de volta: ```diff - import { createMuiTheme } from '@material-ui/core/styles'; + import { createTheme } from '@material-ui/core/styles'; - -const theme = createMuiTheme(), - +const theme = createMuiTheme({ + -const theme = createTheme(), + +const theme = createTheme({ + palette: { text: { hint: 'rgba(0, 0, 0, 0.38)' } }, +}); ``` -- As definições dos componentes dentro do tema foi reestruturada sob a chave `components`, para permitir que as pessoas possam descobrir de uma maneira facilitada as definições sobre um componente. +- The components' definitions in the theme were restructure under the `components` key, to allow for easier discoverability of the definitions related to any one component. 1. `props` ```diff -import { createMuiTheme } from '@material-ui/core/styles'; +import { createTheme } from '@material-ui/core/styles'; -const theme = createMuiTheme({ +const theme = createTheme({ - props: { - MuiButton: { - disableRipple: true, @@ -230,9 +317,9 @@ const theme = createMuiTheme({ 2. `sobrescrevendo` ```diff -import { createMuiTheme } from '@material-ui/core/styles'; +import { createTheme } from '@material-ui/core/styles'; -const theme = createMuiTheme({ +const theme = createTheme({ - overrides: { - MuiButton: { - root: { padding: 0 }, @@ -252,33 +339,67 @@ const theme = createMuiTheme({ - Renomeado `fade` para `alpha` para descrever melhor a sua funcionalidade. O nome anterior estava gerando confusão quando a cor de entrada já tinha um valor alfa. O utilitário **sobrescreve** o valor alfa da cor. -```diff -- import { fade } from '@material-ui/core/styles'; -+ import { alpha } from '@material-ui/core/styles'; + ```diff + - import { fade } from '@material-ui/core/styles'; + + import { alpha } from '@material-ui/core/styles'; + + const classes = makeStyles(theme => ({ + - backgroundColor: fade(theme.palette.primary.main, theme.palette.action.selectedOpacity), + + backgroundColor: alpha(theme.palette.primary.main, theme.palette.action.selectedOpacity), + })); + ``` -const classes = makeStyles(theme => ({ -- backgroundColor: fade(theme.palette.primary.main, theme.palette.action.selectedOpacity), -+ backgroundColor: alpha(theme.palette.primary.main, theme.palette.action.selectedOpacity), -})); + You can use the [`fade-rename-alpha` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#fade-rename-alpha) for automatic migration. + +- The `createStyles` function from `@material-ui/core/styles` was moved to the one exported from `@material-ui/styles`. It is necessary for removing the dependency to `@material-ui/styles` in the core package. + +```diff +-import { createStyles } from '@material-ui/core/styles'; ++import { createStyles } from '@material-ui/styles'; ``` ### Sistema -- The following system functions (and properties) were renamed, because they are considered deprecated CSS: +- The following system functions (and properties) were renamed because they are considered deprecated CSS: + + 1. `gridGap` to `gap` + 1. `gridRowGap` to `rowGap` + 1. `gridColumnGap` to `columnGap` + +- Use spacing unit in `gap`, `rowGap`, and `columnGap`. If you were using a number previously, you need to mention the px to bypass the new transformation with `theme.spacing`. + + ```diff + <Box + - gap={2} + + gap="2px" + > + ``` + +- Replace `css` prop with `sx` to avoid collision with styled-components & emotion `css` prop. + + ```diff + -<Box css={{ color: 'primary.main' }} /> + +<Box sx={{ color: 'primary.main' }} /> + ``` -1. `gridGap` to `gap` -2. `gridColumnGap` to `columnGap` -3. `gridRowGap` to `rowGap` + > Note that the system grid function wasn't documented in v4. ### Componentes do core -As the core components use emotion as a styled engine, the props used by emotion are not intercepted. The prop `as` in the following codesnippet will not be propagated to the `SomeOtherComponent`. +As the core components use emotion as their style engine, the props used by emotion are not intercepted. The prop `as` in the following code snippet will not be propagated to `SomeOtherComponent`. -`<MuiComponent component={SomeOtherComponent} as="button" />` +```jsx +<MuiComponent component={SomeOtherComponent} as="button" /> +``` ### Uma barra de aplicativos proeminente. -- [AppBar] Remova z-index quando a posição for estática e relativa +- Remove z-index when position static and relative. This avoids the creation of a stacking context and rendering issues. +- The `color` prop has no longer any effect in dark mode. The app bar uses the background color required by the elevation to follow the [Material Design guidelines](https://material.io/design/color/dark-theme.html). Use `enableColorOnDark` to restore the behavior of v4. + + ```jsx + <AppBar enableColorOnDark /> + ``` ### Alerta @@ -291,7 +412,7 @@ As the core components use emotion as a styled engine, the props used by emotion +import AlertTitle from '@material-ui/core/AlertTitle'; ``` - Você pode usar o [codemod `moved-lab-modules`](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) para realizar uma migração automática. +Você pode usar o [codemod `moved-lab-modules`](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) para realizar uma migração automática. ### Autocompletar @@ -325,16 +446,39 @@ As the core components use emotion as a styled engine, the props used by emotion - </React. ``` -- Renomeie a propriedade `closeIcon` com `clearIcon` para evitar confusão. +- Rename `closeIcon` prop to `clearIcon` to avoid confusion. ```diff -<Autocomplete closeIcon={defaultClearIcon} /> +<Autocomplete clearIcon={defaultClearIcon} /> ``` + You can use the [`autocomplete-rename-closeicon` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#autocomplete-rename-closeicon) for automatic migration. + +- The following values of the reason argument in `onChange` and `onClose` were renamed for consistency: + + 1. `create-option` to `createOption` + 2. `select-option` to `selectOption` + 3. `remove-option` to `removeOption` + +- Change the CSS rules that use `[data-focus="true"]` to use `.Mui-focused`. The `data-focus` attribute is not set on the focused option anymore, instead, global class names are used. + + ```diff + -'.MuiAutocomplete-option[data-focus="true"]': { + +'.MuiAutocomplete-option.Mui-focused': { + ``` + +- Rename `getOptionSelected` to `isOptionEqualToValue` to better describe its purpose. + + ```diff + <Autocomplete + - getOptionSelected={(option, value) => option.title === value.title} + + isOptionEqualToValue={(option, value) => option.title === value.title} + ``` + ### Avatar -- Renomeie `circle` para `circular` por uma questão de consistência. Os valores possíveis devem ser adjetivos e não substantivos: +- Renomeie `circle` para `circular` por uma questão de consistência: ```diff -<Avatar variant="circle"> @@ -343,6 +487,15 @@ As the core components use emotion as a styled engine, the props used by emotion +<Avatar classes={{ circular: 'className' }}> ``` + Since `circular` is the default value, the variant prop can be deleted: + + ```diff + -<Avatar variant="circle"> + +<Avatar> + ``` + + You can use the [`avatar-circle-circular` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#avatar-circle-circular) for automatic migration. + - Mova o componente AvatarGroup do lab para o core. ```diff @@ -350,9 +503,11 @@ As the core components use emotion as a styled engine, the props used by emotion +import AvatarGroup from '@material-ui/core/AvatarGroup'; ``` + Você pode usar o [codemod `moved-lab-modules`](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) para realizar uma migração automática. + ### Badge -- Renomeie `circle` para `circular` e `rectangle` para `rectangular` por uma questão de consistência. Os valores possíveis devem ser adjetivos e não substantivos: +- Renomeie `circle` para `circular` e `rectangle` para `rectangular` por uma questão de consistência. ```diff -<Badge overlap="circle"> @@ -360,23 +515,25 @@ As the core components use emotion as a styled engine, the props used by emotion +<Badge overlap="circular"> +<Badge overlap="rectangular"> <Badge classes={{ - - anchorOriginTopRightRectangle: 'className' - - anchorOriginBottomRightRectangle: 'className' - - anchorOriginTopLeftRectangle: 'className' - - anchorOriginBottomLeftRectangle: 'className' - - anchorOriginTopRightCircle: 'className' - - anchorOriginBottomRightCircle: 'className' - - anchorOriginTopLeftCircle: 'className' - + anchorOriginTopRightRectangular: 'className' - + anchorOriginBottomRightRectangular: 'className' - + anchorOriginTopLeftRectangular: 'className' - + anchorOriginBottomLeftRectangular: 'className' - + anchorOriginTopRightCircular: 'className' - + anchorOriginBottomRightCircular: 'className' - + anchorOriginTopLeftCircular: 'className' + - anchorOriginTopRightRectangle: 'className', + - anchorOriginBottomRightRectangle: 'className', + - anchorOriginTopLeftRectangle: 'className', + - anchorOriginBottomLeftRectangle: 'className', + - anchorOriginTopRightCircle: 'className', + - anchorOriginBottomRightCircle: 'className', + - anchorOriginTopLeftCircle: 'className', + + anchorOriginTopRightRectangular: 'className', + + anchorOriginBottomRightRectangular: 'className', + + anchorOriginTopLeftRectangular: 'className', + + anchorOriginBottomLeftRectangular: 'className', + + anchorOriginTopRightCircular: 'className', + + anchorOriginBottomRightCircular: 'className', + + anchorOriginTopLeftCircular: 'className', }}> ``` + You can use the [`badge-overlap-value` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#badge-overlap-value) for automatic migration. + ### BottomNavigation - TypeScript: The `event` in `onChange` is no longer typed as a `React. ChangeEvent` but `React. SyntheticEvent`. @@ -388,75 +545,134 @@ As the core components use emotion as a styled engine, the props used by emotion ### Box -- As propriedades de sistema foram descontinuadas na v5, e substituídas pela propriedade `sx`. +- O valor de transformação da propriedade de sistema `borderRadius` foi alterado. Se ele receber um número, ele multiplica esse valor pelo valor de `theme.shape.borderRadius`. Use a string to provide an explicit `px` value. + + ```diff + -<Box borderRadius="borderRadius"> + +<Box borderRadius={1}> + ``` + + ```diff + -<Box borderRadius={16}> + +<Box borderRadius="16px"> + ``` + + You can use the [`box-borderradius-values` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#box-borderradius-values) for automatic migration. + +- The Box system props have an optional alternative API in v5, using the `sx` prop. You can [read this section](/system/basics/#api-tradeoff) for the "why" behind this new API. ```diff -<Box border="1px dashed grey" p={[2, 3, 4]} m={2}> +<Box sx={{ border: "1px dashed grey", p: [2, 3, 4], m: 2 }}> ``` - [Este codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#box-sx-prop) atualizará automaticamente seu código para a nova sintaxe. You can [read this section](/system/basics/#api-tradeoff) for the why behind the change of API. + If you prefer the new syntax, you can use the [`box-sx-prop` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#box-sx-prop) for automatic migration. -- O valor de transformação da propriedade de sistema `borderRadius` foi alterado. Se ele receber um número, ele multiplica esse valor pelo valor de `theme.shape.borderRadius`. Use uma string para fornecer um valor explícito, em `px`. +- The following properties have been renamed because they are considered deprecated CSS properties by the CSS specification: + + 1. `gridGap` to `gap` + 2. `gridColumnGap` to `columnGap` + 3. `gridRowGap` to `rowGap` ```diff - -<Box sx={{ borderRadius: 'borderRadius' }}> - +<Box sx={{ borderRadius: 1 }}> + -<Box gridGap={1}> + -<Box gridColumnGap={2}> + -<Box gridRowGap={3}> + +<Box gap={1}> + +<Box columnGap={2}> + +<Box rowGap={3}> ``` + (Note that the system grid function wasn't documented in v4.) + + You can use the [`box-rename-gap` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#box-rename-gap) for automatic migration. + +- The `clone` prop was removed because its behavior can be obtained by applying the `sx` prop directly to the child if it is a Material-UI component. + ```diff - -<Box sx={{ borderRadius: 16 }}> - +<Box sx={{ borderRadius: '16px' }}> + -<Box sx={{ border: '1px dashed grey' }} clone> + - <Button>Save</Button> + -</Box> + +<Button sx={{ border: '1px dashed grey' }}>Save</Button> ``` -- The following properties were renamed, because they are considered deprecated CSS proeprties: +- The ability to pass a render prop was removed because its behavior can be obtained by applying the `sx` prop directly to the child if it is a Material-UI component. -1. `gridGap` to `gap` -2. `gridColumnGap` to `columnGap` -3. `gridRowGap` to `rowGap` + ```diff + -<Box sx={{ border: '1px dashed grey' }}> + - {(props) => <Button {...props}>Save</Button>} + -</Box> + +<Button sx={{ border: '1px dashed grey' }}>Save</Button> + ``` -```diff --<Box gridGap="10px"> -+<Box sx={{ gap: '10px' }}> -``` + For non-Material-UI components, use the `component` prop. -```diff --<Box gridColumnGap="10px" gridRowGap="20px"> -+<Box sx={{ columnGap: '10px', rowGap: '20px' }}> -``` + ```diff + -<Box sx={{ border: '1px dashed grey' }}> + - {(props) => <button {...props}>Save</button>} + -</Box> + +<Box component="button" sx={{ border: '1px dashed grey' }}>Save</Box> + ``` ### Button -- A propriedade `color` do botão agora é "primary" por padrão, e "default" foi removido. Isto torna o botão mais próximo da especificação do Material Design e simplifica a API. +- A propriedade `color` do botão agora é "primary" por padrão, e "default" foi removido. This makes the button closer to the Material Design guidelines and simplifies the API. ```diff - -<Button color="primary" /> - -<Button color="default" /> - +<Button /> - +<Button /> + -<Button color="primary"> + -<Button color="default"> + +<Button> + +<Button> + ``` + + You can use the [`button-color-prop` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#button-color-prop) for automatic migration. + +- `span` element that wraps children has been removed. `label` classKey is also removed. More details about [this change](https://github.com/mui-org/material-ui/pull/26666). + + ```diff + <button class="MuiButton-root"> + - <span class="MuiButton-label"> + children + - </span> + </button> ``` ### Chip - Renomeie a variante `default` para `filled` por uma questão de consistência. + + Since `filled` is the default value, the variant prop can be deleted: + ```diff -<Chip variant="default"> - +<Chip variant="filled"> + +<Chip> ``` -### Conjunto de progressos + You can use the [`chip-variant-prop` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#chip-variant-prop) for automatic migration. -- A variante `static` foi mesclada na variante `determinate`, assumindo a última a aparência da primeira. A variante removida raramente foi útil. Era uma exceção para Material Design, e foi removida da especificação. +### Caixa de seleção + +- The component doesn't have `.MuiIconButton-root` and `.MuiIconButton-label` class names anymore, target `.MuiButtonBase-root` instead. ```diff - -<CircularProgress variant="determinate" /> + - <span class="MuiIconButton-root MuiButtonBase-root MuiCheckbox-root PrivateSwitchBase-root"> + - <span class="MuiIconButton-label"> + - <input class="PrivateSwitchBase-input"> + + <span class="MuiButtonBase-root MuiCheckbox-root PrivateSwitchBase-root"> + + <span class="PrivateSwitchBase-input"> ``` +### Conjunto de progressos + +- The `static` variant has been renamed to `determinate`, and the previous appearance of `determinate` has been replaced by that of `static`. Era uma exceção para Material Design, e foi removida da especificação. + ```diff - -<CircularProgress variant="static" classes={{ static: 'className' }} /> + <CircularProgress variant="static" classes={{ static: 'className' }} /> +<CircularProgress variant="determinate" classes={{ determinate: 'className' }} /> ``` +You can use the [`circularprogress-variant` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#circularprogress-variant) for automatic migration. + > NB: Se você já tinha customizado como "determinate", suas customizações provavelmente não são mais válidas. Por favor, remova-as. ### Collapse @@ -475,21 +691,28 @@ As the core components use emotion as a styled engine, the props used by emotion +<Collapse classes={{ root: 'collapse' }}> ``` -###  CssBaseline +You can use the [`collapse-rename-collapsedheight` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#collapse-rename-collapsedheight) for automatic migration of both the prop and the classes key. + +### CssBaseline -- The component was migrated to use the `@material-ui/styled-engine` (`emotion` or `styled-components`) instead of `jss`. You should remove the `@global` key when defining the style overrides for it. +- The component was migrated to use the `@material-ui/styled-engine` (`emotion` or `styled-components`) instead of `jss`. You should remove the `@global` key when defining the style overrides for it. You could also start using the CSS template syntax over the JavaScript object syntax. ```diff - const theme = createMuiTheme({ + const theme = createTheme({ components: { MuiCssBaseline: { - styleOverrides: { + - styleOverrides: { - '@global': { - html: { - WebkitFontSmoothing: 'auto', - }, + - html: { + - WebkitFontSmoothing: 'auto', + - }, - }, - }, + - }, + + styleOverrides: ` + + html { + + -webkit-font-smoothing: auto; + + } + + ` }, }, }); @@ -498,7 +721,7 @@ As the core components use emotion as a styled engine, the props used by emotion - The `body` font size has changed from `theme.typography.body2` (`0.875rem`) to `theme.typography.body1` (`1rem`). To return to the previous size, you can override it in the theme: ```js - const theme = createMuiTheme({ + const theme = createTheme({ typography: { body1: { fontSize: '0.875rem', @@ -516,11 +739,11 @@ As the core components use emotion as a styled engine, the props used by emotion ```diff <Dialog - onEnter={onEnter} - - onEntered={onEntered}, - - onEntering={onEntered}, - - onExit={onEntered}, - - onExited={onEntered}, - - onExiting={onEntered} + - onEntered={onEntered} + - onEntering={onEntering} + - onExit={onExit} + - onExited={onExited} + - onExiting={onExiting} + TransitionProps={{ + onEnter, + onEntered, @@ -532,7 +755,9 @@ As the core components use emotion as a styled engine, the props used by emotion /> ``` -- Remova a propriedade `disableBackdropClick` devido a redundância. Em vez disso, ignore eventos de close em `onClose` quando `reason === 'backdropClick'`. + You can use the [`use-transitionprops` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#use-transitionprops) for automatic migration. + +- Remove the `disableBackdropClick` prop because it is redundant. Em vez disso, ignore eventos de close em `onClose` quando `reason === 'backdropClick'`. ```diff <Dialog @@ -546,7 +771,7 @@ As the core components use emotion as a styled engine, the props used by emotion /> ``` -- [withMobileDialog] Remova este componente de ordem superior. A hook API permite uma solução mais simples e flexível: +- Remove the `withMobileDialog` higher-order component. A hook API permite uma solução mais simples e flexível: ```diff -import withMobileDialog from '@material-ui/core/withMobileDialog'; @@ -564,9 +789,20 @@ As the core components use emotion as a styled engine, the props used by emotion +export default ResponsiveDialog; ``` +- Flatten DialogTitle DOM structure, remove `disableTypography` prop + + ```diff + -<DialogTitle disableTypography> + - <Typography variant="h4" component="h2"> + +<DialogTitle> + + <Typography variant="h4" component="span"> + My header + </Typography> + ``` + ### Divider -- Use cor de borda em vez de cor de fundo. Ela impede a altura inconsistente em telas redimensionadas. Para pessoas personalizando a cor da borda, a alteração requer alterar a propriedade CSS com sobrescrita: +- Use cor de borda em vez de cor de fundo. Ela impede a altura inconsistente em telas redimensionadas. If you have customized the color of the border, you will need to update the CSS property override: ```diff . MuiDivider-root { @@ -637,27 +873,66 @@ As the core components use emotion as a styled engine, the props used by emotion ### Fab -- Renomeie `round` para `circular` por uma questão de consistência. Os valores possíveis devem ser adjetivos e não substantivos: +- Rename `round` to `circular` for consistency: ```diff -<Fab variant="round"> +<Fab variant="circular"> ``` +### FormControl + +- Altere a variante padrão de `standard` para `outlined`. Standard has been removed from the Material Design guidelines. + + ```diff + -<FormControl value="Standard" /> + -<FormControl value="Outlined" variant="outlined" /> + +<FormControl value="Standard" variant="standard" /> + +<FormControl value="Outlined" /> + ``` + +[This codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#variant-prop) will automatically update your code. + ### Grid -- Renomeie a propriedade `justify` para `justifyContent` para ter conformidade com o nome da propriedade CSS. +- Rename `justify` prop to `justifyContent` to align with the CSS property name. ```diff -<Grid justify="center"> +<Grid justifyContent="center"> ``` + You can use the [`component-rename-prop` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#component-rename-prop) for automatic migration. + +- The props: `alignItems` `alignContent` and `justifyContent` and their `classes` and style overrides keys were removed: "align-items-xs-center", "align-items-xs-flex-start", "align-items-xs-flex-end", "align-items-xs-baseline", "align-content-xs-center", "align-content-xs-flex-start", "align-content-xs-flex-end", "align-content-xs-space-between", "align-content-xs-space-around", "justify-content-xs-center", "justify-content-xs-flex-end", "justify-content-xs-space-between", "justify-content-xs-space-around" and "justify-content-xs-space-evenly". These props are now considered part of the system, not on the `Grid` component itself. If you still wish to add overrides for them, you can use the `theme.components.MuiGrid.variants` options. For example + + ```diff + const theme = createTheme({ + components: { + MuiGrid: { + - styleOverrides: { + - "align-items-xs-flex-end": { + - marginTop: '20px', + - }, + - }, + + variants: { + + props: { alignItems: "flex-end" }, + + style: { + + marginTop: '20px', + + }, + + }], + }, + }, + }); + ``` + + You can use the [`grid-justify-justifycontent` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#grid-justify-justifycontent) for automatic migration. + ### GridList - Renomeie os componentes `GridList` para `ImageList` para entrar em conformidade com o nome atual do componente no Material Design. - Renomeie no GridList a propriedade `spacing` para `gap` para ter conformidade com o atributo CSS. -- Renomeie no GridList a propriedade `cellHeight` para `rowHieght`. +- Rename the GridList `cellHeight` prop to `rowHeight`. - Adicione a propriedade `variant` para o GridList. - Renomeie no GridListItemBar a propriedade `actionPosition` para `position`. (Observe também as alterações de nome de classe relacionadas.) - Use CSS object-fit. For IE11 support either use a polyfill such as https://www.npmjs.com/package/object-fit-images, or continue to use the v4 component. @@ -686,15 +961,62 @@ As the core components use emotion as a styled engine, the props used by emotion +</ImageList> ``` +### Hidden + +- This component was removed because its functionality can be created with the [`sx`](/system/basics/#the-sx-prop) prop or the [`useMediaQuery`](/components/use-media-query) hook. + + Use the `sx` prop to replace `implementation="css"`: + + ```diff + -<Hidden implementation="css" xlUp><Paper /></Hidden> + -<Hidden implementation="css" xlUp><button /></Hidden> + +<Paper sx={{ display: { xl: 'none', xs: 'block' } }} /> + +<Box component="button" sx={{ display: { xl: 'none', xs: 'block' } }} /> + ``` + + ```diff + -<Hidden implementation="css" mdDown><Paper /></Hidden> + -<Hidden implementation="css" mdDown><button /></Hidden> + +<Paper sx={{ display: { xs: 'none', md: 'block' } }} /> + +<Box component="button" sx={{ display: { xs: 'none', md: 'block' } }} /> + ``` + + Use the `useMediaQuery` hook to replace `implementation="js"`: + + ```diff + -<Hidden implementation="js" xlUp><Paper /></Hidden> + +const hidden = useMediaQuery(theme => theme.breakpoints.up('xl')); + +return hidden ? null : <Paper />; + ``` + ### Icon -- The default value of `fontSize` was changed from `default` to `medium` for consistency. In the unlikey event that you were using the value `default`, the prop can be removed: +- The default value of `fontSize` was changed from `default` to `medium` for consistency. In the unlikely event that you were using the value `default`, the prop can be removed: ```diff -<Icon fontSize="default">icon-name</Icon> +<Icon>icon-name</Icon> ``` +### IconButton + +- The default size's padding is reduced to `8px` which makes the default IconButton size of `40px`. To get the old default size (`48px`), use `size="large"`. The change was done to better match Google's products when Material Design stopped documenting the icon button pattern. + + ```diff + - <IconButton> + + <IconButton size="large"> + ``` + +- `span` element that wraps children has been removed. `label` classKey is also removed. More details about [this change](https://github.com/mui-org/material-ui/pull/26666). + + ```diff + <button class="MuiIconButton-root"> + - <span class="MuiIconButton-label"> + <svg /> + - </span> + </button> + ``` + ### Menu - As propriedades de transição onE\* foram removidas. Em vez disso, use TransitionProps. @@ -702,11 +1024,11 @@ As the core components use emotion as a styled engine, the props used by emotion ```diff <Menu - onEnter={onEnter} - - onEntered={onEntered}, - - onEntering={onEntered}, - - onExit={onEntered}, - - onExited={onEntered}, - - onExiting={onEntered} + - onEntered={onEntered} + - onEntering={onEntering} + - onExit={onExit} + - onExited={onExited} + - onExiting={onExiting} + TransitionProps={{ + onEnter, + onEntered, @@ -718,9 +1040,41 @@ As the core components use emotion as a styled engine, the props used by emotion > ``` + > Note: The `selectedMenu` variant will no longer vertically align the selected item with the anchor. + + You can use the [`use-transitionprops` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#use-transitionprops) for automatic migration. + +- Change the default value of `anchorOrigin.vertical` to follow the Material Design guidelines. The menu now displays below the anchor instead of on top of it. Você pode reproduzir o comportamento anterior com: + + ```diff + <Menu + + anchorOrigin={{ + + vertical: 'top', + + horizontal: 'left', + + }} + ``` + +### MenuItem + +- The `MenuItem` component inherits the `ButtonBase` component instead of `ListItem`. The class names related to "MuiListItem-\*" are removed and theming `ListItem` is no longer affecting `MenuItem`. + + ```diff + -<li className="MuiButtonBase-root MuiMenuItem-root MuiListItem-root"> + +<li className="MuiButtonBase-root MuiMenuItem-root"> + ``` + +- prop `listItemClasses` is removed, use `classes` instead. + + ```diff + -<MenuItem listItemClasses={{...}}> + +<MenuItem classes={{...}}> + ``` + + Read more about [MenuItem CSS API](/api/menu-item/#css) + ### Modal -- Remova a propriedade `disableBackdropClick` devido a redundância. Em vez disso, ignore eventos de close em `onClose` quando `reason === 'backdropClick'`. +- Remove the `disableBackdropClick` prop because it is redundant. Use `onClose` with `reason === 'backdropClick'` instead. ```diff <Modal @@ -734,7 +1088,7 @@ As the core components use emotion as a styled engine, the props used by emotion /> ``` -- Remova a propriedade `onEscapeKeyDown` devido a redundância. Em vez disso, use `onClose` com `reason === "escapeKeyDown"`. +- Remove the `onEscapeKeyDown` prop because it is redundant. Em vez disso, use `onClose` com `reason === "escapeKeyDown"`. ```diff <Modal @@ -749,6 +1103,38 @@ As the core components use emotion as a styled engine, the props used by emotion - Remova a propriedade `onRendered`. Dependendo da sua situação de uso, use um [ref com callback](https://pt-br.reactjs.org/docs/refs-and-the-dom.html#callback-refs) no elemento filho ou um hook de efeito no componente filho. +### NativeSelect + +- Merge the `selectMenu` slot into `select`. Slot `selectMenu` was redundant. The `root` slot is no longer applied to the select, but to the root. + + ```diff + -<NativeSelect classes={{ root: 'class1', select: 'class2', selectMenu: 'class3' }} /> + +<NativeSelect classes={{ select: 'class1 class2 class3' }} /> + ``` + +### OutlinedInput + +- Remove the `labelWidth` prop. The `label` prop now fulfills the same purpose, using CSS layout instead of JavaScript measurement to render the gap in the outlined. + + ```diff + -<OutlinedInput labelWidth={20} /> + +<OutlinedInput label="First Name" /> + ``` + +### Paper + +- Change the background opacity based on the elevation in dark mode. This change was done to follow the Material Design guidelines. You can revert it in the theme: + + ```diff + const theme = createTheme({ + components: { + MuiPaper: { + + styleOverrides: { root: { backgroundImage: 'unset' } }, + }, + }, + }); + ``` + ### Paginação - Mova o componente do lab para o core. O componente agora é estável. @@ -764,7 +1150,7 @@ As the core components use emotion as a styled engine, the props used by emotion Você pode usar o [codemod `moved-lab-modules`](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) para realizar uma migração automática. -- Renomeie `round` para `circular` por uma questão de consistência. Os valores possíveis devem ser adjetivos e não substantivos: +- Rename `round` to `circular` for consistency: ```diff -<Pagination shape="round"> @@ -780,11 +1166,11 @@ As the core components use emotion as a styled engine, the props used by emotion ```diff <Popover - onEnter={onEnter} - - onEntered={onEntered}, - - onEntering={onEntered}, - - onExit={onEntered}, - - onExited={onEntered}, - - onExiting={onEntered} + - onEntered={onEntered} + - onEntering={onEntering} + - onExit={onExit} + - onExited={onExited} + - onExiting={onExiting} + TransitionProps={{ + onEnter, + onEntered, @@ -796,6 +1182,10 @@ As the core components use emotion as a styled engine, the props used by emotion /> ``` + You can use the [`use-transitionprops` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#use-transitionprops) for automatic migration. + +- The `getContentAnchorEl` prop was removed to simplify the positioning logic. + ### Popper - Atualize [Popper.js](https://github.com/popperjs/popper-core) da v1 para v2. Esta biblioteca de terceiros introduziu muitas mudanças.<br /> Você pode ler [seu guia de migração](https://popper.js.org/docs/v2/migration-guide/) ou o seguinte resumo: @@ -807,7 +1197,7 @@ As the core components use emotion as a styled engine, the props used by emotion - '&[x-placement*="bottom"] $arrow': { + '&[data-popper-placement*="bottom"] $arrow': { ``` - - Nomes de métodos alterados. + - Method names have changed: ```diff -popperRef.current.scheduleUpdate() @@ -825,6 +1215,25 @@ As the core components use emotion as a styled engine, the props used by emotion - Remova a propriedade `onRendered`. Dependendo da sua situação de uso, use um [ref com callback](https://pt-br.reactjs.org/docs/refs-and-the-dom.html#callback-refs) no elemento filho ou um hook de efeito no componente filho. +### Botões de opção + +- The radio color prop is now "primary" by default. To continue using the "secondary" color, you must explicitly indicate `secondary`. This brings the radio closer to the Material Design guidelines. + + ```diff + -<Radio /> + +<Radio color="secondary /> + ``` + +- The component doesn't have `.MuiIconButton-root` and `.MuiIconButton-label` class names anymore, target `.MuiButtonBase-root` instead. + + ```diff + - <span class="MuiIconButton-root MuiButtonBase-root MuiRadio-root PrivateSwitchBase-root"> + - <span class="MuiIconButton-label"> + - <input class="PrivateSwitchBase-input"> + + <span class="MuiButtonBase-root MuiRadio-root PrivateSwitchBase-root"> + + <span class="PrivateSwitchBase-input"> + ``` + ### Rating - Mova o componente do lab para o core. O componente agora é estável. @@ -859,78 +1268,139 @@ As the core components use emotion as a styled engine, the props used by emotion ### RootRef - Este componente foi removido. Você pode obter uma referência para o nó DOM subjacente dos nossos componentes através da propriedade `ref`. The component relied on [`ReactDOM.findDOMNode`](https://reactjs.org/docs/react-dom.html#finddomnode) which isdeprecated in `React. - - ```diff - -<RootRef rootRef={ref}> +<pre><code class="diff"> -<RootRef rootRef={ref}> - <Button /> -</RootRef> +<Button ref={ref} /> - ``` +`</pre></li> </ul> + + -### Skeleton +### Seleção -- Mova o componente do lab para o core. O componente agora é estável. +- Altere a variante padrão de `standard` para `outlined`. Standard has been removed from the Material Design guidelines. If you are composing the Select with a form control component, you only need to update `FormControl`, the select inherits the variant from its context. + ```diff - -import Skeleton from '@material-ui/lab/Skeleton'; - +import Skeleton from '@material-ui/core/Skeleton'; + -<Select value="Standard" /> + -<Select value="Outlined" variant="outlined" /> + +<Select value="Standard" variant="standard" /> + +<Select value="Outlined" /> ``` - Você pode usar o [codemod `moved-lab-modules`](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) para realizar uma migração automática. -- Renomeie `circle` para `circular` e `rect` para `rectangular` por uma questão de consistência. Os valores possíveis devem ser adjetivos e não substantivos: +[This codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#variant-prop) will automatically update your code. + +- Remove the `labelWidth` prop. The `label` prop now fulfills the same purpose, using CSS layout instead of JavaScript measurement to render the gap in the outlined. The TextField already handles it by default. + + ```diff - -<Skeleton variant="circle" /> - -<Skeleton variant="rect" /> - -<Skeleton classes={{ circle: 'custom-circle-classname', rect: 'custom-rect-classname', }} /> - +<Skeleton variant="circular" /> - +<Skeleton variant="rectangular" /> - +<Skeleton classes={{ circular: 'custom-circle-classname', rectangular: 'custom-rect-classname', }} /> + -<Select variant="outlined" labelWidth={20} /> + +<Select variant="outlined" label="Gender" /> ``` -### Slider -- TypeScript: The `event` in `onChange` is no longer typed as a `React. ChangeEvent` but `React. SyntheticEvent`. +- Merge the `selectMenu` slot into `select`. Slot `selectMenu` was redundant. The `root` slot is no longer applied to the select, but to the root. + + ```diff - -<Slider onChange={(event: React. ChangeEvent<{}>, value: unknown) => {}} /> - +<Slider onChange={(event: React. SyntheticEvent, value: unknown) => {}} /> + -<Select classes={{ root: 'class1', select: 'class2', selectMenu: 'class3' }} /> + +<Select classes={{ select: 'class1 class2 class3' }} /> ``` -- A propriedade `ValueLabelComponent` agora faz parte da propriedade `components`. - ```diff - -<Slider ValueLabelComponent={CustomValueLabel} /> - +<Slider components={{ ValueLabel: CustomValueLabel }} /> - ``` -- A propriedade `ThumbComponent` agora faz parte da propriedade `components`. - ```diff - -<Slider ThumbComponent={CustomThumb} /> - +<Slider components={{ Thumb: CustomThumb }} /> - ``` +### Skeleton + +- Mova o componente do lab para o core. O componente agora é estável. + + + + ```diff + -import Skeleton from '@material-ui/lab/Skeleton'; + +import Skeleton from '@material-ui/core/Skeleton'; + ``` + + +Você pode usar o [codemod `moved-lab-modules`](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) para realizar uma migração automática. + +- Rename `circle` to `circular` and `rect` to `rectangular` for consistency: + + + + ```diff + -<Skeleton variant="circle" /> + -<Skeleton variant="rect" /> + -<Skeleton classes={{ circle: 'custom-circle-classname', rect: 'custom-rect-classname', }} /> + +<Skeleton variant="circular" /> + +<Skeleton variant="rectangular" /> + +<Skeleton classes={{ circular: 'custom-circle-classname', rectangular: 'custom-rect-classname', }} /> + ``` + + + + +### Slider + +- TypeScript: The `event` in `onChange` is no longer typed as a `React. ChangeEvent` but `React. SyntheticEvent`. + + + + ```diff + -<Slider onChange={(event: React. ChangeEvent<{}>, value: unknown) => {}} /> + +<Slider onChange={(event: React. SyntheticEvent, value: unknown) => {}} /> + ``` + + +- The `ValueLabelComponent` and `ThumbComponent` prop is now part of the `components` prop. + + + + ```diff + <Slider + - ValueLabelComponent={CustomValueLabel} + - ThumbComponent={CustomThumb} + + components={{ + + ValueLabel: CustomValueLabel, + + Thumb: CustomThumb, + + }} + /> + ``` + + +- Rework the CSS to match the latest [Material Design guidelines](https://material.io/components/sliders) and make custom styles more intuitive. [See documentation](/components/slider/). <a href="/components/slider/#continuous-sliders"><img width="247" alt="" src="https://user-images.githubusercontent.com/3165635/121884800-a8808600-cd13-11eb-8cdf-e25de8f1ba73.png" style="margin: auto"></a> + +You can reduce the density of the slider, closer to v4 with the [`size="small"` prop](/components/slider/#sizes). + + ### Snackbar -- A notificação agora é exibida na parte inferior esquerda em telas grandes. This better matches the behavior of Gmail, Google Keep, material.io, etc. You can restore the previous behavior with: Você pode reproduzir o comportamento anterior com: Você pode reproduzir o comportamento anterior com: +- A notificação agora é exibida na parte inferior esquerda em telas grandes. This better matches the behavior of Gmail, Google Keep, material.io, etc. You can restore the previous behavior with: Você pode reproduzir o comportamento anterior com: + + ```diff -<Snackbar /> +<Snackbar anchorOrigin={{ vertical: 'bottom', horizontal: 'center' }} /> ``` -- As propriedades de transição onE\* foram removidas. Em vez disso, use TransitionProps. + +- As propriedades de transição onE\* foram removidas. Em vez disso, use TransitionProps. + + ```diff <Snackbar - onEnter={onEnter} - - onEntered={onEntered}, - - onEntering={onEntered}, - - onExit={onEntered}, - - onExited={onEntered}, - - onExiting={onEntered} + - onEntered={onEntered} + - onEntering={onEntering} + - onExit={onExit} + - onExited={onExited} + - onExiting={onExiting} + TransitionProps={{ + onEnter, + onEntered, @@ -942,9 +1412,16 @@ As the core components use emotion as a styled engine, the props used by emotion /> ``` + +You can use the [`use-transitionprops` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#use-transitionprops) for automatic migration. + + + ### SpeedDial -- Mova o componente do lab para o core. O componente agora é estável. +- Mova o componente do lab para o core. O componente agora é estável. + + ```diff -import SpeedDial from '@material-ui/lab/SpeedDial'; @@ -955,11 +1432,16 @@ As the core components use emotion as a styled engine, the props used by emotion +import SpeedDialIcon from '@material-ui/core/SpeedDialIcon'; ``` - Você pode usar o [codemod `moved-lab-modules`](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) para realizar uma migração automática. + +Você pode usar o [codemod `moved-lab-modules`](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) para realizar uma migração automática. + + ### Assistente -- O componente raiz (Paper) foi substituído por um div. Stepper não tem mais elevação, nem herda as propriedades de Paper. Esta alteração destina-se a incentivar a composição. +- O componente raiz (Paper) foi substituído por um div. Stepper não tem mais elevação, nem herda as propriedades de Paper. Esta alteração destina-se a incentivar a composição. + + ```diff -<Stepper elevation={2}> @@ -976,7 +1458,10 @@ As the core components use emotion as a styled engine, the props used by emotion +<Paper> ``` -- Remova o padding automático de 24px. + +- Remova o padding automático de 24px. + + ```diff -<Stepper> @@ -991,9 +1476,13 @@ As the core components use emotion as a styled engine, the props used by emotion +</Stepper> ``` + + + ### SvgIcon -- The default value of `fontSize` was changed from `default` to `medium` for consistency. In the unlikey event that you were using the value `default`, the prop can be removed: +- The default value of `fontSize` was changed from `default` to `medium` for consistency. In the unlikey event that you were using the value `default`, the prop can be removed: + ```diff -<SvgIcon fontSize="default"> @@ -1002,18 +1491,70 @@ As the core components use emotion as a styled engine, the props used by emotion </SvgIcon> ``` + + + +### Interruptor + +- Remove the second argument from `onChange`. You can pull out the checked state by accessing `event.target.checked`. + + + + ```diff + function MySwitch() { + - const handleChange = (event: React.ChangeEvent<HTMLInputElement>, checked: boolean) => { + + const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => { + + const checked = event.target.checked; + }; + + return <Switch onChange={handleChange} />; + } + ``` + + +- The switch color prop is now "primary" by default. To continue using the "secondary" color, you must explicitly indicate `secondary`. This brings the switch closer to the Material Design guidelines. + + + + ```diff + -<Switch /> + +<Switch color="secondary" /> + ``` + + +- The component doesn't have `.MuiIconButton-root` and `.MuiIconButton-label` class names anymore, target `.MuiButtonBase-root` instead. + + + + ```diff + <span class="MuiSwitch-root"> + - <span class="MuiIconButton-root MuiButtonBase-root MuiSwitch-switchBase PrivateSwitchBase-root"> + - <span class="MuiIconButton-label"> + - <input class="MuiSwitch-input PrivateSwitchBase-input"> + + <span class="MuiButtonBase-root MuiSwitch-switchBase PrivateSwitchBase-root"> + + <span class="MuiSwitch-input PrivateSwitchBase-input"> + ``` + + + + ### Table -- A customização dos rótulos das ações da paginação da tabela deve ser feita com a propriedade `getItemAriaLabel`. Isso aumenta a consistência com o componente `Paginação`. +- A customização dos rótulos das ações da paginação da tabela deve ser feita com a propriedade `getItemAriaLabel`. Isso aumenta a consistência com o componente `Paginação`. + + ```diff <TablePagination - backIconButtonText="Avant" - - nextIconButtonText="Après + - nextIconButtonText="Après" + getItemAriaLabel={…} ``` -- Renomeie `onChangeRowsPerPage` para `onRowsPerPageChange` e `onChangePage` para `onPageChange` por questões de consistência da API. + +- Renomeie `onChangeRowsPerPage` para `onRowsPerPageChange` e `onChangePage` para `onPageChange` por questões de consistência da API. + + ```diff <TablePagination @@ -1023,19 +1564,72 @@ As the core components use emotion as a styled engine, the props used by emotion + onPageChange={()=>{}} ``` + +- Separate classes for different table pagination labels. This allows simpler customizations. + + + + ```diff + <TablePagination + - classes={{ caption: 'foo' }} + + classes={{ selectLabel: 'foo', displayedRows: 'foo' }} + /> + ``` + + +- Move the custom class on `input` to `select`. The `input` key is being applied on another element. + + + + ```diff + <TablePagination + - classes={{ input: 'foo' }} + + classes={{ select: 'foo' }} + /> + ``` + + +- Rename the `default` value of the `padding` prop to `normal`. + + + + ```diff + -<Table padding="default" /> + -<TableCell padding="default" /> + +<Table padding="normal" /> + +<TableCell padding="normal" /> + ``` + + + + ### Abas -- TypeScript: The `event` in `onChange` is no longer typed as a `React. ChangeEvent` but `React. SyntheticEvent`. +- Change the default `indicatorColor` and `textColor` prop values to "primary". This is done to match the most common use cases with Material Design. + + + + ```diff + -<Tabs /> + +<Tabs indicatorColor="primary" textColor="inherit" /> + ``` + + +- TypeScript: The `event` in `onChange` is no longer typed as a `React. ChangeEvent` but `React. SyntheticEvent`. + + ```diff -<Tabs onChange={(event: React. ChangeEvent<{}>, value: unknown) => {}} /> +<Tabs onChange={(event: React. SyntheticEvent, value: unknown) => {}} /> ``` -- A API que controla os botões de rolagem foi dividida em duas propriedades. - - A propriedade `scrollButtons` controla quando os botões de rolagem são exibidos dependendo do espaço disponível. - - A propriedade `allowScrollButtonsMobile` remove a consulta de mídia CSS que oculta sistematicamente os botões de rolagem no celular. +- A API que controla os botões de rolagem foi dividida em duas propriedades. + + - A propriedade `scrollButtons` controla quando os botões de rolagem são exibidos dependendo do espaço disponível. + - A propriedade `allowScrollButtonsMobile` remove a consulta de mídia CSS que oculta sistematicamente os botões de rolagem no celular. + ```diff -<Tabs scrollButtons="on" /> @@ -1046,9 +1640,18 @@ As the core components use emotion as a styled engine, the props used by emotion +<Tabs scrollButtons={false} /> ``` + +- Tab `minWidth` changed from `72px` => `90px` (without media-query) according to [material-design spec](https://material.io/components/tabs#specs) + +- Tab `maxWidth` changed from `264px` => `360px` according to [material-design spec](https://material.io/components/tabs#specs) + + + ### TextField -- Altere a variante padrão de `standard` para `outlined`. O padrão foi removido da Diretrizes do Material Design. +- Altere a variante padrão de `standard` para `outlined`. Standard has been removed from the Material Design guidelines. + + ```diff -<TextField value="Standard" /> @@ -1057,23 +1660,32 @@ As the core components use emotion as a styled engine, the props used by emotion +<TextField value="Outlined" /> ``` -Você pode usar o [codemod `moved-lab-modules`](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) para realizar uma migração automática. -- Renomeie a propriedade `rowsMax` para `maxRows` por questão de consistência com atributos HTML. +You can use the [`variant-prop` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#variant-prop) for automatic migration. + +- Renomeie a propriedade `rowsMax` para `maxRows` por questão de consistência com atributos HTML. + + ```diff -<TextField rowsMax={6}> +<TextField maxRows={6}> ``` -- Melhor isolar o comportamento fixo de altura do textarea para o dinâmico. Você precisa usar a propriedade `minRows` da seguinte forma: + +- Melhor isolar o comportamento fixo de altura do textarea para o dinâmico. Você precisa usar a propriedade `minRows` da seguinte forma: + + ```diff -<TextField rows={2} maxRows={5} /> +<TextField minRows={2} maxRows={5} /> ``` -- Altere o que é esperado no encaminhamento de ref no componente customizado `inputComponent`. O componente deve encaminhar a propriedade `ref` em vez da propriedade `inputRef`. + +- Altere o que é esperado no encaminhamento de ref no componente customizado `inputComponent`. O componente deve encaminhar a propriedade `ref` em vez da propriedade `inputRef`. + + ```diff -function NumberFormatCustom(props) { @@ -1091,39 +1703,70 @@ Você pode usar o [codemod `moved-lab-modules`](https://github.com/mui-org/mate + getInputRef={ref} ``` -- Renomeie as classes `marginDense` e `inputMarginDense` para `sizeSmall` e `inputSizeSmall` para corresponder com a propriedade. + +- Renomeie as classes `marginDense` e `inputMarginDense` para `sizeSmall` e `inputSizeSmall` para corresponder com a propriedade. + + ```diff -<Input margin="dense" /> +<Input size="small" /> ``` + +- Set the InputAdornment `position` prop to `start` or `end`. Use `start` if used as the value of the `startAdornment` prop. Use `end` if used as the value of the `endAdornment` prop. + + + + ```diff + -<TextField startAdornment={<InputAdornment>Kg</InputAdornment>} /> + -<TextField endAdornment={<InputAdornment>Kg</InputAdornment>} /> + +<TextField startAdornment={<InputAdornment position="start">Kg</InputAdornment>} /> + +<TextField endAdornment={<InputAdornment position="end">Kg</InputAdornment>} /> + ``` + + + + ### TextareaAutosize -- Remova a propriedade `rows`, use `minRows` em vez disso. Esta alteração visa esclarecer o comportamento da propriedade. +- Remova a propriedade `rows`, use `minRows` em vez disso. Esta alteração visa esclarecer o comportamento da propriedade. + + ```diff -<TextareaAutosize rows={2} /> +<TextareaAutosize minRows={2} /> ``` -- Renomeie a propriedade `rowsMax` para `maxRows` por questão de consistência com atributos HTML. + +- Renomeie a propriedade `rowsMax` para `maxRows` por questão de consistência com atributos HTML. + + ```diff -<TextareAutosize rowsMax={6}> +<TextareAutosize maxRows={6}> ``` -- Renomeie a propriedade `rowsMin` para `minRows` por questão de consistência com atributos HTML. + +- Renomeie a propriedade `rowsMin` para `minRows` por questão de consistência com atributos HTML. + + ```diff -<TextareAutosize rowsMin={1}> +<TextareAutosize minRows={1}> ``` + + + ### ToggleButton -- Mova o componente do lab para o core. O componente agora é estável. +- Mova o componente do lab para o core. O componente agora é estável. + + ```diff -import ToggleButton from '@material-ui/lab/ToggleButton'; @@ -1132,13 +1775,18 @@ Você pode usar o [codemod `moved-lab-modules`](https://github.com/mui-org/mate +import ToggleButtonGroup from '@material-ui/core/ToggleButtonGroup'; ``` - Você pode usar o [codemod `moved-lab-modules`](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) para realizar uma migração automática. + +Você pode usar o [codemod `moved-lab-modules`](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) para realizar uma migração automática. + + ### Tooltip - Dicas agora estão interativas por padrão. - - O comportamento padrão anterior era falho, como mostra neste artigo, [success criterion 1.4.3 ("hoverable") in WCAG 2.1](https://www.w3.org/TR/WCAG21/#content-on-hover-or-focus). Para refletir o novo valor padrão, a propriedade foi renomeada para `disableInteractive`. Se você quiser reproduzir o comportamento antigo (portanto não chegando ao nível AA), você pode aplicar a seguinte alteração: + + O comportamento padrão anterior era falho, como mostra neste artigo, [success criterion 1.4.3 ("hoverable") in WCAG 2.1](https://www.w3.org/TR/WCAG21/#content-on-hover-or-focus). Para refletir o novo valor padrão, a propriedade foi renomeada para `disableInteractive`. Se você quiser reproduzir o comportamento antigo (portanto não chegando ao nível AA), você pode aplicar a seguinte alteração: + + ```diff -<Tooltip> @@ -1149,26 +1797,319 @@ Você pode usar o [codemod `moved-lab-modules`](https://github.com/mui-org/mate +<Tooltip> ``` + + + ### Tipografia -- Substitua a propriedade `srOnly` para não duplicar as capacidades do [Sistema](https://material-ui.com/system/basics/): +- Remove the `srOnly` variant. You can use the `visuallyHidden` utility in conjunction with the `sx` prop instead. + + ```diff - -import Typography from '@material-ui/core/Typography'; - +import { visuallyHidden } from '@material-ui/system'; - +import styled from 'styled-component'; - - +const Span = styled('span')(visuallyHidden); + +import { visuallyHidden } from '@material-ui/utils'; -<Typography variant="srOnly">Create a user</Typography> - +<Span>Create a user</Span> + +<span style={visuallyHidden}>Create a user</span> ``` -### Sistema -- Substitua a propriedade `css` para `sx` para evitar a colisão com as propriedades CSS de styled-components & emotion. +- The following `classes` and style overrides keys were removed: "colorInherit", "colorPrimary", "colorSecondary", "colorTextPrimary", "colorTextSecondary", "colorError", "displayInline" and "displayBlock". These props are now considered part of the system, not on the `Typography` component itself. If you still wish to add overrides for them, you can use the `theme.components.MuiTypography.variants` options. For example + + + + ```diff + const theme = createTheme({ + components: { + MuiTypography: { + - styleOverrides: { + - colorSecondary: { + - marginTop: '20px', + - }, + - }, + + variants: { + + props: { color: "secondary" }, + + style: { + + marginTop: '20px', + + }, + + }], + }, + }, + }); + ``` + + + + +### `@material-ui/core/styles` + + + +#### createGenerateClassName + +- The `createGenerateClassName` function is no longer exported from `@material-ui/core/styles`. You should import it directly from `@material-ui/styles`. + + + ```diff + -import { createGenerateClassName } from '@material-ui/core/styles'; + +import { createGenerateClassName } from '@material-ui/styles'; + ``` + + + + +#### jssPreset + +- The `jssPreset` object is no longer exported from `@material-ui/core/styles`. You should import it directly from `@material-ui/styles`. + + + ```diff + -import { jssPreset } from '@material-ui/core/styles'; + +import { jssPreset } from '@material-ui/styles'; + ``` + + + + +#### makeStyles + +- The `makeStyles` JSS utility is no longer exported from `@material-ui/core/styles`. You can use `@material-ui/styles/makeStyles` instead. Make sure to add a `ThemeProvider` at the root of your application, as the `defaultTheme` is no longer available. If you are using this utility together with `@material-ui/core`, it's recommended you use the `ThemeProvider` component from `@material-ui/core/styles` instead. + + + ```diff + -import { makeStyles } from '@material-ui/core/styles'; + +import { makeStyles } from '@material-ui/styles'; + +import { createTheme, ThemeProvider } from '@material-ui/core/styles'; + + +const theme = createTheme(); + const useStyles = makeStyles((theme) => ({ + background: theme.palette.primary.main, + })); + function Component() { + const classes = useStyles(); + return <div className={classes.root} /> + } + + // In the root of your app + function App(props) { + - return <Component />; + + return <ThemeProvider theme={theme}><Component {...props} /></ThemeProvider>; + } + ``` + + + + +#### MuiThemeProvider + +- The `MuiThemeProvider` component is no longer exported from `@material-ui/core/styles`. Use `ThemeProvider` instead. + + + ```diff + -import { MuiThemeProvider } from '@material-ui/core/styles'; + +import { ThemeProvider } from '@material-ui/core/styles'; + ``` + + + + +#### ServerStyleSheets + +- The `ServerStyleSheets` component is no longer exported from `@material-ui/core/styles`. You should import it directly from `@material-ui/styles`. + + + ```diff + -import { ServerStyleSheets } from '@material-ui/core/styles'; + +import { ServerStyleSheets } from '@material-ui/styles'; + ``` + + + + +#### styled + +- The `styled` JSS utility is no longer exported from `@material-ui/core/styles`. You can use `@material-ui/styles/styled` instead. Make sure to add a `ThemeProvider` at the root of your application, as the `defaultTheme` is no longer available. If you are using this utility together with `@material-ui/core`, it's recommended you use the `ThemeProvider` component from `@material-ui/core/styles` instead. + + + ```diff + -import { styled } from '@material-ui/core/styles'; + +import { styled } from '@material-ui/styles'; + +import { createTheme, ThemeProvider } from '@material-ui/core/styles'; + + +const theme = createTheme(); + const MyComponent = styled('div')(({ theme }) => ({ background: theme.palette.primary.main })); + + function App(props) { + - return <MyComponent />; + + return <ThemeProvider theme={theme}><MyComponent {...props} /></ThemeProvider>; + } + ``` + + + + +#### StylesProvider + +- The `StylesProvider` component is no longer exported from `@material-ui/core/styles`. You should import it directly from `@material-ui/styles`. + + + ```diff + -import { StylesProvider } from '@material-ui/core/styles'; + +import { StylesProvider } from '@material-ui/styles'; + ``` + + + + +#### useThemeVariants + +- The `useThemeVariants` hook is no longer exported from `@material-ui/core/styles`. You should import it directly from `@material-ui/styles`. + + + ```diff + -import { useThemeVariants } from '@material-ui/core/styles'; + +import { useThemeVariants } from '@material-ui/styles'; + ``` + + + + +#### withStyles + +- Replace the `innerRef` prop with the `ref` prop. Refs are now automatically forwarded to the inner component. + + + + ```diff + import * as React from 'react'; + import { withStyles } from '@material-ui/styles'; + + const MyComponent = withStyles({ + root: { + backgroundColor: 'red', + }, + })(({ classes }) => <div className={classes.root} />); + + function MyOtherComponent(props) { + const ref = React.useRef(); + - return <MyComponent innerRef={ref} />; + + return <MyComponent ref={ref} />; + } + ``` + + +- The `withStyles` JSS utility is no longer exported from `@material-ui/core/styles`. You can use `@material-ui/styles/withStyles` instead. Make sure to add a `ThemeProvider` at the root of your application, as the `defaultTheme` is no longer available. If you are using this utility together with `@material-ui/core`, you should use the `ThemeProvider` component from `@material-ui/core/styles` instead. + + + + ```diff + -import { withStyles } from '@material-ui/core/styles'; + +import { withStyles } from '@material-ui/styles'; + +import { createTheme, ThemeProvider } from '@material-ui/core/styles'; + + +const defaultTheme = createTheme(); + const MyComponent = withStyles((props) => { + const { classes, className, ...other } = props; + return <div className={clsx(className, classes.root)} {...other} /> + })(({ theme }) => ({ root: { background: theme.palette.primary.main }})); + + function App() { + - return <MyComponent />; + + return <ThemeProvider theme={defaultTheme}><MyComponent /></ThemeProvider>; + } + ``` + + + + +#### withTheme + +- The `withTheme` HOC utility has been removed from the `@material-ui/core/styles` package. You can use `@material-ui/styles/withTheme` instead. Make sure to add a `ThemeProvider` at the root of your application, as the `defaultTheme` is no longer available. If you are using this utility together with `@material-ui/core`, it's recommended you use the `ThemeProvider` component from `@material-ui/core/styles` instead. + + + + ```diff + -import { withTheme } from '@material-ui/core/styles'; + +import { withTheme } from '@material-ui/styles'; + +import { createTheme, ThemeProvider } from '@material-ui/core/styles'; + + +const theme = createTheme(); + const MyComponent = withTheme(({ theme }) => <div>{props.theme.direction}</div>); + + function App(props) { + - return <MyComponent />; + + return <ThemeProvider theme={theme}><MyComponent {...props} /></ThemeProvider>; + } + ``` + + +- Replace the `innerRef` prop with the `ref` prop. Refs are now automatically forwarded to the inner component. + + + + ```diff + import * as React from 'react'; + import { withTheme } from '@material-ui/core/styles'; + + const MyComponent = withTheme(({ theme }) => <div>{props.theme.direction}</div>); + + function MyOtherComponent(props) { + const ref = React.useRef(); + - return <MyComponent innerRef={ref} />; + + return <MyComponent ref={ref} />; + } + ``` + + + + +#### withWidth + +- This HOC was removed. There's an alternative using the `useMediaQuery` hook on [this page](/components/use-media-query/#migrating-from-withwidth). + + + +### `@material-ui/types` + +- Rename the exported `Omit` type in `@material-ui/types`. The module is now called `DistributiveOmit`. The change removes the confusion with the built-in `Omit` helper introduced in TypeScript v3.5. The built-in `Omit`, while similar, is non-distributive. This leads to differences when applied to union types. [See this StackOverflow answer for further details](https://stackoverflow.com/a/57103940/1009797). + + + ```diff + -import { Omit } from '@material-ui/types'; + +import { DistributiveOmit } from '@material-ui/types'; + ``` + + + + +### `@material-ui/styles` + + + +#### ThemeProvider + +If you are using the utilities from `@material-ui/styles` together with the `@material-ui/core`, you should replace the use of `ThemeProvider` from `@material-ui/styles` with the one exported from `@material-ui/core/styles`. This way, the `theme` provided in the context will be available in both the styling utilities exported from `@material-ui/styles`, like `makeStyles`, `withStyles` etc. and the Material-UI components. + + ```diff --<Box css={{ color: 'primary.main' }} /> -+<Box sx={{ color: 'primary.main' }} /> +-import { ThemeProvider } from '@material-ui/styles'; ++import { ThemeProvider } from '@material-ui/core/styles'; +``` + + + + +#### Default theme (TypeScript) + +The `@material-ui/styles` package is no longer part of `@material-ui/core/styles`. If you are using `@material-ui/styles` together with `@material-ui/core` you need to add a module augmentation for the `DefaultTheme`. + + + +```ts +import { Theme } from '@material-ui/core/styles'; + +declare module '@material-ui/styles' { + interface DefaultTheme extends Theme {} +} ``` diff --git a/docs/src/pages/guides/migration-v4/migration-v4-ru.md b/docs/src/pages/guides/migration-v4/migration-v4-ru.md index 16c33ac716eceb..4ec7536f66228d 100644 --- a/docs/src/pages/guides/migration-v4/migration-v4-ru.md +++ b/docs/src/pages/guides/migration-v4/migration-v4-ru.md @@ -2,13 +2,13 @@ <p class="description">Yeah, v5 has been released!</p> -Looking for the v4 docs? [Вы можете найти её здесь](https://material-ui.com/versions/). +If you're looking for the v4 docs, you can [find them here](https://material-ui.com/versions/). -> Этот документ пока находится в стадии разработки. Вы обновили свой сайт и столкнулись с чем-то, что здесь не рассматривается? [Добавьте ваши изменения на GitHub](https://github.com/mui-org/material-ui/blob/HEAD/docs/src/pages/guides/migration-v4/migration-v4.md). +> Этот документ пока находится в стадии разработки. If you have upgraded your site and run into something that's not covered here, please [add your changes on GitHub](https://github.com/mui-org/material-ui/blob/HEAD/docs/src/pages/guides/migration-v4/migration-v4.md). ## Вступление -This is a reference for upgrading your site from Material-UI v4 to v5. While there's a lot covered here, you probably won't need to do everything for your site. We'll do our best to keep things easy to follow, and as sequential as possible so you can quickly get rocking on v5! +This is a reference for upgrading your site from Material-UI v4 to v5. While there's a lot covered here, you probably won't need to do everything. We'll do our best to keep things easy to follow, and as sequential as possible, so you can quickly get rocking on v5! ## Why you should migrate @@ -46,11 +46,11 @@ yarn add @material-ui/core@next @emotion/react @emotion/styled Изменены целевые версии для базового пакета. Конкретные версии базового пакета будут уточнены на момент релиза по результатам следующего browserslist-запроса `"> 0.5%, last 2 versions, Firefox ESR, not dead, not IE 11, maintained node versions"`. -На данный момент базовый пакет поддерживает: +The default bundle supports the following minimum versions: <!-- #stable-snapshot --> -- Node 10 (не ниже 8) +- Node 12 (не ниже 8) - Chrome 84 (не ниже 49) - Edge 85 (не ниже 14) - Firefox 78 (не ниже 52) @@ -63,12 +63,26 @@ IE 11 больше не поддерживается. Если вам нужна Support for non-ref-forwarding class components in the `component` prop or as immediate `children` has been dropped. If you were using `unstable_createStrictModeTheme` or didn't see any warnings related to `findDOMNode` in `React.StrictMode` then you don't need to do anything. Otherwise check out the ["Caveat with refs" section in our composition guide](/guides/composition/#caveat-with-refs) to find out how to migrate. This change affects almost all components where you're using the `component` prop or passing `children` to components that require `children` to be elements (e.g. `<MenuList><CustomMenuItem /></MenuList>`) -### Styled engine +### Supported React version -The styled engine used in v5 by default is [`emotion`](https://github.com/emotion-js/emotion). While migration from JSS to emotion, if you are using JSS style overrides for your components (for example overrides created by `makeStyles`), you need to take care of the CSS injection order. In order to do this, you need to have on the top of your application the `StylesProvider` with the `injectFirst` option. Here is an example of it: +The minimum supported version of React was increased from v16.8.0 to v17.0.0. + +### Supported TypeScript version + +The minimum supported version of TypeScript was increased from v3.2 to v3.5. We try to align with types released from [DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped) (i.e. packages published on npm under the `@types` namespace). We will not change the minimum supported version in a major version of Material-UI. However, we generally recommend to not use a TypeScript version older than the [lowest supported version of DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped#older-versions-of-typescript-33-and-earlier) + +### Style library + +The style library used by default in v5 is [`emotion`](https://github.com/emotion-js/emotion). While migrating from JSS to emotion, and if you are using JSS style overrides for your components (for example overrides created by `makeStyles`), you will need to take care of the CSS injection order. To do so, you need to have the `StyledEngineProvider` with the `injectFirst` option at the top of your component tree. Here is an example: ```jsx -Now you can override Material-UI's styles. import * as React from 'react'; +import * as React from 'react'; +import { StyledEngineProvider } from '@material-ui/core/styles'; + +export default function GlobalCssPriority() { + return ( + <StyledEngineProvider injectFirst> + {/* Your component tree. import * as React from 'react'; import { StylesProvider } from '@material-ui/core'; export default function GlobalCssPriority() { @@ -80,21 +94,15 @@ export default function GlobalCssPriority() { } ``` -**Note:** If you are using emotion and have a custom cache in your app, that one will override the one coming from Material-UI. In order for the injection order to still be correct, you need to add the prepend option. Here is an example: +> **Note:** If you are using emotion to style your app, and have a custom cache, it will override the one provided by Material-UI. In order for the injection order to still be correct, you need to add the `prepend` option to `createCache`. Here is an example: ```jsx import * as React from 'react'; -import { CacheProvider } from '@emotion/react'; -import createCache from '@emotion/cache'; - -const cache = createCache({ - key: 'css', - prepend: true, -}); +import { StylesProvider } from '@material-ui/core'; -export default function PlainCssPriority() { +export default function GlobalCssPriority() { return ( - <CacheProvider value={cache}> + <StylesProvider injectFirst> {/* Your component tree. import * as React from 'react'; import { StylesProvider } from '@material-ui/core'; @@ -102,16 +110,29 @@ export default function GlobalCssPriority() { return ( <StylesProvider injectFirst> {/* Your component tree. */} - </CacheProvider> + </StylesProvider> ); } ``` -**Note:** If you are using styled-components and have `StyleSheetManager` with a custom `target`, make sure that the target is the first element in the HTML `<head>`. If you are curious to see how it can be done, you can take a look on the `StylesProvider` implementation in the `@material-ui/styled-engine-sc` package. +> **Note:** If you are using styled-components and have `StyleSheetManager` with a custom `target`, make sure that the target is the first element in the HTML `<head>`. To see how it can be done, take a look at the [`StyledEngineProvider` implementation](https://github.com/mui-org/material-ui/blob/next/packages/material-ui-styled-engine-sc/src/StyledEngineProvider/StyledEngineProvider.js) in the `@material-ui/styled-engine-sc` package. ### Темы -- Breakpoints are now treated as values instead of ranges. The behavior of `down(key)` was changed to define media query less than the value defined with the corresponding breakpoint (exclusive). The `between(start, end)` was also updated to define media query for the values between the actual values of start (inclusive) and end (exclusive). When using the `down()` breakpoints utility you need to update the breakpoint key by one step up. When using the `between(start, end)` the end breakpoint should also be updated by one step up. The same should be done when using the `Hidden` component. Find examples of the changes required defined below: +- The function `createMuiTheme` was renamed to `createTheme` to make more intuitive to use with `ThemeProvider`. + + ```diff + -import { createMuiTheme } from '@material-ui/core/styles'; + +import { createTheme } from '@material-ui/core/styles'; + + -const theme = createMuiTheme({ + +const theme = createTheme({ + ``` + +- The default background color is now `#fff` in light mode and `#121212` in dark mode. This matches the Material Design guidelines. +- Breakpoints are now treated as values instead of [ranges](https://v4.material-ui.com/customization/breakpoints/#default-breakpoints). The behavior of `down(key)` was changed to define a media query below the value defined by the corresponding breakpoint (exclusive), rather than the breakpoint above. `between(start, end)` was also updated to define a media query for the values between the actual values of start (inclusive) and end (exclusive). When using the `down()` breakpoints utility you need to update the breakpoint key by one step up. When using the `between(start, end)` the end breakpoint should also be updated by one step up. + + Here are some examples of the changes required: ```diff -theme.breakpoints.down('sm') // '@media (max-width:959.95px)' - [0, sm + 1) => [0, md) @@ -128,11 +149,22 @@ export default function GlobalCssPriority() { +theme.breakpoints.up('sm') // '@media (min-width:600px)' ``` + You can use the [`theme-breakpoints` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#theme-breakpoints) for automatic migration of `theme.breakpoints`. + + The same should be done when using the `Hidden` component: + ```diff -<Hidden smDown>{...}</Hidden> // '@media (min-width:600px)' +<Hidden mdDown>{...}</Hidden> // '@media (min-width:600px)' ``` +- The `theme.breakpoints.width` utility was removed because it's redundant. Use `theme.breakpoints.values` to get the same values. + + ```diff + -theme.breakpoints.width('md') + +theme.breakpoints.values.md + ``` + - The signature of `theme.palette.augmentColor` helper has changed: ```diff @@ -140,24 +172,65 @@ export default function GlobalCssPriority() { +theme.palette.augmentColor({ color: red, name: 'brand' }); ``` +- The `theme.typography.round` helper was removed because it was no longer used. If you need it, use the function below: + + ```js + function round(value) { + return Math.round(value * 1e5) / 1e5; + } + ``` + +- The default breakpoints were changed to better match the common use cases. They also better match the Material Design guidelines. [Read more about the change](https://github.com/mui-org/material-ui/issues/21902) + + ```diff + { + xs: 0, + sm: 600, + - md: 960, + + md: 900, + - lg: 1280, + + lg: 1200, + - xl: 1920, + + xl: 1536, + } + ``` + + If you prefer the old breakpoint values, use the snippet below. + + ```js + import { createTheme } from '@material-ui/core/styles'; + + const theme = createTheme({ + breakpoints: { + values: { + xs: 0, + sm: 600, + md: 960, + lg: 1280, + xl: 1920, + }, + }, + }); + ``` + #### Upgrade helper For a smoother transition, the `adaptV4Theme` helper allows you to iteratively upgrade to the new theme structure. ```diff -import { createMuiTheme } from '@material-ui/core/styles'; -+import { createMuiTheme, adaptV4Theme } from '@material-ui/core/styles'; ++import { createTheme, adaptV4Theme } from '@material-ui/core/styles'; -const theme = createMuiTheme({ -+const theme = createMuiTheme(adaptV4Theme({ ++const theme = createTheme(adaptV4Theme({ // v4 theme -}); +})); ``` -The following changes are supported by the adapter. +##### Supported changes -#### Changes +The following changes are supported by the adapter: - The "gutters" abstraction hasn't proven to be used frequently enough to be valuable. @@ -185,33 +258,35 @@ The following changes are supported by the adapter. theme.spacing(2) => '16px' ``` -- The `theme.palette.type` was renamed to `theme.palette.mode`, to better follow the "dark mode" term that is usually used for describing this feature. + You can use the [`theme-spacing` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#theme-spacing) to remove any 'px' suffix from `theme.spacing` calls in a template string. + +- The `theme.palette.type` key was renamed to `theme.palette.mode`, to better follow the "dark mode" term that is usually used for describing this feature. ```diff - import { createMuiTheme } from '@material-ui/core/styles'; - -const theme = createMuiTheme({palette: { type: 'dark' }}), - +const theme = createMuiTheme({palette: { mode: 'dark' }}), + import { createTheme } from '@material-ui/core/styles'; + -const theme = createTheme({palette: { type: 'dark' }}), + +const theme = createTheme({palette: { mode: 'dark' }}), ``` - The `theme.palette.text.hint` key was unused in Material-UI components, and has been removed. If you depend on it, you can add it back: ```diff - import { createMuiTheme } from '@material-ui/core/styles'; + import { createTheme } from '@material-ui/core/styles'; - -const theme = createMuiTheme(), - +const theme = createMuiTheme({ + -const theme = createTheme(), + +const theme = createTheme({ + palette: { text: { hint: 'rgba(0, 0, 0, 0.38)' } }, +}); ``` -- The components' definition inside the theme were restructure under the `components` key, to allow people easier discoverability about the definitions regarding one component. +- The components' definitions in the theme were restructure under the `components` key, to allow for easier discoverability of the definitions related to any one component. 1. `props` ```diff -import { createMuiTheme } from '@material-ui/core/styles'; +import { createTheme } from '@material-ui/core/styles'; -const theme = createMuiTheme({ +const theme = createTheme({ - props: { - MuiButton: { - disableRipple: true, @@ -230,9 +305,9 @@ const theme = createMuiTheme({ 2. `переопределение` ```diff -import { createMuiTheme } from '@material-ui/core/styles'; +import { createTheme } from '@material-ui/core/styles'; -const theme = createMuiTheme({ +const theme = createTheme({ - overrides: { - MuiButton: { - root: { padding: 0 }, @@ -252,33 +327,67 @@ const theme = createMuiTheme({ - Renamed `fade` to `alpha` to better describe its functionality. The previous name was leading to confusion when the input color already had an alpha value. The helper **overrides** the alpha value of the color. -```diff -- import { fade } from '@material-ui/core/styles'; -+ import { alpha } from '@material-ui/core/styles'; + ```diff + - import { fade } from '@material-ui/core/styles'; + + import { alpha } from '@material-ui/core/styles'; -const classes = makeStyles(theme => ({ -- backgroundColor: fade(theme.palette.primary.main, theme.palette.action.selectedOpacity), -+ backgroundColor: alpha(theme.palette.primary.main, theme.palette.action.selectedOpacity), -})); + const classes = makeStyles(theme => ({ + - backgroundColor: fade(theme.palette.primary.main, theme.palette.action.selectedOpacity), + + backgroundColor: alpha(theme.palette.primary.main, theme.palette.action.selectedOpacity), + })); + ``` + + You can use the [`fade-rename-alpha` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#fade-rename-alpha) for automatic migration. + +- The `createStyles` function from `@material-ui/core/styles` was moved to the one exported from `@material-ui/styles`. It is necessary for removing the dependency to `@material-ui/styles` in the core package. + +```diff +-import { createStyles } from '@material-ui/core/styles'; ++import { createStyles } from '@material-ui/styles'; ``` ### Система -- The following system functions (and properties) were renamed, because they are considered deprecated CSS: +- The following system functions (and properties) were renamed because they are considered deprecated CSS: + + 1. `gridGap` to `gap` + 1. `gridRowGap` to `rowGap` + 1. `gridColumnGap` to `columnGap` + +- Use spacing unit in `gap`, `rowGap`, and `columnGap`. If you were using a number previously, you need to mention the px to bypass the new transformation with `theme.spacing`. + + ```diff + <Box + - gap={2} + + gap="2px" + > + ``` + +- Replace `css` prop with `sx` to avoid collision with styled-components & emotion `css` prop. + + ```diff + -<Box css={{ color: 'primary.main' }} /> + +<Box sx={{ color: 'primary.main' }} /> + ``` -1. `gridGap` to `gap` -2. `gridColumnGap` to `columnGap` -3. `gridRowGap` to `rowGap` + > Note that the system grid function wasn't documented in v4. ### Core components -As the core components use emotion as a styled engine, the props used by emotion are not intercepted. The prop `as` in the following codesnippet will not be propagated to the `SomeOtherComponent`. +As the core components use emotion as their style engine, the props used by emotion are not intercepted. The prop `as` in the following code snippet will not be propagated to `SomeOtherComponent`. -`<MuiComponent component={SomeOtherComponent} as="button" />` +```jsx +<MuiComponent component={SomeOtherComponent} as="button" /> +``` ### AppBar -- [AppBar] Remove z-index when position static and relative +- Remove z-index when position static and relative. This avoids the creation of a stacking context and rendering issues. +- The `color` prop has no longer any effect in dark mode. The app bar uses the background color required by the elevation to follow the [Material Design guidelines](https://material.io/design/color/dark-theme.html). Use `enableColorOnDark` to restore the behavior of v4. + + ```jsx + <AppBar enableColorOnDark /> + ``` ### Alert @@ -291,7 +400,7 @@ As the core components use emotion as a styled engine, the props used by emotion +import AlertTitle from '@material-ui/core/AlertTitle'; ``` - You can use the [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. +You can use the [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. ### Autocomplete (Автодополнение) @@ -304,7 +413,7 @@ As the core components use emotion as a styled engine, the props used by emotion +import useAutoComplete from '@material-ui/core/useAutocomplete'; ``` - You can use our [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. + You can use the [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. - Remove `debug` prop. There are a couple of simpler alternatives: `open={true}`, Chrome devtools ["Emulate focused"](https://twitter.com/sulco/status/1305841873945272321), or React devtools prop setter. - `renderOption` should now return the full DOM structure of the option. It makes customizations easier. You can recover from the change with: @@ -328,16 +437,39 @@ As the core components use emotion as a styled engine, the props used by emotion /> ``` -- Rename `closeIcon` prop with `clearIcon` to avoid confusion. +- Rename `closeIcon` prop to `clearIcon` to avoid confusion. ```diff -<Autocomplete closeIcon={defaultClearIcon} /> +<Autocomplete clearIcon={defaultClearIcon} /> ``` + You can use the [`autocomplete-rename-closeicon` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#autocomplete-rename-closeicon) for automatic migration. + +- The following values of the reason argument in `onChange` and `onClose` were renamed for consistency: + + 1. `create-option` to `createOption` + 2. `select-option` to `selectOption` + 3. `remove-option` to `removeOption` + +- Change the CSS rules that use `[data-focus="true"]` to use `.Mui-focused`. The `data-focus` attribute is not set on the focused option anymore, instead, global class names are used. + + ```diff + -'.MuiAutocomplete-option[data-focus="true"]': { + +'.MuiAutocomplete-option.Mui-focused': { + ``` + +- Rename `getOptionSelected` to `isOptionEqualToValue` to better describe its purpose. + + ```diff + <Autocomplete + - getOptionSelected={(option, value) => option.title === value.title} + + isOptionEqualToValue={(option, value) => option.title === value.title} + ``` + ### Avatar -- Переименовываем `circle` в `circular` для единообразия. The possible values should be adjectives, not nouns: +- Переименовываем `circle` в `circular` для единообразия: ```diff -<Avatar variant="circle"> @@ -346,6 +478,15 @@ As the core components use emotion as a styled engine, the props used by emotion +<Avatar classes={{ circular: 'className' }}> ``` + Since `circular` is the default value, the variant prop can be deleted: + + ```diff + -<Avatar variant="circle"> + +<Avatar> + ``` + + You can use the [`avatar-circle-circular` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#avatar-circle-circular) for automatic migration. + - Move the AvatarGroup from the lab to the core. ```diff @@ -353,9 +494,11 @@ As the core components use emotion as a styled engine, the props used by emotion +import AvatarGroup from '@material-ui/core/AvatarGroup'; ``` + You can use the [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. + ### Badge -- Переименовываем `circle` в `circular` и `rectangle` в `rectangular` для единообразия. The possible values should be adjectives, not nouns: +- Переименовываем `circle` в `circular` и `rectangle` в `rectangular` для единообразия. ```diff -<Badge overlap="circle"> @@ -363,23 +506,25 @@ As the core components use emotion as a styled engine, the props used by emotion +<Badge overlap="circular"> +<Badge overlap="rectangular"> <Badge classes={{ - - anchorOriginTopRightRectangle: 'className' - - anchorOriginBottomRightRectangle: 'className' - - anchorOriginTopLeftRectangle: 'className' - - anchorOriginBottomLeftRectangle: 'className' - - anchorOriginTopRightCircle: 'className' - - anchorOriginBottomRightCircle: 'className' - - anchorOriginTopLeftCircle: 'className' - + anchorOriginTopRightRectangular: 'className' - + anchorOriginBottomRightRectangular: 'className' - + anchorOriginTopLeftRectangular: 'className' - + anchorOriginBottomLeftRectangular: 'className' - + anchorOriginTopRightCircular: 'className' - + anchorOriginBottomRightCircular: 'className' - + anchorOriginTopLeftCircular: 'className' + - anchorOriginTopRightRectangle: 'className', + - anchorOriginBottomRightRectangle: 'className', + - anchorOriginTopLeftRectangle: 'className', + - anchorOriginBottomLeftRectangle: 'className', + - anchorOriginTopRightCircle: 'className', + - anchorOriginBottomRightCircle: 'className', + - anchorOriginTopLeftCircle: 'className', + + anchorOriginTopRightRectangular: 'className', + + anchorOriginBottomRightRectangular: 'className', + + anchorOriginTopLeftRectangular: 'className', + + anchorOriginBottomLeftRectangular: 'className', + + anchorOriginTopRightCircular: 'className', + + anchorOriginBottomRightCircular: 'className', + + anchorOriginTopLeftCircular: 'className', }}> ``` + You can use the [`badge-overlap-value` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#badge-overlap-value) for automatic migration. + ### BottomNavigation - TypeScript: тип параметра `event` в `onChange` теперь не `React.ChangeEvent` а `React.SyntheticEvent`. @@ -391,75 +536,134 @@ As the core components use emotion as a styled engine, the props used by emotion ### Box -- The system props have been deprecated in v5, and replaced with the `sx` prop. +- The `borderRadius` system prop value transformation has been changed. If it receives a number, it multiplies this value with the `theme.shape.borderRadius` value. Use a string to provide an explicit `px` value. + + ```diff + -<Box borderRadius="borderRadius"> + +<Box borderRadius={1}> + ``` + + ```diff + -<Box borderRadius={16}> + +<Box borderRadius="16px"> + ``` + + You can use the [`box-borderradius-values` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#box-borderradius-values) for automatic migration. + +- The Box system props have an optional alternative API in v5, using the `sx` prop. You can [read this section](/system/basics/#api-tradeoff) for the "why" behind this new API. ```diff -<Box border="1px dashed grey" p={[2, 3, 4]} m={2}> +<Box sx={{ border: "1px dashed grey", p: [2, 3, 4], m: 2 }}> ``` - [This codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#box-sx-prop) will automatically update your code to the new syntax. You can [read this section](/system/basics/#api-tradeoff) for the why behind the change of API. + If you prefer the new syntax, you can use the [`box-sx-prop` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#box-sx-prop) for automatic migration. + +- The following properties have been renamed because they are considered deprecated CSS properties by the CSS specification: -- The `borderRadius` system prop value transformation has been changed. If it receives a number, it multiplies this value with the `theme.shape.borderRadius` value. Use a string to provide an explicit value, in `px`. + 1. `gridGap` to `gap` + 2. `gridColumnGap` to `columnGap` + 3. `gridRowGap` to `rowGap` ```diff - -<Box sx={{ borderRadius: 'borderRadius' }}> - +<Box sx={{ borderRadius: 1 }}> + -<Box gridGap={1}> + -<Box gridColumnGap={2}> + -<Box gridRowGap={3}> + +<Box gap={1}> + +<Box columnGap={2}> + +<Box rowGap={3}> ``` + (Note that the system grid function wasn't documented in v4.) + + You can use the [`box-rename-gap` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#box-rename-gap) for automatic migration. + +- The `clone` prop was removed because its behavior can be obtained by applying the `sx` prop directly to the child if it is a Material-UI component. + ```diff - -<Box sx={{ borderRadius: 16 }}> - +<Box sx={{ borderRadius: '16px' }}> + -<Box sx={{ border: '1px dashed grey' }} clone> + - <Button>Save</Button> + -</Box> + +<Button sx={{ border: '1px dashed grey' }}>Save</Button> ``` -- The following properties were renamed, because they are considered deprecated CSS proeprties: +- The ability to pass a render prop was removed because its behavior can be obtained by applying the `sx` prop directly to the child if it is a Material-UI component. -1. `gridGap` to `gap` -2. `gridColumnGap` to `columnGap` -3. `gridRowGap` to `rowGap` + ```diff + -<Box sx={{ border: '1px dashed grey' }}> + - {(props) => <Button {...props}>Save</Button>} + -</Box> + +<Button sx={{ border: '1px dashed grey' }}>Save</Button> + ``` -```diff --<Box gridGap="10px"> -+<Box sx={{ gap: '10px' }}> -``` + For non-Material-UI components, use the `component` prop. -```diff --<Box gridColumnGap="10px" gridRowGap="20px"> -+<Box sx={{ columnGap: '10px', rowGap: '20px' }}> -``` + ```diff + -<Box sx={{ border: '1px dashed grey' }}> + - {(props) => <button {...props}>Save</button>} + -</Box> + +<Box component="button" sx={{ border: '1px dashed grey' }}>Save</Box> + ``` ### Button -- Свойство `color` у кнопки теперь "primary" по умолчанию, а опция "default" удалена. За счет этого кнопка становится ближе к спецификации Material Design, а API становится проще. +- Свойство `color` у кнопки теперь "primary" по умолчанию, а опция "default" удалена. This makes the button closer to the Material Design guidelines and simplifies the API. + + ```diff + -<Button color="primary"> + -<Button color="default"> + +<Button> + +<Button> + ``` + + You can use the [`button-color-prop` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#button-color-prop) for automatic migration. + +- `span` element that wraps children has been removed. `label` classKey is also removed. More details about [this change](https://github.com/mui-org/material-ui/pull/26666). ```diff - -<Button color="primary" /> - -<Button color="default" /> - +<Button /> - +<Button /> + <button class="MuiButton-root"> + - <span class="MuiButton-label"> + children + - </span> + </button> ``` ### Chip - Переименовываем вариант `default` на `filled` для единообразия. + + Since `filled` is the default value, the variant prop can be deleted: + ```diff -<Chip variant="default"> - +<Chip variant="filled"> + +<Chip> ``` -### Групповой прогресс + You can use the [`chip-variant-prop` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#chip-variant-prop) for automatic migration. + +### Checkbox -- Вариант `static` объединен с вариантом `determinate`, и последний подразумевает внешний вид первого. Удаленный вариант редко был полезен. Это было исключением из Material Design и удалено из спецификации. +- The component doesn't have `.MuiIconButton-root` and `.MuiIconButton-label` class names anymore, target `.MuiButtonBase-root` instead. ```diff - -<CircularProgress variant="determinate" /> + - <span class="MuiIconButton-root MuiButtonBase-root MuiCheckbox-root PrivateSwitchBase-root"> + - <span class="MuiIconButton-label"> + - <input class="PrivateSwitchBase-input"> + + <span class="MuiButtonBase-root MuiCheckbox-root PrivateSwitchBase-root"> + + <span class="PrivateSwitchBase-input"> ``` +### Групповой прогресс + +- The `static` variant has been renamed to `determinate`, and the previous appearance of `determinate` has been replaced by that of `static`. Это было исключением из Material Design и удалено из спецификации. + ```diff - -<CircularProgress variant="static" classes={{ static: 'className' }} /> + <CircularProgress variant="static" classes={{ static: 'className' }} /> +<CircularProgress variant="determinate" classes={{ determinate: 'className' }} /> ``` +You can use the [`circularprogress-variant` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#circularprogress-variant) for automatic migration. + > NB: If you had previously customized determinate, your customizations are probably no longer valid. Please remove them. ### Collapse @@ -478,21 +682,28 @@ As the core components use emotion as a styled engine, the props used by emotion +<Collapse classes={{ root: 'collapse' }}> ``` -###  CssBaseline +You can use the [`collapse-rename-collapsedheight` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#collapse-rename-collapsedheight) for automatic migration of both the prop and the classes key. -- The component was migrated to use the `@material-ui/styled-engine` (`emotion` or `styled-components`) instead of `jss`. You should remove the `@global` key when defining the style overrides for it. +### CssBaseline + +- The component was migrated to use the `@material-ui/styled-engine` (`emotion` or `styled-components`) instead of `jss`. You should remove the `@global` key when defining the style overrides for it. You could also start using the CSS template syntax over the JavaScript object syntax. ```diff - const theme = createMuiTheme({ + const theme = createTheme({ components: { MuiCssBaseline: { - styleOverrides: { + - styleOverrides: { - '@global': { - html: { - WebkitFontSmoothing: 'auto', - }, + - html: { + - WebkitFontSmoothing: 'auto', + - }, - }, - }, + - }, + + styleOverrides: ` + + html { + + -webkit-font-smoothing: auto; + + } + + ` }, }, }); @@ -501,7 +712,7 @@ As the core components use emotion as a styled engine, the props used by emotion - The `body` font size has changed from `theme.typography.body2` (`0.875rem`) to `theme.typography.body1` (`1rem`). To return to the previous size, you can override it in the theme: ```js - const theme = createMuiTheme({ + const theme = createTheme({ typography: { body1: { fontSize: '0.875rem', @@ -519,11 +730,11 @@ As the core components use emotion as a styled engine, the props used by emotion ```diff <Dialog - onEnter={onEnter} - - onEntered={onEntered}, - - onEntering={onEntered}, - - onExit={onEntered}, - - onExited={onEntered}, - - onExiting={onEntered} + - onEntered={onEntered} + - onEntering={onEntering} + - onExit={onExit} + - onExited={onExited} + - onExiting={onExiting} + TransitionProps={{ + onEnter, + onEntered, @@ -535,7 +746,9 @@ As the core components use emotion as a styled engine, the props used by emotion /> ``` -- Remove the `disableBackdropClick` prop because redundant. Ignore close events from `onClose` when `reason === 'backdropClick'` instead. + You can use the [`use-transitionprops` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#use-transitionprops) for automatic migration. + +- Remove the `disableBackdropClick` prop because it is redundant. Ignore close events from `onClose` when `reason === 'backdropClick'` instead. ```diff <Dialog @@ -549,7 +762,7 @@ As the core components use emotion as a styled engine, the props used by emotion /> ``` -- [withMobileDialog] Remove this higher-order component. The hook API allows a simpler and more flexible solution: +- Remove the `withMobileDialog` higher-order component. The hook API allows a simpler and more flexible solution: ```diff -import withMobileDialog from '@material-ui/core/withMobileDialog'; @@ -567,9 +780,20 @@ As the core components use emotion as a styled engine, the props used by emotion +export default ResponsiveDialog; ``` +- Flatten DialogTitle DOM structure, remove `disableTypography` prop + + ```diff + -<DialogTitle disableTypography> + - <Typography variant="h4" component="h2"> + +<DialogTitle> + + <Typography variant="h4" component="span"> + My header + </Typography> + ``` + ### Divider -- Используем рамку вместо цвета фона. Это предотвращает колебания высоты на масштабированных экранах. Для тех кто настраивает цвет контура, данное изменение требует корректировки переопределения CSS свойства: +- Используем рамку вместо цвета фона. Это предотвращает колебания высоты на масштабированных экранах. If you have customized the color of the border, you will need to update the CSS property override: ```diff .MuiDivider-root { @@ -640,27 +864,66 @@ As the core components use emotion as a styled engine, the props used by emotion ### Fab -- Переименовываем `round` в `circular` для единообразия. The possible values should be adjectives, not nouns: +- Rename `round` to `circular` for consistency: ```diff -<Fab variant="round"> +<Fab variant="circular"> ``` +### FormControl + +- Change the default variant from `standard` to `outlined`. Standard has been removed from the Material Design guidelines. + + ```diff + -<FormControl value="Standard" /> + -<FormControl value="Outlined" variant="outlined" /> + +<FormControl value="Standard" variant="standard" /> + +<FormControl value="Outlined" /> + ``` + +[This codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#variant-prop) will automatically update your code. + ### Grid -- Переименовываем свойство `justify` на `justifyContent` для согласованности с названием CSS свойства. +- Rename `justify` prop to `justifyContent` to align with the CSS property name. ```diff -<Grid justify="center"> +<Grid justifyContent="center"> ``` + You can use the [`component-rename-prop` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#component-rename-prop) for automatic migration. + +- The props: `alignItems` `alignContent` and `justifyContent` and their `classes` and style overrides keys were removed: "align-items-xs-center", "align-items-xs-flex-start", "align-items-xs-flex-end", "align-items-xs-baseline", "align-content-xs-center", "align-content-xs-flex-start", "align-content-xs-flex-end", "align-content-xs-space-between", "align-content-xs-space-around", "justify-content-xs-center", "justify-content-xs-flex-end", "justify-content-xs-space-between", "justify-content-xs-space-around" and "justify-content-xs-space-evenly". These props are now considered part of the system, not on the `Grid` component itself. If you still wish to add overrides for them, you can use the `theme.components.MuiGrid.variants` options. For example + + ```diff + const theme = createTheme({ + components: { + MuiGrid: { + - styleOverrides: { + - "align-items-xs-flex-end": { + - marginTop: '20px', + - }, + - }, + + variants: { + + props: { alignItems: "flex-end" }, + + style: { + + marginTop: '20px', + + }, + + }], + }, + }, + }); + ``` + + You can use the [`grid-justify-justifycontent` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#grid-justify-justifycontent) for automatic migration. + ### GridList - Переименовываем компоненты `GridList` на `ImageList` для согласованности с текущими наименованиями Material Design. - Переименовываем GridList свойство `spacing` на `gap` для соответствия CSS атрибуту. -- Переименовываем GridList свойство `cellHeight` в `rowHieght`. +- Rename the GridList `cellHeight` prop to `rowHeight`. - Добавляем в GridList свойство `variant`. - Переименовываем GridListItemBar свойство `actionPosition` в `position`. (Обратите внимание, что соответствующее имя класса также изменяется.) - Используем CSS object-fit. For IE11 support either use a polyfill such as https://www.npmjs.com/package/object-fit-images, or continue to use the v4 component. @@ -689,15 +952,62 @@ As the core components use emotion as a styled engine, the props used by emotion +</ImageList> ``` +### Hidden + +- This component was removed because its functionality can be created with the [`sx`](/system/basics/#the-sx-prop) prop or the [`useMediaQuery`](/components/use-media-query) hook. + + Use the `sx` prop to replace `implementation="css"`: + + ```diff + -<Hidden implementation="css" xlUp><Paper /></Hidden> + -<Hidden implementation="css" xlUp><button /></Hidden> + +<Paper sx={{ display: { xl: 'none', xs: 'block' } }} /> + +<Box component="button" sx={{ display: { xl: 'none', xs: 'block' } }} /> + ``` + + ```diff + -<Hidden implementation="css" mdDown><Paper /></Hidden> + -<Hidden implementation="css" mdDown><button /></Hidden> + +<Paper sx={{ display: { xs: 'none', md: 'block' } }} /> + +<Box component="button" sx={{ display: { xs: 'none', md: 'block' } }} /> + ``` + + Use the `useMediaQuery` hook to replace `implementation="js"`: + + ```diff + -<Hidden implementation="js" xlUp><Paper /></Hidden> + +const hidden = useMediaQuery(theme => theme.breakpoints.up('xl')); + +return hidden ? null : <Paper />; + ``` + ### Icon -- The default value of `fontSize` was changed from `default` to `medium` for consistency. In the unlikey event that you were using the value `default`, the prop can be removed: +- The default value of `fontSize` was changed from `default` to `medium` for consistency. In the unlikely event that you were using the value `default`, the prop can be removed: ```diff -<Icon fontSize="default">icon-name</Icon> +<Icon>icon-name</Icon> ``` +### IconButton + +- The default size's padding is reduced to `8px` which makes the default IconButton size of `40px`. To get the old default size (`48px`), use `size="large"`. The change was done to better match Google's products when Material Design stopped documenting the icon button pattern. + + ```diff + - <IconButton> + + <IconButton size="large"> + ``` + +- `span` element that wraps children has been removed. `label` classKey is also removed. More details about [this change](https://github.com/mui-org/material-ui/pull/26666). + + ```diff + <button class="MuiIconButton-root"> + - <span class="MuiIconButton-label"> + <svg /> + - </span> + </button> + ``` + ### Menu - Свойства onE\* transition были удалены. Используйте вместо них TransitionProps. @@ -705,11 +1015,11 @@ As the core components use emotion as a styled engine, the props used by emotion ```diff <Menu - onEnter={onEnter} - - onEntered={onEntered}, - - onEntering={onEntered}, - - onExit={onEntered}, - - onExited={onEntered}, - - onExiting={onEntered} + - onEntered={onEntered} + - onEntering={onEntering} + - onExit={onExit} + - onExited={onExited} + - onExiting={onExiting} + TransitionProps={{ + onEnter, + onEntered, @@ -721,9 +1031,41 @@ As the core components use emotion as a styled engine, the props used by emotion > ``` + > Note: The `selectedMenu` variant will no longer vertically align the selected item with the anchor. + + You can use the [`use-transitionprops` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#use-transitionprops) for automatic migration. + +- Change the default value of `anchorOrigin.vertical` to follow the Material Design guidelines. The menu now displays below the anchor instead of on top of it. Вы можете восстановить прежнее поведение с помощью: + + ```diff + <Menu + + anchorOrigin={{ + + vertical: 'top', + + horizontal: 'left', + + }} + ``` + +### MenuItem + +- The `MenuItem` component inherits the `ButtonBase` component instead of `ListItem`. The class names related to "MuiListItem-\*" are removed and theming `ListItem` is no longer affecting `MenuItem`. + + ```diff + -<li className="MuiButtonBase-root MuiMenuItem-root MuiListItem-root"> + +<li className="MuiButtonBase-root MuiMenuItem-root"> + ``` + +- prop `listItemClasses` is removed, use `classes` instead. + + ```diff + -<MenuItem listItemClasses={{...}}> + +<MenuItem classes={{...}}> + ``` + + Read more about [MenuItem CSS API](/api/menu-item/#css) + ### Modal -- Remove the `disableBackdropClick` prop because redundant. Ignore close events from `onClose` when `reason === 'backdropClick'` instead. +- Remove the `disableBackdropClick` prop because it is redundant. Use `onClose` with `reason === 'backdropClick'` instead. ```diff <Modal @@ -737,7 +1079,7 @@ As the core components use emotion as a styled engine, the props used by emotion /> ``` -- Remove the `onEscapeKeyDown` prop because redundant. Use `onClose` with `reason === "escapeKeyDown"` instead. +- Remove the `onEscapeKeyDown` prop because it is redundant. Use `onClose` with `reason === "escapeKeyDown"` instead. ```diff <Modal @@ -752,6 +1094,38 @@ As the core components use emotion as a styled engine, the props used by emotion - Удаляем свойство `onRendered`. В зависимости от варианта использования либо используйте [обратную ссылку](https://reactjs.org/docs/refs-and-the-dom.html#callback-refs) на дочерний элемент либо хук эффекта в дочернем компоненте. +### NativeSelect + +- Merge the `selectMenu` slot into `select`. Slot `selectMenu` was redundant. The `root` slot is no longer applied to the select, but to the root. + + ```diff + -<NativeSelect classes={{ root: 'class1', select: 'class2', selectMenu: 'class3' }} /> + +<NativeSelect classes={{ select: 'class1 class2 class3' }} /> + ``` + +### OutlinedInput + +- Remove the `labelWidth` prop. The `label` prop now fulfills the same purpose, using CSS layout instead of JavaScript measurement to render the gap in the outlined. + + ```diff + -<OutlinedInput labelWidth={20} /> + +<OutlinedInput label="First Name" /> + ``` + +### Paper + +- Change the background opacity based on the elevation in dark mode. This change was done to follow the Material Design guidelines. You can revert it in the theme: + + ```diff + const theme = createTheme({ + components: { + MuiPaper: { + + styleOverrides: { root: { backgroundImage: 'unset' } }, + }, + }, + }); + ``` + ### Pagination - Перемещаем компонент из lab в core. Компонент теперь стабилен. @@ -765,9 +1139,9 @@ As the core components use emotion as a styled engine, the props used by emotion +import usePagination from '@material-ui/core/usePagination'; ``` - You can use our [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. + You can use the [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. -- Переименовываем `round` в `circular` для единообразия. The possible values should be adjectives, not nouns: +- Rename `round` to `circular` for consistency: ```diff -<Pagination shape="round"> @@ -783,11 +1157,11 @@ As the core components use emotion as a styled engine, the props used by emotion ```diff <Popover - onEnter={onEnter} - - onEntered={onEntered}, - - onEntering={onEntered}, - - onExit={onEntered}, - - onExited={onEntered}, - - onExiting={onEntered} + - onEntered={onEntered} + - onEntering={onEntering} + - onExit={onExit} + - onExited={onExited} + - onExiting={onExiting} + TransitionProps={{ + onEnter, + onEntered, @@ -799,6 +1173,10 @@ As the core components use emotion as a styled engine, the props used by emotion /> ``` + You can use the [`use-transitionprops` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#use-transitionprops) for automatic migration. + +- The `getContentAnchorEl` prop was removed to simplify the positioning logic. + ### Popper - Upgrade [Popper.js](https://github.com/popperjs/popper-core) from v1 to v2. This third-party library has introduced a lot of changes.<br /> You can read [their migration guide](https://popper.js.org/docs/v2/migration-guide/) or the following summary: @@ -810,7 +1188,7 @@ As the core components use emotion as a styled engine, the props used by emotion - '&[x-placement*="bottom"] $arrow': { + '&[data-popper-placement*="bottom"] $arrow': { ``` - - Method names have changed. + - Method names have changed: ```diff -popperRef.current.scheduleUpdate() @@ -828,6 +1206,25 @@ As the core components use emotion as a styled engine, the props used by emotion - Удаляем свойство `onRendered`. В зависимости от варианта использования либо используйте [обратную ссылку](https://reactjs.org/docs/refs-and-the-dom.html#callback-refs) на дочерний элемент либо хук эффекта в дочернем компоненте. +### Радиокнопка + +- The radio color prop is now "primary" by default. To continue using the "secondary" color, you must explicitly indicate `secondary`. This brings the radio closer to the Material Design guidelines. + + ```diff + -<Radio /> + +<Radio color="secondary /> + ``` + +- The component doesn't have `.MuiIconButton-root` and `.MuiIconButton-label` class names anymore, target `.MuiButtonBase-root` instead. + + ```diff + - <span class="MuiIconButton-root MuiButtonBase-root MuiRadio-root PrivateSwitchBase-root"> + - <span class="MuiIconButton-label"> + - <input class="PrivateSwitchBase-input"> + + <span class="MuiButtonBase-root MuiRadio-root PrivateSwitchBase-root"> + + <span class="PrivateSwitchBase-input"> + ``` + ### Rating - Перемещаем компонент из lab в core. Компонент теперь стабилен. @@ -837,7 +1234,7 @@ As the core components use emotion as a styled engine, the props used by emotion +import Rating from '@material-ui/core/Rating'; ``` - You can use our [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. + You can use the [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. - Чтобы улучшить доступность изменяем используемую по умолчанию пустую иконку. Если у вас есть свой значок (`icon`), но нет пустого значка (`emptyIcon`), вы можете восстановить прежнее поведение с помощью: @@ -870,6 +1267,33 @@ As the core components use emotion as a styled engine, the props used by emotion +<Button ref={ref} /> ``` +### Select (Список) + +- Change the default variant from `standard` to `outlined`. Standard has been removed from the Material Design guidelines. If you are composing the Select with a form control component, you only need to update `FormControl`, the select inherits the variant from its context. + + ```diff + -<Select value="Standard" /> + -<Select value="Outlined" variant="outlined" /> + +<Select value="Standard" variant="standard" /> + +<Select value="Outlined" /> + ``` + +[This codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#variant-prop) will automatically update your code. + +- Remove the `labelWidth` prop. The `label` prop now fulfills the same purpose, using CSS layout instead of JavaScript measurement to render the gap in the outlined. The TextField already handles it by default. + + ```diff + -<Select variant="outlined" labelWidth={20} /> + +<Select variant="outlined" label="Gender" /> + ``` + +- Merge the `selectMenu` slot into `select`. Slot `selectMenu` was redundant. The `root` slot is no longer applied to the select, but to the root. + + ```diff + -<Select classes={{ root: 'class1', select: 'class2', selectMenu: 'class3' }} /> + +<Select classes={{ select: 'class1 class2 class3' }} /> + ``` + ### Skeleton - Перемещаем компонент из lab в core. Компонент теперь стабилен. @@ -879,9 +1303,9 @@ As the core components use emotion as a styled engine, the props used by emotion +import Skeleton from '@material-ui/core/Skeleton'; ``` - You can use our [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. + You can use the [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. -- Переименовываем `circle` в `circular` и `rect` в `rectangular` для единообразия. The possible values should be adjectives, not nouns: +- Rename `circle` to `circular` and `rect` to `rectangular` for consistency: ```diff -<Skeleton variant="circle" /> @@ -901,23 +1325,26 @@ As the core components use emotion as a styled engine, the props used by emotion +<Slider onChange={(event: React.SyntheticEvent, value: unknown) => {}} /> ``` -- The `ValueLabelComponent` prop is now part of the `components` prop. +- The `ValueLabelComponent` and `ThumbComponent` prop is now part of the `components` prop. ```diff - -<Slider ValueLabelComponent={CustomValueLabel} /> - +<Slider components={{ ValueLabel: CustomValueLabel }} /> + <Slider + - ValueLabelComponent={CustomValueLabel} + - ThumbComponent={CustomThumb} + + components={{ + + ValueLabel: CustomValueLabel, + + Thumb: CustomThumb, + + }} + /> ``` -- The `ThumbComponent` prop is not part of the `components` prop. +- Rework the CSS to match the latest [Material Design guidelines](https://material.io/components/sliders) and make custom styles more intuitive. [See documentation](/components/slider/). <a href="/components/slider/#continuous-sliders"><img width="247" alt="" src="https://user-images.githubusercontent.com/3165635/121884800-a8808600-cd13-11eb-8cdf-e25de8f1ba73.png" style="margin: auto"></a> - ```diff - -<Slider ThumbComponent={CustomThumb} /> - +<Slider components={{ Thumb: CustomThumb }} /> - ``` + You can reduce the density of the slider, closer to v4 with the [`size="small"` prop](/components/slider/#sizes). ### Snackbar -- Уведомление теперь отображается в левом нижнем углу на больших экранах. Это лучше соответствует поведению Gmail, Google Keep, material.io и т.д. Вы можете восстановить прежнее поведение с помощью: Вы можете восстановить прежнее поведение с помощью: +- Уведомление теперь отображается в левом нижнем углу на больших экранах. Это лучше соответствует поведению Gmail, Google Keep, material.io и т.д. Вы можете восстановить прежнее поведение с помощью: ```diff -<Snackbar /> @@ -929,11 +1356,11 @@ As the core components use emotion as a styled engine, the props used by emotion ```diff <Snackbar - onEnter={onEnter} - - onEntered={onEntered}, - - onEntering={onEntered}, - - onExit={onEntered}, - - onExited={onEntered}, - - onExiting={onEntered} + - onEntered={onEntered} + - onEntering={onEntering} + - onExit={onExit} + - onExited={onExited} + - onExiting={onExiting} + TransitionProps={{ + onEnter, + onEntered, @@ -945,6 +1372,8 @@ As the core components use emotion as a styled engine, the props used by emotion /> ``` + You can use the [`use-transitionprops` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#use-transitionprops) for automatic migration. + ### SpeedDial - Перемещаем компонент из lab в core. Компонент теперь стабилен. @@ -958,7 +1387,7 @@ As the core components use emotion as a styled engine, the props used by emotion +import SpeedDialIcon from '@material-ui/core/SpeedDialIcon'; ``` - You can use our [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. + You can use the [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. ### Stepper @@ -1005,14 +1434,47 @@ As the core components use emotion as a styled engine, the props used by emotion </SvgIcon> ``` +### Switch (переключатель) + +- Remove the second argument from `onChange`. You can pull out the checked state by accessing `event.target.checked`. + + ```diff + function MySwitch() { + - const handleChange = (event: React.ChangeEvent<HTMLInputElement>, checked: boolean) => { + + const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => { + + const checked = event.target.checked; + }; + + return <Switch onChange={handleChange} />; + } + ``` + +- The switch color prop is now "primary" by default. To continue using the "secondary" color, you must explicitly indicate `secondary`. This brings the switch closer to the Material Design guidelines. + + ```diff + -<Switch /> + +<Switch color="secondary" /> + ``` + +- The component doesn't have `.MuiIconButton-root` and `.MuiIconButton-label` class names anymore, target `.MuiButtonBase-root` instead. + + ```diff + <span class="MuiSwitch-root"> + - <span class="MuiIconButton-root MuiButtonBase-root MuiSwitch-switchBase PrivateSwitchBase-root"> + - <span class="MuiIconButton-label"> + - <input class="MuiSwitch-input PrivateSwitchBase-input"> + + <span class="MuiButtonBase-root MuiSwitch-switchBase PrivateSwitchBase-root"> + + <span class="MuiSwitch-input PrivateSwitchBase-input"> + ``` + ### Table (tаблица) - Настройка ярлыков кнопок постраничной разбивки должна осуществляться с помощью свойства `getItemAriaLabel`. За счет этого улучшается сопоставимость с компонентом `Pagination`. ```diff <TablePagination - - backIconButtonText="Предыдущая" - - nextIconButtonText="Следующая" + - backIconButtonText="Avant" + - nextIconButtonText="Après" + getItemAriaLabel={…} ``` @@ -1026,8 +1488,42 @@ As the core components use emotion as a styled engine, the props used by emotion + onPageChange={()=>{}} ``` +- Separate classes for different table pagination labels. This allows simpler customizations. + + ```diff + <TablePagination + - classes={{ caption: 'foo' }} + + classes={{ selectLabel: 'foo', displayedRows: 'foo' }} + /> + ``` + +- Move the custom class on `input` to `select`. The `input` key is being applied on another element. + + ```diff + <TablePagination + - classes={{ input: 'foo' }} + + classes={{ select: 'foo' }} + /> + ``` + +- Rename the `default` value of the `padding` prop to `normal`. + + ```diff + -<Table padding="default" /> + -<TableCell padding="default" /> + +<Table padding="normal" /> + +<TableCell padding="normal" /> + ``` + ### Вкладки +- Change the default `indicatorColor` and `textColor` prop values to "primary". This is done to match the most common use cases with Material Design. + + ```diff + -<Tabs /> + +<Tabs indicatorColor="primary" textColor="inherit" /> + ``` + - TypeScript: тип параметра `event` в `onChange` теперь не `React.ChangeEvent` а `React.SyntheticEvent`. ```diff @@ -1049,9 +1545,12 @@ As the core components use emotion as a styled engine, the props used by emotion +<Tabs scrollButtons={false} /> ``` +- Tab `minWidth` changed from `72px` => `90px` (without media-query) according to [material-design spec](https://material.io/components/tabs#specs) +- Tab `maxWidth` changed from `264px` => `360px` according to [material-design spec](https://material.io/components/tabs#specs) + ### TextField -- Change the default variant from `standard` to `outlined`. Standard has been removed from the Material Design Guidelines. +- Change the default variant from `standard` to `outlined`. Standard has been removed from the Material Design guidelines. ```diff -<TextField value="Standard" /> @@ -1060,7 +1559,7 @@ As the core components use emotion as a styled engine, the props used by emotion +<TextField value="Outlined" /> ``` -[This codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#textfield-variant-prop) will automatically update your code. + You can use the [`variant-prop` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#variant-prop) for automatic migration. - Rename `rowsMax` prop with `maxRows` for consistency with HTML attributes. @@ -1101,6 +1600,15 @@ As the core components use emotion as a styled engine, the props used by emotion +<Input size="small" /> ``` +- Set the InputAdornment `position` prop to `start` or `end`. Use `start` if used as the value of the `startAdornment` prop. Use `end` if used as the value of the `endAdornment` prop. + + ```diff + -<TextField startAdornment={<InputAdornment>Kg</InputAdornment>} /> + -<TextField endAdornment={<InputAdornment>Kg</InputAdornment>} /> + +<TextField startAdornment={<InputAdornment position="start">Kg</InputAdornment>} /> + +<TextField endAdornment={<InputAdornment position="end">Kg</InputAdornment>} /> + ``` + ### TextareaAutosize - Удаляем свойство `rows` и используем вместо него `minRows`. Цель этого изменения - сделать поведение свойства более понятным. @@ -1135,7 +1643,7 @@ As the core components use emotion as a styled engine, the props used by emotion +import ToggleButtonGroup from '@material-ui/core/ToggleButtonGroup'; ``` - You can use our [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. + You can use the [`moved-lab-modules` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules) for automatic migration. ### Tooltip @@ -1154,24 +1662,241 @@ As the core components use emotion as a styled engine, the props used by emotion ### Typography -- Заменяем свойство `srOnly`, чтобы не дублировать возможности [System](https://material-ui.com/system/basics/): +- Remove the `srOnly` variant. You can use the `visuallyHidden` utility in conjunction with the `sx` prop instead. ```diff - -import Typography from '@material-ui/core/Typography'; - +import { visuallyHidden } from '@material-ui/system'; - +import styled from 'styled-component'; - - +const Span = styled('span')(visuallyHidden); + +import { visuallyHidden } from '@material-ui/utils'; -<Typography variant="srOnly">Create a user</Typography> - +<Span>Create a user</Span> + +<span style={visuallyHidden}>Create a user</span> ``` -### Система +- The following `classes` and style overrides keys were removed: "colorInherit", "colorPrimary", "colorSecondary", "colorTextPrimary", "colorTextSecondary", "colorError", "displayInline" and "displayBlock". These props are now considered part of the system, not on the `Typography` component itself. If you still wish to add overrides for them, you can use the `theme.components.MuiTypography.variants` options. For example -- Replace `css` prop with `sx` to avoid collision with styled-components & emotion CSS props. + ```diff + const theme = createTheme({ + components: { + MuiTypography: { + - styleOverrides: { + - colorSecondary: { + - marginTop: '20px', + - }, + - }, + + variants: { + + props: { color: "secondary" }, + + style: { + + marginTop: '20px', + + }, + + }], + }, + }, + }); + ``` + +### `@material-ui/core/styles` + +#### createGenerateClassName + +- The `createGenerateClassName` function is no longer exported from `@material-ui/core/styles`. You should import it directly from `@material-ui/styles`. + + ```diff + -import { createGenerateClassName } from '@material-ui/core/styles'; + +import { createGenerateClassName } from '@material-ui/styles'; + ``` + +#### jssPreset + +- The `jssPreset` object is no longer exported from `@material-ui/core/styles`. You should import it directly from `@material-ui/styles`. + + ```diff + -import { jssPreset } from '@material-ui/core/styles'; + +import { jssPreset } from '@material-ui/styles'; + ``` + +#### makeStyles + +- The `makeStyles` JSS utility is no longer exported from `@material-ui/core/styles`. You can use `@material-ui/styles/makeStyles` instead. Make sure to add a `ThemeProvider` at the root of your application, as the `defaultTheme` is no longer available. If you are using this utility together with `@material-ui/core`, it's recommended you use the `ThemeProvider` component from `@material-ui/core/styles` instead. + + ```diff + -import { makeStyles } from '@material-ui/core/styles'; + +import { makeStyles } from '@material-ui/styles'; + +import { createTheme, ThemeProvider } from '@material-ui/core/styles'; + + +const theme = createTheme(); + const useStyles = makeStyles((theme) => ({ + background: theme.palette.primary.main, + })); + function Component() { + const classes = useStyles(); + return <div className={classes.root} /> + } + + // In the root of your app + function App(props) { + - return <Component />; + + return <ThemeProvider theme={theme}><Component {...props} /></ThemeProvider>; + } + ``` + +#### MuiThemeProvider + +- The `MuiThemeProvider` component is no longer exported from `@material-ui/core/styles`. Use `ThemeProvider` instead. + + ```diff + -import { MuiThemeProvider } from '@material-ui/core/styles'; + +import { ThemeProvider } from '@material-ui/core/styles'; + ``` + +#### ServerStyleSheets + +- The `ServerStyleSheets` component is no longer exported from `@material-ui/core/styles`. You should import it directly from `@material-ui/styles`. + + ```diff + -import { ServerStyleSheets } from '@material-ui/core/styles'; + +import { ServerStyleSheets } from '@material-ui/styles'; + ``` + +#### styled + +- The `styled` JSS utility is no longer exported from `@material-ui/core/styles`. You can use `@material-ui/styles/styled` instead. Make sure to add a `ThemeProvider` at the root of your application, as the `defaultTheme` is no longer available. If you are using this utility together with `@material-ui/core`, it's recommended you use the `ThemeProvider` component from `@material-ui/core/styles` instead. + + ```diff + -import { styled } from '@material-ui/core/styles'; + +import { styled } from '@material-ui/styles'; + +import { createTheme, ThemeProvider } from '@material-ui/core/styles'; + + +const theme = createTheme(); + const MyComponent = styled('div')(({ theme }) => ({ background: theme.palette.primary.main })); + + function App(props) { + - return <MyComponent />; + + return <ThemeProvider theme={theme}><MyComponent {...props} /></ThemeProvider>; + } + ``` + +#### StylesProvider + +- The `StylesProvider` component is no longer exported from `@material-ui/core/styles`. You should import it directly from `@material-ui/styles`. + + ```diff + -import { StylesProvider } from '@material-ui/core/styles'; + +import { StylesProvider } from '@material-ui/styles'; + ``` + +#### useThemeVariants + +- The `useThemeVariants` hook is no longer exported from `@material-ui/core/styles`. You should import it directly from `@material-ui/styles`. + + ```diff + -import { useThemeVariants } from '@material-ui/core/styles'; + +import { useThemeVariants } from '@material-ui/styles'; + ``` + +#### withStyles + +- Replace the `innerRef` prop with the `ref` prop. Refs are now automatically forwarded to the inner component. + + ```diff + import * as React from 'react'; + import { withStyles } from '@material-ui/styles'; + + const MyComponent = withStyles({ + root: { + backgroundColor: 'red', + }, + })(({ classes }) => <div className={classes.root} />); + + function MyOtherComponent(props) { + const ref = React.useRef(); + - return <MyComponent innerRef={ref} />; + + return <MyComponent ref={ref} />; + } + ``` + +- The `withStyles` JSS utility is no longer exported from `@material-ui/core/styles`. You can use `@material-ui/styles/withStyles` instead. Make sure to add a `ThemeProvider` at the root of your application, as the `defaultTheme` is no longer available. If you are using this utility together with `@material-ui/core`, you should use the `ThemeProvider` component from `@material-ui/core/styles` instead. + + ```diff + -import { withStyles } from '@material-ui/core/styles'; + +import { withStyles } from '@material-ui/styles'; + +import { createTheme, ThemeProvider } from '@material-ui/core/styles'; + + +const defaultTheme = createTheme(); + const MyComponent = withStyles((props) => { + const { classes, className, ...other } = props; + return <div className={clsx(className, classes.root)} {...other} /> + })(({ theme }) => ({ root: { background: theme.palette.primary.main }})); + + function App() { + - return <MyComponent />; + + return <ThemeProvider theme={defaultTheme}><MyComponent /></ThemeProvider>; + } + ``` + +#### withTheme + +- The `withTheme` HOC utility has been removed from the `@material-ui/core/styles` package. You can use `@material-ui/styles/withTheme` instead. Make sure to add a `ThemeProvider` at the root of your application, as the `defaultTheme` is no longer available. If you are using this utility together with `@material-ui/core`, it's recommended you use the `ThemeProvider` component from `@material-ui/core/styles` instead. + + ```diff + -import { withTheme } from '@material-ui/core/styles'; + +import { withTheme } from '@material-ui/styles'; + +import { createTheme, ThemeProvider } from '@material-ui/core/styles'; + + +const theme = createTheme(); + const MyComponent = withTheme(({ theme }) => <div>{props.theme.direction}</div>); + + function App(props) { + - return <MyComponent />; + + return <ThemeProvider theme={theme}><MyComponent {...props} /></ThemeProvider>; + } + ``` + +- Replace the `innerRef` prop with the `ref` prop. Refs are now automatically forwarded to the inner component. + + ```diff + import * as React from 'react'; + import { withTheme } from '@material-ui/core/styles'; + + const MyComponent = withTheme(({ theme }) => <div>{props.theme.direction}</div>); + + function MyOtherComponent(props) { + const ref = React.useRef(); + - return <MyComponent innerRef={ref} />; + + return <MyComponent ref={ref} />; + } + ``` + +#### withWidth + +- This HOC was removed. There's an alternative using the `useMediaQuery` hook on [this page](/components/use-media-query/#migrating-from-withwidth). + +### `@material-ui/types` + +- Rename the exported `Omit` type in `@material-ui/types`. The module is now called `DistributiveOmit`. The change removes the confusion with the built-in `Omit` helper introduced in TypeScript v3.5. The built-in `Omit`, while similar, is non-distributive. This leads to differences when applied to union types. [See this StackOverflow answer for further details](https://stackoverflow.com/a/57103940/1009797). + + ```diff + -import { Omit } from '@material-ui/types'; + +import { DistributiveOmit } from '@material-ui/types'; + ``` + +### `@material-ui/styles` + +#### ThemeProvider + +If you are using the utilities from `@material-ui/styles` together with the `@material-ui/core`, you should replace the use of `ThemeProvider` from `@material-ui/styles` with the one exported from `@material-ui/core/styles`. This way, the `theme` provided in the context will be available in both the styling utilities exported from `@material-ui/styles`, like `makeStyles`, `withStyles` etc. and the Material-UI components. ```diff --<Box css={{ color: 'primary.main' }} /> -+<Box sx={{ color: 'primary.main' }} /> +-import { ThemeProvider } from '@material-ui/styles'; ++import { ThemeProvider } from '@material-ui/core/styles'; +``` + +#### Default theme (TypeScript) + +The `@material-ui/styles` package is no longer part of `@material-ui/core/styles`. If you are using `@material-ui/styles` together with `@material-ui/core` you need to add a module augmentation for the `DefaultTheme`. + +```ts +import { Theme } from '@material-ui/core/styles'; + +declare module '@material-ui/styles' { + interface DefaultTheme extends Theme {} +} ``` diff --git a/docs/src/pages/guides/migration-v4/migration-v4-zh.md b/docs/src/pages/guides/migration-v4/migration-v4-zh.md index 7da5e45ce7c2f8..fe22c05c7d4731 100644 --- a/docs/src/pages/guides/migration-v4/migration-v4-zh.md +++ b/docs/src/pages/guides/migration-v4/migration-v4-zh.md @@ -2,13 +2,13 @@ <p class="description">是的,我们已经发布了 v5 版本!</p> -你在找 v4 版本的文档吗? [您可以在这里找到它们](https://material-ui.com/versions/) 。 +If you're looking for the v4 docs, you can [find them here](https://material-ui.com/versions/). -> 此文档尚未完成。 您是否已经升级了站点并且遇到了一些并没有在此涉及的问题? [请在 GitHub 添加您的更改](https://github.com/mui-org/material-ui/blob/HEAD/docs/src/pages/guides/migration-v4/migration-v4.md)。 +> 此文档尚未完成。 If you have upgraded your site and run into something that's not covered here, please [add your changes on GitHub](https://github.com/mui-org/material-ui/blob/HEAD/docs/src/pages/guides/migration-v4/migration-v4.md). ## 简介 -当你将站点从 Material-UI 的 v4 版本升级到 v5 版本时,这篇文章会为你提供一些参考。 您可能不会将这里所有涵盖的内容运用到你的站点上。 您可能不会将这里所有涵盖的内容运用到你的站点上。 我们会尽我们最大的努力让文档简单易懂,并尽可能有序地介绍,这样你可以迅速对 v5 版本游刃有余。 +当你将站点从 Material-UI 的 v4 版本升级到 v5 版本时,这篇文章会为你提供一些参考。 您可能不会将这里所有涵盖的内容运用到你的站点上。 While there's a lot covered here, you probably won't need to do everything. We'll do our best to keep things easy to follow, and as sequential as possible, so you can quickly get rocking on v5! ## 为什么您需要迁移呢 @@ -46,11 +46,11 @@ yarn add @material-ui/core@next @emotion/react @emotion/styled 默认捆绑包的目标已更改。 实际支持的版本将在发布时从浏览器列表中查询 `"> 0.5%, last 2 versions, Firefox ESR, not dead, not IE 11, maintained node versions"`。 -当前默认的捆绑包支持以下版本: +The default bundle supports the following minimum versions: <!-- #stable-snapshot --> -- Node 10(最低兼容到 8) +- Node 12(最低兼容到 8) - Chrome 84(最低兼容到 49) - Edge 85(最低兼容到 14) - Firefox 78(最低兼容到 52) @@ -63,24 +63,32 @@ yarn add @material-ui/core@next @emotion/react @emotion/styled 对 `component` 属性中的非转发(non-ref-forwarding)类组件或作为直接 `子类(children)` 的支持已被放弃。 如果你使用了 `unstable_createStrictModeTheme` 或者在 `React.StrictMode` 中没有看到任何与 `findDOMNode` 相关的任何警告,那么你不需要做任何事情。 否则请查看我们指南中的 [“注意事项与参考文献”部分](/guides/composition/#caveat-with-refs) 来了解如何迁移。 这个变化几乎影响了所有使用 `component` 属性的组件或者将 `children` 传递给要求 `children` 作为元素的组件(例如 `<MenuList><CustomMenuItem /></MenuList>`) -### Styled engine +### Supported React version -The styled engine used in v5 by default is [`emotion`](https://github.com/emotion-js/emotion). While migration from JSS to emotion, if you are using JSS style overrides for your components (for example overrides created by `makeStyles`), you need to take care of the CSS injection order. In order to do this, you need to have on the top of your application the `StylesProvider` with the `injectFirst` option. Here is an example of it: While migration from JSS to emotion, if you are using JSS style overrides for your components (for example overrides created by `makeStyles`), you need to take care of the CSS injection order. In order to do this, you need to have on the top of your application the `StylesProvider` with the `injectFirst` option. Here is an example of it: +The minimum supported version of React was increased from v16.8.0 to v17.0.0. + +### Supported TypeScript version + +The minimum supported version of TypeScript was increased from v3.2 to v3.5. We try to align with types released from [DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped) (i.e. packages published on npm under the `@types` namespace). We will not change the minimum supported version in a major version of Material-UI. However, we generally recommend to not use a TypeScript version older than the [lowest supported version of DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped#older-versions-of-typescript-33-and-earlier) + +### Style library + +The style library used by default in v5 is [`emotion`](https://github.com/emotion-js/emotion). While migrating from JSS to emotion, and if you are using JSS style overrides for your components (for example overrides created by `makeStyles`), you will need to take care of the CSS injection order. To do so, you need to have the `StyledEngineProvider` with the `injectFirst` option at the top of your component tree. 下面是一个示例: ```jsx import * as React from 'react'; -import { StylesProvider } from '@material-ui/core'; +import { StyledEngineProvider } from '@material-ui/core/styles'; export default function GlobalCssPriority() { return ( - <StylesProvider injectFirst> + <StyledEngineProvider injectFirst> {/* Your component tree. 现在你可以覆盖 Material-UI 的样式。 */} - </StylesProvider> + </StyledEngineProvider> ); } ``` -**Note:** If you are using emotion and have a custom cache in your app, that one will override the one coming from Material-UI. In order for the injection order to still be correct, you need to add the prepend option. 下面是一个示例: In order for the injection order to still be correct, you need to add the prepend option. 下面是一个示例: +> **Note:** If you are using emotion to style your app, and have a custom cache, it will override the one provided by Material-UI. In order for the injection order to still be correct, you need to add the `prepend` option to `createCache`. 下面是一个示例: ```jsx import * as React from 'react'; @@ -95,17 +103,30 @@ const cache = createCache({ export default function PlainCssPriority() { return ( <CacheProvider value={cache}> - {/* Your component tree. 现在你可以覆盖 Material-UI 的样式。 */} + {这里编写你的组件树。 现在你可以覆盖 Material-UI 的样式。 */} </CacheProvider> ); } ``` -**Note:** If you are using styled-components and have `StyleSheetManager` with a custom `target`, make sure that the target is the first element in the HTML `<head>`. If you are curious to see how it can be done, you can take a look on the `StylesProvider` implementation in the `@material-ui/styled-engine-sc` package. If you are curious to see how it can be done, you can take a look on the `StylesProvider` implementation in the `@material-ui/styled-engine-sc` package. +> **Note:** If you are using styled-components and have `StyleSheetManager` with a custom `target`, make sure that the target is the first element in the HTML `<head>`. To see how it can be done, take a look at the [`StyledEngineProvider` implementation](https://github.com/mui-org/material-ui/blob/next/packages/material-ui-styled-engine-sc/src/StyledEngineProvider/StyledEngineProvider.js) in the `@material-ui/styled-engine-sc` package. ### 主题 -- 断点现在被当作值而不是范围来处理。 `down(key)` 的行为已更改为定义的媒体查询小于使用相应断点定义的值(不包含当前值)。 `between(start, end)` 也已更新,定义了媒体查询 start(包含)和 end(不包含)实际值之间的数值。 当使用 `down()`断点工具集时,你需要向上一步更新断点键。 当使用 `between(start, end)` 时,结束断点也应向上一步更新。 使用 `Hidden` 组件时也应该这样做。 下面列出了变动影响的例子: +- The function `createMuiTheme` was renamed to `createTheme` to make more intuitive to use with `ThemeProvider`. + + ```diff + -import { createMuiTheme } from '@material-ui/core/styles'; + +import { createTheme } from '@material-ui/core/styles'; + + -const theme = createMuiTheme({ + +const theme = createTheme({ + ``` + +- The default background color is now `#fff` in light mode and `#121212` in dark mode. This matches the Material Design guidelines. +- Breakpoints are now treated as values instead of [ranges](https://v4.material-ui.com/customization/breakpoints/#default-breakpoints). The behavior of `down(key)` was changed to define a media query below the value defined by the corresponding breakpoint (exclusive), rather than the breakpoint above. `between(start, end)` was also updated to define a media query for the values between the actual values of start (inclusive) and end (exclusive). 当使用 `down()`断点工具集时,你需要向上一步更新断点键。 当使用 `between(start, end)` 时,结束断点也应向上一步更新。 + + Here are some examples of the changes required: ```diff -theme.breakpoints.down('sm') // '@media (max-width:959.95px)' - [0, sm + 1) => [0, md) @@ -122,11 +143,22 @@ export default function PlainCssPriority() { +theme.breakpoints.up('sm') // '@media (min-width:600px)' ``` + You can use the [`theme-breakpoints` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#theme-breakpoints) for automatic migration of `theme.breakpoints`. + + The same should be done when using the `Hidden` component: + ```diff -<Hidden smDown>{...}</Hidden> // '@media (min-width:600px)' +<Hidden mdDown>{...}</Hidden> // '@media (min-width:600px)' ``` +- The `theme.breakpoints.width` utility was removed because it's redundant. Use `theme.breakpoints.values` to get the same values. + + ```diff + -theme.breakpoints.width('md') + +theme.breakpoints.values.md + ``` + - `theme.palette.augmentColor` 助手的签名已经改变: ```diff @@ -134,24 +166,65 @@ export default function PlainCssPriority() { +theme.palette.augmentColor({ color: red, name: 'brand' }); ``` +- The `theme.typography.round` helper was removed because it was no longer used. If you need it, use the function below: + + ```js + function round(value) { + return Math.round(value * 1e5) / 1e5; + } + ``` + +- The default breakpoints were changed to better match the common use cases. They also better match the Material Design guidelines. [Read more about the change](https://github.com/mui-org/material-ui/issues/21902) + + ```diff + { + xs: 0, + sm: 600, + - md: 960, + + md: 900, + - lg: 1280, + + lg: 1200, + - xl: 1920, + + xl: 1536, + } + ``` + + If you prefer the old breakpoint values, use the snippet below. + + ```js + import { createTheme } from '@material-ui/core/styles'; + + const theme = createTheme({ + breakpoints: { + values: { + xs: 0, + sm: 600, + md: 960, + lg: 1280, + xl: 1920, + }, + }, + }); + ``` + #### 变更 为了能实现更平滑的过渡,`adaptV4Theme` 助手允许你迭代升级到新的主题结构。 ```diff -import { createMuiTheme } from '@material-ui/core/styles'; -+import { createMuiTheme, adaptV4Theme } from '@material-ui/core/styles'; ++import { createTheme, adaptV4Theme } from '@material-ui/core/styles'; -const theme = createMuiTheme({ -+const theme = createMuiTheme(adaptV4Theme({ ++const theme = createTheme(adaptV4Theme({ // v4 theme -}); +})); ``` -适配助手支持以下更改。 +##### Supported changes -#### 修改前: +The following changes are supported by the adapter: - 事实证明,“水槽(gutters)”这个抽象的概念还没有被频繁使用,所以是没有价值的。 @@ -179,33 +252,35 @@ export default function PlainCssPriority() { theme.spacing(2) => '16px' ``` -- 为了更好地遵循通常用于描述该功能的“黑暗模式”术语,我们将 `theme.palette.type` 重命名为 `theme.palette.mode`。 + You can use the [`theme-spacing` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#theme-spacing) to remove any 'px' suffix from `theme.spacing` calls in a template string. + +- The `theme.palette.type` key was renamed to `theme.palette.mode`, to better follow the "dark mode" term that is usually used for describing this feature. ```diff - import { createMuiTheme } from '@material-ui/core/styles'; - -const theme = createMuiTheme({palette: { type: 'dark' }}), - +const theme = createMuiTheme({palette: { mode: 'dark' }}), + import { createTheme } from '@material-ui/core/styles'; + -const theme = createTheme({palette: { type: 'dark' }}), + +const theme = createTheme({palette: { mode: 'dark' }}), ``` - `theme.palette.text.hint` 键在 Material-UI 组件中未使用,现已被删除。 如果你的项目之前依赖它,那么也可以通过下面方法将它添加回来: ```diff - import { createMuiTheme } from '@material-ui/core/styles'; + import { createTheme } from '@material-ui/core/styles'; - -const theme = createMuiTheme(), - +const theme = createMuiTheme({ + -const theme = createTheme(), + +const theme = createTheme({ + palette: { text: { hint: 'rgba(0, 0, 0, 0.38)' } }, +}); ``` -- 主题内的组件定义在 `components` 键下进行了重构,以便人们更容易地发现一个组件的定义。 +- The components' definitions in the theme were restructure under the `components` key, to allow for easier discoverability of the definitions related to any one component. 1. `属性` ```diff -import { createMuiTheme } from '@material-ui/core/styles'; +import { createTheme } from '@material-ui/core/styles'; -const theme = createMuiTheme({ +const theme = createTheme({ - props: { - MuiButton: { - disableRipple: true, @@ -224,9 +299,9 @@ const theme = createMuiTheme({ 2. `覆盖` ```diff -import { createMuiTheme } from '@material-ui/core/styles'; +import { createTheme } from '@material-ui/core/styles'; -const theme = createMuiTheme({ +const theme = createTheme({ - overrides: { - MuiButton: { - root: { padding: 0 }, @@ -246,33 +321,67 @@ const theme = createMuiTheme({ - 为更好地描述功能,我们将 `fade` 重命名为 `alpha`。 当输入颜色已经有一个 alpha 值时,以前的名称会导致混乱。 **overrides** 助手覆盖了颜色的 alpha 值。 -```diff -- import { fade } from '@material-ui/core/styles'; -+ import { alpha } from '@material-ui/core/styles'; + ```diff + - import { fade } from '@material-ui/core/styles'; + + import { alpha } from '@material-ui/core/styles'; + + const classes = makeStyles(theme => ({ + - backgroundColor: fade(theme.palette.primary.main, theme.palette.action.selectedOpacity), + + backgroundColor: alpha(theme.palette.primary.main, theme.palette.action.selectedOpacity), + })); + ``` + + You can use the [`fade-rename-alpha` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#fade-rename-alpha) for automatic migration. + +- The `createStyles` function from `@material-ui/core/styles` was moved to the one exported from `@material-ui/styles`. It is necessary for removing the dependency to `@material-ui/styles` in the core package. -const classes = makeStyles(theme => ({ -- backgroundColor: fade(theme.palette.primary.main, theme.palette.action.selectedOpacity), -+ backgroundColor: alpha(theme.palette.primary.main, theme.palette.action.selectedOpacity), -})); +```diff +-import { createStyles } from '@material-ui/core/styles'; ++import { createStyles } from '@material-ui/styles'; ``` ### System 系统 -- The following system functions (and properties) were renamed, because they are considered deprecated CSS: +- The following system functions (and properties) were renamed because they are considered deprecated CSS: + + 1. `gridGap` to `gap` + 1. `gridRowGap` to `rowGap` + 1. `gridColumnGap` to `columnGap` + +- Use spacing unit in `gap`, `rowGap`, and `columnGap`. If you were using a number previously, you need to mention the px to bypass the new transformation with `theme.spacing`. + + ```diff + <Box + - gap={2} + + gap="2px" + > + ``` + +- Replace `css` prop with `sx` to avoid collision with styled-components & emotion `css` prop. + + ```diff + -<Box css={{ color: 'primary.main' }} /> + +<Box sx={{ color: 'primary.main' }} /> + ``` -1. `gridGap` to `gap` -2. `gridColumnGap` to `columnGap` -3. `gridRowGap` to `rowGap` + > Note that the system grid function wasn't documented in v4. -### 1. 核心组件 +### 1. 1. 核心组件 -As the core components use emotion as a styled engine, the props used by emotion are not intercepted. The prop `as` in the following codesnippet will not be propagated to the `SomeOtherComponent`. The prop `as` in the following codesnippet will not be propagated to the `SomeOtherComponent`. +As the core components use emotion as their style engine, the props used by emotion are not intercepted. The prop `as` in the following code snippet will not be propagated to `SomeOtherComponent`. -`<MuiComponent component={SomeOtherComponent} as="button" />` +```jsx +<MuiComponent component={SomeOtherComponent} as="button" /> +``` ### 一个突出的应用栏。 -- [AppBar] 当 position 为 static 和 relative 时,z-index 将会被移除。 +- Remove z-index when position static and relative. This avoids the creation of a stacking context and rendering issues. +- The `color` prop has no longer any effect in dark mode. The app bar uses the background color required by the elevation to follow the [Material Design guidelines](https://material.io/design/color/dark-theme.html). Use `enableColorOnDark` to restore the behavior of v4. + + ```jsx + <AppBar enableColorOnDark /> + ``` ### Alert 警告提示 @@ -285,7 +394,7 @@ As the core components use emotion as a styled engine, the props used by emotion +import AlertTitle from '@material-ui/core/AlertTitle'; ``` - 你可以使用 [`moved-lab-modules` 编码器(codemod)](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules)来进行自动迁移。 +你可以使用 [`moved-lab-modules` 编码器(codemod)](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules)来进行自动迁移。 ### Autocomplete 自动补全组件 @@ -298,7 +407,7 @@ As the core components use emotion as a styled engine, the props used by emotion +import useAutoComplete from '@material-ui/core/useAutocomplete'; ``` - 你可以使用我们的 [`moved-lab-modules` 编码器(codemod)](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules)来进行自动迁移。 + 你可以使用 [`moved-lab-modules` 编码器(codemod)](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules)来进行自动迁移。 - 移除 `debug` 属性。 有几个更简单的方式来使用它:`open={true}`,Chrome 开发者调试工具 [“Emulate focused”](https://twitter.com/sulco/status/1305841873945272321),或者使用 React devtools prop setter。 - `renderOption` 现在应该返回选项的完整 DOM 结构。 这样做可以让定制组件变得更加容易。 你可以通过下面方法进行回滚: @@ -322,16 +431,39 @@ As the core components use emotion as a styled engine, the props used by emotion /> ``` -- 为了避免混淆,我们将 `closeIcon` 属性更名为 `clearIcon`。 +- Rename `closeIcon` prop to `clearIcon` to avoid confusion. ```diff -<Autocomplete closeIcon={defaultClearIcon} /> +<Autocomplete clearIcon={defaultClearIcon} /> ``` + You can use the [`autocomplete-rename-closeicon` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#autocomplete-rename-closeicon) for automatic migration. + +- The following values of the reason argument in `onChange` and `onClose` were renamed for consistency: + + 1. `create-option` to `createOption` + 2. `select-option` to `selectOption` + 3. `remove-option` to `removeOption` + +- Change the CSS rules that use `[data-focus="true"]` to use `.Mui-focused`. The `data-focus` attribute is not set on the focused option anymore, instead, global class names are used. + + ```diff + -'.MuiAutocomplete-option[data-focus="true"]': { + +'.MuiAutocomplete-option.Mui-focused': { + ``` + +- Rename `getOptionSelected` to `isOptionEqualToValue` to better describe its purpose. + + ```diff + <Autocomplete + - getOptionSelected={(option, value) => option.title === value.title} + + isOptionEqualToValue={(option, value) => option.title === value.title} + ``` + ### Avatar 头像组件 -- 为保持一致性,我们将 `circle` 重命名为 `circular`。 可能的值应该是形容词,而不是名词。 +- Rename `circle` to `circular` for consistency: ```diff -<Avatar variant="circle"> @@ -340,6 +472,15 @@ As the core components use emotion as a styled engine, the props used by emotion +<Avatar classes={{ circular: 'className' }}> ``` + Since `circular` is the default value, the variant prop can be deleted: + + ```diff + -<Avatar variant="circle"> + +<Avatar> + ``` + + You can use the [`avatar-circle-circular` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#avatar-circle-circular) for automatic migration. + - AvatarGroup 已从实验室包移动到核心包。 ```diff @@ -347,9 +488,11 @@ As the core components use emotion as a styled engine, the props used by emotion +import AvatarGroup from '@material-ui/core/AvatarGroup'; ``` + 你可以使用 [`moved-lab-modules` 编码器(codemod)](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules)来进行自动迁移。 + ### Badge -- 为保持一致性,我们将 `circle` 重命名为 `circular`,`rectangle` 重命名为 `rectangular`。 可能的值应该是形容词,而不是名词。 +- 为保持一致性,我们将 `circle` 重命名为 `circular`,`rectangle` 重命名为 `rectangular`。 ```diff -<Badge overlap="circle"> @@ -357,23 +500,25 @@ As the core components use emotion as a styled engine, the props used by emotion +<Badge overlap="circular"> +<Badge overlap="rectangular"> <Badge classes={{ - - anchorOriginTopRightRectangle: 'className' - - anchorOriginBottomRightRectangle: 'className' - - anchorOriginTopLeftRectangle: 'className' - - anchorOriginBottomLeftRectangle: 'className' - - anchorOriginTopRightCircle: 'className' - - anchorOriginBottomRightCircle: 'className' - - anchorOriginTopLeftCircle: 'className' - + anchorOriginTopRightRectangular: 'className' - + anchorOriginBottomRightRectangular: 'className' - + anchorOriginTopLeftRectangular: 'className' - + anchorOriginBottomLeftRectangular: 'className' - + anchorOriginTopRightCircular: 'className' - + anchorOriginBottomRightCircular: 'className' - + anchorOriginTopLeftCircular: 'className' + - anchorOriginTopRightRectangle: 'className', + - anchorOriginBottomRightRectangle: 'className', + - anchorOriginTopLeftRectangle: 'className', + - anchorOriginBottomLeftRectangle: 'className', + - anchorOriginTopRightCircle: 'className', + - anchorOriginBottomRightCircle: 'className', + - anchorOriginTopLeftCircle: 'className', + + anchorOriginTopRightRectangular: 'className', + + anchorOriginBottomRightRectangular: 'className', + + anchorOriginTopLeftRectangular: 'className', + + anchorOriginBottomLeftRectangular: 'className', + + anchorOriginTopRightCircular: 'className', + + anchorOriginBottomRightCircular: 'className', + + anchorOriginTopLeftCircular: 'className', }}> ``` + You can use the [`badge-overlap-value` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#badge-overlap-value) for automatic migration. + ### BottomNavigation(底部导航) - TypeScript:`onChange` 中的 `event` 的类型不再是 `React.ChangeEvent`,而是`React.SyntheticEvent`。 @@ -385,75 +530,134 @@ As the core components use emotion as a styled engine, the props used by emotion ### Box 分组 -- system 属性在 v5 中已废弃且被 `sx` 属性取代。 +- `borderRadius` 系统属性值转换已被更改。 如果它收到一个数字,它就会将这个值与 `theme.shape.borderRadius` 的值相乘。 Use a string to provide an explicit `px` value. + + ```diff + -<Box borderRadius="borderRadius"> + +<Box borderRadius={1}> + ``` + + ```diff + -<Box borderRadius={16}> + +<Box borderRadius="16px"> + ``` + + You can use the [`box-borderradius-values` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#box-borderradius-values) for automatic migration. + +- The Box system props have an optional alternative API in v5, using the `sx` prop. You can [read this section](/system/basics/#api-tradeoff) for the "why" behind this new API. ```diff -<Box border="1px dashed grey" p={[2, 3, 4]} m={2}> +<Box sx={{ border: "1px dashed grey", p: [2, 3, 4], m: 2 }}> ``` - [该编码器(codemod)](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#box-sx-prop) 将自动将你的代码更新为新的语法。 You can [read this section](/system/basics/#api-tradeoff) for the why behind the change of API. + If you prefer the new syntax, you can use the [`box-sx-prop` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#box-sx-prop) for automatic migration. -- `borderRadius` 系统属性值转换已被更改。 如果它收到一个数字,它就会将这个值与 `theme.shape.borderRadius` 的值相乘。 也可以使用字符串来提供一个明确的值,单位是 `px`。 +- The following properties have been renamed because they are considered deprecated CSS properties by the CSS specification: + + 1. `gridGap` to `gap` + 2. `gridColumnGap` to `columnGap` + 3. `gridRowGap` to `rowGap` ```diff - -<Box sx={{ borderRadius: 'borderRadius' }}> - +<Box sx={{ borderRadius: 1 }}> + -<Box gridGap={1}> + -<Box gridColumnGap={2}> + -<Box gridRowGap={3}> + +<Box gap={1}> + +<Box columnGap={2}> + +<Box rowGap={3}> ``` + (Note that the system grid function wasn't documented in v4.) + + You can use the [`box-rename-gap` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#box-rename-gap) for automatic migration. + +- The `clone` prop was removed because its behavior can be obtained by applying the `sx` prop directly to the child if it is a Material-UI component. + ```diff - -<Box sx={{ borderRadius: 16 }}> - +<Box sx={{ borderRadius: '16px' }}> + -<Box sx={{ border: '1px dashed grey' }} clone> + - <Button>Save</Button> + -</Box> + +<Button sx={{ border: '1px dashed grey' }}>Save</Button> ``` -- The following properties were renamed, because they are considered deprecated CSS proeprties: +- The ability to pass a render prop was removed because its behavior can be obtained by applying the `sx` prop directly to the child if it is a Material-UI component. -1. `gridGap` to `gap` -2. `gridColumnGap` to `columnGap` -3. `gridRowGap` to `rowGap` + ```diff + -<Box sx={{ border: '1px dashed grey' }}> + - {(props) => <Button {...props}>Save</Button>} + -</Box> + +<Button sx={{ border: '1px dashed grey' }}>Save</Button> + ``` -```diff --<Box gridGap="10px"> -+<Box sx={{ gap: '10px' }}> -``` + For non-Material-UI components, use the `component` prop. -```diff --<Box gridColumnGap="10px" gridRowGap="20px"> -+<Box sx={{ columnGap: '10px', rowGap: '20px' }}> -``` + ```diff + -<Box sx={{ border: '1px dashed grey' }}> + - {(props) => <button {...props}>Save</button>} + -</Box> + +<Box component="button" sx={{ border: '1px dashed grey' }}>Save</Box> + ``` ### Button -- 按钮的 `颜色(color)` 属性默认情况下为 "primary",同时 "default" 属性已被删除。 这使得按钮更接近于 Material Design 规范,并且也简化了 API。 +- 按钮的 `颜色(color)` 属性默认情况下为 "primary",同时 "default" 属性已被删除。 This makes the button closer to the Material Design guidelines and simplifies the API. + + ```diff + -<Button color="primary"> + -<Button color="default"> + +<Button> + +<Button> + ``` + + You can use the [`button-color-prop` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#button-color-prop) for automatic migration. + +- `span` element that wraps children has been removed. `label` classKey is also removed. More details about [this change](https://github.com/mui-org/material-ui/pull/26666). ```diff - -<Button color="primary" /> - -<Button color="default" /> - +<Button /> - +<Button /> + <button class="MuiButton-root"> + - <span class="MuiButton-label"> + children + - </span> + </button> ``` ### Chip - 为保持一致性,我们将 `visuallyhidden` 重命名为 `visuallyHidden`: + + Since `filled` is the default value, the variant prop can be deleted: + ```diff -<Chip variant="default"> - +<Chip variant="filled"> + +<Chip> ``` -### CircularProgress(进度环) + You can use the [`chip-variant-prop` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#chip-variant-prop) for automatic migration. -- `static` 变量已合并到 `determinate` 变量中,后者将采用前者的外观。 这是因为删除的这个变量很少有用。 这属于 Material Design 的例外情况,并且它在规范中已被删除。 +### Checkbox 选择框 + +- The component doesn't have `.MuiIconButton-root` and `.MuiIconButton-label` class names anymore, target `.MuiButtonBase-root` instead. ```diff - -<CircularProgress variant="determinate" /> + - <span class="MuiIconButton-root MuiButtonBase-root MuiCheckbox-root PrivateSwitchBase-root"> + - <span class="MuiIconButton-label"> + - <input class="PrivateSwitchBase-input"> + + <span class="MuiButtonBase-root MuiCheckbox-root PrivateSwitchBase-root"> + + <span class="PrivateSwitchBase-input"> ``` +### CircularProgress(进度环) + +- The `static` variant has been renamed to `determinate`, and the previous appearance of `determinate` has been replaced by that of `static`. 这属于 Material Design 的例外情况,并且它在规范中已被删除。 + ```diff - -<CircularProgress variant="static" classes={{ static: 'className' }} /> + <CircularProgress variant="static" classes={{ static: 'className' }} /> +<CircularProgress variant="determinate" classes={{ determinate: 'className' }} /> ``` +You can use the [`circularprogress-variant` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#circularprogress-variant) for automatic migration. + > 注意:如果你之前已经定制了 determinate,那么你的定制可能不再有效。 所以请删除它们。 ### Collapse 折叠 @@ -472,21 +676,28 @@ As the core components use emotion as a styled engine, the props used by emotion +<Collapse classes={{ root: 'collapse' }}> ``` -###  CssBaseline +You can use the [`collapse-rename-collapsedheight` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#collapse-rename-collapsedheight) for automatic migration of both the prop and the classes key. + +### CssBaseline -- The component was migrated to use the `@material-ui/styled-engine` (`emotion` or `styled-components`) instead of `jss`. You should remove the `@global` key when defining the style overrides for it. +- The component was migrated to use the `@material-ui/styled-engine` (`emotion` or `styled-components`) instead of `jss`. You should remove the `@global` key when defining the style overrides for it. You should remove the `@global` key when defining the style overrides for it. You could also start using the CSS template syntax over the JavaScript object syntax. ```diff - const theme = createMuiTheme({ + const theme = createTheme({ components: { MuiCssBaseline: { - styleOverrides: { + - styleOverrides: { - '@global': { - html: { - WebkitFontSmoothing: 'auto', - }, + - html: { + - WebkitFontSmoothing: 'auto', + - }, - }, - }, + - }, + + styleOverrides: ` + + html { + + -webkit-font-smoothing: auto; + + } + + ` }, }, }); @@ -495,7 +706,7 @@ As the core components use emotion as a styled engine, the props used by emotion - The `body` font size has changed from `theme.typography.body2` (`0.875rem`) to `theme.typography.body1` (`1rem`). To return to the previous size, you can override it in the theme: To return to the previous size, you can override it in the theme: ```js - const theme = createMuiTheme({ + const theme = createTheme({ typography: { body1: { fontSize: '0.875rem', @@ -513,11 +724,11 @@ As the core components use emotion as a styled engine, the props used by emotion ```diff <Dialog - onEnter={onEnter} - - onEntered={onEntered}, - - onEntering={onEntered}, - - onExit={onEntered}, - - onExited={onEntered}, - - onExiting={onEntered} + - onEntered={onEntered} + - onEntering={onEntering} + - onExit={onExit} + - onExited={onExited} + - onExiting={onExiting} + TransitionProps={{ + onEnter, + onEntered, @@ -529,7 +740,9 @@ As the core components use emotion as a styled engine, the props used by emotion /> ``` -- 因为属性重复,所以我们移除了 `disableBackdropClick`。 当 `reason === 'backdropClick'` 时,将会忽略 `onClose` 的关闭事件。 + You can use the [`use-transitionprops` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#use-transitionprops) for automatic migration. + +- Remove the `disableBackdropClick` prop because it is redundant. 当 `reason === 'backdropClick'` 时,将会忽略 `onClose` 的关闭事件。 ```diff <Dialog @@ -543,7 +756,7 @@ As the core components use emotion as a styled engine, the props used by emotion /> ``` -- [withMobileDialog] 此高阶组件已被删除。 Hook API 提供了一个更简单且灵活的方案: +- Remove the `withMobileDialog` higher-order component. Hook API 提供了一个更简单且灵活的方案: ```diff -import withMobileDialog from '@material-ui/core/withMobileDialog'; @@ -559,14 +772,22 @@ As the core components use emotion as a styled engine, the props used by emotion -export default withMobileDialog()(ResponsiveDialog); +export default ResponsiveDialog; + ``` - -export default withMobileDialog()(ResponsiveDialog); - +export default ResponsiveDialog; +- Flatten DialogTitle DOM structure, remove `disableTypography` prop + + ```diff + -<DialogTitle disableTypography> + - <Typography variant="h4" component="h2"> + +<DialogTitle> + + <Typography variant="h4" component="span"> + My header + </Typography> ``` ### Divider -- 你需要使用边框来代替背景色。 这个改动可以防止在缩放屏幕上出现高度不一致的情况。 对于需要自定义边框颜色的用户,你可以改变其需要覆盖的 CSS 属性。 +- 你需要使用边框来代替背景色。 这个改动可以防止在缩放屏幕上出现高度不一致的情况。 If you have customized the color of the border, you will need to update the CSS property override: ```diff .MuiDivider-root { @@ -637,27 +858,66 @@ As the core components use emotion as a styled engine, the props used by emotion ### Fab -- 为保持一致性,我们将 `round` 重命名为 `circular`。 可能的值应该是形容词,而不是名词。 +- Rename `round` to `circular` for consistency: ```diff -<Fab variant="round"> +<Fab variant="circular"> ``` +### FormControl + +- 将默认的变量从 `standard` 更改为 `outlined`。 Standard has been removed from the Material Design guidelines. + + ```diff + -<FormControl value="Standard" /> + -<FormControl value="Outlined" variant="outlined" /> + +<FormControl value="Standard" variant="standard" /> + +<FormControl value="Outlined" /> + ``` + +[This codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#variant-prop) will automatically update your code. + ### Grid -- 为保持和 CSS 原生属性名字的一致性,我们将 `justify` 属性重命名为 `justifyContent`。 +- Rename `justify` prop to `justifyContent` to align with the CSS property name. ```diff -<Grid justify="center"> +<Grid justifyContent="center"> ``` + You can use the [`component-rename-prop` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#component-rename-prop) for automatic migration. + +- The props: `alignItems` `alignContent` and `justifyContent` and their `classes` and style overrides keys were removed: "align-items-xs-center", "align-items-xs-flex-start", "align-items-xs-flex-end", "align-items-xs-baseline", "align-content-xs-center", "align-content-xs-flex-start", "align-content-xs-flex-end", "align-content-xs-space-between", "align-content-xs-space-around", "justify-content-xs-center", "justify-content-xs-flex-end", "justify-content-xs-space-between", "justify-content-xs-space-around" and "justify-content-xs-space-evenly". These props are now considered part of the system, not on the `Grid` component itself. If you still wish to add overrides for them, you can use the `theme.components.MuiGrid.variants` options. For example + + ```diff + const theme = createTheme({ + components: { + MuiGrid: { + - styleOverrides: { + - "align-items-xs-flex-end": { + - marginTop: '20px', + - }, + - }, + + variants: { + + props: { alignItems: "flex-end" }, + + style: { + + marginTop: '20px', + + }, + + }], + }, + }, + }); + ``` + + You can use the [`grid-justify-justifycontent` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#grid-justify-justifycontent) for automatic migration. + ### GridList - 为保持和当前 Material Design 命名的一致性,我们将 `GridList` 组件重命名为 `ImageList`。 - 为保持和 CSS 属性名字的一致性,我们将 `spacing` 属性重命名为 `gap`。 -- 我们将 GridList 的 `cellHeight` 属性重命名为 `rowHieght`。 +- Rename the GridList `cellHeight` prop to `rowHeight`. - 添加 `variant` 属性到 GridList 中。 - 我们将 GridListItemBar 的 `actionPosition` 属性重命名为 `position`。 (也要注意相关的类名变化)。 - 使用 CSS object-fit。 如果要兼容 IE11,那么你可以使用 polyfill 来转换它,例如 https://www.npmjs.com/package/object-fit-images,或者继续使用 v4 组件。 @@ -686,15 +946,62 @@ As the core components use emotion as a styled engine, the props used by emotion +</ImageList> ``` +### Hidden + +- This component was removed because its functionality can be created with the [`sx`](/system/basics/#the-sx-prop) prop or the [`useMediaQuery`](/components/use-media-query) hook. + + Use the `sx` prop to replace `implementation="css"`: + + ```diff + -<Hidden implementation="css" xlUp><Paper /></Hidden> + -<Hidden implementation="css" xlUp><button /></Hidden> + +<Paper sx={{ display: { xl: 'none', xs: 'block' } }} /> + +<Box component="button" sx={{ display: { xl: 'none', xs: 'block' } }} /> + ``` + + ```diff + -<Hidden implementation="css" mdDown><Paper /></Hidden> + -<Hidden implementation="css" mdDown><button /></Hidden> + +<Paper sx={{ display: { xs: 'none', md: 'block' } }} /> + +<Box component="button" sx={{ display: { xs: 'none', md: 'block' } }} /> + ``` + + Use the `useMediaQuery` hook to replace `implementation="js"`: + + ```diff + -<Hidden implementation="js" xlUp><Paper /></Hidden> + +const hidden = useMediaQuery(theme => theme.breakpoints.up('xl')); + +return hidden ? null : <Paper />; + ``` + ### Icon -- The default value of `fontSize` was changed from `default` to `medium` for consistency. The default value of `fontSize` was changed from `default` to `medium` for consistency. In the unlikey event that you were using the value `default`, the prop can be removed: +- The default value of `fontSize` was changed from `default` to `medium` for consistency. In the unlikely event that you were using the value `default`, the prop can be removed: ```diff -<Icon fontSize="default">icon-name</Icon> +<Icon>icon-name</Icon> ``` +### IconButton + +- The default size's padding is reduced to `8px` which makes the default IconButton size of `40px`. To get the old default size (`48px`), use `size="large"`. The change was done to better match Google's products when Material Design stopped documenting the icon button pattern. + + ```diff + - <IconButton> + + <IconButton size="large"> + ``` + +- `span` element that wraps children has been removed. `label` classKey is also removed. More details about [this change](https://github.com/mui-org/material-ui/pull/26666). + + ```diff + <button class="MuiIconButton-root"> + - <span class="MuiIconButton-label"> + <svg /> + - </span> + </button> + ``` + ### Menu - onE\* 过渡属性已被删除。 请使用 TransitionProps 来代替它。 @@ -702,11 +1009,11 @@ As the core components use emotion as a styled engine, the props used by emotion ```diff <Menu - onEnter={onEnter} - - onEntered={onEntered}, - - onEntering={onEntered}, - - onExit={onEntered}, - - onExited={onEntered}, - - onExiting={onEntered} + - onEntered={onEntered} + - onEntering={onEntering} + - onExit={onExit} + - onExited={onExited} + - onExiting={onExiting} + TransitionProps={{ + onEnter, + onEntered, @@ -718,9 +1025,41 @@ As the core components use emotion as a styled engine, the props used by emotion > ``` + > Note: The `selectedMenu` variant will no longer vertically align the selected item with the anchor. + + You can use the [`use-transitionprops` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#use-transitionprops) for automatic migration. + +- Change the default value of `anchorOrigin.vertical` to follow the Material Design guidelines. The menu now displays below the anchor instead of on top of it. 你可以用以下方法恢复到以前的行为: + + ```diff + <Menu + + anchorOrigin={{ + + vertical: 'top', + + horizontal: 'left', + + }} + ``` + +### MenuItem + +- The `MenuItem` component inherits the `ButtonBase` component instead of `ListItem`. The class names related to "MuiListItem-\*" are removed and theming `ListItem` is no longer affecting `MenuItem`. + + ```diff + -<li className="MuiButtonBase-root MuiMenuItem-root MuiListItem-root"> + +<li className="MuiButtonBase-root MuiMenuItem-root"> + ``` + +- prop `listItemClasses` is removed, use `classes` instead. + + ```diff + -<MenuItem listItemClasses={{...}}> + +<MenuItem classes={{...}}> + ``` + + Read more about [MenuItem CSS API](/api/menu-item/#css) + ### Modal -- 因为属性重复,所以我们移除了 `disableBackdropClick`。 当 `reason === 'backdropClick'` 时,将会忽略 `onClose` 的关闭事件。 +- Remove the `disableBackdropClick` prop because it is redundant. Use `onClose` with `reason === 'backdropClick'` instead. ```diff <Modal @@ -734,7 +1073,7 @@ As the core components use emotion as a styled engine, the props used by emotion /> ``` -- 因为属性重复,所以我们移除了 `onEscapeKeyDown`。 使用 `onClose` 和 `reason === "escapeKeyDown"` 来代替。 +- Remove the `onEscapeKeyDown` prop because it is redundant. 使用 `onClose` 和 `reason === "escapeKeyDown"` 来代替。 ```diff <Modal @@ -749,6 +1088,38 @@ As the core components use emotion as a styled engine, the props used by emotion - 移除 `onRendered` 属性。 具体迁移方法根据你的使用情况而定,你可以在子元素上使用 [callback ref](https://reactjs.org/docs/refs-and-the-dom.html#callback-refs),也可以在子组件中使用 effect 钩子。 +### NativeSelect + +- Merge the `selectMenu` slot into `select`. Slot `selectMenu` was redundant. The `root` slot is no longer applied to the select, but to the root. + + ```diff + -<NativeSelect classes={{ root: 'class1', select: 'class2', selectMenu: 'class3' }} /> + +<NativeSelect classes={{ select: 'class1 class2 class3' }} /> + ``` + +### OutlinedInput + +- Remove the `labelWidth` prop. The `label` prop now fulfills the same purpose, using CSS layout instead of JavaScript measurement to render the gap in the outlined. + + ```diff + -<OutlinedInput labelWidth={20} /> + +<OutlinedInput label="First Name" /> + ``` + +### Paper + +- Change the background opacity based on the elevation in dark mode. This change was done to follow the Material Design guidelines. You can revert it in the theme: + + ```diff + const theme = createTheme({ + components: { + MuiPaper: { + + styleOverrides: { root: { backgroundImage: 'unset' } }, + }, + }, + }); + ``` + ### 分页组件 Pagination - 该组件已从实验室包移动到核心包。 现在这个组件处于稳定版本。 @@ -762,9 +1133,9 @@ As the core components use emotion as a styled engine, the props used by emotion +import usePagination from '@material-ui/core/usePagination'; ``` - 你可以使用我们的 [`moved-lab-modules` 编码器(codemod)](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules)来进行自动迁移。 + 你可以使用 [`moved-lab-modules` 编码器(codemod)](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules)来进行自动迁移。 -- 为保持一致性,我们将 `round` 重命名为 `circular`。 可能的值应该是形容词,而不是名词。 +- Rename `round` to `circular` for consistency: ```diff -<Pagination shape="round"> @@ -780,11 +1151,11 @@ As the core components use emotion as a styled engine, the props used by emotion ```diff <Popover - onEnter={onEnter} - - onEntered={onEntered}, - - onEntering={onEntered}, - - onExit={onEntered}, - - onExited={onEntered}, - - onExiting={onEntered} + - onEntered={onEntered} + - onEntering={onEntering} + - onExit={onExit} + - onExited={onExited} + - onExiting={onExiting} + TransitionProps={{ + onEnter, + onEntered, @@ -796,9 +1167,13 @@ As the core components use emotion as a styled engine, the props used by emotion /> ``` + You can use the [`use-transitionprops` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#use-transitionprops) for automatic migration. + +- The `getContentAnchorEl` prop was removed to simplify the positioning logic. + ### Popper -- 我们将 [Popper.js](https://github.com/popperjs/popper-core) 从 v1 升级到 v2。 <br /> 你可以阅读 [他们的迁移指南](https://popper.js.org/docs/v2/migration-guide/) 或参考以下摘要: +- 我们将 [Popper.js](https://github.com/popperjs/popper-core) 从 v1 升级到 v2。 这个第三方库的升级引入了很多变化。<br /> 你可以阅读 [他们的迁移指南](https://popper.js.org/docs/v2/migration-guide/) 或参考以下摘要: - CSS 前缀已更改: ```diff @@ -807,7 +1182,7 @@ As the core components use emotion as a styled engine, the props used by emotion - '&[x-placement*="bottom"] $arrow': { + '&[data-popper-placement*="bottom"] $arrow': { ``` - - 方法名已改变。 + - Method names have changed: ```diff -popperRef.current.scheduleUpdate() @@ -825,6 +1200,25 @@ As the core components use emotion as a styled engine, the props used by emotion - 移除 `onRendered` 属性。 具体迁移方法根据你的使用情况而定,你可以在子元素上使用 [callback ref](https://reactjs.org/docs/refs-and-the-dom.html#callback-refs),也可以在子组件中使用 effect 钩子。 +### Radio 单选框组件 + +- The radio color prop is now "primary" by default. To continue using the "secondary" color, you must explicitly indicate `secondary`. This brings the radio closer to the Material Design guidelines. + + ```diff + -<Radio /> + +<Radio color="secondary /> + ``` + +- The component doesn't have `.MuiIconButton-root` and `.MuiIconButton-label` class names anymore, target `.MuiButtonBase-root` instead. + + ```diff + - <span class="MuiIconButton-root MuiButtonBase-root MuiRadio-root PrivateSwitchBase-root"> + - <span class="MuiIconButton-label"> + - <input class="PrivateSwitchBase-input"> + + <span class="MuiButtonBase-root MuiRadio-root PrivateSwitchBase-root"> + + <span class="PrivateSwitchBase-input"> + ``` + ### Rating - 该组件已从实验室包移动到核心包。 现在这个组件处于稳定版本。 @@ -834,7 +1228,7 @@ As the core components use emotion as a styled engine, the props used by emotion +import Rating from '@material-ui/core/Rating'; ``` - 你可以使用我们的 [`moved-lab-modules` 编码器(codemod)](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules)来进行自动迁移。 + 你可以使用 [`moved-lab-modules` 编码器(codemod)](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules)来进行自动迁移。 - 为提高无障碍的可访问性,我们更改了默认的空图标。 如果你有自定义了 `icon` 属性,但没有使用 `emptyIcon` 属性,你可以用以下方法还原到以前的行为: @@ -867,6 +1261,33 @@ As the core components use emotion as a styled engine, the props used by emotion +<Button ref={ref} /> ``` +### Select 选择属性 + +- 将默认的变量从 `standard` 更改为 `outlined`。 Standard has been removed from the Material Design guidelines. If you are composing the Select with a form control component, you only need to update `FormControl`, the select inherits the variant from its context. + + ```diff + -<Select value="Standard" /> + -<Select value="Outlined" variant="outlined" /> + +<Select value="Standard" variant="standard" /> + +<Select value="Outlined" /> + ``` + +[This codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#variant-prop) will automatically update your code. + +- Remove the `labelWidth` prop. The `label` prop now fulfills the same purpose, using CSS layout instead of JavaScript measurement to render the gap in the outlined. The TextField already handles it by default. + + ```diff + -<Select variant="outlined" labelWidth={20} /> + +<Select variant="outlined" label="Gender" /> + ``` + +- Merge the `selectMenu` slot into `select`. Slot `selectMenu` was redundant. The `root` slot is no longer applied to the select, but to the root. + + ```diff + -<Select classes={{ root: 'class1', select: 'class2', selectMenu: 'class3' }} /> + +<Select classes={{ select: 'class1 class2 class3' }} /> + ``` + ### Skeleton - 该组件已从实验室包移动到核心包。 现在这个组件处于稳定版本。 @@ -876,9 +1297,9 @@ As the core components use emotion as a styled engine, the props used by emotion +import Skeleton from '@material-ui/core/Skeleton'; ``` - 你可以使用我们的 [`moved-lab-modules` 编码器(codemod)](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules)来进行自动迁移。 + 你可以使用 [`moved-lab-modules` 编码器(codemod)](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules)来进行自动迁移。 -- 为保持一致性,我们将 `circle` 重命名为 `circular`,`rect` 重命名为 `rectangular`。 可能的值应该是形容词,而不是名词。 +- Rename `circle` to `circular` and `rect` to `rectangular` for consistency: ```diff -<Skeleton variant="circle" /> @@ -898,19 +1319,22 @@ As the core components use emotion as a styled engine, the props used by emotion +<Slider onChange={(event: React.SyntheticEvent, value: unknown) => {}} /> ``` -- `ValueLabelComponent` 属性现在是 `components` 属性的一部分。 +- The `ValueLabelComponent` and `ThumbComponent` prop is now part of the `components` prop. ```diff - -<Slider ValueLabelComponent={CustomValueLabel} /> - +<Slider components={{ ValueLabel: CustomValueLabel }} /> + <Slider + - ValueLabelComponent={CustomValueLabel} + - ThumbComponent={CustomThumb} + + components={{ + + ValueLabel: CustomValueLabel, + + Thumb: CustomThumb, + + }} + /> ``` -- `ThumbComponent` 属性不再是 `components` 属性的一部分。 +- Rework the CSS to match the latest [Material Design guidelines](https://material.io/components/sliders) and make custom styles more intuitive. [See documentation](/components/slider/). <a href="/components/slider/#continuous-sliders"><img width="247" alt="" src="https://user-images.githubusercontent.com/3165635/121884800-a8808600-cd13-11eb-8cdf-e25de8f1ba73.png" style="margin: auto"></a> - ```diff - -<Slider ThumbComponent={CustomThumb} /> - +<Slider components={{ Thumb: CustomThumb }} /> - ``` + You can reduce the density of the slider, closer to v4 with the [`size="small"` prop](/components/slider/#sizes). ### Snackbar(消息条) @@ -926,11 +1350,11 @@ As the core components use emotion as a styled engine, the props used by emotion ```diff <Snackbar - onEnter={onEnter} - - onEntered={onEntered}, - - onEntering={onEntered}, - - onExit={onEntered}, - - onExited={onEntered}, - - onExiting={onEntered} + - onEntered={onEntered} + - onEntering={onEntering} + - onExit={onExit} + - onExited={onExited} + - onExiting={onExiting} + TransitionProps={{ + onEnter, + onEntered, @@ -942,6 +1366,8 @@ As the core components use emotion as a styled engine, the props used by emotion /> ``` + You can use the [`use-transitionprops` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#use-transitionprops) for automatic migration. + ### SpeedDial 快速拨号 - 该组件已从实验室包移动到核心包。 现在这个组件处于稳定版本。 @@ -955,7 +1381,7 @@ As the core components use emotion as a styled engine, the props used by emotion +import SpeedDialIcon from '@material-ui/core/SpeedDialIcon'; ``` - 你可以使用我们的 [`moved-lab-modules` 编码器(codemod)](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules)来进行自动迁移。 + 你可以使用 [`moved-lab-modules` 编码器(codemod)](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules)来进行自动迁移。 ### Stepper 步骤条组件 @@ -993,7 +1419,7 @@ As the core components use emotion as a styled engine, the props used by emotion ### SvgIcon(Svg 图标) -- The default value of `fontSize` was changed from `default` to `medium` for consistency. The default value of `fontSize` was changed from `default` to `medium` for consistency. In the unlikey event that you were using the value `default`, the prop can be removed: +- The default value of `fontSize` was changed from `default` to `medium` for consistency. In the unlikey event that you were using the value `default`, the prop can be removed: ```diff -<SvgIcon fontSize="default"> @@ -1002,6 +1428,39 @@ As the core components use emotion as a styled engine, the props used by emotion </SvgIcon> ``` +### Switch 开关 + +- Remove the second argument from `onChange`. You can pull out the checked state by accessing `event.target.checked`. + + ```diff + function MySwitch() { + - const handleChange = (event: React.ChangeEvent<HTMLInputElement>, checked: boolean) => { + + const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => { + + const checked = event.target.checked; + }; + + return <Switch onChange={handleChange} />; + } + ``` + +- The switch color prop is now "primary" by default. To continue using the "secondary" color, you must explicitly indicate `secondary`. This brings the switch closer to the Material Design guidelines. + + ```diff + -<Switch /> + +<Switch color="secondary" /> + ``` + +- The component doesn't have `.MuiIconButton-root` and `.MuiIconButton-label` class names anymore, target `.MuiButtonBase-root` instead. + + ```diff + <span class="MuiSwitch-root"> + - <span class="MuiIconButton-root MuiButtonBase-root MuiSwitch-switchBase PrivateSwitchBase-root"> + - <span class="MuiIconButton-label"> + - <input class="MuiSwitch-input PrivateSwitchBase-input"> + + <span class="MuiButtonBase-root MuiSwitch-switchBase PrivateSwitchBase-root"> + + <span class="MuiSwitch-input PrivateSwitchBase-input"> + ``` + ### Table - 如果你需要自定义表格分页的操作标签(actions labels),那么就必须使用 `getItemAriaLabel` 属性。 这是为了与 `Pagination` 组件保持一致。 @@ -1009,7 +1468,7 @@ As the core components use emotion as a styled engine, the props used by emotion ```diff <TablePagination - backIconButtonText="Avant" - - nextIconButtonText="Après + - nextIconButtonText="Après" + getItemAriaLabel={…} ``` @@ -1023,8 +1482,42 @@ As the core components use emotion as a styled engine, the props used by emotion + onPageChange={()=>{}} ``` +- Separate classes for different table pagination labels. This allows simpler customizations. + + ```diff + <TablePagination + - classes={{ caption: 'foo' }} + + classes={{ selectLabel: 'foo', displayedRows: 'foo' }} + /> + ``` + +- Move the custom class on `input` to `select`. The `input` key is being applied on another element. + + ```diff + <TablePagination + - classes={{ input: 'foo' }} + + classes={{ select: 'foo' }} + /> + ``` + +- Rename the `default` value of the `padding` prop to `normal`. + + ```diff + -<Table padding="default" /> + -<TableCell padding="default" /> + +<Table padding="normal" /> + +<TableCell padding="normal" /> + ``` + ### Tabs 选项卡 +- Change the default `indicatorColor` and `textColor` prop values to "primary". This is done to match the most common use cases with Material Design. + + ```diff + -<Tabs /> + +<Tabs indicatorColor="primary" textColor="inherit" /> + ``` + - TypeScript:`onChange` 中的 `event` 的类型不再是 `React.ChangeEvent`,而是`React.SyntheticEvent`。 ```diff @@ -1046,9 +1539,12 @@ As the core components use emotion as a styled engine, the props used by emotion +<Tabs scrollButtons={false} /> ``` +- Tab `minWidth` changed from `72px` => `90px` (without media-query) according to [material-design spec](https://material.io/components/tabs#specs) +- Tab `maxWidth` changed from `264px` => `360px` according to [material-design spec](https://material.io/components/tabs#specs) + ### TextField -- 将默认的变量从 `standard` 更改为 `outlined`。 Standard 在 Material Design 指南中已被删除。 +- 将默认的变量从 `standard` 更改为 `outlined`。 Standard has been removed from the Material Design guidelines. ```diff -<TextField value="Standard" /> @@ -1057,7 +1553,7 @@ As the core components use emotion as a styled engine, the props used by emotion +<TextField value="Outlined" /> ``` -[This codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#textfield-variant-prop) 可以自动升级你的代码。 + You can use the [`variant-prop` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#variant-prop) for automatic migration. - 为保持与 HTML 属性的一致性,我们将 `rowsMax` 属性重命名为 `maxRows`。 @@ -1098,6 +1594,15 @@ As the core components use emotion as a styled engine, the props used by emotion +<Input size="small" /> ``` +- Set the InputAdornment `position` prop to `start` or `end`. Use `start` if used as the value of the `startAdornment` prop. Use `end` if used as the value of the `endAdornment` prop. + + ```diff + -<TextField startAdornment={<InputAdornment>Kg</InputAdornment>} /> + -<TextField endAdornment={<InputAdornment>Kg</InputAdornment>} /> + +<TextField startAdornment={<InputAdornment position="start">Kg</InputAdornment>} /> + +<TextField endAdornment={<InputAdornment position="end">Kg</InputAdornment>} /> + ``` + ### TextareaAutosize - 我们移除了 `rows` 属性,你需要使用 `minRows` 属性来代替它。 这一变化旨在明确该属性的行为。 @@ -1132,7 +1637,7 @@ As the core components use emotion as a styled engine, the props used by emotion +import ToggleButtonGroup from '@material-ui/core/ToggleButtonGroup'; ``` - 你可以使用我们的 [`moved-lab-modules` 编码器(codemod)](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules)来进行自动迁移。 + 你可以使用 [`moved-lab-modules` 编码器(codemod)](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#moved-lab-modules)来进行自动迁移。 ### Tooltip @@ -1151,24 +1656,241 @@ As the core components use emotion as a styled engine, the props used by emotion ### 文字铸排 -- 为了避免 [System](https://material-ui.com/system/basics/) 功能重复,我们替换了 `srOnly` 属性。 +- Remove the `srOnly` variant. You can use the `visuallyHidden` utility in conjunction with the `sx` prop instead. ```diff - -import Typography from '@material-ui/core/Typography'; - +import { visuallyHidden } from '@material-ui/system'; - +import styled from 'styled-component'; + +import { visuallyHidden } from '@material-ui/utils'; - +const Span = styled('span')(visuallyHidden); + -<Typography variant="srOnly">Create a user</Typography> + +<span style={visuallyHidden}>Create a user</span> + ``` - -<Typography variant="srOnly">创建用户</Typography> - +<Span>创建用户</Span> +- The following `classes` and style overrides keys were removed: "colorInherit", "colorPrimary", "colorSecondary", "colorTextPrimary", "colorTextSecondary", "colorError", "displayInline" and "displayBlock". These props are now considered part of the system, not on the `Typography` component itself. If you still wish to add overrides for them, you can use the `theme.components.MuiTypography.variants` options. For example + + ```diff + const theme = createTheme({ + components: { + MuiTypography: { + - styleOverrides: { + - colorSecondary: { + - marginTop: '20px', + - }, + - }, + + variants: { + + props: { color: "secondary" }, + + style: { + + marginTop: '20px', + + }, + + }], + }, + }, + }); ``` -### System 系统 +### `@material-ui/core/styles` + +#### createGenerateClassName + +- The `createGenerateClassName` function is no longer exported from `@material-ui/core/styles`. You should import it directly from `@material-ui/styles`. + + ```diff + -import { createGenerateClassName } from '@material-ui/core/styles'; + +import { createGenerateClassName } from '@material-ui/styles'; + ``` + +#### jssPreset + +- The `jssPreset` object is no longer exported from `@material-ui/core/styles`. You should import it directly from `@material-ui/styles`. + + ```diff + -import { jssPreset } from '@material-ui/core/styles'; + +import { jssPreset } from '@material-ui/styles'; + ``` + +#### makeStyles + +- The `makeStyles` JSS utility is no longer exported from `@material-ui/core/styles`. You can use `@material-ui/styles/makeStyles` instead. Make sure to add a `ThemeProvider` at the root of your application, as the `defaultTheme` is no longer available. If you are using this utility together with `@material-ui/core`, it's recommended you use the `ThemeProvider` component from `@material-ui/core/styles` instead. + + ```diff + -import { makeStyles } from '@material-ui/core/styles'; + +import { makeStyles } from '@material-ui/styles'; + +import { createTheme, ThemeProvider } from '@material-ui/core/styles'; + + +const theme = createTheme(); + const useStyles = makeStyles((theme) => ({ + background: theme.palette.primary.main, + })); + function Component() { + const classes = useStyles(); + return <div className={classes.root} /> + } + + // In the root of your app + function App(props) { + - return <Component />; + + return <ThemeProvider theme={theme}><Component {...props} /></ThemeProvider>; + } + ``` + +#### MuiThemeProvider + +- The `MuiThemeProvider` component is no longer exported from `@material-ui/core/styles`. Use `ThemeProvider` instead. + + ```diff + -import { MuiThemeProvider } from '@material-ui/core/styles'; + +import { ThemeProvider } from '@material-ui/core/styles'; + ``` + +#### ServerStyleSheets + +- The `ServerStyleSheets` component is no longer exported from `@material-ui/core/styles`. You should import it directly from `@material-ui/styles`. + + ```diff + -import { ServerStyleSheets } from '@material-ui/core/styles'; + +import { ServerStyleSheets } from '@material-ui/styles'; + ``` + +#### styled + +- The `styled` JSS utility is no longer exported from `@material-ui/core/styles`. You can use `@material-ui/styles/styled` instead. Make sure to add a `ThemeProvider` at the root of your application, as the `defaultTheme` is no longer available. If you are using this utility together with `@material-ui/core`, it's recommended you use the `ThemeProvider` component from `@material-ui/core/styles` instead. + + ```diff + -import { styled } from '@material-ui/core/styles'; + +import { styled } from '@material-ui/styles'; + +import { createTheme, ThemeProvider } from '@material-ui/core/styles'; + + +const theme = createTheme(); + const MyComponent = styled('div')(({ theme }) => ({ background: theme.palette.primary.main })); -- 为了避免与 styled-components & emotion CSS 属性冲突,我们将该 `css` 属性替换为 `sx`。 + function App(props) { + - return <MyComponent />; + + return <ThemeProvider theme={theme}><MyComponent {...props} /></ThemeProvider>; + } + ``` + +#### StylesProvider + +- The `StylesProvider` component is no longer exported from `@material-ui/core/styles`. You should import it directly from `@material-ui/styles`. + + ```diff + -import { StylesProvider } from '@material-ui/core/styles'; + +import { StylesProvider } from '@material-ui/styles'; + ``` + +#### useThemeVariants + +- The `useThemeVariants` hook is no longer exported from `@material-ui/core/styles`. You should import it directly from `@material-ui/styles`. + + ```diff + -import { useThemeVariants } from '@material-ui/core/styles'; + +import { useThemeVariants } from '@material-ui/styles'; + ``` + +#### withStyles + +- Replace the `innerRef` prop with the `ref` prop. Refs are now automatically forwarded to the inner component. + + ```diff + import * as React from 'react'; + import { withStyles } from '@material-ui/styles'; + + const MyComponent = withStyles({ + root: { + backgroundColor: 'red', + }, + })(({ classes }) => <div className={classes.root} />); + + function MyOtherComponent(props) { + const ref = React.useRef(); + - return <MyComponent innerRef={ref} />; + + return <MyComponent ref={ref} />; + } + ``` + +- The `withStyles` JSS utility is no longer exported from `@material-ui/core/styles`. You can use `@material-ui/styles/withStyles` instead. Make sure to add a `ThemeProvider` at the root of your application, as the `defaultTheme` is no longer available. If you are using this utility together with `@material-ui/core`, you should use the `ThemeProvider` component from `@material-ui/core/styles` instead. + + ```diff + -import { withStyles } from '@material-ui/core/styles'; + +import { withStyles } from '@material-ui/styles'; + +import { createTheme, ThemeProvider } from '@material-ui/core/styles'; + + +const defaultTheme = createTheme(); + const MyComponent = withStyles((props) => { + const { classes, className, ...other } = props; + return <div className={clsx(className, classes.root)} {...other} /> + })(({ theme }) => ({ root: { background: theme.palette.primary.main }})); + + function App() { + - return <MyComponent />; + + return <ThemeProvider theme={defaultTheme}><MyComponent /></ThemeProvider>; + } + ``` + +#### withTheme + +- The `withTheme` HOC utility has been removed from the `@material-ui/core/styles` package. You can use `@material-ui/styles/withTheme` instead. Make sure to add a `ThemeProvider` at the root of your application, as the `defaultTheme` is no longer available. If you are using this utility together with `@material-ui/core`, it's recommended you use the `ThemeProvider` component from `@material-ui/core/styles` instead. + + ```diff + -import { withTheme } from '@material-ui/core/styles'; + +import { withTheme } from '@material-ui/styles'; + +import { createTheme, ThemeProvider } from '@material-ui/core/styles'; + + +const theme = createTheme(); + const MyComponent = withTheme(({ theme }) => <div>{props.theme.direction}</div>); + + function App(props) { + - return <MyComponent />; + + return <ThemeProvider theme={theme}><MyComponent {...props} /></ThemeProvider>; + } + ``` + +- Replace the `innerRef` prop with the `ref` prop. Refs are now automatically forwarded to the inner component. + + ```diff + import * as React from 'react'; + import { withTheme } from '@material-ui/core/styles'; + + const MyComponent = withTheme(({ theme }) => <div>{props.theme.direction}</div>); + + function MyOtherComponent(props) { + const ref = React.useRef(); + - return <MyComponent innerRef={ref} />; + + return <MyComponent ref={ref} />; + } + ``` + +#### withWidth + +- This HOC was removed. There's an alternative using the `useMediaQuery` hook on [this page](/components/use-media-query/#migrating-from-withwidth). + +### `@material-ui/types` + +- Rename the exported `Omit` type in `@material-ui/types`. The module is now called `DistributiveOmit`. The change removes the confusion with the built-in `Omit` helper introduced in TypeScript v3.5. The built-in `Omit`, while similar, is non-distributive. This leads to differences when applied to union types. [See this StackOverflow answer for further details](https://stackoverflow.com/a/57103940/1009797). + + ```diff + -import { Omit } from '@material-ui/types'; + +import { DistributiveOmit } from '@material-ui/types'; + ``` + +### `@material-ui/styles` + +#### ThemeProvider + +If you are using the utilities from `@material-ui/styles` together with the `@material-ui/core`, you should replace the use of `ThemeProvider` from `@material-ui/styles` with the one exported from `@material-ui/core/styles`. This way, the `theme` provided in the context will be available in both the styling utilities exported from `@material-ui/styles`, like `makeStyles`, `withStyles` etc. and the Material-UI components. ```diff --<Box css={{ color: 'primary.main' }} /> -+<Box sx={{ color: 'primary.main' }} /> +-import { ThemeProvider } from '@material-ui/styles'; ++import { ThemeProvider } from '@material-ui/core/styles'; +``` + +#### Default theme (TypeScript) + +The `@material-ui/styles` package is no longer part of `@material-ui/core/styles`. If you are using `@material-ui/styles` together with `@material-ui/core` you need to add a module augmentation for the `DefaultTheme`. + +```ts +import { Theme } from '@material-ui/core/styles'; + +declare module '@material-ui/styles' { + interface DefaultTheme extends Theme {} +} ``` diff --git a/docs/src/pages/guides/migration-v4/migration-v4.md b/docs/src/pages/guides/migration-v4/migration-v4.md index d3e88fd8f95583..1fb87506905f60 100644 --- a/docs/src/pages/guides/migration-v4/migration-v4.md +++ b/docs/src/pages/guides/migration-v4/migration-v4.md @@ -85,7 +85,7 @@ However, we generally recommend to not use a TypeScript version older than the [ ### Style library -The style library used by default in v5 is [`emotion`](https://github.com/emotion-js/emotion). While migrating from JSS to emotion, and if you are using JSS style overrides for your components (for example overrides created by `makeStyles`), you will need to take care of the CSS injection order. To do so, you need to have the `StylesProvider` with the `injectFirst` option at the top of your component tree. Here is an example: +The style library used by default in v5 is [`emotion`](https://github.com/emotion-js/emotion). While migrating from JSS to emotion, and if you are using JSS style overrides for your components (for example overrides created by `makeStyles`), you will need to take care of the CSS injection order. To do so, you need to have the `StyledEngineProvider` with the `injectFirst` option at the top of your component tree. Here is an example: ```jsx import * as React from 'react'; @@ -631,7 +631,7 @@ You can use the [`moved-lab-modules` codemod](https://github.com/mui-org/materia You can use the [`button-color-prop` codemod](https://github.com/mui-org/material-ui/tree/HEAD/packages/material-ui-codemod#button-color-prop) for automatic migration. -- `span` element that wraps children has been removed. `label` classKey is also removed. +- `span` element that wraps children has been removed. `label` classKey is also removed. More details about [this change](https://github.com/mui-org/material-ui/pull/26666). ```diff <button class="MuiButton-root"> @@ -1019,6 +1019,16 @@ You can use the [`collapse-rename-collapsedheight` codemod](https://github.com/m + <IconButton size="large"> ``` +- `span` element that wraps children has been removed. `label` classKey is also removed. More details about [this change](https://github.com/mui-org/material-ui/pull/26666). + + ```diff + <button class="MuiIconButton-root"> + - <span class="MuiIconButton-label"> + <svg /> + - </span> + </button> + ``` + ### Menu - The onE\* transition props were removed. Use TransitionProps instead. diff --git a/docs/src/pages/guides/minimizing-bundle-size/minimizing-bundle-size-de.md b/docs/src/pages/guides/minimizing-bundle-size/minimizing-bundle-size-de.md index 0c370809b32005..4bab7d7ee3f6cf 100644 --- a/docs/src/pages/guides/minimizing-bundle-size/minimizing-bundle-size-de.md +++ b/docs/src/pages/guides/minimizing-bundle-size/minimizing-bundle-size-de.md @@ -105,6 +105,7 @@ Wählen Sie eines der folgenden Plugins: 'babel-plugin-import', { libraryName: '@material-ui/core', + libraryDirectory: '', camel2DashComponentName: false, }, 'core', @@ -113,6 +114,7 @@ Wählen Sie eines der folgenden Plugins: 'babel-plugin-import', { libraryName: '@material-ui/icons', + libraryDirectory: '', camel2DashComponentName: false, }, 'icons', @@ -156,11 +158,10 @@ Create a `config-overrides.js` file in the root directory: ```js /* config-overrides.js */ - const { useBabelRc, override } = require('customize-cra') +/* eslint-disable react-hooks/rules-of-hooks */ +const { useBabelRc, override } = require('customize-cra'); - module.exports = override( - useBabelRc() - ); +module.exports = override(useBabelRc()); ``` If you wish, `babel-plugin-import` can be configured through `config-overrides.js` instead of `.babelrc` by using this [configuration](https://github.com/arackaf/customize-cra/blob/master/api.md#fixbabelimportslibraryname-options). @@ -174,24 +175,6 @@ Modify your `package.json` start command: } ``` -Note: You may run into errors like these: - -> Module not found: Can't resolve '@material-ui/core/makeStyles' in '/your/project' - -This is because `@material-ui/styles` is re-exported through `core`, but the full import is not allowed. - -You have an import like this in your code: - -```js -import { makeStyles, createStyles } from '@material-ui/core'; -``` - -The fix is simple, define the import separately: - -```js -import { makeStyles, createStyles } from '@material-ui/core/styles'; -``` - Enjoy significantly faster start times. #### 2. Convert all your imports diff --git a/docs/src/pages/guides/minimizing-bundle-size/minimizing-bundle-size-es.md b/docs/src/pages/guides/minimizing-bundle-size/minimizing-bundle-size-es.md index 8a970e5b43aefe..c2423ccc40d698 100644 --- a/docs/src/pages/guides/minimizing-bundle-size/minimizing-bundle-size-es.md +++ b/docs/src/pages/guides/minimizing-bundle-size/minimizing-bundle-size-es.md @@ -105,6 +105,7 @@ Pick one of the following plugins: 'babel-plugin-import', { libraryName: '@material-ui/core', + libraryDirectory: '', camel2DashComponentName: false, }, 'core', @@ -113,6 +114,7 @@ Pick one of the following plugins: 'babel-plugin-import', { libraryName: '@material-ui/icons', + libraryDirectory: '', camel2DashComponentName: false, }, 'icons', @@ -155,10 +157,11 @@ If you are using Create React App, you will need to use a couple of projects tha Create a `config-overrides.js` file in the root directory: ```js -"scripts": { -- "start": "react-scripts start" -+ "start": "react-app-rewired start" - } +/* config-overrides.js */ +/* eslint-disable react-hooks/rules-of-hooks */ +const { useBabelRc, override } = require('customize-cra'); + +module.exports = override(useBabelRc()); ``` If you wish, `babel-plugin-import` can be configured through `config-overrides.js` instead of `.babelrc` by using this [configuration](https://github.com/arackaf/customize-cra/blob/master/api.md#fixbabelimportslibraryname-options). @@ -177,24 +180,6 @@ Modify your `package.json` start command: } ``` -Note: You may run into errors like these: - -> Module not found: Can't resolve '@material-ui/core/makeStyles' in '/your/project' - -This is because `@material-ui/styles` is re-exported through `core`, but the full import is not allowed. - -You have an import like this in your code: - -```js -import { makeStyles, createStyles } from '@material-ui/core'; -``` - -The fix is simple, define the import separately: - -```js -import { makeStyles, createStyles } from '@material-ui/core/styles'; -``` - Enjoy significantly faster start times. #### 2. Convert all your imports diff --git a/docs/src/pages/guides/minimizing-bundle-size/minimizing-bundle-size-fr.md b/docs/src/pages/guides/minimizing-bundle-size/minimizing-bundle-size-fr.md index 22602e7e7ff084..9b5d5104c7b07e 100644 --- a/docs/src/pages/guides/minimizing-bundle-size/minimizing-bundle-size-fr.md +++ b/docs/src/pages/guides/minimizing-bundle-size/minimizing-bundle-size-fr.md @@ -177,24 +177,6 @@ Modify your `package.json` start command: } ``` -Note: You may run into errors like these: - -> Module not found: Can't resolve '@material-ui/core/makeStyles' in '/your/project' - -This is because `@material-ui/styles` is re-exported through `core`, but the full import is not allowed. - -You have an import like this in your code: - -```js -import { makeStyles, createStyles } from '@material-ui/core'; -``` - -The fix is simple, define the import separately: - -```js -import { makeStyles, createStyles } from '@material-ui/core/styles'; -``` - Enjoy significantly faster start times. #### 2. Convert all your imports diff --git a/docs/src/pages/guides/minimizing-bundle-size/minimizing-bundle-size-ja.md b/docs/src/pages/guides/minimizing-bundle-size/minimizing-bundle-size-ja.md index 049187ab30f20b..a03faf1066c1c2 100644 --- a/docs/src/pages/guides/minimizing-bundle-size/minimizing-bundle-size-ja.md +++ b/docs/src/pages/guides/minimizing-bundle-size/minimizing-bundle-size-ja.md @@ -18,13 +18,13 @@ import { Button, TextField } from '@material-ui/core'; ## 開発環境 -開発時のバンドルはライブラリの全てを含むので、 **遅い起動時間**の原因となります。 これは、特に`@material-ui/icons`からインポートする場合に顕著です。 起動時間は、上位からの名前指定インポートがない場合に比べて、約6倍遅い場合もあります。 これは、特に`@material-ui/icons`からインポートする場合に顕著です。 起動時間は、上位からの名前指定インポートがない場合に比べて、約6倍遅い場合もあります。 +開発時のバンドルはライブラリの全てを含むので、 **遅い起動時間**の原因となります。 これは、特に`@material-ui/icons`からインポートする場合に顕著です。 起動時間は、上位からの名前指定インポートがない場合に比べて、約6倍遅い場合もあります。 この課題を持っているのであれば、様々な対応を取ることができます。 ### 選択肢 1 -パス指定インポートを利用して、使用していないモジュールのインポートを避けることができます。 例えば: 例えば: 例えば: 例えば: +パス指定インポートを利用して、使用していないモジュールのインポートを避けることができます。 例えば: ```js // 🚀 早い! import Button from '@material-ui/core/Button'; @@ -37,7 +37,7 @@ import TextField from '@material-ui/core/TextField'; import { Button, TextField } from '@material-ui/core'; ``` -設定を必要としないので、この選択肢は全てのデモで利用しています。 コンポーネントを利用するパッケージ作成者には推奨されています。 設定を必要としないので、この選択肢は全てのデモで利用しています。 コンポーネントを利用するパッケージ作成者には推奨されています。 最高のDXとUXをもたらすアプローチは[選択肢 2](#option-2)をみましょう。 +設定を必要としないので、この選択肢は全てのデモで利用しています。 コンポーネントを利用するパッケージ作成者には推奨されています。 最高のDXとUXをもたらすアプローチは[選択肢 2](#option-2)をみましょう。 While importing directly in this manner doesn't use the exports in [the main file of `@material-ui/core`](https://unpkg.com/@material-ui/core), this file can serve as a handy reference as to which modules are public. @@ -59,7 +59,7 @@ import TabIndicator from '@material-ui/core/Tabs/TabIndicator'; // ^^^^^^^^^^^^ 3rd level ``` -`eslint`を使用している場合、 [`no-restricted-imports` ルール](https://eslint.org/docs/rules/no-restricted-imports)で問題のあるインポートを検知可能です。 以下の `.eslintrc`設定は、`@material-ui`からの問題のあるインポート文をハイライトします。 以下の `.eslintrc`設定は、`@material-ui`からの問題のあるインポート文をハイライトします。 以下の `.eslintrc`設定は、`@material-ui`からの問題のあるインポート文をハイライトします。 以下の `.eslintrc`設定は、`@material-ui`からの問題のあるインポート文をハイライトします。 +`eslint`を使用している場合、 [`no-restricted-imports` ルール](https://eslint.org/docs/rules/no-restricted-imports)で問題のあるインポートを検知可能です。 以下の `.eslintrc`設定は、`@material-ui`からの問題のあるインポート文をハイライトします。 ```json { @@ -80,7 +80,7 @@ import TabIndicator from '@material-ui/core/Tabs/TabIndicator'; - UX: Babelプラグインは、バンドラーがサポートしていない場合でも、トップレベルのtree-shakingを有効にします。 - DX: Babelプラグインは、開発モードでも選択肢1と同様の起動時間の速さをもたらします。 -- この記法は、一つのインポート文で複数のモジュールに対応するのでコードの重複をへらします。 この記法は、一つのインポート文で複数のモジュールに対応するのでコードの重複をへらします。 全体として、読みやすく、新しいモジュールをimportする際に間違いをする機会を削減します。 +- この記法は、一つのインポート文で複数のモジュールに対応するのでコードの重複をへらします。 全体として、読みやすく、新しいモジュールをimportする際に間違いをする機会を削減します。 ```js import { Button, TextField } from '@material-ui/core'; @@ -105,6 +105,7 @@ import { Button, TextField } from '@material-ui/core'; 'babel-plugin-import', { libraryName: '@material-ui/core', + libraryDirectory: '', camel2DashComponentName: false, }, 'core', @@ -113,6 +114,7 @@ import { Button, TextField } from '@material-ui/core'; 'babel-plugin-import', { libraryName: '@material-ui/icons', + libraryDirectory: '', camel2DashComponentName: false, }, 'icons', @@ -157,10 +159,11 @@ Create React Appを使用している場合、`.babelrc`の利用を許容して `config-overrides.js`をルートディレクトリ に作成します。 ```js -"scripts": { -- "start": "react-scripts start" -+ "start": "react-app-rewired start" - } +/* config-overrides.js */ +/* eslint-disable react-hooks/rules-of-hooks */ +const { useBabelRc, override } = require('customize-cra'); + +module.exports = override(useBabelRc()); ``` 必要に応じて、`babel-plugin-import`は`.babelrc`の代わりに、 [configuration](https://github.com/arackaf/customize-cra/blob/master/api.md#fixbabelimportslibraryname-options)を使うことで、`config-overrides.js`を通して設定可能です。 @@ -179,24 +182,6 @@ Modify your `package.json` start command: } ``` -注意: このようなエラーが発生する場合があります。 - -> Module not found: Can't resolve '@material-ui/core/makeStyles' in '/your/project' - -これは、 `@material-ui/styles`が `core`を通して、再エクスポートされているからです。しかし、全てのインポートは許可されていません。 - -このようにインポートをしている - -```js -import { makeStyles, createStyles } from '@material-ui/core'; -``` - -修正は簡単です、インポートを別々にします。 - -```js -import { makeStyles, createStyles } from '@material-ui/core/styles'; -``` - 大幅に速い起動時間をお楽しみください。 #### 2. すべてのインポートを変換する diff --git a/docs/src/pages/guides/minimizing-bundle-size/minimizing-bundle-size-pt.md b/docs/src/pages/guides/minimizing-bundle-size/minimizing-bundle-size-pt.md index 63982ad4aa660d..01f7a064107390 100644 --- a/docs/src/pages/guides/minimizing-bundle-size/minimizing-bundle-size-pt.md +++ b/docs/src/pages/guides/minimizing-bundle-size/minimizing-bundle-size-pt.md @@ -105,6 +105,7 @@ Escolha um dos seguintes plugins: 'babel-plugin-import', { libraryName: '@material-ui/core', + libraryDirectory: '', camel2DashComponentName: false, }, 'core', @@ -113,6 +114,7 @@ Escolha um dos seguintes plugins: 'babel-plugin-import', { libraryName: '@material-ui/icons', + libraryDirectory: '', camel2DashComponentName: false, }, 'icons', @@ -155,10 +157,11 @@ Se você estiver usando Create React App, você precisará usar alguns projetos Crie um arquivo `config-overrides.js` na pasta raiz: ```js -"scripts": { -- "start": "react-scripts start" -+ "start": "react-app-rewired start" - } +/* config-overrides.js */ +/* eslint-disable react-hooks/rules-of-hooks */ +const { useBabelRc, override } = require('customize-cra'); + +module.exports = override(useBabelRc()); ``` Se você desejar, `babel-plugin-import` pode ser configurado através de `config-overrides.js` ao invés de `.babelrc` usando esta [configuração](https://github.com/arackaf/customize-cra/blob/master/api.md#fixbabelimportslibraryname-options). @@ -177,24 +180,6 @@ Modifique seu comando start no `package.json`: } ``` -Nota: Você pode se deparar com erros como estes: - -> Module not found: Can't resolve '@material-ui/core/makeStyles' in '/seu/projeto' - -Isso acontece porque `@material-ui/styles` é reexportado através do `core`, mas a importação completa não é permitida. - -Você tem uma importação como essa no seu código: - -```js -import { makeStyles, createStyles } from '@material-ui/core'; -``` - -A correção é simples, defina a importação separadamente: - -```js -import { makeStyles, createStyles } from '@material-ui/core/styles'; -``` - Desfrute do tempo de inicialização significativamente mais rápido. #### 2. Converta todas as suas importações diff --git a/docs/src/pages/guides/minimizing-bundle-size/minimizing-bundle-size-ru.md b/docs/src/pages/guides/minimizing-bundle-size/minimizing-bundle-size-ru.md index 30891204d79ddd..0db1c3ddd1fd0c 100644 --- a/docs/src/pages/guides/minimizing-bundle-size/minimizing-bundle-size-ru.md +++ b/docs/src/pages/guides/minimizing-bundle-size/minimizing-bundle-size-ru.md @@ -105,6 +105,7 @@ Pick one of the following plugins: 'babel-plugin-import', { libraryName: '@material-ui/core', + libraryDirectory: '', camel2DashComponentName: false, }, 'core', @@ -113,6 +114,7 @@ Pick one of the following plugins: 'babel-plugin-import', { libraryName: '@material-ui/icons', + libraryDirectory: '', camel2DashComponentName: false, }, 'icons', @@ -155,10 +157,11 @@ If you are using Create React App, you will need to use a couple of projects tha Create a `config-overrides.js` file in the root directory: ```js -"scripts": { -- "start": "react-scripts start" -+ "start": "react-app-rewired start" - } +/* config-overrides.js */ +/* eslint-disable react-hooks/rules-of-hooks */ +const { useBabelRc, override } = require('customize-cra'); + +module.exports = override(useBabelRc()); ``` If you wish, `babel-plugin-import` can be configured through `config-overrides.js` instead of `.babelrc` by using this [configuration](https://github.com/arackaf/customize-cra/blob/master/api.md#fixbabelimportslibraryname-options). @@ -177,24 +180,6 @@ Modify your `package.json` start command: } ``` -Note: You may run into errors like these: - -> Module not found: Can't resolve '@material-ui/core/makeStyles' in '/your/project' - -This is because `@material-ui/styles` is re-exported through `core`, but the full import is not allowed. - -You have an import like this in your code: - -```js -import { makeStyles, createStyles } from '@material-ui/core'; -``` - -The fix is simple, define the import separately: - -```js -import { makeStyles, createStyles } from '@material-ui/core/styles'; -``` - Enjoy significantly faster start times. #### 2. Convert all your imports diff --git a/docs/src/pages/guides/minimizing-bundle-size/minimizing-bundle-size-zh.md b/docs/src/pages/guides/minimizing-bundle-size/minimizing-bundle-size-zh.md index e23de24ee84818..0032c3a539e642 100644 --- a/docs/src/pages/guides/minimizing-bundle-size/minimizing-bundle-size-zh.md +++ b/docs/src/pages/guides/minimizing-bundle-size/minimizing-bundle-size-zh.md @@ -105,6 +105,7 @@ import { Button, TextField } from '@material-ui/core'; 'babel-plugin-import', { libraryName: '@material-ui/core', + libraryDirectory: '', camel2DashComponentName: false, }, 'core', @@ -113,6 +114,7 @@ import { Button, TextField } from '@material-ui/core'; 'babel-plugin-import', { libraryName: '@material-ui/icons', + libraryDirectory: '', camel2DashComponentName: false, }, 'icons', @@ -156,6 +158,7 @@ import { Button, TextField } from '@material-ui/core'; ```js /* config-overrides.js */ +/* eslint-disable react-hooks/rules-of-hooks */ const { useBabelRc, override } = require('customize-cra'); module.exports = override(useBabelRc()); @@ -177,24 +180,6 @@ module.exports = override(useBabelRc()); } ``` -注意:您可能会遇到如下错误: - -> Module not found: Can't resolve '@material-ui/core/makeStyles' in '/your/project' - -这是因为 `@material-ui/styles` 通过 `核心(core)` 重新导出,但是不允许完整的导入模块。 - -您的代码中可能存在这样的模块导入方式: - -```js -import { makeStyles, createStyles } from '@material-ui/core'; -``` - -要解决它也很简单,您只需要这样单独定义导入模块: - -```js -import { makeStyles, createStyles } from '@material-ui/core/styles'; -``` - 这样一来,你可以享受更快的启动时间了。 #### 2. 转换您的所有模块导入方式 diff --git a/docs/src/pages/guides/pickers-migration/pickers-migration-de.md b/docs/src/pages/guides/pickers-migration/pickers-migration-de.md index 7bf1d7664ac14d..2be4e33d4c5d94 100644 --- a/docs/src/pages/guides/pickers-migration/pickers-migration-de.md +++ b/docs/src/pages/guides/pickers-migration/pickers-migration-de.md @@ -8,7 +8,7 @@ This guide is an overview of the core concepts that were changed from pickers v3 ## Installation -You simply need to install the `@material-ui/lab` package if it's not already installed. Nothing more is required. +You need to install the `@material-ui/lab` package if it's not already installed. ⚠️ Make sure you have installed the latest version, `"@material-ui/lab": ^5.0.0-alpha.30"` or above. ## Importe diff --git a/docs/src/pages/guides/pickers-migration/pickers-migration-es.md b/docs/src/pages/guides/pickers-migration/pickers-migration-es.md index 2ea5d4249ad830..049f407d3bb912 100644 --- a/docs/src/pages/guides/pickers-migration/pickers-migration-es.md +++ b/docs/src/pages/guides/pickers-migration/pickers-migration-es.md @@ -8,7 +8,7 @@ This guide is an overview of the core concepts that were changed from pickers v3 ## Instalación -You simply need to install the `@material-ui/lab` package if it's not already installed. Nothing more is required. +You need to install the `@material-ui/lab` package if it's not already installed. ⚠️ Make sure you have installed the latest version, `"@material-ui/lab": ^5.0.0-alpha.30"` or above. ## Importaciones diff --git a/docs/src/pages/guides/pickers-migration/pickers-migration-fr.md b/docs/src/pages/guides/pickers-migration/pickers-migration-fr.md index d1d7127adcb636..d6cc2eb84a27b5 100644 --- a/docs/src/pages/guides/pickers-migration/pickers-migration-fr.md +++ b/docs/src/pages/guides/pickers-migration/pickers-migration-fr.md @@ -1,18 +1,18 @@ -# Migration from @material-ui-pickers +# Migration depuis @material-ui-pickers -<p class="description">@material-ui/pickers was moved to the @material-ui/lab.</p> +<p class="description">@material-ui/pickers a été déplacé vers le @material-ui/lab.</p> -> **⚠️ The date picker components were rewritten**. In most places, the logic was rewritten from scratch, so it isn't possible to maintain the whole list of changes. Here's an overview of the most important concepts that were changed. If you are going to upgrade, the easiest way might be to go through each picker usage in your codebase, and rewrite them one at a time. Don't forget to run your tests after each! +> **⚠️ Les composants du sélecteur de date ont été réécrit**. Dans la plupart des endroits, la logique a été réécrite à partir de zéro, donc il n'est pas possible de maintenir la liste complète des changements. Voici un aperçu des concepts les plus importants qui ont été changés. Si vous voulez mettre à jour, la façon la plus simple pourrait être de passer par chaque utilisation du sélecteur dans votre codebase, et les réécrire un à la fois. N'oubliez pas d'exécuter vos tests après chaque! -This guide is an overview of the core concepts that were changed from pickers v3.2.10. +Ce guide est un aperçu des concepts de base qui ont été changés des sélecteurs v3.2.10. ## Installation -You simply need to install the `@material-ui/lab` package if it's not already installed. Nothing more is required. +You simply need to install the `@material-ui/lab` package if it's not already installed. ⚠️ Make sure you have installed the latest version, `"@material-ui/lab": ^5.0.0-alpha.30"` or above. ## Importations -The `keyboard` version of pickers is no longer published. All versions of mobile and desktop pickers implement keyboard input for accessibility. +La version `keyboard` des sélecteurs n'est plus publiée. Toutes les versions des sélecteurs de téléphones mobiles et de bureau implémentent l'entrée du clavier pour l'accessibilité. ```diff -import { KeyboardDatePicker } from '@material-ui/pickers'; @@ -22,12 +22,12 @@ The `keyboard` version of pickers is no longer published. All versions of mobile +<DatePicker /> ``` -Also, instead of providing a `variant` prop, these were moved to different imports, meaning that your bundle won't include `Dialog` if you are using only the desktop picker. +De plus, au lieu de fournir une prop `variante` , ceux-ci ont été déplacés vers des importations différentes, ce qui signifie que votre paquet n'inclura pas `Dialog` si vous n'utilisez que le sélecteur de bureau. -- `<DesktopDatePicker />` – Only desktop view. -- `<MobileDatePicker />` – Only mobile view. -- `<DatePicker />` – Mobile or Desktop view according to the user **pointer** preference. -- `<StaticDatePicker />` – The picker view itself, without input or any other wrapper. +- `<DesktopDatePicker />` – Uniquement la vue bureau. +- `<MobileDatePicker />` – Seulement la vue mobile. +- `<DatePicker />` – Vue mobile ou bureau selon la préférence du pointeur **utilisateur**. +- `<StaticDatePicker />` – La vue du sélecteur elle-même, sans entrée ou aucun autre emballage. ```diff -import { DatePicker } from '@material-ui/pickers'; @@ -37,20 +37,20 @@ Also, instead of providing a `variant` prop, these were moved to different impor +<DesktopDatePicker /> ``` -The same convention applies to `TimePicker` – `<DesktopTimePicker>` and `<MobileTimePicker />`. +La même convention s'applique à `TimePicker` – `<DesktopTimePicker>` et `<MobileTimePicker />`. ## MuiPickersUtilsProvider -The `MuiPickersUtilsProvider` was removed in favor of `LocalizationProvider`. Also, pickers do not require you to install date-io adapters manually. Everything is included with the `lab`. +Le `MuiPickersUtilsProvider` a été supprimé pour `LocalizationProvider`. De plus, les sélecteurs ne vous demandent pas d'installer les adaptateurs date-io manuellement. Tout est inclus avec le `lab`. -❌ Before: +❌ Avant: ```js import AdapterDateFns from '@date-io/date-fns'; import { MuiPickersUtilsProvider } from '@material-ui/pickers'; ``` -✅ After: +✅ Après : ```jsx import AdapterDateFns from '@material-ui/lab/AdapterDateFns'; @@ -68,14 +68,14 @@ function App() { ## Render input -We introduced a new **required** `renderInput` prop. This simplifies using non-Material-UI text field input components. +Nous avons introduit une nouvelle propriété **requise** `renderInput`. Cela simplifie l'utilisation de composants de saisie de champ de texte non Material-UI. ```jsx <DatePicker renderInput={(props) => <TextField {...props} />} /> <TimePicker renderInput={(props) => <TextField {...props} />} /> ``` -Previously, props were spread on the `<TextField />` component. From now on you will need to use the new `renderInput` prop to provide these: +Auparavant, les propriétés étaient réparties sur le composant `<TextField />`. À partir de maintenant, vous devrez utiliser la nouvelle propriété `renderInput` pour fournir ceci: ```diff <DatePicker @@ -85,13 +85,13 @@ Previously, props were spread on the `<TextField />` component. From now on you /> ``` -## State management +## Gestion des états -The state/value management logic for pickers was rewritten from scratch. Pickers will now call the `onChange` prop when each view of the date picker ends is completed. The `onError` handler is also completely different. Triple-check your pickers with forms integration, because form-integration issues can be subtle. +La logique de gestion de l'état/des valeurs pour les sélecteurs a été réécrite à partir de zéro. Les sélecteurs appelleront maintenant la prop `onChange` lorsque chaque vue du sélecteur de date se terminera. Le gestionnaire `onError` est également complètement différent. Triple-vérifiez vos sélecteurs avec l'intégration de formulaires, car les problèmes d'intégration de formulaire peuvent être subtiles. -## No required mask +## Aucun mask requis -Mask is no longer required. Also, if your provided mask is not valid, pickers will just ignore the mask, and allow arbitrary input. +Le mask n'est plus requis. En outre, si le mask fourni n'est pas valide, les sélecteurs ignoreront simplement le mask et autoriseront une entrée arbitraire. ```jsx <DatePicker @@ -112,12 +112,12 @@ Mask is no longer required. Also, if your provided mask is not valid, pickers wi /> ``` -## And many more +## Et bien plus encore ! - ```diff <DatePicker - format="DD-MMM-YYYY" + inputFormat="DD-MMM-YYYY" ``` -There are many changes, be careful, make sure your tests, and build pass. In the event you have an advanced usage of the date picker, it will likely be simpler to rewrite it. +Il y a beaucoup de changements, soyez prudent, assurez-vous que vos tests et votre build réussissent. Si vous avez une utilisation avancée du sélecteur de date, il sera probablement plus simple de le réécrire. -Please open a pull request to improve the guide if you notice an opportunity for doing such. +Veuillez ouvrir une pull request pour améliorer le guide si vous remarquez une opportunité de le faire. diff --git a/docs/src/pages/guides/pickers-migration/pickers-migration-ja.md b/docs/src/pages/guides/pickers-migration/pickers-migration-ja.md index 41798aa1bb79c5..64c44a138e1e76 100644 --- a/docs/src/pages/guides/pickers-migration/pickers-migration-ja.md +++ b/docs/src/pages/guides/pickers-migration/pickers-migration-ja.md @@ -8,7 +8,7 @@ This guide is an overview of the core concepts that were changed from pickers v3 ## インストール -You simply need to install the `@material-ui/lab` package if it's not already installed. Nothing more is required. +You need to install the `@material-ui/lab` package if it's not already installed. ⚠️ Make sure you have installed the latest version, `"@material-ui/lab": ^5.0.0-alpha.30"` or above. ## Imports diff --git a/docs/src/pages/guides/pickers-migration/pickers-migration-pt.md b/docs/src/pages/guides/pickers-migration/pickers-migration-pt.md index 07655b403d0559..361a3fa91c77fd 100644 --- a/docs/src/pages/guides/pickers-migration/pickers-migration-pt.md +++ b/docs/src/pages/guides/pickers-migration/pickers-migration-pt.md @@ -8,7 +8,7 @@ Este guia é uma visão geral dos conceitos principais que foram alterados de se ## Instalação -Você simplesmente precisa instalar o pacote `@material-ui/lab` se ainda não estiver instalado. Nada mais é necessário. +You need to install the `@material-ui/lab` package if it's not already installed. ⚠️ Make sure you have installed the latest version, `"@material-ui/lab": ^5.0.0-alpha.30"` or above. ## Importações diff --git a/docs/src/pages/guides/pickers-migration/pickers-migration-ru.md b/docs/src/pages/guides/pickers-migration/pickers-migration-ru.md index 7e1a0059f8bb55..0449fd8508778a 100644 --- a/docs/src/pages/guides/pickers-migration/pickers-migration-ru.md +++ b/docs/src/pages/guides/pickers-migration/pickers-migration-ru.md @@ -8,7 +8,7 @@ This guide is an overview of the core concepts that were changed from pickers v3 ## Инструкция по установке -You simply need to install the `@material-ui/lab` package if it's not already installed. Nothing more is required. +You need to install the `@material-ui/lab` package if it's not already installed. ⚠️ Make sure you have installed the latest version, `"@material-ui/lab": ^5.0.0-alpha.30"` or above. ## Импорт diff --git a/docs/src/pages/guides/pickers-migration/pickers-migration-zh.md b/docs/src/pages/guides/pickers-migration/pickers-migration-zh.md index 6a15e7584d860a..6344bc29423a83 100644 --- a/docs/src/pages/guides/pickers-migration/pickers-migration-zh.md +++ b/docs/src/pages/guides/pickers-migration/pickers-migration-zh.md @@ -8,7 +8,7 @@ ## 安装 -如果你还没有安装 `@material-ui/lab` 包的话,那么安装一下就可以了。 没有更多的依赖需求。 +You need to install the `@material-ui/lab` package if it's not already installed. ⚠️ Make sure you have installed the latest version, `"@material-ui/lab": ^5.0.0-alpha.30"` or above. ## 导入 diff --git a/docs/src/pages/guides/responsive-ui/responsive-ui-de.md b/docs/src/pages/guides/responsive-ui/responsive-ui-de.md index fb88ce185b7f1c..d8776b32c62323 100644 --- a/docs/src/pages/guides/responsive-ui/responsive-ui-de.md +++ b/docs/src/pages/guides/responsive-ui/responsive-ui-de.md @@ -8,4 +8,3 @@ - [Container](/components/container/): Der Container zentriert Ihren Inhalt horizontal. Er ist das grundlegendste Layoutelement. - [ Rasterpunkte](/customization/breakpoints/): API, die die Verwendung von Rasterpunkten in einer Vielzahl von Kontexten ermöglicht. - [useMediaQuery](/components/use-media-query/): Dies ist ein CSS-Media-Abfrage-Hook für React. Es wartet auf Übereinstimmungen mit einer CSS-Medienabfrage. -- [Hidden](/components/hidden/): Wechseln Sie mit unseren versteckten Komponenten schnell und ansprechend den Sichtbarkeitswert von Komponenten und mehr. diff --git a/docs/src/pages/guides/responsive-ui/responsive-ui-es.md b/docs/src/pages/guides/responsive-ui/responsive-ui-es.md index 54401ea36894e4..b9e6d582f20f31 100644 --- a/docs/src/pages/guides/responsive-ui/responsive-ui-es.md +++ b/docs/src/pages/guides/responsive-ui/responsive-ui-es.md @@ -8,4 +8,3 @@ - [ Container](/components/container/): El Container(contenedor) centra su contenido horizontalmente. Es el elemento más básico del layout. - [ Breakpoints ](/customization/breakpoints/): API que permite el uso de puntos de interrupción en una amplia variedad de contextos. - [ useMediaQuery ](/components/use-media-query/): Este es un enlace de consulta de medios CSS para React. It listens for matches to a CSS media query. -- [ Hidden](/components/hidden/): Cambia rápida y receptivamente el valor de visibilidad de los componentes y más con nuestras utilidades hidden(oculto). diff --git a/docs/src/pages/guides/responsive-ui/responsive-ui-fr.md b/docs/src/pages/guides/responsive-ui/responsive-ui-fr.md index 52fb7354cb6956..3633f3f96b7dd9 100644 --- a/docs/src/pages/guides/responsive-ui/responsive-ui-fr.md +++ b/docs/src/pages/guides/responsive-ui/responsive-ui-fr.md @@ -8,4 +8,3 @@ Les [layouts responsive](https://material.io/design/layout/responsive-layout-gri - [Container](/components/container/): The container centers your content horizontally. C'est l'élément de mise en page le plus basique. - [Breakpoints](/customization/breakpoints/): API that enables the use of breakpoints in a wide variety of contexts. - [useMediaQuery](/components/use-media-query/) : Ceci est un hook media query CSS pour React ; It listens for matches to a CSS media query. It listens for matches to a CSS media query. -- [Hidden](/components/hidden/): Quickly and responsively toggle the visibility value of components and more with our hidden utilities. diff --git a/docs/src/pages/guides/responsive-ui/responsive-ui-ja.md b/docs/src/pages/guides/responsive-ui/responsive-ui-ja.md index 0007a72fd212ff..ef2d04a986a5b1 100644 --- a/docs/src/pages/guides/responsive-ui/responsive-ui-ja.md +++ b/docs/src/pages/guides/responsive-ui/responsive-ui-ja.md @@ -1,11 +1,10 @@ # レスポンシブUI -<p class="description">Material Design layouts encourage consistency across platforms, environments, and screen sizes by using uniform elements and spacing.</p> +<p class="description">Material Designレイアウトは、統一された要素と間隔を使用することで、プラットフォーム、環境、および画面サイズ間の一貫性を促進します。</p> -[Responsive layouts](https://material.io/design/layout/responsive-layout-grid.html) in Material Design adapt to any possible screen size. We provide the following helpers to make the UI responsive: +Material Designの[レスポンシブレイアウト](https://material.io/design/layout/responsive-layout-grid.html) は、あらゆる画面サイズに適応します。 UIをレスポンシブにするために以下のヘルパーを提供しています: -- [Grid](/components/grid/): The Material Design responsive layout grid adapts to screen size and orientation, ensuring consistency across layouts. -- [Container](/components/container/): The container centers your content horizontally. それが最も基本的なレイアウト要素です。 -- [Breakpoints](/customization/breakpoints/): API that enables the use of breakpoints in a wide variety of contexts. -- [useMediaQuery](/components/use-media-query/): This is a CSS media query hook for React. CSSメディアクエリへの一致をリッスンします。 -- [Hidden](/components/hidden/): Quickly and responsively toggle the visibility value of components and more with our hidden utilities. +- [Grid](/components/grid/): Material Designのレスポンシブ・レイアウト・グリッドは、画面サイズと向きに適応し、レイアウト間の一貫性を保証します。 +- [Container](/components/container/): コンテナは、コンテンツを水平方向に中央に配置します。 それが最も基本的なレイアウト要素です。 +- [Breakpoints](/customization/breakpoints/): さまざまなコンテキストでブレークポイントを使用できるようにするAPI。 +- [useMediaQuery](/components/use-media-query/): React用のCSSメディアクエリフックです。 CSSメディアクエリへの一致をリッスンします。 diff --git a/docs/src/pages/guides/responsive-ui/responsive-ui-pt.md b/docs/src/pages/guides/responsive-ui/responsive-ui-pt.md index d223667b421659..aba5d027f7fd91 100644 --- a/docs/src/pages/guides/responsive-ui/responsive-ui-pt.md +++ b/docs/src/pages/guides/responsive-ui/responsive-ui-pt.md @@ -8,4 +8,3 @@ - [Container](/components/container/): O contêiner centraliza seu conteúdo horizontalmente. É o elemento de leiaute mais básico. - [Pontos de quebra](/customization/breakpoints/): API que permite o uso de pontos de quebra em uma ampla variedade de contextos. - [useMediaQuery](/components/use-media-query/): Este é um hook CSS de consulta de mídia para React. Ele ouve correspondências para uma consulta de mídia no CSS. -- [Hidden](/components/hidden/): Modifique rapidamente e de forma responsiva a visibilidade dos componentes e muito mais com nosso utilitário hidden. diff --git a/docs/src/pages/guides/responsive-ui/responsive-ui-ru.md b/docs/src/pages/guides/responsive-ui/responsive-ui-ru.md index 9cba03b6445725..ad1c67ca36abd6 100644 --- a/docs/src/pages/guides/responsive-ui/responsive-ui-ru.md +++ b/docs/src/pages/guides/responsive-ui/responsive-ui-ru.md @@ -8,4 +8,3 @@ - [Container](/components/container/): Контейнер центрирует ваш контент по горизонтали. Это базовый элемент всех макетов. - [Breakpoints](/customization/breakpoints/): API, позволяющий использовать контрольные точки в широком диапазоне контекстов. - [useMediaQuery](/components/use-media-query/): Это хук медиа-запроса для React. Он ожидает(слушает) совпадения с медиа-запросом CSS. -- [Hidden](/components/hidden/): Быстро и оперативно управляет видимостью компонентов. diff --git a/docs/src/pages/guides/responsive-ui/responsive-ui-zh.md b/docs/src/pages/guides/responsive-ui/responsive-ui-zh.md index 673fc171c606b8..558b481182c236 100644 --- a/docs/src/pages/guides/responsive-ui/responsive-ui-zh.md +++ b/docs/src/pages/guides/responsive-ui/responsive-ui-zh.md @@ -8,4 +8,3 @@ Material Design 中的 [响应式布局](https://material.io/design/layout/respo - [Container](/components/container/):容器可以将您页面的内容水平居中。 这是最基本的布局元素。 - [Breakpoints](/customization/breakpoints/):它的 API 让您可以在不同的语义环境中使用断点。 - [useMediaQuery](/components/use-media-query/) :这是 React 的 CSS 媒体查询 hook。 它监听与 CSS 媒体查询的匹配的内容。 -- [Hidden](/components/hidden/):使用我们隐藏的实用程序来快速并响应式地切换元素的显隐。 diff --git a/docs/src/pages/guides/right-to-left/right-to-left-de.md b/docs/src/pages/guides/right-to-left/right-to-left-de.md index d608508f78998d..f4b4f46fa5d06e 100644 --- a/docs/src/pages/guides/right-to-left/right-to-left-de.md +++ b/docs/src/pages/guides/right-to-left/right-to-left-de.md @@ -12,6 +12,20 @@ Stellen Sie sicher, dass das `dir` Attribut in body gesetzt wird, sonst werden n <body dir="rtl"> ``` +As an alternative to the above, you can also wrap your application in an element with the `dir` attribute: + +```jsx +function App() { + return ( + <div dir="rtl"> + <MyComponent /> + </div> + ); +} +``` + +This can be helpful for creating components to toggle language settings in the live application. + ### 2. Theme Legen Sie die Richtung in Ihrem benutzerdefinierten Theme fest: @@ -51,17 +65,15 @@ Nachdem Sie eine neue JSS-Instanz mit dem Plugin erstellt haben, müssen Sie die ```jsx import { create } from 'jss'; import rtl from 'jss-rtl'; -import { StylesProvider, jssPreset } from '@material-ui/core/styles'; +import { StylesProvider, jssPreset } from '@material-ui/styles'; // Configure JSS -const jss = create({ plugins: [...jssPreset().plugins, rtl()] }); +const jss = create({ + plugins: [...jssPreset().plugins, rtl()], +}); function RTL(props) { - return ( - <StylesProvider jss={jss}> - {props.children} - </StylesProvider> - ); + return <StylesProvider jss={jss}>{props.children}</StylesProvider>; } ``` diff --git a/docs/src/pages/guides/right-to-left/right-to-left-es.md b/docs/src/pages/guides/right-to-left/right-to-left-es.md index e31cde7ae99c71..b875ee0e961373 100644 --- a/docs/src/pages/guides/right-to-left/right-to-left-es.md +++ b/docs/src/pages/guides/right-to-left/right-to-left-es.md @@ -12,6 +12,20 @@ Asegúrese de que el atributo `dir` está establecido en el body, de lo contrari <body dir="rtl"> ``` +As an alternative to the above, you can also wrap your application in an element with the `dir` attribute: + +```jsx +function App() { + return ( + <div dir="rtl"> + <MyComponent /> + </div> + ); +} +``` + +This can be helpful for creating components to toggle language settings in the live application. + ### 2. Tema Establece la dirección en su tema personalizado: @@ -51,17 +65,15 @@ Una vez que haya creado una nueva instancia JSS con el plugin, necesitará poner ```jsx import { create } from 'jss'; import rtl from 'jss-rtl'; -import { StylesProvider, jssPreset } from '@material-ui/core/styles'; +import { StylesProvider, jssPreset } from '@material-ui/styles'; // Configure JSS -const jss = create({ plugins: [...jssPreset().plugins, rtl()] }); +const jss = create({ + plugins: [...jssPreset().plugins, rtl()], +}); function RTL(props) { - return ( - <StylesProvider jss={jss}> - {props.children} - </StylesProvider> - ); + return <StylesProvider jss={jss}>{props.children}</StylesProvider>; } ``` diff --git a/docs/src/pages/guides/right-to-left/right-to-left-fr.md b/docs/src/pages/guides/right-to-left/right-to-left-fr.md index d793383503a9e5..3a80155ad77c3b 100644 --- a/docs/src/pages/guides/right-to-left/right-to-left-fr.md +++ b/docs/src/pages/guides/right-to-left/right-to-left-fr.md @@ -12,6 +12,20 @@ Make sure the `dir` attribute is set on the body, otherwise native components wi <body dir="rtl"> ``` +As an alternative to the above, you can also wrap your application in an element with the `dir` attribute: + +```jsx +function App() { + return ( + <div dir="rtl"> + <MyComponent /> + </div> + ); +} +``` + +You need this JSS plugin to flip the styles: [jss-rtl](https://github.com/alitaheri/jss-rtl). + ### 2. Thème Set the direction in your custom theme: diff --git a/docs/src/pages/guides/right-to-left/right-to-left-ja.md b/docs/src/pages/guides/right-to-left/right-to-left-ja.md index 5096ba732d429b..ebd4483638f4c4 100644 --- a/docs/src/pages/guides/right-to-left/right-to-left-ja.md +++ b/docs/src/pages/guides/right-to-left/right-to-left-ja.md @@ -12,6 +12,20 @@ Make sure the `dir` attribute is set on the body, otherwise native components wi <body dir="rtl"> ``` +As an alternative to the above, you can also wrap your application in an element with the `dir` attribute: + +```jsx +function App() { + return ( + <div dir="rtl"> + <MyComponent /> + </div> + ); +} +``` + +This can be helpful for creating components to toggle language settings in the live application. + ### 2. テーマ Set the direction in your custom theme: @@ -51,17 +65,15 @@ Once you have created a new JSS instance with the plugin, you need to make it av ```jsx import { create } from 'jss'; import rtl from 'jss-rtl'; -import { StylesProvider, jssPreset } from '@material-ui/core/styles'; +import { StylesProvider, jssPreset } from '@material-ui/styles'; // Configure JSS -const jss = create({ plugins: [...jssPreset().plugins, rtl()] }); +const jss = create({ + plugins: [...jssPreset().plugins, rtl()], +}); function RTL(props) { - return ( - <StylesProvider jss={jss}> - {props.children} - </StylesProvider> - ); + return <StylesProvider jss={jss}>{props.children}</StylesProvider>; } ``` diff --git a/docs/src/pages/guides/right-to-left/right-to-left-pt.md b/docs/src/pages/guides/right-to-left/right-to-left-pt.md index e5acaa07de054e..ad44d56e6d20fb 100644 --- a/docs/src/pages/guides/right-to-left/right-to-left-pt.md +++ b/docs/src/pages/guides/right-to-left/right-to-left-pt.md @@ -12,6 +12,20 @@ Certifique-se de que o atributo `dir` é definido no corpo (body), caso contrár <body dir="rtl"> ``` +As an alternative to the above, you can also wrap your application in an element with the `dir` attribute: + +```jsx +function App() { + return ( + <div dir="rtl"> + <MyComponent /> + </div> + ); +} +``` + +This can be helpful for creating components to toggle language settings in the live application. + ### 2. Tema Defina a direção no seu tema customizado: @@ -51,17 +65,15 @@ Depois de criar uma nova instância do JSS com o plugin, você precisará dispon ```jsx import { create } from 'jss'; import rtl from 'jss-rtl'; -import { StylesProvider, jssPreset } from '@material-ui/core/styles'; +import { StylesProvider, jssPreset } from '@material-ui/styles'; -// Configure o JSS -const jss = create({ plugins: [...jssPreset().plugins, rtl()] }); +// Configure JSS +const jss = create({ + plugins: [...jssPreset().plugins, rtl()], +}); function RTL(props) { - return ( - <StylesProvider jss={jss}> - {props.children} - </StylesProvider> - ); + return <StylesProvider jss={jss}>{props.children}</StylesProvider>; } ``` diff --git a/docs/src/pages/guides/right-to-left/right-to-left-ru.md b/docs/src/pages/guides/right-to-left/right-to-left-ru.md index 0fa4b8d9451785..fb9eddc7e6b92d 100644 --- a/docs/src/pages/guides/right-to-left/right-to-left-ru.md +++ b/docs/src/pages/guides/right-to-left/right-to-left-ru.md @@ -12,6 +12,20 @@ Make sure the `dir` attribute is set on the body, otherwise native components wi <body dir="rtl"> ``` +As an alternative to the above, you can also wrap your application in an element with the `dir` attribute: + +```jsx +function App() { + return ( + <div dir="rtl"> + <MyComponent /> + </div> + ); +} +``` + +This can be helpful for creating components to toggle language settings in the live application. + ### 2. Темы Set the direction in your custom theme: @@ -51,17 +65,15 @@ Once you have created a new JSS instance with the plugin, you need to make it av ```jsx import { create } from 'jss'; import rtl from 'jss-rtl'; -import { StylesProvider, jssPreset } from '@material-ui/core/styles'; +import { StylesProvider, jssPreset } from '@material-ui/styles'; // Configure JSS -const jss = create({ plugins: [...jssPreset().plugins, rtl()] }); +const jss = create({ + plugins: [...jssPreset().plugins, rtl()], +}); function RTL(props) { - return ( - <StylesProvider jss={jss}> - {props.children} - </StylesProvider> - ); + return <StylesProvider jss={jss}>{props.children}</StylesProvider>; } ``` diff --git a/docs/src/pages/guides/right-to-left/right-to-left-zh.md b/docs/src/pages/guides/right-to-left/right-to-left-zh.md index 7bdde6a706ae03..ac2ec473d4ab36 100644 --- a/docs/src/pages/guides/right-to-left/right-to-left-zh.md +++ b/docs/src/pages/guides/right-to-left/right-to-left-zh.md @@ -12,6 +12,20 @@ <body dir="rtl"> ``` +As an alternative to the above, you can also wrap your application in an element with the `dir` attribute: + +```jsx +function App() { + return ( + <div dir="rtl"> + <MyComponent /> + </div> + ); +} +``` + +This can be helpful for creating components to toggle language settings in the live application. + ### 2. 主题 在您自定义的主题中设置方向: @@ -36,7 +50,7 @@ npm install jss-rtl npm install stylis-plugin-rtl ``` -**Note**: Only `emotion` is compatible with version 2 of the plugin. `styled-components` requires version 1. If you are using `styled-components` as styled engine, make sure to install the correct version. +**Note**: Only `emotion` is compatible with version 2 of the plugin. `styled-components` requires version 1. If you are using `styled-components` as styled engine, make sure to install the correct version. `styled-components` requires version 1. If you are using `styled-components` as styled engine, make sure to install the correct version. 在你的项目中安装了该插件后,Material-UI 组件仍然需要通过你使用的样式引擎实例来加载它。 下面的指南讲述了如何进行加载。 @@ -51,9 +65,9 @@ npm install stylis-plugin-rtl ```jsx import { create } from 'jss'; import rtl from 'jss-rtl'; -import { StylesProvider, jssPreset } from '@material-ui/core/styles'; +import { StylesProvider, jssPreset } from '@material-ui/styles'; -// 配置 JSS +// Configure JSS const jss = create({ plugins: [...jssPreset().plugins, rtl()], }); diff --git a/docs/src/pages/guides/routing/ButtonDemo.js b/docs/src/pages/guides/routing/ButtonDemo.js index 1fc380f3638f1b..9cd07b4a35674a 100644 --- a/docs/src/pages/guides/routing/ButtonDemo.js +++ b/docs/src/pages/guides/routing/ButtonDemo.js @@ -1,15 +1,10 @@ import * as React from 'react'; -import Box from '@material-ui/core/Box'; import Button from '@material-ui/core/Button'; -const preventDefault = (event) => event.preventDefault(); - export default function ButtonDemo() { return ( - <Box role="presentation" onClick={preventDefault}> - <Button href="/" variant="contained"> - Link - </Button> - </Box> + <Button href="/" variant="contained"> + Link + </Button> ); } diff --git a/docs/src/pages/guides/routing/ButtonDemo.tsx b/docs/src/pages/guides/routing/ButtonDemo.tsx index eee2bfa849af0f..9cd07b4a35674a 100644 --- a/docs/src/pages/guides/routing/ButtonDemo.tsx +++ b/docs/src/pages/guides/routing/ButtonDemo.tsx @@ -1,15 +1,10 @@ import * as React from 'react'; -import Box from '@material-ui/core/Box'; import Button from '@material-ui/core/Button'; -const preventDefault = (event: React.SyntheticEvent) => event.preventDefault(); - export default function ButtonDemo() { return ( - <Box role="presentation" onClick={preventDefault}> - <Button href="/" variant="contained"> - Link - </Button> - </Box> + <Button href="/" variant="contained"> + Link + </Button> ); } diff --git a/docs/src/pages/guides/routing/ButtonRouter.js b/docs/src/pages/guides/routing/ButtonRouter.js index da65000ddd285e..55d9c68798b29a 100644 --- a/docs/src/pages/guides/routing/ButtonRouter.js +++ b/docs/src/pages/guides/routing/ButtonRouter.js @@ -4,7 +4,7 @@ import { Link as RouterLink } from 'react-router-dom'; import Button from '@material-ui/core/Button'; const LinkBehavior = React.forwardRef((props, ref) => ( - <RouterLink ref={ref} to="/getting-started/installation/" {...props} /> + <RouterLink ref={ref} to="/" {...props} role={undefined} /> )); export default function ButtonRouter() { @@ -15,7 +15,7 @@ export default function ButtonRouter() { With prop forwarding </Button> <br /> - <Button component={LinkBehavior}>Without prop forwarding</Button> + <Button component={LinkBehavior}>With inlining</Button> </Router> </div> ); diff --git a/docs/src/pages/guides/routing/ButtonRouter.tsx b/docs/src/pages/guides/routing/ButtonRouter.tsx index 0cbcb17272d082..db63d6493a85cb 100644 --- a/docs/src/pages/guides/routing/ButtonRouter.tsx +++ b/docs/src/pages/guides/routing/ButtonRouter.tsx @@ -4,9 +4,7 @@ import { Link as RouterLink, LinkProps as RouterLinkProps } from 'react-router-d import Button from '@material-ui/core/Button'; const LinkBehavior = React.forwardRef<any, Omit<RouterLinkProps, 'to'>>( - (props, ref) => ( - <RouterLink ref={ref} to="/getting-started/installation/" {...props} /> - ), + (props, ref) => <RouterLink ref={ref} to="/" {...props} role={undefined} />, ); export default function ButtonRouter() { @@ -17,7 +15,7 @@ export default function ButtonRouter() { With prop forwarding </Button> <br /> - <Button component={LinkBehavior}>Without prop forwarding</Button> + <Button component={LinkBehavior}>With inlining</Button> </Router> </div> ); diff --git a/docs/src/pages/guides/routing/LinkDemo.js b/docs/src/pages/guides/routing/LinkDemo.js index fec5638e0ab1de..9a05cd1767c97c 100644 --- a/docs/src/pages/guides/routing/LinkDemo.js +++ b/docs/src/pages/guides/routing/LinkDemo.js @@ -2,11 +2,9 @@ import * as React from 'react'; import Link from '@material-ui/core/Link'; import Box from '@material-ui/core/Box'; -const preventDefault = (event) => event.preventDefault(); - export default function LinkDemo() { return ( - <Box sx={{ typography: 'body1' }} role="presentation" onClick={preventDefault}> + <Box sx={{ typography: 'body1' }}> <Link href="/">Link</Link> </Box> ); diff --git a/docs/src/pages/guides/routing/LinkDemo.tsx b/docs/src/pages/guides/routing/LinkDemo.tsx index 5fba35c5a8e814..9a05cd1767c97c 100644 --- a/docs/src/pages/guides/routing/LinkDemo.tsx +++ b/docs/src/pages/guides/routing/LinkDemo.tsx @@ -2,11 +2,9 @@ import * as React from 'react'; import Link from '@material-ui/core/Link'; import Box from '@material-ui/core/Box'; -const preventDefault = (event: React.SyntheticEvent) => event.preventDefault(); - export default function LinkDemo() { return ( - <Box sx={{ typography: 'body1' }} role="presentation" onClick={preventDefault}> + <Box sx={{ typography: 'body1' }}> <Link href="/">Link</Link> </Box> ); diff --git a/docs/src/pages/guides/routing/ListRouter.js b/docs/src/pages/guides/routing/ListRouter.js index b9ac390735703e..c0b973f8b70d27 100644 --- a/docs/src/pages/guides/routing/ListRouter.js +++ b/docs/src/pages/guides/routing/ListRouter.js @@ -19,7 +19,7 @@ function ListItemLink(props) { const renderLink = React.useMemo( () => React.forwardRef(function Link(itemProps, ref) { - return <RouterLink to={to} ref={ref} {...itemProps} />; + return <RouterLink to={to} ref={ref} {...itemProps} role={undefined} />; }), [to], ); diff --git a/docs/src/pages/guides/routing/ListRouter.tsx b/docs/src/pages/guides/routing/ListRouter.tsx index 2c8b75dcb53f23..78525951dac521 100644 --- a/docs/src/pages/guides/routing/ListRouter.tsx +++ b/docs/src/pages/guides/routing/ListRouter.tsx @@ -27,7 +27,7 @@ function ListItemLink(props: ListItemLinkProps) { itemProps, ref, ) { - return <RouterLink to={to} ref={ref} {...itemProps} />; + return <RouterLink to={to} ref={ref} {...itemProps} role={undefined} />; }), [to], ); diff --git a/docs/src/pages/guides/routing/routing-de.md b/docs/src/pages/guides/routing/routing-de.md new file mode 100644 index 00000000000000..9241c1f796d313 --- /dev/null +++ b/docs/src/pages/guides/routing/routing-de.md @@ -0,0 +1,119 @@ +# Routing libraries + +<p class="description">By default, the navigation is performed with a native <code><a></code> element. You can customize it to use your own router. For instance, using Next.js's Link or react-router.</p> + +## Navigation components + +There are two main components available to perform navigations. The most common one is the [`Link`](/components/link/) as its name might suggest. It renders a native `<a>` element and applies the `href` as an attribute. + +{{"demo": "pages/guides/routing/LinkDemo.js"}} + +You can also make a button perform navigation actions. If your component is extending [`ButtonBase`](/api/button-base/), providing a `href` prop enables the link mode. For instance, with a `Button` component: + +{{"demo": "pages/guides/routing/ButtonDemo.js"}} + +## Global theme Link + +In real-life applications, using a native `<a>` element is rarely enough. You can improve the user experience by using an enhanced Link component systematically. The theme of Material-UI allows configuring this component once. For instance, with react-router: + +```jsx +const LinkBehavior = React.forwardRef< + any, + Omit<RouterLinkProps, 'to'> & { href: RouterLinkProps['to'] } +>((props, ref) => { + const { href, ...other } = props; + // Map href (Material-UI) -> to (react-router) + return <RouterLink ref={ref} to={href} {...other} />; +}); + +const theme = createTheme({ + components: { + MuiLink: { + defaultProps: { + component: LinkBehavior, + }, + }, + MuiButtonBase: { + defaultProps: { + LinkComponent: LinkBehavior, + }, + }, + }, +}); +``` + +{{"demo": "pages/guides/routing/LinkRouterWithTheme.js", "defaultCodeOpen": false}} + +> ⚠️ This approach has limitations with TypeScript. The `href` prop only accepts a string. In the event you need to provide a richer structure, see the next section. + +## `component` prop + +You can achieve the integration with third-party routing libraries with the `component` prop. You can learn more about this prop in the [composition guide](/guides/composition/#component-prop). + +Here are a few demos with [react-router](https://github.com/ReactTraining/react-router). You can apply the same strategy with all the components: BottomNavigation, Card, etc. + +### Link + +{{"demo": "pages/guides/routing/LinkRouter.js"}} + +### Tabs + +{{"demo": "pages/guides/routing/TabsRouter.js", "defaultCodeOpen": false}} + +### Button + +{{"demo": "pages/guides/routing/ButtonRouter.js"}} + +### List (liste) + +{{"demo": "pages/guides/routing/ListRouter.js"}} + +## More examples + +### Next.js + +Next.js has [a custom Link component](https://nextjs.org/docs/api-reference/next/link). The [example folder](https://github.com/mui-org/material-ui/tree/HEAD/examples/nextjs-with-typescript) provides adapters for usage with Material-UI. + +- The first version of the adapter is the [`NextLinkComposed`](https://github.com/mui-org/material-ui/tree/HEAD/examples/nextjs-with-typescript/src/Link.tsx) component. This component is unstyled and only responsible for handling the navigation. The prop `href` was renamed `to` to avoid a naming conflict. This is similar to react-router's Link component. + + ```tsx + import Button from '@material-ui/core/Button'; + import { NextLinkComposed } from '../src/Link'; + + export default function Index() { + return ( + <Button + component={NextLinkComposed} + to={{ + pathname: '/about', + query: { name: 'test' }, + }} + > + Button link + </Button> + ); + } + ``` + +- The second version of the adapter is the `Link` component. This component is styled. It leverages the [link component of Material-UI](https://material-ui.com/components/links/) with `NextLinkComposed`. + + ```tsx + import Link from '../src/Link'; + + export default function Index() { + return ( + <Link + href={{ + pathname: '/about', + query: { name: 'test' }, + }} + > + Link + </Link> + ); + } + ``` + +### Gatsby + +The [Link](https://www.gatsbyjs.com/docs/linking-between-pages/) component of Gatsby is built on `@reach/router`. You can use the same previous documentation for react-router. Unlike Next.js, it doesn't require you to create an adapter. diff --git a/docs/src/pages/guides/routing/routing-es.md b/docs/src/pages/guides/routing/routing-es.md new file mode 100644 index 00000000000000..f50d23952d4aea --- /dev/null +++ b/docs/src/pages/guides/routing/routing-es.md @@ -0,0 +1,119 @@ +# Routing libraries + +<p class="description">By default, the navigation is performed with a native <code><a></code> element. You can customize it to use your own router. For instance, using Next.js's Link or react-router.</p> + +## Navigation components + +There are two main components available to perform navigations. The most common one is the [`Link`](/components/link/) as its name might suggest. It renders a native `<a>` element and applies the `href` as an attribute. + +{{"demo": "pages/guides/routing/LinkDemo.js"}} + +You can also make a button perform navigation actions. If your component is extending [`ButtonBase`](/api/button-base/), providing a `href` prop enables the link mode. For instance, with a `Button` component: + +{{"demo": "pages/guides/routing/ButtonDemo.js"}} + +## Global theme Link + +In real-life applications, using a native `<a>` element is rarely enough. You can improve the user experience by using an enhanced Link component systematically. The theme of Material-UI allows configuring this component once. For instance, with react-router: + +```jsx +const LinkBehavior = React.forwardRef< + any, + Omit<RouterLinkProps, 'to'> & { href: RouterLinkProps['to'] } +>((props, ref) => { + const { href, ...other } = props; + // Map href (Material-UI) -> to (react-router) + return <RouterLink ref={ref} to={href} {...other} />; +}); + +const theme = createTheme({ + components: { + MuiLink: { + defaultProps: { + component: LinkBehavior, + }, + }, + MuiButtonBase: { + defaultProps: { + LinkComponent: LinkBehavior, + }, + }, + }, +}); +``` + +{{"demo": "pages/guides/routing/LinkRouterWithTheme.js", "defaultCodeOpen": false}} + +> ⚠️ This approach has limitations with TypeScript. The `href` prop only accepts a string. In the event you need to provide a richer structure, see the next section. + +## `component` prop + +You can achieve the integration with third-party routing libraries with the `component` prop. You can learn more about this prop in the [composition guide](/guides/composition/#component-prop). + +Here are a few demos with [react-router](https://github.com/ReactTraining/react-router). You can apply the same strategy with all the components: BottomNavigation, Card, etc. + +### Link + +{{"demo": "pages/guides/routing/LinkRouter.js"}} + +### Pestañas + +{{"demo": "pages/guides/routing/TabsRouter.js", "defaultCodeOpen": false}} + +### Button (Botón) + +{{"demo": "pages/guides/routing/ButtonRouter.js"}} + +### List + +{{"demo": "pages/guides/routing/ListRouter.js"}} + +## More examples + +### Next.js + +Next.js has [a custom Link component](https://nextjs.org/docs/api-reference/next/link). The [example folder](https://github.com/mui-org/material-ui/tree/HEAD/examples/nextjs-with-typescript) provides adapters for usage with Material-UI. + +- The first version of the adapter is the [`NextLinkComposed`](https://github.com/mui-org/material-ui/tree/HEAD/examples/nextjs-with-typescript/src/Link.tsx) component. This component is unstyled and only responsible for handling the navigation. The prop `href` was renamed `to` to avoid a naming conflict. This is similar to react-router's Link component. + + ```tsx + import Button from '@material-ui/core/Button'; + import { NextLinkComposed } from '../src/Link'; + + export default function Index() { + return ( + <Button + component={NextLinkComposed} + to={{ + pathname: '/about', + query: { name: 'test' }, + }} + > + Button link + </Button> + ); + } + ``` + +- The second version of the adapter is the `Link` component. This component is styled. It leverages the [link component of Material-UI](https://material-ui.com/components/links/) with `NextLinkComposed`. + + ```tsx + import Link from '../src/Link'; + + export default function Index() { + return ( + <Link + href={{ + pathname: '/about', + query: { name: 'test' }, + }} + > + Link + </Link> + ); + } + ``` + +### Gatsby + +The [Link](https://www.gatsbyjs.com/docs/linking-between-pages/) component of Gatsby is built on `@reach/router`. You can use the same previous documentation for react-router. Unlike Next.js, it doesn't require you to create an adapter. diff --git a/docs/src/pages/guides/routing/routing-fr.md b/docs/src/pages/guides/routing/routing-fr.md new file mode 100644 index 00000000000000..d5f573f8365fef --- /dev/null +++ b/docs/src/pages/guides/routing/routing-fr.md @@ -0,0 +1,119 @@ +# Routing libraries + +<p class="description">By default, the navigation is performed with a native <code><a></code> element. You can customize it to use your own router. For instance, using Next.js's Link or react-router.</p> + +## Navigation components + +There are two main components available to perform navigations. The most common one is the [`Link`](/components/link/) as its name might suggest. It renders a native `<a>` element and applies the `href` as an attribute. + +{{"demo": "pages/guides/routing/LinkDemo.js"}} + +You can also make a button perform navigation actions. If your component is extending [`ButtonBase`](/api/button-base/), providing a `href` prop enables the link mode. For instance, with a `Button` component: + +{{"demo": "pages/guides/routing/ButtonDemo.js"}} + +## Global theme Link + +In real-life applications, using a native `<a>` element is rarely enough. You can improve the user experience by using an enhanced Link component systematically. The theme of Material-UI allows configuring this component once. For instance, with react-router: + +```jsx +const LinkBehavior = React.forwardRef< + any, + Omit<RouterLinkProps, 'to'> & { href: RouterLinkProps['to'] } +>((props, ref) => { + const { href, ...other } = props; + // Map href (Material-UI) -> to (react-router) + return <RouterLink ref={ref} to={href} {...other} />; +}); + +const theme = createTheme({ + components: { + MuiLink: { + defaultProps: { + component: LinkBehavior, + }, + }, + MuiButtonBase: { + defaultProps: { + LinkComponent: LinkBehavior, + }, + }, + }, +}); +``` + +{{"demo": "pages/guides/routing/LinkRouterWithTheme.js", "defaultCodeOpen": false}} + +> ⚠️ This approach has limitations with TypeScript. The `href` prop only accepts a string. In the event you need to provide a richer structure, see the next section. + +## `component` prop + +You can achieve the integration with third-party routing libraries with the `component` prop. You can learn more about this prop in the [composition guide](/guides/composition/#component-prop). + +Here are a few demos with [react-router](https://github.com/ReactTraining/react-router). You can apply the same strategy with all the components: BottomNavigation, Card, etc. + +### Link + +{{"demo": "pages/guides/routing/LinkRouter.js"}} + +### Tabs (Onglets) + +{{"demo": "pages/guides/routing/TabsRouter.js", "defaultCodeOpen": false}} + +### Button + +{{"demo": "pages/guides/routing/ButtonRouter.js"}} + +### List (Liste) + +{{"demo": "pages/guides/routing/ListRouter.js"}} + +## More examples + +### Next.js + +Next.js has [a custom Link component](https://nextjs.org/docs/api-reference/next/link). The [example folder](https://github.com/mui-org/material-ui/tree/HEAD/examples/nextjs-with-typescript) provides adapters for usage with Material-UI. + +- The first version of the adapter is the [`NextLinkComposed`](https://github.com/mui-org/material-ui/tree/HEAD/examples/nextjs-with-typescript/src/Link.tsx) component. This component is unstyled and only responsible for handling the navigation. The prop `href` was renamed `to` to avoid a naming conflict. This is similar to react-router's Link component. + + ```tsx + import Button from '@material-ui/core/Button'; + import { NextLinkComposed } from '../src/Link'; + + export default function Index() { + return ( + <Button + component={NextLinkComposed} + to={{ + pathname: '/about', + query: { name: 'test' }, + }} + > + Button link + </Button> + ); + } + ``` + +- The second version of the adapter is the `Link` component. This component is styled. It leverages the [link component of Material-UI](https://material-ui.com/components/links/) with `NextLinkComposed`. + + ```tsx + import Link from '../src/Link'; + + export default function Index() { + return ( + <Link + href={{ + pathname: '/about', + query: { name: 'test' }, + }} + > + Link + </Link> + ); + } + ``` + +### Gatsby + +The [Link](https://www.gatsbyjs.com/docs/linking-between-pages/) component of Gatsby is built on `@reach/router`. You can use the same previous documentation for react-router. Unlike Next.js, it doesn't require you to create an adapter. diff --git a/docs/src/pages/guides/routing/routing-ja.md b/docs/src/pages/guides/routing/routing-ja.md new file mode 100644 index 00000000000000..6205e47407ef6b --- /dev/null +++ b/docs/src/pages/guides/routing/routing-ja.md @@ -0,0 +1,119 @@ +# Routing libraries + +<p class="description">By default, the navigation is performed with a native <code><a></code> element. You can customize it to use your own router. For instance, using Next.js's Link or react-router.</p> + +## Navigation components + +There are two main components available to perform navigations. The most common one is the [`Link`](/components/link/) as its name might suggest. It renders a native `<a>` element and applies the `href` as an attribute. + +{{"demo": "pages/guides/routing/LinkDemo.js"}} + +You can also make a button perform navigation actions. If your component is extending [`ButtonBase`](/api/button-base/), providing a `href` prop enables the link mode. For instance, with a `Button` component: + +{{"demo": "pages/guides/routing/ButtonDemo.js"}} + +## Global theme Link + +In real-life applications, using a native `<a>` element is rarely enough. You can improve the user experience by using an enhanced Link component systematically. The theme of Material-UI allows configuring this component once. For instance, with react-router: + +```jsx +const LinkBehavior = React.forwardRef< + any, + Omit<RouterLinkProps, 'to'> & { href: RouterLinkProps['to'] } +>((props, ref) => { + const { href, ...other } = props; + // Map href (Material-UI) -> to (react-router) + return <RouterLink ref={ref} to={href} {...other} />; +}); + +const theme = createTheme({ + components: { + MuiLink: { + defaultProps: { + component: LinkBehavior, + }, + }, + MuiButtonBase: { + defaultProps: { + LinkComponent: LinkBehavior, + }, + }, + }, +}); +``` + +{{"demo": "pages/guides/routing/LinkRouterWithTheme.js", "defaultCodeOpen": false}} + +> ⚠️ This approach has limitations with TypeScript. The `href` prop only accepts a string. In the event you need to provide a richer structure, see the next section. + +## `component` prop + +You can achieve the integration with third-party routing libraries with the `component` prop. You can learn more about this prop in the [composition guide](/guides/composition/#component-prop). + +Here are a few demos with [react-router](https://github.com/ReactTraining/react-router). You can apply the same strategy with all the components: BottomNavigation, Card, etc. + +### Link + +{{"demo": "pages/guides/routing/LinkRouter.js"}} + +### Tabs + +{{"demo": "pages/guides/routing/TabsRouter.js", "defaultCodeOpen": false}} + +### Button (ボタン) + +{{"demo": "pages/guides/routing/ButtonRouter.js"}} + +### List (リスト) + +{{"demo": "pages/guides/routing/ListRouter.js"}} + +## More examples + +### Next.js + +Next.js has [a custom Link component](https://nextjs.org/docs/api-reference/next/link). The [example folder](https://github.com/mui-org/material-ui/tree/HEAD/examples/nextjs-with-typescript) provides adapters for usage with Material-UI. + +- The first version of the adapter is the [`NextLinkComposed`](https://github.com/mui-org/material-ui/tree/HEAD/examples/nextjs-with-typescript/src/Link.tsx) component. This component is unstyled and only responsible for handling the navigation. The prop `href` was renamed `to` to avoid a naming conflict. This is similar to react-router's Link component. + + ```tsx + import Button from '@material-ui/core/Button'; + import { NextLinkComposed } from '../src/Link'; + + export default function Index() { + return ( + <Button + component={NextLinkComposed} + to={{ + pathname: '/about', + query: { name: 'test' }, + }} + > + Button link + </Button> + ); + } + ``` + +- The second version of the adapter is the `Link` component. This component is styled. It leverages the [link component of Material-UI](https://material-ui.com/components/links/) with `NextLinkComposed`. + + ```tsx + import Link from '../src/Link'; + + export default function Index() { + return ( + <Link + href={{ + pathname: '/about', + query: { name: 'test' }, + }} + > + Link + </Link> + ); + } + ``` + +### Gatsby + +The [Link](https://www.gatsbyjs.com/docs/linking-between-pages/) component of Gatsby is built on `@reach/router`. You can use the same previous documentation for react-router. Unlike Next.js, it doesn't require you to create an adapter. diff --git a/docs/src/pages/guides/routing/routing-pt.md b/docs/src/pages/guides/routing/routing-pt.md new file mode 100644 index 00000000000000..f9553775af9730 --- /dev/null +++ b/docs/src/pages/guides/routing/routing-pt.md @@ -0,0 +1,119 @@ +# Bibliotecas de roteamento + +<p class="description">By default, the navigation is performed with a native <code><a></code> element. You can customize it to use your own router. For instance, using Next.js's Link or react-router.</p> + +## Navigation components + +There are two main components available to perform navigations. The most common one is the [`Link`](/components/link/) as its name might suggest. It renders a native `<a>` element and applies the `href` as an attribute. + +{{"demo": "pages/guides/routing/LinkDemo.js"}} + +You can also make a button perform navigation actions. If your component is extending [`ButtonBase`](/api/button-base/), providing a `href` prop enables the link mode. For instance, with a `Button` component: + +{{"demo": "pages/guides/routing/ButtonDemo.js"}} + +## Global theme Link + +In real-life applications, using a native `<a>` element is rarely enough. You can improve the user experience by using an enhanced Link component systematically. The theme of Material-UI allows configuring this component once. For instance, with react-router: + +```jsx +const LinkBehavior = React.forwardRef< + any, + Omit<RouterLinkProps, 'to'> & { href: RouterLinkProps['to'] } +>((props, ref) => { + const { href, ...other } = props; + // Map href (Material-UI) -> to (react-router) + return <RouterLink ref={ref} to={href} {...other} />; +}); + +const theme = createTheme({ + components: { + MuiLink: { + defaultProps: { + component: LinkBehavior, + }, + }, + MuiButtonBase: { + defaultProps: { + LinkComponent: LinkBehavior, + }, + }, + }, +}); +``` + +{{"demo": "pages/guides/routing/LinkRouterWithTheme.js", "defaultCodeOpen": false}} + +> ⚠️ This approach has limitations with TypeScript. The `href` prop only accepts a string. In the event you need to provide a richer structure, see the next section. + +## Propriedade `component` + +You can achieve the integration with third-party routing libraries with the `component` prop. You can learn more about this prop in the [composition guide](/guides/composition/#component-prop). + +Here are a few demos with [react-router](https://github.com/ReactTraining/react-router). You can apply the same strategy with all the components: BottomNavigation, Card, etc. + +### Link + +{{"demo": "pages/guides/routing/LinkRouter.js"}} + +### Abas + +{{"demo": "pages/guides/routing/TabsRouter.js", "defaultCodeOpen": false}} + +### Button + +{{"demo": "pages/guides/routing/ButtonRouter.js"}} + +### Lista + +{{"demo": "pages/guides/routing/ListRouter.js"}} + +## More examples + +### Next.js + +Next.js has [a custom Link component](https://nextjs.org/docs/api-reference/next/link). The [example folder](https://github.com/mui-org/material-ui/tree/HEAD/examples/nextjs-with-typescript) provides adapters for usage with Material-UI. + +- The first version of the adapter is the [`NextLinkComposed`](https://github.com/mui-org/material-ui/tree/HEAD/examples/nextjs-with-typescript/src/Link.tsx) component. This component is unstyled and only responsible for handling the navigation. The prop `href` was renamed `to` to avoid a naming conflict. This is similar to react-router's Link component. + + ```tsx + import Button from '@material-ui/core/Button'; + import { NextLinkComposed } from '../src/Link'; + + export default function Index() { + return ( + <Button + component={NextLinkComposed} + to={{ + pathname: '/about', + query: { name: 'test' }, + }} + > + Button link + </Button> + ); + } + ``` + +- The second version of the adapter is the `Link` component. This component is styled. It leverages the [link component of Material-UI](https://material-ui.com/components/links/) with `NextLinkComposed`. + + ```tsx + import Link from '../src/Link'; + + export default function Index() { + return ( + <Link + href={{ + pathname: '/about', + query: { name: 'test' }, + }} + > + Link + </Link> + ); + } + ``` + +### Gatsby + +The [Link](https://www.gatsbyjs.com/docs/linking-between-pages/) component of Gatsby is built on `@reach/router`. You can use the same previous documentation for react-router. Unlike Next.js, it doesn't require you to create an adapter. diff --git a/docs/src/pages/guides/routing/routing-ru.md b/docs/src/pages/guides/routing/routing-ru.md new file mode 100644 index 00000000000000..6192422a3d01a0 --- /dev/null +++ b/docs/src/pages/guides/routing/routing-ru.md @@ -0,0 +1,119 @@ +# Routing libraries + +<p class="description">By default, the navigation is performed with a native <code><a></code> element. You can customize it to use your own router. For instance, using Next.js's Link or react-router.</p> + +## Navigation components + +There are two main components available to perform navigations. The most common one is the [`Link`](/components/link/) as its name might suggest. It renders a native `<a>` element and applies the `href` as an attribute. + +{{"demo": "pages/guides/routing/LinkDemo.js"}} + +You can also make a button perform navigation actions. If your component is extending [`ButtonBase`](/api/button-base/), providing a `href` prop enables the link mode. For instance, with a `Button` component: + +{{"demo": "pages/guides/routing/ButtonDemo.js"}} + +## Global theme Link + +In real-life applications, using a native `<a>` element is rarely enough. You can improve the user experience by using an enhanced Link component systematically. The theme of Material-UI allows configuring this component once. For instance, with react-router: + +```jsx +const LinkBehavior = React.forwardRef< + any, + Omit<RouterLinkProps, 'to'> & { href: RouterLinkProps['to'] } +>((props, ref) => { + const { href, ...other } = props; + // Map href (Material-UI) -> to (react-router) + return <RouterLink ref={ref} to={href} {...other} />; +}); + +const theme = createTheme({ + components: { + MuiLink: { + defaultProps: { + component: LinkBehavior, + }, + }, + MuiButtonBase: { + defaultProps: { + LinkComponent: LinkBehavior, + }, + }, + }, +}); +``` + +{{"demo": "pages/guides/routing/LinkRouterWithTheme.js", "defaultCodeOpen": false}} + +> ⚠️ This approach has limitations with TypeScript. The `href` prop only accepts a string. In the event you need to provide a richer structure, see the next section. + +## `component` prop + +You can achieve the integration with third-party routing libraries with the `component` prop. You can learn more about this prop in the [composition guide](/guides/composition/#component-prop). + +Here are a few demos with [react-router](https://github.com/ReactTraining/react-router). You can apply the same strategy with all the components: BottomNavigation, Card, etc. + +### Link + +{{"demo": "pages/guides/routing/LinkRouter.js"}} + +### Вкладки + +{{"demo": "pages/guides/routing/TabsRouter.js", "defaultCodeOpen": false}} + +### Button + +{{"demo": "pages/guides/routing/ButtonRouter.js"}} + +### Список + +{{"demo": "pages/guides/routing/ListRouter.js"}} + +## More examples + +### Next.js + +Next.js has [a custom Link component](https://nextjs.org/docs/api-reference/next/link). The [example folder](https://github.com/mui-org/material-ui/tree/HEAD/examples/nextjs-with-typescript) provides adapters for usage with Material-UI. + +- The first version of the adapter is the [`NextLinkComposed`](https://github.com/mui-org/material-ui/tree/HEAD/examples/nextjs-with-typescript/src/Link.tsx) component. This component is unstyled and only responsible for handling the navigation. The prop `href` was renamed `to` to avoid a naming conflict. This is similar to react-router's Link component. + + ```tsx + import Button from '@material-ui/core/Button'; + import { NextLinkComposed } from '../src/Link'; + + export default function Index() { + return ( + <Button + component={NextLinkComposed} + to={{ + pathname: '/about', + query: { name: 'test' }, + }} + > + Button link + </Button> + ); + } + ``` + +- The second version of the adapter is the `Link` component. This component is styled. It leverages the [link component of Material-UI](https://material-ui.com/components/links/) with `NextLinkComposed`. + + ```tsx + import Link from '../src/Link'; + + export default function Index() { + return ( + <Link + href={{ + pathname: '/about', + query: { name: 'test' }, + }} + > + Link + </Link> + ); + } + ``` + +### Gatsby + +The [Link](https://www.gatsbyjs.com/docs/linking-between-pages/) component of Gatsby is built on `@reach/router`. You can use the same previous documentation for react-router. Unlike Next.js, it doesn't require you to create an adapter. diff --git a/docs/src/pages/guides/routing/routing-zh.md b/docs/src/pages/guides/routing/routing-zh.md new file mode 100644 index 00000000000000..ec9814ac796d6c --- /dev/null +++ b/docs/src/pages/guides/routing/routing-zh.md @@ -0,0 +1,119 @@ +# 路由库 + +<p class="description">By default, the navigation is performed with a native <code><a></code> element. You can customize it to use your own router. For instance, using Next.js's Link or react-router.</p> + +## Navigation components + +There are two main components available to perform navigations. The most common one is the [`Link`](/components/link/) as its name might suggest. It renders a native `<a>` element and applies the `href` as an attribute. + +{{"demo": "pages/guides/routing/LinkDemo.js"}} + +You can also make a button perform navigation actions. If your component is extending [`ButtonBase`](/api/button-base/), providing a `href` prop enables the link mode. For instance, with a `Button` component: + +{{"demo": "pages/guides/routing/ButtonDemo.js"}} + +## Global theme Link + +In real-life applications, using a native `<a>` element is rarely enough. You can improve the user experience by using an enhanced Link component systematically. The theme of Material-UI allows configuring this component once. For instance, with react-router: + +```jsx +const LinkBehavior = React.forwardRef< + any, + Omit<RouterLinkProps, 'to'> & { href: RouterLinkProps['to'] } +>((props, ref) => { + const { href, ...other } = props; + // Map href (Material-UI) -> to (react-router) + return <RouterLink ref={ref} to={href} {...other} />; +}); + +const theme = createTheme({ + components: { + MuiLink: { + defaultProps: { + component: LinkBehavior, + }, + }, + MuiButtonBase: { + defaultProps: { + LinkComponent: LinkBehavior, + }, + }, + }, +}); +``` + +{{"demo": "pages/guides/routing/LinkRouterWithTheme.js", "defaultCodeOpen": false}} + +> ⚠️ This approach has limitations with TypeScript. The `href` prop only accepts a string. In the event you need to provide a richer structure, see the next section. + +## `component` 属性 + +You can achieve the integration with third-party routing libraries with the `component` prop. You can learn more about this prop in the [composition guide](/guides/composition/#component-prop). + +Here are a few demos with [react-router](https://github.com/ReactTraining/react-router). You can apply the same strategy with all the components: BottomNavigation, Card, etc. + +### Link + +{{"demo": "pages/guides/routing/LinkRouter.js"}} + +### Tabs 选项卡 + +{{"demo": "pages/guides/routing/TabsRouter.js", "defaultCodeOpen": false}} + +### Button + +{{"demo": "pages/guides/routing/ButtonRouter.js"}} + +### Lists(列表) + +{{"demo": "pages/guides/routing/ListRouter.js"}} + +## More examples + +### Next.js + +Next.js has [a custom Link component](https://nextjs.org/docs/api-reference/next/link). The [example folder](https://github.com/mui-org/material-ui/tree/HEAD/examples/nextjs-with-typescript) provides adapters for usage with Material-UI. + +- The first version of the adapter is the [`NextLinkComposed`](https://github.com/mui-org/material-ui/tree/HEAD/examples/nextjs-with-typescript/src/Link.tsx) component. This component is unstyled and only responsible for handling the navigation. The prop `href` was renamed `to` to avoid a naming conflict. This is similar to react-router's Link component. + + ```tsx + import Button from '@material-ui/core/Button'; + import { NextLinkComposed } from '../src/Link'; + + export default function Index() { + return ( + <Button + component={NextLinkComposed} + to={{ + pathname: '/about', + query: { name: 'test' }, + }} + > + Button link + </Button> + ); + } + ``` + +- The second version of the adapter is the `Link` component. This component is styled. It leverages the [link component of Material-UI](https://material-ui.com/components/links/) with `NextLinkComposed`. + + ```tsx + import Link from '../src/Link'; + + export default function Index() { + return ( + <Link + href={{ + pathname: '/about', + query: { name: 'test' }, + }} + > + Link + </Link> + ); + } + ``` + +### Gatsby + +The [Link](https://www.gatsbyjs.com/docs/linking-between-pages/) component of Gatsby is built on `@reach/router`. You can use the same previous documentation for react-router. Unlike Next.js, it doesn't require you to create an adapter. diff --git a/docs/src/pages/guides/routing/routing.md b/docs/src/pages/guides/routing/routing.md index fc65786c8de165..69a3a26f43a74b 100644 --- a/docs/src/pages/guides/routing/routing.md +++ b/docs/src/pages/guides/routing/routing.md @@ -58,23 +58,34 @@ const theme = createTheme({ ## `component` prop You can achieve the integration with third-party routing libraries with the `component` prop. -You can learn more about this prop in the [composition guide](/guides/composition/#component-prop). +You can learn more about this prop in the [**composition guide**](/guides/composition/#component-prop). + +### Link Here are a few demos with [react-router](https://github.com/ReactTraining/react-router). You can apply the same strategy with all the components: BottomNavigation, Card, etc. -### Link - {{"demo": "pages/guides/routing/LinkRouter.js"}} -### Tabs - -{{"demo": "pages/guides/routing/TabsRouter.js", "defaultCodeOpen": false}} - ### Button {{"demo": "pages/guides/routing/ButtonRouter.js"}} +**Note**: The button base component adds the `role="button"` attribute when it identifies the intent to render a button without a native `<button>` element. +This can create issues when rendering a link. +If you are not using one of the `href`, `to`, or `component="a"` props, you need to override the `role` attribute. +The above demo achieves this by setting `role={undefined}` **after** the spread props. + +```jsx +const LinkBehavior = React.forwardRef((props, ref) => ( + <RouterLink ref={ref} to="/" {...props} role={undefined} /> +)); +``` + +### Tabs + +{{"demo": "pages/guides/routing/TabsRouter.js", "defaultCodeOpen": false}} + ### List {{"demo": "pages/guides/routing/ListRouter.js"}} diff --git a/docs/src/pages/guides/server-rendering/server-rendering-de.md b/docs/src/pages/guides/server-rendering/server-rendering-de.md index f885391849d98e..f1108be04ec502 100644 --- a/docs/src/pages/guides/server-rendering/server-rendering-de.md +++ b/docs/src/pages/guides/server-rendering/server-rendering-de.md @@ -8,14 +8,14 @@ Wenn der Server die Anforderung empfängt, stellt er die erforderlichen Komponen Die Client-Seite ist unkompliziert. Wir müssen nur das serverseitig erzeugte CSS entfernen. Let's take a look at the client file: -1. Eine neue [`ServerStyleSheets`](/styles/api/#serverstylesheets) Instanz bei jede Anfrage erstellen. +1. Create a fresh, new [`emotion cache`](https://emotion.sh/docs/@emotion/cache) instance on every request. 2. Den React-Baum mit dem serverseitigen Collector rendern. 3. Das CSS herausziehen. 4. Das CSS zum Client weiterleiten. -Auf der Clientseite wird das CSS ein zweites Mal eingefügt, bevor das serverseitige injizierte CSS entfernt wird. +On the client-side, the CSS will be injected a second time before removing the server-side injected CSS. -## Installation +## Setting up Im folgenden Rezept wird beschrieben, wie das serverseitige Rendering eingerichtet wird. @@ -41,9 +41,6 @@ const theme = createTheme({ error: { main: red.A400, }, - background: { - default: '#fff', - }, }, }); @@ -52,7 +49,7 @@ export default theme; ### Die Server-Seite -The following is the outline for what the server-side is going to look like. We are going to set up an [Express middleware](https://expressjs.com/en/guide/using-middleware.html) using [app.use](https://expressjs.com/en/api.html) to handle all requests that come in to the server. If you're unfamiliar with Express or middleware, just know that the handleRender function will be called every time the server receives a request. +The following is the outline for what the server-side is going to look like. We are going to set up an [Express middleware](https://expressjs.com/en/guide/using-middleware.html) using [app.use](https://expressjs.com/en/api.html) to handle all requests that come into the server. If you're unfamiliar with Express or middleware, know that the `handleRender` function will be called every time the server receives a request. `server.js` @@ -79,27 +76,29 @@ const app = express(); // Isso é acionado toda vez que o servidor recebe uma solicitação. ``` -### Verarbeiten der Anfrage +### Handling the request -Als Erstes müssen wir bei jeder Anfrage ein neues `ServerStyleSheets` erstellen. +The first thing that we need to do on every request is to create a new `emotion cache`. -When rendering, we will wrap `App`, the root component, inside a [`StylesProvider`](/styles/api/#stylesprovider) and [`ThemeProvider`](/styles/api/#themeprovider) to make the style configuration and the `theme` available to all components in the component tree. +When rendering, we will wrap `App`, the root component, inside a [`CacheProvider`](https://emotion.sh/docs/cache-provider) and [`ThemeProvider`](/styles/api/#themeprovider) to make the style configuration and the `theme` available to all components in the component tree. -The key step in server-side rendering is to render the initial HTML of the component **before** we send it to the client side. Dazu verwenden wir [ReactDOMServer.renderToString()](https://reactjs.org/docs/react-dom-server.html). +The key step in server-side rendering is to render the initial HTML of the component **before** we send it to the client-side. Dazu verwenden wir [ReactDOMServer.renderToString()](https://reactjs.org/docs/react-dom-server.html). -We then get the CSS from the `sheets` using `sheets.toString()`. As we are also using emotion as our default styled engine, we need to extract the styles from the emotion instance as well. For this we need to share the same cache definition for both the client and server: +Material-UI is using emotion as its default styled engine. We need to extract the styles from the emotion instance. For this, we need to share the same cache configuration for both the client and server: -`cache.js` +`getCache.js` ```js import createCache from '@emotion/cache'; -const cache = createCache({ key: 'css' }); - -export default cache; +export default function getCache() { + const cache = createCache({ key: 'css' }); + cache.compat = true; + return cache; +} ``` -With this we are creating new Emotion server instance and using this to extract the critical styles for the html as well. +With this we are creating new emotion cache instance and using this to extract the critical styles for the html as well. We will see how this is passed along in the `renderFullPage` function. @@ -107,36 +106,35 @@ We will see how this is passed along in the `renderFullPage` function. import express from 'express'; import * as React from 'react'; import ReactDOMServer from 'react-dom/server'; -import { ServerStyleSheets, ThemeProvider } from '@material-ui/core/styles'; +import CssBaseline from '@material-ui/core/CssBaseline'; +import { ThemeProvider } from '@material-ui/core/styles'; import createEmotionServer from '@emotion/server/create-instance'; import App from './App'; import theme from './theme'; -import cache from './cache'; - -const { extractCritical } = createEmotionServer(cache); +import getCache from './getCache'; function handleRender(req, res) { - const sheets = new ServerStyleSheets(); + const cache = getCache(); + const { extractCriticalToChunks, constructStyleTagsFromChunks } = + createEmotionServer(cache); // Render the component to a string. const html = ReactDOMServer.renderToString( - sheets.collect( - <CacheProvider value={cache}> - <ThemeProvider theme={theme}> - <App /> - </ThemeProvider> - </CacheProvider>, - ), + <CacheProvider value={cache}> + <ThemeProvider theme={theme}> + {/* CssBaseline kickstart an elegant, consistent, and simple baseline to build upon. */} + <CssBaseline /> + <App /> + </ThemeProvider> + </CacheProvider>, ); - // Grab the CSS from the sheets. - const css = sheets.toString(); - // Grab the CSS from emotion - const styles = extractCritical(html); + const emotionChunks = extractCriticalToChunks(html); + const emotionCss = constructStyleTagsFromChunks(emotionChunks); // Send the rendered page back to the client. - res.send(renderFullPage(html, `${css} ${styles.css}`)); + res.send(renderFullPage(html, emotionCss)); } const app = express(); @@ -152,9 +150,9 @@ const app = express(); // Isso é acionado toda vez que o servidor recebe uma solicitação. ``` -### Injizieren der ursprüngliche HTML Komponente und CSS +### Inject initial component HTML and CSS -The final step on the server-side is to inject the initial component HTML and CSS into a template to be rendered on the client side. +The final step on the server-side is to inject the initial component HTML and CSS into a template to be rendered on the client-side. ```js function renderFullPage(html, css) { @@ -163,7 +161,9 @@ function renderFullPage(html, css) { <html> <head> <title>My page - + ${css} + +
    ${html}
    @@ -173,32 +173,28 @@ function renderFullPage(html, css) { } ``` -### Die Client-Seite +### The client-side -Die Client-Seite ist unkompliziert. Wir müssen nur das serverseitig erzeugte CSS entfernen. Let's take a look at the client file: +The client-side is straightforward. All we need to do is use the same cache configuration as the server-side. Let's take a look at the client file: `client.js` ```jsx import * as React from 'react'; import ReactDOM from 'react-dom'; +import CssBaseline from '@material-ui/core/CssBaseline'; import { ThemeProvider } from '@material-ui/core/styles'; import { CacheProvider } from '@emotion/react'; import App from './App'; import theme from './theme'; -import cache from './cache'; +import getCache from './getCache'; function Main() { - React.useEffect(() => { - const jssStyles = document.querySelector('#jss-server-side'); - if (jssStyles) { - jssStyles.parentElement.removeChild(jssStyles); - } - }, []); - return ( - + + {/* CssBaseline kickstart an elegant, consistent, and simple baseline to build upon. */} + @@ -210,11 +206,11 @@ ReactDOM.hydrate(
    , document.querySelector('#root')); ## Referenzimplementierungen -Wir bieten verschiedene Referenzimplementierungen an, die Sie im [GitHub-Repository](https://github.com/mui-org/material-ui) finden können unter dem [`/examples`](https://github.com/mui-org/material-ui/tree/next/examples) Ordner: +We host different reference implementations which you can find in the [GitHub repository](https://github.com/mui-org/material-ui) under the [`/examples`](https://github.com/mui-org/material-ui/tree/HEAD/examples) folder: -- [Die Referenzimplementierung dieses Tutorials](https://github.com/mui-org/material-ui/tree/next/examples/ssr) -- [Gatsby](https://github.com/mui-org/material-ui/tree/next/examples/gatsby) -- https://github.com/mui-org/material-ui/tree/master/examples/nextjs +- [Die Referenzimplementierung dieses Tutorials](https://github.com/mui-org/material-ui/tree/HEAD/examples/ssr) +- [Gatsby](https://github.com/mui-org/material-ui/tree/HEAD/examples/gatsby) +- [Next.js](https://github.com/mui-org/material-ui/tree/HEAD/examples/nextjs) ([TypeScript version](https://github.com/mui-org/material-ui/tree/HEAD/examples/nextjs-with-typescript)) ## Problemlösungen diff --git a/docs/src/pages/guides/server-rendering/server-rendering-es.md b/docs/src/pages/guides/server-rendering/server-rendering-es.md index bfd54056714365..854e7b43997091 100644 --- a/docs/src/pages/guides/server-rendering/server-rendering-es.md +++ b/docs/src/pages/guides/server-rendering/server-rendering-es.md @@ -8,14 +8,14 @@ When the server receives the request, it renders the required component(s) into Material-UI was designed from the ground-up with the constraint of rendering on the server, but it's up to you to make sure it's correctly integrated. It's important to provide the page with the required CSS, otherwise the page will render with just the HTML then wait for the CSS to be injected by the client, causing it to flicker (FOUC). It's important to provide the page with the required CSS, otherwise the page will render with just the HTML then wait for the CSS to be injected by the client, causing it to flicker (FOUC). -1. Create a fresh, new [`ServerStyleSheets`](/styles/api/#serverstylesheets) instance on every request. +1. Create a fresh, new [`emotion cache`](https://emotion.sh/docs/@emotion/cache) instance on every request. 2. Render the React tree with the server-side collector. 3. Pull the CSS out. 4. Pass the CSS along to the client. -On the client side, the CSS will be injected a second time before removing the server-side injected CSS. +On the client-side, the CSS will be injected a second time before removing the server-side injected CSS. -## Setting Up +## Setting up In the following recipe, we are going to look at how to set up server-side rendering. @@ -41,9 +41,6 @@ const theme = createTheme({ error: { main: red.A400, }, - background: { - default: '#fff', - }, }, }); @@ -52,7 +49,7 @@ export default theme; ### The server-side -The following is the outline for what the server-side is going to look like. We are going to set up an [Express middleware](https://expressjs.com/en/guide/using-middleware.html) using [app.use](https://expressjs.com/en/api.html) to handle all requests that come in to the server. If you're unfamiliar with Express or middleware, just know that the handleRender function will be called every time the server receives a request. +The following is the outline for what the server-side is going to look like. We are going to set up an [Express middleware](https://expressjs.com/en/guide/using-middleware.html) using [app.use](https://expressjs.com/en/api.html) to handle all requests that come into the server. If you're unfamiliar with Express or middleware, know that the `handleRender` function will be called every time the server receives a request. `server.js` @@ -74,27 +71,29 @@ const app = express(); // Isso é acionado toda vez que o servidor recebe uma solicitação. ``` -### Handling the Request +### Handling the request -The first thing that we need to do on every request is create a new `ServerStyleSheets`. +The first thing that we need to do on every request is to create a new `emotion cache`. -When rendering, we will wrap `App`, the root component, inside a [`StylesProvider`](/styles/api/#stylesprovider) and [`ThemeProvider`](/styles/api/#themeprovider) to make the style configuration and the `theme` available to all components in the component tree. +When rendering, we will wrap `App`, the root component, inside a [`CacheProvider`](https://emotion.sh/docs/cache-provider) and [`ThemeProvider`](/styles/api/#themeprovider) to make the style configuration and the `theme` available to all components in the component tree. -The key step in server-side rendering is to render the initial HTML of the component **before** we send it to the client side. To do this, we use [ReactDOMServer.renderToString()](https://reactjs.org/docs/react-dom-server.html). +The key step in server-side rendering is to render the initial HTML of the component **before** we send it to the client-side. To do this, we use [ReactDOMServer.renderToString()](https://reactjs.org/docs/react-dom-server.html). -We then get the CSS from the `sheets` using `sheets.toString()`. As we are also using emotion as our default styled engine, we need to extract the styles from the emotion instance as well. For this we need to share the same cache definition for both the client and server: +Material-UI is using emotion as its default styled engine. We need to extract the styles from the emotion instance. For this, we need to share the same cache configuration for both the client and server: -`cache.js` +`getCache.js` ```js import createCache from '@emotion/cache'; -const cache = createCache({ key: 'css' }); - -export default cache; +export default function getCache() { + const cache = createCache({ key: 'css' }); + cache.compat = true; + return cache; +} ``` -With this we are creating new Emotion server instance and using this to extract the critical styles for the html as well. +With this we are creating new emotion cache instance and using this to extract the critical styles for the html as well. We will see how this is passed along in the `renderFullPage` function. @@ -102,36 +101,35 @@ We will see how this is passed along in the `renderFullPage` function. import express from 'express'; import * as React from 'react'; import ReactDOMServer from 'react-dom/server'; -import { ServerStyleSheets, ThemeProvider } from '@material-ui/core/styles'; +import CssBaseline from '@material-ui/core/CssBaseline'; +import { ThemeProvider } from '@material-ui/core/styles'; import createEmotionServer from '@emotion/server/create-instance'; import App from './App'; import theme from './theme'; -import cache from './cache'; - -const { extractCritical } = createEmotionServer(cache); +import getCache from './getCache'; function handleRender(req, res) { - const sheets = new ServerStyleSheets(); + const cache = getCache(); + const { extractCriticalToChunks, constructStyleTagsFromChunks } = + createEmotionServer(cache); // Render the component to a string. const html = ReactDOMServer.renderToString( - sheets.collect( - - - - - , - ), + + + {/* CssBaseline kickstart an elegant, consistent, and simple baseline to build upon. */} + + + + , ); - // Grab the CSS from the sheets. - const css = sheets.toString(); - // Grab the CSS from emotion - const styles = extractCritical(html); + const emotionChunks = extractCriticalToChunks(html); + const emotionCss = constructStyleTagsFromChunks(emotionChunks); // Send the rendered page back to the client. - res.send(renderFullPage(html, `${css} ${styles.css}`)); + res.send(renderFullPage(html, emotionCss)); } const app = express(); @@ -147,9 +145,9 @@ const app = express(); // Isso é acionado toda vez que o servidor recebe uma solicitação. ``` -### Inject Initial Component HTML and CSS +### Inject initial component HTML and CSS -The final step on the server-side is to inject the initial component HTML and CSS into a template to be rendered on the client side. +The final step on the server-side is to inject the initial component HTML and CSS into a template to be rendered on the client-side. ```js function renderFullPage(html, css) { @@ -158,7 +156,9 @@ function renderFullPage(html, css) { My page - + ${css} + +
    ${html}
    @@ -168,32 +168,28 @@ function renderFullPage(html, css) { } ``` -### The Client Side +### The client-side -The client side is straightforward. All we need to do is remove the server-side generated CSS. Let's take a look at the client file: +The client-side is straightforward. All we need to do is use the same cache configuration as the server-side. Let's take a look at the client file: `client.js` ```jsx import * as React from 'react'; import ReactDOM from 'react-dom'; +import CssBaseline from '@material-ui/core/CssBaseline'; import { ThemeProvider } from '@material-ui/core/styles'; import { CacheProvider } from '@emotion/react'; import App from './App'; import theme from './theme'; -import cache from './cache'; +import getCache from './getCache'; function Main() { - React.useEffect(() => { - const jssStyles = document.querySelector('#jss-server-side'); - if (jssStyles) { - jssStyles.parentElement.removeChild(jssStyles); - } - }, []); - return ( - + + {/* CssBaseline kickstart an elegant, consistent, and simple baseline to build upon. */} + @@ -205,11 +201,11 @@ ReactDOM.hydrate(
    , document.querySelector('#root')); ## Reference implementations -We host different reference implementations which you can find in the [GitHub repository](https://github.com/mui-org/material-ui) under the [`/examples`](https://github.com/mui-org/material-ui/tree/master/examples) folder: +We host different reference implementations which you can find in the [GitHub repository](https://github.com/mui-org/material-ui) under the [`/examples`](https://github.com/mui-org/material-ui/tree/HEAD/examples) folder: -- [The reference implementation of this tutorial](https://github.com/mui-org/material-ui/tree/next/examples/ssr) -- [Gatsby](https://github.com/mui-org/material-ui/tree/next/examples/gatsby) -- https://github.com/mui-org/material-ui/tree/master/examples/nextjs +- [The reference implementation of this tutorial](https://github.com/mui-org/material-ui/tree/HEAD/examples/ssr) +- [Gatsby](https://github.com/mui-org/material-ui/tree/HEAD/examples/gatsby) +- [Next.js](https://github.com/mui-org/material-ui/tree/HEAD/examples/nextjs) ([TypeScript version](https://github.com/mui-org/material-ui/tree/HEAD/examples/nextjs-with-typescript)) ## Troubleshooting diff --git a/docs/src/pages/guides/server-rendering/server-rendering-fr.md b/docs/src/pages/guides/server-rendering/server-rendering-fr.md index 7232aafd3dd5cc..3713ffbbd8bee6 100644 --- a/docs/src/pages/guides/server-rendering/server-rendering-fr.md +++ b/docs/src/pages/guides/server-rendering/server-rendering-fr.md @@ -124,8 +124,7 @@ function handleRender(req, res) { ), ); - // Grab the CSS from the sheets. - const css = sheets.toString(); + // Grab the CSS from the sheets. const css = sheets.toString(); // Grab the CSS from emotion const styles = extractCritical(html); @@ -200,6 +199,14 @@ function Main() { ); } +ReactDOM.hydrate(
    , document.querySelector('#root')); */} + + + + + ); +} + ReactDOM.hydrate(
    , document.querySelector('#root')); ``` @@ -207,8 +214,8 @@ ReactDOM.hydrate(
    , document.querySelector('#root')); We host different reference implementations which you can find in the [GitHub repository](https://github.com/mui-org/material-ui) under the [`/examples`](https://github.com/mui-org/material-ui/tree/master/examples) folder: -- [The reference implementation of this tutorial](https://github.com/mui-org/material-ui/tree/next/examples/ssr) -- [Gatsby](https://github.com/mui-org/material-ui/tree/next/examples/gatsby) +- [The reference implementation of this tutorial](https://github.com/mui-org/material-ui/tree/HEAD/examples/ssr) +- [Gatsby](https://github.com/mui-org/material-ui/tree/HEAD/examples/gatsby) - https://github.com/mui-org/material-ui/tree/master/examples/nextjs ## Résolution de problèmes diff --git a/docs/src/pages/guides/server-rendering/server-rendering-ja.md b/docs/src/pages/guides/server-rendering/server-rendering-ja.md index a6759552ae6176..46fbc0dbec73a3 100644 --- a/docs/src/pages/guides/server-rendering/server-rendering-ja.md +++ b/docs/src/pages/guides/server-rendering/server-rendering-ja.md @@ -1,21 +1,21 @@ # サーバーサイドレンダリング -

    サーバーサイドレンダリングの最も一般的な使用例は、ユーザー(または検索エンジンのクローラー)が最初にアプリを要求した際に、最初に提示される画面を描画するのに使われます。

    +

    サーバーサイドレンダリングの最も一般的な使用例は、ユーザー(または検索エンジンのクローラー)が最初にアプリをリクエストしたときの初期レンダリングを処理することです。

    -サーバはリクエストを受け付けると、必要なコンポーネントをHTMLフォーマットの文字列として書き出し、クライアント側に送り返します。 そして、初回リクエスト以降のレンダリングはクライアント側で行います。 そして、初回リクエスト以降のレンダリングはクライアント側で行います。 そして、初回リクエスト以降のレンダリングはクライアント側で行います。 +サーバはリクエストを受け付けると、必要なコンポーネントをHTMLフォーマットの文字列として書き出し、クライアント側に送り返します。 そして、初回リクエスト以降のレンダリングはクライアント側で行います。 ## Material-UIをサーバ上で使用する Material-UIは、サーバーでのレンダリングの制約を考慮してゼロから設計されましたが、正しく統合されるかどうかはユーザー次第です。 サーバサイドレンダリングでは必要とされるCSSが正しく渡される必要があります。HTML要素だけを返しクライアントサイドでCSSが挿入されるのを待つようにコード書かれた場合、CSSが適用される前後でチラつき(俗にいうFOUC)が発生する場合があります。 クライアントにスタイルを注入するには、次のことが必要です。 -1. 新しい[`ServerStyleSheets`](/styles/api/#serverstylesheets) のインスタンスを毎リクエストごとに作成する。 +1. Create a fresh, new [`emotion cache`](https://emotion.sh/docs/@emotion/cache) instance on every request. 2. Server-side collectorを使用しReactのコンポーネントツリーを描画する。 3. コンポーネントツリーで必要となるCSSを読み込む 4. CSSをツリーと一緒にクライアント側へ渡す。 -クライアントサイドでは上記のサーバサイドで書かれたCSSが取り除かれるより前に、本来のCSSが挿入されます。 +On the client-side, the CSS will be injected a second time before removing the server-side injected CSS. -## 設定する +## Setting up ここからは、サーバーサイドレンダリングをどう設定するかについて見ていきます。 @@ -41,9 +41,6 @@ const theme = createTheme({ error: { main: red.A400, }, - background: { - default: '#fff', - }, }, }); @@ -52,7 +49,7 @@ export default theme; ### サーバーサイド -サーバーサイドのコードは概ね次の様になります。 サーバーサイドのコードは概ね次の様になります。 サーバーサイドのコードは概ね次の様になります。 サーバーサイドのコードは概ね次の様になります。 ここでは[Express](https://expressjs.com/en/guide/using-middleware.html) 使用し、[app.use](https://expressjs.com/en/api.html)を用いてサーバへの全てのリクエストを捌いていきます。 もしExpressや他のサーバーアプリケーションにあまり馴染みがない場合、サーバーへのリクエストごとにhandleRender関数が呼ばれるということだけを覚えておいてください。 もしExpressや他のサーバーアプリケーションにあまり馴染みがない場合、サーバーへのリクエストごとにhandleRender関数が呼ばれるということだけを覚えておいてください。 もしExpressや他のサーバーアプリケーションにあまり馴染みがない場合、サーバーへのリクエストごとにhandleRender関数が呼ばれるということだけを覚えておいてください。 もしExpressや他のサーバーアプリケーションにあまり馴染みがない場合、サーバーへのリクエストごとにhandleRender関数が呼ばれるということだけを覚えておいてください。 +サーバーサイドのコードは概ね次の様になります。 We are going to set up an [Express middleware](https://expressjs.com/en/guide/using-middleware.html) using [app.use](https://expressjs.com/en/api.html) to handle all requests that come into the server. If you're unfamiliar with Express or middleware, know that the `handleRender` function will be called every time the server receives a request. `server.js` @@ -79,27 +76,29 @@ const app = express(); // Isso é acionado toda vez que o servidor recebe uma solicitação. ``` -### リクエストハンドリング +### Handling the request -リクエストをサーバで受け付けた後、まず最初に行わなくてはいけないのは新しい`ServerStyleSheets`インスタンスの作成です。 +The first thing that we need to do on every request is to create a new `emotion cache`. -画面を描画する際に、ルートコンポーネントである`App`コンポーネントを [`StylesProvider`](/styles/api/#stylesprovider)と [`ThemeProvider`](/styles/api/#themeprovider)でラップします。 これによりスタイルの設定が行われ、コンポーネントツリー内に存在する全てのコンポーネントが`theme`インスタンスにアクセスできる様になります。 +When rendering, we will wrap `App`, the root component, inside a [`CacheProvider`](https://emotion.sh/docs/cache-provider) and [`ThemeProvider`](/styles/api/#themeprovider) to make the style configuration and the `theme` available to all components in the component tree. -サーバーサイドレンダリングにおいて最も重要なステップは、最初に描画されるHTMLをクライアントに**渡す前**に描画しきることです。 サーバーサイドレンダリングにおいて最も重要なステップは、最初に描画されるHTMLをクライアントに**渡す前**に描画しきることです。 サーバーサイドレンダリングにおいて最も重要なステップは、最初に描画されるHTMLをクライアントに**渡す前**に描画しきることです。 これを実現するために [ReactDOMServer.renderToString()](https://reactjs.org/docs/react-dom-server.html)を使用します。 +The key step in server-side rendering is to render the initial HTML of the component **before** we send it to the client-side. これを実現するために [ReactDOMServer.renderToString()](https://reactjs.org/docs/react-dom-server.html)を使用します。 -その後、対象のCSS を`sheets` インスタンスから`sheets.toString()`を用いて文字列として取得します。 ここで、先ほどの`renderFullPage`関数の中で、これらの値がどの様に受け渡されるを見ていきます。 As we are also using emotion as our default styled engine, we need to extract the styles from the emotion instance as well. For this we need to share the same cache definition for both the client and server: +Material-UI is using emotion as its default styled engine. We need to extract the styles from the emotion instance. For this, we need to share the same cache configuration for both the client and server: -`cache.js` +`getCache.js` ```js import createCache from '@emotion/cache'; -const cache = createCache({ key: 'css' }); - -export default cache; +export default function getCache() { + const cache = createCache({ key: 'css' }); + cache.compat = true; + return cache; +} ``` -With this we are creating new Emotion server instance and using this to extract the critical styles for the html as well. +With this we are creating new emotion cache instance and using this to extract the critical styles for the html as well. ここで、先ほどの`renderFullPage`関数の中で、これらの値がどの様に受け渡されるを見ていきます。 @@ -107,36 +106,35 @@ With this we are creating new Emotion server instance and using this to extract import express from 'express'; import * as React from 'react'; import ReactDOMServer from 'react-dom/server'; -import { ServerStyleSheets, ThemeProvider } from '@material-ui/core/styles'; +import CssBaseline from '@material-ui/core/CssBaseline'; +import { ThemeProvider } from '@material-ui/core/styles'; import createEmotionServer from '@emotion/server/create-instance'; import App from './App'; import theme from './theme'; -import cache from './cache'; - -const { extractCritical } = createEmotionServer(cache); +import getCache from './getCache'; function handleRender(req, res) { - const sheets = new ServerStyleSheets(); + const cache = getCache(); + const { extractCriticalToChunks, constructStyleTagsFromChunks } = + createEmotionServer(cache); // Render the component to a string. const html = ReactDOMServer.renderToString( - sheets.collect( - - - - - , - ), + + + {/* CssBaseline kickstart an elegant, consistent, and simple baseline to build upon. */} + + + + , ); - // Grab the CSS from the sheets. - const css = sheets.toString(); - // Grab the CSS from emotion - const styles = extractCritical(html); + const emotionChunks = extractCriticalToChunks(html); + const emotionCss = constructStyleTagsFromChunks(emotionChunks); // Send the rendered page back to the client. - res.send(renderFullPage(html, `${css} ${styles.css}`)); + res.send(renderFullPage(html, emotionCss)); } const app = express(); @@ -152,9 +150,9 @@ const app = express(); // Isso é acionado toda vez que o servidor recebe uma solicitação. ``` -### コンポーネントHTML・CSSをテンプレートに挿入する +### Inject initial component HTML and CSS -最後に、コンポーネントツリーから作成されたCSSとHTMLをクライアントサイドで描画するためのテンプレートに差し込みます。 +The final step on the server-side is to inject the initial component HTML and CSS into a template to be rendered on the client-side. ```js function renderFullPage(html, css) { @@ -163,7 +161,9 @@ function renderFullPage(html, css) { My page - + ${css} + +
    ${html}
    @@ -173,32 +173,28 @@ function renderFullPage(html, css) { } ``` -### クライアントサイド +### The client-side -クライアント側は簡単です。 サーバーサイドで生成された CSS を削除するだけです。 クライアント側のコードを見てみましょう: +The client-side is straightforward. All we need to do is use the same cache configuration as the server-side. クライアント側のコードを見てみましょう: `client.js` ```jsx import * as React from 'react'; import ReactDOM from 'react-dom'; +import CssBaseline from '@material-ui/core/CssBaseline'; import { ThemeProvider } from '@material-ui/core/styles'; import { CacheProvider } from '@emotion/react'; import App from './App'; import theme from './theme'; -import cache from './cache'; +import getCache from './getCache'; function Main() { - React.useEffect(() => { - const jssStyles = document.querySelector('#jss-server-side'); - if (jssStyles) { - jssStyles.parentElement.removeChild(jssStyles); - } - }, []); - return ( - + + {/* CssBaseline kickstart an elegant, consistent, and simple baseline to build upon. */} + @@ -210,11 +206,11 @@ ReactDOM.hydrate(
    , document.querySelector('#root')); ## 参考実装 -We host different reference implementations which you can find in the [GitHub repository](https://github.com/mui-org/material-ui) under the [`/examples`](https://github.com/mui-org/material-ui/tree/master/examples) folder: +We host different reference implementations which you can find in the [GitHub repository](https://github.com/mui-org/material-ui) under the [`/examples`](https://github.com/mui-org/material-ui/tree/HEAD/examples) folder: -- [このチュートリアルの実装サンプル](https://github.com/mui-org/material-ui/tree/next/examples/ssr) -- [Gatsby](https://github.com/mui-org/material-ui/tree/next/examples/gatsby) -- https://github.com/mui-org/material-ui/tree/master/examples/nextjs +- [このチュートリアルの実装サンプル](https://github.com/mui-org/material-ui/tree/HEAD/examples/ssr) +- [Gatsby](https://github.com/mui-org/material-ui/tree/HEAD/examples/gatsby) +- [Next.js](https://github.com/mui-org/material-ui/tree/HEAD/examples/nextjs) ([TypeScript version](https://github.com/mui-org/material-ui/tree/HEAD/examples/nextjs-with-typescript)) ## トラブルシューティング diff --git a/docs/src/pages/guides/server-rendering/server-rendering-pt.md b/docs/src/pages/guides/server-rendering/server-rendering-pt.md index 067c08374c0638..5489a6802da0c3 100644 --- a/docs/src/pages/guides/server-rendering/server-rendering-pt.md +++ b/docs/src/pages/guides/server-rendering/server-rendering-pt.md @@ -8,14 +8,14 @@ Quando o servidor recebe a solicitação, ele renderiza o(s) componente(s) reque O Material-UI foi projetado em base com garantias de renderização no servidor, mas cabe a você certificar-se de que ele será integrado corretamente. É importante fornecer a página com o CSS necessário, caso contrário a página irá renderizar somente o HTML até o CSS ser injetado pelo cliente, causando uma tremulação (FOUC). Para injetar o estilo no cliente, precisamos: -1. Crie uma instância nova do [`ServerStyleSheets`](/styles/api/#serverstylesheets) em cada requisição. +1. Create a fresh, new [`emotion cache`](https://emotion.sh/docs/@emotion/cache) instance on every request. 2. Renderize a árvore React com o coletor do lado do servidor. 3. Capture o CSS. 4. Passe o CSS junto ao cliente. -No lado do cliente, o CSS será injetado uma segunda vez antes de remover o CSS injetado no lado do servidor. +On the client-side, the CSS will be injected a second time before removing the server-side injected CSS. -## Configurando +## Setting up No passo a passo a seguir, vamos ver como configurar a renderização do lado do servidor. @@ -41,9 +41,6 @@ const theme = createTheme({ error: { main: red.A400, }, - background: { - default: '#fff', - }, }, }); @@ -52,7 +49,7 @@ export default theme; ### O lado do servidor -A seguir um esboço para o aspecto do que o servidor deve lidar. Vamos montar um [middleware Express](https://expressjs.com/en/guide/using-middleware.html) usando [app.use](https://expressjs.com/en/api.html) para lidar com todas as requisições que chegam ao servidor. Se você não estiver familiarizado com o Express ou middleware, saiba apenas, que a função handleRender será chamada toda vez que o servidor receber uma requisição. +A seguir um esboço para o aspecto do que o servidor deve lidar. We are going to set up an [Express middleware](https://expressjs.com/en/guide/using-middleware.html) using [app.use](https://expressjs.com/en/api.html) to handle all requests that come into the server. If you're unfamiliar with Express or middleware, know that the `handleRender` function will be called every time the server receives a request. `server.js` @@ -77,80 +74,81 @@ const port = 3000; app.listen(port); ``` -### Manipulando a requisição +### Handling the request -A primeira coisa que precisamos fazer em cada solicitação é criar um novo `ServerStyleSheets`. +The first thing that we need to do on every request is to create a new `emotion cache`. -Quando renderizando, vamos encapsular `App`, o componente raiz, dentro de um [`StylesProvider`](/styles/api/#stylesprovider) e [`ThemeProvider`](/styles/api/#themeprovider) para tornar a configuração de estilo e o `theme` disponíveis para todos os componentes na árvore de componentes. +When rendering, we will wrap `App`, the root component, inside a [`CacheProvider`](https://emotion.sh/docs/cache-provider) and [`ThemeProvider`](/styles/api/#themeprovider) to make the style configuration and the `theme` available to all components in the component tree. -A etapa principal na renderização do lado do servidor, é renderizar o HTML inicial do componente **antes** de enviarmos para o lado do cliente. Para fazer isso, usamos [ReactDOMServer.renderToString()](https://reactjs.org/docs/react-dom-server.html). +The key step in server-side rendering is to render the initial HTML of the component **before** we send it to the client-side. Para fazer isso, usamos [ReactDOMServer.renderToString()](https://reactjs.org/docs/react-dom-server.html). -Em seguida, obtemos o CSS das `folhas` usando `sheets.toString()`. Uma vez que também estamos usando emotion como nosso motor padrão de estilos, precisamos extrair os estilos também da instância do emotion. Para isso, precisamos compartilhar a mesma definição de cache tanto para o cliente quanto para o servidor: +Material-UI is using emotion as its default styled engine. We need to extract the styles from the emotion instance. For this, we need to share the same cache configuration for both the client and server: -`cache.js` +`getCache.js` ```js import createCache from '@emotion/cache'; -const cache = createCache({ key: 'css' }); - -export default cache; +export default function getCache() { + const cache = createCache({ key: 'css' }); + cache.compat = true; + return cache; +} ``` -Com isto estamos criando uma nova instância do servidor Emotion e usando isto para extrair os estilos críticos para o html também. +With this we are creating new emotion cache instance and using this to extract the critical styles for the html as well. Vamos ver como isso é passado na função `renderFullPage`. ```jsx -res.send(renderFullPage(html, `${css} ${styles.css}`)); -} - -const app = express(); - -app.use('/build', express.static('build')); - -// Isso é acionado toda vez que o servidor recebe uma requisição. - import express from 'express'; +import express from 'express'; import * as React from 'react'; import ReactDOMServer from 'react-dom/server'; -import { ServerStyleSheets, ThemeProvider } from '@material-ui/core/styles'; +import CssBaseline from '@material-ui/core/CssBaseline'; +import { ThemeProvider } from '@material-ui/core/styles'; import createEmotionServer from '@emotion/server/create-instance'; import App from './App'; import theme from './theme'; -import cache from './cache'; - -const { extractCritical } = createEmotionServer(cache); +import getCache from './getCache'; function handleRender(req, res) { - const sheets = new ServerStyleSheets(); + const cache = getCache(); + const { extractCriticalToChunks, constructStyleTagsFromChunks } = + createEmotionServer(cache); - // Renderiza o componente para uma string. + // Render the component to a string. const html = ReactDOMServer.renderToString( - sheets.collect( - - - - - , - ), + + + {/* CssBaseline kickstart an elegant, consistent, and simple baseline to build upon. */} + + + + , ); - // Pegue o CSS das folhas. - const css = sheets.toString(); + // Grab the CSS from emotion + const emotionChunks = extractCriticalToChunks(html); + const emotionCss = constructStyleTagsFromChunks(emotionChunks); - // Pegue o CSS do emotion - const styles = extractCritical(html); + // Send the rendered page back to the client. + res.send(renderFullPage(html, emotionCss)); +} - // Envie a página renderizada de volta para o cliente. +const app = express(); + +app.use('/build', express.static('build')); + +// This is fired every time the server-side receives a request. app.use(handleRender); const port = 3000; app.listen(port); ``` -### Injetar Componente Inicial HTML e CSS +### Inject initial component HTML and CSS -A etapa final no lado do servidor é injetar o componente HTML e CSS inicial em um modelo a ser renderizado no lado do cliente. +The final step on the server-side is to inject the initial component HTML and CSS into a template to be rendered on the client-side. ```js function renderFullPage(html, css) { @@ -158,8 +156,10 @@ function renderFullPage(html, css) { - Minha página - + My page + ${css} + +
    ${html}
    @@ -169,32 +169,28 @@ function renderFullPage(html, css) { } ``` -### O lado do cliente +### The client-side -O lado do cliente é simples. Tudo o que precisamos fazer é remover o CSS gerado no lado do servidor. Vamos dar uma olhada no arquivo do cliente: +The client-side is straightforward. All we need to do is use the same cache configuration as the server-side. Vamos dar uma olhada no arquivo do cliente: `client.js` ```jsx import * as React from 'react'; import ReactDOM from 'react-dom'; +import CssBaseline from '@material-ui/core/CssBaseline'; import { ThemeProvider } from '@material-ui/core/styles'; import { CacheProvider } from '@emotion/react'; import App from './App'; import theme from './theme'; -import cache from './cache'; +import getCache from './getCache'; function Main() { - React.useEffect(() => { - const jssStyles = document.querySelector('#jss-server-side'); - if (jssStyles) { - jssStyles.parentElement.removeChild(jssStyles); - } - }, []); - return ( - + + {/* CssBaseline kickstart an elegant, consistent, and simple baseline to build upon. */} + @@ -206,11 +202,11 @@ ReactDOM.hydrate(
    , document.querySelector('#root')); ## Implementações de referência -Nós hospedamos diferentes implementações de referência que você pode encontrar no [repositório GitHub](https://github.com/mui-org/material-ui) sob a pasta o [`/examples`](https://github.com/mui-org/material-ui/tree/master/examples): +We host different reference implementations which you can find in the [GitHub repository](https://github.com/mui-org/material-ui) under the [`/examples`](https://github.com/mui-org/material-ui/tree/HEAD/examples) folder: -- [A implementação de referência deste tutorial](https://github.com/mui-org/material-ui/tree/next/examples/ssr) -- [Gatsby](https://github.com/mui-org/material-ui/tree/next/examples/gatsby) -- [Next.js](https://github.com/mui-org/material-ui/tree/next/examples/nextjs) ([Versão TypeScript](https://github.com/mui-org/material-ui/tree/next/examples/nextjs-with-typescript)) +- [A implementação de referência deste tutorial](https://github.com/mui-org/material-ui/tree/HEAD/examples/ssr) +- [Gatsby](https://github.com/mui-org/material-ui/tree/HEAD/examples/gatsby) +- [Next.js](https://github.com/mui-org/material-ui/tree/HEAD/examples/nextjs) ([TypeScript version](https://github.com/mui-org/material-ui/tree/HEAD/examples/nextjs-with-typescript)) ## Resolução de problemas diff --git a/docs/src/pages/guides/server-rendering/server-rendering-ru.md b/docs/src/pages/guides/server-rendering/server-rendering-ru.md index 5ddb8cbdca306f..470f4a6430954d 100644 --- a/docs/src/pages/guides/server-rendering/server-rendering-ru.md +++ b/docs/src/pages/guides/server-rendering/server-rendering-ru.md @@ -8,14 +8,14 @@ Material-UI was designed from the ground-up with the constraint of rendering on the server, but it's up to you to make sure it's correctly integrated. It's important to provide the page with the required CSS, otherwise the page will render with just the HTML then wait for the CSS to be injected by the client, causing it to flicker (FOUC). It's important to provide the page with the required CSS, otherwise the page will render with just the HTML then wait for the CSS to be injected by the client, causing it to flicker (FOUC). -1. Create a fresh, new [`ServerStyleSheets`](/styles/api/#serverstylesheets) instance on every request. +1. Create a fresh, new [`emotion cache`](https://emotion.sh/docs/@emotion/cache) instance on every request. 2. Render the React tree with the server-side collector. 3. Pull the CSS out. 4. Передать CSS клиенту. -На стороне клиента CSS будет добавлен второй раз перед удалением добавленного сервером CSS. +On the client-side, the CSS will be injected a second time before removing the server-side injected CSS. -## Настройка +## Setting up В следующем рецепте мы рассмотрим, как настроить серверную отрисовку. @@ -41,9 +41,6 @@ const theme = createTheme({ error: { main: red.A400, }, - background: { - default: '#fff', - }, }, }); @@ -52,7 +49,7 @@ export default theme; ### The server-side -The following is the outline for what the server-side is going to look like. We are going to set up an [Express middleware](https://expressjs.com/en/guide/using-middleware.html) using [app.use](https://expressjs.com/en/api.html) to handle all requests that come in to the server. If you're unfamiliar with Express or middleware, just know that the handleRender function will be called every time the server receives a request. +The following is the outline for what the server-side is going to look like. We are going to set up an [Express middleware](https://expressjs.com/en/guide/using-middleware.html) using [app.use](https://expressjs.com/en/api.html) to handle all requests that come into the server. If you're unfamiliar with Express or middleware, know that the `handleRender` function will be called every time the server receives a request. `server.js` @@ -74,27 +71,29 @@ const app = express(); // Isso é acionado toda vez que o servidor recebe uma solicitação. ``` -### Обработка запроса +### Handling the request -The first thing that we need to do on every request is create a new `ServerStyleSheets`. +The first thing that we need to do on every request is to create a new `emotion cache`. -When rendering, we will wrap `App`, the root component, inside a [`StylesProvider`](/styles/api/#stylesprovider) and [`ThemeProvider`](/styles/api/#themeprovider) to make the style configuration and the `theme` available to all components in the component tree. +When rendering, we will wrap `App`, the root component, inside a [`CacheProvider`](https://emotion.sh/docs/cache-provider) and [`ThemeProvider`](/styles/api/#themeprovider) to make the style configuration and the `theme` available to all components in the component tree. -The key step in server-side rendering is to render the initial HTML of the component **before** we send it to the client side. To do this, we use [ReactDOMServer.renderToString()](https://reactjs.org/docs/react-dom-server.html). +The key step in server-side rendering is to render the initial HTML of the component **before** we send it to the client-side. To do this, we use [ReactDOMServer.renderToString()](https://reactjs.org/docs/react-dom-server.html). -We then get the CSS from the `sheets` using `sheets.toString()`. As we are also using emotion as our default styled engine, we need to extract the styles from the emotion instance as well. For this we need to share the same cache definition for both the client and server: +Material-UI is using emotion as its default styled engine. We need to extract the styles from the emotion instance. For this, we need to share the same cache configuration for both the client and server: -`cache.js` +`getCache.js` ```js import createCache from '@emotion/cache'; -const cache = createCache({ key: 'css' }); - -export default cache; +export default function getCache() { + const cache = createCache({ key: 'css' }); + cache.compat = true; + return cache; +} ``` -With this we are creating new Emotion server instance and using this to extract the critical styles for the html as well. +With this we are creating new emotion cache instance and using this to extract the critical styles for the html as well. We will see how this is passed along in the `renderFullPage` function. @@ -102,36 +101,35 @@ We will see how this is passed along in the `renderFullPage` function. import express from 'express'; import * as React from 'react'; import ReactDOMServer from 'react-dom/server'; -import { ServerStyleSheets, ThemeProvider } from '@material-ui/core/styles'; +import CssBaseline from '@material-ui/core/CssBaseline'; +import { ThemeProvider } from '@material-ui/core/styles'; import createEmotionServer from '@emotion/server/create-instance'; import App from './App'; import theme from './theme'; -import cache from './cache'; - -const { extractCritical } = createEmotionServer(cache); +import getCache from './getCache'; function handleRender(req, res) { - const sheets = new ServerStyleSheets(); + const cache = getCache(); + const { extractCriticalToChunks, constructStyleTagsFromChunks } = + createEmotionServer(cache); // Render the component to a string. const html = ReactDOMServer.renderToString( - sheets.collect( - - - - - , - ), + + + {/* CssBaseline kickstart an elegant, consistent, and simple baseline to build upon. */} + + + + , ); - // Grab the CSS from the sheets. - const css = sheets.toString(); - // Grab the CSS from emotion - const styles = extractCritical(html); + const emotionChunks = extractCriticalToChunks(html); + const emotionCss = constructStyleTagsFromChunks(emotionChunks); // Send the rendered page back to the client. - res.send(renderFullPage(html, `${css} ${styles.css}`)); + res.send(renderFullPage(html, emotionCss)); } const app = express(); @@ -147,9 +145,9 @@ const app = express(); // Isso é acionado toda vez que o servidor recebe uma solicitação. ``` -### Inject Initial Component HTML and CSS +### Inject initial component HTML and CSS -The final step on the server-side is to inject the initial component HTML and CSS into a template to be rendered on the client side. +The final step on the server-side is to inject the initial component HTML and CSS into a template to be rendered on the client-side. ```js function renderFullPage(html, css) { @@ -158,7 +156,9 @@ function renderFullPage(html, css) { My page - + ${css} + +
    ${html}
    @@ -168,32 +168,28 @@ function renderFullPage(html, css) { } ``` -### The Client Side +### The client-side -The client side is straightforward. All we need to do is remove the server-side generated CSS. Let's take a look at the client file: +The client-side is straightforward. All we need to do is use the same cache configuration as the server-side. Let's take a look at the client file: `client.js` ```jsx import * as React from 'react'; import ReactDOM from 'react-dom'; +import CssBaseline from '@material-ui/core/CssBaseline'; import { ThemeProvider } from '@material-ui/core/styles'; import { CacheProvider } from '@emotion/react'; import App from './App'; import theme from './theme'; -import cache from './cache'; +import getCache from './getCache'; function Main() { - React.useEffect(() => { - const jssStyles = document.querySelector('#jss-server-side'); - if (jssStyles) { - jssStyles.parentElement.removeChild(jssStyles); - } - }, []); - return ( - + + {/* CssBaseline kickstart an elegant, consistent, and simple baseline to build upon. */} + @@ -205,11 +201,11 @@ ReactDOM.hydrate(
    , document.querySelector('#root')); ## Reference implementations -We host different reference implementations which you can find in the [GitHub repository](https://github.com/mui-org/material-ui) under the [`/examples`](https://github.com/mui-org/material-ui/tree/master/examples) folder: +We host different reference implementations which you can find in the [GitHub repository](https://github.com/mui-org/material-ui) under the [`/examples`](https://github.com/mui-org/material-ui/tree/HEAD/examples) folder: -- [The reference implementation of this tutorial](https://github.com/mui-org/material-ui/tree/next/examples/ssr) -- [Gatsby](https://github.com/mui-org/material-ui/tree/next/examples/gatsby) -- https://github.com/mui-org/material-ui/tree/master/examples/nextjs +- [The reference implementation of this tutorial](https://github.com/mui-org/material-ui/tree/HEAD/examples/ssr) +- [Gatsby](https://github.com/mui-org/material-ui/tree/HEAD/examples/gatsby) +- [Next.js](https://github.com/mui-org/material-ui/tree/HEAD/examples/nextjs) ([TypeScript version](https://github.com/mui-org/material-ui/tree/HEAD/examples/nextjs-with-typescript)) ## Troubleshooting diff --git a/docs/src/pages/guides/server-rendering/server-rendering-zh.md b/docs/src/pages/guides/server-rendering/server-rendering-zh.md index e3f05dd9a11273..dce7b2a352b690 100644 --- a/docs/src/pages/guides/server-rendering/server-rendering-zh.md +++ b/docs/src/pages/guides/server-rendering/server-rendering-zh.md @@ -8,14 +8,14 @@ Material-UI 最初设计受到了在服务器端渲染的约束,但是您可以完全负责它的正确整合。 为页面提供所需的 CSS 是至关重要的,否则页面只会渲染 HTML 而等待客户端注入 CSS,从而导致浏览器样式闪烁(FOUC)。 若想将样式注入客户端,我们需要: -1. 在每个请求上创建一个全新的 [`ServerStyleSheets`](/styles/api/#serverstylesheets) 实例。 +1. Create a fresh, new [`emotion cache`](https://emotion.sh/docs/@emotion/cache) instance on every request. 2. 用服务端收集器渲染 React 树组件。 3. 将 CSS 单独拿出。 4. 将 CSS 传递给客户端。 -在删除服务器端注入的 CSS 之前,客户端将第二次注入 CSS。 +On the client-side, the CSS will be injected a second time before removing the server-side injected CSS. -## 配置 +## Setting up 在下面的配置中,我们将了解如何设置服务器端的渲染。 @@ -41,9 +41,6 @@ const theme = createTheme({ error: { main: red.A400, }, - background: { - default: '#fff', - }, }, }); @@ -52,7 +49,7 @@ export default theme; ### 服务器端 -下面的大纲可以大致展现一下服务器端。 我们将使用 [app.use](https://expressjs.com/en/api.html) 建立一个 [Express 中间件](https://expressjs.com/en/guide/using-middleware.html) 来处理所有进入服务器的请求。 如果您不熟悉 Express 或中间件(middleware)的概念,那么只需要知道每次服务器收到请求时都会调用 handleRender 函数就可以了。 +下面的大纲可以大致展现一下服务器端。 We are going to set up an [Express middleware](https://expressjs.com/en/guide/using-middleware.html) using [app.use](https://expressjs.com/en/api.html) to handle all requests that come into the server. If you're unfamiliar with Express or middleware, know that the `handleRender` function will be called every time the server receives a request. `server.js` @@ -77,27 +74,29 @@ const port = 3000; app.listen(port); ``` -### 处理请求 +### Handling the request -对于每次请求,我们首先需要做的是创建一个 `ServerStyleSheets`。 +The first thing that we need to do on every request is to create a new `emotion cache`. -当渲染时,我们将把根组件 `App` 包裹在 [`StylesProvider`](/styles/api/#stylesprovider) 和 [`ThemeProvider`](/styles/api/#themeprovider) 中,这样组件树中的所有组件都可以使用样式配置和 `theme`。 +When rendering, we will wrap `App`, the root component, inside a [`CacheProvider`](https://emotion.sh/docs/cache-provider) and [`ThemeProvider`](/styles/api/#themeprovider) to make the style configuration and the `theme` available to all components in the component tree. -服务端渲染的关键步骤是,在将组件的初始 HTML 发送到客户端**之前**,就开始进行渲染。 我们用 [ReactDOMServer.renderToString()](https://reactjs.org/docs/react-dom-server.html) 来实现此操作。 +The key step in server-side rendering is to render the initial HTML of the component **before** we send it to the client-side. 我们用 [ReactDOMServer.renderToString()](https://reactjs.org/docs/react-dom-server.html) 来实现此操作。 -然后我们就可以使用 `sheets.toString()` 方法从`表单(sheets)`中获取 CSS。 由于我们也使用 emotion 作为默认的样式引擎,所以我们也需要从 emotion 实例中提取样式。 为此,我们需要为客户端和服务端共享相同的缓存定义: +Material-UI is using emotion as its default styled engine. We need to extract the styles from the emotion instance. For this, we need to share the same cache configuration for both the client and server: -`cache.js` +`getCache.js` ```js import createCache from '@emotion/cache'; -const cache = createCache({ key: 'css' }); - -export default cache; +export default function getCache() { + const cache = createCache({ key: 'css' }); + cache.compat = true; + return cache; +} ``` -这样做之后,我们就可以在服务器上创建新的 Emotion 实例,并用它来提取 html 的关键样式。 +With this we are creating new emotion cache instance and using this to extract the critical styles for the html as well. 我们将看到在 `renderFullPage` 函数中,是如何传递这些信息的。 @@ -105,52 +104,51 @@ export default cache; import express from 'express'; import * as React from 'react'; import ReactDOMServer from 'react-dom/server'; -import { ServerStyleSheets, ThemeProvider } from '@material-ui/core/styles'; +import CssBaseline from '@material-ui/core/CssBaseline'; +import { ThemeProvider } from '@material-ui/core/styles'; import createEmotionServer from '@emotion/server/create-instance'; import App from './App'; import theme from './theme'; -import cache from './cache'; - -const { extractCritical } = createEmotionServer(cache); +import getCache from './getCache'; function handleRender(req, res) { - const sheets = new ServerStyleSheets(); + const cache = getCache(); + const { extractCriticalToChunks, constructStyleTagsFromChunks } = + createEmotionServer(cache); - // 将组件渲染成字符串 + // Render the component to a string. const html = ReactDOMServer.renderToString( - sheets.collect( - - - - - , - ), + + + {/* CssBaseline kickstart an elegant, consistent, and simple baseline to build upon. */} + + + + , ); - // 从 sheet 中抓取 CSS。 - const css = sheets.toString(); - - // 从 emotion 中抓取 CSS - const styles = extractCritical(html); + // Grab the CSS from emotion + const emotionChunks = extractCriticalToChunks(html); + const emotionCss = constructStyleTagsFromChunks(emotionChunks); - // 将渲染好的页面发回给客户端。 - res.send(renderFullPage(html, `${css} ${styles.css}`)); + // Send the rendered page back to the client. + res.send(renderFullPage(html, emotionCss)); } const app = express(); app.use('/build', express.static('build')); -// 每当服务器端接收到一个请求时,这个功能就会被触发。 +// This is fired every time the server-side receives a request. app.use(handleRender); const port = 3000; app.listen(port); ``` -### 注入组件的初始 HTML 和 CSS +### Inject initial component HTML and CSS -服务端渲染的最后一步,则是将初始组件的 HTML 和 CSS 注入到客户端要渲染的模板当中。 +The final step on the server-side is to inject the initial component HTML and CSS into a template to be rendered on the client-side. ```js function renderFullPage(html, css) { @@ -158,8 +156,10 @@ function renderFullPage(html, css) { - 我的页面 - + My page + ${css} + +
    ${html}
    @@ -169,32 +169,28 @@ function renderFullPage(html, css) { } ``` -### 客户端 +### The client-side -客户端则是简单明了的。 我们只需要移除服务器端生成的 CSS。 让我们来看看客户端的文件: +The client-side is straightforward. All we need to do is use the same cache configuration as the server-side. 让我们来看看客户端的文件: `client.js` ```jsx import * as React from 'react'; import ReactDOM from 'react-dom'; +import CssBaseline from '@material-ui/core/CssBaseline'; import { ThemeProvider } from '@material-ui/core/styles'; import { CacheProvider } from '@emotion/react'; import App from './App'; import theme from './theme'; -import cache from './cache'; +import getCache from './getCache'; function Main() { - React.useEffect(() => { - const jssStyles = document.querySelector('#jss-server-side'); - if (jssStyles) { - jssStyles.parentElement.removeChild(jssStyles); - } - }, []); - return ( - + + {/* CssBaseline kickstart an elegant, consistent, and simple baseline to build upon. */} + @@ -206,11 +202,11 @@ ReactDOM.hydrate(
    , document.querySelector('#root')); ## 参考实现 -你可以在 [GitHub仓库](https://github.com/mui-org/material-ui) 的 [`/examples`](https://github.com/mui-org/material-ui/tree/next/examples) 文件夹下找到我们托管的不同范例项目。 +We host different reference implementations which you can find in the [GitHub repository](https://github.com/mui-org/material-ui) under the [`/examples`](https://github.com/mui-org/material-ui/tree/HEAD/examples) folder: -- [本教程的参考实现](https://github.com/mui-org/material-ui/tree/next/examples/ssr) -- [Gatsby](https://github.com/mui-org/material-ui/tree/next/examples/gatsby) -- [Next.js](https://github.com/mui-org/material-ui/tree/next/examples/nextjs) ([TypeScript 版本](https://github.com/mui-org/material-ui/tree/next/examples/nextjs-with-typescript)) +- [本教程的参考实现](https://github.com/mui-org/material-ui/tree/HEAD/examples/ssr) +- [Gatsby](https://github.com/mui-org/material-ui/tree/HEAD/examples/gatsby) +- [Next.js](https://github.com/mui-org/material-ui/tree/HEAD/examples/nextjs) ([TypeScript version](https://github.com/mui-org/material-ui/tree/HEAD/examples/nextjs-with-typescript)) ## 故障排除(Troubleshooting) diff --git a/docs/src/pages/guides/styled-engine/styled-engine-de.md b/docs/src/pages/guides/styled-engine/styled-engine-de.md new file mode 100644 index 00000000000000..f61f253e03ab2e --- /dev/null +++ b/docs/src/pages/guides/styled-engine/styled-engine-de.md @@ -0,0 +1,33 @@ +# `@material-ui/styled-engine` + +

    Configuring your preferred styling library.

    + +The default style library used for generating CSS styles for Material-UI components is [emotion](https://github.com/emotion-js/emotion). All of the Material-UI components rely on the `styled()` API to inject CSS into the page. This API is supported by multiple popular styling libraries, which makes it possible to switch between them in Material-UI. + +## How to switch to styled-components + +If you already have [styled-components](https://github.com/styled-components/styled-components) installed, it's possible to use it exclusively. There are currently two packages available to choose from: + +- `@material-ui/styled-engine` - a thin wrapper around [emotion's `styled()`](https://emotion.sh/docs/styled) API, with the addition of few other required utilities, such as the `` component, the `css` and `keyframe` helpers, etc. This is the default. +- `@material-ui/styled-engine-sc` - a similar wrapper around `styled-components`. + +These two packages implement the same interface, which makes it makes possible to replace one with the other. By default, `@material-ui/core` has `@material-ui/styled-engine` as a dependency, but you can configure your bundler to replace it with `@material-ui/styled-engine-sc`. For example, if you are using webpack you can configure this by adding a resolver: + +**webpack.config.js** + +```js +module.exports = { + //... + resolve: { + alias: { + '@material-ui/styled-engine': '@material-ui/styled-engine-sc', + }, + }, +}; +``` + +If you are using create-react-app, there is a ready-to-use template in the example projects. You can use the [create-react-app-with-styled-components example](https://github.com/mui-org/material-ui/tree/next/examples/create-react-app-with-styled-components), or its [TypeScript equivalent](https://github.com/mui-org/material-ui/tree/next/examples/create-react-app-with-styled-components-typescript). + +> **Note**: `@emotion/react`, `@emotion/styled`, and `styled-components` are optional peer dependencies of `@material-ui/core`, so you need to install them yourself. See the [Installation guide](/getting-started/installation/) for more info. + +> **Note:** This package-swap approach is identical to the replacement of React with [Preact](https://github.com/preactjs/preact). The Preact team has documented a large number of installation configurations. If you are stuck with Material-UI + styled-components, don't hesitate to check out how they solve the problem, as you can likely transfer the solution. diff --git a/docs/src/pages/guides/styled-engine/styled-engine-es.md b/docs/src/pages/guides/styled-engine/styled-engine-es.md new file mode 100644 index 00000000000000..f61f253e03ab2e --- /dev/null +++ b/docs/src/pages/guides/styled-engine/styled-engine-es.md @@ -0,0 +1,33 @@ +# `@material-ui/styled-engine` + +

    Configuring your preferred styling library.

    + +The default style library used for generating CSS styles for Material-UI components is [emotion](https://github.com/emotion-js/emotion). All of the Material-UI components rely on the `styled()` API to inject CSS into the page. This API is supported by multiple popular styling libraries, which makes it possible to switch between them in Material-UI. + +## How to switch to styled-components + +If you already have [styled-components](https://github.com/styled-components/styled-components) installed, it's possible to use it exclusively. There are currently two packages available to choose from: + +- `@material-ui/styled-engine` - a thin wrapper around [emotion's `styled()`](https://emotion.sh/docs/styled) API, with the addition of few other required utilities, such as the `` component, the `css` and `keyframe` helpers, etc. This is the default. +- `@material-ui/styled-engine-sc` - a similar wrapper around `styled-components`. + +These two packages implement the same interface, which makes it makes possible to replace one with the other. By default, `@material-ui/core` has `@material-ui/styled-engine` as a dependency, but you can configure your bundler to replace it with `@material-ui/styled-engine-sc`. For example, if you are using webpack you can configure this by adding a resolver: + +**webpack.config.js** + +```js +module.exports = { + //... + resolve: { + alias: { + '@material-ui/styled-engine': '@material-ui/styled-engine-sc', + }, + }, +}; +``` + +If you are using create-react-app, there is a ready-to-use template in the example projects. You can use the [create-react-app-with-styled-components example](https://github.com/mui-org/material-ui/tree/next/examples/create-react-app-with-styled-components), or its [TypeScript equivalent](https://github.com/mui-org/material-ui/tree/next/examples/create-react-app-with-styled-components-typescript). + +> **Note**: `@emotion/react`, `@emotion/styled`, and `styled-components` are optional peer dependencies of `@material-ui/core`, so you need to install them yourself. See the [Installation guide](/getting-started/installation/) for more info. + +> **Note:** This package-swap approach is identical to the replacement of React with [Preact](https://github.com/preactjs/preact). The Preact team has documented a large number of installation configurations. If you are stuck with Material-UI + styled-components, don't hesitate to check out how they solve the problem, as you can likely transfer the solution. diff --git a/docs/src/pages/guides/styled-engine/styled-engine-fr.md b/docs/src/pages/guides/styled-engine/styled-engine-fr.md new file mode 100644 index 00000000000000..f61f253e03ab2e --- /dev/null +++ b/docs/src/pages/guides/styled-engine/styled-engine-fr.md @@ -0,0 +1,33 @@ +# `@material-ui/styled-engine` + +

    Configuring your preferred styling library.

    + +The default style library used for generating CSS styles for Material-UI components is [emotion](https://github.com/emotion-js/emotion). All of the Material-UI components rely on the `styled()` API to inject CSS into the page. This API is supported by multiple popular styling libraries, which makes it possible to switch between them in Material-UI. + +## How to switch to styled-components + +If you already have [styled-components](https://github.com/styled-components/styled-components) installed, it's possible to use it exclusively. There are currently two packages available to choose from: + +- `@material-ui/styled-engine` - a thin wrapper around [emotion's `styled()`](https://emotion.sh/docs/styled) API, with the addition of few other required utilities, such as the `` component, the `css` and `keyframe` helpers, etc. This is the default. +- `@material-ui/styled-engine-sc` - a similar wrapper around `styled-components`. + +These two packages implement the same interface, which makes it makes possible to replace one with the other. By default, `@material-ui/core` has `@material-ui/styled-engine` as a dependency, but you can configure your bundler to replace it with `@material-ui/styled-engine-sc`. For example, if you are using webpack you can configure this by adding a resolver: + +**webpack.config.js** + +```js +module.exports = { + //... + resolve: { + alias: { + '@material-ui/styled-engine': '@material-ui/styled-engine-sc', + }, + }, +}; +``` + +If you are using create-react-app, there is a ready-to-use template in the example projects. You can use the [create-react-app-with-styled-components example](https://github.com/mui-org/material-ui/tree/next/examples/create-react-app-with-styled-components), or its [TypeScript equivalent](https://github.com/mui-org/material-ui/tree/next/examples/create-react-app-with-styled-components-typescript). + +> **Note**: `@emotion/react`, `@emotion/styled`, and `styled-components` are optional peer dependencies of `@material-ui/core`, so you need to install them yourself. See the [Installation guide](/getting-started/installation/) for more info. + +> **Note:** This package-swap approach is identical to the replacement of React with [Preact](https://github.com/preactjs/preact). The Preact team has documented a large number of installation configurations. If you are stuck with Material-UI + styled-components, don't hesitate to check out how they solve the problem, as you can likely transfer the solution. diff --git a/docs/src/pages/guides/styled-engine/styled-engine-ja.md b/docs/src/pages/guides/styled-engine/styled-engine-ja.md new file mode 100644 index 00000000000000..f61f253e03ab2e --- /dev/null +++ b/docs/src/pages/guides/styled-engine/styled-engine-ja.md @@ -0,0 +1,33 @@ +# `@material-ui/styled-engine` + +

    Configuring your preferred styling library.

    + +The default style library used for generating CSS styles for Material-UI components is [emotion](https://github.com/emotion-js/emotion). All of the Material-UI components rely on the `styled()` API to inject CSS into the page. This API is supported by multiple popular styling libraries, which makes it possible to switch between them in Material-UI. + +## How to switch to styled-components + +If you already have [styled-components](https://github.com/styled-components/styled-components) installed, it's possible to use it exclusively. There are currently two packages available to choose from: + +- `@material-ui/styled-engine` - a thin wrapper around [emotion's `styled()`](https://emotion.sh/docs/styled) API, with the addition of few other required utilities, such as the `` component, the `css` and `keyframe` helpers, etc. This is the default. +- `@material-ui/styled-engine-sc` - a similar wrapper around `styled-components`. + +These two packages implement the same interface, which makes it makes possible to replace one with the other. By default, `@material-ui/core` has `@material-ui/styled-engine` as a dependency, but you can configure your bundler to replace it with `@material-ui/styled-engine-sc`. For example, if you are using webpack you can configure this by adding a resolver: + +**webpack.config.js** + +```js +module.exports = { + //... + resolve: { + alias: { + '@material-ui/styled-engine': '@material-ui/styled-engine-sc', + }, + }, +}; +``` + +If you are using create-react-app, there is a ready-to-use template in the example projects. You can use the [create-react-app-with-styled-components example](https://github.com/mui-org/material-ui/tree/next/examples/create-react-app-with-styled-components), or its [TypeScript equivalent](https://github.com/mui-org/material-ui/tree/next/examples/create-react-app-with-styled-components-typescript). + +> **Note**: `@emotion/react`, `@emotion/styled`, and `styled-components` are optional peer dependencies of `@material-ui/core`, so you need to install them yourself. See the [Installation guide](/getting-started/installation/) for more info. + +> **Note:** This package-swap approach is identical to the replacement of React with [Preact](https://github.com/preactjs/preact). The Preact team has documented a large number of installation configurations. If you are stuck with Material-UI + styled-components, don't hesitate to check out how they solve the problem, as you can likely transfer the solution. diff --git a/docs/src/pages/guides/styled-engine/styled-engine-pt.md b/docs/src/pages/guides/styled-engine/styled-engine-pt.md new file mode 100644 index 00000000000000..f61f253e03ab2e --- /dev/null +++ b/docs/src/pages/guides/styled-engine/styled-engine-pt.md @@ -0,0 +1,33 @@ +# `@material-ui/styled-engine` + +

    Configuring your preferred styling library.

    + +The default style library used for generating CSS styles for Material-UI components is [emotion](https://github.com/emotion-js/emotion). All of the Material-UI components rely on the `styled()` API to inject CSS into the page. This API is supported by multiple popular styling libraries, which makes it possible to switch between them in Material-UI. + +## How to switch to styled-components + +If you already have [styled-components](https://github.com/styled-components/styled-components) installed, it's possible to use it exclusively. There are currently two packages available to choose from: + +- `@material-ui/styled-engine` - a thin wrapper around [emotion's `styled()`](https://emotion.sh/docs/styled) API, with the addition of few other required utilities, such as the `` component, the `css` and `keyframe` helpers, etc. This is the default. +- `@material-ui/styled-engine-sc` - a similar wrapper around `styled-components`. + +These two packages implement the same interface, which makes it makes possible to replace one with the other. By default, `@material-ui/core` has `@material-ui/styled-engine` as a dependency, but you can configure your bundler to replace it with `@material-ui/styled-engine-sc`. For example, if you are using webpack you can configure this by adding a resolver: + +**webpack.config.js** + +```js +module.exports = { + //... + resolve: { + alias: { + '@material-ui/styled-engine': '@material-ui/styled-engine-sc', + }, + }, +}; +``` + +If you are using create-react-app, there is a ready-to-use template in the example projects. You can use the [create-react-app-with-styled-components example](https://github.com/mui-org/material-ui/tree/next/examples/create-react-app-with-styled-components), or its [TypeScript equivalent](https://github.com/mui-org/material-ui/tree/next/examples/create-react-app-with-styled-components-typescript). + +> **Note**: `@emotion/react`, `@emotion/styled`, and `styled-components` are optional peer dependencies of `@material-ui/core`, so you need to install them yourself. See the [Installation guide](/getting-started/installation/) for more info. + +> **Note:** This package-swap approach is identical to the replacement of React with [Preact](https://github.com/preactjs/preact). The Preact team has documented a large number of installation configurations. If you are stuck with Material-UI + styled-components, don't hesitate to check out how they solve the problem, as you can likely transfer the solution. diff --git a/docs/src/pages/guides/styled-engine/styled-engine-ru.md b/docs/src/pages/guides/styled-engine/styled-engine-ru.md new file mode 100644 index 00000000000000..f61f253e03ab2e --- /dev/null +++ b/docs/src/pages/guides/styled-engine/styled-engine-ru.md @@ -0,0 +1,33 @@ +# `@material-ui/styled-engine` + +

    Configuring your preferred styling library.

    + +The default style library used for generating CSS styles for Material-UI components is [emotion](https://github.com/emotion-js/emotion). All of the Material-UI components rely on the `styled()` API to inject CSS into the page. This API is supported by multiple popular styling libraries, which makes it possible to switch between them in Material-UI. + +## How to switch to styled-components + +If you already have [styled-components](https://github.com/styled-components/styled-components) installed, it's possible to use it exclusively. There are currently two packages available to choose from: + +- `@material-ui/styled-engine` - a thin wrapper around [emotion's `styled()`](https://emotion.sh/docs/styled) API, with the addition of few other required utilities, such as the `` component, the `css` and `keyframe` helpers, etc. This is the default. +- `@material-ui/styled-engine-sc` - a similar wrapper around `styled-components`. + +These two packages implement the same interface, which makes it makes possible to replace one with the other. By default, `@material-ui/core` has `@material-ui/styled-engine` as a dependency, but you can configure your bundler to replace it with `@material-ui/styled-engine-sc`. For example, if you are using webpack you can configure this by adding a resolver: + +**webpack.config.js** + +```js +module.exports = { + //... + resolve: { + alias: { + '@material-ui/styled-engine': '@material-ui/styled-engine-sc', + }, + }, +}; +``` + +If you are using create-react-app, there is a ready-to-use template in the example projects. You can use the [create-react-app-with-styled-components example](https://github.com/mui-org/material-ui/tree/next/examples/create-react-app-with-styled-components), or its [TypeScript equivalent](https://github.com/mui-org/material-ui/tree/next/examples/create-react-app-with-styled-components-typescript). + +> **Note**: `@emotion/react`, `@emotion/styled`, and `styled-components` are optional peer dependencies of `@material-ui/core`, so you need to install them yourself. See the [Installation guide](/getting-started/installation/) for more info. + +> **Note:** This package-swap approach is identical to the replacement of React with [Preact](https://github.com/preactjs/preact). The Preact team has documented a large number of installation configurations. If you are stuck with Material-UI + styled-components, don't hesitate to check out how they solve the problem, as you can likely transfer the solution. diff --git a/docs/src/pages/guides/styled-engine/styled-engine-zh.md b/docs/src/pages/guides/styled-engine/styled-engine-zh.md new file mode 100644 index 00000000000000..f61f253e03ab2e --- /dev/null +++ b/docs/src/pages/guides/styled-engine/styled-engine-zh.md @@ -0,0 +1,33 @@ +# `@material-ui/styled-engine` + +

    Configuring your preferred styling library.

    + +The default style library used for generating CSS styles for Material-UI components is [emotion](https://github.com/emotion-js/emotion). All of the Material-UI components rely on the `styled()` API to inject CSS into the page. This API is supported by multiple popular styling libraries, which makes it possible to switch between them in Material-UI. + +## How to switch to styled-components + +If you already have [styled-components](https://github.com/styled-components/styled-components) installed, it's possible to use it exclusively. There are currently two packages available to choose from: + +- `@material-ui/styled-engine` - a thin wrapper around [emotion's `styled()`](https://emotion.sh/docs/styled) API, with the addition of few other required utilities, such as the `` component, the `css` and `keyframe` helpers, etc. This is the default. +- `@material-ui/styled-engine-sc` - a similar wrapper around `styled-components`. + +These two packages implement the same interface, which makes it makes possible to replace one with the other. By default, `@material-ui/core` has `@material-ui/styled-engine` as a dependency, but you can configure your bundler to replace it with `@material-ui/styled-engine-sc`. For example, if you are using webpack you can configure this by adding a resolver: + +**webpack.config.js** + +```js +module.exports = { + //... + resolve: { + alias: { + '@material-ui/styled-engine': '@material-ui/styled-engine-sc', + }, + }, +}; +``` + +If you are using create-react-app, there is a ready-to-use template in the example projects. You can use the [create-react-app-with-styled-components example](https://github.com/mui-org/material-ui/tree/next/examples/create-react-app-with-styled-components), or its [TypeScript equivalent](https://github.com/mui-org/material-ui/tree/next/examples/create-react-app-with-styled-components-typescript). + +> **Note**: `@emotion/react`, `@emotion/styled`, and `styled-components` are optional peer dependencies of `@material-ui/core`, so you need to install them yourself. See the [Installation guide](/getting-started/installation/) for more info. + +> **Note:** This package-swap approach is identical to the replacement of React with [Preact](https://github.com/preactjs/preact). The Preact team has documented a large number of installation configurations. If you are stuck with Material-UI + styled-components, don't hesitate to check out how they solve the problem, as you can likely transfer the solution. diff --git a/docs/src/pages/guides/typescript/typescript-de.md b/docs/src/pages/guides/typescript/typescript-de.md index 7c45ed2a29fe89..bc0d68f50b3f69 100644 --- a/docs/src/pages/guides/typescript/typescript-de.md +++ b/docs/src/pages/guides/typescript/typescript-de.md @@ -2,7 +2,7 @@

    Sie können statische Typisierung zu JavaScript hinzufügen, um die Produktivität und die Codequalität dank TypeScript zu verbessern.

    -Material-UI requires a minimum version of TypeScript 3.2. +Material-UI requires a minimum version of TypeScript 3.5. Schauen Sie sich das [Create React App mit TypeScript](https://github.com/mui-org/material-ui/tree/master/examples/create-react-app-with-typescript) Beispiel an. @@ -170,13 +170,21 @@ interface Props { Dies ist jedoch nicht sehr [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself) weil Sie die Klassennamen (`'root'`, `'paper'`, `'button'`, ...) an zwei verschiedenen Stellen pflegen müssen. Wir stellen einen Typoperator `WithStyles` bereit, um damit zu helfen. So kannst du einfach schreiben: ```ts -import { WithStyles, createStyles } from '@material-ui/core'; +import { createStyles } from '@material-ui/styles'; +import { WithStyles } from '@material-ui/core'; -const styles = (theme: Theme) => createStyles({ - root: { /* ... */ }, - paper: { /* ... */ }, - button: { /* ... */ }, -}); +const styles = (theme: Theme) => + createStyles({ + root: { + /* ... */ + }, + paper: { + /* ... */ + }, + button: { + /* ... */ + }, + }); interface Props extends WithStyles { foo: number; @@ -218,22 +226,21 @@ Beim Hinzufügen benutzerdefinierter Eigenschaften zum `Theme` können Sie es we Im folgenden Beispiel wird eine `appDrawer` Eigenschaft hinzugefügt, welche in das von `material-ui` exportierte Theme eingefügt wird: ```ts -import { Theme } from '@material-ui/core/styles/createTheme'; -import { Breakpoint } from '@material-ui/core/styles/createBreakpoints'; +import { Breakpoint, Theme } from '@material-ui/core/styles'; -declare module '@material-ui/core/styles/createTheme' { +declare module '@material-ui/core/styles' { interface Theme { appDrawer: { - width: React.CSSProperties['width'] - breakpoint: Breakpoint - } + width: React.CSSProperties['width']; + breakpoint: Breakpoint; + }; } // allow configuration using `createTheme` interface ThemeOptions { appDrawer?: { - width?: React.CSSProperties['width'] - breakpoint?: Breakpoint - } + width?: React.CSSProperties['width']; + breakpoint?: Breakpoint; + }; } } ``` @@ -252,7 +259,7 @@ export default function createMyTheme(options: ThemeOptions) { breakpoint: 'lg', }, ...options, - }) + }); } ``` @@ -266,7 +273,7 @@ const theme = createMyTheme({ appDrawer: { breakpoint: 'md' }}); ## Usage of `component` prop -Many Material-UI components allow you to replace their root node via a `component` prop, this will be detailed in the component's API documentation. For example, a Button's root node can be replaced with a React Router's Link, and any additional props that are passed to Button, such as `to`, will be spread to the Link component. For a code example concerning Button and react-router-dom checkout [these demos](/guides/composition/#routing-libraries). +Many Material-UI components allow you to replace their root node via a `component` prop, this will be detailed in the component's API documentation. For example, a Button's root node can be replaced with a React Router's Link, and any additional props that are passed to Button, such as `to`, will be spread to the Link component. For a code example concerning Button and react-router-dom checkout [these demos](/guides/routing/#component-prop). To be able to use props of such a Material-UI component on their own, props should be used with type arguments. Otherwise, the `component` prop will not be present in the props of the Material-UI component. diff --git a/docs/src/pages/guides/typescript/typescript-es.md b/docs/src/pages/guides/typescript/typescript-es.md index 3ccacd46b7622f..4f0c46ddad4c15 100644 --- a/docs/src/pages/guides/typescript/typescript-es.md +++ b/docs/src/pages/guides/typescript/typescript-es.md @@ -2,7 +2,7 @@

    You can add static typing to JavaScript to improve developer productivity and code quality thanks to TypeScript.

    -Material-UI requires a minimum version of TypeScript 3.2. +Material-UI requires a minimum version of TypeScript 3.5. Have a look at the [Create React App with TypeScript](https://github.com/mui-org/material-ui/tree/master/examples/create-react-app-with-typescript) example. @@ -168,13 +168,21 @@ interface Props { However this isn't very [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself) because it requires you to maintain the class names (`'root'`, `'paper'`, `'button'`, ...) in two different places. We provide a type operator `WithStyles` to help with this, so that you can just write: ```ts -import { WithStyles, createStyles } from '@material-ui/core'; +import { createStyles } from '@material-ui/styles'; +import { WithStyles } from '@material-ui/core'; -const styles = (theme: Theme) => createStyles({ - root: { /* ... */ }, - paper: { /* ... */ }, - button: { /* ... */ }, -}); +const styles = (theme: Theme) => + createStyles({ + root: { + /* ... */ + }, + paper: { + /* ... */ + }, + button: { + /* ... */ + }, + }); interface Props extends WithStyles { foo: number; @@ -216,22 +224,21 @@ When adding custom properties to the `Theme`, you may continue to use it in a st The following example adds an `appDrawer` property that is merged into the one exported by `material-ui`: ```ts -import { Theme } from '@material-ui/core/styles/createTheme'; -import { Breakpoint } from '@material-ui/core/styles/createBreakpoints'; +import { Breakpoint, Theme } from '@material-ui/core/styles'; -declare module '@material-ui/core/styles/createTheme' { +declare module '@material-ui/core/styles' { interface Theme { appDrawer: { - width: React.CSSProperties['width'] - breakpoint: Breakpoint - } + width: React.CSSProperties['width']; + breakpoint: Breakpoint; + }; } // allow configuration using `createTheme` interface ThemeOptions { appDrawer?: { - width?: React.CSSProperties['width'] - breakpoint?: Breakpoint - } + width?: React.CSSProperties['width']; + breakpoint?: Breakpoint; + }; } } ``` @@ -250,7 +257,7 @@ export default function createMyTheme(options: ThemeOptions) { breakpoint: 'lg', }, ...options, - }) + }); } ``` @@ -264,7 +271,7 @@ const theme = createMyTheme({ appDrawer: { breakpoint: 'md' }}); ## Usage of `component` prop -Many Material-UI components allow you to replace their root node via a `component` prop, this will be detailed in the component's API documentation. For example, a Button's root node can be replaced with a React Router's Link, and any additional props that are passed to Button, such as `to`, will be spread to the Link component. For a code example concerning Button and react-router-dom checkout [these demos](/guides/composition/#routing-libraries). +Many Material-UI components allow you to replace their root node via a `component` prop, this will be detailed in the component's API documentation. For example, a Button's root node can be replaced with a React Router's Link, and any additional props that are passed to Button, such as `to`, will be spread to the Link component. For a code example concerning Button and react-router-dom checkout [these demos](/guides/routing/#component-prop). To be able to use props of such a Material-UI component on their own, props should be used with type arguments. Otherwise, the `component` prop will not be present in the props of the Material-UI component. diff --git a/docs/src/pages/guides/typescript/typescript-ja.md b/docs/src/pages/guides/typescript/typescript-ja.md index dd99d5673e0388..05618f12a67738 100644 --- a/docs/src/pages/guides/typescript/typescript-ja.md +++ b/docs/src/pages/guides/typescript/typescript-ja.md @@ -2,7 +2,7 @@

    TypeScriptを使用することで、JavaScriptに静的型付けを追加し、開発者の生産性とコード品質を向上させることができます。

    -Material-UI requires a minimum version of TypeScript 3.2. +Material-UI requires a minimum version of TypeScript 3.5. [Create React AppでのTypeScript](https://github.com/mui-org/material-ui/tree/master/examples/create-react-app-with-typescript)の使用例を参考にしてください。 @@ -19,7 +19,7 @@ Material-UI requires a minimum version of TypeScript 3.2. } ``` -Strictモードのオプションは、すべてのタイプのパッケージに必要なものと同じです。 は`@types/`namespaceで発行されます。 あまり厳密でない`tsconfig.json`を使ったり、一部のライブラリを省略した場合、エラーが発生する可能性があります。 To get the best type experience with the types we recommend setting `"strict": true`. あまり厳密でない`tsconfig.json`を使ったり、一部のライブラリを省略した場合、エラーが発生する可能性があります。 To get the best type experience with the types we recommend setting `"strict": true`. To get the best type experience with the types we recommend setting `"strict": true`. +Strictモードオプションは、`@types/`名前空間で公開されている全てのtypesパッケージに必要なものと同じです。 あまり厳密でない`tsconfig.json`を使ったり、一部のライブラリを省略した場合、エラーが発生する可能性があります。 typesで最高のタイプエクスペリエンスを得るには、 `"strict": true` を設定することをお勧めします。 ## `withStyles`の使い方 @@ -43,7 +43,7 @@ withStyles(styles); // Type 'string' is not assignable to type '"-moz-initial" | "inherit" | "initial" | "revert" | "unset" | "column" | "column-reverse" | "row"...'. ``` -問題は、`flexDirection`プロパティの型が`string`として型推論されることです。 コンポーネントプロップを汎用化することで、この問題を解決するための取り組みが続けられています。 +問題は、`flexDirection`プロパティの型が`string`として型推論されることです。 これを修正するため、styleオブジェクトを直接`withStyles`に渡します: ```ts withStyles({ @@ -54,7 +54,7 @@ withStyles({ }); ``` -ただし、スタイルをテーマに依存させようとすると、タイプを広げるとい頭が再び現れます: +しかし、スタイルをテーマに依存させようとすると、型の拡大が再び表面化します: ```ts withStyles(({ palette, spacing }) => ({ @@ -112,7 +112,7 @@ const styles = createStyles({ }); ``` -However to allow these styles to pass TypeScript, the definitions have to be unambiguous concerning names for CSS classes and actual CSS property names. ただし、これらのスタイルがTypeScriptを渡せるようにするには、CSSクラスの名前と実際のCSSプロパティ名に関して定義があいまいでなければなりません。 このため、CSSプロパティと同じクラス名は使用しないでください。 +However to allow these styles to pass TypeScript, the definitions have to be unambiguous concerning names for CSS classes and actual CSS property names. このため、CSSプロパティと同じクラス名は使用しないでください。 ```ts // error because TypeScript thinks `@media (min-width: 960px)` is a class name @@ -165,16 +165,24 @@ interface Props { } ``` -しかし、これはあまり[DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself)ではありません。なぜなら、クラス名(`'root'`、`'paper'`、`'button'`、...。) を二つの異なる場所に維持する必要があるからです。 このために、型演算子`WithStyles`を使用して、次のように記述します。 このために、型演算子`WithStyles`を使用して、次のように記述します。 このために、型演算子`WithStyles`を使用して、次のように記述します。 このために、型演算子`WithStyles`を使用して、次のように記述します。 このために、型演算子`WithStyles`を使用して、次のように記述します。 このために、型演算子`WithStyles`を使用して、次のように記述します。 +しかし、これはあまり[DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself)ではありません。なぜなら、クラス名(`'root'`、`'paper'`、`'button'`、...。) を二つの異なる場所に維持する必要があるからです。 このために、型演算子`WithStyles`を使用して、次のように記述します。 ```ts -import { WithStyles, createStyles } from '@material-ui/core'; +import { createStyles } from '@material-ui/styles'; +import { WithStyles } from '@material-ui/core'; -const styles = (theme: Theme) => createStyles({ - root: { /* ... */ }, - paper: { /* ... */ }, - button: { /* ... */ }, -}); +const styles = (theme: Theme) => + createStyles({ + root: { + /* ... */ + }, + paper: { + /* ... */ + }, + button: { + /* ... */ + }, + }); interface Props extends WithStyles { foo: number; @@ -216,22 +224,21 @@ const DecoratedClass = withStyles(styles)( 次の例では、`material-ui`によって書き出されたプロパティに合成される`appDrawer`プロパティを追加します。 ```ts -import { Theme } from '@material-ui/core/styles/createTheme'; -import { Breakpoint } from '@material-ui/core/styles/createBreakpoints'; +import { Breakpoint, Theme } from '@material-ui/core/styles'; -declare module '@material-ui/core/styles/createTheme' { +declare module '@material-ui/core/styles' { interface Theme { appDrawer: { - width: React.CSSProperties['width'] - breakpoint: Breakpoint - } + width: React.CSSProperties['width']; + breakpoint: Breakpoint; + }; } // allow configuration using `createTheme` interface ThemeOptions { appDrawer?: { - width?: React.CSSProperties['width'] - breakpoint?: Breakpoint - } + width?: React.CSSProperties['width']; + breakpoint?: Breakpoint; + }; } } ``` @@ -250,7 +257,7 @@ export default function createMyTheme(options: ThemeOptions) { breakpoint: 'lg', }, ...options, - }) + }); } ``` @@ -264,7 +271,7 @@ const theme = createMyTheme({ appDrawer: { breakpoint: 'md' }}); ## Usage of `component` prop -Many Material-UI components allow you to replace their root node via a `component` prop, this will be detailed in the component's API documentation. For example, a Button's root node can be replaced with a React Router's Link, and any additional props that are passed to Button, such as `to`, will be spread to the Link component. For a code example concerning Button and react-router-dom checkout [these demos](/guides/composition/#routing-libraries). +Many Material-UI components allow you to replace their root node via a `component` prop, this will be detailed in the component's API documentation. For example, a Button's root node can be replaced with a React Router's Link, and any additional props that are passed to Button, such as `to`, will be spread to the Link component. For a code example concerning Button and react-router-dom checkout [these demos](/guides/routing/#component-prop). To be able to use props of such a Material-UI component on their own, props should be used with type arguments. Otherwise, the `component` prop will not be present in the props of the Material-UI component. @@ -305,12 +312,12 @@ function ThirdPartyComponent({ prop1 } : { prop1: string }) { The `prop1` became required for the `GenericCustomComponent` as the `ThirdPartyComponent` has it as a requirement. -すべてのコンポーネントが、渡すコンポーネントタイプを完全にサポートしているわけではありません。 すべてのコンポーネントが、渡すコンポーネントタイプを完全にサポートしているわけではありません。 If you encounter a component that rejects its `component` props in TypeScript please open an issue. すべてのコンポーネントが、渡すコンポーネントタイプを完全にサポートしているわけではありません。 If you encounter a component that rejects its `component` props in TypeScript please open an issue. コンポーネントプロップを汎用化することで、この問題を解決するための取り組みが続けられています。 +すべてのコンポーネントが、あなたが渡すコンポーネント型を完全にサポートしているわけではありません。 TypeScriptで `component`プロパティを拒否するコンポーネントに遭遇した場合は、Issueを開いてください。 componentプロパティを汎用化することで、この問題を解決するための取り組みが続けられています。 ## `value` およびイベントハンドラの処理 -ユーザ入力に関連する多くのコンポーネントは、現在の `value`を含む`value`プロパティまたはイベントハンドラを提供します。 ほとんどの場合、`値`のみが処理されます。 オブジェクトや配列などの任意のタイプを使用できます。 ほとんどの場合、`値`のみが処理されます。 オブジェクトや配列などの任意のタイプを使用できます。 ほとんどの場合、`値`のみが処理されます。 オブジェクトや配列などの任意のタイプを使用できます。 ほとんどの場合、`値`のみが処理されます。 オブジェクトや配列などの任意のタイプを使用できます。 ほとんどの場合、`値`のみが処理されます。 オブジェクトや配列などの任意のタイプを使用できます。 +ユーザ入力に関連する多くのコンポーネントは、現在の `value`を含む`value`プロパティまたはイベントハンドラを提供します。 ほとんどの場合、`値`のみが処理されます。 オブジェクトや配列などの任意のタイプを使用できます。 -ただし、そのタイプは、たとえば`Select`または`RadioGroup`など、コンポーネントの子に依存する状況では、コンパイル時に検証できません。 つまり、soundest オプションは、それを`unknown`として入力し、その型をどのように絞り込むかを開発者に決定させることです。 [同じ理由で`event.target` は Reactでは一般的ではないため](https://github.com/DefinitelyTyped/DefinitelyTyped/issues/11508#issuecomment-256045682)これらの場合にジェネリック タイプを使用する可能性は提供しません。 つまり、soundest オプションは、それを`unknown`として入力し、その型をどのように絞り込むかを開発者に決定させることです。 [同じ理由で` event.target` は Reactでは一般的ではないため](https://github.com/DefinitelyTyped/DefinitelyTyped/issues/11508#issuecomment-256045682)これらの場合にジェネリック タイプを使用する可能性は提供しません。 +ただし、そのタイプは、たとえば`Select`または`RadioGroup`など、コンポーネントの子に依存する状況では、コンパイル時に検証できません。 つまり、soundest オプションは、それを`unknown`として入力し、その型をどのように絞り込むかを開発者に決定させることです。 [同じ理由で` event.target` は Reactでは一般的ではないため](https://github.com/DefinitelyTyped/DefinitelyTyped/issues/11508#issuecomment-256045682)これらの場合にジェネリック タイプを使用する可能性は提供しません。 The demos include typed variants that use type casting. すべての型が単一のファイル内にあり、非常に基本的であるため、これは許容できるトレードオフです。 同じトレードオフが受け入れられるかどうかは、自分で判断する必要があります。 The library types are be strict by default and loose via opt-in. diff --git a/docs/src/pages/guides/typescript/typescript-pt.md b/docs/src/pages/guides/typescript/typescript-pt.md index 5f1b36e39ef46f..961bf30f5b3ecf 100644 --- a/docs/src/pages/guides/typescript/typescript-pt.md +++ b/docs/src/pages/guides/typescript/typescript-pt.md @@ -2,7 +2,7 @@

    Você pode adicionar tipagem estática para o JavaScript para melhorar a produtividade do desenvolvimento e a qualidade do código graças ao TypeScript.

    -Material-UI requer como versão mínima o TypeScript 3.2. +Material-UI requires a minimum version of TypeScript 3.5. Dê uma olhada no exemplo [Create React App com TypeScript](https://github.com/mui-org/material-ui/tree/master/examples/create-react-app-with-typescript). @@ -168,13 +168,21 @@ interface Props { No entanto isto não é muito elegante de acordo com o princípio de software [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself), porque requer que você mantenha os nomes das classes (`'root'`, `'paper'`, `'button'`, ...) em dois locais diferentes. Nós fornecemos um operador de tipo `WithStyles` para ajudar com isso, assim você pode apenas escrever: ```ts -import { WithStyles, createStyles } from '@material-ui/core'; +import { createStyles } from '@material-ui/styles'; +import { WithStyles } from '@material-ui/core'; -const styles = (theme: Theme) => createStyles({ - root: { /* ... */ }, - paper: { /* ... */ }, - button: { /* ... */ }, -}); +const styles = (theme: Theme) => + createStyles({ + root: { + /* ... */ + }, + paper: { + /* ... */ + }, + button: { + /* ... */ + }, + }); interface Props extends WithStyles { foo: number; @@ -216,22 +224,21 @@ Ao adicionar propriedades customizadas ao `Theme`, você pode continuar a utiliz O exemplo a seguir adiciona uma propriedade `appDrawer` que é mesclada na que foi exportada pelo `material-ui`: ```ts -import { Theme } from '@material-ui/core/styles/createTheme'; -import { Breakpoint } from '@material-ui/core/styles/createBreakpoints'; +import { Breakpoint, Theme } from '@material-ui/core/styles'; -declare module '@material-ui/core/styles/createTheme' { +declare module '@material-ui/core/styles' { interface Theme { appDrawer: { - width: React.CSSProperties['width'] - breakpoint: Breakpoint - } + width: React.CSSProperties['width']; + breakpoint: Breakpoint; + }; } - // permitir configuração usando `createTheme` + // allow configuration using `createTheme` interface ThemeOptions { appDrawer?: { - width?: React.CSSProperties['width'] - breakpoint?: Breakpoint - } + width?: React.CSSProperties['width']; + breakpoint?: Breakpoint; + }; } } ``` @@ -250,7 +257,7 @@ export default function createMyTheme(options: ThemeOptions) { breakpoint: 'lg', }, ...options, - }) + }); } ``` @@ -264,7 +271,7 @@ const theme = createMyTheme({ appDrawer: { breakpoint: 'md' }}); ## Uso da propriedade `component` -Muitos componentes do Material-UI permitem que você substitua seu nó raiz através de uma propriedade `component`, isto será detalhado na documentação da API do componente. Por exemplo, o nó raiz de um Button pode ser substituído por um Link do React Router, e quaisquer propriedades adicionais que são passados para o Button, como `to`, serão propagadas para o componente Link. Para um exemplo de código relativo ao Button e o react-router-dom veja [estas demonstrações](/guides/composition/#routing-libraries). +Muitos componentes do Material-UI permitem que você substitua seu nó raiz através de uma propriedade `component`, isto será detalhado na documentação da API do componente. Por exemplo, o nó raiz de um Button pode ser substituído por um Link do React Router, e quaisquer propriedades adicionais que são passados para o Button, como `to`, serão propagadas para o componente Link. Para um exemplo de código relativo ao Button e o react-router-dom veja [estas demonstrações](/guides/routing/#component-prop). Para poder usar propriedades de determinado componente Material-UI no seu componente próprio, as propriedades devem ser usadas com argumentos de tipo. Caso contrário, a propriedade `component` não estará presente nas propriedades do componente Material-UI. diff --git a/docs/src/pages/guides/typescript/typescript-ru.md b/docs/src/pages/guides/typescript/typescript-ru.md index c599abddea8bd7..b3f9f636e5ce4d 100644 --- a/docs/src/pages/guides/typescript/typescript-ru.md +++ b/docs/src/pages/guides/typescript/typescript-ru.md @@ -2,7 +2,7 @@

    You can add static typing to JavaScript to improve developer productivity and code quality thanks to TypeScript.

    -Material-UI requires a minimum version of TypeScript 3.2. +Material-UI requires a minimum version of TypeScript 3.5. Have a look at the [Create React App with TypeScript](https://github.com/mui-org/material-ui/tree/master/examples/create-react-app-with-typescript) example. @@ -168,13 +168,21 @@ interface Props { However this isn't very [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself) because it requires you to maintain the class names (`'root'`, `'paper'`, `'button'`, ...) in two different places. We provide a type operator `WithStyles` to help with this, so that you can just write: ```ts -import { WithStyles, createStyles } from '@material-ui/core'; +import { createStyles } from '@material-ui/styles'; +import { WithStyles } from '@material-ui/core'; -const styles = (theme: Theme) => createStyles({ - root: { /* ... */ }, - paper: { /* ... */ }, - button: { /* ... */ }, -}); +const styles = (theme: Theme) => + createStyles({ + root: { + /* ... */ + }, + paper: { + /* ... */ + }, + button: { + /* ... */ + }, + }); interface Props extends WithStyles { foo: number; @@ -216,22 +224,21 @@ When adding custom properties to the `Theme`, you may continue to use it in a st The following example adds an `appDrawer` property that is merged into the one exported by `material-ui`: ```ts -import { Theme } from '@material-ui/core/styles/createTheme'; -import { Breakpoint } from '@material-ui/core/styles/createBreakpoints'; +import { Breakpoint, Theme } from '@material-ui/core/styles'; -declare module '@material-ui/core/styles/createTheme' { +declare module '@material-ui/core/styles' { interface Theme { appDrawer: { - width: React.CSSProperties['width'] - breakpoint: Breakpoint - } + width: React.CSSProperties['width']; + breakpoint: Breakpoint; + }; } // allow configuration using `createTheme` interface ThemeOptions { appDrawer?: { - width?: React.CSSProperties['width'] - breakpoint?: Breakpoint - } + width?: React.CSSProperties['width']; + breakpoint?: Breakpoint; + }; } } ``` @@ -250,7 +257,7 @@ export default function createMyTheme(options: ThemeOptions) { breakpoint: 'lg', }, ...options, - }) + }); } ``` @@ -264,7 +271,7 @@ const theme = createMyTheme({ appDrawer: { breakpoint: 'md' }}); ## Usage of `component` prop -Many Material-UI components allow you to replace their root node via a `component` prop, this will be detailed in the component's API documentation. For example, a Button's root node can be replaced with a React Router's Link, and any additional props that are passed to Button, such as `to`, will be spread to the Link component. For a code example concerning Button and react-router-dom checkout [these demos](/guides/composition/#routing-libraries). +Many Material-UI components allow you to replace their root node via a `component` prop, this will be detailed in the component's API documentation. For example, a Button's root node can be replaced with a React Router's Link, and any additional props that are passed to Button, such as `to`, will be spread to the Link component. For a code example concerning Button and react-router-dom checkout [these demos](/guides/routing/#component-prop). To be able to use props of such a Material-UI component on their own, props should be used with type arguments. Otherwise, the `component` prop will not be present in the props of the Material-UI component. diff --git a/docs/src/pages/guides/typescript/typescript-zh.md b/docs/src/pages/guides/typescript/typescript-zh.md index 08b73f01f4b334..e7c0524bb07a85 100644 --- a/docs/src/pages/guides/typescript/typescript-zh.md +++ b/docs/src/pages/guides/typescript/typescript-zh.md @@ -2,7 +2,7 @@

    借助 TypeScript,你可以为 JavaScript 添加静态类型,从而提高代码质量及开发者的工作效率。

    -Material-UI 需要的最低 TypeScript 的版本为 3.2。 +Material-UI requires a minimum version of TypeScript 3.5. 请查看 [Create React App with TypeScript](https://github.com/mui-org/material-ui/tree/next/examples/create-react-app-with-typescript) 的例子。 @@ -176,7 +176,8 @@ interface Props { 然而,这是不是很 [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself) ,因为它需要你在两个不同的地方保持类名(如 `“root”`, `“paper”`, `“button”`,...)。 我们提供了一个类型操作符 `WithStyles` 来帮助解决这个问题,因此您可以直接写入:: ```ts -import { WithStyles, createStyles } from '@material-ui/core'; +import { createStyles } from '@material-ui/styles'; +import { WithStyles } from '@material-ui/core'; const styles = (theme: Theme) => createStyles({ @@ -231,22 +232,21 @@ const DecoratedClass = withStyles(styles)( 以下示例添加了一个 `appDrawer` 属性,并将其合并到由 `material-ui` 提供的属性中: ```ts -import { Theme } from '@material-ui/core/styles/createTheme'; -import { Breakpoint } from '@material-ui/core/styles/createBreakpoints'; +import { Breakpoint, Theme } from '@material-ui/core/styles'; -declare module '@material-ui/core/styles/createTheme' { +declare module '@material-ui/core/styles' { interface Theme { appDrawer: { - width: React.CSSProperties['width'] - breakpoint: Breakpoint - } + width: React.CSSProperties['width']; + breakpoint: Breakpoint; + }; } - // 使用 `createTheme` 来配置 + // allow configuration using `createTheme` interface ThemeOptions { appDrawer?: { - width?: React.CSSProperties['width'] - breakpoint?: Breakpoint - } + width?: React.CSSProperties['width']; + breakpoint?: Breakpoint; + }; } } ``` @@ -281,7 +281,7 @@ const theme = createMyTheme({ ## `component` 属性的用法 -你可以通过 `component` 属性替换许多 Material-UI 的许多组件的根节点,我们在组件的 API 文档中做了详细的说明。 例如,一个按钮(Button)的根节点可以被替换成一个 React Router 的链接(Link),并且,任何传入按钮(Button)的额外的属性,例如 `to` ,都会被传递到链接(Link)组件中。 关于按钮组件和 react-router-dom 的代码示例查看 [这些示例](/guides/composition/#routing-libraries)。 +你可以通过 `component` 属性替换许多 Material-UI 的许多组件的根节点,我们在组件的 API 文档中做了详细的说明。 例如,一个按钮(Button)的根节点可以被替换成一个 React Router 的链接(Link),并且,任何传入按钮(Button)的额外的属性,例如 `to` ,都会被传递到链接(Link)组件中。 关于按钮和 react-router-dom 的代码示例查看[这些示例](/guides/routing/#component-prop)。 为了能够单独使用 Material-UI 组件的属性,该属性应该与类型参数一起使用。 否则,`component` 属性将不会出现在 Material-UI 组件的属性中。 diff --git a/docs/src/pages/landing/backers-de.md b/docs/src/pages/landing/backers-de.md index 64ae279d7b1b62..c8e160dbacedfa 100644 --- a/docs/src/pages/landing/backers-de.md +++ b/docs/src/pages/landing/backers-de.md @@ -23,6 +23,7 @@ _2/3 Plätze verfügbar_

    call-em-all canadacasino + hoodiebees

    ### Es gibt noch mehr! diff --git a/docs/src/pages/landing/backers-es.md b/docs/src/pages/landing/backers-es.md index 1b19c7401611cb..0009bb7dc94618 100644 --- a/docs/src/pages/landing/backers-es.md +++ b/docs/src/pages/landing/backers-es.md @@ -23,6 +23,7 @@ _2/3 slots available_

    call-em-all canadacasino + hoodiebees

    ### ¡Y aún hay más! diff --git a/docs/src/pages/landing/backers-fr.md b/docs/src/pages/landing/backers-fr.md index f98c18449133ba..6593ccdd0bfeed 100644 --- a/docs/src/pages/landing/backers-fr.md +++ b/docs/src/pages/landing/backers-fr.md @@ -23,6 +23,7 @@ _2/3 places disponibles_

    call-em-all canadacasino + hoodiebees

    ### Il y en a plus ! diff --git a/docs/src/pages/landing/backers-ja.md b/docs/src/pages/landing/backers-ja.md index 43e8a5076166b4..768759fdc9a29e 100644 --- a/docs/src/pages/landing/backers-ja.md +++ b/docs/src/pages/landing/backers-ja.md @@ -23,6 +23,7 @@ _2 枠中 3 枠が参加可能です_

    call-em-all canadacasino + hoodiebees

    ### もっとあります! diff --git a/docs/src/pages/landing/backers-pt.md b/docs/src/pages/landing/backers-pt.md index 462fbf4c564c57..1146a3585c6d5a 100644 --- a/docs/src/pages/landing/backers-pt.md +++ b/docs/src/pages/landing/backers-pt.md @@ -23,6 +23,7 @@ _2/3 espaços disponíveis_

    call-em-all canadacasino + hoodiebees

    ### E tem mais! diff --git a/docs/src/pages/landing/backers-ru.md b/docs/src/pages/landing/backers-ru.md index 42de8183ca8a07..e49d2f498988fa 100644 --- a/docs/src/pages/landing/backers-ru.md +++ b/docs/src/pages/landing/backers-ru.md @@ -23,6 +23,7 @@ _2/3 slots available_

    call-em-all canadacasino + hoodiebees

    ### И не только! diff --git a/docs/src/pages/landing/backers-zh.md b/docs/src/pages/landing/backers-zh.md index 0cf1a91f75bade..85233c0be30ce1 100644 --- a/docs/src/pages/landing/backers-zh.md +++ b/docs/src/pages/landing/backers-zh.md @@ -23,6 +23,7 @@ _2/3 个位置可用_

    call-em-all canadacasino + hoodiebees

    ### 还有更多的赞助商! diff --git a/docs/src/pages/production-error/index-de.md b/docs/src/pages/production-error/index-de.md index d2ab9a0e0378ef..be81a9f6a405ff 100644 --- a/docs/src/pages/production-error/index-de.md +++ b/docs/src/pages/production-error/index-de.md @@ -1,7 +1,7 @@ -# Production Error +# Produktionsfehler -

    In the production build of Material-UI error messages are minified to reduce the size of your application.

    +

    Bei der Erstellung von Material-UI-Fehlern werden Fehlermeldungen minimiert, um die Größe Ihrer Anwendung zu verringern.

    -We recommend using the development build when debugging this error. It will include additional warnings about potential problems. If you encounter an exception while using the production build, this page will reassemble the orrigianl text of the error. +Wir empfehlen, beim Debuggen dieses Fehlers den Entwicklungsbuild zu verwenden. Sie wird zusätzliche Warnungen vor möglichen Problemen enthalten. If you encounter an exception while using the production build, this page will reassemble the orrigianl text of the error. {{"demo": "pages/production-error/ErrorDecoder.js", "hideToolbar": true, "bg": "inline"}} diff --git a/docs/src/pages/styles/advanced/advanced-de.md b/docs/src/pages/styles/advanced/advanced-de.md index f3b7bfdc6d1dda..482f199819cc3d 100644 --- a/docs/src/pages/styles/advanced/advanced-de.md +++ b/docs/src/pages/styles/advanced/advanced-de.md @@ -1,12 +1,12 @@ # Erweitert -

    This section covers more advanced usage of @material-ui/core/styles.

    +

    In diesem Abschnitt wird die erweiterte Verwendung von @material-ui/core/styles behandelt.

    ## Theming Sie können das äußere Theme erweitern, indem Sie eine Funktion bereitstellen: Das innere Theme ** überschreibt** das äußere Theme. -> This example creates a theme object for custom-built components. If you intend to use some of the Material-UI's components you need to provide a richer theme structure using the `createTheme()` method. Head to the the [theming section](/customization/theming/) to learn how to build your custom Material-UI theme. +> In diesem Beispiel wird ein Designobjekt für benutzerdefinierte Komponenten erstellt. If you intend to use some of the Material-UI's components you need to provide a richer theme structure using the `createTheme()` method. Head to the the [theming section](/customization/theming/) to learn how to build your custom Material-UI theme. ```jsx import { ThemeProvider } from '@material-ui/core/styles'; @@ -33,7 +33,7 @@ Möglicherweise müssen Sie auf die Themevariablen in Ihren React-Komponenten zu #### `useTheme` hook -For use in function components: +Zur Verwendung in Funktionskomponenten: ```jsx import { useTheme } from '@material-ui/core/styles'; @@ -48,7 +48,7 @@ function DeepChild() { #### `withTheme` HOC -For use in class or function components: +Zur Verwendung in Klassen- oder Funktionskomponenten: ```jsx import { withTheme } from '@material-ui/core/styles'; @@ -177,7 +177,7 @@ Selbstverständlich können Sie weitere Plugins benutzen. Hier ist ein Beispiel ```jsx import { create } from 'jss'; -import { StylesProvider, jssPreset } from '@material-ui/core/styles'; +import { StylesProvider, jssPreset } from '@material-ui/styles'; import rtl from 'jss-rtl'; const jss = create({ @@ -214,7 +214,7 @@ Beachten Sie, dass dies keine Selektoren oder verschachtelten Regeln unterstütz ## CSS-Injektionsreihenfolge -> It's **really important** to understand how the CSS specificity is calculated by the browser, as it's one of the key elements to know when overriding styles. You are encouraged to read this MDN paragraph: [How is specificity calculated?](https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity#How_is_specificity_calculated) +> It's **really important** to understand how the CSS specificity is calculated by the browser, as it's one of the key elements to know when overriding styles. Sie werden gebeten, diesen MDN-Absatz zu lesen: [Wie wird spezifität berechnet?](https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity#How_is_specificity_calculated) Standardmäßig werden die Style-Tags **zuletzt** im `` -Element der Seite eingefügt. Sie erhalten mehr Details als jedes andere Styletag auf Ihrer Seite, z.B. CSS-Module oder StilKomponenten. @@ -223,19 +223,21 @@ Standardmäßig werden die Style-Tags **zuletzt** im `` -Element der Seite Der `StylesProvider` Komponente hat eine `injectFirst` Eigenschaft, um **zuerst** die Style-Tags im Kopf einzufügen (weniger Priorität): ```jsx -import { StylesProvider } from '@material-ui/core/styles'; +import { StylesProvider } from '@material-ui/styles'; -{/* Your component tree. - Styled components can override Material-UI's styles. */}; + + {/* Dein Komponentenbaum. + Mit Stil versehene Komponenten können die Stile von Material-UI überschreiben. */} +; ``` -### `makeStyles` / `withStyles` / `styled` +### `makeStyle` / `withStyles` / `styled` Das Einfügen von Style-Tags erfolgt in der **gleichen Reihenfolge** wie die `makeStyles`/`withStyles`/`styled` Aufrufe. Zum Beispiel gewinnt die Farbe Rot in diesem Fall: ```jsx import clsx from 'clsx'; -import { makeStyles } from '@material-ui/core/styles'; +import { makeStyles } from '@material-ui/styles'; const useStylesBase = makeStyles({ root: { @@ -281,11 +283,11 @@ In diesem Beispiel wird ein Html-String zurückgegeben und die erforderliche kri ```jsx import { create } from 'jss'; -import { StylesProvider, jssPreset } from '@material-ui/core/styles'; +import { StylesProvider, jssPreset } from '@material-ui/styles'; const jss = create({ ...jssPreset(), - // Define a custom insertion point that JSS will look for when injecting the styles into the DOM. + // Wir definieren einen individuellen insertion point, welcher von JSS benutzt wird, um die Stile in den DOM einzufügen. insertionPoint: 'jss-insertion-point', }); @@ -294,7 +296,7 @@ export default function App() { } ``` -#### Other HTML elements +#### Andere HTML-Elemente The way that you do this is by passing a `` tag in the `` of your HTML. JSS will then, by convention, look for a `` Element. Um dieses Problem zu ```jsx import { create } from 'jss'; -import { StylesProvider, jssPreset } from '@material-ui/core/styles'; +import { StylesProvider, jssPreset } from '@material-ui/styles'; const styleNode = document.createComment('jss-insertion-point'); document.head.insertBefore(styleNode, document.head.firstChild); const jss = create({ ...jssPreset(), - // Define a custom insertion point that JSS will look for when injecting the styles into the DOM. + // Definiert einen benutzerdefinierten Einfügepunkt, den JSS beim Einfügen der Stile in das DOM sucht. insertionPoint: 'jss-insertion-point', }); @@ -348,7 +350,7 @@ This example returns a string of HTML and inlines the critical CSS required, rig ```jsx import ReactDOMServer from 'react-dom/server'; -import { ServerStyleSheets } from '@material-ui/core/styles'; +import { ServerStyleSheets } from '@material-ui/styles'; function render() { const sheets = new ServerStyleSheets(); @@ -374,25 +376,25 @@ You can [follow the server side guide](/guides/server-rendering/) for a more det ### Gatsby -There is [an official Gatsby plugin](https://github.com/hupe1980/gatsby-plugin-material-ui) that enables server-side rendering for `@material-ui/styles`. Anleitungen zur Einrichtung und Verwendung finden Sie auf der Seite des Plugins. +Es gibt [ein offizielles Gatsby-Plugin](https://github.com/hupe1980/gatsby-plugin-material-ui) das serverseitiges Rendering für `@material-ui/styles` ermöglicht. Anleitungen zur Einrichtung und Verwendung finden Sie auf der Seite des Plugins. -Refer to [this example Gatsby project](https://github.com/mui-org/material-ui/blob/next/examples/gatsby) for an up-to-date usage example. +Hier finden Sie [Dieses Beispiel für Gatsby-Projekt](https://github.com/mui-org/material-ui/blob/next/examples/gatsby) ein aktuelles Nutzungsbeispiel. ### Next.js -Sie müssen über eine benutzerdefiniertes `pages/_document.js` haben und [diese Logik](https://github.com/mui-org/material-ui/blob/814fb60bbd8e500517b2307b6a297a638838ca89/examples/nextjs/pages/_document.js#L52-L59) kopieren, um die serverseitig gerenderten Stile in das `` Element hinzuzufügen. - Siehe [dieses Beispielprojekt](https://github.com/mui-org/material-ui/blob/next/examples/nextjs) für ein aktuelles Verwendungsbeispiel. +Die Klassennamen werden von dem [Klassennamengenerator](/styles/api/#creategenerateclassname-options-class-name-generator) generiert. + ## Klassennamen Die Klassennamen werden von dem [Klassennamengenerator](/styles/api/#creategenerateclassname-options-class-name-generator) generiert. ### Standard -By default, the class names generated by `@material-ui/core/styles` are **non-deterministic**; you can't rely on them to stay the same. Nehmen wir den folgenden Stil als Beispiel: +Standardmäßig sind die Klassennamen, die von `@material-ui/core/styles` generiert werden, **nicht deterministisch**; Sie können sich nicht darauf verlassen, dass sie gleich bleiben. Nehmen wir den folgenden Stil als Beispiel: ```js const useStyles = makeStyles({ @@ -430,8 +432,8 @@ const className = `${productionPrefix}-${identifier}`; Die generierten Klassennamen der `@material-ui/core` Komponenten verhalten sich anders. Wenn die folgenden Bedingungen erfüllt sind, sind die Klassennamen **deterministisch**: - Es wird nur ein Themeanbieter verwendet (**Keine Verschachtelung von Themes**) -- The style sheet has a name that starts with `Mui` (all Material-UI components). -- The `disableGlobal` option of the [class name generator](/styles/api/#creategenerateclassname-options-class-name-generator) is `false` (the default). +- Das style sheet hat einen Namen, der mit `Mui`(alle Material-UI Komponenten). +- Das `disableGlobal`Option des [Klassen Namen Generator ](/styles/api/#creategenerateclassname-options-class-name-generator) ist `false`(Standart). Diese Bedingungen werden bei den häufigsten Anwendungsfällen von `@material-ui/core` erfüllt. Zum Beispiel dieses Stylesheet: diff --git a/docs/src/pages/styles/advanced/advanced-es.md b/docs/src/pages/styles/advanced/advanced-es.md index 19fc48be993f14..a5af0c32f95d2c 100644 --- a/docs/src/pages/styles/advanced/advanced-es.md +++ b/docs/src/pages/styles/advanced/advanced-es.md @@ -6,7 +6,7 @@ Add a `ThemeProvider` to the top level of your app to pass a theme down the React component tree. Then, you can access the theme object in style functions. -> Este ejemplo crea un objeto de tema para componentes construidos a medida. Si pretende utilizar algunos de los componentes de Material-UI, necesita proporcionar una estructura de tema más rica utilizando el método `createTheme()`. Dirígete a la sección [temática](/customization/theming/) para aprender cómo construir tu tema personalizado de Material-UI. +> Este ejemplo crea un objeto de tema para componentes construidos a medida. If you intend to use some of the Material-UI's components you need to provide a richer theme structure using the `createTheme()` method. Dirígete a la sección [temática](/customization/theming/) para aprender cómo construir tu tema personalizado de Material-UI. ```jsx import { ThemeProvider } from '@material-ui/core/styles'; @@ -182,18 +182,15 @@ Of course, you are free to use additional plugins. Here is an example with the [ ```jsx import { create } from 'jss'; -import { StylesProvider, jssPreset } from '@material-ui/core/styles'; -import rtl from 'jss-rtl' +import { StylesProvider, jssPreset } from '@material-ui/styles'; +import rtl from 'jss-rtl'; const jss = create({ plugins: [...jssPreset().plugins, rtl()], }); export default function App() { - return ( - - ... - ); + return ...; } ``` @@ -231,7 +228,7 @@ By default, the style tags are injected **last** in the `` element of the The `StylesProvider` component has an `injectFirst` prop to inject the style tags **first** in the head (less priority): ```jsx -import { StylesProvider } from '@material-ui/core/styles'; +import { StylesProvider } from '@material-ui/styles'; {/* Your component tree. @@ -241,8 +238,7 @@ import { StylesProvider } from '@material-ui/core/styles'; {/* Your component tree. */} - - Now, you can override Material-UI's styles. +; ``` ### `makeStyles` / `withStyles` / `styled` @@ -251,7 +247,7 @@ The injection of style tags happens in the **same order** as the `makeStyles` / ```jsx import clsx from 'clsx'; -import { makeStyles } from '@material-ui/core/styles'; +import { makeStyles } from '@material-ui/styles'; const useStylesBase = makeStyles({ root: { @@ -271,7 +267,7 @@ export default function MyComponent() { const classesBase = useStylesBase(); // Order doesn't matter - const className = clsx(classes.root, classesBase.root) + const className = clsx(classes.root, classesBase.root); // color: red 🔴 wins. However, the class names are often non-deterministic. @@ -296,7 +292,7 @@ The simplest approach is to add an HTML comment to the `` that determines ```jsx import { create } from 'jss'; -import { StylesProvider, jssPreset } from '@material-ui/core/styles'; +import { StylesProvider, jssPreset } from '@material-ui/styles'; const jss = create({ ...jssPreset(), @@ -323,7 +319,7 @@ export default function App() { ```jsx import { create } from 'jss'; -import { StylesProvider, jssPreset } from '@material-ui/core/styles'; +import { StylesProvider, jssPreset } from '@material-ui/styles'; const jss = create({ ...jssPreset(), @@ -342,17 +338,14 @@ codesandbox.io prevents access to the `` element. To get around this issue ```jsx import { create } from 'jss'; -import { StylesProvider, jssPreset } from '@material-ui/core/styles'; -import rtl from 'jss-rtl' +import { StylesProvider, jssPreset } from '@material-ui/styles'; -const jss = create({ - plugins: [...jssPreset().plugins, rtl()], -}); +const styleNode = document.createComment('jss-insertion-point'); +document.head.insertBefore(styleNode, document.head.firstChild); -export default function App() { - return ( - - ... +const jss = create({ + ...jssPreset(), + // Define a custom insertion point that JSS will look for when injecting the styles into the DOM. insertionPoint: 'jss-insertion-point', }); @@ -367,7 +360,7 @@ This example returns a string of HTML and inlines the critical CSS required, rig ```jsx import ReactDOMServer from 'react-dom/server'; -import { ServerStyleSheets } from '@material-ui/core/styles'; +import { ServerStyleSheets } from '@material-ui/styles'; function render() { const sheets = new ServerStyleSheets(); diff --git a/docs/src/pages/styles/advanced/advanced-fr.md b/docs/src/pages/styles/advanced/advanced-fr.md index e2aef138dcaa33..ee5e3a7c25efab 100644 --- a/docs/src/pages/styles/advanced/advanced-fr.md +++ b/docs/src/pages/styles/advanced/advanced-fr.md @@ -6,7 +6,7 @@ Add a `ThemeProvider` to the top level of your app to pass a theme down the React component tree. Then, you can access the theme object in style functions. -> This example creates a theme object for custom-built components. If you intend to use some of the Material-UI's components you need to provide a richer theme structure using the `createTheme()` method. Head to the the [theming section](/customization/theming/) to learn how to build your custom Material-UI theme. +> This example creates a theme object for custom-built components. Head to the the [theming section](/customization/theming/) to learn how to build your custom Material-UI theme. If you intend to use some of the Material-UI's components you need to provide a richer theme structure using the `createTheme()` method. ```jsx import { ThemeProvider } from '@material-ui/core/styles'; @@ -231,7 +231,9 @@ By default, the style tags are injected **last** in the `` element of the The `StylesProvider` component has an `injectFirst` prop to inject the style tags **first** in the head (less priority): ```jsx -import { StylesProvider } from '@material-ui/core/styles'; +*/} + + import { StylesProvider } from '@material-ui/core/styles'; {/* Your component tree. @@ -295,12 +297,12 @@ The simplest approach is to add an HTML comment to the `` that determines ``` ```jsx -import { create } from 'jss'; -import { StylesProvider, jssPreset } from '@material-ui/core/styles'; +insertionPoint: 'jss-insertion-point', +}); -const jss = create({ - ...jssPreset(), - // Define a custom insertion point that JSS will look for when injecting the styles into the DOM. +export default function App() { + return ...; +} insertionPoint: 'jss-insertion-point', }); @@ -322,12 +324,12 @@ export default function App() { ``` ```jsx -import { create } from 'jss'; -import { StylesProvider, jssPreset } from '@material-ui/core/styles'; +insertionPoint: 'jss-insertion-point', +}); -const jss = create({ - ...jssPreset(), - // Define a custom insertion point that JSS will look for when injecting the styles into the DOM. +export default function App() { + return ...; +} insertionPoint: 'jss-insertion-point', }); @@ -341,18 +343,12 @@ export default function App() { codesandbox.io prevents access to the `` element. To get around this issue, you can use the JavaScript `document.createComment()` API: ```jsx -import { create } from 'jss'; -import { StylesProvider, jssPreset } from '@material-ui/core/styles'; -import rtl from 'jss-rtl' - -const jss = create({ - plugins: [...jssPreset().plugins, rtl()], +insertionPoint: 'jss-insertion-point', }); export default function App() { - return ( - - ... + return ...; +} insertionPoint: 'jss-insertion-point', }); diff --git a/docs/src/pages/styles/advanced/advanced-ja.md b/docs/src/pages/styles/advanced/advanced-ja.md index 16b1710450b50e..9b8f915131f1a7 100644 --- a/docs/src/pages/styles/advanced/advanced-ja.md +++ b/docs/src/pages/styles/advanced/advanced-ja.md @@ -182,18 +182,15 @@ Of course, you are free to use additional plugins. Here is an example with the [ ```jsx import { create } from 'jss'; -import { StylesProvider, jssPreset } from '@material-ui/core/styles'; -import rtl from 'jss-rtl' +import { StylesProvider, jssPreset } from '@material-ui/styles'; +import rtl from 'jss-rtl'; const jss = create({ plugins: [...jssPreset().plugins, rtl()], }); export default function App() { - return ( - - ... - ); + return ...; } ``` @@ -231,7 +228,7 @@ By default, the style tags are injected **last** in the `` element of the The `StylesProvider` component has an `injectFirst` prop to inject the style tags **first** in the head (less priority): ```jsx -import { StylesProvider } from '@material-ui/core/styles'; +import { StylesProvider } from '@material-ui/styles'; {/* Your component tree. @@ -241,8 +238,7 @@ import { StylesProvider } from '@material-ui/core/styles'; {/* Your component tree. */} - - Now, you can override Material-UI's styles. +; ``` ### `makeStyles` / `withStyles` / `styled` @@ -251,7 +247,7 @@ The injection of style tags happens in the **same order** as the `makeStyles` / ```jsx import clsx from 'clsx'; -import { makeStyles } from '@material-ui/core/styles'; +import { makeStyles } from '@material-ui/styles'; const useStylesBase = makeStyles({ root: { @@ -271,7 +267,7 @@ export default function MyComponent() { const classesBase = useStylesBase(); // Order doesn't matter - const className = clsx(classes.root, classesBase.root) + const className = clsx(classes.root, classesBase.root); // color: red 🔴 wins. However, the class names are often non-deterministic. @@ -296,7 +292,7 @@ The simplest approach is to add an HTML comment to the `` that determines ```jsx import { create } from 'jss'; -import { StylesProvider, jssPreset } from '@material-ui/core/styles'; +import { StylesProvider, jssPreset } from '@material-ui/styles'; const jss = create({ ...jssPreset(), @@ -323,7 +319,7 @@ export default function App() { ```jsx import { create } from 'jss'; -import { StylesProvider, jssPreset } from '@material-ui/core/styles'; +import { StylesProvider, jssPreset } from '@material-ui/styles'; const jss = create({ ...jssPreset(), @@ -342,17 +338,14 @@ codesandbox.io prevents access to the `` element. To get around this issue ```jsx import { create } from 'jss'; -import { StylesProvider, jssPreset } from '@material-ui/core/styles'; -import rtl from 'jss-rtl' +import { StylesProvider, jssPreset } from '@material-ui/styles'; -const jss = create({ - plugins: [...jssPreset().plugins, rtl()], -}); +const styleNode = document.createComment('jss-insertion-point'); +document.head.insertBefore(styleNode, document.head.firstChild); -export default function App() { - return ( - - ... +const jss = create({ + ...jssPreset(), + // Define a custom insertion point that JSS will look for when injecting the styles into the DOM. insertionPoint: 'jss-insertion-point', }); @@ -367,7 +360,7 @@ This example returns a string of HTML and inlines the critical CSS required, rig ```jsx import ReactDOMServer from 'react-dom/server'; -import { ServerStyleSheets } from '@material-ui/core/styles'; +import { ServerStyleSheets } from '@material-ui/styles'; function render() { const sheets = new ServerStyleSheets(); diff --git a/docs/src/pages/styles/advanced/advanced-pt.md b/docs/src/pages/styles/advanced/advanced-pt.md index b41651f2e3ef63..00ea3eeb36be42 100644 --- a/docs/src/pages/styles/advanced/advanced-pt.md +++ b/docs/src/pages/styles/advanced/advanced-pt.md @@ -6,7 +6,7 @@ Adicione um `ThemeProvider` para o nível superior de sua aplicação para passar um tema pela árvore de componentes do React. Dessa maneira, você poderá acessar o objeto de tema em funções de estilo. -> Este exemplo cria um objeto de tema para componentes customizados. Se você pretende usar alguns dos componentes do Material-UI, você precisa fornecer uma estrutura de tema mais rica usando o método `createTheme()`. Vá até a [seção de temas](/customization/theming/) para aprender como construir seu tema customizado do Material-UI. +> Este exemplo cria um objeto de tema para componentes customizados. If you intend to use some of the Material-UI's components you need to provide a richer theme structure using the `createTheme()` method. Vá até a [seção de temas](/customization/theming/) para aprender como construir seu tema customizado do Material-UI. ```jsx import { ThemeProvider } from '@material-ui/core/styles'; @@ -182,18 +182,15 @@ Claro, você é livre para usar plugins adicionais. Aqui está um exemplo com o ```jsx import { create } from 'jss'; -import { StylesProvider, jssPreset } from '@material-ui/core/styles'; -import rtl from 'jss-rtl' +import { StylesProvider, jssPreset } from '@material-ui/styles'; +import rtl from 'jss-rtl'; const jss = create({ plugins: [...jssPreset().plugins, rtl()], }); export default function App() { - return ( - - ... - ); + return ...; } ``` @@ -231,12 +228,12 @@ Por padrão, os estilos são inseridos **por último** no elemento `` da s O componente `StylesProvider` tem uma propriedade `injectFirst` para injetar as tags de estilo em **primeiro** no cabeçalho (menor prioridade): ```jsx -import { StylesProvider } from '@material-ui/core/styles'; +import { StylesProvider } from '@material-ui/styles'; {/* Sua árvore de componentes. Componentes com estilo podem sobrescrever os estilos de Material-UI. */} - +; ``` ### `makeStyles` / `withStyles` / `styled` @@ -245,7 +242,7 @@ A injeção de tags de estilo acontece na **mesma ordem** com as invocações de ```jsx import clsx from 'clsx'; -import { makeStyles } from '@material-ui/core/styles'; +import { makeStyles } from '@material-ui/styles'; const useStylesBase = makeStyles({ root: { @@ -260,14 +257,14 @@ const useStyles = makeStyles({ }); export default function MyComponent() { - // Ordem não importa + // Order doesn't matter const classes = useStyles(); const classesBase = useStylesBase(); - // Ordem não importa - const className = clsx(classes.root, classesBase.root) + // Order doesn't matter + const className = clsx(classes.root, classesBase.root); - // color: red 🔴 vence. + // color: red 🔴 wins. return
    ; } ``` @@ -291,7 +288,7 @@ A abordagem mais simples é adicionar um comentário HTML no `` que determ ```jsx import { create } from 'jss'; -import { StylesProvider, jssPreset } from '@material-ui/core/styles'; +import { StylesProvider, jssPreset } from '@material-ui/styles'; const jss = create({ ...jssPreset(), @@ -317,7 +314,7 @@ export default function App() { ```jsx import { create } from 'jss'; -import { StylesProvider, jssPreset } from '@material-ui/core/styles'; +import { StylesProvider, jssPreset } from '@material-ui/styles'; const jss = create({ ...jssPreset(), @@ -336,7 +333,7 @@ codesandbox.io impede o acesso ao elemento ``. Para contornar esse comport ```jsx import { create } from 'jss'; -import { StylesProvider, jssPreset } from '@material-ui/core/styles'; +import { StylesProvider, jssPreset } from '@material-ui/styles'; const styleNode = document.createComment('jss-insertion-point'); document.head.insertBefore(styleNode, document.head.firstChild); @@ -358,7 +355,7 @@ This example returns a string of HTML and inlines the critical CSS required, rig ```jsx import ReactDOMServer from 'react-dom/server'; -import { ServerStyleSheets } from '@material-ui/core/styles'; +import { ServerStyleSheets } from '@material-ui/styles'; function render() { const sheets = new ServerStyleSheets(); diff --git a/docs/src/pages/styles/advanced/advanced-ru.md b/docs/src/pages/styles/advanced/advanced-ru.md index d5c1d21b4974f5..ea904e14e945c2 100644 --- a/docs/src/pages/styles/advanced/advanced-ru.md +++ b/docs/src/pages/styles/advanced/advanced-ru.md @@ -6,7 +6,7 @@ Add a `ThemeProvider` to the top level of your app to pass a theme down the React component tree. Then, you can access the theme object in style functions. -> Этот пример создает объект темы для пользовательских компонентов. Если вы собираетесь использовать какие-либо компоненты Material-UI, вам необходимо использовать метод `createTheme()` который обеспечивает более обширную структуру темы. Head to the the [theming section](/customization/theming/) to learn how to build your custom Material-UI theme. +> Этот пример создает объект темы для пользовательских компонентов. If you intend to use some of the Material-UI's components you need to provide a richer theme structure using the `createTheme()` method. Head to the the [theming section](/customization/theming/) to learn how to build your custom Material-UI theme. ```jsx import { ThemeProvider } from '@material-ui/core/styles'; @@ -182,18 +182,15 @@ Of course, you are free to use additional plugins. Вот пример с пла ```jsx import { create } from 'jss'; -import { StylesProvider, jssPreset } from '@material-ui/core/styles'; -import rtl from 'jss-rtl' +import { StylesProvider, jssPreset } from '@material-ui/styles'; +import rtl from 'jss-rtl'; const jss = create({ plugins: [...jssPreset().plugins, rtl()], }); export default function App() { - return ( - - ... - ); + return ...; } ``` @@ -231,7 +228,7 @@ By default, the style tags are injected **last** in the `` element of the The `StylesProvider` component has an `injectFirst` prop to inject the style tags **first** in the head (less priority): ```jsx -import { StylesProvider } from '@material-ui/core/styles'; +import { StylesProvider } from '@material-ui/styles'; {/* Your component tree. @@ -241,8 +238,7 @@ import { StylesProvider } from '@material-ui/core/styles'; {/* Your component tree. */} - - Now, you can override Material-UI's styles. +; ``` ### `makeStyles` / `withStyles` / `styled` @@ -251,7 +247,7 @@ The injection of style tags happens in the **same order** as the `makeStyles` / ```jsx import clsx from 'clsx'; -import { makeStyles } from '@material-ui/core/styles'; +import { makeStyles } from '@material-ui/styles'; const useStylesBase = makeStyles({ root: { @@ -271,7 +267,7 @@ export default function MyComponent() { const classesBase = useStylesBase(); // Order doesn't matter - const className = clsx(classes.root, classesBase.root) + const className = clsx(classes.root, classesBase.root); // color: red 🔴 wins. However, the class names are often non-deterministic. @@ -296,7 +292,7 @@ The simplest approach is to add an HTML comment to the `` that determines ```jsx import { create } from 'jss'; -import { StylesProvider, jssPreset } from '@material-ui/core/styles'; +import { StylesProvider, jssPreset } from '@material-ui/styles'; const jss = create({ ...jssPreset(), @@ -323,7 +319,7 @@ export default function App() { ```jsx import { create } from 'jss'; -import { StylesProvider, jssPreset } from '@material-ui/core/styles'; +import { StylesProvider, jssPreset } from '@material-ui/styles'; const jss = create({ ...jssPreset(), @@ -342,17 +338,14 @@ codesandbox.io prevents access to the `` element. To get around this issue ```jsx import { create } from 'jss'; -import { StylesProvider, jssPreset } from '@material-ui/core/styles'; -import rtl from 'jss-rtl' +import { StylesProvider, jssPreset } from '@material-ui/styles'; -const jss = create({ - plugins: [...jssPreset().plugins, rtl()], -}); +const styleNode = document.createComment('jss-insertion-point'); +document.head.insertBefore(styleNode, document.head.firstChild); -export default function App() { - return ( - - ... +const jss = create({ + ...jssPreset(), + // Define a custom insertion point that JSS will look for when injecting the styles into the DOM. insertionPoint: 'jss-insertion-point', }); @@ -367,7 +360,7 @@ This example returns a string of HTML and inlines the critical CSS required, rig ```jsx import ReactDOMServer from 'react-dom/server'; -import { ServerStyleSheets } from '@material-ui/core/styles'; +import { ServerStyleSheets } from '@material-ui/styles'; function render() { const sheets = new ServerStyleSheets(); diff --git a/docs/src/pages/styles/advanced/advanced-zh.md b/docs/src/pages/styles/advanced/advanced-zh.md index ed7be92327eb50..36d893fee319ea 100644 --- a/docs/src/pages/styles/advanced/advanced-zh.md +++ b/docs/src/pages/styles/advanced/advanced-zh.md @@ -6,7 +6,7 @@ 若您想将主题传递到 React 组件树,请将添加 `ThemeProvider` 包装到应用程序的顶层。 然后,您可以在样式函数中访问主题对象。 -> 此示例为自定义组件创建了一个主题对象(theme object)。 如果你想要使用 Material-UI 的部分组件,那么则需要通过使用 `createTheme()` 方法来提供一个更丰富的主题结构。 请前往 [theming 部分](/customization/theming/) 学习如何构建自己的 Material-UI 主题。 +> 此示例为自定义组件创建了一个主题对象(theme object)。 If you intend to use some of the Material-UI's components you need to provide a richer theme structure using the `createTheme()` method. 请前往 [theming 部分](/customization/theming/) 学习如何构建自己的 Material-UI 主题。 ```jsx import { ThemeProvider } from '@material-ui/core/styles'; @@ -177,7 +177,7 @@ JSS 使用插件来扩展其核心,您可以挑选所需的功能,并且只 ```jsx import { create } from 'jss'; -import { StylesProvider, jssPreset } from '@material-ui/core/styles'; +import { StylesProvider, jssPreset } from '@material-ui/styles'; import rtl from 'jss-rtl'; const jss = create({ @@ -223,10 +223,12 @@ const useStyles = makeStyles({ `StylesProvider`组件的属性 `injectFirst` 会把style标签注入到head的**前部**(意味着更低的权重)。 ```jsx -import { StylesProvider } from '@material-ui/core/styles'; +import { StylesProvider } from '@material-ui/styles'; -{/* 你的组件树。 - 样式化组件可以覆盖 Material-UI 的样式。 */}; + + {/* 你的组件树。 + 样式化组件可以覆盖 Material-UI 的样式。 */} +; ``` ### `makeStyles` / `withStyles` / `styled` @@ -235,7 +237,7 @@ import { StylesProvider } from '@material-ui/core/styles'; ```jsx import clsx from 'clsx'; -import { makeStyles } from '@material-ui/core/styles'; +import { makeStyles } from '@material-ui/styles'; const useStylesBase = makeStyles({ root: { @@ -250,14 +252,14 @@ const useStyles = makeStyles({ }); export default function MyComponent() { - // 下列函数先后顺序不重要 + // Order doesn't matter const classes = useStyles(); const classesBase = useStylesBase(); - // 下列函数先后顺序不重要 + // Order doesn't matter const className = clsx(classes.root, classesBase.root); - // color: red 🔴 优先渲染。 + // color: red 🔴 wins. return
    ; } ``` @@ -281,11 +283,11 @@ JSS [提供了一种机制](https://github.com/cssinjs/jss/blob/master/docs/setu ```jsx import { create } from 'jss'; -import { StylesProvider, jssPreset } from '@material-ui/core/styles'; +import { StylesProvider, jssPreset } from '@material-ui/styles'; const jss = create({ ...jssPreset(), - // 当将样式注入到 DOM 中时,定义了一个自定义插入点以供 JSS 查询。 + // Define a custom insertion point that JSS will look for when injecting the styles into the DOM. insertionPoint: 'jss-insertion-point', }); @@ -307,11 +309,11 @@ export default function App() { ```jsx import { create } from 'jss'; -import { StylesProvider, jssPreset } from '@material-ui/core/styles'; +import { StylesProvider, jssPreset } from '@material-ui/styles'; const jss = create({ ...jssPreset(), - // 当将样式注入到 DOM 中时,定义了一个自定义插入点以供 JSS 查询。 + // Define a custom insertion point that JSS will look for when injecting the styles into the DOM. insertionPoint: document.getElementById('jss-insertion-point'), }); @@ -326,14 +328,14 @@ codesandbox.io 阻止访问 `` 元素。 要解决这个问题,您可以 ```jsx import { create } from 'jss'; -import { StylesProvider, jssPreset } from '@material-ui/core/styles'; +import { StylesProvider, jssPreset } from '@material-ui/styles'; const styleNode = document.createComment('jss-insertion-point'); document.head.insertBefore(styleNode, document.head.firstChild); const jss = create({ ...jssPreset(), - // 我们定义了一个自定义插入点,JSS在DOM中注入样式时会查找该插入点。 + // Define a custom insertion point that JSS will look for when injecting the styles into the DOM. insertionPoint: 'jss-insertion-point', }); @@ -348,7 +350,7 @@ This example returns a string of HTML and inlines the critical CSS required, rig ```jsx import ReactDOMServer from 'react-dom/server'; -import { ServerStyleSheets } from '@material-ui/core/styles'; +import { ServerStyleSheets } from '@material-ui/styles'; function render() { const sheets = new ServerStyleSheets(); diff --git a/docs/src/pages/styles/api/api-de.md b/docs/src/pages/styles/api/api-de.md index c6f6337a4036c1..cc21548e3a980b 100644 --- a/docs/src/pages/styles/api/api-de.md +++ b/docs/src/pages/styles/api/api-de.md @@ -8,11 +8,11 @@ Eine Funktion, die eine [Klassennamengeneratorfunktion](https://cssinjs.org/jss- ### Parameter -1. `options` (*Object* [optional]): +1. `options` (_object_ [optional]): - - `options.disableGlobal` (*Boolean* [optional]): Standardeinstellung ist `false`. Deaktivieren Sie die Generierung deterministischer Klassennamen. - - `options.productionPrefix` (*String* [optional]): Standardeinstellung ist `'jss'`. Ein String, der den Klassennamen in der Produktion vorangestellt wird. - - `options.seed` (*String* [optional]): Standardeinstellung ist `''`. Der String, mit der der Generator eindeutig identifiziert wird. Dies kann verwendet werden, um Klassennamenskollisionen bei Verwendung mehrerer Generatoren in einem Dokument zu vermeiden. + - `options.disableGlobal` (_bool_ [optional]): Defaults to `false`. Deaktivieren Sie die Generierung deterministischer Klassennamen. + - `options.productionPrefix` (*string* [optional]): Standardeinstellung ist `'jss'`. Ein String, der den Klassennamen in der Produktion vorangestellt wird. + - `options.seed` (*string* [optional]): Standardeinstellung ist `''`. Der String, mit der der Generator eindeutig identifiziert wird. Dies kann verwendet werden, um Klassennamenskollisionen bei Verwendung mehrerer Generatoren in einem Dokument zu vermeiden. ### Rückgabewerte @@ -22,7 +22,7 @@ Eine Funktion, die eine [Klassennamengeneratorfunktion](https://cssinjs.org/jss- ```jsx import * as React from 'react'; -import { StylesProvider, createGenerateClassName } from '@material-ui/core/styles'; +import { StylesProvider, createGenerateClassName } from '@material-ui/styles'; const generateClassName = createGenerateClassName({ productionPrefix: 'c', @@ -39,7 +39,7 @@ Diese Funktion "macht zur Laufzeit nicht wirklich etwas", es ist nur die Identit ### Parameter -1. `styles` (*Object*): A styles object. +1. `styles` (_object_): A styles object. ### Rückgabewerte @@ -48,7 +48,8 @@ Diese Funktion "macht zur Laufzeit nicht wirklich etwas", es ist nur die Identit ### Beispiele ```jsx -import { makeStyles, createStyles } from '@material-ui/core/styles'; +import { createStyles, makeStyles } from '@material-ui/styles'; +import { createTheme, ThemeProvider } from '@material-ui/core/styles'; const useStyles = makeStyles((theme: Theme) => createStyles({ root: { @@ -56,9 +57,11 @@ const useStyles = makeStyles((theme: Theme) => createStyles({ }, })); +const theme = createTheme(); + export default function MyComponent { const classes = useStyles(); - return
    ; + return
    ; } ``` @@ -69,11 +72,11 @@ Verknüpfen Sie ein Stylesheet mit einer Funktionskomponente mit dem **Hook** Mu ### Parameter 1. `styles` (* Function | Object *): Eine Funktion, die die Stile oder ein Stilobjekt generiert. Es wird mit der Komponente verknüpft. Verwenden Sie die Funktionssignatur, wenn Sie Zugriff auf das Theme benötigen. Es ist das erste Argument. -2. `options` (*Object* [optional]): +2. `options` (_object_ [optional]): -- `options.defaultTheme` (*Object* [optional]): Das Standarddesign, das verwendet werden soll, wenn ein Theme nicht über einen Theme Provider bereitgestellt wird. -- `options.name` (*String* [optional]): Der Name des Stylesheets. Nützlich zum Debuggen. -- `options.flip` (*Boolean* [optional]): Wenn auf `false` gestellt, wird die `Rechts-Nach-Links` Transformation deaktiviert. Wenn es `true` ist sind die Stile invertiert. Wenn es `null` ist, folgt es der `theme.direction` Einstellung. +- `options.defaultTheme` (*object* [optional]): Das Standarddesign, das verwendet werden soll, wenn ein Theme nicht über einen Theme Provider bereitgestellt wird. +- `options.name` (*string* [optional]): Der Name des Stylesheets. Nützlich zum Debuggen. +- `options.flip` (_bool_ [optional]): When set to `false`, this sheet will opt-out the `rtl` transformation. Wenn es `true` ist sind die Stile invertiert. Wenn es `null` ist, folgt es der `theme.direction` Einstellung. - Die anderen Schlüssel werden an das Optionsargument [jss.createStyleSheet([styles], [options])](https://cssinjs.org/jss-api/#create-style-sheet) weitergeleitet. ### Rückgabewerte @@ -84,12 +87,12 @@ Verknüpfen Sie ein Stylesheet mit einer Funktionskomponente mit dem **Hook** Mu ```jsx import * as React from 'react'; -import { makeStyles } from '@material-ui/core/styles'; +import { makeStyles } from '@material-ui/styles'; const useStyles = makeStyles({ root: { backgroundColor: 'red', - color: props => props.color, + color: (props) => props.color, }, }); @@ -105,7 +108,7 @@ Dies ist ein Klassenhelfer für das serverseitige Rendering. [You can follow thi ```jsx import ReactDOMServer from 'react-dom/server'; -import { ServerStyleSheets } from '@material-ui/core/styles'; +import { ServerStyleSheets } from '@material-ui/styles'; const sheets = new ServerStyleSheets(); const html = ReactDOMServer.renderToString(sheets.collect()); @@ -126,7 +129,7 @@ const response = ` Die Instantiierung akzeptiert ein Optionsobjekt als erstes Argument. -1. `options` (*Objekt * [optional]): Die Optionen werden als Eigenschaften an die [`StylesProvider`](#stylesprovider) Komponente verteilt. +1. `options` (_object_ [optional]): The options are spread as props to the [`StylesProvider`](#stylesprovider) component. ### `sheets.collect(node) => React element` @@ -152,12 +155,12 @@ Verknüpfen Sie ein Stylesheet mit einer Funktionskomponente mit dem **styled co 1. `Component`: Die Komponente, die verpackt wird. 2. `styles` (* Function | Object *): Eine Funktion, die die Stile oder ein Stilobjekt generiert. Es wird mit der Komponente verknüpft. Verwenden Sie die Funktionssignatur, wenn Sie Zugriff auf das Theme benötigen. Es wird als Eigenschaft des ersten Arguments bereitgestellt. -3. `options` (*Object* [optional]): +3. `options` (_object_ [optional]): -- `options.defaultTheme` (*Object* [optional]): Das Standarddesign, das verwendet werden soll, wenn ein Theme nicht über einen Theme Provider bereitgestellt wird. -- `options.withTheme` (*Boolean* [optional]): Standardeinstellung ist `false`. Übergeben Sie das `Theme` Objekt als Eigenschaft an die Komponente. -- `options.name` (*String* [optional]): Der Name des Stylesheets. Nützlich zum Debuggen. Wenn der Wert nicht angegeben wird, wird versucht, auf den Namen der Komponente zurückzugreifen. -- `options.flip` (*Boolean* [optional]): Wenn auf `false` gestellt, wird die `Rechts-Nach-Links` Transformation deaktiviert. Wenn es `true` ist sind die Stile invertiert. Wenn es `null` ist, folgt es der `theme.direction` Einstellung. +- `options.defaultTheme` (*object* [optional]): Das Standarddesign, das verwendet werden soll, wenn ein Theme nicht über einen Theme Provider bereitgestellt wird. +- `options.withTheme` (_bool_ [optional]): Defaults to `false`. Übergeben Sie das `Theme` Objekt als Eigenschaft an die Komponente. +- `options.name` (*string* [optional]): Der Name des Stylesheets. Nützlich zum Debuggen. Wenn der Wert nicht angegeben wird, wird versucht, auf den Namen der Komponente zurückzugreifen. +- `options.flip` (_bool_ [optional]): When set to `false`, this sheet will opt-out the `rtl` transformation. Wenn es `true` ist sind die Stile invertiert. Wenn es `null` ist, folgt es der `theme.direction` Einstellung. - Die anderen Schlüssel werden an das Optionsargument [jss.createStyleSheet([styles], [options])](https://cssinjs.org/jss-api/#create-style-sheet) weitergeleitet. ### Rückgabewerte @@ -168,23 +171,26 @@ Verknüpfen Sie ein Stylesheet mit einer Funktionskomponente mit dem **styled co ```jsx import * as React from 'react'; -import { styled } from '@material-ui/core/styles'; +import { styled, ThemeProvider } from '@material-ui/styles'; +import { createTheme } from '@material-ui/core/styles'; const MyComponent = styled('div')({ backgroundColor: 'red', }); -const MyThemeComponent = styled('div')(({ - theme -}) => ({ +const MyThemeComponent = styled('div')(({ theme }) => ({ padding: theme.spacing(1), })); +const theme = createTheme(); + export default function StyledComponents() { return ( - - - + + + + + ); } ``` @@ -210,12 +216,10 @@ Es sollte vorzugsweise an der **Wurzel Ihres Komponentenbaums** verwendet werden ```jsx import * as React from 'react'; import ReactDOM from 'react-dom'; -import { StylesProvider } from '@material-ui/core/styles'; +import { StylesProvider } from '@material-ui/styles'; function App() { - return ( - ... - ); + return ...; } ReactDOM.render(, document.querySelector('#app')); @@ -279,18 +283,17 @@ Einige Implementierungsdetails, die interessant sein könnten: - Es fügt eine `classes` Eigenschaft hinzu, damit Sie die injizierten Klassennamen von außen überschreiben können. - Leitet die innere Komponente mit Ref weiter. -- Die `innerRef` Eigenschaft ist veraltet. Verwenden Sie `ref` stattdessen. -- Es wird **keine** Statik rüberkopiert. Es kann zum Beispiel verwendet werden, um eine `getInitialProps()` als statische Methode zu definieren (next.js). +- It does **not** copy over statics. For instance, it can be used to define a `getInitialProps()` static method (next.js). ### Parameter 1. `styles` (* Function | Object *): Eine Funktion, die die Stile oder ein Stilobjekt generiert. Es wird mit der Komponente verknüpft. Verwenden Sie die Funktionssignatur, wenn Sie Zugriff auf das Theme benötigen. Es ist das erste Argument. -2. `options` (*Object* [optional]): +2. `options` (_object_ [optional]): -- `options.defaultTheme` (*Object* [optional]): Das Standarddesign, das verwendet werden soll, wenn ein Theme nicht über einen Theme Provider bereitgestellt wird. -- `options.withTheme` (*Boolean* [optional]): Standardeinstellung ist `false`. Übergeben Sie das `Theme` Objekt als Eigenschaft an die Komponente. -- `options.name` (*String* [optional]): Der Name des Stylesheets. Nützlich zum Debuggen. Wenn der Wert nicht angegeben wird, wird versucht, auf den Namen der Komponente zurückzugreifen. -- `options.flip` (*Boolean* [optional]): Wenn auf `false` gestellt, wird die `Rechts-Nach-Links` Transformation deaktiviert. Wenn es `true` ist sind die Stile invertiert. Wenn es `null` ist, folgt es der `theme.direction` Einstellung. +- `options.defaultTheme` (*object* [optional]): Das Standarddesign, das verwendet werden soll, wenn ein Theme nicht über einen Theme Provider bereitgestellt wird. +- `options.withTheme` (_bool_ [optional]): Defaults to `false`. Übergeben Sie das `Theme` Objekt als Eigenschaft an die Komponente. +- `options.name` (*string* [optional]): Der Name des Stylesheets. Nützlich zum Debuggen. Wenn der Wert nicht angegeben wird, wird versucht, auf den Namen der Komponente zurückzugreifen. +- `options.flip` (_bool_ [optional]): When set to `false`, this sheet will opt-out the `rtl` transformation. Wenn es `true` ist sind die Stile invertiert. Wenn es `null` ist, folgt es der `theme.direction` Einstellung. - Die anderen Schlüssel werden an das Optionsargument [jss.createStyleSheet([styles], [options])](https://cssinjs.org/jss-api/#create-style-sheet) weitergeleitet. ### Rückgabewerte @@ -301,7 +304,7 @@ Einige Implementierungsdetails, die interessant sein könnten: ```jsx import * as React from 'react'; -import { withStyles } from '@material-ui/core/styles'; +import { withStyles } from '@material-ui/styles'; const styles = { root: { @@ -320,7 +323,7 @@ Sie können auch so als [Dekorateur](https://babeljs.io/docs/en/babel-plugin-pro ```jsx import * as React from 'react'; -import { withStyles } from '@material-ui/core/styles'; +import { withStyles } from '@material-ui/styles'; const styles = { root: { @@ -330,12 +333,12 @@ const styles = { @withStyles(styles) class MyComponent extends React.Component { - render () { + render() { return
    ; } } -export default MyComponent +export default MyComponent; ``` ## `withTheme(Component) => Component` diff --git a/docs/src/pages/styles/api/api-es.md b/docs/src/pages/styles/api/api-es.md index 8f77e1f8276b2c..b3e7143e50bb16 100644 --- a/docs/src/pages/styles/api/api-es.md +++ b/docs/src/pages/styles/api/api-es.md @@ -10,9 +10,9 @@ A function which returns [a class name generator function](https://cssinjs.org/j 1. `options` (*Object* [optional]): - - `options.disableGlobal` (*Boolean* [optional]): Default `false`. Disable the generation of deterministic class names. - - `options.productionPrefix` (*String* [optional]): Defaults to `'jss'`. The string used to prefix the class names in production. - - `options.seed` (*String* [optional]): Defaults to `''`. The string used to uniquely identify the generator. It can be used to avoid class name collisions when using multiple generators in the same document. + - `options.disableGlobal` (_bool_ [optional]): Defaults to `false`. Disable the generation of deterministic class names. + - `options.productionPrefix` (*string* [optional]): Defaults to `'jss'`. The string used to prefix the class names in production. + - `options.seed` (*string* [optional]): Defaults to `''`. The string used to uniquely identify the generator. It can be used to avoid class name collisions when using multiple generators in the same document. ### Regresa @@ -22,7 +22,7 @@ A function which returns [a class name generator function](https://cssinjs.org/j ```jsx import * as React from 'react'; -import { StylesProvider, createGenerateClassName } from '@material-ui/core/styles'; +import { StylesProvider, createGenerateClassName } from '@material-ui/styles'; const generateClassName = createGenerateClassName({ productionPrefix: 'c', @@ -39,7 +39,7 @@ This function doesn't really "do anything" at runtime, it's just the identity fu ### Argumentos -1. `styles` (*Object*): A styles object. +1. `styles` (_object_): A styles object. ### Regresa @@ -48,7 +48,8 @@ This function doesn't really "do anything" at runtime, it's just the identity fu ### Ejemplos ```jsx -import { makeStyles, createStyles } from '@material-ui/core/styles'; +import { createStyles, makeStyles } from '@material-ui/styles'; +import { createTheme, ThemeProvider } from '@material-ui/core/styles'; const useStyles = makeStyles((theme: Theme) => createStyles({ root: { @@ -56,9 +57,11 @@ const useStyles = makeStyles((theme: Theme) => createStyles({ }, })); +const theme = createTheme(); + export default function MyComponent { const classes = useStyles(); - return
    ; + return
    ; } ``` @@ -71,9 +74,9 @@ Link a style sheet with a function component using the **hook** pattern. 1. `styles` (*Function | Object*): A function generating the styles or a styles object. It will be linked to the component. Use the function signature if you need to have access to the theme. It's provided as the first argument. 2. `options` (*Object* [optional]): -- `options.defaultTheme` (*Object* [optional]): The default theme to use if a theme isn't supplied through a Theme Provider. -- `options.name` (*String* [optional]): The name of the style sheet. Useful for debugging. -- `options.flip` (*Boolean* [optional]): When set to `false`, this sheet will opt-out the `rtl` transformation. When set to `true`, the styles are inversed. When set to `null`, it follows `theme.direction`. +- `options.defaultTheme` (*object* [optional]): The default theme to use if a theme isn't supplied through a Theme Provider. +- `options.name` (*string* [optional]): The name of the style sheet. Useful for debugging. +- `options.flip` (_bool_ [optional]): When set to `false`, this sheet will opt-out the `rtl` transformation. When set to `true`, the styles are inversed. When set to `null`, it follows `theme.direction`. - The other keys are forwarded to the options argument of [jss.createStyleSheet([styles], [options])](https://cssinjs.org/jss-api/#create-style-sheet). ### Regresa @@ -84,12 +87,12 @@ Link a style sheet with a function component using the **hook** pattern. ```jsx import * as React from 'react'; -import { makeStyles } from '@material-ui/core/styles'; +import { makeStyles } from '@material-ui/styles'; const useStyles = makeStyles({ root: { backgroundColor: 'red', - color: props => props.color, + color: (props) => props.color, }, }); @@ -105,7 +108,7 @@ This is a class helper to handle server-side rendering. [You can follow this gui ```jsx import ReactDOMServer from 'react-dom/server'; -import { ServerStyleSheets } from '@material-ui/core/styles'; +import { ServerStyleSheets } from '@material-ui/styles'; const sheets = new ServerStyleSheets(); const html = ReactDOMServer.renderToString(sheets.collect()); @@ -126,7 +129,7 @@ const response = ` The instantiation accepts an options object as a first argument. -1. `options` (*Object* [optional]): The options are spread as props to the [`StylesProvider`](#stylesprovider) component. +1. `options` (_object_ [optional]): The options are spread as props to the [`StylesProvider`](#stylesprovider) component. ### `sheets.collect(node) => React element` @@ -154,10 +157,10 @@ Link a style sheet with a function component using the **styled components** pat 2. `styles` (*Function | Object*): A function generating the styles or a styles object. It will be linked to the component. Use the function signature if you need to have access to the theme. It's provided as property of the first argument. 3. `options` (*Object* [optional]): -- `options.defaultTheme` (*Object* [optional]): The default theme to use if a theme isn't supplied through a Theme Provider. -- `options.withTheme` (*Boolean* [optional]): Default `false`. Provide the `theme` object to the component as a property. -- `options.name` (*String* [optional]): The name of the style sheet. Useful for debugging. If the value isn't provided, it will try to fallback to the name of the component. -- `options.flip` (*Boolean* [optional]): When set to `false`, this sheet will opt-out the `rtl` transformation. When set to `true`, the styles are inversed. When set to `null`, it follows `theme.direction`. +- `options.defaultTheme` (*object* [optional]): The default theme to use if a theme isn't supplied through a Theme Provider. +- `options.withTheme` (_bool_ [optional]): Defaults to `false`. Provide the `theme` object to the component as a property. +- `options.name` (*string* [optional]): The name of the style sheet. Useful for debugging. If the value isn't provided, it will try to fallback to the name of the component. +- `options.flip` (_bool_ [optional]): When set to `false`, this sheet will opt-out the `rtl` transformation. When set to `true`, the styles are inversed. When set to `null`, it follows `theme.direction`. - The other keys are forwarded to the options argument of [jss.createStyleSheet([styles], [options])](https://cssinjs.org/jss-api/#create-style-sheet). ### Regresa @@ -168,23 +171,26 @@ Link a style sheet with a function component using the **styled components** pat ```jsx import * as React from 'react'; -import { styled } from '@material-ui/core/styles'; +import { styled, ThemeProvider } from '@material-ui/styles'; +import { createTheme } from '@material-ui/core/styles'; const MyComponent = styled('div')({ backgroundColor: 'red', }); -const MyThemeComponent = styled('div')(({ - theme -}) => ({ +const MyThemeComponent = styled('div')(({ theme }) => ({ padding: theme.spacing(1), })); +const theme = createTheme(); + export default function StyledComponents() { return ( - - - + + + + + ); } ``` @@ -210,12 +216,10 @@ It should preferably be used at **the root of your component tree**. ```jsx import * as React from 'react'; import ReactDOM from 'react-dom'; -import { StylesProvider } from '@material-ui/core/styles'; +import { StylesProvider } from '@material-ui/styles'; function App() { - return ( - ... - ); + return ...; } ReactDOM.render(, document.querySelector('#app')); @@ -279,18 +283,17 @@ Some implementation details that might be interesting to being aware of: - It adds a `classes` property so you can override the injected class names from the outside. - It forwards refs to the inner component. -- The `innerRef` prop is deprecated. Use `ref` instead. -- It does **not** copy over statics. For instance, it can be used to defined a `getInitialProps()` static method (next.js). +- It does **not** copy over statics. For instance, it can be used to define a `getInitialProps()` static method (next.js). ### Argumentos 1. `styles` (*Function | Object*): A function generating the styles or a styles object. It will be linked to the component. Use the function signature if you need to have access to the theme. It's provided as the first argument. 2. `options` (*Object* [optional]): -- `options.defaultTheme` (*Object* [optional]): The default theme to use if a theme isn't supplied through a Theme Provider. -- `options.withTheme` (*Boolean* [optional]): Default `false`. Provide the `theme` object to the component as a property. -- `options.name` (*String* [optional]): The name of the style sheet. Useful for debugging. If the value isn't provided, it will try to fallback to the name of the component. -- `options.flip` (*Boolean* [optional]): When set to `false`, this sheet will opt-out the `rtl` transformation. When set to `true`, the styles are inversed. When set to `null`, it follows `theme.direction`. +- `options.defaultTheme` (*object* [optional]): The default theme to use if a theme isn't supplied through a Theme Provider. +- `options.withTheme` (_bool_ [optional]): Defaults to `false`. Provide the `theme` object to the component as a property. +- `options.name` (*string* [optional]): The name of the style sheet. Useful for debugging. If the value isn't provided, it will try to fallback to the name of the component. +- `options.flip` (_bool_ [optional]): When set to `false`, this sheet will opt-out the `rtl` transformation. When set to `true`, the styles are inversed. When set to `null`, it follows `theme.direction`. - The other keys are forwarded to the options argument of [jss.createStyleSheet([styles], [options])](https://cssinjs.org/jss-api/#create-style-sheet). ### Regresa @@ -301,7 +304,7 @@ Some implementation details that might be interesting to being aware of: ```jsx import * as React from 'react'; -import { withStyles } from '@material-ui/core/styles'; +import { withStyles } from '@material-ui/styles'; const styles = { root: { @@ -320,7 +323,7 @@ Also, you can use as [decorators](https://babeljs.io/docs/en/babel-plugin-propos ```jsx import * as React from 'react'; -import { withStyles } from '@material-ui/core/styles'; +import { withStyles } from '@material-ui/styles'; const styles = { root: { @@ -329,13 +332,13 @@ const styles = { }; @withStyles(styles) -class MyComponent extends React. Component { - render () { +class MyComponent extends React.Component { + render() { return
    ; } } -export default MyComponent +export default MyComponent; ``` ## `withTheme(Component) => Component` diff --git a/docs/src/pages/styles/api/api-fr.md b/docs/src/pages/styles/api/api-fr.md index 202dc0e1dd912a..7039ea0abdf4b9 100644 --- a/docs/src/pages/styles/api/api-fr.md +++ b/docs/src/pages/styles/api/api-fr.md @@ -155,7 +155,7 @@ Link a style sheet with a function component using the **styled components** pat 3. `options` (*Object* [optional]): - `options.defaultTheme` (*Object* [optional]): The default theme to use if a theme isn't supplied through a Theme Provider. -- `options.withTheme` (*Boolean* [optional]): Valeur par défaut `false`. Provide the `theme` object to the component as a property. +- `options.withTheme` (*Boolean* [optional]): Valeur par défaut `false`. Fournissez l'objet `theme` au composant en tant que prop. - `options.name` (*String* [optional]): The name of the style sheet. Useful for debugging. If the value isn't provided, it will try to fallback to the name of the component. - `options.flip` (*Boolean* [optional]): When set to `false`, this sheet will opt-out the `rtl` transformation. When set to `true`, the styles are inversed. When set to `null`, it follows `theme.direction`. - The other keys are forwarded to the options argument of [jss.createStyleSheet([styles], [options])](https://cssinjs.org/jss-api/#create-style-sheet). @@ -279,7 +279,6 @@ Some implementation details that might be interesting to being aware of: - It adds a `classes` property so you can override the injected class names from the outside. - It forwards refs to the inner component. -- The `innerRef` prop is deprecated. Use `ref` instead. - It does **not** copy over statics. For instance, it can be used to defined a `getInitialProps()` static method (next.js). ### Paramètres @@ -288,7 +287,7 @@ Some implementation details that might be interesting to being aware of: 2. `options` (*Object* [optional]): - `options.defaultTheme` (*Object* [optional]): The default theme to use if a theme isn't supplied through a Theme Provider. -- `options.withTheme` (*Boolean* [optional]): Valeur par défaut `false`. Provide the `theme` object to the component as a property. +- `options.withTheme` (*Boolean* [optional]): Valeur par défaut `false`. Fournissez l'objet `theme` au composant en tant que prop. - `options.name` (*String* [optional]): The name of the style sheet. Useful for debugging. If the value isn't provided, it will try to fallback to the name of the component. - `options.flip` (*Boolean* [optional]): When set to `false`, this sheet will opt-out the `rtl` transformation. When set to `true`, the styles are inversed. When set to `null`, it follows `theme.direction`. - The other keys are forwarded to the options argument of [jss.createStyleSheet([styles], [options])](https://cssinjs.org/jss-api/#create-style-sheet). diff --git a/docs/src/pages/styles/api/api-ja.md b/docs/src/pages/styles/api/api-ja.md index d6ba3b26c97dd3..59a4b53c44c6d9 100644 --- a/docs/src/pages/styles/api/api-ja.md +++ b/docs/src/pages/styles/api/api-ja.md @@ -8,11 +8,11 @@ ### 引数 -1. `オプション` (*オプジェクト* [任意]): +1. `options` (_object_ [optional]): - - `options.disableGlobal` (*Boolean* [optional]): Defaults `false`. 確定的なクラス名の生成を無効にします。 - - `options.productionPrefix` (*String* [optional]): Defaults to `'jss'`. プロダクションでクラス名のプレフィックスに使用される文字列。 - - `options.seed` (*String* [optional]): Defaults to `''`. Useful for debugging. If the value isn't provided, it will try to fallback to the name of the component. + - `options.disableGlobal` (_bool_ [optional]): Defaults to `false`. 確定的なクラス名の生成を無効にします。 + - `options.productionPrefix` (*string* [optional]): Defaults to `'jss'`. プロダクションでクラス名のプレフィックスに使用される文字列。 + - `options.seed` (*string* [optional]): Defaults to `''`. Useful for debugging. If the value isn't provided, it will try to fallback to the name of the component. ### 戻り値 @@ -22,7 +22,7 @@ ```jsx import * as React from 'react'; -import { StylesProvider, createGenerateClassName } from '@material-ui/core/styles'; +import { StylesProvider, createGenerateClassName } from '@material-ui/styles'; const generateClassName = createGenerateClassName({ productionPrefix: 'c', @@ -39,7 +39,7 @@ This function doesn't really "do anything" at runtime, it's just the identity fu ### 引数 -1. `styles` (*Object*): A styles object. +1. `styles` (_object_): A styles object. ### 戻り値 @@ -48,7 +48,8 @@ This function doesn't really "do anything" at runtime, it's just the identity fu ### 例 ```jsx -import { makeStyles, createStyles } from '@material-ui/core/styles'; +import { createStyles, makeStyles } from '@material-ui/styles'; +import { createTheme, ThemeProvider } from '@material-ui/core/styles'; const useStyles = makeStyles((theme: Theme) => createStyles({ root: { @@ -56,9 +57,11 @@ const useStyles = makeStyles((theme: Theme) => createStyles({ }, })); +const theme = createTheme(); + export default function MyComponent { const classes = useStyles(); - return
    ; + return
    ; } ``` @@ -69,11 +72,11 @@ Link a style sheet with a function component using the **hook** pattern. ### 引数 1. `styles` (*Function | Object*): A function generating the styles or a styles object. It will be linked to the component. Use the function signature if you need to have access to the theme. It's provided as the first argument. -2. `オプション` (*オプジェクト* [任意]): +2. `options` (_object_ [optional]): -- `options.defaultTheme` (*Object* [optional]): The default theme to use if a theme isn't supplied through a Theme Provider. -- `options.name` (*String* [optional]): The name of the style sheet. Useful for debugging. -- `options.flip` (*Boolean* [optional]): When set to `false`, this sheet will opt-out the `rtl` transformation. When set to `true`, the styles are inversed. When set to `null`, it follows `theme.direction`. +- `options.defaultTheme` (*object* [optional]): The default theme to use if a theme isn't supplied through a Theme Provider. +- `options.name` (*string* [optional]): The name of the style sheet. Useful for debugging. +- `options.flip` (_bool_ [optional]): When set to `false`, this sheet will opt-out the `rtl` transformation. When set to `true`, the styles are inversed. When set to `null`, it follows `theme.direction`. - The other keys are forwarded to the options argument of [jss.createStyleSheet([styles], [options])](https://cssinjs.org/jss-api/#create-style-sheet). ### 戻り値 @@ -84,12 +87,12 @@ Link a style sheet with a function component using the **hook** pattern. ```jsx import * as React from 'react'; -import { makeStyles } from '@material-ui/core/styles'; +import { makeStyles } from '@material-ui/styles'; const useStyles = makeStyles({ root: { backgroundColor: 'red', - color: props => props.color, + color: (props) => props.color, }, }); @@ -104,8 +107,9 @@ export default function MyComponent(props) { This is a class helper to handle server-side rendering. [You can follow this guide for a practical approach](/guides/server-rendering/). ```jsx + import ReactDOMServer from 'react-dom/server'; -import { ServerStyleSheets } from '@material-ui/core/styles'; +import { ServerStyleSheets } from '@material-ui/styles'; const sheets = new ServerStyleSheets(); const html = ReactDOMServer.renderToString(sheets.collect()); @@ -126,7 +130,7 @@ const response = ` The instantiation accepts an options object as a first argument. -1. `options` (*Object* [optional]): The options are spread as props to the [`StylesProvider`](#stylesprovider) component. +1. `options` (_object_ [optional]): The options are spread as props to the [`StylesProvider`](#stylesprovider) component. ### `sheets.collect(node) => React element` @@ -152,12 +156,12 @@ Link a style sheet with a function component using the **styled components** pat 1. `Component`::ラップされるコンポーネント。 2. `styles` (*Function | Object*): A function generating the styles or a styles object. It will be linked to the component. Use the function signature if you need to have access to the theme. It's provided as property of the first argument. -3. `オプション` (*オプジェクト* [任意]): +3. `options` (_object_ [optional]): -- `options.defaultTheme` (*Object* [optional]): The default theme to use if a theme isn't supplied through a Theme Provider. -- `options.withTheme` (*ブール値* [任意]): デフォルト値 `false`. `theme`オブジェクトをプロパティとしてコンポーネントに提供します。 -- `options.name` (*String* [optional]): The name of the style sheet. Useful for debugging. If the value isn't provided, it will try to fallback to the name of the component. -- `options.flip` (*Boolean* [optional]): When set to `false`, this sheet will opt-out the `rtl` transformation. When set to `true`, the styles are inversed. When set to `null`, it follows `theme.direction`. +- `options.defaultTheme` (*object* [optional]): The default theme to use if a theme isn't supplied through a Theme Provider. +- `options.withTheme` (_bool_ [optional]): Defaults to `false`. `theme`オブジェクトをプロパティとしてコンポーネントに提供します。 +- `options.name` (*string* [optional]): The name of the style sheet. Useful for debugging. If the value isn't provided, it will try to fallback to the name of the component. +- `options.flip` (_bool_ [optional]): When set to `false`, this sheet will opt-out the `rtl` transformation. When set to `true`, the styles are inversed. When set to `null`, it follows `theme.direction`. - The other keys are forwarded to the options argument of [jss.createStyleSheet([styles], [options])](https://cssinjs.org/jss-api/#create-style-sheet). ### 戻り値 @@ -168,23 +172,26 @@ Link a style sheet with a function component using the **styled components** pat ```jsx import * as React from 'react'; -import { styled } from '@material-ui/core/styles'; +import { styled, ThemeProvider } from '@material-ui/styles'; +import { createTheme } from '@material-ui/core/styles'; const MyComponent = styled('div')({ backgroundColor: 'red', }); -const MyThemeComponent = styled('div')(({ - theme -}) => ({ +const MyThemeComponent = styled('div')(({ theme }) => ({ padding: theme.spacing(1), })); +const theme = createTheme(); + export default function StyledComponents() { return ( - - - + + + + + ); } ``` @@ -210,12 +217,10 @@ It should preferably be used at **the root of your component tree**. ```jsx import * as React from 'react'; import ReactDOM from 'react-dom'; -import { StylesProvider } from '@material-ui/core/styles'; +import { StylesProvider } from '@material-ui/styles'; function App() { - return ( - ... - ); + return ...; } ReactDOM.render(, document.querySelector('#app')); @@ -279,18 +284,17 @@ Link a style sheet with a component using the **higher-order component** pattern - It adds a `classes` property so you can override the injected class names from the outside. - It forwards refs to the inner component. -- The `innerRef` prop is deprecated. Use `ref` instead. -- It does **not** copy over statics. たとえば、`getInitialProps()`静的メソッド (next.js) を定義するために使用できます。 +- It does **not** copy over statics. For instance, it can be used to define a `getInitialProps()` static method (next.js). ### 引数 1. `styles` (*Function | Object*): A function generating the styles or a styles object. It will be linked to the component. Use the function signature if you need to have access to the theme. It's provided as the first argument. -2. `オプション` (*オプジェクト* [任意]): +2. `options` (_object_ [optional]): -- `options.defaultTheme` (*Object* [optional]): The default theme to use if a theme isn't supplied through a Theme Provider. -- `options.withTheme` (*ブール値* [任意]): デフォルト値 `false`. `theme`オブジェクトをプロパティとしてコンポーネントに提供します。 -- `options.name` (*String* [optional]): The name of the style sheet. Useful for debugging. If the value isn't provided, it will try to fallback to the name of the component. -- `options.flip` (*Boolean* [optional]): When set to `false`, this sheet will opt-out the `rtl` transformation. When set to `true`, the styles are inversed. When set to `null`, it follows `theme.direction`. +- `options.defaultTheme` (*object* [optional]): The default theme to use if a theme isn't supplied through a Theme Provider. +- `options.withTheme` (_bool_ [optional]): Defaults to `false`. `theme`オブジェクトをプロパティとしてコンポーネントに提供します。 +- `options.name` (*string* [optional]): The name of the style sheet. Useful for debugging. If the value isn't provided, it will try to fallback to the name of the component. +- `options.flip` (_bool_ [optional]): When set to `false`, this sheet will opt-out the `rtl` transformation. When set to `true`, the styles are inversed. When set to `null`, it follows `theme.direction`. - The other keys are forwarded to the options argument of [jss.createStyleSheet([styles], [options])](https://cssinjs.org/jss-api/#create-style-sheet). ### 戻り値 @@ -301,7 +305,7 @@ Link a style sheet with a component using the **higher-order component** pattern ```jsx import * as React from 'react'; -import { withStyles } from '@material-ui/core/styles'; +import { withStyles } from '@material-ui/styles'; const styles = { root: { @@ -320,7 +324,7 @@ export default withStyles(styles)(MyComponent); ```jsx import * as React from 'react'; -import { withStyles } from '@material-ui/core/styles'; +import { withStyles } from '@material-ui/styles'; const styles = { root: { @@ -330,12 +334,12 @@ const styles = { @withStyles(styles) class MyComponent extends React.Component { - render () { + render() { return
    ; } } -export default MyComponent +export default MyComponent; ``` ## `withTheme(Component) => Component` diff --git a/docs/src/pages/styles/api/api-pt.md b/docs/src/pages/styles/api/api-pt.md index 2672f6dde00519..c2cac2f83a494e 100644 --- a/docs/src/pages/styles/api/api-pt.md +++ b/docs/src/pages/styles/api/api-pt.md @@ -8,11 +8,11 @@ Uma função que retorna [uma função geradora de nome de classe](https://cssin ### Argumentos -1. `options` (_Object_ [opcional]): +1. `options` (_object_ [optional]): - - `options.disableGlobal` (*Boolean* [opcional]): Padrão `false`. Desabilita a geração de nomes de classes determinísticas. - - `options.productionPrefix` (*String* [opcional]): Padrão `'jss'`. A string usada para prefixar os nomes de classes em produção. - - `options.seed` (*String* [opcional]): Padrão `''`. A string usada unicamente para identificar o gerador. Ela pode ser usada para evitar colisões de nomes de classes ao usar vários geradores no mesmo documento. + - `options.disableGlobal` (_bool_ [optional]): Defaults to `false`. Desabilita a geração de nomes de classes determinísticas. + - `options.productionPrefix` (*string* [opcional]): Padrão `'jss'`. A string usada para prefixar os nomes de classes em produção. + - `options.seed` (*string* [opcional]): Padrão `''`. A string usada unicamente para identificar o gerador. Ela pode ser usada para evitar colisões de nomes de classes ao usar vários geradores no mesmo documento. ### Retornos @@ -22,7 +22,7 @@ Uma função que retorna [uma função geradora de nome de classe](https://cssin ```jsx import * as React from 'react'; -import { StylesProvider, createGenerateClassName } from '@material-ui/core/styles'; +import { StylesProvider, createGenerateClassName } from '@material-ui/styles'; const generateClassName = createGenerateClassName({ productionPrefix: 'c', @@ -39,7 +39,7 @@ Esta função realmente não "faz nada" em tempo de execução, é apenas uma fu ### Argumentos -1. `styles` (*Object*): Um objeto de estilos. +1. `styles` (_object_): A styles object. ### Retornos @@ -48,7 +48,8 @@ Esta função realmente não "faz nada" em tempo de execução, é apenas uma fu ### Exemplos ```jsx -import { makeStyles, createStyles } from '@material-ui/core/styles'; +import { createStyles, makeStyles } from '@material-ui/styles'; +import { createTheme, ThemeProvider } from '@material-ui/core/styles'; const useStyles = makeStyles((theme: Theme) => createStyles({ root: { @@ -56,9 +57,11 @@ const useStyles = makeStyles((theme: Theme) => createStyles({ }, })); +const theme = createTheme(); + export default function MyComponent { const classes = useStyles(); - return
    ; + return
    ; } ``` @@ -69,11 +72,11 @@ Vincula uma folha de estilo a um componente de função usando o padrão **hook* ### Argumentos 1. `styles` (*Function | Object*): Uma função que gera os estilos ou um objeto de estilos. Ela será vinculada ao componente. Use a assinatura da função se você precisar ter acesso ao tema. É fornecido como o primeiro argumento. -2. `options` (_Object_ [opcional]): +2. `options` (_object_ [optional]): -- `options.defaultTheme` (*Object* [opcional]): O tema padrão a ser usado se um tema não for fornecido por meio de um provedor de temas. -- `options.name` (*String* [opcional]): O nome da folha de estilo. Útil para depuração. -- `options.flip` (*Boolean* [opcional]): Quando definido como `false`, está folha irá cancelar a transformação `rtl`. Quando definido para `true`, os estilos são invertidos. Quando definido para `null`, segue `theme.direction`. +- `options.defaultTheme` (*object* [opcional]): O tema padrão a ser usado se um tema não for fornecido por meio de um provedor de temas. +- `options.name` (*string* [opcional]): O nome da folha de estilo. Útil para depuração. +- `options.flip` (_bool_ [optional]): When set to `false`, this sheet will opt-out the `rtl` transformation. Quando definido para `true`, os estilos são invertidos. Quando definido para `null`, segue `theme.direction`. - As outras chaves são encaminhadas para o argumento de opções do [jss.createStyleSheet ([styles], [options])](https://cssinjs.org/jss-api/#create-style-sheet). ### Retornos @@ -84,7 +87,7 @@ Vincula uma folha de estilo a um componente de função usando o padrão **hook* ```jsx import * as React from 'react'; -import { makeStyles } from '@material-ui/core/styles'; +import { makeStyles } from '@material-ui/styles'; const useStyles = makeStyles({ root: { @@ -105,7 +108,7 @@ Esta é uma classe utilitária para manipular a renderização do lado do servid ```jsx import ReactDOMServer from 'react-dom/server'; -import { ServerStyleSheets } from '@material-ui/core/styles'; +import { ServerStyleSheets } from '@material-ui/styles'; const sheets = new ServerStyleSheets(); const html = ReactDOMServer.renderToString(sheets.collect()); @@ -126,7 +129,7 @@ const response = ` A instanciação aceita um objeto de opções como primeiro argumento. -1. `options` (*Object* [opcional]): As opções são distribuídas como propriedades para o componente [`StylesProvider`](#stylesprovider). +1. `options` (_object_ [optional]): The options are spread as props to the [`StylesProvider`](#stylesprovider) component. ### `sheets.collect(node) => Elemento React` @@ -152,12 +155,12 @@ Vincula uma folha de estilos, com uma função de componente, usando o padrão d 1. `Component`: O componente que será manipulado. 2. `styles` (*Function | Object*): Uma função que gera os estilos ou um objeto de estilos. Ela será vinculada ao componente. Use a assinatura da função se você precisar ter acesso ao tema. É fornecido como propriedade do primeiro argumento. -3. `options` (_Object_ [opcional]): +3. `options` (_object_ [optional]): -- `options.defaultTheme` (*Object* [opcional]): O tema padrão a ser usado se um tema não for fornecido por meio de um provedor de temas. -- `options.withTheme` (*Boolean* [opcional]): Padrão `false`. Fornecer o objeto `theme` para o componente como uma propriedade. -- `options.name` (*String* [opcional]): O nome da folha de estilo. Útil para depuração. Se o valor não for fornecido, ele tentará usar o nome do componente. -- `options.flip` (*Boolean* [opcional]): Quando definido como `false`, está folha irá cancelar a transformação `rtl`. Quando definido para `true`, os estilos são invertidos. Quando definido para `null`, segue `theme.direction`. +- `options.defaultTheme` (*object* [opcional]): O tema padrão a ser usado se um tema não for fornecido por meio de um provedor de temas. +- `options.withTheme` (_bool_ [optional]): Defaults to `false`. Fornecer o objeto `theme` para o componente como uma propriedade. +- `options.name` (*string* [opcional]): O nome da folha de estilo. Útil para depuração. Se o valor não for fornecido, ele tentará usar o nome do componente. +- `options.flip` (_bool_ [optional]): When set to `false`, this sheet will opt-out the `rtl` transformation. Quando definido para `true`, os estilos são invertidos. Quando definido para `null`, segue `theme.direction`. - As outras chaves são encaminhadas para o argumento de opções do [jss.createStyleSheet ([styles], [options])](https://cssinjs.org/jss-api/#create-style-sheet). ### Retornos @@ -168,7 +171,8 @@ Vincula uma folha de estilos, com uma função de componente, usando o padrão d ```jsx import * as React from 'react'; -import { styled } from '@material-ui/core/styles'; +import { styled, ThemeProvider } from '@material-ui/styles'; +import { createTheme } from '@material-ui/core/styles'; const MyComponent = styled('div')({ backgroundColor: 'red', @@ -178,11 +182,15 @@ const MyThemeComponent = styled('div')(({ theme }) => ({ padding: theme.spacing(1), })); +const theme = createTheme(); + export default function StyledComponents() { return ( - - - + + + + + ); } ``` @@ -208,7 +216,7 @@ Deve preferencialmente ser usado na **raiz da sua árvore de componentes**. ```jsx import * as React from 'react'; import ReactDOM from 'react-dom'; -import { StylesProvider } from '@material-ui/core/styles'; +import { StylesProvider } from '@material-ui/styles'; function App() { return ...; @@ -273,18 +281,17 @@ Alguns detalhes de implementação que podem ser interessantes para estar ciente - Adiciona uma propriedade `classes`, assim você pode substituir, a partir do exterior, os nomes de classe previamente injectados. - Ela encaminha refs para o componente interno. -- A propriedade `innerRef` está descontinuada. Em vez disso, use `ref`. -- Ele **não** faz copia sobre estáticos. Por exemplo, pode ser usado para definir um método estático (next.js) `getInitialProps()`. +- Ele **não** faz copia sobre estáticos. For instance, it can be used to define a `getInitialProps()` static method (next.js). ### Argumentos 1. `styles` (*Function | Object*): Uma função que gera os estilos ou um objeto de estilos. Ela será vinculada ao componente. Use a assinatura da função se você precisar ter acesso ao tema. É fornecido como o primeiro argumento. -2. `options` (_Object_ [opcional]): +2. `options` (_object_ [optional]): -- `options.defaultTheme` (*Object* [opcional]): O tema padrão a ser usado se um tema não for fornecido por meio de um provedor de temas. -- `options.withTheme` (*Boolean* [opcional]): Padrão `false`. Fornecer o objeto `theme` para o componente como uma propriedade. -- `options.name` (*String* [opcional]): O nome da folha de estilo. Útil para depuração. Se o valor não for fornecido, ele tentará usar o nome do componente. -- `options.flip` (*Boolean* [opcional]): Quando definido como `false`, está folha irá cancelar a transformação `rtl`. Quando definido para `true`, os estilos são invertidos. Quando definido para `null`, segue `theme.direction`. +- `options.defaultTheme` (*object* [opcional]): O tema padrão a ser usado se um tema não for fornecido por meio de um provedor de temas. +- `options.withTheme` (_bool_ [optional]): Defaults to `false`. Fornecer o objeto `theme` para o componente como uma propriedade. +- `options.name` (*string* [opcional]): O nome da folha de estilo. Útil para depuração. Se o valor não for fornecido, ele tentará usar o nome do componente. +- `options.flip` (_bool_ [optional]): When set to `false`, this sheet will opt-out the `rtl` transformation. Quando definido para `true`, os estilos são invertidos. Quando definido para `null`, segue `theme.direction`. - As outras chaves são encaminhadas para o argumento de opções do [jss.createStyleSheet ([styles], [options])](https://cssinjs.org/jss-api/#create-style-sheet). ### Retornos @@ -295,7 +302,7 @@ Alguns detalhes de implementação que podem ser interessantes para estar ciente ```jsx import * as React from 'react'; -import { withStyles } from '@material-ui/core/styles'; +import { withStyles } from '@material-ui/styles'; const styles = { root: { @@ -314,7 +321,7 @@ Além disso, você pode usar com [decoradores](https://babeljs.io/docs/en/babel- ```jsx import * as React from 'react'; -import { withStyles } from '@material-ui/core/styles'; +import { withStyles } from '@material-ui/styles'; const styles = { root: { diff --git a/docs/src/pages/styles/api/api-ru.md b/docs/src/pages/styles/api/api-ru.md index 57ebb589a8b39f..391f49e4ae5f7f 100644 --- a/docs/src/pages/styles/api/api-ru.md +++ b/docs/src/pages/styles/api/api-ru.md @@ -8,11 +8,11 @@ A function which returns [a class name generator function](https://cssinjs.org/j ### Аргументы -1. `варианты` (*объекта* [optional]): +1. `options` (_object_ [optional]): - - `options.disableGlobal` (*Boolean* [optional]): По умолчанию - `false`. Disable the generation of deterministic class names. - - `options.productionPrefix` (*String* [optional]): Defaults to `'jss'`. The string used to prefix the class names in production. - - `options.seed` (*String* [optional]): Defaults to `''`. The string used to uniquely identify the generator. It can be used to avoid class name collisions when using multiple generators in the same document. + - `options.disableGlobal` (_bool_ [optional]): Defaults to `false`. Disable the generation of deterministic class names. + - `options.productionPrefix` (*string* [optional]): Defaults to `'jss'`. The string used to prefix the class names in production. + - `options.seed` (*string* [optional]): Defaults to `''`. The string used to uniquely identify the generator. It can be used to avoid class name collisions when using multiple generators in the same document. ### Возвращает @@ -22,7 +22,7 @@ A function which returns [a class name generator function](https://cssinjs.org/j ```jsx import * as React from 'react'; -import { StylesProvider, createGenerateClassName } from '@material-ui/core/styles'; +import { StylesProvider, createGenerateClassName } from '@material-ui/styles'; const generateClassName = createGenerateClassName({ productionPrefix: 'c', @@ -39,7 +39,7 @@ This function doesn't really "do anything" at runtime, it's just the identity fu ### Аргументы -1. `styles` (*Object*): A styles object. +1. `styles` (_object_): A styles object. ### Возвращает @@ -48,7 +48,8 @@ This function doesn't really "do anything" at runtime, it's just the identity fu ### Примеры ```jsx -import { makeStyles, createStyles } from '@material-ui/core/styles'; +import { createStyles, makeStyles } from '@material-ui/styles'; +import { createTheme, ThemeProvider } from '@material-ui/core/styles'; const useStyles = makeStyles((theme: Theme) => createStyles({ root: { @@ -56,9 +57,11 @@ const useStyles = makeStyles((theme: Theme) => createStyles({ }, })); +const theme = createTheme(); + export default function MyComponent { const classes = useStyles(); - return
    ; + return
    ; } ``` @@ -69,11 +72,11 @@ Link a style sheet with a function component using the **hook** pattern. ### Аргументы 1. `styles` (*Function | Object*): A function generating the styles or a styles object. Это будет связано с компонентом. Use the function signature if you need to have access to the theme. It's provided as the first argument. -2. `варианты` (*объекта* [optional]): +2. `options` (_object_ [optional]): -- `options.defaultTheme` (*Object* [optional]): The default theme to use if a theme isn't supplied through a Theme Provider. -- `options.name` (*String* [optional]): The name of the style sheet. Полезно для отладки. -- `options.flip` (*Boolean* [optional]): When set to `false`, this sheet will opt-out the `rtl` transformation. When set to `true`, the styles are inversed. When set to `null`, it follows `theme.direction`. +- `options.defaultTheme` (*object* [optional]): The default theme to use if a theme isn't supplied through a Theme Provider. +- `options.name` (*string* [optional]): The name of the style sheet. Полезно для отладки. +- `options.flip` (_bool_ [optional]): When set to `false`, this sheet will opt-out the `rtl` transformation. When set to `true`, the styles are inversed. When set to `null`, it follows `theme.direction`. - The other keys are forwarded to the options argument of [jss.createStyleSheet([styles], [options])](https://cssinjs.org/jss-api/#create-style-sheet). ### Возвращает @@ -84,12 +87,12 @@ Link a style sheet with a function component using the **hook** pattern. ```jsx import * as React from 'react'; -import { makeStyles } from '@material-ui/core/styles'; +import { makeStyles } from '@material-ui/styles'; const useStyles = makeStyles({ root: { backgroundColor: 'red', - color: props => props.color, + color: (props) => props.color, }, }); @@ -105,7 +108,7 @@ This is a class helper to handle server-side rendering. [You can follow this gui ```jsx import ReactDOMServer from 'react-dom/server'; -import { ServerStyleSheets } from '@material-ui/core/styles'; +import { ServerStyleSheets } from '@material-ui/styles'; const sheets = new ServerStyleSheets(); const html = ReactDOMServer.renderToString(sheets.collect()); @@ -126,7 +129,7 @@ const response = ` The instantiation accepts an options object as a first argument. -1. `options` (*Object* [optional]): The options are spread as props to the [`StylesProvider`](#stylesprovider) component. +1. `options` (_object_ [optional]): The options are spread as props to the [`StylesProvider`](#stylesprovider) component. ### `sheets.collect(node) => React element` @@ -152,12 +155,12 @@ Link a style sheet with a function component using the **styled components** pat 1. `Component`: The component that will be wrapped. 2. `styles` (*Function | Object*): A function generating the styles or a styles object. Это будет связано с компонентом. Use the function signature if you need to have access to the theme. It's provided as property of the first argument. -3. `варианты` (*объекта* [optional]): +3. `options` (_object_ [optional]): -- `options.defaultTheme` (*Object* [optional]): The default theme to use if a theme isn't supplied through a Theme Provider. -- `options.withTheme` (*Boolean* [optional]): По умолчанию - `false`. Provide the `theme` object to the component as a property. -- `options.name` (*String* [optional]): The name of the style sheet. Полезно для отладки. If the value isn't provided, it will try to fallback to the name of the component. -- `options.flip` (*Boolean* [optional]): When set to `false`, this sheet will opt-out the `rtl` transformation. When set to `true`, the styles are inversed. When set to `null`, it follows `theme.direction`. +- `options.defaultTheme` (*object* [optional]): The default theme to use if a theme isn't supplied through a Theme Provider. +- `options.withTheme` (_bool_ [optional]): Defaults to `false`. Provide the `theme` object to the component as a property. +- `options.name` (*string* [optional]): The name of the style sheet. Полезно для отладки. If the value isn't provided, it will try to fallback to the name of the component. +- `options.flip` (_bool_ [optional]): When set to `false`, this sheet will opt-out the `rtl` transformation. When set to `true`, the styles are inversed. When set to `null`, it follows `theme.direction`. - The other keys are forwarded to the options argument of [jss.createStyleSheet([styles], [options])](https://cssinjs.org/jss-api/#create-style-sheet). ### Возвращает @@ -168,23 +171,26 @@ Link a style sheet with a function component using the **styled components** pat ```jsx import * as React from 'react'; -import { styled } from '@material-ui/core/styles'; +import { styled, ThemeProvider } from '@material-ui/styles'; +import { createTheme } from '@material-ui/core/styles'; const MyComponent = styled('div')({ backgroundColor: 'red', }); -const MyThemeComponent = styled('div')(({ - theme -}) => ({ +const MyThemeComponent = styled('div')(({ theme }) => ({ padding: theme.spacing(1), })); +const theme = createTheme(); + export default function StyledComponents() { return ( - - - + + + + + ); } ``` @@ -210,12 +216,10 @@ It should preferably be used at **the root of your component tree**. ```jsx import * as React from 'react'; import ReactDOM from 'react-dom'; -import { StylesProvider } from '@material-ui/core/styles'; +import { StylesProvider } from '@material-ui/styles'; function App() { - return ( - ... - ); + return ...; } ReactDOM.render(, document.querySelector('#app')); @@ -279,18 +283,17 @@ Link a style sheet with a component using the **higher-order component** pattern - It adds a `classes` property so you can override the injected class names from the outside. - It forwards refs to the inner component. -- The `innerRef` prop is deprecated. Use `ref` instead. -- It does **not** copy over statics. For instance, it can be used to defined a `getInitialProps()` static method (next.js). +- It does **not** copy over statics. For instance, it can be used to define a `getInitialProps()` static method (next.js). ### Аргументы 1. `styles` (*Function | Object*): A function generating the styles or a styles object. Это будет связано с компонентом. Use the function signature if you need to have access to the theme. It's provided as the first argument. -2. `варианты` (*объекта* [optional]): +2. `options` (_object_ [optional]): -- `options.defaultTheme` (*Object* [optional]): The default theme to use if a theme isn't supplied through a Theme Provider. -- `options.withTheme` (*Boolean* [optional]): По умолчанию - `false`. Provide the `theme` object to the component as a property. -- `options.name` (*String* [optional]): The name of the style sheet. Полезно для отладки. If the value isn't provided, it will try to fallback to the name of the component. -- `options.flip` (*Boolean* [optional]): When set to `false`, this sheet will opt-out the `rtl` transformation. When set to `true`, the styles are inversed. When set to `null`, it follows `theme.direction`. +- `options.defaultTheme` (*object* [optional]): The default theme to use if a theme isn't supplied through a Theme Provider. +- `options.withTheme` (_bool_ [optional]): Defaults to `false`. Provide the `theme` object to the component as a property. +- `options.name` (*string* [optional]): The name of the style sheet. Полезно для отладки. If the value isn't provided, it will try to fallback to the name of the component. +- `options.flip` (_bool_ [optional]): When set to `false`, this sheet will opt-out the `rtl` transformation. When set to `true`, the styles are inversed. When set to `null`, it follows `theme.direction`. - The other keys are forwarded to the options argument of [jss.createStyleSheet([styles], [options])](https://cssinjs.org/jss-api/#create-style-sheet). ### Возвращает @@ -301,7 +304,7 @@ Link a style sheet with a component using the **higher-order component** pattern ```jsx import * as React from 'react'; -import { withStyles } from '@material-ui/core/styles'; +import { withStyles } from '@material-ui/styles'; const styles = { root: { @@ -320,7 +323,7 @@ Also, you can use as [decorators](https://babeljs.io/docs/en/babel-plugin-propos ```jsx import * as React from 'react'; -import { withStyles } from '@material-ui/core/styles'; +import { withStyles } from '@material-ui/styles'; const styles = { root: { @@ -330,12 +333,12 @@ const styles = { @withStyles(styles) class MyComponent extends React.Component { - render () { + render() { return
    ; } } -export default MyComponent +export default MyComponent; ``` ## `withTheme()(Component) => Component` diff --git a/docs/src/pages/styles/api/api-zh.md b/docs/src/pages/styles/api/api-zh.md index 7ab3f22ad30a71..e5d1319ed232c6 100644 --- a/docs/src/pages/styles/api/api-zh.md +++ b/docs/src/pages/styles/api/api-zh.md @@ -8,11 +8,11 @@ ### 参数 -1. `options` (_Object_ [optional]): +1. `options` (_object_ [optional]): - - `options.disableGlobal` (*Boolean* [optional]): 默认值为`false`。 阻止生成确定性的类名。 - - `options.seed` (*String* [optional]):初始值为 `''`. 用于唯一标识生成器的字符串。 字符串用来在生产中对类名称加上前缀。 - - `options.seed` (_String_ [optional]):初始值为 `''`. 用于唯一标识生成器的字符串。 用于唯一标识生成器的字符串。 在同一个文档中使用多个生成器时,它可用于避免类名冲突。 + - `options.disableGlobal` (_bool_ [optional]): Defaults to `false`. 阻止生成确定性的类名。 + - `options.seed` (*string* [optional]):初始值为 `''`. 用于唯一标识生成器的字符串。 字符串用来在生产中对类名称加上前缀。 + - `options.seed` (_string_ [optional]):初始值为 `''`. 用于唯一标识生成器的字符串。 用于唯一标识生成器的字符串。 在同一个文档中使用多个生成器时,它可用于避免类名冲突。 ### 返回结果 @@ -22,7 +22,7 @@ ```jsx import * as React from 'react'; -import { StylesProvider, createGenerateClassName } from '@material-ui/core/styles'; +import { StylesProvider, createGenerateClassName } from '@material-ui/styles'; const generateClassName = createGenerateClassName({ productionPrefix: 'c', @@ -39,7 +39,7 @@ export default function App() { ### 参数 -1. `styles` (_Object_): 一个样式对象。 +1. `styles` (_object_): A styles object. ### 返回结果 @@ -48,7 +48,8 @@ export default function App() { ### 例子 ```jsx -import { makeStyles, createStyles } from '@material-ui/core/styles'; +import { createStyles, makeStyles } from '@material-ui/styles'; +import { createTheme, ThemeProvider } from '@material-ui/core/styles'; const useStyles = makeStyles((theme: Theme) => createStyles({ root: { @@ -56,9 +57,11 @@ const useStyles = makeStyles((theme: Theme) => createStyles({ }, })); +const theme = createTheme(); + export default function MyComponent { const classes = useStyles(); - return
    ; + return
    ; } ``` @@ -69,11 +72,11 @@ export default function MyComponent { ### 参数 1. `styles`(* Function | Object *): 生成样式或样式对象的函数。 它将被链接到组件中。 若您需要访问主题,请使用函数签名(function signature)。 它是提供的第一个参数。 -2. `options` (_Object_ [optional]): +2. `options` (_object_ [optional]): -- `options.defaultTheme`(*Object* [optional]):如果未通过主题提供者提供主题,则使用默认主题。 -- `options.name` (*String* [optional]): 样式表的名称。 适合调试。 -- `options.flip` (*Boolean* [optional]):当设置为 `false` 时, 此工作表将选择退出 `rtl` 转换。 如果设置为 `true`时,则会反转样式。 当设置为 `null`,它依据 `theme.direction` 而定。 +- `options.defaultTheme`(*object* [optional]):如果未通过主题提供者提供主题,则使用默认主题。 +- `options.name` (*string* [optional]): 样式表的名称。 适合调试。 +- `options.flip` (_bool_ [optional]): When set to `false`, this sheet will opt-out the `rtl` transformation. 如果设置为 `true`时,则会反转样式。 当设置为 `null`,它依据 `theme.direction` 而定。 - 其他的键将会作为 options 参数传递给 [jss.createStyleSheet([styles], [options])](https://cssinjs.org/jss-api/#create-style-sheet)。 ### 返回结果 @@ -84,7 +87,7 @@ export default function MyComponent { ```jsx import * as React from 'react'; -import { makeStyles } from '@material-ui/core/styles'; +import { makeStyles } from '@material-ui/styles'; const useStyles = makeStyles({ root: { @@ -105,7 +108,7 @@ export default function MyComponent(props) { ```jsx import ReactDOMServer from 'react-dom/server'; -import { ServerStyleSheets } from '@material-ui/core/styles'; +import { ServerStyleSheets } from '@material-ui/styles'; const sheets = new ServerStyleSheets(); const html = ReactDOMServer.renderToString(sheets.collect()); @@ -126,7 +129,7 @@ const response = ` 实例化接受的第一个参数是一个 options 对象。 -1. `options` (_Object_ [optional]):options 作为属性分布到 [`StylesProvider`](#stylesprovider) 组件中。 +1. `options` (_object_ [optional]): The options are spread as props to the [`StylesProvider`](#stylesprovider) component. ### `sheets.collect(node) => React element` @@ -152,12 +155,12 @@ const response = ` 1. `Component` :将被包装的组件。 2. `styles`(* Function | Object *): 生成样式或样式对象的函数。 它将被链接到组件中。 若您需要访问主题,请使用函数签名(function signature)。 它作为第一个参数的属性给出。 -3. `options` (_Object_ [optional]): +3. `options` (_object_ [optional]): -- `options.defaultTheme`(*Object* [optional]):如果未通过主题提供者提供主题,则使用默认主题。 -- `options.withTheme` (*Boolean* [optional]): 默认值为 `false`。 将 `theme` 对象作为属性提供给组件。 -- `options.name` (*String* [optional]): 样式表的名称。 适合调试。 如果未提供该值,它将尝试回退到组件的名称。 -- `options.flip` (*Boolean* [optional]):当设置为 `false` 时, 此工作表将选择退出 `rtl` 转换。 如果设置为 `true`时,则会反转样式。 当设置为 `null`,它依据 `theme.direction` 而定。 +- `options.defaultTheme`(*object* [optional]):如果未通过主题提供者提供主题,则使用默认主题。 +- `options.withTheme` (_bool_ [optional]): Defaults to `false`. 将 `theme` 对象作为属性提供给组件。 +- `options.name` (*string* [optional]): 样式表的名称。 适合调试。 如果未提供该值,它将尝试回退到组件的名称。 +- `options.flip` (_bool_ [optional]): When set to `false`, this sheet will opt-out the `rtl` transformation. 如果设置为 `true`时,则会反转样式。 当设置为 `null`,它依据 `theme.direction` 而定。 - 其他的键将会作为 options 参数传递给 [jss.createStyleSheet([styles], [options])](https://cssinjs.org/jss-api/#create-style-sheet)。 ### 返回结果 @@ -168,7 +171,8 @@ const response = ` ```jsx import * as React from 'react'; -import { styled } from '@material-ui/core/styles'; +import { styled, ThemeProvider } from '@material-ui/styles'; +import { createTheme } from '@material-ui/core/styles'; const MyComponent = styled('div')({ backgroundColor: 'red', @@ -178,11 +182,15 @@ const MyThemeComponent = styled('div')(({ theme }) => ({ padding: theme.spacing(1), })); +const theme = createTheme(); + export default function StyledComponents() { return ( - - - + + + + + ); } ``` @@ -208,12 +216,10 @@ export default function StyledComponents() { ```jsx import * as React from 'react'; import ReactDOM from 'react-dom'; -import { StylesProvider } from '@material-ui/core/styles'; +import { StylesProvider } from '@material-ui/styles'; function App() { - return ( - ... - ); + return ...; } ReactDOM.render(, document.querySelector('#app')); @@ -275,18 +281,17 @@ export default function MyComponent() { - 它添加了一个 `classes` 属性,因此您可以从外部覆盖注入的类名。 - 它将 refs 转发给内部的组件。 -- 而 `innerRef` 属性已不再使用了。 请使用 `ref`。 -- 它 **不会** 拷贝静态文件。 例如,您可以用它来定义一个 `getInitialProps()` 的静态方法 (next.js)。 +- 它 **不会** 拷贝静态文件。 For instance, it can be used to define a `getInitialProps()` static method (next.js). ### 参数 1. `styles`(* Function | Object *): 生成样式或样式对象的函数。 它将被链接到组件中。 若您需要访问主题,请使用函数签名(function signature)。 它是提供的第一个参数。 -2. `options` (_Object_ [optional]): +2. `options` (_object_ [optional]): -- `options.defaultTheme`(*Object* [optional]):如果未通过主题提供者提供主题,则使用默认主题。 -- `options.withTheme` (*Boolean* [optional]): 默认值为 `false`。 将 `theme` 对象作为属性提供给组件。 -- `options.name` (*String* [optional]): 样式表的名称。 适合调试。 如果未提供该值,它将尝试回退到组件的名称。 -- `options.flip` (*Boolean* [optional]):当设置为 `false` 时, 此工作表将选择退出 `rtl` 转换。 如果设置为 `true`时,则会反转样式。 当设置为 `null`,它依据 `theme.direction` 而定。 +- `options.defaultTheme`(*object* [optional]):如果未通过主题提供者提供主题,则使用默认主题。 +- `options.withTheme` (_bool_ [optional]): Defaults to `false`. 将 `theme` 对象作为属性提供给组件。 +- `options.name` (*string* [optional]): 样式表的名称。 适合调试。 如果未提供该值,它将尝试回退到组件的名称。 +- `options.flip` (_bool_ [optional]): When set to `false`, this sheet will opt-out the `rtl` transformation. 如果设置为 `true`时,则会反转样式。 当设置为 `null`,它依据 `theme.direction` 而定。 - 其他的键将会作为 options 参数传递给 [jss.createStyleSheet([styles], [options])](https://cssinjs.org/jss-api/#create-style-sheet)。 ### 返回结果 @@ -297,7 +302,7 @@ export default function MyComponent() { ```jsx import * as React from 'react'; -import { withStyles } from '@material-ui/core/styles'; +import { withStyles } from '@material-ui/styles'; const styles = { root: { @@ -316,7 +321,7 @@ export default withStyles(styles)(MyComponent); ```jsx import * as React from 'react'; -import { withStyles } from '@material-ui/core/styles'; +import { withStyles } from '@material-ui/styles'; const styles = { root: { diff --git a/docs/src/pages/styles/basics/basics-de.md b/docs/src/pages/styles/basics/basics-de.md index efcc6e78c6501d..56de43f658265c 100644 --- a/docs/src/pages/styles/basics/basics-de.md +++ b/docs/src/pages/styles/basics/basics-de.md @@ -41,7 +41,7 @@ Es gibt 3 mögliche APIs, die Sie verwenden können, um Stile zu generieren und ```jsx import * as React from 'react'; -import { makeStyles } from '@material-ui/core/styles'; +import { makeStyles } from '@material-ui/styles'; import Button from '@material-ui/core/Button'; const useStyles = makeStyles({ @@ -70,7 +70,7 @@ Hinweis: Dies gilt nur für aufrufende Syntax-Stil-Definitionen, die noch ein JS ```jsx import * as React from 'react'; -import { styled } from '@material-ui/core/styles'; +import { styled } from '@material-ui/styles'; import Button from '@material-ui/core/Button'; const MyButton = styled(Button)({ @@ -95,7 +95,7 @@ export default function StyledComponents() { ```jsx import * as React from 'react'; import PropTypes from 'prop-types'; -import { withStyles } from '@material-ui/core/styles'; +import { withStyles } from '@material-ui/styles'; import Button from '@material-ui/core/Button'; const styles = { @@ -199,20 +199,24 @@ const useStyles = makeStyles(theme => ({ {{"demo": "pages/styles/basics/StressTest.js"}} -## @material-ui/core/styles vs @material-ui/styles - -Material-UI's styles are powered by the [@material-ui/styles](https://www.npmjs.com/package/@material-ui/styles) package, (built with JSS). This solution is [isolated](https://bundlephobia.com/result?p=@material-ui/styles). Es hat kein Standard-Theme und kann verwendet werden, um React-Anwendungen zu entwerfen, die keine Material-UI-Komponenten verwenden. +## Using the theme context -Um die Anzahl der zu installierenden Pakete zu reduzieren und um die Importe zu vereinfachen, werden `@material-ui/styles` Module von `@material-ui/core/styles` erneut exportiert. +Starting from v5, Material-UI no longer uses JSS as its default styling solution. If you still want to use the utilities exported by `@material-ui/styles`, you will need to provide the `theme` as part of the context. For this, you can use the `ThemeProvider` component available in `@material-ui/styles`, or, if you are already using `@material-ui/core`, you should use the one exported from `@material-ui/core/styles` so that the same `theme` is available for components from '@material-ui/core'. -Um die Notwendigkeit einer systematischen Bereitstellung eines Themes zu entfernen, wird das Standard-Material-UI-Theme auf die neu exportierten `makeStyles`, `styled`, `withTheme`, `useTheme`, und `withStyles` Module angewendet. +```jsx +import { makeStyles } from '@material-ui/styles'; +import { createTheme, ThemeProvider } from '@material-ui/core/styles'; -Zum Beispiel: +const theme = createMuiTheme(); -```js -// Re-export with a default theme -import { makeStyles } from '@material-ui/core/styles'; +const useStyles = makeStyles((theme) => ({ + root: { + color: theme.palette.primary.main, + } +})); -// Original module with no default theme -import { makeStyles } from '@material-ui/styles'; +const App = (props) => { + const classes = useStyles(); + return
    ; +} ``` diff --git a/docs/src/pages/styles/basics/basics-es.md b/docs/src/pages/styles/basics/basics-es.md index 551749a535f94c..94acc982781090 100644 --- a/docs/src/pages/styles/basics/basics-es.md +++ b/docs/src/pages/styles/basics/basics-es.md @@ -41,7 +41,7 @@ There are 3 possible APIs you can use to generate and apply styles, however they ```jsx import * as React from 'react'; -import { makeStyles } from '@material-ui/core/styles'; +import { makeStyles } from '@material-ui/styles'; import Button from '@material-ui/core/Button'; const useStyles = makeStyles({ @@ -70,7 +70,7 @@ Note: this only applies to the calling syntax – style definitions still use a ```jsx import * as React from 'react'; -import { styled } from '@material-ui/core/styles'; +import { styled } from '@material-ui/styles'; import Button from '@material-ui/core/Button'; const MyButton = styled(Button)({ @@ -95,7 +95,7 @@ export default function StyledComponents() { ```jsx import * as React from 'react'; import PropTypes from 'prop-types'; -import { withStyles } from '@material-ui/core/styles'; +import { withStyles } from '@material-ui/styles'; import Button from '@material-ui/core/Button'; const styles = { @@ -199,20 +199,24 @@ const useStyles = makeStyles(theme => ({ {{"demo": "pages/styles/basics/StressTest.js"}} -## @material-ui/core/styles vs @material-ui/styles - -Material-UI's styles are powered by the [@material-ui/styles](https://www.npmjs.com/package/@material-ui/styles) package, (built with JSS). This solution is [isolated](https://bundlephobia.com/result?p=@material-ui/styles). It doesn't have a default theme, and can be used to style React applications that are not using Material-UI components. +## Using the theme context -To reduce the number of packages to install when using Material-UI, and to simplify the imports, `@material-ui/styles` modules are re-exported from `@material-ui/core/styles`. +Starting from v5, Material-UI no longer uses JSS as its default styling solution. If you still want to use the utilities exported by `@material-ui/styles`, you will need to provide the `theme` as part of the context. For this, you can use the `ThemeProvider` component available in `@material-ui/styles`, or, if you are already using `@material-ui/core`, you should use the one exported from `@material-ui/core/styles` so that the same `theme` is available for components from '@material-ui/core'. -To remove the need to systematically supply a theme, the default Material-UI theme is applied to the re-exported `makeStyles`, `styled`, `withTheme`, `useTheme`, and `withStyles` modules. +```jsx +import { makeStyles } from '@material-ui/styles'; +import { createTheme, ThemeProvider } from '@material-ui/core/styles'; -For example: +const theme = createMuiTheme(); -```js -// Re-export with a default theme -import { makeStyles } from '@material-ui/core/styles'; +const useStyles = makeStyles((theme) => ({ + root: { + color: theme.palette.primary.main, + } +})); -// Original module with no default theme -import { makeStyles } from '@material-ui/styles'; +const App = (props) => { + const classes = useStyles(); + return
    ; +} ``` diff --git a/docs/src/pages/styles/basics/basics-fr.md b/docs/src/pages/styles/basics/basics-fr.md index 915a41a213b1c5..aa090b8be9a1da 100644 --- a/docs/src/pages/styles/basics/basics-fr.md +++ b/docs/src/pages/styles/basics/basics-fr.md @@ -2,7 +2,7 @@

    You can use Material-UI's styling solution in your app, whether or not you are using Material-UI components.

    -Material-UI aims to provide a strong foundation for building dynamic UIs. Material-UI aims to provide a strong foundation for building dynamic UIs. You can use it, but you don't have to, since Material-UI is also [interoperable with](/guides/interoperability/) all the other major styling solutions. +Material-UI aims to provide a strong foundation for building dynamic UIs. To reduce the number of packages to install when using Material-UI, and to simplify the imports, `@material-ui/styles` modules are re-exported from `@material-ui/core/styles`. You can use it, but you don't have to, since Material-UI is also [interoperable with](/guides/interoperability/) all the other major styling solutions. ## Why use Material-UI's styling solution? @@ -201,15 +201,9 @@ const useStyles = makeStyles(theme => ({ ## @material-ui/core/styles vs @material-ui/styles -Material-UI's styles are powered by the [@material-ui/styles](https://www.npmjs.com/package/@material-ui/styles) package, (built with JSS). This solution is [isolated](https://bundlephobia.com/result?p=@material-ui/styles). It doesn't have a default theme, and can be used to style React applications that are not using Material-UI components. +Starting from v5, Material-UI no longer uses JSS as its default styling solution. To remove the need to systematically supply a theme, the default Material-UI theme is applied to the re-exported `makeStyles`, `styled`, `withTheme`, `useTheme`, and `withStyles` modules. For this, you can use the `ThemeProvider` component available in `@material-ui/styles`, or, if you are already using `@material-ui/core`, you should use the one exported from `@material-ui/core/styles` so that the same `theme` is available for components from '@material-ui/core'. -To reduce the number of packages to install when using Material-UI, and to simplify the imports, `@material-ui/styles` modules are re-exported from `@material-ui/core/styles`. - -To remove the need to systematically supply a theme, the default Material-UI theme is applied to the re-exported `makeStyles`, `styled`, `withTheme`, `useTheme`, and `withStyles` modules. - -For example: - -```js +```jsx // Re-export with a default theme import { makeStyles } from '@material-ui/core/styles'; diff --git a/docs/src/pages/styles/basics/basics-ja.md b/docs/src/pages/styles/basics/basics-ja.md index 59200beb64dc1d..6bd86f036078ee 100644 --- a/docs/src/pages/styles/basics/basics-ja.md +++ b/docs/src/pages/styles/basics/basics-ja.md @@ -41,7 +41,7 @@ yarn add @material-ui/styles ```jsx import * as React from 'react'; -import { makeStyles } from '@material-ui/core/styles'; +import { makeStyles } from '@material-ui/styles'; import Button from '@material-ui/core/Button'; const useStyles = makeStyles({ @@ -70,7 +70,7 @@ export default function Hook() { ```jsx import * as React from 'react'; -import { styled } from '@material-ui/core/styles'; +import { styled } from '@material-ui/styles'; import Button from '@material-ui/core/Button'; const MyButton = styled(Button)({ @@ -95,7 +95,7 @@ export default function StyledComponents() { ```jsx import * as React from 'react'; import PropTypes from 'prop-types'; -import { withStyles } from '@material-ui/core/styles'; +import { withStyles } from '@material-ui/styles'; import Button from '@material-ui/core/Button'; const styles = { @@ -199,20 +199,24 @@ const useStyles = makeStyles(theme => ({ {{"demo": "pages/styles/basics/StressTest.js"}} -## @material-ui/core/styles と @material-ui/styles - -Material-UI's styles are powered by the [@material-ui/styles](https://www.npmjs.com/package/@material-ui/styles) package, (built with JSS). This solution is [isolated](https://bundlephobia.com/result?p=@material-ui/styles). It doesn't have a default theme, and can be used to style React applications that are not using Material-UI components. +## Using the theme context -To reduce the number of packages to install when using Material-UI, and to simplify the imports, `@material-ui/styles` modules are re-exported from `@material-ui/core/styles`. +Starting from v5, Material-UI no longer uses JSS as its default styling solution. If you still want to use the utilities exported by `@material-ui/styles`, you will need to provide the `theme` as part of the context. For this, you can use the `ThemeProvider` component available in `@material-ui/styles`, or, if you are already using `@material-ui/core`, you should use the one exported from `@material-ui/core/styles` so that the same `theme` is available for components from '@material-ui/core'. -To remove the need to systematically supply a theme, the default Material-UI theme is applied to the re-exported `makeStyles`, `styled`, `withTheme`, `useTheme`, and `withStyles` modules. +```jsx +import { makeStyles } from '@material-ui/styles'; +import { createTheme, ThemeProvider } from '@material-ui/core/styles'; -For example: +const theme = createMuiTheme(); -```js -// Re-export with a default theme -import { makeStyles } from '@material-ui/core/styles'; +const useStyles = makeStyles((theme) => ({ + root: { + color: theme.palette.primary.main, + } +})); -// Original module with no default theme -import { makeStyles } from '@material-ui/styles'; +const App = (props) => { + const classes = useStyles(); + return
    ; +} ``` diff --git a/docs/src/pages/styles/basics/basics-pt.md b/docs/src/pages/styles/basics/basics-pt.md index f6c7dff7826ba5..cbe7ea0fe10248 100644 --- a/docs/src/pages/styles/basics/basics-pt.md +++ b/docs/src/pages/styles/basics/basics-pt.md @@ -41,7 +41,7 @@ Existem 3 APIs possíveis que você pode usar para gerar e aplicar estilos, no e ```jsx import * as React from 'react'; -import { makeStyles } from '@material-ui/core/styles'; +import { makeStyles } from '@material-ui/styles'; import Button from '@material-ui/core/Button'; const useStyles = makeStyles({ @@ -70,7 +70,7 @@ Nota: isso se aplica somente para a sintaxe de chamada – definições de estil ```jsx import * as React from 'react'; -import { styled } from '@material-ui/core/styles'; +import { styled } from '@material-ui/styles'; import Button from '@material-ui/core/Button'; const MyButton = styled(Button)({ @@ -95,7 +95,7 @@ export default function StyledComponents() { ```jsx import * as React from 'react'; import PropTypes from 'prop-types'; -import { withStyles } from '@material-ui/core/styles'; +import { withStyles } from '@material-ui/styles'; import Button from '@material-ui/core/Button'; const styles = { @@ -199,20 +199,24 @@ const useStyles = makeStyles((theme) => ({ {{"demo": "pages/styles/basics/StressTest.js"}} -## @material-ui/core/styles vs @material-ui/styles - -Os estilos do Material-UI são disponibilizados no pacote [@material-ui/styles](https://www.npmjs.com/package/@material-ui/styles) (construído com JSS). Esta solução está [isolada](https://bundlephobia.com/result?p=@material-ui/styles). Ela não tem um tema padrão e pode ser usada para estilizar aplicações React que não estão usando componentes Material-UI. +## Using the theme context -Para reduzir o número de pacotes a instalar, quando usando o Material-UI, e para simplificar as importações, os módulos de `@material-ui/styles` são reexportados em `@material-ui/core/styles`. +Starting from v5, Material-UI no longer uses JSS as its default styling solution. If you still want to use the utilities exported by `@material-ui/styles`, you will need to provide the `theme` as part of the context. For this, you can use the `ThemeProvider` component available in `@material-ui/styles`, or, if you are already using `@material-ui/core`, you should use the one exported from `@material-ui/core/styles` so that the same `theme` is available for components from '@material-ui/core'. -Para remover a necessidade de fornecer sistematicamente um tema, o tema padrão do Material-UI é aplicado aos módulos reexportados `makeStyles`, `styled`, `withTheme`, `useTheme`, e `withStyles`. +```jsx +import { makeStyles } from '@material-ui/styles'; +import { createTheme, ThemeProvider } from '@material-ui/core/styles'; -Por exemplo: +const theme = createMuiTheme(); -```js -// Reexportação com um tema padrão -import { makeStyles } from '@material-ui/core/styles'; +const useStyles = makeStyles((theme) => ({ + root: { + color: theme.palette.primary.main, + } +})); -// Módulo original sem um tema padrão -import { makeStyles } from '@material-ui/styles'; +const App = (props) => { + const classes = useStyles(); + return
    ; +} ``` diff --git a/docs/src/pages/styles/basics/basics-ru.md b/docs/src/pages/styles/basics/basics-ru.md index 118a3b64259349..03531f6e7cce3e 100644 --- a/docs/src/pages/styles/basics/basics-ru.md +++ b/docs/src/pages/styles/basics/basics-ru.md @@ -41,7 +41,7 @@ yarn add @material-ui/styles ```jsx import * as React from 'react'; -import { makeStyles } from '@material-ui/core/styles'; +import { makeStyles } from '@material-ui/styles'; import Button from '@material-ui/core/Button'; const useStyles = makeStyles({ @@ -70,7 +70,7 @@ export default function Hook() { ```jsx import * as React from 'react'; -import { styled } from '@material-ui/core/styles'; +import { styled } from '@material-ui/styles'; import Button from '@material-ui/core/Button'; const MyButton = styled(Button)({ @@ -95,7 +95,7 @@ export default function StyledComponents() { ```jsx import * as React from 'react'; import PropTypes from 'prop-types'; -import { withStyles } from '@material-ui/core/styles'; +import { withStyles } from '@material-ui/styles'; import Button from '@material-ui/core/Button'; const styles = { @@ -199,20 +199,24 @@ const useStyles = makeStyles(theme => ({ {{"demo": "pages/styles/basics/StressTest.js"}} -## Отличие @material-ui/core/styles от @material-ui/styles - -Material-UI's styles are powered by the [@material-ui/styles](https://www.npmjs.com/package/@material-ui/styles) package, (built with JSS). This solution is [isolated](https://bundlephobia.com/result?p=@material-ui/styles). Он не имеет темы по умолчанию и может использоваться для стилизации приложений React, которые не используют компоненты Material-UI. +## Using the theme context -Чтобы уменьшить количество пакетов, устанавливаемых при использовании Material-UI, и упростить импорт, модули `@material-ui/styles` реэкспортируются из `@material-ui/core/styles` , +Starting from v5, Material-UI no longer uses JSS as its default styling solution. If you still want to use the utilities exported by `@material-ui/styles`, you will need to provide the `theme` as part of the context. For this, you can use the `ThemeProvider` component available in `@material-ui/styles`, or, if you are already using `@material-ui/core`, you should use the one exported from `@material-ui/core/styles` so that the same `theme` is available for components from '@material-ui/core'. -Чтобы устранить необходимость постоянного подключения темы, к реэкспортированным модулям применяется дефолтная тема Material-UI. Это относится к модулям: `makeStyles`, `styled`, `withTheme`, `useTheme` и `withStyles` +```jsx +import { makeStyles } from '@material-ui/styles'; +import { createTheme, ThemeProvider } from '@material-ui/core/styles'; -For example: +const theme = createMuiTheme(); -```js -// Re-export with a default theme -import { makeStyles } from '@material-ui/core/styles'; +const useStyles = makeStyles((theme) => ({ + root: { + color: theme.palette.primary.main, + } +})); -// Original module with no default theme -import { makeStyles } from '@material-ui/styles'; +const App = (props) => { + const classes = useStyles(); + return
    ; +} ``` diff --git a/docs/src/pages/styles/basics/basics-zh.md b/docs/src/pages/styles/basics/basics-zh.md index 4dbe3144658090..e172c408613136 100644 --- a/docs/src/pages/styles/basics/basics-zh.md +++ b/docs/src/pages/styles/basics/basics-zh.md @@ -41,7 +41,7 @@ yarn add @material-ui/styles ```jsx import * as React from 'react'; -import { makeStyles } from '@material-ui/core/styles'; +import { makeStyles } from '@material-ui/styles'; import Button from '@material-ui/core/Button'; const useStyles = makeStyles({ @@ -70,7 +70,7 @@ export default function Hook() { ```jsx import * as React from 'react'; -import { styled } from '@material-ui/core/styles'; +import { styled } from '@material-ui/styles'; import Button from '@material-ui/core/Button'; const MyButton = styled(Button)({ @@ -95,7 +95,7 @@ export default function StyledComponents() { ```jsx import * as React from 'react'; import PropTypes from 'prop-types'; -import { withStyles } from '@material-ui/core/styles'; +import { withStyles } from '@material-ui/styles'; import Button from '@material-ui/core/Button'; const styles = { @@ -202,20 +202,24 @@ const useStyles = makeStyles((theme) => ({ {{"demo": "pages/styles/basics/StressTest.js"}} -## @material-ui/core/styles 与 @material-ui/styles - -Material-UI 的样式是由 [@material-ui/styles](https://www.npmjs.com/package/@material-ui/styles) 包加载的,(由 JSS 构建)。 这个解决方案是[独立](https://bundlephobia.com/result?p=@material-ui/styles)的。 它没有一个默认的主题,而对那些不使用 Material-UI 组件的 React 应用,你也可以用于设置它们的样式。 +## Using the theme context -为了减少在使用 Material-UI 时要安装的包的数量,并且简化导入的步骤,我们将 `@material-ui/styles` 模块从 `@material-ui/core/styles` 中重新导出。 +Starting from v5, Material-UI no longer uses JSS as its default styling solution. If you still want to use the utilities exported by `@material-ui/styles`, you will need to provide the `theme` as part of the context. For this, you can use the `ThemeProvider` component available in `@material-ui/styles`, or, if you are already using `@material-ui/core`, you should use the one exported from `@material-ui/core/styles` so that the same `theme` is available for components from '@material-ui/core'. -这样一来,无需系统性的提供一个主题,默认的 Material-UI 主题被应用到重新导出的 `makeStyles`,`styled`,`withTheme`,`useTheme`,和 `withStyles` 模块当中。 +```jsx +import { makeStyles } from '@material-ui/styles'; +import { createTheme, ThemeProvider } from '@material-ui/core/styles'; -例如: +const theme = createMuiTheme(); -```js -// 重新与默认的主题导出 -import { makeStyles } from '@material-ui/core/styles'; +const useStyles = makeStyles((theme) => ({ + root: { + color: theme.palette.primary.main, + } +})); -// 原有的不带主题的模块 -import { makeStyles } from '@material-ui/styles'; +const App = (props) => { + const classes = useStyles(); + return
    ; +} ``` diff --git a/docs/src/pages/system/advanced/advanced-de.md b/docs/src/pages/system/advanced/advanced-de.md index cb0b0ce0b03574..707c49b54544bb 100644 --- a/docs/src/pages/system/advanced/advanced-de.md +++ b/docs/src/pages/system/advanced/advanced-de.md @@ -4,12 +4,12 @@ ## Adding the `sx` prop to your custom components -The `unstable_styleFunctionSx` utility adds the support for the `sx` to your own components. Normally you would use the `Box` components from `@material-ui/core` at the root of your component tree. If you would like to use the system independently from Material-UI, this utility will give you the same capabilities, while having a smaller bundle size. +The `unstable_styleFunctionSx` utility adds the support for the [`sx` prop](/system/basics/#the-sx-prop) to your own components. Normally you would use the `Box` component from `@material-ui/core` at the root of your component tree. If you would like to use the system independently from Material-UI, the `unstable_styleFunctionSx` utility will give you the same capabilities, while having a smaller bundle size. {{"demo": "pages/system/advanced/StyleFunctionSxDemo.js"}} ## Using standalone system utilities -If you only need some elements of the system in your custom components, you can directly use and combine the different style functions available, and access them as component props. You might use this approach if you need smaller bundle size and better performance than using Box, for the price of using a subset of what the `sx` supports, and a different API. +If you only need some elements of the system in your custom components, you can directly use and combine the different style functions available, and access them as component props. You might use this approach if you need smaller bundle size and better performance than using Box, for the price of using a subset of what the [`sx` prop](/system/basics/#the-sx-prop) supports, and a different API. {{"demo": "pages/system/advanced/CombiningStyleFunctionsDemo.js", "defaultCodeOpen": true}} diff --git a/docs/src/pages/system/advanced/advanced-es.md b/docs/src/pages/system/advanced/advanced-es.md index 5f5aaa2a00fb78..0bdd2da5a26911 100644 --- a/docs/src/pages/system/advanced/advanced-es.md +++ b/docs/src/pages/system/advanced/advanced-es.md @@ -4,12 +4,12 @@ ## Adding the `sx` prop to your custom components -The `unstable_styleFunctionSx` utility adds the support for the `sx` to your own components. Normally you would use the `Box` components from `@material-ui/core` at the root of your component tree. If you would like to use the system independently from Material-UI, this utility will give you the same capabilities, while having a smaller bundle size. +The `unstable_styleFunctionSx` utility adds the support for the [`sx` prop](/system/basics/#the-sx-prop) to your own components. Normally you would use the `Box` component from `@material-ui/core` at the root of your component tree. If you would like to use the system independently from Material-UI, the `unstable_styleFunctionSx` utility will give you the same capabilities, while having a smaller bundle size. {{"demo": "pages/system/advanced/StyleFunctionSxDemo.js"}} ## Using standalone system utilities -If you only need some elements of the system in your custom components, you can directly use and combine the different style functions available, and access them as component props. You might use this approach if you need smaller bundle size and better performance than using Box, for the price of using a subset of what the `sx` supports, and a different API. +If you only need some elements of the system in your custom components, you can directly use and combine the different style functions available, and access them as component props. You might use this approach if you need smaller bundle size and better performance than using Box, for the price of using a subset of what the [`sx` prop](/system/basics/#the-sx-prop) supports, and a different API. {{"demo": "pages/system/advanced/CombiningStyleFunctionsDemo.js", "defaultCodeOpen": true}} diff --git a/docs/src/pages/system/advanced/advanced-ja.md b/docs/src/pages/system/advanced/advanced-ja.md index 4bca930cc7762e..c242a0a23e6900 100644 --- a/docs/src/pages/system/advanced/advanced-ja.md +++ b/docs/src/pages/system/advanced/advanced-ja.md @@ -4,12 +4,12 @@ ## Adding the `sx` prop to your custom components -The `unstable_styleFunctionSx` utility adds the support for the `sx` to your own components. Normally you would use the `Box` components from `@material-ui/core` at the root of your component tree. If you would like to use the system independently from Material-UI, this utility will give you the same capabilities, while having a smaller bundle size. +The `unstable_styleFunctionSx` utility adds the support for the [`sx` prop](/system/basics/#the-sx-prop) to your own components. Normally you would use the `Box` component from `@material-ui/core` at the root of your component tree. If you would like to use the system independently from Material-UI, the `unstable_styleFunctionSx` utility will give you the same capabilities, while having a smaller bundle size. {{"demo": "pages/system/advanced/StyleFunctionSxDemo.js"}} ## Using standalone system utilities -If you only need some elements of the system in your custom components, you can directly use and combine the different style functions available, and access them as component props. You might use this approach if you need smaller bundle size and better performance than using Box, for the price of using a subset of what the `sx` supports, and a different API. +If you only need some elements of the system in your custom components, you can directly use and combine the different style functions available, and access them as component props. You might use this approach if you need smaller bundle size and better performance than using Box, for the price of using a subset of what the [`sx` prop](/system/basics/#the-sx-prop) supports, and a different API. {{"demo": "pages/system/advanced/CombiningStyleFunctionsDemo.js", "defaultCodeOpen": true}} diff --git a/docs/src/pages/system/advanced/advanced-pt.md b/docs/src/pages/system/advanced/advanced-pt.md index 36bbe25513a8fd..d035a246e4b0f0 100644 --- a/docs/src/pages/system/advanced/advanced-pt.md +++ b/docs/src/pages/system/advanced/advanced-pt.md @@ -4,12 +4,12 @@ ## Adicionando a propriedade `sx` para seus componentes customizados -O utilitário `unstable_styleFunctionSx` adiciona suporte para a propriedade `sx` em seus componentes. Normalmente você usaria os componentes `Box` de `@material-ui/core` como raiz da árvore de componentes. Se você quiser usar o sistema sem depender do Material-UI, este utilitário lhe dará as mesmas capacidades, enquanto tem um tamanho menor de pacote. +The `unstable_styleFunctionSx` utility adds the support for the [`sx` prop](/system/basics/#the-sx-prop) to your own components. Normally you would use the `Box` component from `@material-ui/core` at the root of your component tree. If you would like to use the system independently from Material-UI, the `unstable_styleFunctionSx` utility will give you the same capabilities, while having a smaller bundle size. {{"demo": "pages/system/advanced/StyleFunctionSxDemo.js"}} ## Usando utilitários de sistema autônomo -Se você precisar apenas de alguns elementos do sistema em seus componentes customizados, você pode usar diretamente e combinar as diferentes funções de estilo disponíveis, e acessá-las como propriedades de componente. Você pode usar esta abordagem se você precisar de um tamanho menor de pacote e melhor desempenho do que o uso de Box, pelo preço de usar um suporte de subconjunto `sx` e uma API diferente. +Se você precisar apenas de alguns elementos do sistema em seus componentes customizados, você pode usar diretamente e combinar as diferentes funções de estilo disponíveis, e acessá-las como propriedades de componente. You might use this approach if you need smaller bundle size and better performance than using Box, for the price of using a subset of what the [`sx` prop](/system/basics/#the-sx-prop) supports, and a different API. {{"demo": "pages/system/advanced/CombiningStyleFunctionsDemo.js", "defaultCodeOpen": true}} diff --git a/docs/src/pages/system/advanced/advanced-ru.md b/docs/src/pages/system/advanced/advanced-ru.md index eb222196beb081..44392de9d67553 100644 --- a/docs/src/pages/system/advanced/advanced-ru.md +++ b/docs/src/pages/system/advanced/advanced-ru.md @@ -4,12 +4,12 @@ ## Adding the `sx` prop to your custom components -The `unstable_styleFunctionSx` utility adds the support for the `sx` to your own components. Normally you would use the `Box` components from `@material-ui/core` at the root of your component tree. If you would like to use the system independently from Material-UI, this utility will give you the same capabilities, while having a smaller bundle size. +The `unstable_styleFunctionSx` utility adds the support for the [`sx` prop](/system/basics/#the-sx-prop) to your own components. Normally you would use the `Box` component from `@material-ui/core` at the root of your component tree. If you would like to use the system independently from Material-UI, the `unstable_styleFunctionSx` utility will give you the same capabilities, while having a smaller bundle size. {{"demo": "pages/system/advanced/StyleFunctionSxDemo.js"}} ## Using standalone system utilities -If you only need some elements of the system in your custom components, you can directly use and combine the different style functions available, and access them as component props. You might use this approach if you need smaller bundle size and better performance than using Box, for the price of using a subset of what the `sx` supports, and a different API. +If you only need some elements of the system in your custom components, you can directly use and combine the different style functions available, and access them as component props. You might use this approach if you need smaller bundle size and better performance than using Box, for the price of using a subset of what the [`sx` prop](/system/basics/#the-sx-prop) supports, and a different API. {{"demo": "pages/system/advanced/CombiningStyleFunctionsDemo.js", "defaultCodeOpen": true}} diff --git a/docs/src/pages/system/advanced/advanced-zh.md b/docs/src/pages/system/advanced/advanced-zh.md index d97fb366f0c046..2acc30f97d503b 100644 --- a/docs/src/pages/system/advanced/advanced-zh.md +++ b/docs/src/pages/system/advanced/advanced-zh.md @@ -4,12 +4,12 @@ ## 将 `sx` 属性添加到你的自定义组件 -`unstable_styleFunctionSx` 工具集为你自定义的组件添加了 `sx` 的支持。 通常你会在组件树的根部使用 `@material-ui/core` 中的 `Box` 组件。 如果你想独立于 Material-UI 使用系统,这个工具集可以为你提供同样的功能,同时该捆绑包的尺寸会更小。 +The `unstable_styleFunctionSx` utility adds the support for the [`sx` prop](/system/basics/#the-sx-prop) to your own components. Normally you would use the `Box` component from `@material-ui/core` at the root of your component tree. If you would like to use the system independently from Material-UI, the `unstable_styleFunctionSx` utility will give you the same capabilities, while having a smaller bundle size. {{"demo": "pages/system/advanced/StyleFunctionSxDemo.js"}} ## 使用独立的系统工具集 -如果你在自定义组件中只需要系统中的一些元素,你可以直接使用和组合不同的风格功能,并将其作为组件属性访问。 如果你需要比使用 Box 更小的捆绑大小和更好的性能,那么可以使用这种方法,但代价是需要使用 `sx` 支持的子集和不同的 API。 +如果你在自定义组件中只需要系统中的一些元素,你可以直接使用和组合不同的风格功能,并将其作为组件属性访问。 You might use this approach if you need smaller bundle size and better performance than using Box, for the price of using a subset of what the [`sx` prop](/system/basics/#the-sx-prop) supports, and a different API. {{"demo": "pages/system/advanced/CombiningStyleFunctionsDemo.js", "defaultCodeOpen": true}} diff --git a/docs/src/pages/system/basics/basics-de.md b/docs/src/pages/system/basics/basics-de.md index c69af926e53fa0..5f670aed509015 100644 --- a/docs/src/pages/system/basics/basics-de.md +++ b/docs/src/pages/system/basics/basics-de.md @@ -1,6 +1,6 @@ # Material-UI System -

    CSS utilities for rapidly creating custom design.

    +

    CSS utilities for rapidly laying out custom designs.

    Material-UI comes with dozens of **ready-to-use** components in the core. These components are an incredible starting point but when it comes to making your site stand out with a custom design, it can be simpler to start from an unstyled state. Introducing the system: @@ -14,14 +14,28 @@ _(Resize the window to see the responsive breakpoints)_ ## Installation + + ```jsx -// usando npm -npm install @material-ui/system +// with npm +npm install @material-ui/system@next @emotion/react @emotion/styled + +// with yarn +yarn add @material-ui/system@next @emotion/react @emotion/styled +``` -// usando yarn -yarn add @material-ui/system +Or if you want to use `styled-components` as a styling engine: + +```sh +// with npm +npm install @material-ui/system@next @material-ui/styled-engine-sc@next styled-components + +// with yarn +yarn add @material-ui/system@next @material-ui/styled-engine-sc@next styled-components ``` +Take a look at the [Styled Engine guide](/guides/styled-engine/) for more information about how to configure `styled-components` as the style engine. + ## Why use the system? Compare how the same stat component can be built with two different APIs. @@ -123,7 +137,7 @@ return ( 18.77% - vs last week + vs. last week ``` @@ -183,9 +197,9 @@ Cons: ### API tradeoff -In previous versions, the system properties were supported as props on the `Box` component. From v5, however, the system provides a superset of CSS (supports all CSS properties/selectors in addition to custom ones), and is available in all components, so selectors cannot be efficiently mapped to props without potential naming conflicts. Instead, all system properties are available under one prop `sx`. +Having the system under one prop (`sx`) helps to differentiate props defined for the sole purpose of CSS utilities, vs. those for component business logic. It's important for the **separation of concerns**. For instance, a `color` prop on a button impacts multiple states (hover, focus, etc.), not to be confused with the color CSS property. -Additionally, having the system under one prop helps to easily differentiate props defined for the sole purpose of CSS utilities, vs. those for component business logic. +Only the `Box`, `Stack`, `Typography`, and `Grid` components accept the system properties as _props_ for the above reason. These components are designed to solve CSS problems, they are CSS component utilities. ## Nutzung @@ -204,7 +218,7 @@ There are lots of shorthands available for the CSS properties. These are documen color: 'primary.main', // theme.palette.primary.main m: 1, // margin: theme.spacing(1) p: { - xs: 1, // [theme.breakpoints.up('xs')]: : { padding: theme.spacing(1) } + xs: 1, // [theme.breakpoints.up('xs')]: { padding: theme.spacing(1) } }, zIndex: 'tooltip', // theme.zIndex.tooltip }} @@ -215,7 +229,7 @@ These shorthands are **optional**, they are great to save time when writing styl ### Superset of CSS -As part of the prop, you can use any regular CSS too: child or pseudo-selectors, media queries, raw CSS values, etc. Here are a few examples: Here are a few examples: +As part of the prop, you can use any regular CSS too: child or pseudo-selectors, media queries, raw CSS values, etc. Here are a few examples: Here are a few examples: Here are a few examples: - Using pseudo selectors: @@ -262,7 +276,7 @@ If you would like to have responsive values for a CSS property, you can use the #### 1. Breakpoints as an object -The first option for defining breakpoints is to define them as an object, using the breakpoints as keys. Here is the previous example again, using the object syntax. +The first option for defining breakpoints is to define them as an object, using the breakpoints as keys. Note that each breakpoint property matches the breakpoint and every larger breakpoint. For example, `width: { lg: 100 }` is equivalent to `theme.breakpoints.up('lg')`. Here is the previous example again, using the object syntax. {{"demo": "pages/system/basics/BreakpointsAsObject.js"}} @@ -292,6 +306,7 @@ import { createTheme, ThemeProvider } from '@material-ui/core/styles'; const theme = createTheme({ breakpoints: { values: { + mobile: 0, tablet: 640, laptop: 1024, desktop: 1280, @@ -305,9 +320,8 @@ export default function CustomBreakpoints() { diff --git a/docs/src/pages/system/basics/basics-es.md b/docs/src/pages/system/basics/basics-es.md index cbc12f2c2f471c..57705e9b805e30 100644 --- a/docs/src/pages/system/basics/basics-es.md +++ b/docs/src/pages/system/basics/basics-es.md @@ -1,6 +1,6 @@ # Material-UI System -

    CSS utilities for rapidly creating custom design.

    +

    CSS utilities for rapidly laying out custom designs.

    Material-UI comes with dozens of **ready-to-use** components in the core. These components are an incredible starting point but when it comes to making your site stand out with a custom design, it can be simpler to start from an unstyled state. Introducing the system: @@ -14,14 +14,28 @@ _(Resize the window to see the responsive breakpoints)_ ## Instalación + + ```jsx -// usando npm -npm install @material-ui/system +// with npm +npm install @material-ui/system@next @emotion/react @emotion/styled + +// with yarn +yarn add @material-ui/system@next @emotion/react @emotion/styled +``` -// usando yarn -yarn add @material-ui/system +Or if you want to use `styled-components` as a styling engine: + +```sh +// with npm +npm install @material-ui/system@next @material-ui/styled-engine-sc@next styled-components + +// with yarn +yarn add @material-ui/system@next @material-ui/styled-engine-sc@next styled-components ``` +Take a look at the [Styled Engine guide](/guides/styled-engine/) for more information about how to configure `styled-components` as the style engine. + ## Why use the system? Compare how the same stat component can be built with two different APIs. @@ -123,7 +137,7 @@ return ( 18.77%
    - vs last week + vs. last week ``` @@ -183,9 +197,9 @@ Cons: ### API tradeoff -In previous versions, the system properties were supported as props on the `Box` component. From v5, however, the system provides a superset of CSS (supports all CSS properties/selectors in addition to custom ones), and is available in all components, so selectors cannot be efficiently mapped to props without potential naming conflicts. Instead, all system properties are available under one prop `sx`. +Having the system under one prop (`sx`) helps to differentiate props defined for the sole purpose of CSS utilities, vs. those for component business logic. It's important for the **separation of concerns**. For instance, a `color` prop on a button impacts multiple states (hover, focus, etc.), not to be confused with the color CSS property. -Additionally, having the system under one prop helps to easily differentiate props defined for the sole purpose of CSS utilities, vs. those for component business logic. +Only the `Box`, `Stack`, `Typography`, and `Grid` components accept the system properties as _props_ for the above reason. These components are designed to solve CSS problems, they are CSS component utilities. ## Implementación @@ -204,7 +218,7 @@ There are lots of shorthands available for the CSS properties. These are documen color: 'primary.main', // theme.palette.primary.main m: 1, // margin: theme.spacing(1) p: { - xs: 1, // [theme.breakpoints.up('xs')]: : { padding: theme.spacing(1) } + xs: 1, // [theme.breakpoints.up('xs')]: { padding: theme.spacing(1) } }, zIndex: 'tooltip', // theme.zIndex.tooltip }} @@ -262,7 +276,7 @@ If you would like to have responsive values for a CSS property, you can use the #### 1. Breakpoints as an object -The first option for defining breakpoints is to define them as an object, using the breakpoints as keys. Here is the previous example again, using the object syntax. +The first option for defining breakpoints is to define them as an object, using the breakpoints as keys. Note that each breakpoint property matches the breakpoint and every larger breakpoint. For example, `width: { lg: 100 }` is equivalent to `theme.breakpoints.up('lg')`. Here is the previous example again, using the object syntax. {{"demo": "pages/system/basics/BreakpointsAsObject.js"}} @@ -292,6 +306,7 @@ import { createTheme, ThemeProvider } from '@material-ui/core/styles'; const theme = createTheme({ breakpoints: { values: { + mobile: 0, tablet: 640, laptop: 1024, desktop: 1280, @@ -305,9 +320,8 @@ export default function CustomBreakpoints() { diff --git a/docs/src/pages/system/basics/basics-fr.md b/docs/src/pages/system/basics/basics-fr.md index 2b420763f18278..33e7949675f3ed 100644 --- a/docs/src/pages/system/basics/basics-fr.md +++ b/docs/src/pages/system/basics/basics-fr.md @@ -14,6 +14,8 @@ _(Resize the window to see the responsive breakpoints)_ ## Installation + + ```jsx // usando npm npm install @material-ui/system @@ -22,6 +24,18 @@ npm install @material-ui/system yarn add @material-ui/system ``` +Or if you want to use `styled-components` as a styling engine: + +```sh +// with npm +npm install @material-ui/system@next @material-ui/styled-engine-sc@next styled-components + +// with yarn +yarn add @material-ui/system@next @material-ui/styled-engine-sc@next styled-components +``` + +Take a look at the [Styled Engine guide](/guides/styled-engine/) for more information about how to configure `styled-components` as the style engine. + ## Why use the system? Compare how the same stat component can be built with two different APIs. @@ -97,35 +111,15 @@ return ( ```jsx - Sessions - - 98.3 K - - - - 18.77% - - - vs last week - - ``` ### Problem solved @@ -183,9 +177,9 @@ Cons: ### API tradeoff -In previous versions, the system properties were supported as props on the `Box` component. From v5, however, the system provides a superset of CSS (supports all CSS properties/selectors in addition to custom ones), and is available in all components, so selectors cannot be efficiently mapped to props without potential naming conflicts. Instead, all system properties are available under one prop `sx`. +Additionally, having the system under one prop helps to easily differentiate props defined for the sole purpose of CSS utilities, vs. those for component business logic. It's important for the **separation of concerns**. For instance, a `color` prop on a button impacts multiple states (hover, focus, etc.), not to be confused with the color CSS property. -Additionally, having the system under one prop helps to easily differentiate props defined for the sole purpose of CSS utilities, vs. those for component business logic. +Only the `Box`, `Stack`, `Typography`, and `Grid` components accept the system properties as _props_ for the above reason. These components are designed to solve CSS problems, they are CSS component utilities. ## Utilisation @@ -200,15 +194,35 @@ There are lots of shorthands available for the CSS properties. These are documen ```jsx + Sessions + + 98.3 K + + + + 18.77% + + + vs last week + + ``` These shorthands are **optional**, they are great to save time when writing styles but it can be overwhelming to learn new custom APIs. You might want to skip this part and bet on CSS, it has been standardized for decades, head to the [next section](#superset-of-css). @@ -262,7 +276,7 @@ If you would like to have responsive values for a CSS property, you can use the #### 1. Breakpoints as an object -The first option for defining breakpoints is to define them as an object, using the breakpoints as keys. Here is the previous example again, using the object syntax. +The first option for defining breakpoints is to define them as an object, using the breakpoints as keys. Note that each breakpoint property matches the breakpoint and every larger breakpoint. For example, `width: { lg: 100 }` is equivalent to `theme.breakpoints.up('lg')`. Here is the previous example again, using the object syntax. {{"demo": "pages/system/basics/BreakpointsAsObject.js"}} @@ -285,6 +299,23 @@ You can skip breakpoints with the `null` value: You can also specify your own custom breakpoints, and use them as keys when defining the breakpoints object. Here is an example of how to do that. ```jsx +declare module "@material-ui/core/styles/createBreakpoints" { + interface BreakpointOverrides { + xs: false; // removes the `xs` breakpoint + sm: false; + md: false; + lg: false; + xl: false; + tablet: true; // adds the `tablet` breakpoint + laptop: true; + desktop: true; + } +} +``` + +If you are using TypeScript, you will also need to use [module augmentation](/guides/typescript/#customization-of-theme) for the theme to accept the above values. + +```ts import * as React from 'react'; import Box from '@material-ui/core/Box'; import { createTheme, ThemeProvider } from '@material-ui/core/styles'; @@ -318,30 +349,13 @@ export default function CustomBreakpoints() { } ``` -If you are using TypeScript, you will also need to use [module augmentation](/guides/typescript/#customization-of-theme) for the theme to accept the above values. - -```ts -declare module "@material-ui/core/styles/createBreakpoints" { - interface BreakpointOverrides { - xs: false; // removes the `xs` breakpoint - sm: false; - md: false; - lg: false; - xl: false; - tablet: true; // adds the `tablet` breakpoint - laptop: true; - desktop: true; - } -} -``` - ### Theme getter If you wish to use the theme for a CSS property that is not supported natively by the system, you can use a function as the value, in which you can access the theme object. {{"demo": "pages/system/basics/ValueAsFunction.js"}} -## Implementations +## Implémentations The `sx` prop can be used in four different locations: diff --git a/docs/src/pages/system/basics/basics-ja.md b/docs/src/pages/system/basics/basics-ja.md index 3d1ba7bcd35ca1..a77d205d5154ee 100644 --- a/docs/src/pages/system/basics/basics-ja.md +++ b/docs/src/pages/system/basics/basics-ja.md @@ -1,8 +1,8 @@ # Material-UI System -

    CSS utilities for rapidly creating custom design.

    +

    CSS utilities for rapidly laying out custom designs.

    -Material-UI comes with dozens of **ready-to-use** components in the core. These components are an incredible starting point but when it comes to making your site stand out with a custom design, it can be simpler to start from an unstyled state. Introducing the system: +Material-UIには、コアに数十の **今すぐ使用できる** コンポーネントが付属しています。 These components are an incredible starting point but when it comes to making your site stand out with a custom design, it can be simpler to start from an unstyled state. Introducing the system: The **system** lets you quickly build custom UI components leveraging the values defined in your theme. @@ -14,14 +14,28 @@ _(Resize the window to see the responsive breakpoints)_ ## インストール + + ```jsx -// usando npm -npm install @material-ui/system +// with npm +npm install @material-ui/system@next @emotion/react @emotion/styled + +// with yarn +yarn add @material-ui/system@next @emotion/react @emotion/styled +``` -// usando yarn -yarn add @material-ui/system +Or if you want to use `styled-components` as a styling engine: + +```sh +// with npm +npm install @material-ui/system@next @material-ui/styled-engine-sc@next styled-components + +// with yarn +yarn add @material-ui/system@next @material-ui/styled-engine-sc@next styled-components ``` +Take a look at the [Styled Engine guide](/guides/styled-engine/) for more information about how to configure `styled-components` as the style engine. + ## Why use the system? Compare how the same stat component can be built with two different APIs. @@ -123,7 +137,7 @@ return ( 18.77%
    - vs last week + vs. last week
    ``` @@ -183,9 +197,9 @@ Cons: ### API tradeoff -In previous versions, the system properties were supported as props on the `Box` component. From v5, however, the system provides a superset of CSS (supports all CSS properties/selectors in addition to custom ones), and is available in all components, so selectors cannot be efficiently mapped to props without potential naming conflicts. Instead, all system properties are available under one prop `sx`. +Having the system under one prop (`sx`) helps to differentiate props defined for the sole purpose of CSS utilities, vs. those for component business logic. It's important for the **separation of concerns**. For instance, a `color` prop on a button impacts multiple states (hover, focus, etc.), not to be confused with the color CSS property. -Additionally, having the system under one prop helps to easily differentiate props defined for the sole purpose of CSS utilities, vs. those for component business logic. +Only the `Box`, `Stack`, `Typography`, and `Grid` components accept the system properties as _props_ for the above reason. These components are designed to solve CSS problems, they are CSS component utilities. ## 使い方 @@ -204,7 +218,7 @@ There are lots of shorthands available for the CSS properties. These are documen color: 'primary.main', // theme.palette.primary.main m: 1, // margin: theme.spacing(1) p: { - xs: 1, // [theme.breakpoints.up('xs')]: : { padding: theme.spacing(1) } + xs: 1, // [theme.breakpoints.up('xs')]: { padding: theme.spacing(1) } }, zIndex: 'tooltip', // theme.zIndex.tooltip }} @@ -262,7 +276,7 @@ If you would like to have responsive values for a CSS property, you can use the #### 1. Breakpoints as an object -The first option for defining breakpoints is to define them as an object, using the breakpoints as keys. Here is the previous example again, using the object syntax. +The first option for defining breakpoints is to define them as an object, using the breakpoints as keys. Note that each breakpoint property matches the breakpoint and every larger breakpoint. For example, `width: { lg: 100 }` is equivalent to `theme.breakpoints.up('lg')`. Here is the previous example again, using the object syntax. {{"demo": "pages/system/basics/BreakpointsAsObject.js"}} @@ -292,6 +306,7 @@ import { createTheme, ThemeProvider } from '@material-ui/core/styles'; const theme = createTheme({ breakpoints: { values: { + mobile: 0, tablet: 640, laptop: 1024, desktop: 1280, @@ -305,9 +320,8 @@ export default function CustomBreakpoints() { diff --git a/docs/src/pages/system/basics/basics-pt.md b/docs/src/pages/system/basics/basics-pt.md index 86e2903b29aaaf..b1ba1ea7530717 100644 --- a/docs/src/pages/system/basics/basics-pt.md +++ b/docs/src/pages/system/basics/basics-pt.md @@ -1,6 +1,6 @@ # Sistema Material-UI -

    Utilitários CSS para criar rapidamente um design customizado.

    +

    CSS utilities for rapidly laying out custom designs.

    Material-UI comes with dozens of **ready-to-use** components in the core. Esses componentes são um ponto de partida incrível, mas quando se trata de fazer seu site se destacar com um design customizado, pode ser mais simples começar de um estado sem estilos. Apresentando o sistema: @@ -14,14 +14,28 @@ _(Redimensione a janela para ver os pontos de quebra responsivos)_ ## Instalação + + ```jsx -// utilizando o npm -npm install @material-ui/system +// with npm +npm install @material-ui/system@next @emotion/react @emotion/styled + +// with yarn +yarn add @material-ui/system@next @emotion/react @emotion/styled +``` -// utilizando o yarn -yarn add @material-ui/system +Or if you want to use `styled-components` as a styling engine: + +```sh +// with npm +npm install @material-ui/system@next @material-ui/styled-engine-sc@next styled-components + +// with yarn +yarn add @material-ui/system@next @material-ui/styled-engine-sc@next styled-components ``` +Take a look at the [Styled Engine guide](/guides/styled-engine/) for more information about how to configure `styled-components` as the style engine. + ## Por que usar o sistema? Compare como o mesmo componente de estatística pode ser construído com duas APIs diferentes. @@ -123,7 +137,7 @@ return ( 18.77%
    - vs last week + vs. last week
    ``` @@ -175,7 +189,7 @@ Contras: | a. Renderizar 1.000 Box | `
    ` | 100ms | | b. Renderizar 1.000 componentes | `
    ` | 120ms | | c. Renderizar 1,000 styled components | `` | 160ms | - | d. Renderizar 1.000 Box | `` | 370ms | + | d. a. Renderizar 1.000 Box | `` | 370ms | _Vá até a [pasta de benchmark](https://github.com/mui-org/material-ui/tree/next/benchmark/browser) para uma reprodução dessas métricas._ @@ -183,9 +197,9 @@ Contras: ### API tradeoff -In previous versions, the system properties were supported as props on the `Box` component. From v5, however, the system provides a superset of CSS (supports all CSS properties/selectors in addition to custom ones), and is available in all components, so selectors cannot be efficiently mapped to props without potential naming conflicts. Instead, all system properties are available under one prop `sx`. +Having the system under one prop (`sx`) helps to differentiate props defined for the sole purpose of CSS utilities, vs. those for component business logic. It's important for the **separation of concerns**. For instance, a `color` prop on a button impacts multiple states (hover, focus, etc.), not to be confused with the color CSS property. -Additionally, having the system under one prop helps to easily differentiate props defined for the sole purpose of CSS utilities, vs. those for component business logic. +Only the `Box`, `Stack`, `Typography`, and `Grid` components accept the system properties as _props_ for the above reason. These components are designed to solve CSS problems, they are CSS component utilities. ## Uso @@ -204,7 +218,7 @@ Existem muitas abreviações disponíveis para as propriedades do CSS. Estas sã color: 'primary.main', // theme.palette.primary.main m: 1, // margin: theme.spacing(1) p: { - xs: 1, // [theme.breakpoints.up('xs')]: : { padding: theme.spacing(1) } + xs: 1, // [theme.breakpoints.up('xs')]: { padding: theme.spacing(1) } }, zIndex: 'tooltip', // theme.zIndex.tooltip }} @@ -215,7 +229,7 @@ Estas abreviações são **opcionais**, elas são ótimas para economizar tempo ### Super conjunto de CSS -Como parte da propriedade, você pode usar qualquer CSS normalmente: seletores filhos ou pseudo seletores, consultas de mídia, valores CSS brutos, etc. Aqui esta alguns exemplos: Aqui esta alguns exemplos: +Como parte da propriedade, você pode usar qualquer CSS normalmente: seletores filhos ou pseudo seletores, consultas de mídia, valores CSS brutos, etc. Aqui esta alguns exemplos: - Usando pseudo seletores: @@ -262,7 +276,7 @@ Se você quiser ter valores responsivos para uma propriedade CSS, você pode usa #### 1. Pontos de quebra como um objeto -A primeira opção para definir pontos de quebra é defini-los como um objeto, usando os pontos de quebra como chaves. Aqui está o exemplo anterior novamente, usando a sintaxe do objeto. +A primeira opção para definir pontos de quebra é defini-los como um objeto, usando os pontos de quebra como chaves. Note that each breakpoint property matches the breakpoint and every larger breakpoint. For example, `width: { lg: 100 }` is equivalent to `theme.breakpoints.up('lg')`. Aqui está o exemplo anterior novamente, usando a sintaxe do objeto. {{"demo": "pages/system/basics/BreakpointsAsObject.js"}} @@ -292,6 +306,7 @@ import { createTheme, ThemeProvider } from '@material-ui/core/styles'; const theme = createTheme({ breakpoints: { values: { + mobile: 0, tablet: 640, laptop: 1024, desktop: 1280, @@ -305,13 +320,12 @@ export default function CustomBreakpoints() { - Este box tem uma largura responsiva + This box has a responsive width ); @@ -355,7 +369,7 @@ Todos os componentes Material-UI do core suportarão a propriedade `sx`. ### 3. Componentes customizados -Além dos componentes de Material-UI, você também pode adicionar a propriedade `sx` para seus componentes customizados, usando o utilitário `styled` de `@material-ui/core/styles`. +In addition to Material-UI components, you can add the `sx` prop to your custom components too, by using the `styled` utility from `@material-ui/core/styles`. ```jsx import { styled } from '@material-ui/core/styles'; diff --git a/docs/src/pages/system/basics/basics-ru.md b/docs/src/pages/system/basics/basics-ru.md index 509c89cece4939..d48199eaa2c12a 100644 --- a/docs/src/pages/system/basics/basics-ru.md +++ b/docs/src/pages/system/basics/basics-ru.md @@ -1,6 +1,6 @@ # Material-UI System -

    CSS utilities for rapidly creating custom design.

    +

    CSS utilities for rapidly laying out custom designs.

    Material-UI comes with dozens of **ready-to-use** components in the core. These components are an incredible starting point but when it comes to making your site stand out with a custom design, it can be simpler to start from an unstyled state. Introducing the system: @@ -14,14 +14,28 @@ _(Resize the window to see the responsive breakpoints)_ ## Инструкция по установке + + ```jsx -// usando npm -npm install @material-ui/system +// with npm +npm install @material-ui/system@next @emotion/react @emotion/styled + +// with yarn +yarn add @material-ui/system@next @emotion/react @emotion/styled +``` -// usando yarn -yarn add @material-ui/system +Or if you want to use `styled-components` as a styling engine: + +```sh +// with npm +npm install @material-ui/system@next @material-ui/styled-engine-sc@next styled-components + +// with yarn +yarn add @material-ui/system@next @material-ui/styled-engine-sc@next styled-components ``` +Take a look at the [Styled Engine guide](/guides/styled-engine/) for more information about how to configure `styled-components` as the style engine. + ## Why use the system? Compare how the same stat component can be built with two different APIs. @@ -123,7 +137,7 @@ return ( 18.77%
    - vs last week + vs. last week
    ``` @@ -183,9 +197,9 @@ Cons: ### API tradeoff -In previous versions, the system properties were supported as props on the `Box` component. From v5, however, the system provides a superset of CSS (supports all CSS properties/selectors in addition to custom ones), and is available in all components, so selectors cannot be efficiently mapped to props without potential naming conflicts. Instead, all system properties are available under one prop `sx`. +Having the system under one prop (`sx`) helps to differentiate props defined for the sole purpose of CSS utilities, vs. those for component business logic. It's important for the **separation of concerns**. For instance, a `color` prop on a button impacts multiple states (hover, focus, etc.), not to be confused with the color CSS property. -Additionally, having the system under one prop helps to easily differentiate props defined for the sole purpose of CSS utilities, vs. those for component business logic. +Only the `Box`, `Stack`, `Typography`, and `Grid` components accept the system properties as _props_ for the above reason. These components are designed to solve CSS problems, they are CSS component utilities. ## Использование @@ -204,7 +218,7 @@ There are lots of shorthands available for the CSS properties. These are documen color: 'primary.main', // theme.palette.primary.main m: 1, // margin: theme.spacing(1) p: { - xs: 1, // [theme.breakpoints.up('xs')]: : { padding: theme.spacing(1) } + xs: 1, // [theme.breakpoints.up('xs')]: { padding: theme.spacing(1) } }, zIndex: 'tooltip', // theme.zIndex.tooltip }} @@ -262,7 +276,7 @@ If you would like to have responsive values for a CSS property, you can use the #### 1. Breakpoints as an object -The first option for defining breakpoints is to define them as an object, using the breakpoints as keys. Here is the previous example again, using the object syntax. +The first option for defining breakpoints is to define them as an object, using the breakpoints as keys. Note that each breakpoint property matches the breakpoint and every larger breakpoint. For example, `width: { lg: 100 }` is equivalent to `theme.breakpoints.up('lg')`. Here is the previous example again, using the object syntax. {{"demo": "pages/system/basics/BreakpointsAsObject.js"}} @@ -292,6 +306,7 @@ import { createTheme, ThemeProvider } from '@material-ui/core/styles'; const theme = createTheme({ breakpoints: { values: { + mobile: 0, tablet: 640, laptop: 1024, desktop: 1280, @@ -305,9 +320,8 @@ export default function CustomBreakpoints() { diff --git a/docs/src/pages/system/basics/basics-zh.md b/docs/src/pages/system/basics/basics-zh.md index c0d5dec8fc705f..e2b5a4d66be3ae 100644 --- a/docs/src/pages/system/basics/basics-zh.md +++ b/docs/src/pages/system/basics/basics-zh.md @@ -1,6 +1,6 @@ # Material-UI 系统(System) -

    用于快速创建自定义设计的 CSS 工具集。

    +

    CSS utilities for rapidly laying out custom designs.

    Material-UI comes with dozens of **ready-to-use** components in the core. 开始使用这些组件时可能会非常困难,但当涉及到通过定制设计使你的网站脱颖而出时,从这样无风格的状态开始可能更简单。 开始使用这些组件时可能会非常困难,但当涉及到通过定制设计使你的网站脱颖而出时,从这样无风格的状态开始可能更简单。 介绍该系统: @@ -14,14 +14,28 @@ _(调整窗口大小以查看响应的断点)_ ## 安装 + + ```jsx -// 使用 npm -npm install @material-ui/system +// with npm +npm install @material-ui/system@next @emotion/react @emotion/styled + +// with yarn +yarn add @material-ui/system@next @emotion/react @emotion/styled +``` -// 使用 yarn -yarn add @material-ui/system +Or if you want to use `styled-components` as a styling engine: + +```sh +// with npm +npm install @material-ui/system@next @material-ui/styled-engine-sc@next styled-components + +// with yarn +yarn add @material-ui/system@next @material-ui/styled-engine-sc@next styled-components ``` +Take a look at the [Styled Engine guide](/guides/styled-engine/) for more information about how to configure `styled-components` as the style engine. + ## 为什么要使用系统? 比较同一个统计组件如何使用两种不同的 API 来构建。 @@ -123,7 +137,7 @@ return ( 18.77%
    - vs last week + vs. last week ``` @@ -136,7 +150,7 @@ return ( 用户没有必要在样式组件的用法和定义的地方不断跳转。 有了这个系统,直接就可以在你需要的组件上面进行样式定制。 -**2. 2. 命名是一件很难的事情。** +**2. UI 中要达成一致是很困难的。** 你有没有发现自己在为一个样式组件找一个好名字而苦恼? 该系统可以直接将样式映射到元素。 所以你要做的就是只关心实际的样式属性。 @@ -170,12 +184,12 @@ This prop provides a superset of CSS (contains all CSS properties/selectors in a - 运行时会造成性能影响: - | 基准测试 | 代码片段 | 花费时间 | - |:-------------------- |:--------------------------- | ----- | - | a. a. 渲染 1,000 个基元 | `
    ` | 100ms | - | b. b. 渲染 1,000 个组件 | `
    ` | 120ms | - | c. c. 渲染 1,000 个样式组件 | `` | 160ms | - | d. 渲染一千个分组(Box) | `` | 370ms | + | 基准测试 | 代码片段 | 花费时间 | + |:----------------------- |:--------------------------- | ----- | + | a. a. 渲染 1,000 个基元 | `
    ` | 100ms | + | b. b. b. 渲染 1,000 个组件 | `
    ` | 120ms | + | c. c. c. 渲染 1,000 个样式组件 | `` | 160ms | + | d. 渲染一千个分组(Box) | `` | 370ms | _这里是可复现的 [性能测试文件夹](https://github.com/mui-org/material-ui/tree/next/benchmark/browser)。_ @@ -183,9 +197,9 @@ This prop provides a superset of CSS (contains all CSS properties/selectors in a ### API 权衡 -In previous versions, the system properties were supported as props on the `Box` component. In previous versions, the system properties were supported as props on the `Box` component. From v5, however, the system provides a superset of CSS (supports all CSS properties/selectors in addition to custom ones), and is available in all components, so selectors cannot be efficiently mapped to props without potential naming conflicts. Instead, all system properties are available under one prop `sx`. Instead, all system properties are available under one prop `sx`. +Having the system under one prop (`sx`) helps to differentiate props defined for the sole purpose of CSS utilities, vs. those for component business logic. It's important for the **separation of concerns**. For instance, a `color` prop on a button impacts multiple states (hover, focus, etc.), not to be confused with the color CSS property. -Additionally, having the system under one prop helps to easily differentiate props defined for the sole purpose of CSS utilities, vs. those for component business logic. +Only the `Box`, `Stack`, `Typography`, and `Grid` components accept the system properties as _props_ for the above reason. These components are designed to solve CSS problems, they are CSS component utilities. ## 使用 @@ -204,7 +218,7 @@ CSS 属性中有大量的速记语法。 这些语法在之后的文档中都有 color: 'primary.main', // theme.palette.primary.main m: 1, // margin: theme.spacing(1) p: { - xs: 1, // [theme.breakpoints.up('xs')]: : { padding: theme.spacing(1) } + xs: 1, // [theme.breakpoints.up('xs')]: { padding: theme.spacing(1) } }, zIndex: 'tooltip', // theme.zIndex.tooltip }} @@ -260,9 +274,9 @@ CSS 属性中有大量的速记语法。 这些语法在之后的文档中都有 如果你想要你的 CSS 属性是响应式的,那么可以使用断点速记语法。 确定断点有两种方法: -#### 1. 1. 将断点作为对象 +#### 1. 1. 1. 将断点作为对象 -定义断点的第一种选择是将断点定义为一个对象,将断点作为其键。 这里又是前面的例子,使用的是对象语法。 +定义断点的第一种选择是将断点定义为一个对象,将断点作为其键。 Note that each breakpoint property matches the breakpoint and every larger breakpoint. For example, `width: { lg: 100 }` is equivalent to `theme.breakpoints.up('lg')`. 这里又是前面的例子,使用的是对象语法。 {{"demo": "pages/system/basics/BreakpointsAsObject.js"}} @@ -293,6 +307,7 @@ import { createTheme, ThemeProvider } from '@material-ui/core/styles'; const theme = createTheme({ breakpoints: { values: { + mobile: 0, tablet: 640, laptop: 1024, desktop: 1280, @@ -306,13 +321,12 @@ export default function CustomBreakpoints() { - 该分组的宽度是响应式的 + This box has a responsive width ); @@ -346,7 +360,7 @@ declare module "@material-ui/core/styles/createBreakpoints" { `sx` 属性可以用于四个不同的位置: -### 1. 1. 核心组件 +### 1. 1. 1. 核心组件 所有的 Material-UI 核心组件都支持 `sx` 属性。 @@ -354,9 +368,9 @@ declare module "@material-ui/core/styles/createBreakpoints" { [`Box`](/components/box/) 是一个轻量级组件,它可以以工具集的方式通过包装其他组件来达到访问其 `sx` 属性的目的。 默认情况下将渲染一个 `
    ` 元素。 -### 3。 自定义组件 +### 3。 2. 自定义组件 -除了 Material-UI 组件,你也可以通过使用 `@material-ui/core/styles` 中的 `styled` 工具集来将 `sx` 属性添加到你的自定义组件中。 +In addition to Material-UI components, you can add the `sx` prop to your custom components too, by using the `styled` utility from `@material-ui/core/styles`. ```jsx import { styled } from '@material-ui/core/styles'; @@ -364,6 +378,6 @@ import { styled } from '@material-ui/core/styles'; const Div = styled('div')``; ``` -### 4、 4、 使用 babel 插件的任何元素 +### 4、 4、 4、 使用 babel 插件的任何元素 等待开发 [#23220](https://github.com/mui-org/material-ui/issues/23220)。 diff --git a/docs/src/pages/system/basics/basics.md b/docs/src/pages/system/basics/basics.md index 599b90c0975733..50c4befc0dc248 100644 --- a/docs/src/pages/system/basics/basics.md +++ b/docs/src/pages/system/basics/basics.md @@ -167,7 +167,9 @@ The system provides direct access to the value in the theme. It makes it easier The `sx` prop, as the main part of the system, solves these problems by providing a fast & simple way of applying the correct design tokens for specific CSS properties directly to a React element. The [demo above](#demo) shows how it can be used to create a one-off design. -This prop provides a superset of CSS (contains all CSS properties/selectors in addition to custom ones) that maps values directly from the theme, depending on the CSS property used. Also, it allows a simple way of defining responsive values that correspond to the breakpoints defined in the theme. +This prop provides a superset of CSS (contains all CSS properties/selectors in addition to custom ones) that maps values directly from the theme, depending on the CSS property used. +Also, it allows a simple way of defining responsive values that correspond to the breakpoints defined in the theme. +For more details, visit the [`sx` prop page](/system/the-sx-prop/). ### When to use it? diff --git a/docs/src/pages/system/borders/borders-fr.md b/docs/src/pages/system/borders/borders-fr.md index 11ef121d8bacd7..29584f71788efe 100644 --- a/docs/src/pages/system/borders/borders-fr.md +++ b/docs/src/pages/system/borders/borders-fr.md @@ -58,7 +58,7 @@ Use border utilities to add or remove an element's borders. Choose from all bord import { borders } from '@material-ui/system'; ``` -| Import name | Prop | Propriété CSS | Clé du thème | +| Nom importé | Propriété | Propriété CSS | Clé du thème | |:-------------- |:-------------- |:--------------- |:---------------------------------------------------------------- | | `border` | `border` | `border` | `borders` | | `borderTop` | `borderTop` | `border-top` | `borders` | diff --git a/docs/src/pages/system/borders/borders-pt.md b/docs/src/pages/system/borders/borders-pt.md index e24d4819487f50..a9145cfdfaa162 100644 --- a/docs/src/pages/system/borders/borders-pt.md +++ b/docs/src/pages/system/borders/borders-pt.md @@ -25,6 +25,44 @@ Use border utilities to add or remove an element's borders. Escolha para todas a … +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… @@ -35,6 +73,16 @@ Use border utilities to add or remove an element's borders. Escolha para todas a … +… +… +… +… +… +… +… +… +… +… @@ -171,6 +219,26 @@ Use border utilities to add or remove an element's borders. Escolha para todas a … +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… diff --git a/docs/src/pages/system/borders/borders-zh.md b/docs/src/pages/system/borders/borders-zh.md index eb9f871d7c09af..72311a73605911 100644 --- a/docs/src/pages/system/borders/borders-zh.md +++ b/docs/src/pages/system/borders/borders-zh.md @@ -50,11 +50,23 @@ Use border utilities to add or remove an element's borders. 选择所有边框 … +… -… +… +… +… +… +… +… +… +… +… +… +… +… diff --git a/docs/src/pages/system/box/BoxSx.js b/docs/src/pages/system/box/BoxSx.js index 7d98a0d490e231..bfe2fe65fcde20 100644 --- a/docs/src/pages/system/box/BoxSx.js +++ b/docs/src/pages/system/box/BoxSx.js @@ -1,11 +1,10 @@ import * as React from 'react'; -import { Box } from '@material-ui/system'; -import { ThemeContext } from '@material-ui/styled-engine'; +import { Box, ThemeProvider } from '@material-ui/system'; export default function BoxSx() { return ( - - + ); } diff --git a/docs/src/pages/system/box/BoxSx.tsx b/docs/src/pages/system/box/BoxSx.tsx index 7d98a0d490e231..bfe2fe65fcde20 100644 --- a/docs/src/pages/system/box/BoxSx.tsx +++ b/docs/src/pages/system/box/BoxSx.tsx @@ -1,11 +1,10 @@ import * as React from 'react'; -import { Box } from '@material-ui/system'; -import { ThemeContext } from '@material-ui/styled-engine'; +import { Box, ThemeProvider } from '@material-ui/system'; export default function BoxSx() { return ( - - + ); } diff --git a/docs/src/pages/system/box/box-de.md b/docs/src/pages/system/box/box-de.md new file mode 100644 index 00000000000000..6624fa4ac2c796 --- /dev/null +++ b/docs/src/pages/system/box/box-de.md @@ -0,0 +1,68 @@ +--- +title: React Box component +githubLabel: 'component: Box' +--- + +# Box + +

    Die Box-Komponente dient als Wrapper-Komponente für die meisten Anforderungen des CSS-Dienstprogramms.

    + +Die Box-Komponente kombiniert [alle Stilfunktionen](/system/basics/#all-inclusive), die in `@material-ui/system` verfügbar sind. + +Die Style-Funktion der [Palette](/system/palette/). + +## Beispiel + +Die Style-Funktion der [Palette](/system/palette/). + +## The `sx` prop + +All system properties are available via the [`sx` prop](/system/basics/#the-sx-prop). In addition, the `sx` prop allows you to specify any other CSS rules you may need. Here's an example of how you can use it: + +{{"demo": "pages/system/box/BoxSx.js", "defaultCodeOpen": true }} + +## Material-UI-Komponenten überschreiben + +Die Box-Komponente umschließt Ihre Komponente. It creates a new DOM element, a `
    ` by default that can be changed with the `component` prop. Angenommen, stattdessen soll ein ``-Element verwendet werden: + +{{"demo": "pages/system/box/BoxComponent.js", "defaultCodeOpen": true }} + +Dies funktioniert hervorragend, wenn die Änderungen für ein neues DOM-Element isoliert werden können. Zum Beispiel kann der Rand auf diese Weise verändert werden. + +Manchmal müssen Sie jedoch das zugrunde liegende DOM-Element als Ziel festlegen. As an example, you may want to change the border of the Button. The Button component defines its own styles. CSS-Vererbung hilft hier nicht. To workaround the problem, you can use the [`sx`](/system/basics/#the-sx-prop) prop directly on the child if it is a Material-UI component. + +```diff +- +- +- ++ +``` + +For non-Material-UI components, use the `component` prop. + +```diff +- +- +- ++Save +``` + +## API + +```jsx +import Box from '@material-ui/core/Box'; +``` + +| Name | Typ | Standard | Beschreibung | +|:---------------------------------------- |:----------------------------------------------------------------------------------------------------------------------------- |:--------------------------------------- |:-------------------------------------------------------------------------------------------------------------------------- | +| children | node
    | | Box Render-Funktion oder Knoten. | +| component | union: string |
     func |
     object
    | 'div' | Die für den Wurzelknoten verwendete Komponente. Entweder ein String, um ein DOM-Element zu verwenden oder eine Komponente. | +| sx | object | {} | Accepts all system properties, as well as any valid CSS properties. | + +## System props + +As a CSS utility component, the `Box` also supports all [`system`](/system/properties/) properties. You can use them as prop directly on the component. For instance, a margin-top: + +```jsx + +``` diff --git a/docs/src/pages/system/box/box-es.md b/docs/src/pages/system/box/box-es.md new file mode 100644 index 00000000000000..62ad164a243535 --- /dev/null +++ b/docs/src/pages/system/box/box-es.md @@ -0,0 +1,68 @@ +--- +title: React Box component +githubLabel: 'component: Box' +--- + +# Cuadro + +

    El componente Box sirve como una envoltura para la mayoría de las necesidades CSS.

    + +El componente Box recoge [todas las funciones de estilo](/system/basics/#all-inclusive) que están expuesta en `@material-ui/system`. + +[La función de estilo de la paleta](/system/palette/). + +## Ejemplo + +[La función de estilo de la paleta](/system/palette/). + +## The `sx` prop + +All system properties are available via the `sx` prop. In addition, this prop allows you to specify any other CSS rules you may need. Here's an example of how you can use it: + +{{"demo": "pages/system/box/BoxSx.js", "defaultCodeOpen": true }} + +## Anulación de componentes de material-UI + +El componente Box envuelve su componente. Crea un nuevo elemento DOM, un `
    ` por defecto que se puede cambiar con la propiedad `componente`. Digamos que quiere usar un `` en lugar: + +{{"demo": "pages/system/box/BoxComponent.js", "defaultCodeOpen": true }} + +Esto funciona muy bien cuando los cambios se pueden aislar a un nuevo elemento DOM. Por ejemplo, puede cambiar el margen de esta manera. + +Sin embargo, a veces tienes que apuntar al elemento DOM subyacente. For instance, you want to change the border of the Button. The Button component defines its own styles. La herencia por CSS no ayuda. To workaround the problem, you can use the [`sx`](/system/basics/#the-sx-prop) prop directly on the child if it is a Material-UI component. + +```diff +- +- +- ++ +``` + +El componente Box tiene una propiedad `clone` para permitir el uso del método de elemento clon de React. + +```diff +- +- +- ++Save +``` + +## API + +```jsx +import Box from '@material-ui/core/Box'; +``` + +| Nombre | Tipo | Por defecto | Descripción | +|:------------------------------------------- |:----------------------------------------------------------------------------------------------------------------------------- |:--------------------------------------- |:-------------------------------------------------------------------------------------------------------- | +| hijos * | node
    | | Función de render de Box o nodo. | +| component | union: string |
     func |
     object
    | 'div' | El componente utilizado para el nodo raíz. Ya sea un 'string' para usar un elemento DOM o un componente. | +| sx | object | {} | Accepts all system properties, as well as any valid CSS properties. | + +## System props + +As a CSS utility component, the `Box` also supports all [`system`](/system/properties/) properties. You can use them as prop directly on the component. For instance, a margin-top: + +```jsx + +``` diff --git a/docs/src/pages/system/box/box-fr.md b/docs/src/pages/system/box/box-fr.md new file mode 100644 index 00000000000000..7fbb567a1333fc --- /dev/null +++ b/docs/src/pages/system/box/box-fr.md @@ -0,0 +1,68 @@ +--- +title: Composant React Box +githubLabel: 'component: Box' +--- + +# Box (Boite) + +

    Le composant Box sert de composant de wrapper pour la plupart des besoins de l'utilitaire CSS.

    + +Le composant Box contiens [toutes les fonctions de style](/system/basics/#all-inclusive) qui sont exposées dans `@material-ui/system`. + +{{"component": "modules/components/ComponentLinkHeader.js", "design": false}} + +## Exemple + +[La palette](/system/palette/) de style fonction. + +## The `sx` prop + +All system properties are available via the `sx` prop. In addition, this prop allows you to specify any other CSS rules you may need. Voici un exemple de la façon dont vous pouvez l'utiliser : + +{{"demo": "pages/system/box/BoxSx.js", "defaultCodeOpen": true }} + +## Remplacer les composants Material-UI + +Le composant Box enveloppe votre composant. Il crée un nouvel élément DOM, un `
    ` par défaut qui peut être modifié avec la propriété `component`. Disons que vous voulez utiliser un `` à la place : + +{{"demo": "pages/system/box/BoxComponent.js", "defaultCodeOpen": true }} + +Cela fonctionne très bien quand les changements peuvent être isolés dans un nouvel élément DOM. Par exemple, vous pouvez changer la marge de cette façon. + +Cependant, vous devez parfois cibler l'élément DOM sous-jacent. For instance, you want to change the border of the Button. Le composant Button définit ses propres styles. L'héritage CSS n'aide pas. To workaround the problem, you can use the [`sx`](/system/basics/#the-sx-prop) prop directly on the child if it is a Material-UI component. + +```diff +- +- +- ++ +``` + +The Box component has a `clone` property to enable the usage of the clone element method of React. + +```diff +- +- +- ++Save +``` + +## API + +```jsx +import Box from '@material-ui/core/Box'; +``` + +| Nom | Type | Défaut | Description | +|:---------------------------------------------- |:----------------------------------------------------------------------------------------------------------------------------- |:--------------------------------------- |:---------------------------------------------------------------------------------------------------------------------- | +| children * | node
    | | Fonction de rendu ou noeud de la boîte. | +| component | union: string |
     func |
     object
    | 'div' | Le composant utilisé pour le noeud racine. Soit une chaîne de caractères pour utiliser un élément DOM ou un composant. | +| sx | object | {} | Accepte toutes les propriétés du système, ainsi que toutes les propriétés CSS valides. | + +## System props + +As a CSS utility component, the `Box` also supports all [`system`](/system/properties/) properties. You can use them as prop directly on the component. For instance, a margin-top: + +```jsx + +``` diff --git a/docs/src/pages/system/box/box-ja.md b/docs/src/pages/system/box/box-ja.md new file mode 100644 index 00000000000000..a3efcb8cec34a1 --- /dev/null +++ b/docs/src/pages/system/box/box-ja.md @@ -0,0 +1,68 @@ +--- +title: React Box コンポーネント +githubLabel: 'component: Box' +--- + +# Box + +

    Boxコンポーネントは、CSSユーティリティーのほとんどのニーズに対応するラッパーコンポーネントとして機能します

    + +Boxコンポーネントは、`@material-ui/system`で公開される[すべてのスタイル関数](/system/basics/#all-inclusive) をパッケージ化します。 + +[The palette](/system/palette/) style関数。 + +## 例 + +[palette](/system/palette/) style関数。 + +## The `sx` prop + +All system properties are available via the [`sx` prop](/system/basics/#the-sx-prop). In addition, the `sx` prop allows you to specify any other CSS rules you may need. 使用方法の例を次に示します。 + +{{"demo": "pages/system/box/BoxSx.js", "defaultCodeOpen": true }} + +## Material-UI componentsのオーバーライド + +The Box componentは、コンポーネントをラップします。 新しいDOM要素を作成します。 この要素はデフォルトで`
    `であり、`component` プロパティを使用して変更できます。 代わりに `` を使用すると + +{{"demo": "pages/system/box/BoxComponent.js", "defaultCodeOpen": true }} + +これは、新しいDOM要素に分離する変更の場合に非常に有効です。 たとえば、この方法で余白を変更できます。 + +ただし、場合によっては基礎となるDOM要素をターゲットにする必要があります。 As an example, you may want to change the border of the Button. しかしButtonコンポーネントは独自のスタイルを定義しています。 CSS継承は役に立ちません。 To workaround the problem, you can use the [`sx`](/system/basics/#the-sx-prop) prop directly on the child if it is a Material-UI component. + +```diff +- +- +- ++ +``` + +For non-Material-UI components, use the `component` prop. + +```diff +- +- +- ++Save +``` + +## API + +```jsx +import Box from '@material-ui/core/Box'; +``` + +| Name | Type | Default | Description | +|:---------------------------------------- |:----------------------------------------------------------------------------------------------------------------------------- |:--------------------------------------- |:--------------------------------------------- | +| children | node
    | | ボックスレンダー関数またはノード。 | +| component | union: string |
     func |
     object
    | 'div' | ルートノードに使用されるコンポーネント。 DOM要素またはコンポーネントを使用する文字列。 | +| sx | object | {} | すべてのシステムプロパティと有効な CSS プロパティを受け入れます。 | + +## System props + +As a CSS utility component, the `Box` also supports all [`system`](/system/properties/) properties. You can use them as prop directly on the component. For instance, a margin-top: + +```jsx + +``` diff --git a/docs/src/pages/system/box/box-pt.md b/docs/src/pages/system/box/box-pt.md new file mode 100644 index 00000000000000..3fdbbc815543c8 --- /dev/null +++ b/docs/src/pages/system/box/box-pt.md @@ -0,0 +1,68 @@ +--- +title: Componente React Box +githubLabel: 'component: Box' +--- + +# Box + +

    O componente Box serve como um componente encapsulador (wrapper) para a auxiliar na maioria das necessidades de uso com CSS.

    + +O component Box compõe [todas as funções de estilo](/system/basics/#all-inclusive) que são expostas no `@material-ui/system`. + +[A paleta](/system/palette/) com funções de estilo. + +## Exemplo + +[A paleta](/system/palette/) com funções de estilo. + +## A propriedade `sx` + +All system properties are available via the [`sx` prop](/system/basics/#the-sx-prop). In addition, the `sx` prop allows you to specify any other CSS rules you may need. Aqui está um exemplo de como você pode usá-la: + +{{"demo": "pages/system/box/BoxSx.js", "defaultCodeOpen": true }} + +## Sobrescrevendo componentes do Material-UI + +O componente Box envolve seu componente. Ele cria um novo elemento DOM, uma `
    ` por padrão, comportamento que pode ser modificado através da propriedade `component`. Digamos que você queira usar um ``: + +{{"demo": "pages/system/box/BoxComponent.js", "defaultCodeOpen": true }} + +Isso funciona muito bem quando as alterações precisam ser isoladas em um novo elemento DOM. Note no exemplo, a forma que você alterou a margem. + +No entanto, às vezes, você precisa modificar o elemento DOM subjacente. As an example, you may want to change the border of the Button. Por exemplo, você quer mudar a borda do botão. A herança por CSS não irá ajudar nesse caso. To workaround the problem, you can use the [`sx`](/system/basics/#the-sx-prop) prop directly on the child if it is a Material-UI component. + +```diff +- +- +- ++ +``` + +For non-Material-UI components, use the `component` prop. + +```diff +- +- +- ++Save +``` + +## API + +```jsx +import Box from '@material-ui/core/Box'; +``` + +| Nome | Tipo | Padrão | Descrição | +|:---------------------------------------- |:----------------------------------------------------------------------------------------------------------------------------- |:--------------------------------------- |:--------------------------------------------------------------------------------------- | +| children | node
    | | Função de renderização do Box ou nó. | +| component | union: string |
     func |
     object
    | 'div' | O componente usado como nó raiz. Ou uma string para usar um elemento DOM ou componente. | +| sx | object | {} | Aceita todas as propriedades do sistema, bem como quaisquer propriedades CSS válidas. | + +## System props + +As a CSS utility component, the `Box` also supports all [`system`](/system/properties/) properties. You can use them as prop directly on the component. For instance, a margin-top: + +```jsx + +``` diff --git a/docs/src/pages/system/box/box-ru.md b/docs/src/pages/system/box/box-ru.md new file mode 100644 index 00000000000000..91009cfb7e33e8 --- /dev/null +++ b/docs/src/pages/system/box/box-ru.md @@ -0,0 +1,68 @@ +--- +title: Компонент React Box +githubLabel: 'component: Box' +--- + +# Box + +

    Box компонент используется как обертка компонента для большинства используемых CSS свойств.

    + +The Box component packages [all the style functions](/system/basics/#all-inclusive) that are exposed in `@material-ui/system`. + +{{"component": "modules/components/ComponentLinkHeader.js", "design": false}} + +## Пример + +[The palette](/system/palette/) style function. + +## The `sx` prop + +All system properties are available via the [`sx` prop](/system/basics/#the-sx-prop). In addition, the `sx` prop allows you to specify any other CSS rules you may need. Вот пример того, как вы можете использовать его: + +{{"demo": "pages/system/box/BoxSx.js", "defaultCodeOpen": true }} + +## Переопределение Material-UI компонентов + +Box компонент оборачивает ваш компонент. Он создает новый DOM элемент: `
    ` по умолчанию, который можно изменить свойством `component`. Например если вы хотите использовать`` взамен: + +{{"demo": "pages/system/box/BoxComponent.js", "defaultCodeOpen": true }} + +Это работает превосходно когда изменения могут быть изолированы в новый DOM элемент. Для сущности, вы можете изменить margin(внешний отступ) таким образом. + +Тем не менее, иногда вам нужно ориентироваться на базовый элемент DOM. As an example, you may want to change the border of the Button. Этот компонент определяет свои собственные стили. Наследование CSS не помогает. To workaround the problem, you can use the [`sx`](/system/basics/#the-sx-prop) prop directly on the child if it is a Material-UI component. + +```diff +- +- +- ++ +``` + +For non-Material-UI components, use the `component` prop. + +```diff +- +- +- ++Save +``` + +## API + +```jsx +import Box from '@material-ui/core/Box'; +``` + +| Имя | Тип | По-умолчанию | Описание | +|:---------------------------------------- |:----------------------------------------------------------------------------------------------------------------------------- |:--------------------------------------- |:------------------------------------------------------------------------------------------ | +| children | node
    | | Box render function or node. | +| component | union: string |
     func |
     object
    | 'div' | The component used for the root node. Either a string to use a DOM element or a component. | +| sx | object | {} | Принимает все системные свойства, а также все допустимые CSS-свойства. | + +## System props + +As a CSS utility component, the `Box` also supports all [`system`](/system/properties/) properties. You can use them as prop directly on the component. For instance, a margin-top: + +```jsx + +``` diff --git a/docs/src/pages/system/box/box-zh.md b/docs/src/pages/system/box/box-zh.md new file mode 100644 index 00000000000000..a2dcaa4c414838 --- /dev/null +++ b/docs/src/pages/system/box/box-zh.md @@ -0,0 +1,68 @@ +--- +title: React Box(分组)组件 +githubLabel: 'component: Box' +--- + +# Box 分组 + +

    对于大多数 CSS 实用程序来说,Box 组件能够作为一个包装组件来使用。

    + +在`@material-ui/system`中,您可以找到所述 Box 组件包的 [所有的样式功能](/system/basics/#all-inclusive)。 + +{{"component": "modules/components/ComponentLinkHeader.js", "design": false}} + +## 示例 + +查看[调色板](/system/palette/)样式功能。 + +## `sx` 属性 + +All system properties are available via the [`sx` prop](/system/basics/#the-sx-prop). In addition, the `sx` prop allows you to specify any other CSS rules you may need. 下面是一个如何使用的示例: + +{{"demo": "pages/system/box/BoxSx.js", "defaultCodeOpen": true }} + +## 覆盖 Material-UI 组件 + +Box 组件能够封装您的组件。 它创建了一个新的 DOM 元素,默认情况下为 `
    `,并可以通过 `组件` 的属性进行更改。 假设反之你想使用一个 ``: + +{{"demo": "pages/system/box/BoxComponent.js", "defaultCodeOpen": true }} + +当所需的更改与新的 DOM 元素分开时比较有效。 例如,您可以使用这个方法来更改边距。 + +但是,有时您必须针对到底层的 DOM 元素。 As an example, you may want to change the border of the Button. 但是按钮组件已经定义自己的样式。 CSS 继承于事无补。 To workaround the problem, you can use the [`sx`](/system/basics/#the-sx-prop) prop directly on the child if it is a Material-UI component. + +```diff +- +- +- ++ +``` + +For non-Material-UI components, use the `component` prop. + +```diff +- +- +- ++Save +``` + +## API + +```jsx +import Box from '@material-ui/core/Box'; +``` + +| 名称 | 类型 | 默认值 | 描述 | +|:---------------------------------------- |:----------------------------------------------------------------------------------------------------------------------------- |:--------------------------------------- |:------------------------------------------ | +| children | node
    | | Box 渲染函数或者返回节点。 | +| component | union: string |
     func |
     object
    | 'div' | component 用于根节点。 可以是一个使用 DOM 元素或者一个组件的字符串。 | +| sx | object | {} | 接受所有系统属性,以及任何有效的 CSS 属性。 | + +## System props + +As a CSS utility component, the `Box` also supports all [`system`](/system/properties/) properties. You can use them as prop directly on the component. For instance, a margin-top: + +```jsx + +``` diff --git a/docs/src/pages/system/display/display-fr.md b/docs/src/pages/system/display/display-fr.md index ee2971482d1201..98cab96245ad9c 100644 --- a/docs/src/pages/system/display/display-fr.md +++ b/docs/src/pages/system/display/display-fr.md @@ -122,7 +122,7 @@ For faster mobile-friendly development, use responsive display classes for showi import { display } from '@material-ui/system'; ``` -| Import name | Prop | Propriété CSS | Clé du thème | +| Nom importé | Propriété | Propriété CSS | Clé du thème | |:-------------- |:-------------- |:--------------- |:------------ | | `displayPrint` | `displayPrint` | `display` | none | | `displayRaw` | `display` | `display` | none | diff --git a/docs/src/pages/system/display/display-ja.md b/docs/src/pages/system/display/display-ja.md index ac5f1715dbf919..8ef85e55e92fef 100644 --- a/docs/src/pages/system/display/display-ja.md +++ b/docs/src/pages/system/display/display-ja.md @@ -1,6 +1,6 @@ # ディスプレイ -

    一般的な値の一部のサポートと、印刷時の表示を制御するための追加機能が含まれています。 一般的な値の一部のサポートと、印刷時の表示を制御するための追加機能が含まれています。 Quickly and responsively toggle the display value of components and more with the display utilities.

    +

    一般的な値の一部のサポートと、印刷時の表示を制御するための追加機能が含まれています。 一般的な値の一部のサポートと、印刷時の表示を制御するための追加機能が含まれています。 一般的な値の一部のサポートと、印刷時の表示を制御するための追加機能が含まれています。 一般的な値の一部のサポートと、印刷時の表示を制御するための追加機能が含まれています。 一般的な値の一部のサポートと、印刷時の表示を制御するための追加機能が含まれています。 Quickly and responsively toggle the display value of components and more with the display utilities.

    ## 例 diff --git a/docs/src/pages/system/flexbox/flexbox-fr.md b/docs/src/pages/system/flexbox/flexbox-fr.md index 1586f7bade80a3..dd440d60c549b6 100644 --- a/docs/src/pages/system/flexbox/flexbox-fr.md +++ b/docs/src/pages/system/flexbox/flexbox-fr.md @@ -2,7 +2,7 @@

    Quickly manage the layout, alignment, and sizing of grid columns, navigation, components, and more with a full suite of responsive flexbox utilities.

    -Si vous êtes **nouveau ou peu familiers avec FlexBox**, nous vous encourageons à lire ce guide [CSS-Tricks flexbox](https://css-tricks.com/snippets/css/a-guide-to-flexbox/). +Si vous êtes **nouveau ou peu familiers avec FlexBox**, nous vous encourageons à lire ce guide [CSS-Tricks FlexBox ](https://css-tricks.com/snippets/css/a-guide-to-flexbox/). ## Properties for the Parent @@ -109,7 +109,7 @@ Si vous êtes **nouveau ou peu familiers avec FlexBox**, nous vous encourageons import { flexbox } from '@material-ui/system'; ``` -| Import name | Prop | Propriété CSS | Clé du thème | +| Nom importé | Propriété | Propriété CSS | Clé du thème | |:---------------- |:---------------- |:----------------- |:------------ | | `flexDirection` | `flexDirection` | `flex-direction` | none | | `flexWrap` | `flexWrap` | `flex-wrap` | none | diff --git a/docs/src/pages/system/flexbox/flexbox-pt.md b/docs/src/pages/system/flexbox/flexbox-pt.md index cecba72e46622c..bd68f24903109a 100644 --- a/docs/src/pages/system/flexbox/flexbox-pt.md +++ b/docs/src/pages/system/flexbox/flexbox-pt.md @@ -28,6 +28,9 @@ Se você é **novo ou não está familiarizado com o flexbox**, nós recomendamo … +… +… +… ``` ### flex-wrap @@ -40,6 +43,10 @@ Se você é **novo ou não está familiarizado com o flexbox**, nós recomendamo … +… +… +… +… ``` ### justify-content @@ -59,6 +66,12 @@ Se você é **novo ou não está familiarizado com o flexbox**, nós recomendamo … +… +… +… +… +… +… @@ -83,6 +96,12 @@ Se você é **novo ou não está familiarizado com o flexbox**, nós recomendamo … +… +… +… +… +… +… @@ -98,6 +117,7 @@ Se você é **novo ou não está familiarizado com o flexbox**, nós recomendamo … +… ``` ## Propriedades para os Filhos diff --git a/docs/src/pages/system/flexbox/flexbox-ru.md b/docs/src/pages/system/flexbox/flexbox-ru.md index 57fb0dd7bef2d4..db75e48b2ead53 100644 --- a/docs/src/pages/system/flexbox/flexbox-ru.md +++ b/docs/src/pages/system/flexbox/flexbox-ru.md @@ -2,7 +2,7 @@

    Quickly manage the layout, alignment, and sizing of grid columns, navigation, components, and more with a full suite of responsive flexbox utilities.

    -Если вы **слабо знакомы (или совсем незнакомы) с Flexbox**, мы рекомендуем Вам прочитать это руководство [CSS-трюки Flexbox](https://css-tricks.com/snippets/css/a-guide-to-flexbox/). +Если вы **слабо знакомы (или совсем незнакомы) с Flexbox**, мы рекомендуем Вам прочитать это руководство [CSS-Tricks Flexbox](https://css-tricks.com/snippets/css/a-guide-to-flexbox/). ## Properties for the Parent diff --git a/docs/src/pages/system/flexbox/flexbox-zh.md b/docs/src/pages/system/flexbox/flexbox-zh.md index bc4281fa128f16..a2317f324c6446 100644 --- a/docs/src/pages/system/flexbox/flexbox-zh.md +++ b/docs/src/pages/system/flexbox/flexbox-zh.md @@ -21,6 +21,7 @@ ```jsx … +… ``` @@ -31,6 +32,7 @@ ```jsx … +… ``` @@ -43,6 +45,10 @@ … +… +… +… +… ``` @@ -56,6 +62,10 @@ … +… +… +… +… ``` ### align-content @@ -66,6 +76,7 @@ … +… ``` ## 子元素的属性 diff --git a/docs/src/pages/system/grid/grid-de.md b/docs/src/pages/system/grid/grid-de.md index 5a0cdf4b342254..2d9f4ee8465ac1 100644 --- a/docs/src/pages/system/grid/grid-de.md +++ b/docs/src/pages/system/grid/grid-de.md @@ -1,16 +1,16 @@ -# Grid +# CSS Grid

    Quickly manage the layout, alignment, and sizing of grid columns, navigation, components, and more with a full suite of responsive grid utilities.

    -If you are **new to or unfamiliar with grid**, you're encourage to read this [CSS-Tricks grid](https://css-tricks.com/snippets/css/complete-guide-grid/) guide. +If you are **new to or unfamiliar with grid**, you're encouraged to read this [CSS-Tricks grid](https://css-tricks.com/snippets/css/complete-guide-grid/) guide. -## Eigenschaften für das übergeordnete Element +## Properties for the parent ### display -In order to define a `grid` container you must specify the `display` CSS property to have one of the values: `grid` or `inline-grid`. +To define a `grid` container, you must specify the `display` CSS property to have one of the values: `grid` or `inline-grid`. -{{"demo": "pages/system/grid/Display.js", "defaultCodeOpen": false, "bg": true}} +{{"demo": "pages/system/grid/Display.js", "defaultCodeOpen": false}} ```jsx @@ -21,150 +21,86 @@ In order to define a `grid` container you must specify the `display` CSS propert The `grid-template-rows` property defines the line names and track sizing functions of the grid rows. -{{"demo": "pages/system/grid/GridTemplateRows.js", "defaultCodeOpen": false, "bg": true}} - -```jsx - -
    1
    -
    2
    -
    3
    -
    -``` +{{"demo": "pages/system/grid/GridTemplateRows.js", "bg": true}} ### grid-template-columns The `grid-template-columns` property defines the line names and track sizing functions of the grid columns. -{{"demo": "pages/system/grid/GridTemplateColumns.js", "defaultCodeOpen": false, "bg": true}} - -```jsx - -
    1
    -
    2
    -
    3
    -
    -``` +{{"demo": "pages/system/grid/GridTemplateColumns.js", "bg": true}} ### gap -The `gap: size` property specifies the gap between the different items inside the `grid`. - -{{"demo": "pages/system/grid/Gap.js", "defaultCodeOpen": false, "bg": true}} +The `gap: size` property specifies the gap between the different items inside the CSS grid. -```jsx - -
    1
    -
    2
    -
    3
    -
    4
    -
    -``` +{{"demo": "pages/system/grid/Gap.js", "bg": true}} ### row-gap & column-gap -The `row-gap` and `column-gap` gives the possibility for specifying the row and column gaps independently. +The `row-gap` and `column-gap` CSS properties allow for specifying the row and column gaps independently. -{{"demo": "pages/system/grid/RowAndColumnGap.js", "defaultCodeOpen": false, "bg": true}} - -```jsx - -
    1
    -
    2
    -
    3
    -
    4
    -
    -``` +{{"demo": "pages/system/grid/RowAndColumnGap.js", "bg": true}} ### grid-template-areas The `grid-template-area` property defines a grid template by referencing the names of the grid areas which are specified with the `grid-area` property. -{{"demo": "pages/system/grid/GridTemplateAreas.js", "defaultCodeOpen": false, "bg": true}} - -```jsx - - - - - - -``` +{{"demo": "pages/system/grid/GridTemplateAreas.js", "bg": true}} ### grid-auto-columns The `grid-auto-column` property specifies the size of an implicitly-created grid column track or pattern of tracks. -{{"demo": "pages/system/grid/GridAutoColumns.js", "defaultCodeOpen": false, "bg": true}} - -```jsx - - 1 / 3 - 4 / 5 - -``` +{{"demo": "pages/system/grid/GridAutoColumns.js", "bg": true}} -You can see on the screenshot below that the third non-visible column have width of `0.2fr`, which is approximately `20%`. - -
    - grid-auto-column -
    +On the demo above, the second non-visible column has a width of `1fr`/4 which is approximately equal to `25%`. ### grid-auto-rows The `grid-auto-rows` property specifies the size of an implicitly-created grid row track or pattern of tracks. -{{"demo": "pages/system/grid/GridAutoRows.js", "defaultCodeOpen": false, "bg": true}} - -```jsx - - {/* The third non-visible row has height of 40px */} - 1 / 3 - 4 / 5 - -``` +{{"demo": "pages/system/grid/GridAutoRows.js", "bg": true}} ### grid-auto-flow The `grid-auto-flow` property controls how the auto-placement algorithm works, specifying exactly how auto-placed items get flowed into the grid. -{{"demo": "pages/system/grid/GridAutoFlow.js", "defaultCodeOpen": false, "bg": true}} +{{"demo": "pages/system/grid/GridAutoFlow.js", "bg": true}} -```jsx - - 1 - 2 - 3 - 4 - 5 - -``` - -## Eigenschaften für die untergeordneten Elemente +## Properties for the children ### grid-column The `grid-column` property is a shorthand for `grid-column-start` + `grid-column-end`. You can see how it's used in the [grid-auto-columns example](/system/grid/#grid-auto-columns). +You can either set the start and end line: + ```jsx … ``` +Or set the number of columns to span: + +```jsx +… +``` + ### grid-row The `grid-row` property is a shorthand for `grid-row-start` + `grid-row-end`. You can see how it's used in the [grid-auto-rows example](/system/grid/#grid-auto-rows). +You can either set the start and end line: + ```jsx … ``` +Or set the number of rows to span: + +```jsx +… +``` + ### grid-area The `grid-area` property allows you to give an item a name so that it can be referenced by a template created with the `grid-template-areas` property. You can see how it's used in the [grid-template-area example](/system/grid/#grid-template-areas). diff --git a/docs/src/pages/system/grid/grid-es.md b/docs/src/pages/system/grid/grid-es.md index fd2f54d8ab5af1..0d47ddaea2e2ef 100644 --- a/docs/src/pages/system/grid/grid-es.md +++ b/docs/src/pages/system/grid/grid-es.md @@ -1,16 +1,16 @@ -# Grid +# CSS Grid

    Quickly manage the layout, alignment, and sizing of grid columns, navigation, components, and more with a full suite of responsive grid utilities.

    -If you are **new to or unfamiliar with grid**, you're encourage to read this [CSS-Tricks grid](https://css-tricks.com/snippets/css/complete-guide-grid/) guide. +If you are **new to or unfamiliar with grid**, you're encouraged to read this [CSS-Tricks grid](https://css-tricks.com/snippets/css/complete-guide-grid/) guide. -## Properties for the Parent +## Properties for the parent ### display -In order to define a `grid` container you must specify the `display` CSS property to have one of the values: `grid` or `inline-grid`. +To define a `grid` container, you must specify the `display` CSS property to have one of the values: `grid` or `inline-grid`. -{{"demo": "pages/system/grid/Display.js", "defaultCodeOpen": false, "bg": true}} +{{"demo": "pages/system/grid/Display.js", "defaultCodeOpen": false}} ```jsx @@ -21,150 +21,86 @@ In order to define a `grid` container you must specify the `display` CSS propert The `grid-template-rows` property defines the line names and track sizing functions of the grid rows. -{{"demo": "pages/system/grid/GridTemplateRows.js", "defaultCodeOpen": false, "bg": true}} - -```jsx - -
    1
    -
    2
    -
    3
    -
    -``` +{{"demo": "pages/system/grid/GridTemplateRows.js", "bg": true}} ### grid-template-columns The `grid-template-columns` property defines the line names and track sizing functions of the grid columns. -{{"demo": "pages/system/grid/GridTemplateColumns.js", "defaultCodeOpen": false, "bg": true}} - -```jsx - -
    1
    -
    2
    -
    3
    -
    -``` +{{"demo": "pages/system/grid/GridTemplateColumns.js", "bg": true}} ### gap -The `gap: size` property specifies the gap between the different items inside the `grid`. - -{{"demo": "pages/system/grid/Gap.js", "defaultCodeOpen": false, "bg": true}} +The `gap: size` property specifies the gap between the different items inside the CSS grid. -```jsx - -
    1
    -
    2
    -
    3
    -
    4
    -
    -``` +{{"demo": "pages/system/grid/Gap.js", "bg": true}} ### row-gap & column-gap -The `row-gap` and `column-gap` gives the possibility for specifying the row and column gaps independently. +The `row-gap` and `column-gap` CSS properties allow for specifying the row and column gaps independently. -{{"demo": "pages/system/grid/RowAndColumnGap.js", "defaultCodeOpen": false, "bg": true}} - -```jsx - -
    1
    -
    2
    -
    3
    -
    4
    -
    -``` +{{"demo": "pages/system/grid/RowAndColumnGap.js", "bg": true}} ### grid-template-areas The `grid-template-area` property defines a grid template by referencing the names of the grid areas which are specified with the `grid-area` property. -{{"demo": "pages/system/grid/GridTemplateAreas.js", "defaultCodeOpen": false, "bg": true}} - -```jsx - - - - - - -``` +{{"demo": "pages/system/grid/GridTemplateAreas.js", "bg": true}} ### grid-auto-columns The `grid-auto-column` property specifies the size of an implicitly-created grid column track or pattern of tracks. -{{"demo": "pages/system/grid/GridAutoColumns.js", "defaultCodeOpen": false, "bg": true}} - -```jsx - - 1 / 3 - 4 / 5 - -``` +{{"demo": "pages/system/grid/GridAutoColumns.js", "bg": true}} -You can see on the screenshot below that the third non-visible column have width of `0.2fr`, which is approximately `20%`. - -
    - grid-auto-column -
    +On the demo above, the second non-visible column has a width of `1fr`/4 which is approximately equal to `25%`. ### grid-auto-rows The `grid-auto-rows` property specifies the size of an implicitly-created grid row track or pattern of tracks. -{{"demo": "pages/system/grid/GridAutoRows.js", "defaultCodeOpen": false, "bg": true}} - -```jsx - - {/* The third non-visible row has height of 40px */} - 1 / 3 - 4 / 5 - -``` +{{"demo": "pages/system/grid/GridAutoRows.js", "bg": true}} ### grid-auto-flow The `grid-auto-flow` property controls how the auto-placement algorithm works, specifying exactly how auto-placed items get flowed into the grid. -{{"demo": "pages/system/grid/GridAutoFlow.js", "defaultCodeOpen": false, "bg": true}} +{{"demo": "pages/system/grid/GridAutoFlow.js", "bg": true}} -```jsx - - 1 - 2 - 3 - 4 - 5 - -``` - -## Properties for the Children +## Properties for the children ### grid-column The `grid-column` property is a shorthand for `grid-column-start` + `grid-column-end`. You can see how it's used in the [grid-auto-columns example](/system/grid/#grid-auto-columns). +You can either set the start and end line: + ```jsx … ``` +Or set the number of columns to span: + +```jsx +… +``` + ### grid-row The `grid-row` property is a shorthand for `grid-row-start` + `grid-row-end`. You can see how it's used in the [grid-auto-rows example](/system/grid/#grid-auto-rows). +You can either set the start and end line: + ```jsx … ``` +Or set the number of rows to span: + +```jsx +… +``` + ### grid-area The `grid-area` property allows you to give an item a name so that it can be referenced by a template created with the `grid-template-areas` property. You can see how it's used in the [grid-template-area example](/system/grid/#grid-template-areas). diff --git a/docs/src/pages/system/grid/grid-fr.md b/docs/src/pages/system/grid/grid-fr.md index e783e111caef6d..e135bcee326d8e 100644 --- a/docs/src/pages/system/grid/grid-fr.md +++ b/docs/src/pages/system/grid/grid-fr.md @@ -23,148 +23,95 @@ The `grid-template-rows` property defines the line names and track sizing functi {{"demo": "pages/system/grid/GridTemplateRows.js", "defaultCodeOpen": false, "bg": true}} -```jsx - -
    1
    -
    2
    -
    3
    -
    -``` - ### grid-template-columns The `grid-template-columns` property defines the line names and track sizing functions of the grid columns. {{"demo": "pages/system/grid/GridTemplateColumns.js", "defaultCodeOpen": false, "bg": true}} -```jsx - -
    1
    -
    2
    -
    3
    -
    -``` - ### gap The `gap: size` property specifies the gap between the different items inside the `grid`. {{"demo": "pages/system/grid/Gap.js", "defaultCodeOpen": false, "bg": true}} -```jsx - -
    1
    -
    2
    -
    3
    -
    4
    -
    -``` - ### row-gap & column-gap The `row-gap` and `column-gap` gives the possibility for specifying the row and column gaps independently. {{"demo": "pages/system/grid/RowAndColumnGap.js", "defaultCodeOpen": false, "bg": true}} -```jsx - -
    1
    -
    2
    -
    3
    -
    4
    -
    -``` - ### grid-template-areas The `grid-template-area` property defines a grid template by referencing the names of the grid areas which are specified with the `grid-area` property. {{"demo": "pages/system/grid/GridTemplateAreas.js", "defaultCodeOpen": false, "bg": true}} -```jsx - - - - - - -``` - ### grid-auto-columns The `grid-auto-column` property specifies the size of an implicitly-created grid column track or pattern of tracks. {{"demo": "pages/system/grid/GridAutoColumns.js", "defaultCodeOpen": false, "bg": true}} -```jsx - - 1 / 3 - 4 / 5 - -``` - You can see on the screenshot below that the third non-visible column have width of `0.2fr`, which is approximately `20%`. -
    - grid-auto-column -
    - ### grid-auto-rows The `grid-auto-rows` property specifies the size of an implicitly-created grid row track or pattern of tracks. {{"demo": "pages/system/grid/GridAutoRows.js", "defaultCodeOpen": false, "bg": true}} -```jsx - - {/* The third non-visible row has height of 40px */} - 1 / 3 - 4 / 5 - -``` - ### grid-auto-flow The `grid-auto-flow` property controls how the auto-placement algorithm works, specifying exactly how auto-placed items get flowed into the grid. {{"demo": "pages/system/grid/GridAutoFlow.js", "defaultCodeOpen": false, "bg": true}} -```jsx - - 1 - 2 - 3 - 4 - 5 - -``` - ## Properties for the Children ### grid-column The `grid-column` property is a shorthand for `grid-column-start` + `grid-column-end`. You can see how it's used in the [grid-auto-columns example](/system/grid/#grid-auto-columns). +You can either set the start and end line: + ```jsx … ``` +Or set the number of columns to span: + +```jsx + +
    1
    +
    2
    +
    3
    +
    +``` + ### grid-row The `grid-row` property is a shorthand for `grid-row-start` + `grid-row-end`. You can see how it's used in the [grid-auto-rows example](/system/grid/#grid-auto-rows). +You can either set the start and end line: + ```jsx … ``` +Or set the number of rows to span: + +```jsx + +
    1
    +
    2
    +
    3
    +
    4
    +
    +``` + ### grid-area The `grid-area` property allows you to give an item a name so that it can be referenced by a template created with the `grid-template-areas` property. You can see how it's used in the [grid-template-area example](/system/grid/#grid-template-areas). @@ -179,7 +126,7 @@ The `grid-area` property allows you to give an item a name so that it can be ref import { flexbox } from '@material-ui/system'; ``` -| Import name | Prop | Propriété CSS | Clé du thème | +| Nom importé | Propriété | Propriété CSS | Clé du thème | |:--------------------- |:--------------------- |:----------------------- |:------------ | | `gap` | `gap` | `gap` | none | | `columnGap` | `columnGap` | `column-gap` | none | diff --git a/docs/src/pages/system/grid/grid-ja.md b/docs/src/pages/system/grid/grid-ja.md index 95fb949ffdbb21..784ffb1b59b9fb 100644 --- a/docs/src/pages/system/grid/grid-ja.md +++ b/docs/src/pages/system/grid/grid-ja.md @@ -1,16 +1,16 @@ -# Grid +# CSS Grid

    Quickly manage the layout, alignment, and sizing of grid columns, navigation, components, and more with a full suite of responsive grid utilities.

    -If you are **new to or unfamiliar with grid**, you're encourage to read this [CSS-Tricks grid](https://css-tricks.com/snippets/css/complete-guide-grid/) guide. +If you are **new to or unfamiliar with grid**, you're encouraged to read this [CSS-Tricks grid](https://css-tricks.com/snippets/css/complete-guide-grid/) guide. -## 親のプロパティ +## Properties for the parent ### display -In order to define a `grid` container you must specify the `display` CSS property to have one of the values: `grid` or `inline-grid`. +To define a `grid` container, you must specify the `display` CSS property to have one of the values: `grid` or `inline-grid`. -{{"demo": "pages/system/grid/Display.js", "defaultCodeOpen": false, "bg": true}} +{{"demo": "pages/system/grid/Display.js", "defaultCodeOpen": false}} ```jsx @@ -21,150 +21,86 @@ In order to define a `grid` container you must specify the `display` CSS propert The `grid-template-rows` property defines the line names and track sizing functions of the grid rows. -{{"demo": "pages/system/grid/GridTemplateRows.js", "defaultCodeOpen": false, "bg": true}} - -```jsx - -
    1
    -
    2
    -
    3
    -
    -``` +{{"demo": "pages/system/grid/GridTemplateRows.js", "bg": true}} ### grid-template-columns The `grid-template-columns` property defines the line names and track sizing functions of the grid columns. -{{"demo": "pages/system/grid/GridTemplateColumns.js", "defaultCodeOpen": false, "bg": true}} - -```jsx - -
    1
    -
    2
    -
    3
    -
    -``` +{{"demo": "pages/system/grid/GridTemplateColumns.js", "bg": true}} ### gap -The `gap: size` property specifies the gap between the different items inside the `grid`. - -{{"demo": "pages/system/grid/Gap.js", "defaultCodeOpen": false, "bg": true}} +The `gap: size` property specifies the gap between the different items inside the CSS grid. -```jsx - -
    1
    -
    2
    -
    3
    -
    4
    -
    -``` +{{"demo": "pages/system/grid/Gap.js", "bg": true}} ### row-gap & column-gap -The `row-gap` and `column-gap` gives the possibility for specifying the row and column gaps independently. +The `row-gap` and `column-gap` CSS properties allow for specifying the row and column gaps independently. -{{"demo": "pages/system/grid/RowAndColumnGap.js", "defaultCodeOpen": false, "bg": true}} - -```jsx - -
    1
    -
    2
    -
    3
    -
    4
    -
    -``` +{{"demo": "pages/system/grid/RowAndColumnGap.js", "bg": true}} ### grid-template-areas The `grid-template-area` property defines a grid template by referencing the names of the grid areas which are specified with the `grid-area` property. -{{"demo": "pages/system/grid/GridTemplateAreas.js", "defaultCodeOpen": false, "bg": true}} - -```jsx - - - - - - -``` +{{"demo": "pages/system/grid/GridTemplateAreas.js", "bg": true}} ### grid-auto-columns The `grid-auto-column` property specifies the size of an implicitly-created grid column track or pattern of tracks. -{{"demo": "pages/system/grid/GridAutoColumns.js", "defaultCodeOpen": false, "bg": true}} - -```jsx - - 1 / 3 - 4 / 5 - -``` +{{"demo": "pages/system/grid/GridAutoColumns.js", "bg": true}} -You can see on the screenshot below that the third non-visible column have width of `0.2fr`, which is approximately `20%`. - -
    - grid-auto-column -
    +On the demo above, the second non-visible column has a width of `1fr`/4 which is approximately equal to `25%`. ### grid-auto-rows The `grid-auto-rows` property specifies the size of an implicitly-created grid row track or pattern of tracks. -{{"demo": "pages/system/grid/GridAutoRows.js", "defaultCodeOpen": false, "bg": true}} - -```jsx - - {/* The third non-visible row has height of 40px */} - 1 / 3 - 4 / 5 - -``` +{{"demo": "pages/system/grid/GridAutoRows.js", "bg": true}} ### grid-auto-flow The `grid-auto-flow` property controls how the auto-placement algorithm works, specifying exactly how auto-placed items get flowed into the grid. -{{"demo": "pages/system/grid/GridAutoFlow.js", "defaultCodeOpen": false, "bg": true}} +{{"demo": "pages/system/grid/GridAutoFlow.js", "bg": true}} -```jsx - - 1 - 2 - 3 - 4 - 5 - -``` - -## 子供のプロパティ +## Properties for the children ### grid-column The `grid-column` property is a shorthand for `grid-column-start` + `grid-column-end`. You can see how it's used in the [grid-auto-columns example](/system/grid/#grid-auto-columns). +You can either set the start and end line: + ```jsx … ``` +Or set the number of columns to span: + +```jsx +… +``` + ### grid-row The `grid-row` property is a shorthand for `grid-row-start` + `grid-row-end`. You can see how it's used in the [grid-auto-rows example](/system/grid/#grid-auto-rows). +You can either set the start and end line: + ```jsx … ``` +Or set the number of rows to span: + +```jsx +… +``` + ### grid-area The `grid-area` property allows you to give an item a name so that it can be referenced by a template created with the `grid-template-areas` property. You can see how it's used in the [grid-template-area example](/system/grid/#grid-template-areas). diff --git a/docs/src/pages/system/grid/grid-pt.md b/docs/src/pages/system/grid/grid-pt.md index bcc93cd5c82ba1..c9767e383c4c20 100644 --- a/docs/src/pages/system/grid/grid-pt.md +++ b/docs/src/pages/system/grid/grid-pt.md @@ -1,16 +1,16 @@ -# Grid +# CSS Grid

    Quickly manage the layout, alignment, and sizing of grid columns, navigation, components, and more with a full suite of responsive grid utilities.

    -If you are **new to or unfamiliar with grid**, you're encourage to read this [CSS-Tricks grid](https://css-tricks.com/snippets/css/complete-guide-grid/) guide. +If you are **new to or unfamiliar with grid**, you're encouraged to read this [CSS-Tricks grid](https://css-tricks.com/snippets/css/complete-guide-grid/) guide. -## Propriedades para o pai +## Properties for the parent ### display -In order to define a `grid` container you must specify the `display` CSS property to have one of the values: `grid` or `inline-grid`. +To define a `grid` container, you must specify the `display` CSS property to have one of the values: `grid` or `inline-grid`. -{{"demo": "pages/system/grid/Display.js", "defaultCodeOpen": false, "bg": true}} +{{"demo": "pages/system/grid/Display.js", "defaultCodeOpen": false}} ```jsx @@ -21,148 +21,246 @@ In order to define a `grid` container you must specify the `display` CSS propert The `grid-template-rows` property defines the line names and track sizing functions of the grid rows. -{{"demo": "pages/system/grid/GridTemplateRows.js", "defaultCodeOpen": false, "bg": true}} - -```jsx - -
    1
    -
    2
    -
    3
    -
    -``` +{{"demo": "pages/system/grid/GridTemplateRows.js", "bg": true}} ### grid-template-columns The `grid-template-columns` property defines the line names and track sizing functions of the grid columns. -{{"demo": "pages/system/grid/GridTemplateColumns.js", "defaultCodeOpen": false, "bg": true}} - -```jsx - -
    1
    -
    2
    -
    3
    -
    -``` +{{"demo": "pages/system/grid/GridTemplateColumns.js", "bg": true}} ### gap -The `gap: size` property specifies the gap between the different items inside the `grid`. - -{{"demo": "pages/system/grid/Gap.js", "defaultCodeOpen": false, "bg": true}} +The `gap: size` property specifies the gap between the different items inside the CSS grid. -```jsx - -
    1
    -
    2
    -
    3
    -
    4
    -
    -``` +{{"demo": "pages/system/grid/Gap.js", "bg": true}} ### row-gap & column-gap -The `row-gap` and `column-gap` gives the possibility for specifying the row and column gaps independently. +The `row-gap` and `column-gap` CSS properties allow for specifying the row and column gaps independently. -{{"demo": "pages/system/grid/RowAndColumnGap.js", "defaultCodeOpen": false, "bg": true}} - -```jsx - -
    1
    -
    2
    -
    3
    -
    4
    -
    -``` +{{"demo": "pages/system/grid/RowAndColumnGap.js", "bg": true}} ### grid-template-areas The `grid-template-area` property defines a grid template by referencing the names of the grid areas which are specified with the `grid-area` property. -{{"demo": "pages/system/grid/GridTemplateAreas.js", "defaultCodeOpen": false, "bg": true}} - -```jsx - - - - - - -``` +{{"demo": "pages/system/grid/GridTemplateAreas.js", "bg": true}} ### grid-auto-columns The `grid-auto-column` property specifies the size of an implicitly-created grid column track or pattern of tracks. -{{"demo": "pages/system/grid/GridAutoColumns.js", "defaultCodeOpen": false, "bg": true}} - -```jsx - - 1 / 3 - 4 / 5 - -``` +{{"demo": "pages/system/grid/GridAutoColumns.js", "bg": true}} -You can see on the screenshot below that the third non-visible column have width of `0.2fr`, which is approximately `20%`. - -
    - grid-auto-column -
    +On the demo above, the second non-visible column has a width of `1fr`/4 which is approximately equal to `25%`. ### grid-auto-rows The `grid-auto-rows` property specifies the size of an implicitly-created grid row track or pattern of tracks. -{{"demo": "pages/system/grid/GridAutoRows.js", "defaultCodeOpen": false, "bg": true}} - -```jsx - - {/* The third non-visible row has height of 40px */} - 1 / 3 - 4 / 5 - -``` +{{"demo": "pages/system/grid/GridAutoRows.js", "bg": true}} ### grid-auto-flow The `grid-auto-flow` property controls how the auto-placement algorithm works, specifying exactly how auto-placed items get flowed into the grid. -{{"demo": "pages/system/grid/GridAutoFlow.js", "defaultCodeOpen": false, "bg": true}} +{{"demo": "pages/system/grid/GridAutoFlow.js", "bg": true}} -```jsx - - 1 - 2 - 3 - 4 - 5 - -``` - -## Propriedades para os Filhos +## Properties for the children ### grid-column The `grid-column` property is a shorthand for `grid-column-start` + `grid-column-end`. You can see how it's used in the [grid-auto-columns example](/system/grid/#grid-auto-columns). +You can either set the start and end line: + ```jsx +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +``` + +Or set the number of columns to span: + +```jsx +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… ``` ### grid-row The `grid-row` property is a shorthand for `grid-row-start` + `grid-row-end`. You can see how it's used in the [grid-auto-rows example](/system/grid/#grid-auto-rows). +You can either set the start and end line: + ```jsx +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +``` + +Or set the number of rows to span: + +```jsx +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… ``` ### grid-area @@ -170,7 +268,55 @@ The `grid-row` property is a shorthand for `grid-row-start` + `grid-row-end`. Yo The `grid-area` property allows you to give an item a name so that it can be referenced by a template created with the `grid-template-areas` property. You can see how it's used in the [grid-template-area example](/system/grid/#grid-template-areas). ```jsx +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… +… ``` ## API diff --git a/docs/src/pages/system/grid/grid-ru.md b/docs/src/pages/system/grid/grid-ru.md index 8cb91117e93b53..08996ccf320797 100644 --- a/docs/src/pages/system/grid/grid-ru.md +++ b/docs/src/pages/system/grid/grid-ru.md @@ -1,16 +1,16 @@ -# Grid +# CSS Grid

    Quickly manage the layout, alignment, and sizing of grid columns, navigation, components, and more with a full suite of responsive grid utilities.

    -If you are **new to or unfamiliar with grid**, you're encourage to read this [CSS-Tricks grid](https://css-tricks.com/snippets/css/complete-guide-grid/) guide. +If you are **new to or unfamiliar with grid**, you're encouraged to read this [CSS-Tricks grid](https://css-tricks.com/snippets/css/complete-guide-grid/) guide. -## Properties for the Parent +## Properties for the parent ### display -In order to define a `grid` container you must specify the `display` CSS property to have one of the values: `grid` or `inline-grid`. +To define a `grid` container, you must specify the `display` CSS property to have one of the values: `grid` or `inline-grid`. -{{"demo": "pages/system/grid/Display.js", "defaultCodeOpen": false, "bg": true}} +{{"demo": "pages/system/grid/Display.js", "defaultCodeOpen": false}} ```jsx @@ -21,150 +21,86 @@ In order to define a `grid` container you must specify the `display` CSS propert The `grid-template-rows` property defines the line names and track sizing functions of the grid rows. -{{"demo": "pages/system/grid/GridTemplateRows.js", "defaultCodeOpen": false, "bg": true}} - -```jsx - -
    1
    -
    2
    -
    3
    -
    -``` +{{"demo": "pages/system/grid/GridTemplateRows.js", "bg": true}} ### grid-template-columns The `grid-template-columns` property defines the line names and track sizing functions of the grid columns. -{{"demo": "pages/system/grid/GridTemplateColumns.js", "defaultCodeOpen": false, "bg": true}} - -```jsx - -
    1
    -
    2
    -
    3
    -
    -``` +{{"demo": "pages/system/grid/GridTemplateColumns.js", "bg": true}} ### gap -The `gap: size` property specifies the gap between the different items inside the `grid`. - -{{"demo": "pages/system/grid/Gap.js", "defaultCodeOpen": false, "bg": true}} +The `gap: size` property specifies the gap between the different items inside the CSS grid. -```jsx - -
    1
    -
    2
    -
    3
    -
    4
    -
    -``` +{{"demo": "pages/system/grid/Gap.js", "bg": true}} ### row-gap & column-gap -The `row-gap` and `column-gap` gives the possibility for specifying the row and column gaps independently. +The `row-gap` and `column-gap` CSS properties allow for specifying the row and column gaps independently. -{{"demo": "pages/system/grid/RowAndColumnGap.js", "defaultCodeOpen": false, "bg": true}} - -```jsx - -
    1
    -
    2
    -
    3
    -
    4
    -
    -``` +{{"demo": "pages/system/grid/RowAndColumnGap.js", "bg": true}} ### grid-template-areas The `grid-template-area` property defines a grid template by referencing the names of the grid areas which are specified with the `grid-area` property. -{{"demo": "pages/system/grid/GridTemplateAreas.js", "defaultCodeOpen": false, "bg": true}} - -```jsx - - - - - - -``` +{{"demo": "pages/system/grid/GridTemplateAreas.js", "bg": true}} ### grid-auto-columns The `grid-auto-column` property specifies the size of an implicitly-created grid column track or pattern of tracks. -{{"demo": "pages/system/grid/GridAutoColumns.js", "defaultCodeOpen": false, "bg": true}} - -```jsx - - 1 / 3 - 4 / 5 - -``` +{{"demo": "pages/system/grid/GridAutoColumns.js", "bg": true}} -You can see on the screenshot below that the third non-visible column have width of `0.2fr`, which is approximately `20%`. - -
    - grid-auto-column -
    +On the demo above, the second non-visible column has a width of `1fr`/4 which is approximately equal to `25%`. ### grid-auto-rows The `grid-auto-rows` property specifies the size of an implicitly-created grid row track or pattern of tracks. -{{"demo": "pages/system/grid/GridAutoRows.js", "defaultCodeOpen": false, "bg": true}} - -```jsx - - {/* The third non-visible row has height of 40px */} - 1 / 3 - 4 / 5 - -``` +{{"demo": "pages/system/grid/GridAutoRows.js", "bg": true}} ### grid-auto-flow The `grid-auto-flow` property controls how the auto-placement algorithm works, specifying exactly how auto-placed items get flowed into the grid. -{{"demo": "pages/system/grid/GridAutoFlow.js", "defaultCodeOpen": false, "bg": true}} +{{"demo": "pages/system/grid/GridAutoFlow.js", "bg": true}} -```jsx - - 1 - 2 - 3 - 4 - 5 - -``` - -## Properties for the Children +## Properties for the children ### grid-column The `grid-column` property is a shorthand for `grid-column-start` + `grid-column-end`. You can see how it's used in the [grid-auto-columns example](/system/grid/#grid-auto-columns). +You can either set the start and end line: + ```jsx … ``` +Or set the number of columns to span: + +```jsx +… +``` + ### grid-row The `grid-row` property is a shorthand for `grid-row-start` + `grid-row-end`. You can see how it's used in the [grid-auto-rows example](/system/grid/#grid-auto-rows). +You can either set the start and end line: + ```jsx … ``` +Or set the number of rows to span: + +```jsx +… +``` + ### grid-area The `grid-area` property allows you to give an item a name so that it can be referenced by a template created with the `grid-template-areas` property. You can see how it's used in the [grid-template-area example](/system/grid/#grid-template-areas). diff --git a/docs/src/pages/system/grid/grid-zh.md b/docs/src/pages/system/grid/grid-zh.md index f839423a5ad550..d70e1b7b4592c6 100644 --- a/docs/src/pages/system/grid/grid-zh.md +++ b/docs/src/pages/system/grid/grid-zh.md @@ -1,16 +1,16 @@ -# Grid +# CSS Grid

    Quickly manage the layout, alignment, and sizing of grid columns, navigation, components, and more with a full suite of responsive grid utilities.

    -If you are **new to or unfamiliar with grid**, you're encourage to read this [CSS-Tricks grid](https://css-tricks.com/snippets/css/complete-guide-grid/) guide. +If you are **new to or unfamiliar with grid**, you're encouraged to read this [CSS-Tricks grid](https://css-tricks.com/snippets/css/complete-guide-grid/) guide. -## 父元素的属性 +## Properties for the parent ### display -In order to define a `grid` container you must specify the `display` CSS property to have one of the values: `grid` or `inline-grid`. +To define a `grid` container, you must specify the `display` CSS property to have one of the values: `grid` or `inline-grid`. -{{"demo": "pages/system/grid/Display.js", "defaultCodeOpen": false, "bg": true}} +{{"demo": "pages/system/grid/Display.js", "defaultCodeOpen": false}} ```jsx @@ -21,156 +21,132 @@ In order to define a `grid` container you must specify the `display` CSS propert The `grid-template-rows` property defines the line names and track sizing functions of the grid rows. -{{"demo": "pages/system/grid/GridTemplateRows.js", "defaultCodeOpen": false, "bg": true}} - -```jsx - -
    1
    -
    2
    -
    3
    -
    -``` +{{"demo": "pages/system/grid/GridTemplateRows.js", "bg": true}} ### grid-template-columns The `grid-template-columns` property defines the line names and track sizing functions of the grid columns. -{{"demo": "pages/system/grid/GridTemplateColumns.js", "defaultCodeOpen": false, "bg": true}} - -```jsx - -
    1
    -
    2
    -
    3
    -
    -``` +{{"demo": "pages/system/grid/GridTemplateColumns.js", "bg": true}} ### gap -The `gap: size` property specifies the gap between the different items inside the `grid`. - -{{"demo": "pages/system/grid/Gap.js", "defaultCodeOpen": false, "bg": true}} +The `gap: size` property specifies the gap between the different items inside the CSS grid. -```jsx - -
    1
    -
    2
    -
    3
    -
    4
    -
    -``` +{{"demo": "pages/system/grid/Gap.js", "bg": true}} ### row-gap & column-gap -The `row-gap` and `column-gap` gives the possibility for specifying the row and column gaps independently. +The `row-gap` and `column-gap` CSS properties allow for specifying the row and column gaps independently. -{{"demo": "pages/system/grid/RowAndColumnGap.js", "defaultCodeOpen": false, "bg": true}} - -```jsx - -
    1
    -
    2
    -
    3
    -
    4
    -
    -``` +{{"demo": "pages/system/grid/RowAndColumnGap.js", "bg": true}} ### grid-template-areas The `grid-template-area` property defines a grid template by referencing the names of the grid areas which are specified with the `grid-area` property. -{{"demo": "pages/system/grid/GridTemplateAreas.js", "defaultCodeOpen": false, "bg": true}} - -```jsx - - - - - - -``` +{{"demo": "pages/system/grid/GridTemplateAreas.js", "bg": true}} ### grid-auto-columns The `grid-auto-column` property specifies the size of an implicitly-created grid column track or pattern of tracks. -{{"demo": "pages/system/grid/GridAutoColumns.js", "defaultCodeOpen": false, "bg": true}} - -```jsx - - 1 / 3 - 4 / 5 - -``` +{{"demo": "pages/system/grid/GridAutoColumns.js", "bg": true}} -You can see on the screenshot below that the third non-visible column have width of `0.2fr`, which is approximately `20%`. - -
    - grid-auto-column -
    +On the demo above, the second non-visible column has a width of `1fr`/4 which is approximately equal to `25%`. ### grid-auto-rows The `grid-auto-rows` property specifies the size of an implicitly-created grid row track or pattern of tracks. -{{"demo": "pages/system/grid/GridAutoRows.js", "defaultCodeOpen": false, "bg": true}} - -```jsx - - {/* The third non-visible row has height of 40px */} - 1 / 3 - 4 / 5 - -``` +{{"demo": "pages/system/grid/GridAutoRows.js", "bg": true}} ### grid-auto-flow The `grid-auto-flow` property controls how the auto-placement algorithm works, specifying exactly how auto-placed items get flowed into the grid. -{{"demo": "pages/system/grid/GridAutoFlow.js", "defaultCodeOpen": false, "bg": true}} +{{"demo": "pages/system/grid/GridAutoFlow.js", "bg": true}} -```jsx - - 1 - 2 - 3 - 4 - 5 - -``` - -## 子元素的属性 +## Properties for the children ### grid-column -The `grid-column` property is a shorthand for `grid-column-start` + `grid-column-end`. You can see how it's used in the [grid-auto-columns example](/system/grid/#grid-auto-columns). You can see how it's used in the [grid-auto-columns example](/system/grid/#grid-auto-columns). +The `grid-column` property is a shorthand for `grid-column-start` + `grid-column-end`. You can see how it's used in the [grid-auto-columns example](/system/grid/#grid-auto-columns). You can see how it's used in the [grid-auto-columns example](/system/grid/#grid-auto-columns). You can see how it's used in the [grid-auto-columns example](/system/grid/#grid-auto-columns). + +You can either set the start and end line: ```jsx … +… +… +… +… +… +… +… +… +``` + +Or set the number of columns to span: + +```jsx +… +… +… +… +… +… +… +… +… ``` ### grid-row -The `grid-row` property is a shorthand for `grid-row-start` + `grid-row-end`. You can see how it's used in the [grid-auto-rows example](/system/grid/#grid-auto-rows). You can see how it's used in the [grid-auto-rows example](/system/grid/#grid-auto-rows). +The `grid-row` property is a shorthand for `grid-row-start` + `grid-row-end`. You can see how it's used in the [grid-auto-rows example](/system/grid/#grid-auto-rows). You can see how it's used in the [grid-auto-rows example](/system/grid/#grid-auto-rows). You can see how it's used in the [grid-auto-rows example](/system/grid/#grid-auto-rows). + +You can either set the start and end line: ```jsx … +… +… +… +… +… +… +… +… +``` + +Or set the number of rows to span: + +```jsx +… +… +… +… +… +… +… +… +… ``` ### grid-area -The `grid-area` property allows you to give an item a name so that it can be referenced by a template created with the `grid-template-areas` property. You can see how it's used in the [grid-template-area example](/system/grid/#grid-template-areas). You can see how it's used in the [grid-template-area example](/system/grid/#grid-template-areas). +The `grid-area` property allows you to give an item a name so that it can be referenced by a template created with the `grid-template-areas` property. You can see how it's used in the [grid-template-area example](/system/grid/#grid-template-areas). You can see how it's used in the [grid-template-area example](/system/grid/#grid-template-areas). You can see how it's used in the [grid-template-area example](/system/grid/#grid-template-areas). ```jsx … +… +… +… +… +… +… +… +… ``` ## API diff --git a/docs/src/pages/system/palette/palette-fr.md b/docs/src/pages/system/palette/palette-fr.md index 6c9df6a0671137..2a8cf067a32b94 100644 --- a/docs/src/pages/system/palette/palette-fr.md +++ b/docs/src/pages/system/palette/palette-fr.md @@ -40,7 +40,7 @@ import { palette } from '@material-ui/system'; ``` -| Import name | Prop | Propriété CSS | Clé du thème | +| Nom importé | Propriété | Propriété CSS | Clé du thème | |:----------- |:--------- |:----------------- |:---------------------------------------------------------------- | | `color` | `color` | `color` | [`palette`](/customization/default-theme/?expand-path=$.palette) | | `bgcolor` | `bgcolor` | `backgroundColor` | [`palette`](/customization/default-theme/?expand-path=$.palette) | diff --git a/docs/src/pages/system/palette/palette-zh.md b/docs/src/pages/system/palette/palette-zh.md index a8ef7988ec1b50..495f484fa33809 100644 --- a/docs/src/pages/system/palette/palette-zh.md +++ b/docs/src/pages/system/palette/palette-zh.md @@ -27,11 +27,23 @@ … +… +… +… +… +… +… +… +… +… +… +… +… ``` ## 背景颜色 @@ -59,11 +71,23 @@ … +… +… +… +… +… +… +… +… +… +… +… +… ``` ## API diff --git a/docs/src/pages/system/positions/positions-fr.md b/docs/src/pages/system/positions/positions-fr.md index 358488f4bf6bfa..86e2e7289bac48 100644 --- a/docs/src/pages/system/positions/positions-fr.md +++ b/docs/src/pages/system/positions/positions-fr.md @@ -1,6 +1,6 @@ # Positions -

    Use these shorthand utilities for quickly configuring the position of an element.

    +

    Utilisez ces utilitaires de raccourci pour configurer rapidement la position d'un élément.

    ## z-index @@ -17,7 +17,7 @@ import { positions } from '@material-ui/system'; ``` -| Import name | Prop | Propriété CSS | Clé du thème | +| Nom importé | Propriété | Propriété CSS | Clé du thème | |:----------- |:---------- |:------------- |:-------------------------------------------------------------- | | `position` | `position` | `position` | none | | `zIndex` | `zIndex` | `z-index` | [`zIndex`](/customization/default-theme/?expand-path=$.zIndex) | diff --git a/docs/src/pages/system/properties/properties-de.md b/docs/src/pages/system/properties/properties-de.md index f35f98822c0862..51d70526bbc485 100644 --- a/docs/src/pages/system/properties/properties-de.md +++ b/docs/src/pages/system/properties/properties-de.md @@ -2,119 +2,129 @@

    This page lists all of the custom system properties, how are they linked with the theme, and which CSS properties they compute. All other regular CSS properties and selectors are supported too.

    +## Properties reference table + +Note that this table only lists custom properties, all other regular CSS properties and selectors are supported. You can check out the [legend](/system/properties/#legend) below. + +| System key(s) | CSS property/properties | System style function | Theme mapping | +|:--------------------- |:-------------------------------------------------------------------------------------------- |:------------------------------------------------------------ |:--------------------------------------------------------------------------------------- | +| `border` | `border` | [`border`](/system/borders/#border) | `${value}px solid` | +| `borderBottom` | `border-bottom` | [`borderBottom`](/system/borders/#border) | `${value}px solid` | +| `borderColor` | `border-color` | [`borderColor`](/system/borders/#border-color) | [`theme.palette[value]`](/customization/default-theme/?expand-path=$.palette) | +| `borderLeft` | `border-left` | [`borderLeft`](/system/borders/#border) | `${value}px solid` | +| `borderRadius` | `border-radius` | [`borderRadius`](/system/borders/#border-radius) | [`theme.shape.borderRadius * value`](/customization/default-theme/?expand-path=$.shape) | +| `borderRight` | `border-right` | [`borderRight`](/system/borders/#border) | `${value}px solid` | +| `borderTop` | `border-top` | [`borderTop`](/system/borders/#border) | `${value}px solid` | +| `boxShadow` | `box-shadow` | [`boxShadow`](/system/shadows/) | `theme.shadows[value]` | +| `displayPrint` | `display` | [`displayPrint`](/system/display/#display-in-print) | none | +| `display` | `display` | [`displayRaw`](/system/display/) | none | +| `alignContent` | `align-content` | [`alignContent`](/system/flexbox/#align-content) | none | +| `alignItems` | `align-items` | [`alignItems`](/system/flexbox/#align-items) | none | +| `alignSelf` | `align-self` | [`alignSelf`](/system/flexbox/#align-self) | none | +| `flex` | `flex` | [`flex`](/system/flexbox/) | none | +| `flexDirection` | `flex-direction` | [`flexDirection`](/system/flexbox/#flex-direction) | none | +| `flexGrow` | `flex-grow` | [`flexGrow`](/system/flexbox/#flex-grow) | none | +| `flexShrink` | `flex-shrink` | [`flexShrink`](/system/flexbox/#flex-shrink) | none | +| `flexWrap` | `flex-wrap` | [`flexWrap`](/system/flexbox/#flex-wrap) | none | +| `justifyContent` | `justify-content` | [`justifyContent`](/system/flexbox/#justify-content) | none | +| `order` | `order` | [`order`](/system/flexbox/#order) | none | +| `gap` | `gap` | [`gap`](/system/grid/#gap) | none | +| `columnGap` | `column-gap` | [`columnGap`](/system/grid/#row-gap-amp-column-gap) | none | +| `rowGap` | `row-gap` | [`rowGap`](/system/grid/#row-gap-amp-column-gap) | none | +| `gridColumn` | `grid-column` | [`gridColumn`](/system/grid/#grid-column) | none | +| `gridRow` | `grid-row` | [`gridRow`](/system/grid/#grid-row) | none | +| `gridAutoFlow` | `grid-auto-flow` | [`gridAutoFlow`](/system/grid/#grid-auto-flow) | none | +| `gridAutoColumns` | `grid-auto-columns` | [`gridAutoColumns`](/system/grid/#grid-auto-columns) | none | +| `gridAutoRows` | `grid-auto-rows` | [`gridAutoRows`](/system/grid/#grid-auto-rows) | none | +| `gridTemplateColumns` | `grid-template-columns` | [`gridTemplateColumns`](/system/grid/#grid-template-columns) | none | +| `gridTemplateRows` | `grid-template-rows` | [`gridTemplateRows`](/system/grid/#grid-template-rows) | none | +| `gridTemplateAreas` | `grid-template-areas` | [`gridTemplateAreas`](/system/grid/#grid-template-areas) | none | +| `gridArea` | `grid-area` | [`gridArea`](/system/grid/#grid-area) | none | +| `bgcolor` | `backgroundColor` | [`bgcolor`](/system/palette/#background-color) | [`theme.palette[value]`](/customization/default-theme/?expand-path=$.palette) | +| `color` | `color` | [`color`](/system/palette/#color) | [`theme.palette[value]`](/customization/default-theme/?expand-path=$.palette) | +| `bottom` | `bottom` | [`bottom`](/system/positions/) | none | +| `left` | `left` | [`left`](/system/positions/) | none | +| `position` | `position` | [`position`](/system/positions/) | none | +| `right` | `right` | [`right`](/system/positions/) | none | +| `top` | `top` | [`top`](/system/positions/) | none | +| `zIndex` | `z-index` | [`zIndex`](/system/positions/#z-index) | [`theme.zIndex[value]`](/customization/default-theme/?expand-path=$.zIndex) | +| `height` | `height` | [`height`](/system/sizing/#height) | none | +| `maxHeight` | `max-height` | [`maxHeight`](/system/sizing/) | none | +| `maxWidth` | `max-width` | [`maxWidth`](/system/sizing/) | none | +| `minHeight` | `min-height` | [`minHeight`](/system/sizing/) | none | +| `minWidth` | `min-width` | [`minWidth`](/system/sizing/) | none | +| `width` | `width` | [`width`](/system/sizing/#width) | none | +| `boxSizing` | `box-sizing` | [`boxSizing`](/system/sizing/) | none | +| `m`, `margin` | `margin` | [`spacing`](/system/spacing/) | [`theme.spacing(value)`](/customization/default-theme/?expand-path=$.spacing) | +| `mb`, `marginBottom` | `margin-bottom` | [`spacing`](/system/spacing/) | [`theme.spacing(value)`](/customization/default-theme/?expand-path=$.spacing) | +| `ml`, `marginLeft` | `margin-left` | [`spacing`](/system/spacing/) | [`theme.spacing(value)`](/customization/default-theme/?expand-path=$.spacing) | +| `mr`, `marginRight` | `margin-right` | [`spacing`](/system/spacing/) | [`theme.spacing(value)`](/customization/default-theme/?expand-path=$.spacing) | +| `mt`, `marginTop` | `margin-top` | [`spacing`](/system/spacing/) | [`theme.spacing(value)`](/customization/default-theme/?expand-path=$.spacing) | +| `mx`, `marginX` | `margin-left`, `margin-right` | [`spacing`](/system/spacing/) | [`theme.spacing(value)`](/customization/default-theme/?expand-path=$.spacing) | +| `my`, `marginY` | `margin-top`, `margin-bottom` | [`spacing`](/system/spacing/) | [`theme.spacing(value)`](/customization/default-theme/?expand-path=$.spacing) | +| `p`, `padding` | `padding` | [`spacing`](/system/spacing/) | [`theme.spacing(value)`](/customization/default-theme/?expand-path=$.spacing) | +| `pb`, `paddingBottom` | `padding-bottom` | [`spacing`](/system/spacing/) | [`theme.spacing(value)`](/customization/default-theme/?expand-path=$.spacing) | +| `pl`, `paddingLeft` | `padding-left` | [`spacing`](/system/spacing/) | [`theme.spacing(value)`](/customization/default-theme/?expand-path=$.spacing) | +| `pr`, `paddingRight` | `padding-right` | [`spacing`](/system/spacing/) | [`theme.spacing(value)`](/customization/default-theme/?expand-path=$.spacing) | +| `pt`, `paddingTop` | `padding-top` | [`spacing`](/system/spacing/) | [`theme.spacing(value)`](/customization/default-theme/?expand-path=$.spacing) | +| `px`, `paddingX` | `padding-left`, `padding-right` | [`spacing`](/system/spacing/) | [`theme.spacing(value)`](/customization/default-theme/?expand-path=$.spacing) | +| `py`, `paddingY` | `padding-top`, `padding-bottom` | [`spacing`](/system/spacing/) | [`theme.spacing(value)`](/customization/default-theme/?expand-path=$.spacing) | +| `typography` | `font-family`, `font-weight`, `font-size`, `line-height`, `letter-spacing`, `text-transform` | [`typography`](/system/typography/#variant) | [`theme.typography[value]`](/customization/default-theme/?expand-path=$.typography) | +| `fontFamily` | `font-family` | [`fontFamily`](/system/typography/#font-family) | [`theme.typography[value]`](/customization/default-theme/?expand-path=$.typography) | +| `fontSize` | `font-size` | [`fontSize`](/system/typography/#font-size) | [`theme.typography[value]`](/customization/default-theme/?expand-path=$.typography) | +| `fontStyle` | `font-style` | [`fontStyle`](/system/typography/#font-style) | [`theme.typography[value]`](/customization/default-theme/?expand-path=$.typography) | +| `fontWeight` | `font-weight` | [`fontWeight`](/system/typography/#font-weight) | [`theme.typography[value]`](/customization/default-theme/?expand-path=$.typography) | +| `letterSpacing` | `letter-spacing` | [`letterSpacing`](/system/typography/#letter-spacing) | [`theme.typography[value]`](/customization/default-theme/?expand-path=$.typography) | +| `lineHeight` | `line-height` | [`lineHeight`](/system/typography/#line-height) | [`theme.typography[value]`](/customization/default-theme/?expand-path=$.typography) | +| `textAlign` | `text-align` | [`textAlign`](/system/typography/#text-alignment) | none | + ## Legend -Let's take the following row from [the table below](#properties-reference-table), for example: +Let's take one row from [the table above](#properties-reference-table), for example: -| System style function | System key(s) | CSS property/properties | Theme mapping | -|:----------------------------- |:-------------------- |:----------------------- |:----------------------------------------------------------------------------- | -| [`spacing`](/system/spacing/) | `mb`, `marginBottom` | `margin-bottom` | [`theme.spacing(value)`](/customization/default-theme/?expand-path=$.spacing) | +| System key(s) | CSS property/properties | System style function | Theme mapping | +|:-------------------- |:----------------------- |:----------------------------- |:----------------------------------------------------------------------------- | +| `mb`, `marginBottom` | `margin-bottom` | [`spacing`](/system/spacing/) | [`theme.spacing(value)`](/customization/default-theme/?expand-path=$.spacing) | -### System style function +
    -The System style function column lists the function which generates the properties shown in the other columns, as a reference in case you want to add this functionality to your custom components. The functions can be imported from `@material-ui/system`. You can see an example of using the style functions on the [advanced page](/system/advanced/#using-standalone-system-utilities). The content links to the documentation page where this properties are described; in this example, the [spacing](/system/spacing/) page. +and detail each column: -### System keys +- **System keys**. The column lists the key(s) by which you can use this property with the `sx` prop (or as a system function). -The System keys column lists the key(s) by which you can use this property with the `sx` prop (or as a system function). + ```jsx + ); - expect(markup.text()).to.equal('Hello World'); + const container = serverRender(); + expect(container.firstChild).to.have.text('Hello World'); }); }); diff --git a/packages/material-ui/src/ButtonBase/ButtonBase.js b/packages/material-ui/src/ButtonBase/ButtonBase.js index 6bc5371a644ebb..e69ac1fd7344e9 100644 --- a/packages/material-ui/src/ButtonBase/ButtonBase.js +++ b/packages/material-ui/src/ButtonBase/ButtonBase.js @@ -283,7 +283,7 @@ const ButtonBase = React.forwardRef(function ButtonBase(inProps, ref) { let ComponentProp = component; - if (ComponentProp === 'button' && other.href) { + if (ComponentProp === 'button' && (other.href || other.to)) { ComponentProp = LinkComponent; } @@ -292,7 +292,7 @@ const ButtonBase = React.forwardRef(function ButtonBase(inProps, ref) { buttonProps.type = type === undefined ? 'button' : type; buttonProps.disabled = disabled; } else { - if (!other.href) { + if (!other.href && !other.to) { buttonProps.role = 'button'; } if (disabled) { diff --git a/packages/material-ui/src/ButtonBase/ButtonBase.test.js b/packages/material-ui/src/ButtonBase/ButtonBase.test.js index 7424331e5aa105..b7e56b4d85f7af 100644 --- a/packages/material-ui/src/ButtonBase/ButtonBase.test.js +++ b/packages/material-ui/src/ButtonBase/ButtonBase.test.js @@ -133,7 +133,7 @@ describe('', () => { expect(button).not.to.have.attribute('type'); }); - it('should not add role="button" if custom LinkComponent and href are used', () => { + it('should not add role="button" if custom component and href are used', () => { const CustomLink = React.forwardRef((props, ref) => { return ( @@ -143,7 +143,8 @@ describe('', () => { }); const { container } = render( - + // @ts-expect-error missing types in CustomLink + Hello , ); @@ -153,6 +154,27 @@ describe('', () => { expect(button).to.have.attribute('href', 'https://google.com'); expect(button).not.to.have.attribute('role', 'button'); }); + + it('should not add role="button" if custom component and to are used', () => { + const CustomLink = React.forwardRef((props, ref) => { + // @ts-expect-error missing types in CustomLink + const { to, ...other } = props; + return ( + + {props.children} + + ); + }); + + const { container } = render( + // @ts-expect-error missing types in CustomLink + + Hello + , + ); + const button = container.firstChild; + expect(button).not.to.have.attribute('role', 'button'); + }); }); describe('event callbacks', () => { diff --git a/packages/material-ui/src/ButtonBase/Ripple.js b/packages/material-ui/src/ButtonBase/Ripple.js index 18867f66d1d5bb..ae9ac4f6e965d1 100644 --- a/packages/material-ui/src/ButtonBase/Ripple.js +++ b/packages/material-ui/src/ButtonBase/Ripple.js @@ -1,8 +1,6 @@ import * as React from 'react'; import PropTypes from 'prop-types'; import clsx from 'clsx'; -import useEventCallback from '../utils/useEventCallback'; -import useEnhancedEffect from '../utils/useEnhancedEffect'; /** * @ignore - internal component. @@ -16,7 +14,7 @@ function Ripple(props) { rippleY, rippleSize, in: inProp, - onExited = () => {}, + onExited, timeout, } = props; const [leaving, setLeaving] = React.useState(false); @@ -37,21 +35,19 @@ function Ripple(props) { [classes.childPulsate]: pulsate, }); - const handleExited = useEventCallback(onExited); - // Ripple is used for user feedback (e.g. click or press) so we want to apply styles with the highest priority - useEnhancedEffect(() => { - if (!inProp) { - // react-transition-group#onExit - setLeaving(true); - + if (!inProp && !leaving) { + setLeaving(true); + } + React.useEffect(() => { + if (!inProp && onExited != null) { // react-transition-group#onExited - const timeoutId = setTimeout(handleExited, timeout); + const timeoutId = setTimeout(onExited, timeout); return () => { clearTimeout(timeoutId); }; } return undefined; - }, [handleExited, inProp, timeout]); + }, [onExited, inProp, timeout]); return ( diff --git a/packages/material-ui/src/ButtonBase/TouchRipple.js b/packages/material-ui/src/ButtonBase/TouchRipple.js index 59bf23e6b5658c..e030816d604cc3 100644 --- a/packages/material-ui/src/ButtonBase/TouchRipple.js +++ b/packages/material-ui/src/ButtonBase/TouchRipple.js @@ -2,7 +2,7 @@ import * as React from 'react'; import PropTypes from 'prop-types'; import { TransitionGroup } from 'react-transition-group'; import clsx from 'clsx'; -import { keyframes } from '@material-ui/styled-engine'; +import { keyframes } from '@material-ui/system'; import styled from '../styles/styled'; import useThemeProps from '../styles/useThemeProps'; import Ripple from './Ripple'; diff --git a/packages/material-ui/src/Checkbox/Checkbox.d.ts b/packages/material-ui/src/Checkbox/Checkbox.d.ts index e54cdf08ec7d64..2b68350cb2f54f 100644 --- a/packages/material-ui/src/Checkbox/Checkbox.d.ts +++ b/packages/material-ui/src/Checkbox/Checkbox.d.ts @@ -28,7 +28,10 @@ export interface CheckboxProps * The color of the component. It supports those theme colors that make sense for this component. * @default 'primary' */ - color?: OverridableStringUnion<'primary' | 'secondary' | 'default', CheckboxPropsColorOverrides>; + color?: OverridableStringUnion< + 'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning' | 'default', + CheckboxPropsColorOverrides + >; /** * If `true`, the component is disabled. */ diff --git a/packages/material-ui/src/Checkbox/Checkbox.js b/packages/material-ui/src/Checkbox/Checkbox.js index 82f65273519727..1bbaa12e297509 100644 --- a/packages/material-ui/src/Checkbox/Checkbox.js +++ b/packages/material-ui/src/Checkbox/Checkbox.js @@ -143,7 +143,7 @@ Checkbox.propTypes /* remove-proptypes */ = { * @default 'primary' */ color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([ - PropTypes.oneOf(['default', 'primary', 'secondary']), + PropTypes.oneOf(['default', 'primary', 'secondary', 'error', 'info', 'succes', 'warning']), PropTypes.string, ]), /** diff --git a/packages/material-ui/src/Chip/Chip.d.ts b/packages/material-ui/src/Chip/Chip.d.ts index bc0e8e7da17493..cd5326f91eed80 100644 --- a/packages/material-ui/src/Chip/Chip.d.ts +++ b/packages/material-ui/src/Chip/Chip.d.ts @@ -1,7 +1,7 @@ import * as React from 'react'; import { OverridableStringUnion } from '@material-ui/types'; import { SxProps } from '@material-ui/system'; -import { PropTypes, Theme } from '..'; +import { Theme } from '..'; import { OverridableComponent, OverrideProps } from '../OverridableComponent'; import { ChipClasses } from './chipClasses'; @@ -39,7 +39,10 @@ export interface ChipTypeMap

    { * The color of the component. It supports those theme colors that make sense for this component. * @default 'default' */ - color?: OverridableStringUnion, ChipPropsColorOverrides>; + color?: OverridableStringUnion< + 'default' | 'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning', + ChipPropsColorOverrides + >; /** * Override the default delete icon element. Shown only if `onDelete` is set. */ diff --git a/packages/material-ui/src/Chip/Chip.js b/packages/material-ui/src/Chip/Chip.js index ca28da50fd5575..187594761d44e7 100644 --- a/packages/material-ui/src/Chip/Chip.js +++ b/packages/material-ui/src/Chip/Chip.js @@ -512,7 +512,7 @@ Chip.propTypes /* remove-proptypes */ = { * @default 'default' */ color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([ - PropTypes.oneOf(['default', 'primary', 'secondary']), + PropTypes.oneOf(['default', 'primary', 'secondary', 'error', 'info', 'success', 'warning']), PropTypes.string, ]), /** diff --git a/packages/material-ui/src/CircularProgress/CircularProgress.d.ts b/packages/material-ui/src/CircularProgress/CircularProgress.d.ts index 5309b097166601..c96cd354671b4f 100644 --- a/packages/material-ui/src/CircularProgress/CircularProgress.d.ts +++ b/packages/material-ui/src/CircularProgress/CircularProgress.d.ts @@ -17,7 +17,7 @@ export interface CircularProgressProps * @default 'primary' */ color?: OverridableStringUnion< - 'primary' | 'secondary' | 'inherit', + 'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning' | 'inherit', CircularProgressPropsColorOverrides >; /** diff --git a/packages/material-ui/src/CircularProgress/CircularProgress.js b/packages/material-ui/src/CircularProgress/CircularProgress.js index 5809f125e32285..e3a433cfafba1c 100644 --- a/packages/material-ui/src/CircularProgress/CircularProgress.js +++ b/packages/material-ui/src/CircularProgress/CircularProgress.js @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import clsx from 'clsx'; import { chainPropTypes } from '@material-ui/utils'; import { unstable_composeClasses as composeClasses } from '@material-ui/unstyled'; -import { keyframes, css } from '@material-ui/styled-engine'; +import { keyframes, css } from '@material-ui/system'; import capitalize from '../utils/capitalize'; import useThemeProps from '../styles/useThemeProps'; import styled from '../styles/styled'; @@ -222,7 +222,7 @@ CircularProgress.propTypes /* remove-proptypes */ = { * @default 'primary' */ color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([ - PropTypes.oneOf(['inherit', 'primary', 'secondary']), + PropTypes.oneOf(['inherit', 'primary', 'secondary', 'error', 'info', 'success', 'warning']), PropTypes.string, ]), /** diff --git a/packages/material-ui/src/Dialog/Dialog.d.ts b/packages/material-ui/src/Dialog/Dialog.d.ts index 6cabefb458f7d6..4958ccfb8bfd34 100644 --- a/packages/material-ui/src/Dialog/Dialog.d.ts +++ b/packages/material-ui/src/Dialog/Dialog.d.ts @@ -3,11 +3,10 @@ import { SxProps, Breakpoint } from '@material-ui/system'; import { InternalStandardProps as StandardProps, Theme } from '..'; import { PaperProps } from '../Paper'; import { ModalProps } from '../Modal'; -import { TransitionHandlerProps, TransitionProps } from '../transitions/transition'; +import { TransitionProps } from '../transitions/transition'; import { DialogClasses } from './dialogClasses'; -export interface DialogProps - extends StandardProps, 'children'> { +export interface DialogProps extends StandardProps { /** * The id(s) of the element(s) that describe the dialog. */ diff --git a/packages/material-ui/src/Dialog/Dialog.js b/packages/material-ui/src/Dialog/Dialog.js index ee53cac6824909..dfd12a1476e9fa 100644 --- a/packages/material-ui/src/Dialog/Dialog.js +++ b/packages/material-ui/src/Dialog/Dialog.js @@ -2,6 +2,7 @@ import * as React from 'react'; import PropTypes from 'prop-types'; import clsx from 'clsx'; import { unstable_composeClasses as composeClasses } from '@material-ui/unstyled'; +import { unstable_useId as useId } from '@material-ui/utils'; import capitalize from '../utils/capitalize'; import Modal from '../Modal'; import Fade from '../Fade'; @@ -10,6 +11,7 @@ import Paper from '../Paper'; import useThemeProps from '../styles/useThemeProps'; import styled from '../styles/styled'; import dialogClasses, { getDialogUtilityClass } from './dialogClasses'; +import DialogContext from './DialogContext'; import Backdrop from '../Backdrop'; const DialogBackdrop = styled(Backdrop, { @@ -170,7 +172,7 @@ const Dialog = React.forwardRef(function Dialog(inProps, ref) { const props = useThemeProps({ props: inProps, name: 'MuiDialog' }); const { 'aria-describedby': ariaDescribedby, - 'aria-labelledby': ariaLabelledby, + 'aria-labelledby': ariaLabelledbyProp, BackdropComponent, BackdropProps, children, @@ -225,6 +227,11 @@ const Dialog = React.forwardRef(function Dialog(inProps, ref) { } }; + const ariaLabelledby = useId(ariaLabelledbyProp); + const dialogContextValue = React.useMemo(() => { + return { titleId: ariaLabelledby }; + }, [ariaLabelledby]); + return ( - {children} + {children} @@ -290,6 +297,15 @@ Dialog.propTypes /* remove-proptypes */ = { 'aria-labelledby': PropTypes.string, /** * A backdrop component. This prop enables custom backdrop rendering. + * @default styled(Backdrop, { + * name: 'MuiModal', + * slot: 'Backdrop', + * overridesResolver: (props, styles) => { + * return styles.backdrop; + * }, + * })({ + * zIndex: -1, + * }) */ BackdropComponent: PropTypes.elementType, /** diff --git a/packages/material-ui/src/Dialog/DialogContext.ts b/packages/material-ui/src/Dialog/DialogContext.ts new file mode 100644 index 00000000000000..ab2558ff6ae81c --- /dev/null +++ b/packages/material-ui/src/Dialog/DialogContext.ts @@ -0,0 +1,13 @@ +import { createContext } from 'react'; + +interface DialogContextValue { + titleId?: string; +} + +const DialogContext = createContext({}); + +if (process.env.NODE_ENV !== 'production') { + DialogContext.displayName = 'DialogContext'; +} + +export default DialogContext; diff --git a/packages/material-ui/src/DialogTitle/DialogTitle.js b/packages/material-ui/src/DialogTitle/DialogTitle.js index 075c815f7eed84..583d7c74eec7fc 100644 --- a/packages/material-ui/src/DialogTitle/DialogTitle.js +++ b/packages/material-ui/src/DialogTitle/DialogTitle.js @@ -6,6 +6,7 @@ import Typography from '../Typography'; import styled from '../styles/styled'; import useThemeProps from '../styles/useThemeProps'; import { getDialogTitleUtilityClass } from './dialogTitleClasses'; +import DialogContext from '../Dialog/DialogContext'; const useUtilityClasses = (styleProps) => { const { classes } = styleProps; @@ -32,10 +33,12 @@ const DialogTitle = React.forwardRef(function DialogTitle(inProps, ref) { name: 'MuiDialogTitle', }); - const { className, ...other } = props; + const { className, id: idProp, ...other } = props; const styleProps = props; const classes = useUtilityClasses(styleProps); + const { titleId: id = idProp } = React.useContext(DialogContext); + return ( ); @@ -65,6 +69,10 @@ DialogTitle.propTypes /* remove-proptypes */ = { * @ignore */ className: PropTypes.string, + /** + * @ignore + */ + id: PropTypes.string, /** * The system prop that allows defining system overrides as well as additional CSS styles. */ diff --git a/packages/material-ui/src/Divider/Divider.js b/packages/material-ui/src/Divider/Divider.js index ea970940c6c50f..a4488bb89a12a0 100644 --- a/packages/material-ui/src/Divider/Divider.js +++ b/packages/material-ui/src/Divider/Divider.js @@ -274,7 +274,7 @@ Divider.propTypes /* remove-proptypes */ = { /** * @ignore */ - role: PropTypes.string, + role: PropTypes /* @typescript-to-proptypes-ignore */.string, /** * The system prop that allows defining system overrides as well as additional CSS styles. */ diff --git a/packages/material-ui/src/Drawer/Drawer.d.ts b/packages/material-ui/src/Drawer/Drawer.d.ts index 72c5c8c2175623..70f3fa5d303257 100644 --- a/packages/material-ui/src/Drawer/Drawer.d.ts +++ b/packages/material-ui/src/Drawer/Drawer.d.ts @@ -4,11 +4,10 @@ import { InternalStandardProps as StandardProps, Theme } from '..'; import { ModalProps } from '../Modal'; import { SlideProps } from '../Slide'; import { PaperProps } from '../Paper'; -import { TransitionHandlerProps, TransitionProps } from '../transitions/transition'; +import { TransitionProps } from '../transitions/transition'; import { DrawerClasses } from './drawerClasses'; -export interface DrawerProps - extends StandardProps, 'open' | 'children'> { +export interface DrawerProps extends StandardProps { /** * Side from which the drawer will appear. * @default 'left' diff --git a/packages/material-ui/src/Drawer/Drawer.js b/packages/material-ui/src/Drawer/Drawer.js index bed515f56516a9..73f4e2cb6482c9 100644 --- a/packages/material-ui/src/Drawer/Drawer.js +++ b/packages/material-ui/src/Drawer/Drawer.js @@ -45,7 +45,9 @@ const DrawerRoot = styled(Modal, { name: 'MuiDrawer', slot: 'Root', overridesResolver, -})({}); +})(({ theme }) => ({ + zIndex: theme.zIndex.drawer, +})); const DrawerDockedRoot = styled('div', { shouldForwardProp: rootShouldForwardProp, diff --git a/packages/material-ui/src/Drawer/Drawer.test.js b/packages/material-ui/src/Drawer/Drawer.test.js index 95fecdfc267832..a267662272fc41 100644 --- a/packages/material-ui/src/Drawer/Drawer.test.js +++ b/packages/material-ui/src/Drawer/Drawer.test.js @@ -1,19 +1,23 @@ import * as React from 'react'; import { expect } from 'chai'; -import { - findOutermostIntrinsic, - createMount, - createClientRender, - describeConformanceV5, -} from 'test/utils'; +import { useFakeTimers, spy } from 'sinon'; +import { act, createMount, createClientRender, describeConformanceV5, screen } from 'test/utils'; import { ThemeProvider, createTheme } from '@material-ui/core/styles'; -import Slide from '@material-ui/core/Slide'; -import Paper from '@material-ui/core/Paper'; -import Modal from '@material-ui/core/Modal'; import Drawer, { drawerClasses as classes } from '@material-ui/core/Drawer'; import { getAnchor, isHorizontal } from './Drawer'; describe('', () => { + /** + * @type {ReturnType} + */ + let clock; + beforeEach(() => { + clock = useFakeTimers(); + }); + afterEach(() => { + clock.restore(); + }); + const render = createClientRender(); const mount = createMount(); @@ -41,183 +45,152 @@ describe('', () => { ); describe('prop: variant=temporary', () => { - it('should render a Modal', () => { - const wrapper = mount( - -

    - , - ); - expect(wrapper.find(Modal).exists()).to.equal(true); - }); - - it('should render Slide > Paper inside the Modal', () => { - const wrapper = mount( - -
    - , - ); - const modal = wrapper.find(Modal); - - const slide = modal.find(Slide); - expect(slide.exists()).to.equal(true); - - const paper = slide.find(Paper); - expect(paper.exists()).to.equal(true); - expect(paper.hasClass(classes.paper)).to.equal(true); - }); - describe('transitionDuration property', () => { const transitionDuration = { enter: 854, exit: 2967, }; - it('should be passed to Slide', () => { - const wrapper = mount( - + it('delay the slide transition to complete', () => { + const handleEntered = spy(); + const { setProps } = render( +
    , ); - expect(wrapper.find(Slide).props().timeout).to.equal(transitionDuration); - }); - it("should be passed to to Modal's BackdropTransitionDuration when open=true", () => { - const wrapper = mount( - -
    - , - ); - expect(wrapper.find(Modal).props().BackdropProps.transitionDuration).to.equal( - transitionDuration, - ); - }); - }); + setProps({ open: true }); - it("should override Modal's BackdropTransitionDuration from prop when specified", () => { - const testDuration = 335; - const wrapper = mount( - -
    - , - ); - expect(wrapper.find(Modal).props().BackdropTransitionDuration).to.equal(testDuration); + expect(handleEntered.callCount).to.equal(0); + + act(() => { + clock.tick(transitionDuration.enter); + }); + + expect(handleEntered.callCount).to.equal(1); + }); }); it('should set the custom className for Modal when variant is temporary', () => { - const wrapper = mount( - -

    Hello

    + render( + +
    , ); - const modal = wrapper.find(Modal); - - expect(modal.hasClass('woofDrawer')).to.equal(true); + expect(document.querySelector(`.${classes.modal}`)).to.have.class('woofDrawer'); }); it('should set the Paper className', () => { - const wrapper = mount( + render( -

    Hello

    +
    , ); - const paper = wrapper.find(Paper); - expect(paper.hasClass(classes.paper)).to.equal(true); - expect(paper.hasClass('woofDrawer')).to.equal(true); + + expect(document.querySelector(`.${classes.paper}`)).to.have.class('woofDrawer'); }); it('should be closed by default', () => { - const wrapper = mount( + render( -

    Hello

    +
    , ); - const modal = wrapper.find(Modal); - - expect(modal.props().open).to.equal(false); + expect(screen.queryByTestId('child')).to.equal(null); }); describe('opening and closing', () => { + const transitionDuration = 123; const drawerElement = ( - -

    Hello

    + +
    ); - it('should start closed', () => { - const wrapper = mount(drawerElement); - expect(wrapper.find(Modal).props().open).to.equal(false); - }); - it('should open and close', () => { - const wrapper = mount(drawerElement); + const { setProps } = render(drawerElement); + + setProps({ open: true }); - wrapper.setProps({ open: true }); - wrapper.update(); - expect(wrapper.find(Slide).props().in).to.equal(true); + expect(screen.getByTestId('child')).not.to.equal(null); - wrapper.setProps({ open: false }); - wrapper.update(); - expect(wrapper.find(Slide).props().in).to.equal(false); + setProps({ open: false }); + act(() => { + clock.tick(transitionDuration); + }); + + expect(screen.queryByTestId('child')).to.equal(null); }); }); }); describe('prop: variant=persistent', () => { - const drawerElement = ( - -

    Hello

    -
    - ); - it('should render a div instead of a Modal when persistent', () => { - const wrapper = mount(drawerElement); - const root = findOutermostIntrinsic(wrapper); - expect(root.type()).to.equal('div'); - expect(root.hasClass(classes.docked)).to.equal(true); + const { container } = render( + +
    + , + ); + + expect(container.firstChild).to.have.tagName('div'); + expect(container.firstChild).to.have.class(classes.docked); }); it('should render Slide > Paper inside the div', () => { - const wrapper = mount(drawerElement); - const div = wrapper.find('div').first(); - const slide = div.childAt(0); - expect(slide.length).to.equal(1); - expect(slide.type()).to.equal(Slide); - - const paper = findOutermostIntrinsic(slide); - expect(paper.exists()).to.equal(true); - expect(paper.hasClass(classes.paper)).to.equal(true); + const transitionDuration = 123; + const handleEntered = spy(); + const { container, setProps } = render( + +
    + , + ); + + setProps({ open: true }); + + expect(handleEntered.callCount).to.equal(0); + + act(() => { + clock.tick(transitionDuration); + }); + + expect(handleEntered.callCount).to.equal(1); + expect(container.firstChild.firstChild).to.have.class(classes.paper); }); }); describe('prop: variant=permanent', () => { const drawerElement = ( -

    Hello

    +
    ); it('should render a div instead of a Modal when permanent', () => { const { container } = render(drawerElement); const root = container.querySelector(`.${classes.root}`); + + expect(root).not.to.equal(null); expect(root).to.have.tagName('div'); expect(root).to.have.class(classes.docked); }); - - it('should render div > Paper inside the div', () => { - const wrapper = mount(drawerElement); - - const root = wrapper.find(`div.${classes.root}`); - expect(root.exists()).to.equal(true); - }); }); describe('prop: PaperProps', () => { it('should merge class names', () => { const { container } = render( -

    Hello

    +
    , ); expect(container.querySelector(`.${classes.paper}`)).to.have.class('my-class'); @@ -226,50 +199,77 @@ describe('', () => { describe('slide direction', () => { it('should return the opposing slide direction', () => { - const wrapper = mount( - + const MockedSlide = React.forwardRef(function MockedSlide(props, ref) { + const { children, in: inProp, direction } = props; + + if (!inProp) { + return null; + } + + return ( +
    + {children} +
    + ); + }); + + const { setProps } = render( +
    , ); - wrapper.setProps({ anchor: 'left' }); - expect(wrapper.find(Slide).props().direction).to.equal('right'); + setProps({ anchor: 'left' }); + expect(screen.getByTestId('slide')).to.have.attribute('data-direction', 'right'); - wrapper.setProps({ anchor: 'right' }); - expect(wrapper.find(Slide).props().direction).to.equal('left'); + setProps({ anchor: 'right' }); + expect(screen.getByTestId('slide')).to.have.attribute('data-direction', 'left'); - wrapper.setProps({ anchor: 'top' }); - expect(wrapper.find(Slide).props().direction).to.equal('down'); + setProps({ anchor: 'top' }); + expect(screen.getByTestId('slide')).to.have.attribute('data-direction', 'down'); - wrapper.setProps({ anchor: 'bottom' }); - expect(wrapper.find(Slide).props().direction).to.equal('up'); + setProps({ anchor: 'bottom' }); + expect(screen.getByTestId('slide')).to.have.attribute('data-direction', 'up'); }); }); describe('Right To Left', () => { it('should switch left and right anchor when theme is right-to-left', () => { + const MockedSlide = React.forwardRef(function MockedSlide(props, ref) { + const { children, in: inProp, direction } = props; + + if (!inProp) { + return null; + } + + return ( +
    + {children} +
    + ); + }); const theme = createTheme({ direction: 'rtl', }); - const wrapper1 = mount( + const { rerender } = render( - +
    , ); // slide direction for left is right, if left is switched to right, we should get left - expect(wrapper1.find(Slide).props().direction).to.equal('left'); + expect(screen.getByTestId('slide')).to.have.attribute('data-direction', 'left'); - const wrapper2 = mount( + rerender( - +
    , ); // slide direction for right is left, if right is switched to left, we should get right - expect(wrapper2.find(Slide).props().direction).to.equal('right'); + expect(screen.getByTestId('slide')).to.have.attribute('data-direction', 'right'); }); }); @@ -299,4 +299,20 @@ describe('', () => { expect(getAnchor(theme, 'right')).to.equal('left'); }); }); + + describe('zIndex', () => { + it('should set correct zIndex on the root element', () => { + const theme = createTheme(); + render( + + +
    + + , + ); + expect(document.querySelector(`.${classes.root}`)).toHaveComputedStyle({ + zIndex: String(theme.zIndex.drawer), + }); + }); + }); }); diff --git a/packages/material-ui/src/Fab/Fab.test.js b/packages/material-ui/src/Fab/Fab.test.js index c8e182abf3ea8d..23bd45699ce43b 100644 --- a/packages/material-ui/src/Fab/Fab.test.js +++ b/packages/material-ui/src/Fab/Fab.test.js @@ -163,8 +163,8 @@ describe('', () => { }); it('should server-side render', () => { - const markup = serverRender(Fab); - expect(markup.text()).to.equal('Fab'); + const container = serverRender(Fab); + expect(container.firstChild).to.have.text('Fab'); }); }); }); diff --git a/packages/material-ui/src/FormControl/FormControl.d.ts b/packages/material-ui/src/FormControl/FormControl.d.ts index f84bf2c43d4da9..1f089645ff5aa9 100644 --- a/packages/material-ui/src/FormControl/FormControl.d.ts +++ b/packages/material-ui/src/FormControl/FormControl.d.ts @@ -22,7 +22,10 @@ export interface FormControlTypeMap

    * The color of the component. It supports those theme colors that make sense for this component. * @default 'primary' */ - color?: OverridableStringUnion<'primary' | 'secondary', FormControlPropsColorOverrides>; + color?: OverridableStringUnion< + 'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning', + FormControlPropsColorOverrides + >; /** * If `true`, the label, input and helper text should be displayed in a disabled state. * @default false diff --git a/packages/material-ui/src/FormControl/FormControl.js b/packages/material-ui/src/FormControl/FormControl.js index 6a921d24795415..700a86b63aea52 100644 --- a/packages/material-ui/src/FormControl/FormControl.js +++ b/packages/material-ui/src/FormControl/FormControl.js @@ -249,7 +249,7 @@ FormControl.propTypes /* remove-proptypes */ = { * @default 'primary' */ color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([ - PropTypes.oneOf(['primary', 'secondary']), + PropTypes.oneOf(['primary', 'secondary', 'error', 'info', 'success', 'warning']), PropTypes.string, ]), /** diff --git a/packages/material-ui/src/FormLabel/FormLabel.d.ts b/packages/material-ui/src/FormLabel/FormLabel.d.ts index 3b5495ef0bea20..bf35b8482c92fe 100644 --- a/packages/material-ui/src/FormLabel/FormLabel.d.ts +++ b/packages/material-ui/src/FormLabel/FormLabel.d.ts @@ -18,7 +18,7 @@ export interface FormLabelTypeMap

    /** * The color of the component. It supports those theme colors that make sense for this component. */ - color?: 'primary' | 'secondary'; + color?: 'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning'; /** * If `true`, the label should be displayed in a disabled state. */ diff --git a/packages/material-ui/src/FormLabel/FormLabel.js b/packages/material-ui/src/FormLabel/FormLabel.js index b3dcbffcd50de9..a421495654e071 100644 --- a/packages/material-ui/src/FormLabel/FormLabel.js +++ b/packages/material-ui/src/FormLabel/FormLabel.js @@ -136,7 +136,7 @@ FormLabel.propTypes /* remove-proptypes */ = { /** * The color of the component. It supports those theme colors that make sense for this component. */ - color: PropTypes.oneOf(['primary', 'secondary']), + color: PropTypes.oneOf(['error', 'info', 'primary', 'secondary', 'success', 'warning']), /** * The component used for the root node. * Either a string to use a HTML element or a component. diff --git a/packages/material-ui/src/GlobalStyles/GlobalStyles.d.ts b/packages/material-ui/src/GlobalStyles/GlobalStyles.d.ts index eaf72bed48af70..50228bcce8b9c2 100644 --- a/packages/material-ui/src/GlobalStyles/GlobalStyles.d.ts +++ b/packages/material-ui/src/GlobalStyles/GlobalStyles.d.ts @@ -1,4 +1,4 @@ -import { GlobalStylesProps as StyledGlobalStylesProps } from '@material-ui/styled-engine'; +import { GlobalStylesProps as StyledGlobalStylesProps } from '@material-ui/system'; export interface GlobalStylesProps { /** diff --git a/packages/material-ui/src/GlobalStyles/GlobalStyles.js b/packages/material-ui/src/GlobalStyles/GlobalStyles.js index 31d44ed0b01fba..b4b1b7baedeebd 100644 --- a/packages/material-ui/src/GlobalStyles/GlobalStyles.js +++ b/packages/material-ui/src/GlobalStyles/GlobalStyles.js @@ -1,10 +1,10 @@ import * as React from 'react'; import PropTypes from 'prop-types'; -import { GlobalStyles as StyledEngineGlobalStyles } from '@material-ui/styled-engine'; +import { GlobalStyles as SystemGlobalStyles } from '@material-ui/system'; import defaultTheme from '../styles/defaultTheme'; function GlobalStyles(props) { - return ; + return ; } GlobalStyles.propTypes /* remove-proptypes */ = { diff --git a/packages/material-ui/src/Icon/Icon.d.ts b/packages/material-ui/src/Icon/Icon.d.ts index 0ad29966ec7a47..8246a1d2cecada 100644 --- a/packages/material-ui/src/Icon/Icon.d.ts +++ b/packages/material-ui/src/Icon/Icon.d.ts @@ -1,7 +1,6 @@ import * as React from 'react'; import { SxProps } from '@material-ui/system'; import { OverridableStringUnion } from '@material-ui/types'; -import { PropTypes } from '..'; import { Theme } from '../styles'; import { OverridableComponent, OverrideProps } from '../OverridableComponent'; import { IconClasses } from './iconClasses'; @@ -31,7 +30,15 @@ export interface IconTypeMap

    { * @default 'inherit' */ color?: OverridableStringUnion< - Exclude | 'action' | 'disabled' | 'error', + | 'inherit' + | 'action' + | 'disabled' + | 'primary' + | 'secondary' + | 'error' + | 'info' + | 'success' + | 'warning', IconPropsColorOverrides >; /** diff --git a/packages/material-ui/src/Icon/Icon.js b/packages/material-ui/src/Icon/Icon.js index d6d6487d9562a7..5f2c3545038bb9 100644 --- a/packages/material-ui/src/Icon/Icon.js +++ b/packages/material-ui/src/Icon/Icon.js @@ -54,6 +54,9 @@ const IconRoot = styled('span', { color: { primary: theme.palette.primary.main, secondary: theme.palette.secondary.main, + info: theme.palette.info.main, + success: theme.palette.success.main, + warning: theme.palette.warning.main, action: theme.palette.action.active, error: theme.palette.error.main, disabled: theme.palette.action.disabled, @@ -129,7 +132,17 @@ Icon.propTypes /* remove-proptypes */ = { * @default 'inherit' */ color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([ - PropTypes.oneOf(['action', 'disabled', 'error', 'inherit', 'primary', 'secondary']), + PropTypes.oneOf([ + 'inherit', + 'action', + 'disabled', + 'primary', + 'secondary', + 'error', + 'info', + 'success', + 'warning', + ]), PropTypes.string, ]), /** diff --git a/packages/material-ui/src/IconButton/IconButton.d.ts b/packages/material-ui/src/IconButton/IconButton.d.ts index 81c37b57812a1b..0bb4bea271d5ed 100644 --- a/packages/material-ui/src/IconButton/IconButton.d.ts +++ b/packages/material-ui/src/IconButton/IconButton.d.ts @@ -28,7 +28,7 @@ export type IconButtonTypeMap< * @default 'default' */ color?: OverridableStringUnion< - 'inherit' | 'default' | 'primary' | 'secondary', + 'inherit' | 'default' | 'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning', IconButtonPropsColorOverrides >; /** diff --git a/packages/material-ui/src/IconButton/IconButton.js b/packages/material-ui/src/IconButton/IconButton.js index a128d375f30801..c21f88d5e7e22c 100644 --- a/packages/material-ui/src/IconButton/IconButton.js +++ b/packages/material-ui/src/IconButton/IconButton.js @@ -21,7 +21,6 @@ const useUtilityClasses = (styleProps) => { edge && `edge${capitalize(edge)}`, `size${capitalize(size)}`, ], - label: ['label'], }; return composeClasses(slots, getIconButtonUtilityClass, classes); @@ -74,28 +73,20 @@ const IconButtonRoot = styled(ButtonBase, { ...(styleProps.color === 'inherit' && { color: 'inherit', }), - /* Styles applied to the root element if `color="primary"`. */ - ...(styleProps.color === 'primary' && { - color: theme.palette.primary.main, - '&:hover': { - backgroundColor: alpha(theme.palette.primary.main, theme.palette.action.hoverOpacity), - // Reset on touch devices, it doesn't add specificity - '@media (hover: none)': { - backgroundColor: 'transparent', + ...(styleProps.color !== 'inherit' && + styleProps.color !== 'default' && { + color: theme.palette[styleProps.color].main, + '&:hover': { + backgroundColor: alpha( + theme.palette[styleProps.color].main, + theme.palette.action.hoverOpacity, + ), + // Reset on touch devices, it doesn't add specificity + '@media (hover: none)': { + backgroundColor: 'transparent', + }, }, - }, - }), - /* Styles applied to the root element if `color="secondary"`. */ - ...(styleProps.color === 'secondary' && { - color: theme.palette.secondary.main, - '&:hover': { - backgroundColor: alpha(theme.palette.secondary.main, theme.palette.action.hoverOpacity), - // Reset on touch devices, it doesn't add specificity - '@media (hover: none)': { - backgroundColor: 'transparent', - }, - }, - }), + }), /* Styles applied to the root element if `size="small"`. */ ...(styleProps.size === 'small' && { padding: 5, @@ -113,18 +104,6 @@ const IconButtonRoot = styled(ButtonBase, { }), ); -const IconButtonLabel = styled('span', { - name: 'MuiIconButton', - slot: 'Label', - overridesResolver: (props, styles) => styles.label, -})({ - /* Styles applied to the children container element. */ - width: '100%', - display: 'flex', - alignItems: 'inherit', - justifyContent: 'inherit', -}); - /** * Refer to the [Icons](/components/icons/) section of the documentation * regarding the available icon options. @@ -163,9 +142,7 @@ const IconButton = React.forwardRef(function IconButton(inProps, ref) { styleProps={styleProps} {...other} > - - {children} - + {children} ); }); @@ -208,7 +185,16 @@ IconButton.propTypes /* remove-proptypes */ = { * @default 'default' */ color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([ - PropTypes.oneOf(['inherit', 'default', 'primary', 'secondary']), + PropTypes.oneOf([ + 'inherit', + 'default', + 'primary', + 'secondary', + 'error', + 'info', + 'success', + 'warning', + ]), PropTypes.string, ]), /** diff --git a/packages/material-ui/src/IconButton/IconButton.test.js b/packages/material-ui/src/IconButton/IconButton.test.js index b45b251603c4cd..52de2feb0e0e0a 100644 --- a/packages/material-ui/src/IconButton/IconButton.test.js +++ b/packages/material-ui/src/IconButton/IconButton.test.js @@ -18,25 +18,9 @@ describe('', () => { refInstanceof: window.HTMLButtonElement, muiName: 'MuiIconButton', testVariantProps: { edge: 'end', disabled: true }, - testDeepOverrides: { slotName: 'label', slotClassName: classes.label }, skip: ['componentProp', 'componentsProp'], })); - it('should render an inner label span (bloody safari)', () => { - const { getByText } = render(book); - const label = getByText('book'); - expect(label).to.have.class(classes.label); - expect(label).to.have.property('nodeName', 'SPAN'); - }); - - it('should render the child normally inside the label span', () => { - const child =

    H

    ; - const { container } = render({child}); - const label = container.querySelector(`.${classes.label}`); - const icon = label.firstChild; - expect(icon).to.equal(container.querySelector('#child')); - }); - it('should render Icon children with right classes', () => { const childClassName = 'child-woof'; const iconChild = ; diff --git a/packages/material-ui/src/IconButton/iconButtonClasses.ts b/packages/material-ui/src/IconButton/iconButtonClasses.ts index 6e3541821f5958..520ad8254d2092 100644 --- a/packages/material-ui/src/IconButton/iconButtonClasses.ts +++ b/packages/material-ui/src/IconButton/iconButtonClasses.ts @@ -21,8 +21,6 @@ export interface IconButtonClasses { sizeMedium: string; /** Styles applied to the root element if `size="large"`. */ sizeLarge: string; - /** Styles applied to the children container element. */ - label: string; } export type IconButtonClassKey = keyof IconButtonClasses; @@ -42,7 +40,6 @@ const iconButtonClasses: IconButtonClasses = generateUtilityClasses('MuiIconButt 'sizeSmall', 'sizeMedium', 'sizeLarge', - 'label', ]); export default iconButtonClasses; diff --git a/packages/material-ui/src/InputBase/InputBase.d.ts b/packages/material-ui/src/InputBase/InputBase.d.ts index 93ba4ef3d2fc73..ac5fcfc20c18b6 100644 --- a/packages/material-ui/src/InputBase/InputBase.d.ts +++ b/packages/material-ui/src/InputBase/InputBase.d.ts @@ -38,7 +38,10 @@ export interface InputBaseProps * The color of the component. It supports those theme colors that make sense for this component. * The prop defaults to the value (`'primary'`) inherited from the parent FormControl component. */ - color?: OverridableStringUnion<'primary' | 'secondary', InputBasePropsColorOverrides>; + color?: OverridableStringUnion< + 'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning', + InputBasePropsColorOverrides + >; /** * The components used for each slot inside the InputBase. * Either a string to use a HTML element or a component. diff --git a/packages/material-ui/src/InputBase/InputBase.js b/packages/material-ui/src/InputBase/InputBase.js index 7ea570e61c8f99..32255bad186b32 100644 --- a/packages/material-ui/src/InputBase/InputBase.js +++ b/packages/material-ui/src/InputBase/InputBase.js @@ -579,7 +579,7 @@ InputBase.propTypes /* remove-proptypes */ = { * The prop defaults to the value (`'primary'`) inherited from the parent FormControl component. */ color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([ - PropTypes.oneOf(['primary', 'secondary']), + PropTypes.oneOf(['primary', 'secondary', 'error', 'info', 'success', 'warning']), PropTypes.string, ]), /** diff --git a/packages/material-ui/src/InputLabel/InputLabel.js b/packages/material-ui/src/InputLabel/InputLabel.js index 64bb6e4c4b8553..88ebaa3b98a961 100644 --- a/packages/material-ui/src/InputLabel/InputLabel.js +++ b/packages/material-ui/src/InputLabel/InputLabel.js @@ -164,7 +164,7 @@ InputLabel.propTypes /* remove-proptypes */ = { /** * The color of the component. It supports those theme colors that make sense for this component. */ - color: PropTypes.oneOf(['primary', 'secondary']), + color: PropTypes.oneOf(['error', 'info', 'primary', 'secondary', 'success', 'warning']), /** * If `true`, the transition animation is disabled. * @default false diff --git a/packages/material-ui/src/LinearProgress/LinearProgress.d.ts b/packages/material-ui/src/LinearProgress/LinearProgress.d.ts index cdfc8460d14874..a6c4cf5c8a9a74 100644 --- a/packages/material-ui/src/LinearProgress/LinearProgress.d.ts +++ b/packages/material-ui/src/LinearProgress/LinearProgress.d.ts @@ -17,7 +17,7 @@ export interface LinearProgressProps * @default 'primary' */ color?: OverridableStringUnion< - 'primary' | 'secondary' | 'inherit', + 'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning' | 'inherit', LinearProgressPropsColorOverrides >; /** diff --git a/packages/material-ui/src/LinearProgress/LinearProgress.js b/packages/material-ui/src/LinearProgress/LinearProgress.js index ef366f26ca5a0b..811e8645d71477 100644 --- a/packages/material-ui/src/LinearProgress/LinearProgress.js +++ b/packages/material-ui/src/LinearProgress/LinearProgress.js @@ -2,8 +2,7 @@ import * as React from 'react'; import PropTypes from 'prop-types'; import clsx from 'clsx'; import { unstable_composeClasses as composeClasses } from '@material-ui/unstyled'; -import { keyframes, css } from '@material-ui/styled-engine'; -import { darken, lighten } from '@material-ui/system'; +import { keyframes, css, darken, lighten } from '@material-ui/system'; import capitalize from '../utils/capitalize'; import useTheme from '../styles/useTheme'; import styled from '../styles/styled'; diff --git a/packages/material-ui/src/Menu/Menu.d.ts b/packages/material-ui/src/Menu/Menu.d.ts index 7cb54929750871..145787f22f7216 100644 --- a/packages/material-ui/src/Menu/Menu.d.ts +++ b/packages/material-ui/src/Menu/Menu.d.ts @@ -4,10 +4,10 @@ import { InternalStandardProps as StandardProps } from '..'; import { PopoverProps } from '../Popover'; import { MenuListProps } from '../MenuList'; import { Theme } from '../styles'; -import { TransitionHandlerProps, TransitionProps } from '../transitions/transition'; +import { TransitionProps } from '../transitions/transition'; import { MenuClasses } from './menuClasses'; -export interface MenuProps extends StandardProps> { +export interface MenuProps extends StandardProps { /** * An HTML element, or a function that returns one. * It's used to set the position of the menu. diff --git a/packages/material-ui/src/MenuItem/MenuItem.js b/packages/material-ui/src/MenuItem/MenuItem.js index 4c0ff33ef3ff85..3bf806bd2fd920 100644 --- a/packages/material-ui/src/MenuItem/MenuItem.js +++ b/packages/material-ui/src/MenuItem/MenuItem.js @@ -256,7 +256,7 @@ MenuItem.propTypes /* remove-proptypes */ = { /** * @ignore */ - role: PropTypes.string, + role: PropTypes /* @typescript-to-proptypes-ignore */.string, /** * @ignore */ diff --git a/packages/material-ui/src/Modal/Modal.d.ts b/packages/material-ui/src/Modal/Modal.d.ts index 2e530c0ff1b5a7..ddbef48bf12dc5 100644 --- a/packages/material-ui/src/Modal/Modal.d.ts +++ b/packages/material-ui/src/Modal/Modal.d.ts @@ -1,9 +1,9 @@ import * as React from 'react'; import { SxProps } from '@material-ui/system'; +import { OverrideProps } from '@material-ui/types'; import { ExtendModalUnstyledTypeMap, ExtendModalUnstyled, - ModalUnstyledProps, } from '@material-ui/unstyled/ModalUnstyled'; import { Theme } from '../styles'; import { BackdropProps } from '../Backdrop'; @@ -12,7 +12,15 @@ export type ModalTypeMap = ExtendMo props: P & { /** * A backdrop component. This prop enables custom backdrop rendering. - * @default Backdrop + * @default styled(Backdrop, { + * name: 'MuiModal', + * slot: 'Backdrop', + * overridesResolver: (props, styles) => { + * return styles.backdrop; + * }, + * })({ + * zIndex: -1, + * }) */ BackdropComponent?: React.ElementType; /** @@ -63,6 +71,6 @@ export const modalClasses: ModalClasses; export type ModalProps< D extends React.ElementType = ModalTypeMap['defaultComponent'], P = {}, -> = ModalUnstyledProps; +> = OverrideProps, D>; export default Modal; diff --git a/packages/material-ui/src/Modal/Modal.js b/packages/material-ui/src/Modal/Modal.js index f409ca09e5dcae..842ba7a260ea4a 100644 --- a/packages/material-ui/src/Modal/Modal.js +++ b/packages/material-ui/src/Modal/Modal.js @@ -39,6 +39,16 @@ const ModalRoot = styled('div', { }), })); +const ModalBackdrop = styled(Backdrop, { + name: 'MuiModal', + slot: 'Backdrop', + overridesResolver: (props, styles) => { + return styles.backdrop; + }, +})({ + zIndex: -1, +}); + /** * Modal is a lower-level construct that is leveraged by the following components: * @@ -55,7 +65,7 @@ const ModalRoot = styled('div', { const Modal = React.forwardRef(function Modal(inProps, ref) { const props = useThemeProps({ name: 'MuiModal', props: inProps }); const { - BackdropComponent = Backdrop, + BackdropComponent = ModalBackdrop, closeAfterTransition = false, children, components = {}, @@ -127,7 +137,15 @@ Modal.propTypes /* remove-proptypes */ = { // ---------------------------------------------------------------------- /** * A backdrop component. This prop enables custom backdrop rendering. - * @default Backdrop + * @default styled(Backdrop, { + * name: 'MuiModal', + * slot: 'Backdrop', + * overridesResolver: (props, styles) => { + * return styles.backdrop; + * }, + * })({ + * zIndex: -1, + * }) */ BackdropComponent: PropTypes.elementType, /** diff --git a/packages/material-ui/src/Modal/Modal.spec.tsx b/packages/material-ui/src/Modal/Modal.spec.tsx new file mode 100644 index 00000000000000..1dc2e96d39d1b1 --- /dev/null +++ b/packages/material-ui/src/Modal/Modal.spec.tsx @@ -0,0 +1,10 @@ +import * as React from 'react'; +import Modal, { ModalProps } from '@material-ui/core/Modal'; + +const backdropProps: ModalProps['BackdropProps'] = { + onEntered: () => console.log('entered'), +}; + + console.log('entered') }}> +
    +; diff --git a/packages/material-ui/src/Modal/Modal.test.js b/packages/material-ui/src/Modal/Modal.test.js index c7325ed327345a..544b0b5dff3cc7 100644 --- a/packages/material-ui/src/Modal/Modal.test.js +++ b/packages/material-ui/src/Modal/Modal.test.js @@ -10,10 +10,10 @@ import { within, createMount, describeConformanceV5, + screen, } from 'test/utils'; import { createTheme, ThemeProvider } from '@material-ui/core/styles'; import Fade from '@material-ui/core/Fade'; -import Backdrop from '@material-ui/core/Backdrop'; import Modal, { modalClasses as classes } from '@material-ui/core/Modal'; describe('', () => { @@ -111,18 +111,23 @@ describe('', () => { }); describe('backdrop', () => { - it('should render a backdrop with a fade transition', () => { - const wrapper = mount( - + it('can render a custom backdrop component', () => { + function TestBackdrop(props) { + const { open } = props; + if (!open) { + return null; + } + + return
    ; + } + + render( +
    , ); - const backdrop = wrapper.find(Backdrop); - expect(backdrop.exists()).to.equal(true); - - const transition = backdrop.find(Fade); - expect(transition.props()).to.have.property('in', true); + expect(screen.getByTestId('backdrop')).not.to.equal(null); }); it('should render a backdrop component into the portal before the modal content', () => { @@ -141,14 +146,21 @@ describe('', () => { }); it('should pass prop to the transition component', () => { - const wrapper = mount( - + function TestBackdrop(props) { + const { open, transitionDuration } = props; + if (!open) { + return null; + } + + return
    ; + } + render( +
    , ); - const transition = wrapper.find(Fade); - expect(transition.props()).to.have.property('timeout', 200); + expect(screen.getByTestId('backdrop')).to.have.attribute('data-timeout', '200'); }); it('should attach a handler to the backdrop that fires onClose', () => { diff --git a/packages/material-ui/src/NoSsr/NoSsr.test.js b/packages/material-ui/src/NoSsr/NoSsr.test.js index 9f90ea9707d6ef..3e123a91d8e7b7 100644 --- a/packages/material-ui/src/NoSsr/NoSsr.test.js +++ b/packages/material-ui/src/NoSsr/NoSsr.test.js @@ -5,22 +5,17 @@ import NoSsr from '@material-ui/core/NoSsr'; describe('', () => { const render = createClientRender(); - const serverRender = createServerRender(); + const serverRender = createServerRender({ expectUseLayoutEffectWarning: true }); describe('server-side rendering', () => { it('should not render the children as the width is unknown', () => { - let wrapper; - expect(() => { - wrapper = serverRender( - - Hello - , - ); - }).toErrorDev( - // Known issue due to using SSR APIs in a browser environment. - ['Warning: useLayoutEffect does nothing on the server'], + const container = serverRender( + + Hello + , ); - expect(wrapper.text()).to.equal(''); + + expect(container.firstChild).to.equal(null); }); }); @@ -37,20 +32,15 @@ describe('', () => { describe('prop: fallback', () => { it('should render the fallback', () => { - let wrapper; - expect(() => { - wrapper = serverRender( -
    - - Hello - -
    , - ); - }).toErrorDev( - // Known issue due to using SSR APIs in a browser environment. - ['Warning: useLayoutEffect does nothing on the server'], + const container = serverRender( +
    + + Hello + +
    , ); - expect(wrapper.text()).to.equal('fallback'); + + expect(container.firstChild).to.have.text('fallback'); }); }); diff --git a/packages/material-ui/src/Popover/Popover.d.ts b/packages/material-ui/src/Popover/Popover.d.ts index 009a2a43f9461d..a75c4cb1c41cf4 100644 --- a/packages/material-ui/src/Popover/Popover.d.ts +++ b/packages/material-ui/src/Popover/Popover.d.ts @@ -4,7 +4,7 @@ import { InternalStandardProps as StandardProps } from '..'; import { PaperProps } from '../Paper'; import { ModalProps } from '../Modal'; import { Theme } from '../styles'; -import { TransitionHandlerProps, TransitionProps } from '../transitions/transition'; +import { TransitionProps } from '../transitions/transition'; import { PopoverClasses } from './popoverClasses'; export interface PopoverOrigin { @@ -19,8 +19,7 @@ export interface PopoverPosition { export type PopoverReference = 'anchorEl' | 'anchorPosition' | 'none'; -export interface PopoverProps - extends StandardProps, 'children'> { +export interface PopoverProps extends StandardProps { /** * A ref for imperative actions. * It currently only supports updatePosition() action. diff --git a/packages/material-ui/src/Popover/Popover.test.js b/packages/material-ui/src/Popover/Popover.test.js index e675e06004c076..9dc2e764dd28d2 100644 --- a/packages/material-ui/src/Popover/Popover.test.js +++ b/packages/material-ui/src/Popover/Popover.test.js @@ -1,12 +1,7 @@ import * as React from 'react'; import { expect } from 'chai'; import { spy, stub, useFakeTimers } from 'sinon'; -import { - findOutermostIntrinsic, - createMount, - createClientRender, - describeConformanceV5, -} from 'test/utils'; +import { act, createMount, createClientRender, describeConformanceV5, screen } from 'test/utils'; import PropTypes from 'prop-types'; import Grow from '@material-ui/core/Grow'; import Modal from '@material-ui/core/Modal'; @@ -39,15 +34,21 @@ const FakePaper = React.forwardRef(function FakeWidthPaper(props, ref) { }); describe('', () => { - // StrictModeViolation: Not using act(), prefer using createClientRender from test/utils - const mount = createMount({ strict: false }); + /** + * @type {ReturnType} + */ + let clock; + beforeEach(() => { + clock = useFakeTimers(); + }); + afterEach(() => { + clock.restore(); + }); + + const mount = createMount(); const render = createClientRender(); - const defaultProps = { - open: false, - anchorEl: () => document.createElement('svg'), - }; - describeConformanceV5(, () => ({ + describeConformanceV5( document.createElement('div')} open />, () => ({ classes, inheritComponent: Modal, render, @@ -68,36 +69,55 @@ describe('', () => { describe('root node', () => { it('should render a Modal with an invisible backdrop as the root node', () => { - const wrapper = mount( - + function TestBackdrop(props) { + const { open, invisible } = props; + if (!open) { + return null; + } + return
    ; + } + render( +
    , ); - const root = wrapper.find('ForwardRef(Popover) > [data-root-node]').first(); - expect(root.find(Modal).exists()).to.equal(true); - expect(root.props().BackdropProps.invisible).to.equal(true); + + expect(screen.getByTestId('backdrop')).to.have.attribute('data-invisible', 'true'); }); - it('should pass open prop to Modal as `open`', () => { - const wrapper = mount( - -
    + it('should only render its children when open', () => { + const { setProps } = render( + +
    , ); - expect(wrapper.find(Modal).props().open).to.equal(false); - wrapper.setProps({ open: true }); - expect(wrapper.find(Modal).props().open).to.equal(true); - wrapper.setProps({ open: false }); - expect(wrapper.find(Modal).props().open).to.equal(false); + + expect(screen.queryByTestId('children')).to.equal(null); + + setProps({ open: true }); + + expect(screen.getByTestId('children')).not.to.equal(null); }); - describe('getOffsetTop', () => { - let rect; + it('hide its children immediately when closing but transition them out', () => { + const { setProps } = render( + +
    + , + ); - before(() => { - rect = { height: 1 }; + setProps({ open: false }); + + expect(screen.getByTestId('children')).toBeInaccessible(); + + act(() => { + clock.tick(1974); }); + expect(screen.queryByTestId('children')).to.equal(null); + }); + + describe('getOffsetTop', () => { it('should return vertical when vertical is a number', () => { const vertical = 1; const offsetTop = getOffsetTop('', vertical); @@ -106,30 +126,27 @@ describe('', () => { it("should return half of rect.height if vertical is 'center'", () => { const vertical = 'center'; + const rect = { height: 1 }; const offsetTop = getOffsetTop(rect, vertical); expect(offsetTop).to.equal(rect.height / 2); }); it("should return rect.height if vertical is 'bottom'", () => { const vertical = 'bottom'; + const rect = { height: 1 }; const offsetTop = getOffsetTop(rect, vertical); expect(offsetTop).to.equal(rect.height); }); it('should return zero if vertical is something else', () => { const vertical = undefined; + const rect = { height: 1 }; const offsetTop = getOffsetTop(rect, vertical); expect(offsetTop).to.equal(0); }); }); describe('getOffsetLeft', () => { - let rect; - - before(() => { - rect = { width: 1 }; - }); - it('should return horizontal when horizontal is a number', () => { const horizontal = 1; const offsetLeft = getOffsetLeft('', horizontal); @@ -138,18 +155,21 @@ describe('', () => { it("should return half of rect.width if horizontal is 'center'", () => { const horizontal = 'center'; + const rect = { width: 1 }; const offsetLeft = getOffsetLeft(rect, horizontal); expect(offsetLeft).to.equal(rect.width / 2); }); it("should return rect.width if horizontal is 'right'", () => { const horizontal = 'right'; + const rect = { width: 1 }; const offsetLeft = getOffsetLeft(rect, horizontal); expect(offsetLeft).to.equal(rect.width); }); it('should return zero if horizontal is something else', () => { const horizontal = undefined; + const rect = { width: 1 }; const offsetLeft = getOffsetLeft(rect, horizontal); expect(offsetLeft).to.equal(0); }); @@ -157,92 +177,155 @@ describe('', () => { }); describe('transition', () => { - let clock; - - beforeEach(() => { - clock = useFakeTimers(); - }); - - afterEach(() => { - clock.restore(); - }); - - it('uses Grow as the Transition of the modal', () => { - const wrapper = mount( - + it('appears on mount', () => { + const handleEnter = spy(); + render( +
    , ); - const modal = wrapper.find('[data-testid="Modal"]'); - const transition = modal.find(Grow); - expect(transition.exists()).to.equal(true); - expect(transition.props().appear).to.equal(true); + expect(handleEnter.callCount).to.equal(1); }); - it('should set the transition in/out based on the open prop', () => { - const wrapper = mount( - + it('should fire Popover transition event callbacks', () => { + const handleEnter = spy(); + const handleEntering = spy(); + const handleEntered = spy(); + const handleExit = spy(); + const handleExiting = spy(); + const handleExited = spy(); + + const { setProps } = render( +
    , ); - expect(wrapper.find(Grow).props().in).to.equal(false); - wrapper.setProps({ open: true }); - expect(wrapper.find(Grow).props().in).to.equal(true); - wrapper.setProps({ open: false }); - expect(wrapper.find(Grow).props().in).to.equal(false); - }); - it('should fire Popover transition event callbacks', () => { - const events = ['onEntering', 'onEnter', 'onEntered', 'onExit', 'onExiting', 'onExited']; + expect({ + onEnter: handleEnter.callCount, + onEntered: handleEntered.callCount, + onEntering: handleEntering.callCount, + onExit: handleExit.callCount, + onExited: handleExited.callCount, + onExiting: handleExiting.callCount, + }).to.deep.equal({ + onEnter: 1, + onEntering: 1, + onEntered: 0, + onExit: 0, + onExiting: 0, + onExited: 0, + }); - const handlers = events.reduce((result, eventHook) => { - result[eventHook] = spy(); - return result; - }, {}); + act(() => { + clock.tick(0); + }); - // transitions towards entered - const wrapper = mount( - -
    - , - ); - clock.tick(0); - // transition towards exited - wrapper.setProps({ open: false }); - clock.tick(0); + expect({ + onEnter: handleEnter.callCount, + onEntered: handleEntered.callCount, + onEntering: handleEntering.callCount, + onExit: handleExit.callCount, + onExited: handleExited.callCount, + onExiting: handleExiting.callCount, + }).to.deep.equal({ + onEnter: 1, + onEntering: 1, + onEntered: 1, + onExit: 0, + onExiting: 0, + onExited: 0, + }); + + setProps({ open: false }); + + expect({ + onEnter: handleEnter.callCount, + onEntered: handleEntered.callCount, + onEntering: handleEntering.callCount, + onExit: handleExit.callCount, + onExited: handleExited.callCount, + onExiting: handleExiting.callCount, + }).to.deep.equal({ + onEnter: 1, + onEntering: 1, + onEntered: 1, + onExit: 1, + onExiting: 1, + onExited: 0, + }); + + act(() => { + clock.tick(0); + }); - events.forEach((eventHook) => { - expect(handlers[eventHook].callCount).to.equal(1); + expect({ + onEnter: handleEnter.callCount, + onEntered: handleEntered.callCount, + onEntering: handleEntering.callCount, + onExit: handleExit.callCount, + onExited: handleExited.callCount, + onExiting: handleExiting.callCount, + }).to.deep.equal({ + onEnter: 1, + onEntering: 1, + onEntered: 1, + onExit: 1, + onExiting: 1, + onExited: 1, }); }); }); describe('paper', () => { it('should have Paper as a child of Transition', () => { - const wrapper = mount( - + render( +
    , ); - expect(wrapper.find(Grow).find(Paper).exists()).to.equal(true); + expect(screen.getByTestId('paper')).not.to.equal(null); }); - it('should have the paper class and user classes', () => { - const wrapper = mount( - + it('should have the paper class', () => { + render( +
    , ); - expect(findOutermostIntrinsic(wrapper).hasClass('test-class')).to.equal(true); - const paper = wrapper.find(Paper); - expect(paper.hasClass(classes.paper)).to.equal(true); + + expect(screen.getByTestId('paper')).to.have.class(classes.paper); }); it('should have a elevation prop passed down', () => { const wrapper = mount( - +
    , ); @@ -259,7 +342,7 @@ describe('', () => { const handleEntering = spy(); render( null }} TransitionProps={{ onEntering: handleEntering }} @@ -275,13 +358,17 @@ describe('', () => { describe('handleEntering(element)', () => { it('should set the inline styles for the enter phase', () => { const handleEntering = spy(); - const wrapper = mount( - + const { setProps } = render( +
    , ); - wrapper.setProps({ + setProps({ open: true, }); @@ -296,141 +383,121 @@ describe('', () => { describe('prop: anchorEl', () => { it('should accept a function', () => { const anchorElSpy = spy(); - mount( - + render( +
    , ); - expect(anchorElSpy.callCount).to.equal(1); + expect(anchorElSpy.callCount).to.be.greaterThanOrEqual(1); }); }); describe('positioning on an anchor', () => { let anchorEl; - let wrapper; - let popoverEl; - let openPopover; - let expectPopover; - - before(() => { - openPopover = (anchorOrigin) => { - if (!anchorEl) { - anchorEl = document.createElement('div'); - } - const css = (element, styles) => { - Object.keys(styles).forEach((key) => { - element.style[key] = styles[key]; - }); - }; - - css(anchorEl, { - width: '50px', - height: '50px', - position: 'absolute', - top: '100px', - left: '100px', - }); - document.body.appendChild(anchorEl); - - return new Promise((resolve) => { - const component = ( - { - popoverEl = document.querySelector('[data-testid="Popover"]'); - resolve(); - }, - }} - > -
    - - ); - wrapper = mount(component); - wrapper.setProps({ open: true }); - }); - }; + function openPopover(anchorOrigin) { + render( + +
    + , + ); + act(() => { + clock.tick(0); + }); + } - expectPopover = (top, left) => { - expect(popoverEl).toHaveInlineStyle({ top: `${top}px`, left: `${left}px` }); + beforeEach(() => { + anchorEl = document.createElement('div'); - wrapper.unmount(); - }; + anchorEl.style.width = '50px'; + anchorEl.style.height = '50px'; + anchorEl.style.position = 'absolute'; + anchorEl.style.top = '100px'; + anchorEl.style.left = '100px'; + + document.body.appendChild(anchorEl); }); - after(() => { - if (anchorEl) { - document.body.removeChild(anchorEl); - } + afterEach(() => { + document.body.removeChild(anchorEl); }); - it('should be positioned over the top left of the anchor', async () => { - await openPopover({ vertical: 'top', horizontal: 'left' }); + it('should be positioned over the top left of the anchor', () => { + openPopover({ vertical: 'top', horizontal: 'left' }); + const anchorRect = anchorEl.getBoundingClientRect(); - const expectedTop = anchorRect.top <= 16 ? 16 : anchorRect.top; - const expectedLeft = anchorRect.left <= 16 ? 16 : anchorRect.left; - expectPopover(expectedTop, expectedLeft); + const top = anchorRect.top <= 16 ? 16 : anchorRect.top; + const left = anchorRect.left <= 16 ? 16 : anchorRect.left; + expect(screen.getByTestId('paper')).toHaveInlineStyle({ top: `${top}px`, left: `${left}px` }); }); - it('should be positioned over the center left of the anchor', async () => { - await openPopover({ vertical: 'center', horizontal: 'left' }); + it('should be positioned over the center left of the anchor', () => { + openPopover({ vertical: 'center', horizontal: 'left' }); + const anchorRect = anchorEl.getBoundingClientRect(); const anchorTop = anchorRect.top + anchorRect.height / 2; - const expectedTop = anchorTop <= 16 ? 16 : anchorTop; - const expectedLeft = anchorRect.left <= 16 ? 16 : anchorRect.left; - expectPopover(expectedTop, expectedLeft); + const top = anchorTop <= 16 ? 16 : anchorTop; + const left = anchorRect.left <= 16 ? 16 : anchorRect.left; + expect(screen.getByTestId('paper')).toHaveInlineStyle({ top: `${top}px`, left: `${left}px` }); }); - it('should be positioned over the bottom left of the anchor', async () => { - await openPopover({ vertical: 'bottom', horizontal: 'left' }); + it('should be positioned over the bottom left of the anchor', () => { + openPopover({ vertical: 'bottom', horizontal: 'left' }); + const anchorRect = anchorEl.getBoundingClientRect(); - const expectedTop = anchorRect.bottom <= 16 ? 16 : anchorRect.bottom; - const expectedLeft = anchorRect.left <= 16 ? 16 : anchorRect.left; - expectPopover(expectedTop, expectedLeft); + const top = anchorRect.bottom <= 16 ? 16 : anchorRect.bottom; + const left = anchorRect.left <= 16 ? 16 : anchorRect.left; + expect(screen.getByTestId('paper')).toHaveInlineStyle({ top: `${top}px`, left: `${left}px` }); }); - it('should be positioned over the center center of the anchor', async () => { - await openPopover({ vertical: 'center', horizontal: 'center' }); + it('should be positioned over the center center of the anchor', () => { + openPopover({ vertical: 'center', horizontal: 'center' }); + const anchorRect = anchorEl.getBoundingClientRect(); const anchorTop = anchorRect.top + anchorRect.height / 2; const anchorLeft = anchorRect.left + anchorRect.height / 2; - const expectedTop = anchorTop <= 16 ? 16 : anchorTop; - const expectedLeft = anchorLeft <= 16 ? 16 : anchorLeft; - expectPopover(expectedTop, expectedLeft); + const top = anchorTop <= 16 ? 16 : anchorTop; + const left = anchorLeft <= 16 ? 16 : anchorLeft; + expect(screen.getByTestId('paper')).toHaveInlineStyle({ top: `${top}px`, left: `${left}px` }); }); - it('should be positioned over the top right of the anchor', async () => { - await openPopover({ vertical: 'top', horizontal: 'right' }); + it('should be positioned over the top right of the anchor', () => { + openPopover({ vertical: 'top', horizontal: 'right' }); const anchorRect = anchorEl.getBoundingClientRect(); - const expectedTop = anchorRect.top <= 16 ? 16 : anchorRect.top; - const expectedLeft = anchorRect.right <= 16 ? 16 : anchorRect.right; - expectPopover(expectedTop, expectedLeft); + const top = anchorRect.top <= 16 ? 16 : anchorRect.top; + const left = anchorRect.right <= 16 ? 16 : anchorRect.right; + expect(screen.getByTestId('paper')).toHaveInlineStyle({ top: `${top}px`, left: `${left}px` }); }); - it('should be positioned over the bottom right of the anchor', async () => { - await openPopover({ vertical: 'bottom', horizontal: 'right' }); + it('should be positioned over the bottom right of the anchor', () => { + openPopover({ vertical: 'bottom', horizontal: 'right' }); + const anchorRect = anchorEl.getBoundingClientRect(); - const expectedTop = anchorRect.bottom <= 16 ? 16 : anchorRect.bottom; - const expectedLeft = anchorRect.right <= 16 ? 16 : anchorRect.right; - expectPopover(expectedTop, expectedLeft); + const top = anchorRect.bottom <= 16 ? 16 : anchorRect.bottom; + const left = anchorRect.right <= 16 ? 16 : anchorRect.right; + expect(screen.getByTestId('paper')).toHaveInlineStyle({ top: `${top}px`, left: `${left}px` }); }); + }); - it('should pass through container prop if container and anchorEl props are provided', () => { - const container = document.createElement('div'); - const wrapper2 = mount(); + it('should pass through container prop if container and anchorEl props are provided', () => { + const container = document.createElement('div'); + const anchorEl = document.createElement('div'); + render(); - expect(wrapper2.find(Modal).props().container).to.equal(container); - }); + expect(container.querySelector('[data-testid="popover"]').parentElement).to.equal(container); + }); - it("should use anchorEl's parent body as container if container not provided", async () => { - await openPopover(undefined); - expect(wrapper.find(Modal).props().container).to.equal(document.body); - }); + it("should use anchorEl's parent body as container if container not provided", () => { + const anchorEl = document.createElement('div'); + render(); + + expect(screen.getByTestId('popover').parentElement).to.equal(anchorEl.ownerDocument.body); }); describe('warnings', () => { @@ -453,7 +520,12 @@ describe('', () => { expect(() => { PropTypes.checkPropTypes( Popover.propTypes, - { ...defaultProps, classes: {}, PaperProps: { component: () =>
    , elevation: 4 } }, + { + anchorEl: document.createElement('div'), + classes: {}, + open: false, + PaperProps: { component: () =>
    , elevation: 4 }, + }, 'prop', 'MockedPopover', ); @@ -466,183 +538,193 @@ describe('', () => { describe('prop anchorReference="anchorPosition"', () => { const anchorPosition = { top: 300, left: 500 }; - let wrapper; - let popoverEl; - let openPopover; - let expectPopover; - - before(() => { - openPopover = (anchorOrigin) => - new Promise((resolve) => { - wrapper = mount( - { - popoverEl = document.querySelector('[data-testid="Popover"]'); - resolve(); - }, - }} - > -
    - , - ); - wrapper.setProps({ open: true }); - }); + function openPopover(anchorOrigin) { + render( + +
    + , + ); + act(() => { + clock.tick(0); + }); + } - expectPopover = (top, left) => { - expect(popoverEl).toHaveInlineStyle({ - top: `${top}px`, - left: `${left}px`, - }); + it('should be positioned according to the passed coordinates', () => { + openPopover(); - wrapper.unmount(); - }; + expect(screen.getByTestId('paper')).toHaveInlineStyle({ + top: `${anchorPosition.top}px`, + left: `${anchorPosition.left}px`, + }); }); - it('should be positioned according to the passed coordinates', async () => { - await openPopover(); - expectPopover(anchorPosition.top, anchorPosition.left); - }); + it('should ignore the anchorOrigin prop when being positioned', () => { + openPopover({ vertical: 'top', horizontal: 'right' }); - it('should ignore the anchorOrigin prop when being positioned', async () => { - await openPopover({ vertical: 'top', horizontal: 'right' }); - expectPopover(anchorPosition.top, anchorPosition.left); + expect(screen.getByTestId('paper')).toHaveInlineStyle({ + top: `${anchorPosition.top}px`, + left: `${anchorPosition.left}px`, + }); }); }); describe('prop anchorReference="none"', () => { - let wrapper; - let popoverEl; - let openPopover; - let expectPopover; - - before(() => { - openPopover = () => - new Promise((resolve) => { - wrapper = mount( - { - popoverEl = document.querySelector('[data-testid="Popover"]'); - resolve(); - }, - }} - PaperProps={{ - 'data-testid': 'Popover', - style: { - top: 11, - left: 12, - }, - }} - > -
    - , - ); - wrapper.setProps({ open: true }); - }); - - expectPopover = (top, left) => { - expect(popoverEl).toHaveInlineStyle({ - top: `${top}px`, - left: `${left}px`, - }); - - wrapper.unmount(); - }; - }); + it('should not try to change the position', () => { + const anchorEl = document.createElement('div'); + render( + +
    + , + ); - it('should not try to change the position', async () => { - await openPopover(); - expectPopover(11, 12); + expect(screen.getByTestId('paper')).toHaveInlineStyle({ + top: `11px`, + left: `12px`, + }); }); }); describe('update position', () => { - let clock; let windowInnerHeight; - let element; - let wrapper; beforeEach(() => { - clock = useFakeTimers(); - windowInnerHeight = window.innerHeight; window.innerHeight = 8; + }); - const mockedAnchor = document.createElement('div'); - stub(mockedAnchor, 'getBoundingClientRect').callsFake(() => ({ + afterEach(() => { + window.innerHeight = windowInnerHeight; + }); + + it('should recalculate position if the popover is open', () => { + let element; + const anchorEl = document.createElement('div'); + stub(anchorEl, 'getBoundingClientRect').callsFake(() => ({ left: 0, top: 9, })); - const handleEntering = spy(); - wrapper = mount( + render( { + element = node; + }, + }} transitionDuration={0} marginThreshold={8} >
    , ); - element = handleEntering.args[0][0]; - }); - - afterEach(() => { - window.innerHeight = windowInnerHeight; - - clock.restore(); - }); - - it('should recalculate position if the popover is open', () => { const beforeStyle = { top: element.style.top, left: element.style.left, transformOrigin: element.style.transformOrigin, }; + window.innerHeight = windowInnerHeight * 2; window.dispatchEvent(new window.Event('resize')); - clock.tick(166); + act(() => { + clock.tick(166); + }); + const afterStyle = { top: element.style.top, left: element.style.left, transformOrigin: element.style.transformOrigin, }; - expect(JSON.stringify(beforeStyle)).not.to.equal(JSON.stringify(afterStyle)); + expect(beforeStyle).not.to.deep.equal(afterStyle); }); it('should not recalculate position if the popover is closed', () => { + let element; + const mockedAnchor = document.createElement('div'); + stub(mockedAnchor, 'getBoundingClientRect').callsFake(() => ({ + left: 0, + top: 9, + })); + const { setProps } = render( + { + element = node; + }, + }} + transitionDuration={0} + marginThreshold={8} + > +
    + , + ); const beforeStyle = { top: element.style.top, left: element.style.left, transformOrigin: element.style.transformOrigin, }; + window.innerHeight = windowInnerHeight * 2; window.dispatchEvent(new window.Event('resize')); - wrapper.setProps({ open: false }); - clock.tick(166); + setProps({ open: false }); + act(() => { + clock.tick(166); + }); + const afterStyle = { top: element.style.top, left: element.style.left, transformOrigin: element.style.transformOrigin, }; - expect(JSON.stringify(beforeStyle)).to.equal(JSON.stringify(afterStyle)); + expect(beforeStyle).to.deep.equal(afterStyle); }); it('should be able to manually recalculate position', () => { + let element; + const mockedAnchor = document.createElement('div'); + stub(mockedAnchor, 'getBoundingClientRect').callsFake(() => ({ + left: 0, + top: 9, + })); + const { setProps } = render( + { + element = node; + }, + }} + transitionDuration={0} + marginThreshold={8} + > +
    + , + ); let popoverActions; - wrapper.setProps({ - open: true, + setProps({ action: (actions) => { popoverActions = actions; }, @@ -653,39 +735,46 @@ describe('', () => { transformOrigin: element.style.transformOrigin, }; window.innerHeight = windowInnerHeight * 2; + expect(typeof popoverActions.updatePosition === 'function').to.equal(true); + popoverActions.updatePosition(); clock.tick(166); + const afterStyle = { top: element.style.top, left: element.style.left, transformOrigin: element.style.transformOrigin, }; - expect(JSON.stringify(beforeStyle)).not.to.equal(JSON.stringify(afterStyle)); + expect(beforeStyle).not.to.deep.equal(afterStyle); }); }); [0, 18, 16].forEach((marginThreshold) => { describe(`positioning when \`marginThreshold=${marginThreshold}\``, () => { - function generateElementStyle(anchorEl = document.createElement('svg')) { - const handleEntering = spy(); - mount( + function getElementStyleOfOpenPopover(anchorEl = document.createElement('svg')) { + let style; + render( { + style = node.style; + }, + }} marginThreshold={marginThreshold} PaperProps={{ component: FakePaper }} >
    , ); - return handleEntering.args[0][0].style; + return style; } specify('when no movement is needed', () => { const negative = marginThreshold === 0 ? '' : '-'; - const positioningStyle = generateElementStyle(); + const positioningStyle = getElementStyleOfOpenPopover(); expect(positioningStyle.top).to.equal(`${marginThreshold}px`); expect(positioningStyle.left).to.equal(`${marginThreshold}px`); @@ -700,7 +789,7 @@ describe('', () => { left: marginThreshold, top: marginThreshold - 1, })); - const positioningStyle = generateElementStyle(mockedAnchor); + const positioningStyle = getElementStyleOfOpenPopover(mockedAnchor); expect(positioningStyle.top).to.equal(`${marginThreshold}px`); expect(positioningStyle.left).to.equal(`${marginThreshold}px`); @@ -726,7 +815,7 @@ describe('', () => { top: marginThreshold + 1, })); - const positioningStyle = generateElementStyle(mockedAnchor); + const positioningStyle = getElementStyleOfOpenPopover(mockedAnchor); expect(positioningStyle.top).to.equal(`${marginThreshold}px`); expect(positioningStyle.left).to.equal(`${marginThreshold}px`); @@ -741,7 +830,7 @@ describe('', () => { top: marginThreshold, })); - const positioningStyle = generateElementStyle(mockedAnchor); + const positioningStyle = getElementStyleOfOpenPopover(mockedAnchor); expect(positioningStyle.top).to.equal(`${marginThreshold}px`); @@ -769,7 +858,7 @@ describe('', () => { top: marginThreshold, })); - const positioningStyle = generateElementStyle(mockedAnchor); + const positioningStyle = getElementStyleOfOpenPopover(mockedAnchor); expect(positioningStyle.top).to.equal(`${marginThreshold}px`); expect(positioningStyle.left).to.equal(`${marginThreshold}px`); @@ -782,7 +871,7 @@ describe('', () => { describe('prop: transitionDuration', () => { it('should apply the auto prop if supported', () => { const wrapper = mount( - +
    , ); @@ -790,13 +879,19 @@ describe('', () => { }); it('should not apply the auto prop if not supported', () => { - const TransitionComponent = React.forwardRef((_, ref) =>
    ); - const wrapper = mount( - + const TransitionComponent = React.forwardRef((props, ref) => ( +
    + )); + render( +
    , ); - expect(wrapper.find(TransitionComponent).props().timeout).to.equal(undefined); + expect(screen.getByTestId('transition')).not.to.have.attribute('data-timeout'); }); }); }); diff --git a/packages/material-ui/src/Radio/Radio.d.ts b/packages/material-ui/src/Radio/Radio.d.ts index 789f15303981b6..7c9a829c599584 100644 --- a/packages/material-ui/src/Radio/Radio.d.ts +++ b/packages/material-ui/src/Radio/Radio.d.ts @@ -23,7 +23,10 @@ export interface RadioProps * The color of the component. It supports those theme colors that make sense for this component. * @default 'primary' */ - color?: OverridableStringUnion<'primary' | 'secondary' | 'default', RadioPropsColorOverrides>; + color?: OverridableStringUnion< + 'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning' | 'default', + RadioPropsColorOverrides + >; /** * If `true`, the component is disabled. */ diff --git a/packages/material-ui/src/Radio/Radio.js b/packages/material-ui/src/Radio/Radio.js index eb6010460f844b..3e2833863fe1d7 100644 --- a/packages/material-ui/src/Radio/Radio.js +++ b/packages/material-ui/src/Radio/Radio.js @@ -138,7 +138,7 @@ Radio.propTypes /* remove-proptypes */ = { * @default 'primary' */ color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([ - PropTypes.oneOf(['default', 'primary', 'secondary']), + PropTypes.oneOf(['default', 'primary', 'secondary', 'error', 'info', 'success', 'warning']), PropTypes.string, ]), /** diff --git a/packages/material-ui/src/Rating/Rating.js b/packages/material-ui/src/Rating/Rating.js index a7703d7c2182ea..3eb36763cc5b0e 100644 --- a/packages/material-ui/src/Rating/Rating.js +++ b/packages/material-ui/src/Rating/Rating.js @@ -193,6 +193,116 @@ IconContainer.propTypes = { value: PropTypes.number.isRequired, }; +function RatingItem(props) { + const { + classes, + disabled, + emptyIcon, + focus, + getLabelText, + highlightSelectedOnly, + hover, + icon, + IconContainerComponent, + isActive, + itemValue, + labelProps, + name, + onBlur, + onChange, + onClick, + onFocus, + readOnly, + styleProps, + ratingValue, + ratingValueRounded, + } = props; + + const isFilled = highlightSelectedOnly ? itemValue === ratingValue : itemValue <= ratingValue; + const isHovered = itemValue <= hover; + const isFocused = itemValue <= focus; + const isChecked = itemValue === ratingValueRounded; + + const id = useId(); + const container = ( + + {emptyIcon && !isFilled ? emptyIcon : icon} + + ); + + if (readOnly) { + return {container}; + } + + return ( + + + {container} + {getLabelText(itemValue)} + + + + ); +} + +RatingItem.propTypes = { + classes: PropTypes.object.isRequired, + disabled: PropTypes.bool.isRequired, + emptyIcon: PropTypes.node, + focus: PropTypes.number.isRequired, + getLabelText: PropTypes.func.isRequired, + highlightSelectedOnly: PropTypes.bool.isRequired, + hover: PropTypes.number.isRequired, + icon: PropTypes.node, + IconContainerComponent: PropTypes.elementType.isRequired, + isActive: PropTypes.bool.isRequired, + itemValue: PropTypes.number.isRequired, + labelProps: PropTypes.object, + name: PropTypes.string, + onBlur: PropTypes.func.isRequired, + onChange: PropTypes.func.isRequired, + onClick: PropTypes.func.isRequired, + onFocus: PropTypes.func.isRequired, + ratingValue: PropTypes.number, + ratingValueRounded: PropTypes.number, + readOnly: PropTypes.bool.isRequired, + styleProps: PropTypes.object.isRequired, +}; + const defaultIcon = ; const defaultEmptyIcon = ; @@ -397,67 +507,6 @@ const Rating = React.forwardRef(function Rating(inProps, ref) { const classes = useUtilityClasses(styleProps); - const item = (state, labelProps) => { - const id = `${name}-${String(state.value).replace('.', '-')}`; - const container = ( - - {emptyIcon && !state.filled ? emptyIcon : icon} - - ); - - if (readOnly) { - return ( - - {container} - - ); - } - - return ( - - - {container} - {getLabelText(state.value)} - - - - ); - }; - return ( { const itemValue = index + 1; + const ratingItemProps = { + classes, + disabled, + emptyIcon, + focus, + getLabelText, + highlightSelectedOnly, + hover, + icon, + IconContainerComponent, + name, + onBlur: handleBlur, + onChange: handleChange, + onClick: handleClear, + onFocus: handleFocus, + ratingValue: value, + ratingValueRounded: valueRounded, + readOnly, + styleProps, + }; + + const isActive = itemValue === Math.ceil(value) && (hover !== -1 || focus !== -1); if (precision < 1) { const items = Array.from(new Array(1 / precision)); - const iconActive = itemValue === Math.ceil(value) && (hover !== -1 || focus !== -1); return ( {items.map(($, indexDecimal) => { @@ -490,44 +560,42 @@ const Rating = React.forwardRef(function Rating(inProps, ref) { precision, ); - return item( - { - value: itemDecimalValue, - filled: highlightSelectedOnly - ? itemDecimalValue === value - : itemDecimalValue <= value, - hover: itemDecimalValue <= hover, - focus: itemDecimalValue <= focus, - checked: itemDecimalValue === valueRounded, - }, - { - style: - items.length - 1 === indexDecimal - ? {} - : { - width: - itemDecimalValue === value - ? `${(indexDecimal + 1) * precision * 100}%` - : '0%', - overflow: 'hidden', - zIndex: 1, - position: 'absolute', - }, - }, + return ( + ); })} ); } - return item({ - value: itemValue, - active: itemValue === value && (hover !== -1 || focus !== -1), - filled: highlightSelectedOnly ? itemValue === value : itemValue <= value, - hover: itemValue <= hover, - focus: itemValue <= focus, - checked: itemValue === valueRounded, - }); + return ( + + ); })} {!readOnly && !disabled && ( ', () => { const handleChange = spy(); const { container } = render(); - fireEvent.click(container.querySelector('#rating-test-2'), { + fireEvent.click(container.querySelector('input[name="rating-test"][value="2"]'), { clientX: 1, }); @@ -77,7 +77,7 @@ describe('', () => { it('should select the rating', () => { const handleChange = spy(); const { container } = render(); - fireEvent.click(container.querySelector('#rating-test-3')); + fireEvent.click(container.querySelector('input[name="rating-test"][value="3"]')); expect(handleChange.callCount).to.equal(1); expect(handleChange.args[0][1]).to.deep.equal(3); const checked = container.querySelector('input[name="rating-test"]:checked'); @@ -105,7 +105,7 @@ describe('', () => { checked = container.querySelector('input[name="rating-test"]:checked'); expect(checked.value).to.equal('3'); - fireEvent.click(container.querySelector('#rating-test-2')); + fireEvent.click(container.querySelector('input[name="rating-test"][value="2"]')); checked = container.querySelector('input[name="rating-test"]:checked'); expect(checked.value).to.equal('2'); }); diff --git a/packages/material-ui/src/Select/Select.test.js b/packages/material-ui/src/Select/Select.test.js index 5d8725ce7b1606..467d8a14969ec1 100644 --- a/packages/material-ui/src/Select/Select.test.js +++ b/packages/material-ui/src/Select/Select.test.js @@ -20,9 +20,18 @@ import Divider from '@material-ui/core/Divider'; import classes from './selectClasses'; describe(', () => ({ classes, @@ -150,7 +159,9 @@ describe(', ); const trigger = screen.getByRole('button'); - trigger.focus(); + act(() => { + trigger.focus(); + }); fireEvent.keyDown(trigger, { key }); expect(screen.getByRole('listbox', { hidden: false })).not.to.equal(null); @@ -168,9 +179,13 @@ describe(', ); const button = getByRole('button'); - button.focus(); + act(() => { + button.focus(); + }); - button.blur(); + act(() => { + button.blur(); + }); expect(handleBlur.callCount).to.equal(1); expect(handleBlur.firstCall.returnValue).to.equal('blur-testing'); @@ -245,7 +260,9 @@ describe(', ); fireEvent.mouseDown(getByRole('button')); - getAllByRole('option')[1].click(); + act(() => { + getAllByRole('option')[1].click(); + }); expect(onChangeHandler.calledOnce).to.equal(true); const selected = onChangeHandler.args[0][1]; @@ -264,7 +281,9 @@ describe('', () => { , ); fireEvent.mouseDown(getByRole('button')); - getAllByRole('option')[1].click(); + act(() => { + getAllByRole('option')[1].click(); + }); expect(onChangeHandler.callCount).to.equal(0); }); @@ -562,7 +583,9 @@ describe('', () => { }); describe('prop: MenuProps', () => { - let clock; - - beforeEach(() => { - clock = useFakeTimers(); - }); - - afterEach(() => { - clock.restore(); - }); - it('should apply additional props to the Menu component', () => { const onEntered = spy(); const { getByRole } = render( @@ -661,16 +674,6 @@ describe(' integration', () => { Ten , - // StrictModeViolation: Requires fake timers + act - { strict: false }, ); act(() => { diff --git a/packages/material-ui/test/typescript/color-palette-prop.spec.tsx b/packages/material-ui/test/typescript/color-palette-prop.spec.tsx new file mode 100644 index 00000000000000..500788faaa71de --- /dev/null +++ b/packages/material-ui/test/typescript/color-palette-prop.spec.tsx @@ -0,0 +1,51 @@ +import * as React from 'react'; +import { + Badge, + Button, + Checkbox, + Chip, + CircularProgress, + FormControl, + FormLabel, + FilledInput, + OutlinedInput, + IconButton, + Input, + InputLabel, + LinearProgress, + Radio, + TextField, + SvgIcon, + Switch, +} from '@material-ui/core'; +import { TimelineDot } from '@material-ui/lab'; + +function TestBaseColorPaletteProp() { + const baseColorPalette = ['primary', 'secondary', 'error', 'info', 'success', 'warning'] as const; + return ( +
    + {baseColorPalette.map((color) => ( +
    + +
    + ))} +
    + ); +} diff --git a/test/karma.tests.js b/test/karma.tests.js index 9a774e8d8a351b..0d9e3477dd9e56 100644 --- a/test/karma.tests.js +++ b/test/karma.tests.js @@ -49,3 +49,10 @@ const unstyledContext = require.context( /\.test\.(js|ts|tsx)$/, ); unstyledContext.keys().forEach(unstyledContext); + +const utilsContext = require.context( + '../packages/material-ui-utils/src/', + true, + /\.test\.(js|ts|tsx)$/, +); +utilsContext.keys().forEach(utilsContext); diff --git a/test/package.json b/test/package.json index 037aa23f6e3b55..38c09ec47ab6d2 100644 --- a/test/package.json +++ b/test/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "test", - "version": "5.0.0-alpha.37", + "version": "5.0.0-alpha.38", "scripts": { "typescript": "tsc -p tsconfig.json" } diff --git a/test/regressions/fixtures/Alert/MultilineAlertWithAction.js b/test/regressions/fixtures/Alert/MultilineAlertWithAction.js index ca7cb7446aa3a9..3978901740222b 100644 --- a/test/regressions/fixtures/Alert/MultilineAlertWithAction.js +++ b/test/regressions/fixtures/Alert/MultilineAlertWithAction.js @@ -1,6 +1,6 @@ import * as React from 'react'; import Button from '@material-ui/core/Button'; -import Typogrpahy from '@material-ui/core/Typography'; +import Typography from '@material-ui/core/Typography'; import Alert from '@material-ui/core/Alert'; export default function MultilineAlertWithAction() { @@ -12,8 +12,8 @@ export default function MultilineAlertWithAction() { } > - This is the first line. - This is the second line. + This is the first line. + This is the second line. ); } diff --git a/test/regressions/fixtures/Rating/PreciseFocusVisibleRating.js b/test/regressions/fixtures/Rating/PreciseFocusVisibleRating.js new file mode 100644 index 00000000000000..03c61edd42f721 --- /dev/null +++ b/test/regressions/fixtures/Rating/PreciseFocusVisibleRating.js @@ -0,0 +1,6 @@ +import * as React from 'react'; +import Rating from '@material-ui/core/Rating'; + +export default function FocusVisibleRating() { + return ; +} diff --git a/test/regressions/index.test.js b/test/regressions/index.test.js index 86daafffced0e7..b15cc2e3c75475 100644 --- a/test/regressions/index.test.js +++ b/test/regressions/index.test.js @@ -100,6 +100,17 @@ async function main() { await page.keyboard.press('ArrowLeft'); await takeScreenshot({ testcase, route: '/regression-Rating/FocusVisibleRating3' }); }); + + it('should handle focus-visible with precise ratings correctly', async () => { + const index = routes.findIndex( + (route) => route === '/regression-Rating/PreciseFocusVisibleRating', + ); + const testcase = await renderFixture(index); + await page.keyboard.press('Tab'); + await takeScreenshot({ testcase, route: '/regression-Rating/PreciseFocusVisibleRating2' }); + await page.keyboard.press('ArrowRight'); + await takeScreenshot({ testcase, route: '/regression-Rating/PreciseFocusVisibleRating3' }); + }); }); describe('DateTimePicker', () => { diff --git a/test/utils/createServerRender.js b/test/utils/createServerRender.js index 117e323b3f8c72..670caaa44c6e84 100644 --- a/test/utils/createServerRender.js +++ b/test/utils/createServerRender.js @@ -1,5 +1,5 @@ /* eslint-env mocha */ -import { render as enzymeRender } from 'enzyme'; +import * as ReactDOMServer from 'react-dom/server'; import { stub } from 'sinon'; /** @@ -28,6 +28,10 @@ export default function createServerRender(options = {}) { }); return function render(node) { - return enzymeRender(node); + const markup = ReactDOMServer.renderToStaticMarkup(node); + const container = document.createElement('div'); + container.innerHTML = markup; + + return container; }; } diff --git a/test/utils/createShallow.js b/test/utils/createShallow.js deleted file mode 100644 index 05789d93ac0ed8..00000000000000 --- a/test/utils/createShallow.js +++ /dev/null @@ -1,45 +0,0 @@ -import { shallow as enzymeShallow } from 'enzyme'; -import until from './until'; - -/** - * @typedef {object} ExtendedShallowOptions - * @property {typeof import('enzyme').shallow} shallow; - * @property {boolean} dive - * @property {import('enzyme').EnzymeSelector} untilSelector - * - * @typedef {import('enzyme').ShallowRendererProps & ExtendedShallowOptions} ShallowOptions - */ - -/** - * Generate an enhanced shallow function. - * @param {Partial} [options1] - * @returns {typeof import('enzyme').shallow} - */ -export default function createShallow(options1 = {}) { - const { shallow = enzymeShallow, dive = false, untilSelector = false, ...other1 } = options1; - - const shallowWithContext = function shallowWithContext(node, options2 = {}) { - const options = { - ...other1, - ...options2, - context: { - ...other1.context, - ...options2.context, - }, - }; - - const wrapper = shallow(node, options); - - if (dive) { - return wrapper.dive(); - } - - if (untilSelector) { - return until.call(wrapper, untilSelector, options); - } - - return wrapper; - }; - - return shallowWithContext; -} diff --git a/test/utils/getClasses.js b/test/utils/getClasses.js deleted file mode 100644 index 3f8dfc5669d4ec..00000000000000 --- a/test/utils/getClasses.js +++ /dev/null @@ -1,22 +0,0 @@ -import * as React from 'react'; -import createShallow from './createShallow'; - -const shallow = createShallow(); - -/** - * Extracts the available classes for the `classes` prop of the given component - * @param {React.ReactElement} element - An element created from a Material-UI component that implements the `classes` prop. - * @returns {Record} - */ -export default function getClasses(element) { - const { useStyles = () => null } = element.type; - - let classes; - function Listener() { - classes = useStyles(element.props); - return null; - } - shallow(); - - return classes; -} diff --git a/test/utils/index.js b/test/utils/index.js index f5cf5b4708d3cf..7201f45b484669 100644 --- a/test/utils/index.js +++ b/test/utils/index.js @@ -4,14 +4,12 @@ export { default as describeConformanceV5 } from './describeConformanceV5'; export * from './createClientRender'; export { default as createMount } from './createMount'; export { default as createServerRender } from './createServerRender'; -export { default as createShallow } from './createShallow'; export { default as findOutermostIntrinsic, wrapsIntrinsicElement } from './findOutermostIntrinsic'; export { default as focusVisible, simulatePointerDevice, programmaticFocusTriggersFocusVisible, } from './focusVisible'; -export { default as getClasses } from './getClasses'; export {} from './initMatchers'; export * as fireDiscreteEvent from './fireDiscreteEvent'; export * as userEvent from './userEvent'; diff --git a/test/utils/initMatchers.test.js b/test/utils/initMatchers.test.js index 9d42f38a0236f3..682ddf2a759cc2 100644 --- a/test/utils/initMatchers.test.js +++ b/test/utils/initMatchers.test.js @@ -64,15 +64,14 @@ describe('custom matchers', () => { expect(caughtError).to.have.property('stack'); expect(caughtError.stack).to.include( 'Recorded unexpected console.error calls: \n\n' + - ' - Expected "expected Message"\n' + - 'to include\n' + - '"expected message"\n' + + ' - Expected #1 "expected message" to be included in \n' + + '"expected Message"\n' + ' at callback', ); // check that the top stackframe points to this test // if this test is moved to another file the next assertion fails expect(caughtError.stack).to.match( - /"expected message"\s+at callback \(.+\/initMatchers\.test\.js:\d+:\d+\)/, + /"expected Message"\s+at callback \(.+\/initMatchers\.test\.js:\d+:\d+\)/, ); }); diff --git a/test/utils/initMatchers.ts b/test/utils/initMatchers.ts index 85586ed07d0c80..38894b1f6523d3 100644 --- a/test/utils/initMatchers.ts +++ b/test/utils/initMatchers.ts @@ -470,20 +470,25 @@ chai.use((chaiAPI, utils) => { // eslint-disable-next-line no-console const originalMethod = console[methodName]; + let messagesMatched = 0; const consoleMatcher = (format: string, ...args: readonly unknown[]) => { - // Ignore ReactDOM.render deprecation warning + // Ignore legacy root deprecation warnings // TODO: Remove once we no longer use legacy roots. - if (format.indexOf('Use createRoot instead.') !== -1) { + if ( + format.indexOf('Use createRoot instead.') !== -1 || + format.indexOf('Use hydrateRoot instead.') !== -1 + ) { return; } const actualMessage = formatUtil(format, ...args); const expectedMessage = remainingMessages.shift(); + messagesMatched += 1; let message = null; if (expectedMessage === undefined) { message = `Expected no more error messages but got:\n"${actualMessage}"`; } else if (!actualMessage.includes(expectedMessage)) { - message = `Expected "${actualMessage}"\nto include\n"${expectedMessage}"`; + message = `Expected #${messagesMatched} "${expectedMessage}" to be included in \n"${actualMessage}"`; } if (message !== null) { diff --git a/test/utils/mochaHooks.js b/test/utils/mochaHooks.js index 2758e628e6eba4..1da9d000817b64 100644 --- a/test/utils/mochaHooks.js +++ b/test/utils/mochaHooks.js @@ -93,9 +93,12 @@ function createUnexpectedConsoleMessagesHooks(Mocha, methodName, expectedMatcher } } - // Ignore ReactDOM.render deprecation warning + // Ignore legacy root deprecation warnings // TODO: Remove once we no longer use legacy roots. - if (message.indexOf('Use createRoot instead.') !== -1) { + if ( + message.indexOf('Use createRoot instead.') !== -1 || + message.indexOf('Use hydrateRoot instead.') !== -1 + ) { return; } diff --git a/test/utils/until.js b/test/utils/until.js deleted file mode 100644 index aab33f8085bf51..00000000000000 --- a/test/utils/until.js +++ /dev/null @@ -1,28 +0,0 @@ -function shallowRecursively(wrapper, selector, { context, ...other }) { - if (wrapper.isEmptyRender() || typeof wrapper.getElement().type === 'string') { - return wrapper; - } - - let newContext = context; - - const instance = wrapper.root().instance(); - // The instance can be null with a stateless functional component and react >= 16. - if (instance && instance.getChildContext) { - newContext = { - ...context, - ...instance.getChildContext(), - }; - } - - const nextWrapper = wrapper.shallow({ context: newContext, ...other }); - - if (selector && wrapper.is(selector)) { - return nextWrapper; - } - - return shallowRecursively(nextWrapper, selector, { context: newContext }); -} - -export default function until(selector, options = {}) { - return this.single('until', () => shallowRecursively(this, selector, options)); -} diff --git a/test/utils/until.test.js b/test/utils/until.test.js deleted file mode 100644 index c80020c8d38f5d..00000000000000 --- a/test/utils/until.test.js +++ /dev/null @@ -1,111 +0,0 @@ -import * as React from 'react'; -import { expect } from 'chai'; -import PropTypes from 'prop-types'; -import { shallow } from 'enzyme'; -import until from './until'; - -const Div = () =>
    ; -const hoc = (Component) => () => ; - -describe('until', () => { - it('shallow renders the current wrapper one level deep', () => { - const EnhancedDiv = hoc(Div); - const wrapper = until.call(shallow(), 'Div'); - expect(wrapper.contains(
    )).to.equal(true); - }); - - it('shallow renders the current wrapper several levels deep', () => { - const EnhancedDiv = hoc(hoc(hoc(Div))); - const wrapper = until.call(shallow(), 'Div'); - expect(wrapper.contains(
    )).to.equal(true); - }); - - it('stops shallow rendering when the wrapper is empty', () => { - const nullHoc = () => () => null; - const EnhancedDiv = nullHoc(); - const wrapper = until.call(shallow(), 'Div'); - expect(wrapper.html()).to.equal(null); - }); - - it('shallow renders as much as possible when no selector is provided', () => { - const EnhancedDiv = hoc(hoc(Div)); - const wrapper = until.call(shallow()); - expect(wrapper.contains(
    )).to.equal(true); - }); - - it('shallow renders the current wrapper even if the selector never matches', () => { - const EnhancedDiv = hoc(Div); - const wrapper = until.call(shallow(), 'NotDiv'); - expect(wrapper.contains(
    )).to.equal(true); - }); - - it('stops shallow rendering when it encounters a HTML element', () => { - const wrapper = until.call( - shallow( -
    -
    -
    , - ), - 'Div', - ); - expect( - wrapper.contains( -
    -
    -
    , - ), - ).to.equal(true); - }); - - it('throws when until called on an empty wrapper', () => { - expect(() => { - until.call(shallow(
    ).find('Foo'), 'div'); - }).to.throw(Error); - }); - - it('shallow renders non-root wrappers', () => { - const Container = () => ( -
    -
    -
    - ); - const wrapper = until.call(shallow().find(Div)); - expect(wrapper.contains(
    )).to.equal(true); - }); - - // eslint-disable-next-line react/prefer-stateless-function - class Foo extends React.Component { - render() { - return
    ; - } - } - - Foo.contextTypes = { - quux: PropTypes.bool.isRequired, - }; - - it('context propagation passes down context from the root component', () => { - const EnhancedFoo = hoc(Foo); - const options = { context: { quux: true } }; - const wrapper = until.call(shallow(, options), 'Foo', options); - expect(wrapper.context('quux')).to.equal(true); - expect(wrapper.contains(
    )).to.equal(true); - }); - - class Bar extends React.Component { - static childContextTypes = { quux: PropTypes.bool }; - - getChildContext = () => ({ quux: true }); - - render() { - return ; - } - } - - it('context propagation passes down context from an intermediary component', () => { - const EnhancedBar = hoc(Bar); - const wrapper = until.call(shallow(), 'Foo'); - expect(wrapper.context('quux')).to.equal(true); - expect(wrapper.contains(
    )).to.equal(true); - }); -}); diff --git a/yarn.lock b/yarn.lock index f1651655667f4b..f2bc25201a1e65 100644 --- a/yarn.lock +++ b/yarn.lock @@ -51,7 +51,7 @@ semver "^6.3.0" source-map "^0.5.0" -"@babel/generator@^7.14.5", "@babel/generator@^7.6.2": +"@babel/generator@^7.12.11", "@babel/generator@^7.14.5", "@babel/generator@^7.6.2": version "7.14.5" resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.14.5.tgz#848d7b9f031caca9d0cd0af01b063f226f52d785" integrity sha512-y3rlP+/G25OIX3mYKKIOlQRcqj7YgrvHxOLbVmyLJ9bPmi5ttvUmpydVjcFjZphOktWuA7ovbx91ECloWTfjIA== @@ -279,10 +279,10 @@ regenerator-runtime "^0.13.4" v8flags "^3.1.1" -"@babel/parser@^7.1.0", "@babel/parser@^7.13.16", "@babel/parser@^7.14.5", "@babel/parser@^7.7.5", "@babel/parser@^7.8.3": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.14.5.tgz#4cd2f346261061b2518873ffecdf1612cb032829" - integrity sha512-TM8C+xtH/9n1qzX+JNHi7AN2zHMTiPUtspO0ZdHflW8KaskkALhMmuMHb4bCmNdv9VAPzJX3/bXqkVLnAvsPfg== +"@babel/parser@^7.1.0", "@babel/parser@^7.13.16", "@babel/parser@^7.14.5", "@babel/parser@^7.14.7", "@babel/parser@^7.7.5", "@babel/parser@^7.8.3": + version "7.14.7" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.14.7.tgz#6099720c8839ca865a2637e6c85852ead0bdb595" + integrity sha512-X67Z5y+VBJuHB/RjwECp8kSl5uYi0BvRbNeWqkaJCVh+LiTPl19WBUfG627psSgp9rSf6ojuXghQM3ha6qHHdA== "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@^7.14.5": version "7.14.5" @@ -1035,17 +1035,17 @@ "@babel/parser" "^7.14.5" "@babel/types" "^7.14.5" -"@babel/traverse@^7.13.0", "@babel/traverse@^7.14.5", "@babel/traverse@^7.4.5", "@babel/traverse@^7.6.2", "@babel/traverse@^7.7.4", "@babel/traverse@^7.8.3": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.14.5.tgz#c111b0f58afab4fea3d3385a406f692748c59870" - integrity sha512-G3BiS15vevepdmFqmUc9X+64y0viZYygubAMO8SvBmKARuF6CPSZtH4Ng9vi/lrWlZFGe3FWdXNy835akH8Glg== +"@babel/traverse@^7.1.6", "@babel/traverse@^7.13.0", "@babel/traverse@^7.14.5", "@babel/traverse@^7.4.5", "@babel/traverse@^7.6.2", "@babel/traverse@^7.7.4", "@babel/traverse@^7.8.3": + version "7.14.7" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.14.7.tgz#64007c9774cfdc3abd23b0780bc18a3ce3631753" + integrity sha512-9vDr5NzHu27wgwejuKL7kIOm4bwEtaPQ4Z6cpCmjSuaRqpH/7xc4qcGEscwMqlkwgcXl6MvqoAjZkQ24uSdIZQ== dependencies: "@babel/code-frame" "^7.14.5" "@babel/generator" "^7.14.5" "@babel/helper-function-name" "^7.14.5" "@babel/helper-hoist-variables" "^7.14.5" "@babel/helper-split-export-declaration" "^7.14.5" - "@babel/parser" "^7.14.5" + "@babel/parser" "^7.14.7" "@babel/types" "^7.14.5" debug "^4.1.0" globals "^11.1.0" @@ -1059,7 +1059,7 @@ lodash "^4.17.13" to-fast-properties "^2.0.0" -"@babel/types@^7.0.0", "@babel/types@^7.14.5", "@babel/types@^7.3.0", "@babel/types@^7.4.4", "@babel/types@^7.5.0", "@babel/types@^7.6.1": +"@babel/types@^7.0.0", "@babel/types@^7.14.5", "@babel/types@^7.2.0", "@babel/types@^7.3.0", "@babel/types@^7.4.4", "@babel/types@^7.5.0", "@babel/types@^7.6.1": version "7.14.5" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.14.5.tgz#3bb997ba829a2104cedb20689c4a5b8121d383ff" integrity sha512-M/NzBpEL95I5Hh4dwhin5JlE7EzO5PHMAuzjxss3tiOBD46KfQvVedN/3jEPZvdRvtsK2222XfdHogNIttFgcg== @@ -1067,18 +1067,23 @@ "@babel/helper-validator-identifier" "^7.14.5" to-fast-properties "^2.0.0" -"@chakra-ui/color-mode@1.1.8": - version "1.1.8" - resolved "https://registry.yarnpkg.com/@chakra-ui/color-mode/-/color-mode-1.1.8.tgz#a5648c017868d22947827009e5ea4f0cd0d0ad87" - integrity sha512-hmSK02Eozu42g1yaQIXfJg+8Dag/YoeaQLS8Ygk6OEGEZrILMxLbFEBvzxaCJt5GCKOuVc/9aGsn31N7c4SNrA== +"@bcoe/v8-coverage@^0.2.3": + version "0.2.3" + resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" + integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== + +"@chakra-ui/color-mode@1.1.9": + version "1.1.9" + resolved "https://registry.yarnpkg.com/@chakra-ui/color-mode/-/color-mode-1.1.9.tgz#7cda49574fb73f793c2b0816be803689a4f51b55" + integrity sha512-Bb8HpoJ4dzrYUIOHzIf0Ph+82ZphYEmRxc4Hd/ilCa5PGTHmOh7SSoFs6RToU4j/9Xmz32eKF6ioT6m6Fh8ycQ== dependencies: - "@chakra-ui/hooks" "1.5.2" + "@chakra-ui/hooks" "1.5.3" "@chakra-ui/utils" "1.8.0" -"@chakra-ui/hooks@1.5.2": - version "1.5.2" - resolved "https://registry.yarnpkg.com/@chakra-ui/hooks/-/hooks-1.5.2.tgz#9bde3c698790a0c94286701cad6ec2ce09c1484c" - integrity sha512-8rpZbrB3yFgKAjEwzafJkYOckRNYDQ6sSt0IWOFsfwGSGB3RxX19tKiGMziqU/djzKEGU85QErsVYVC1v0tJ3A== +"@chakra-ui/hooks@1.5.3": + version "1.5.3" + resolved "https://registry.yarnpkg.com/@chakra-ui/hooks/-/hooks-1.5.3.tgz#d1988fc028ee04e61d625de2d33b991d4d1b8d8c" + integrity sha512-a8j87nnS5mGopsNkEPmvXPOuW+Ua4vS3sQh48esx8WXQ3v9V2/XcJ8+eTA4AMJGhxXCU63brU2BciyN9dkxYwA== dependencies: "@chakra-ui/react-utils" "1.1.2" "@chakra-ui/utils" "1.8.0" @@ -1092,22 +1097,22 @@ dependencies: "@chakra-ui/utils" "^1.7.0" -"@chakra-ui/styled-system@1.11.1": - version "1.11.1" - resolved "https://registry.yarnpkg.com/@chakra-ui/styled-system/-/styled-system-1.11.1.tgz#f9571752fcb41f3621f8e2bb69dbf6e81808178c" - integrity sha512-bVR2g8vmQHyjVsj1QccH+d7I+mi1Whd6qJk25Nz2bl2UKO7z8hsxmV9KK3ZGGTQsY7/Kjy6wAas0waElJVdHyw== +"@chakra-ui/styled-system@1.12.0": + version "1.12.0" + resolved "https://registry.yarnpkg.com/@chakra-ui/styled-system/-/styled-system-1.12.0.tgz#acc8f89aefa799dced8d5e805f1817fbd56cf837" + integrity sha512-bDs5K7ZnIeBcVOkaOSW/L8/b+ToEG0YH5+MtTxxK8OXwfoFKnuZKfxqwzcM2PDqg3LKb+qPcGBB+BkidTgUorg== dependencies: "@chakra-ui/utils" "1.8.0" csstype "^3.0.6" "@chakra-ui/system@^1.0.0": - version "1.6.7" - resolved "https://registry.yarnpkg.com/@chakra-ui/system/-/system-1.6.7.tgz#aca7f18e8932a87d6f3c77d619360fd1e403423a" - integrity sha512-dEZzEzrEF2p/b/9b+v/RNoTWCBcbzCz5aTYC5ZkOfYQt/BQ9hT0b4KGuklfvHkqXSbvbwMoTAGmgTV99h8YLcQ== + version "1.7.0" + resolved "https://registry.yarnpkg.com/@chakra-ui/system/-/system-1.7.0.tgz#2cd05beabeb5a2ceceaaa628760b194093ab93f4" + integrity sha512-/ke6XjsZ5RwSuxQh9BKdAZZ36buDmUjZb6lcYgYdPW365L9ZwFnT9jlIv3ch729O4xfzXPuIh1pCdrv+iu4PWw== dependencies: - "@chakra-ui/color-mode" "1.1.8" + "@chakra-ui/color-mode" "1.1.9" "@chakra-ui/react-utils" "1.1.2" - "@chakra-ui/styled-system" "1.11.1" + "@chakra-ui/styled-system" "1.12.0" "@chakra-ui/utils" "1.8.0" react-fast-compare "3.2.0" @@ -1355,15 +1360,15 @@ react-test-renderer "^17.0.0" semver "^5.7.0" -"@eslint/eslintrc@^0.4.1": - version "0.4.1" - resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.4.1.tgz#442763b88cecbe3ee0ec7ca6d6dd6168550cbf14" - integrity sha512-5v7TDE9plVhvxQeWLXDTvFvJBdH6pEsdnl2g/dAptmuFEPedQ4Erq5rsDsX+mvAM610IhNaO2W5V1dOOnDKxkQ== +"@eslint/eslintrc@^0.4.2": + version "0.4.2" + resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.4.2.tgz#f63d0ef06f5c0c57d76c4ab5f63d3835c51b0179" + integrity sha512-8nmGq/4ycLpIwzvhI4tNDmQztZ8sp+hI7cyG8i1nQDhkAbRzHpXPidRAHlNvCZQpJTKw5ItIpMw9RSToGF00mg== dependencies: ajv "^6.12.4" debug "^4.1.1" espree "^7.3.0" - globals "^12.1.0" + globals "^13.9.0" ignore "^4.0.6" import-fresh "^3.2.1" js-yaml "^3.13.1" @@ -1442,6 +1447,17 @@ "@types/yargs" "^15.0.0" chalk "^4.0.0" +"@jest/types@^27.0.2": + version "27.0.2" + resolved "https://registry.yarnpkg.com/@jest/types/-/types-27.0.2.tgz#e153d6c46bda0f2589f0702b071f9898c7bbd37e" + integrity sha512-XpjCtJ/99HB4PmyJ2vgmN7vT+JLP7RW1FBT9RgnMFS4Dt7cvIyBee8O3/j98aUZ34ZpenPZFqmaaObWSeL65dg== + dependencies: + "@types/istanbul-lib-coverage" "^2.0.0" + "@types/istanbul-reports" "^3.0.0" + "@types/node" "*" + "@types/yargs" "^16.0.0" + chalk "^4.0.0" + "@lerna/add@4.0.0": version "4.0.0" resolved "https://registry.yarnpkg.com/@lerna/add/-/add-4.0.0.tgz#c36f57d132502a57b9e7058d1548b7a565ef183f" @@ -2114,9 +2130,9 @@ write-file-atomic "^3.0.3" "@material-ui/data-grid@^4.0.0-alpha.29": - version "4.0.0-alpha.31" - resolved "https://registry.yarnpkg.com/@material-ui/data-grid/-/data-grid-4.0.0-alpha.31.tgz#0428e9b3a881f0ac68bcaa9e4cf9b11f7fcdb3cb" - integrity sha512-tzXfBgKWlByJlDcqgyUTHQxjr6nMfiqkkGeyCzTHeLVGb5iMdZtvwbamUSTSJ9TLzVqS4o5ZQcsEEAYVXqMkTA== + version "4.0.0-alpha.32" + resolved "https://registry.yarnpkg.com/@material-ui/data-grid/-/data-grid-4.0.0-alpha.32.tgz#72952d1dea9a9440a02827dd66996a8e94d3f28f" + integrity sha512-yEmQ8OGGHCB9fUx6f6/ncIxAQpH/U/295EqqocCsbIjLJA1rUYF5eseo2/jnW1Wd69o3aTsXozdlKV8tQNit2Q== dependencies: "@material-ui/utils" "^5.0.0-alpha.14" clsx "^1.0.4" @@ -2628,27 +2644,27 @@ dependencies: defer-to-connect "^1.0.1" -"@testing-library/dom@^7.22.1", "@testing-library/dom@^7.28.1": - version "7.31.0" - resolved "https://registry.yarnpkg.com/@testing-library/dom/-/dom-7.31.0.tgz#938451abd3ca27e1b69bb395d4a40759fd7f5b3b" - integrity sha512-0X7ACg4YvTRDFMIuTOEj6B4NpN7i3F/4j5igOcTI5NC5J+N4TribNdErCHOZF1LBWhhcyfwxelVwvoYNMUXTOA== +"@testing-library/dom@^8.0.0": + version "8.0.0" + resolved "https://registry.yarnpkg.com/@testing-library/dom/-/dom-8.0.0.tgz#2bb994393c566aae021db86dd263ba06e8b71b38" + integrity sha512-Ym375MTOpfszlagRnTMO+FOfTt6gRrWiDOWmEnWLu9OvwCPOWtK6i5pBHmZ07wUJiQ7wWz0t8+ZBK2wFo2tlew== dependencies: "@babel/code-frame" "^7.10.4" "@babel/runtime" "^7.12.5" "@types/aria-query" "^4.2.0" aria-query "^4.2.2" chalk "^4.1.0" - dom-accessibility-api "^0.5.4" + dom-accessibility-api "^0.5.6" lz-string "^1.4.4" - pretty-format "^26.6.2" + pretty-format "^27.0.2" -"@testing-library/react@^11.0.2": - version "11.2.7" - resolved "https://registry.yarnpkg.com/@testing-library/react/-/react-11.2.7.tgz#b29e2e95c6765c815786c0bc1d5aed9cb2bf7818" - integrity sha512-tzRNp7pzd5QmbtXNG/mhdcl7Awfu/Iz1RaVHY75zTdOkmHCuzMhRL83gWHSgOAcjS3CCbyfwUHMZgRJb4kAfpA== +"@testing-library/react@^12.0.0": + version "12.0.0" + resolved "https://registry.yarnpkg.com/@testing-library/react/-/react-12.0.0.tgz#9aeb2264521522ab9b68f519eaf15136148f164a" + integrity sha512-sh3jhFgEshFyJ/0IxGltRhwZv2kFKfJ3fN1vTZ6hhMXzz9ZbbcTgmDYM4e+zJv+oiVKKEWZPyqPAh4MQBI65gA== dependencies: "@babel/runtime" "^7.12.5" - "@testing-library/dom" "^7.28.1" + "@testing-library/dom" "^8.0.0" "@theme-ui/color-modes@0.9.1": version "0.9.1" @@ -2927,7 +2943,7 @@ resolved "https://registry.yarnpkg.com/@types/html-minifier-terser/-/html-minifier-terser-5.1.1.tgz#3c9ee980f1a10d6021ae6632ca3e79ca2ec4fb50" integrity sha512-giAlZwstKbmvMk1OO7WXSj4OZ0keXAcl2TQq4LWHiiPH2ByaH7WeUzng+Qej8UPxxv+8lRTuouo0iaNDBuzIBA== -"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0": +"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0", "@types/istanbul-lib-coverage@^2.0.1": version "2.0.3" resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.3.tgz#4ba8ddb720221f432e443bd5f9117fd22cfd4762" integrity sha512-sz7iLqvVUg1gIedBOvlkxPlc8/uVzyS5OwGz1cKjXzkl3FpL3al0crU8YGU1WoHkxn0Wxbw5tyi6hvzJKNzFsw== @@ -2955,9 +2971,9 @@ recast "^0.20.3" "@types/jsdom@^16.1.0": - version "16.2.10" - resolved "https://registry.yarnpkg.com/@types/jsdom/-/jsdom-16.2.10.tgz#c05ea94682d035943ae2453b79d56178496b6653" - integrity sha512-q3aIjp3ehhVSXSbvNyuireAfvU2umRiZ2aLumyeZewCnoNaokrRDdTu5IvaeE9pzNtWHXrUnM9lb22Vl3W08EA== + version "16.2.11" + resolved "https://registry.yarnpkg.com/@types/jsdom/-/jsdom-16.2.11.tgz#e18bd29e0678bb9a16ee74d3c0fb9788e8a4286b" + integrity sha512-Dvtx0zFQOJqn06VgjRur7P5CeSNUOaQ5ivSSvdAdA3sBWzL3kl9OWApQRExKnS3XN39OaZdeCHpoYxVmX6FwCQ== dependencies: "@types/node" "*" "@types/parse5" "*" @@ -3003,9 +3019,9 @@ markdown-to-jsx "*" "@types/marked@^2.0.0": - version "2.0.2" - resolved "https://registry.yarnpkg.com/@types/marked/-/marked-2.0.2.tgz#33a15106383f6e42cd6bdd38093e6b19904e29e1" - integrity sha512-P4zanhCQKs4tiWPPBGpB7lHflgFCP9DFGNI5YtpW9MALKoy2qs9rHNWJ+z55cegD9uCfnmsKuaosq9FNvbxrOw== + version "2.0.3" + resolved "https://registry.yarnpkg.com/@types/marked/-/marked-2.0.3.tgz#c8ea93684e530cc3b667d3e7226556dd0844ad1f" + integrity sha512-lbhSN1rht/tQ+dSWxawCzGgTfxe9DB31iLgiT1ZVT5lshpam/nyOA1m3tKHRoNPctB2ukSL22JZI5Fr+WI/zYg== "@types/mdast@^3.0.0": version "3.0.3" @@ -3070,9 +3086,9 @@ integrity sha512-KfRL3PuHmqQLOG+2tGpRO26Ctg+Cq1E01D2DMriKEATHgWLfeNDmq9e29Q9WIky0dQ3NPkd1mzYH8Lm936Z9qw== "@types/react-dom@^17.0.0": - version "17.0.5" - resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-17.0.5.tgz#df44eed5b8d9e0b13bb0cd38e0ea6572a1231227" - integrity sha512-ikqukEhH4H9gr4iJCmQVNzTB307kROe3XFfHAOTxOXPOw7lAoEXnM5KWTkzeANGL5Ce6ABfiMl/zJBYNi7ObmQ== + version "17.0.8" + resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-17.0.8.tgz#3180de6d79bf53762001ad854e3ce49f36dd71fc" + integrity sha512-0ohAiJAx1DAUEcY9UopnfwCE9sSMDGnY/oXjWMax6g3RpzmTt2GMyMVAXcbn0mo8XAff0SbQJl2/SBU+hjSZ1A== dependencies: "@types/react" "*" @@ -3156,9 +3172,9 @@ "@types/react" "*" "@types/react@*", "@types/react@^17.0.0", "@types/react@^17.0.3": - version "17.0.5" - resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.5.tgz#3d887570c4489011f75a3fc8f965bf87d09a1bea" - integrity sha512-bj4biDB9ZJmGAYTWSKJly6bMr4BLUiBrx9ujiJEoP9XIDY9CTaPGxE5QWN/1WjpPLzYF7/jRNnV2nNxNe970sw== + version "17.0.11" + resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.11.tgz#67fcd0ddbf5a0b083a0f94e926c7d63f3b836451" + integrity sha512-yFRQbD+whVonItSk7ZzP/L+gPTJVBkL/7shLEF+i9GC/1cV3JmUxEQz6+9ylhUpWSDuqo1N9qEvqS6vTj4USUA== dependencies: "@types/prop-types" "*" "@types/scheduler" "*" @@ -3200,10 +3216,10 @@ resolved "https://registry.yarnpkg.com/@types/source-list-map/-/source-list-map-0.1.2.tgz#0078836063ffaf17412349bba364087e0ac02ec9" integrity sha512-K5K+yml8LTo9bWJI/rECfIPrGgxdpeNbj+d53lwN4QjW1MCwlkhUms+gtdzigTeUyBr09+u8BwOIY3MXvHdcsA== -"@types/styled-components@5.1.9": - version "5.1.9" - resolved "https://registry.yarnpkg.com/@types/styled-components/-/styled-components-5.1.9.tgz#00d3d84b501420521c4db727e3c195459f87a6cf" - integrity sha512-kbEG6YlwK8rucITpKEr6pA4Ho9KSQHUUOzZ9lY3va1mtcjvS3D0wDciFyHEiNHKLL/npZCKDQJqm0x44sPO9oA== +"@types/styled-components@5.1.10": + version "5.1.10" + resolved "https://registry.yarnpkg.com/@types/styled-components/-/styled-components-5.1.10.tgz#b509da9d62be8a02cefd88ec6b820f417429a503" + integrity sha512-g3ZfWlTiyXktASIhcfCicZtqB/fFFnq0a7kPYYxKXNggdrohp8m/9bMmmt3zDvHj2gplWDGCkZByfFnEXfbSWg== dependencies: "@types/hoist-non-react-statics" "*" "@types/react" "*" @@ -3276,6 +3292,13 @@ dependencies: "@types/yargs-parser" "*" +"@types/yargs@^16.0.0": + version "16.0.3" + resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-16.0.3.tgz#4b6d35bb8e680510a7dc2308518a80ee1ef27e01" + integrity sha512-YlFfTGS+zqCgXuXNV26rOIeETOkXnGQXP/pjjL9P0gO/EP9jTmc7pUBhx+jVEIxpq41RX33GQ7N3DzOSfZoglQ== + dependencies: + "@types/yargs-parser" "*" + "@types/yargs@^17.0.0": version "17.0.0" resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-17.0.0.tgz#32f740934eedf0a5cd19470249f317755c91f1ae" @@ -3291,12 +3314,12 @@ "@types/node" "*" "@typescript-eslint/eslint-plugin@^4.11.1": - version "4.26.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.26.0.tgz#12bbd6ebd5e7fabd32e48e1e60efa1f3554a3242" - integrity sha512-yA7IWp+5Qqf+TLbd8b35ySFOFzUfL7i+4If50EqvjT6w35X8Lv0eBHb6rATeWmucks37w+zV+tWnOXI9JlG6Eg== + version "4.27.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.27.0.tgz#0b7fc974e8bc9b2b5eb98ed51427b0be529b4ad0" + integrity sha512-DsLqxeUfLVNp3AO7PC3JyaddmEHTtI9qTSAs+RB6ja27QvIM0TA8Cizn1qcS6vOu+WDLFJzkwkgweiyFhssDdQ== dependencies: - "@typescript-eslint/experimental-utils" "4.26.0" - "@typescript-eslint/scope-manager" "4.26.0" + "@typescript-eslint/experimental-utils" "4.27.0" + "@typescript-eslint/scope-manager" "4.27.0" debug "^4.3.1" functional-red-black-tree "^1.0.1" lodash "^4.17.21" @@ -3304,94 +3327,60 @@ semver "^7.3.5" tsutils "^3.21.0" -"@typescript-eslint/experimental-utils@4.26.0": - version "4.26.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-4.26.0.tgz#ba7848b3f088659cdf71bce22454795fc55be99a" - integrity sha512-TH2FO2rdDm7AWfAVRB5RSlbUhWxGVuxPNzGT7W65zVfl8H/WeXTk1e69IrcEVsBslrQSTDKQSaJD89hwKrhdkw== +"@typescript-eslint/experimental-utils@4.27.0": + version "4.27.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-4.27.0.tgz#78192a616472d199f084eab8f10f962c0757cd1c" + integrity sha512-n5NlbnmzT2MXlyT+Y0Jf0gsmAQzCnQSWXKy4RGSXVStjDvS5we9IWbh7qRVKdGcxT0WYlgcCYUK/HRg7xFhvjQ== dependencies: "@types/json-schema" "^7.0.7" - "@typescript-eslint/scope-manager" "4.26.0" - "@typescript-eslint/types" "4.26.0" - "@typescript-eslint/typescript-estree" "4.26.0" + "@typescript-eslint/scope-manager" "4.27.0" + "@typescript-eslint/types" "4.27.0" + "@typescript-eslint/typescript-estree" "4.27.0" eslint-scope "^5.1.1" eslint-utils "^3.0.0" "@typescript-eslint/parser@^4.11.1", "@typescript-eslint/parser@^4.4.1": - version "4.22.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-4.22.1.tgz#a95bda0fd01d994a15fc3e99dc984294f25c19cc" - integrity sha512-l+sUJFInWhuMxA6rtirzjooh8cM/AATAe3amvIkqKFeMzkn85V+eLzb1RyuXkHak4dLfYzOmF6DXPyflJvjQnw== + version "4.27.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-4.27.0.tgz#85447e573364bce4c46c7f64abaa4985aadf5a94" + integrity sha512-XpbxL+M+gClmJcJ5kHnUpBGmlGdgNvy6cehgR6ufyxkEJMGP25tZKCaKyC0W/JVpuhU3VU1RBn7SYUPKSMqQvQ== dependencies: - "@typescript-eslint/scope-manager" "4.22.1" - "@typescript-eslint/types" "4.22.1" - "@typescript-eslint/typescript-estree" "4.22.1" - debug "^4.1.1" - -"@typescript-eslint/scope-manager@4.22.1": - version "4.22.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-4.22.1.tgz#5bb357f94f9cd8b94e6be43dd637eb73b8f355b4" - integrity sha512-d5bAiPBiessSmNi8Amq/RuLslvcumxLmyhf1/Xa9IuaoFJ0YtshlJKxhlbY7l2JdEk3wS0EnmnfeJWSvADOe0g== - dependencies: - "@typescript-eslint/types" "4.22.1" - "@typescript-eslint/visitor-keys" "4.22.1" + "@typescript-eslint/scope-manager" "4.27.0" + "@typescript-eslint/types" "4.27.0" + "@typescript-eslint/typescript-estree" "4.27.0" + debug "^4.3.1" -"@typescript-eslint/scope-manager@4.26.0": - version "4.26.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-4.26.0.tgz#60d1a71df162404e954b9d1c6343ff3bee496194" - integrity sha512-G6xB6mMo4xVxwMt5lEsNTz3x4qGDt0NSGmTBNBPJxNsrTXJSm21c6raeYroS2OwQsOyIXqKZv266L/Gln1BWqg== +"@typescript-eslint/scope-manager@4.27.0": + version "4.27.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-4.27.0.tgz#b0b1de2b35aaf7f532e89c8e81d0fa298cae327d" + integrity sha512-DY73jK6SEH6UDdzc6maF19AHQJBFVRf6fgAXHPXCGEmpqD4vYgPEzqpFz1lf/daSbOcMpPPj9tyXXDPW2XReAw== dependencies: - "@typescript-eslint/types" "4.26.0" - "@typescript-eslint/visitor-keys" "4.26.0" - -"@typescript-eslint/types@4.22.1": - version "4.22.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.22.1.tgz#bf99c6cec0b4a23d53a61894816927f2adad856a" - integrity sha512-2HTkbkdAeI3OOcWbqA8hWf/7z9c6gkmnWNGz0dKSLYLWywUlkOAQ2XcjhlKLj5xBFDf8FgAOF5aQbnLRvgNbCw== + "@typescript-eslint/types" "4.27.0" + "@typescript-eslint/visitor-keys" "4.27.0" -"@typescript-eslint/types@4.26.0": - version "4.26.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.26.0.tgz#7c6732c0414f0a69595f4f846ebe12616243d546" - integrity sha512-rADNgXl1kS/EKnDr3G+m7fB9yeJNnR9kF7xMiXL6mSIWpr3Wg5MhxyfEXy/IlYthsqwBqHOr22boFbf/u6O88A== +"@typescript-eslint/types@4.27.0": + version "4.27.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.27.0.tgz#712b408519ed699baff69086bc59cd2fc13df8d8" + integrity sha512-I4ps3SCPFCKclRcvnsVA/7sWzh7naaM/b4pBO2hVxnM3wrU51Lveybdw5WoIktU/V4KfXrTt94V9b065b/0+wA== -"@typescript-eslint/typescript-estree@4.22.1": - version "4.22.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.22.1.tgz#dca379eead8cdfd4edc04805e83af6d148c164f9" - integrity sha512-p3We0pAPacT+onSGM+sPR+M9CblVqdA9F1JEdIqRVlxK5Qth4ochXQgIyb9daBomyQKAXbygxp1aXQRV0GC79A== +"@typescript-eslint/typescript-estree@4.27.0": + version "4.27.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.27.0.tgz#189a7b9f1d0717d5cccdcc17247692dedf7a09da" + integrity sha512-KH03GUsUj41sRLLEy2JHstnezgpS5VNhrJouRdmh6yNdQ+yl8w5LrSwBkExM+jWwCJa7Ct2c8yl8NdtNRyQO6g== dependencies: - "@typescript-eslint/types" "4.22.1" - "@typescript-eslint/visitor-keys" "4.22.1" - debug "^4.1.1" - globby "^11.0.1" - is-glob "^4.0.1" - semver "^7.3.2" - tsutils "^3.17.1" - -"@typescript-eslint/typescript-estree@4.26.0": - version "4.26.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.26.0.tgz#aea17a40e62dc31c63d5b1bbe9a75783f2ce7109" - integrity sha512-GHUgahPcm9GfBuy3TzdsizCcPjKOAauG9xkz9TR8kOdssz2Iz9jRCSQm6+aVFa23d5NcSpo1GdHGSQKe0tlcbg== - dependencies: - "@typescript-eslint/types" "4.26.0" - "@typescript-eslint/visitor-keys" "4.26.0" + "@typescript-eslint/types" "4.27.0" + "@typescript-eslint/visitor-keys" "4.27.0" debug "^4.3.1" globby "^11.0.3" is-glob "^4.0.1" semver "^7.3.5" tsutils "^3.21.0" -"@typescript-eslint/visitor-keys@4.22.1": - version "4.22.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.22.1.tgz#6045ae25a11662c671f90b3a403d682dfca0b7a6" - integrity sha512-WPkOrIRm+WCLZxXQHCi+WG8T2MMTUFR70rWjdWYddLT7cEfb2P4a3O/J2U1FBVsSFTocXLCoXWY6MZGejeStvQ== +"@typescript-eslint/visitor-keys@4.27.0": + version "4.27.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.27.0.tgz#f56138b993ec822793e7ebcfac6ffdce0a60cb81" + integrity sha512-es0GRYNZp0ieckZ938cEANfEhsfHrzuLrePukLKtY3/KPXcq1Xd555Mno9/GOgXhKzn0QfkDLVgqWO3dGY80bg== dependencies: - "@typescript-eslint/types" "4.22.1" - eslint-visitor-keys "^2.0.0" - -"@typescript-eslint/visitor-keys@4.26.0": - version "4.26.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.26.0.tgz#26d2583169222815be4dcd1da4fe5459bc3bcc23" - integrity sha512-cw4j8lH38V1ycGBbF+aFiLUls9Z0Bw8QschP3mkth50BbWzgFS33ISIgBzUMuQ2IdahoEv/rXstr8Zhlz4B1Zg== - dependencies: - "@typescript-eslint/types" "4.26.0" + "@typescript-eslint/types" "4.27.0" eslint-visitor-keys "^2.0.0" "@ungap/promise-all-settled@1.1.2": @@ -3858,6 +3847,11 @@ ansi-styles@^4.0.0, ansi-styles@^4.1.0: "@types/color-name" "^1.1.1" color-convert "^2.0.1" +ansi-styles@^5.0.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-5.2.0.tgz#07449690ad45777d1924ac2abb2fc8895dba836b" + integrity sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA== + any-promise@^1.0.0: version "1.3.0" resolved "https://registry.yarnpkg.com/any-promise/-/any-promise-1.3.0.tgz#abc6afeedcea52e809cdc0376aed3ce39635d17f" @@ -4276,9 +4270,9 @@ available-typed-arrays@^1.0.2: array-filter "^1.0.0" aws-sdk@^2.607.0, aws-sdk@^2.766.0: - version "2.918.0" - resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.918.0.tgz#e4323de000262beb762e9c139f89e07282462f17" - integrity sha512-ZjWanOA1Zo664EyWLCnbUlkwCjoRPmSIMx529W4gk1418qo3oCEcvUy1HeibGGIClYnZZ7J4FMQvVDm2+JtHLQ== + version "2.931.0" + resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.931.0.tgz#7fdc886fa7697095203fe7de16bc948a8b1c8daa" + integrity sha512-Db97/aJq8zYl8mHzY6dNO6m9S89TqN4HEUUc2aCYQCTyMb/eNrjf+uZTnutnQbJkClqHzxFcWc3aqe5VlTac/A== dependencies: buffer "4.9.2" events "1.1.1" @@ -4381,10 +4375,10 @@ babel-plugin-module-resolver@^4.0.0: reselect "^4.0.0" resolve "^1.13.1" -babel-plugin-optimize-clsx@^2.3.0, babel-plugin-optimize-clsx@^2.4.1: - version "2.6.1" - resolved "https://registry.yarnpkg.com/babel-plugin-optimize-clsx/-/babel-plugin-optimize-clsx-2.6.1.tgz#2c9b58811bb86553beedd03b69486d370700a7f5" - integrity sha512-uPatuZ4FhqsQ23IhoZNOVoVLCFYBvIwVgWJ4WdUbwaZvsooitwbbwwtQxQHljUiCpMEZGkVln/OLMIdwrlCs1g== +babel-plugin-optimize-clsx@^2.6.2: + version "2.6.2" + resolved "https://registry.yarnpkg.com/babel-plugin-optimize-clsx/-/babel-plugin-optimize-clsx-2.6.2.tgz#9aaa42faffbe481cb0272fc65631f94889c6c5b7" + integrity sha512-TxgyjdVb7trTAsg/J5ByqJdbBPTYR8yaWLGQGpSxwygw8IFST5gEc1J9QktCGCHCb+69t04DWg9KOE0y2hN30w== dependencies: "@babel/generator" "^7.6.2" "@babel/template" "^7.6.0" @@ -4914,6 +4908,24 @@ bytes@3.1.0, bytes@^3.1.0: resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.0.tgz#f6cf7933a360e0588fa9fde85651cdc7f805d1f6" integrity sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg== +c8@^7.6.0: + version "7.7.3" + resolved "https://registry.yarnpkg.com/c8/-/c8-7.7.3.tgz#5af8f83b55dace03b353375e7a2ba85e2c13b17f" + integrity sha512-ZyA7n3w8i4ETV25tVYMHwJxCSnaOf/LfA8vOcuZOPbonuQfD7tBT/gMWZy7eczRpCDuHcvMXwoqAemg6R0p3+A== + dependencies: + "@bcoe/v8-coverage" "^0.2.3" + "@istanbuljs/schema" "^0.1.2" + find-up "^5.0.0" + foreground-child "^2.0.0" + istanbul-lib-coverage "^3.0.0" + istanbul-lib-report "^3.0.0" + istanbul-reports "^3.0.2" + rimraf "^3.0.0" + test-exclude "^6.0.0" + v8-to-istanbul "^8.0.0" + yargs "^16.2.0" + yargs-parser "^20.2.7" + cacache@^12.0.2: version "12.0.2" resolved "https://registry.yarnpkg.com/cacache/-/cacache-12.0.2.tgz#8db03205e36089a3df6954c66ce92541441ac46c" @@ -5794,13 +5806,20 @@ conventional-recommended-bump@^6.1.0: meow "^8.0.0" q "^1.5.1" -convert-source-map@1.7.0, convert-source-map@^1.1.0, convert-source-map@^1.5.0, convert-source-map@^1.7.0: +convert-source-map@1.7.0: version "1.7.0" resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.7.0.tgz#17a2cb882d7f77d3490585e2ce6c524424a3a442" integrity sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA== dependencies: safe-buffer "~5.1.1" +convert-source-map@^1.1.0, convert-source-map@^1.5.0, convert-source-map@^1.6.0, convert-source-map@^1.7.0: + version "1.8.0" + resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.8.0.tgz#f3373c32d21b4d780dd8004514684fb791ca4369" + integrity sha512-+OQdjP49zViI/6i7nIJpA8rAl4sV/JdPfU9nZs3VqOwGIgizICvuN2ru6fMd+4llL0tar18UYJXfZ/TWtmhUjA== + dependencies: + safe-buffer "~5.1.1" + convict@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/convict/-/convict-6.0.0.tgz#4be829f001a778d337d32ec79e9ae7f2e39df1a6" @@ -6693,10 +6712,10 @@ doctrine@^3.0.0: dependencies: esutils "^2.0.2" -dom-accessibility-api@^0.5.0, dom-accessibility-api@^0.5.4: - version "0.5.4" - resolved "https://registry.yarnpkg.com/dom-accessibility-api/-/dom-accessibility-api-0.5.4.tgz#b06d059cdd4a4ad9a79275f9d414a5c126241166" - integrity sha512-TvrjBckDy2c6v6RLxPv5QXOnU+SmF9nBII5621Ve5fu6Z/BDrENurBEvlC1f44lKEUVqOpK4w9E5Idc5/EgkLQ== +dom-accessibility-api@^0.5.0, dom-accessibility-api@^0.5.6: + version "0.5.6" + resolved "https://registry.yarnpkg.com/dom-accessibility-api/-/dom-accessibility-api-0.5.6.tgz#3f5d43b52c7a3bd68b5fb63fa47b4e4c1fdf65a9" + integrity sha512-DplGLZd8L1lN64jlT27N9TVSESFR5STaEJvX+thCby7fuCHonfPpAlodYc3vuUYbDuDec5w8AMP7oCM5TWFsqw== dom-converter@^0.2: version "0.2.0" @@ -7426,17 +7445,17 @@ eslint-visitor-keys@^1.1.0, eslint-visitor-keys@^1.3.0: integrity sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ== eslint-visitor-keys@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz#21fdc8fbcd9c795cc0321f0563702095751511a8" - integrity sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ== + version "2.1.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz#f65328259305927392c938ed44eb0a5c9b2bd303" + integrity sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw== eslint@^7.4.0: - version "7.27.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.27.0.tgz#665a1506d8f95655c9274d84bd78f7166b07e9c7" - integrity sha512-JZuR6La2ZF0UD384lcbnd0Cgg6QJjiCwhMD6eU4h/VGPcVGwawNNzKU41tgokGXnfjOOyI6QIffthhJTPzzuRA== + version "7.29.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.29.0.tgz#ee2a7648f2e729485e4d0bd6383ec1deabc8b3c0" + integrity sha512-82G/JToB9qIy/ArBzIWG9xvvwL3R86AlCjtGw+A29OMZDqhTybz/MByORSukGxeI+YPCR4coYyITKk8BFH9nDA== dependencies: "@babel/code-frame" "7.12.11" - "@eslint/eslintrc" "^0.4.1" + "@eslint/eslintrc" "^0.4.2" ajv "^6.10.0" chalk "^4.0.0" cross-spawn "^7.0.2" @@ -7453,7 +7472,7 @@ eslint@^7.4.0: fast-deep-equal "^3.1.3" file-entry-cache "^6.0.1" functional-red-black-tree "^1.0.1" - glob-parent "^5.0.0" + glob-parent "^5.1.2" globals "^13.6.0" ignore "^4.0.6" import-fresh "^3.0.0" @@ -7513,6 +7532,15 @@ estraverse@^5.1.0, estraverse@^5.2.0: resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.2.0.tgz#307df42547e6cc7324d3cf03c155d5cdb8c53880" integrity sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ== +estree-to-babel@^3.1.0: + version "3.2.1" + resolved "https://registry.yarnpkg.com/estree-to-babel/-/estree-to-babel-3.2.1.tgz#82e78315275c3ca74475fdc8ac1a5103c8a75bf5" + integrity sha512-YNF+mZ/Wu2FU/gvmzuWtYc8rloubL7wfXCTgouFrnjGVXPA/EeYYA7pupXWrb3Iv1cTBeSSxxJIbK23l4MRNqg== + dependencies: + "@babel/traverse" "^7.1.6" + "@babel/types" "^7.2.0" + c8 "^7.6.0" + estree-walker@^0.5.2: version "0.5.2" resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.5.2.tgz#d3850be7529c9580d815600b53126515e146dd39" @@ -7901,7 +7929,7 @@ find-root@^1.1.0: resolved "https://registry.yarnpkg.com/find-root/-/find-root-1.1.0.tgz#abcfc8ba76f708c42a97b3d685b7e9450bfb9ce4" integrity sha512-NKfW6bec6GfKc0SGx1e07QZY9PE99u0Bft/0rzSD5k3sO/vwkVUpDUKVm5Gpp5Ue3YfShPFTX2070tDs5kB9Ng== -find-up@5.0.0: +find-up@5.0.0, find-up@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc" integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng== @@ -8427,7 +8455,7 @@ glob-parent@^3.1.0: is-glob "^3.1.0" path-dirname "^1.0.0" -glob-parent@^5.0.0, glob-parent@^5.1.0, glob-parent@^5.1.1, glob-parent@^5.1.2, glob-parent@~5.1.0: +glob-parent@^5.1.0, glob-parent@^5.1.1, glob-parent@^5.1.2, glob-parent@~5.1.0: version "5.1.2" resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== @@ -8499,17 +8527,10 @@ globals@^11.1.0: resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== -globals@^12.1.0: - version "12.4.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-12.4.0.tgz#a18813576a41b00a24a97e7f815918c2e19925f8" - integrity sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg== - dependencies: - type-fest "^0.8.1" - -globals@^13.6.0: - version "13.8.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-13.8.0.tgz#3e20f504810ce87a8d72e55aecf8435b50f4c1b3" - integrity sha512-rHtdA6+PDBIjeEvA91rpqzEvk/k3/i7EeNQiryiWuJH0Hw9cpyJMAt2jtbAwUaRdhD+573X4vWw6IcjKPasi9Q== +globals@^13.6.0, globals@^13.9.0: + version "13.9.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-13.9.0.tgz#4bf2bf635b334a173fb1daf7c5e6b218ecdc06cb" + integrity sha512-74/FduwI/JaIrr1H8e71UbDE+5x7pIPs1C2rrwC52SszOo043CsWOZEMW7o2Y58xwm9b+0RBKDxY5n2sUpEFxA== dependencies: type-fest "^0.20.2" @@ -11368,9 +11389,9 @@ mkdirp@^1.0.3, mkdirp@^1.0.4: integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== mocha@^9.0.0: - version "9.0.0" - resolved "https://registry.yarnpkg.com/mocha/-/mocha-9.0.0.tgz#67ce848170cb6426f9e84c57e38376dc9017bab4" - integrity sha512-GRGG/q9bIaUkHJB9NL+KZNjDhMBHB30zW3bZW9qOiYr+QChyLjPzswaxFWkI1q6lGlSL28EQYzAi2vKWNkPx+g== + version "9.0.1" + resolved "https://registry.yarnpkg.com/mocha/-/mocha-9.0.1.tgz#01e66b7af0012330c0a38c4b6eaa6d92b8a81bf9" + integrity sha512-9zwsavlRO+5csZu6iRtl3GHImAbhERoDsZwdRkdJ/bE+eVplmoxNKE901ZJ9LdSchYBjSCPbjKc5XvcAri2ylw== dependencies: "@ungap/promise-all-settled" "1.1.2" ansi-colors "4.1.1" @@ -12991,9 +13012,9 @@ postcss@^7.0.14, postcss@^7.0.2, postcss@^7.0.21, postcss@^7.0.26, postcss@^7.0. supports-color "^6.1.0" postcss@^8.0.6: - version "8.3.2" - resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.3.2.tgz#ed3ec489f5428af5740cd6effcc216b4d455ee64" - integrity sha512-y1FK/AWdZlBF5lusS5j5l4/vF67+vQZt1SXPVJ32y1kRGDQyrs1zk32hG1cInRTu14P0V+orPz+ifwW/7rR4bg== + version "8.3.5" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.3.5.tgz#982216b113412bc20a86289e91eb994952a5b709" + integrity sha512-NxTuJocUhYGsMiMFHDUkmjSKT3EdH4/WbGF6GCi1NDGk+vbcUTun4fpbOqaPtD8IIsztA2ilZm2DhYCuyN58gA== dependencies: colorette "^1.2.2" nanoid "^3.1.23" @@ -13027,7 +13048,7 @@ pretty-error@^2.1.1: lodash "^4.17.20" renderkid "^2.0.4" -pretty-format@^26.0.1, pretty-format@^26.6.2: +pretty-format@^26.0.1: version "26.6.2" resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-26.6.2.tgz#e35c2705f14cb7fe2fe94fa078345b444120fc93" integrity sha512-7AeGuCYNGmycyQbCqd/3PWH4eOoX/OiCa0uphp57NVTeAGdJGaAliecxwBDHYQCIvrW7aDBZCYeNTP/WX69mkg== @@ -13037,6 +13058,16 @@ pretty-format@^26.0.1, pretty-format@^26.6.2: ansi-styles "^4.0.0" react-is "^17.0.1" +pretty-format@^27.0.2: + version "27.0.2" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-27.0.2.tgz#9283ff8c4f581b186b2d4da461617143dca478a4" + integrity sha512-mXKbbBPnYTG7Yra9qFBtqj+IXcsvxsvOBco3QHxtxTl+hHKq6QdzMZ+q0CtL4ORHZgwGImRr2XZUX2EWzORxig== + dependencies: + "@jest/types" "^27.0.2" + ansi-regex "^5.0.0" + ansi-styles "^5.0.0" + react-is "^17.0.1" + prettyjson@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/prettyjson/-/prettyjson-1.2.1.tgz#fcffab41d19cab4dfae5e575e64246619b12d289" @@ -13390,15 +13421,17 @@ react-display-name@^0.2.4: integrity sha512-zvU6iouW+SWwHTyThwxGICjJYCMZFk/6r/+jmOdC7ntQoPlS/Pqb81MkxaMf2bHTSq9TN3K3zX2/ayMW/jCtyA== react-docgen@^5.0.0-beta.1: - version "5.3.1" - resolved "https://registry.yarnpkg.com/react-docgen/-/react-docgen-5.3.1.tgz#940b519646a6c285c2950b96512aed59e8f90934" - integrity sha512-YG7YujVTwlLslr2Ny8nQiUfbBuEwKsLHJdQTSdEga1eY/nRFh/7LjCWUn6ogYhu2WDKg4z+6W/BJtUi+DPUIlA== + version "5.4.0" + resolved "https://registry.yarnpkg.com/react-docgen/-/react-docgen-5.4.0.tgz#2cd7236720ec2769252ef0421f23250b39a153a1" + integrity sha512-JBjVQ9cahmNlfjMGxWUxJg919xBBKAoy3hgDgKERbR+BcF4ANpDuzWAScC7j27hZfd8sJNmMPOLWo9+vB/XJEQ== dependencies: "@babel/core" "^7.7.5" + "@babel/generator" "^7.12.11" "@babel/runtime" "^7.7.6" ast-types "^0.14.2" commander "^2.19.0" doctrine "^3.0.0" + estree-to-babel "^3.1.0" neo-async "^2.6.1" node-dir "^0.1.10" strip-indent "^3.0.0" @@ -13565,35 +13598,35 @@ react-spring@^8.0.27: "@babel/runtime" "^7.3.1" prop-types "^15.5.8" -react-swipeable-views-core@^0.14.0-alpha.0: - version "0.14.0-alpha.0" - resolved "https://registry.yarnpkg.com/react-swipeable-views-core/-/react-swipeable-views-core-0.14.0-alpha.0.tgz#1c40dd1c328c97048a8f2cb9de504ee611ae21dd" - integrity sha512-TQm58RJv01EseBfaeY0kZUIBmhs1NyKXwhJL52iN/UlzbQSiaIE2kk+mSGicUriBK0H7UlScgLeJR91AJ7SVcA== +react-swipeable-views-core@^0.14.0: + version "0.14.0" + resolved "https://registry.yarnpkg.com/react-swipeable-views-core/-/react-swipeable-views-core-0.14.0.tgz#6ac443a7cc7bc5ea022fbd549292bb5fff361cce" + integrity sha512-0W/e9uPweNEOSPjmYtuKSC/SvKKg1sfo+WtPdnxeLF3t2L82h7jjszuOHz9C23fzkvLfdgkaOmcbAxE9w2GEjA== dependencies: "@babel/runtime" "7.0.0" warning "^4.0.1" -react-swipeable-views-utils@^0.14.0-alpha.0: - version "0.14.0-alpha.0" - resolved "https://registry.yarnpkg.com/react-swipeable-views-utils/-/react-swipeable-views-utils-0.14.0-alpha.0.tgz#1bc91cf89d13417a0ca8edc11b4a2c55c4a889b9" - integrity sha512-Ya9Xtr4uE1CYxyrPwtcImzcZFcOr3PP51kRgIOTx3Dx9SF31OtF0t2CgXuypTYTs7G4StRE3NzWlvSBiMZSVtQ== +react-swipeable-views-utils@^0.14.0: + version "0.14.0" + resolved "https://registry.yarnpkg.com/react-swipeable-views-utils/-/react-swipeable-views-utils-0.14.0.tgz#6b76e251906747482730c22002fe47ab1014ba32" + integrity sha512-W+fXBOsDqgFK1/g7MzRMVcDurp3LqO3ksC8UgInh2P/tKgb5DusuuB1geKHFc6o1wKl+4oyER4Zh3Lxmr8xbXA== dependencies: "@babel/runtime" "7.0.0" keycode "^2.1.7" prop-types "^15.6.0" react-event-listener "^0.6.0" - react-swipeable-views-core "^0.14.0-alpha.0" + react-swipeable-views-core "^0.14.0" shallow-equal "^1.2.1" react-swipeable-views@^0.14.0-alpha.0: - version "0.14.0-alpha.0" - resolved "https://registry.yarnpkg.com/react-swipeable-views/-/react-swipeable-views-0.14.0-alpha.0.tgz#53cd109edf612b3121cc7d18cea41ae1af238d34" - integrity sha512-DIw4ig/QtDIbBPBa+15Dski51tp/JPXIbqm9c9hlO32eWzUmMXLXFo+DnieTt1n+KJXrSrduHYWcR48LMP3Tbg== + version "0.14.0" + resolved "https://registry.yarnpkg.com/react-swipeable-views/-/react-swipeable-views-0.14.0.tgz#149c0df3d92220cc89e3f6d5c04a78dfe46f9b54" + integrity sha512-wrTT6bi2nC3JbmyNAsPXffUXLn0DVT9SbbcFr36gKpbaCgEp7rX/OFxsu5hPc/NBsUhHyoSRGvwqJNNrWTwCww== dependencies: "@babel/runtime" "7.0.0" prop-types "^15.5.4" - react-swipeable-views-core "^0.14.0-alpha.0" - react-swipeable-views-utils "^0.14.0-alpha.0" + react-swipeable-views-core "^0.14.0" + react-swipeable-views-utils "^0.14.0" warning "^4.0.1" react-test-renderer@^17.0.0, react-test-renderer@^17.0.1: @@ -16067,7 +16100,7 @@ tsutils@^2.29.0: dependencies: tslib "^1.8.1" -tsutils@^3.17.1, tsutils@^3.21.0: +tsutils@^3.21.0: version "3.21.0" resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.21.0.tgz#b48717d394cea6c1e096983eed58e9d61715b623" integrity sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA== @@ -16551,6 +16584,15 @@ v8-compile-cache@^2.0.3, v8-compile-cache@^2.2.0, v8-compile-cache@^2.3.0: resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz#2de19618c66dc247dcfb6f99338035d8245a2cee" integrity sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA== +v8-to-istanbul@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/v8-to-istanbul/-/v8-to-istanbul-8.0.0.tgz#4229f2a99e367f3f018fa1d5c2b8ec684667c69c" + integrity sha512-LkmXi8UUNxnCC+JlH7/fsfsKr5AU110l+SYGJimWNkWhxbN5EyeOtm1MJ0hhvqMMOhGwBj1Fp70Yv9i+hX0QAg== + dependencies: + "@types/istanbul-lib-coverage" "^2.0.1" + convert-source-map "^1.6.0" + source-map "^0.7.3" + v8flags@^3.1.1: version "3.1.2" resolved "https://registry.yarnpkg.com/v8flags/-/v8flags-3.1.2.tgz#fc5cd0c227428181e6c29b2992e4f8f1da5e0c9f" @@ -17080,7 +17122,7 @@ yaml@^1.10.0, yaml@^1.7.2: resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.0.tgz#3b593add944876077d4d683fee01081bd9fff31e" integrity sha512-yr2icI4glYaNG+KWONODapy2/jDdMSDnrONSjblABjD9B4Z5LgiircSt8m8sRZFNi08kG9Sm0uSHtEmP3zaEGg== -yargs-parser@20.2.4, yargs-parser@^20.2.2, yargs-parser@^20.2.3: +yargs-parser@20.2.4: version "20.2.4" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.4.tgz#b42890f14566796f85ae8e3a25290d205f154a54" integrity sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA== @@ -17093,6 +17135,11 @@ yargs-parser@^18.1.2, yargs-parser@^18.1.3: camelcase "^5.0.0" decamelize "^1.2.0" +yargs-parser@^20.2.2, yargs-parser@^20.2.3, yargs-parser@^20.2.7: + version "20.2.9" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.9.tgz#2eb7dc3b0289718fc295f362753845c41a0c94ee" + integrity sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w== + yargs-unparser@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/yargs-unparser/-/yargs-unparser-2.0.0.tgz#f131f9226911ae5d9ad38c432fe809366c2325eb"