From 10374c4fe23b6128f36729a37ae6764008822b5a Mon Sep 17 00:00:00 2001 From: minjee <104430030+iammminzzy@users.noreply.github.com> Date: Sat, 23 Mar 2024 15:16:48 +0000 Subject: [PATCH 1/9] [core] Remove some IE11 support --- .../src/useAutocomplete/useAutocomplete.js | 24 ++++--------------- .../mui-base/src/useSnackbar/useSnackbar.ts | 3 +-- packages/mui-joy/src/Tooltip/Tooltip.tsx | 3 +-- packages/mui-material/src/Tooltip/Tooltip.js | 3 +-- .../src/styles/createTransitions.js | 4 +--- .../getDisplayName/getDisplayName.test.tsx | 12 +--------- .../src/getDisplayName/getDisplayName.ts | 11 +-------- .../mui-utils/src/getDisplayName/index.ts | 1 - .../src/integerPropType/integerPropType.js | 10 +------- 9 files changed, 12 insertions(+), 59 deletions(-) diff --git a/packages/mui-base/src/useAutocomplete/useAutocomplete.js b/packages/mui-base/src/useAutocomplete/useAutocomplete.js index 344b2cce0efe0f..45caa7dd2123dc 100644 --- a/packages/mui-base/src/useAutocomplete/useAutocomplete.js +++ b/packages/mui-base/src/useAutocomplete/useAutocomplete.js @@ -10,11 +10,8 @@ import { } from '@mui/utils'; // https://stackoverflow.com/questions/990904/remove-accents-diacritics-in-a-string-in-javascript -// Give up on IE11 support for this feature function stripDiacritics(string) { - return typeof string.normalize !== 'undefined' - ? string.normalize('NFD').replace(/[\u0300-\u036f]/g, '') - : string; + return string.normalize('NFD').replace(/[\u0300-\u036f]/g, ''); } export function createFilterOptions(config = {}) { @@ -56,17 +53,6 @@ export function createFilterOptions(config = {}) { }; } -// To replace with .findIndex() once we stop IE11 support. -function findIndex(array, comp) { - for (let i = 0; i < array.length; i += 1) { - if (comp(array[i])) { - return i; - } - } - - return -1; -} - const defaultFilterOptions = createFilterOptions(); // Number of options to jump in list box when `Page Up` and `Page Down` keys are used. @@ -498,7 +484,7 @@ export function useAutocomplete(props) { const previousHighlightedOption = previousProps.filteredOptions[highlightedIndexRef.current]; if (previousHighlightedOption) { - return findIndex(filteredOptions, (option) => { + return filteredOptions.findIndex((option) => { return getOptionLabel(option) === getOptionLabel(previousHighlightedOption); }); } @@ -539,12 +525,12 @@ export function useAutocomplete(props) { if ( multiple && currentOption && - findIndex(value, (val) => isOptionEqualToValue(currentOption, val)) !== -1 + value.findIndex((val) => isOptionEqualToValue(currentOption, val)) !== -1 ) { return; } - const itemIndex = findIndex(filteredOptions, (optionItem) => + const itemIndex = filteredOptions.findIndex((optionItem) => isOptionEqualToValue(optionItem, valueItem), ); if (itemIndex === -1) { @@ -685,7 +671,7 @@ export function useAutocomplete(props) { } } - const itemIndex = findIndex(newValue, (valueItem) => isOptionEqualToValue(option, valueItem)); + const itemIndex = newValue.findIndex((valueItem) => isOptionEqualToValue(option, valueItem)); if (itemIndex === -1) { newValue.push(option); diff --git a/packages/mui-base/src/useSnackbar/useSnackbar.ts b/packages/mui-base/src/useSnackbar/useSnackbar.ts index d2d73cf641af1f..4b9de6ad0754bb 100644 --- a/packages/mui-base/src/useSnackbar/useSnackbar.ts +++ b/packages/mui-base/src/useSnackbar/useSnackbar.ts @@ -44,8 +44,7 @@ export function useSnackbar(parameters: UseSnackbarParameters = {}): UseSnackbar */ function handleKeyDown(nativeEvent: KeyboardEvent) { if (!nativeEvent.defaultPrevented) { - // IE11, Edge (prior to using Blink?) use 'Esc' - if (nativeEvent.key === 'Escape' || nativeEvent.key === 'Esc') { + if (nativeEvent.key === 'Escape') { // not calling `preventDefault` since we don't know if people may ignore this event e.g. a permanently open snackbar onClose?.(nativeEvent, 'escapeKeyDown'); } diff --git a/packages/mui-joy/src/Tooltip/Tooltip.tsx b/packages/mui-joy/src/Tooltip/Tooltip.tsx index 531d3a8b288c1b..22c560f0ecf439 100644 --- a/packages/mui-joy/src/Tooltip/Tooltip.tsx +++ b/packages/mui-joy/src/Tooltip/Tooltip.tsx @@ -409,8 +409,7 @@ const Tooltip = React.forwardRef(function Tooltip(inProps, ref) { } function handleKeyDown(nativeEvent: KeyboardEvent) { - // IE11, Edge (prior to using Bink?) use 'Esc' - if (nativeEvent.key === 'Escape' || nativeEvent.key === 'Esc') { + if (nativeEvent.key === 'Escape') { handleClose(nativeEvent); } } diff --git a/packages/mui-material/src/Tooltip/Tooltip.js b/packages/mui-material/src/Tooltip/Tooltip.js index 05cea653d79888..dc71ddee0481ff 100644 --- a/packages/mui-material/src/Tooltip/Tooltip.js +++ b/packages/mui-material/src/Tooltip/Tooltip.js @@ -473,8 +473,7 @@ const Tooltip = React.forwardRef(function Tooltip(inProps, ref) { * @param {KeyboardEvent} nativeEvent */ function handleKeyDown(nativeEvent) { - // IE11, Edge (prior to using Bink?) use 'Esc' - if (nativeEvent.key === 'Escape' || nativeEvent.key === 'Esc') { + if (nativeEvent.key === 'Escape') { handleClose(nativeEvent); } } diff --git a/packages/mui-material/src/styles/createTransitions.js b/packages/mui-material/src/styles/createTransitions.js index a98b2c2357458e..9f92f9f2d8c4df 100644 --- a/packages/mui-material/src/styles/createTransitions.js +++ b/packages/mui-material/src/styles/createTransitions.js @@ -64,9 +64,7 @@ export default function createTransitions(inputTransitions) { if (process.env.NODE_ENV !== 'production') { const isString = (value) => typeof value === 'string'; - // IE11 support, replace with Number.isNaN - // eslint-disable-next-line no-restricted-globals - const isNumber = (value) => !isNaN(parseFloat(value)); + const isNumber = (value) => !Number.isNaN(parseFloat(value)); if (!isString(props) && !Array.isArray(props)) { console.error('MUI: Argument "props" must be a string or Array.'); } diff --git a/packages/mui-utils/src/getDisplayName/getDisplayName.test.tsx b/packages/mui-utils/src/getDisplayName/getDisplayName.test.tsx index 4d30daac79c0fe..6d2aba0f362085 100644 --- a/packages/mui-utils/src/getDisplayName/getDisplayName.test.tsx +++ b/packages/mui-utils/src/getDisplayName/getDisplayName.test.tsx @@ -1,7 +1,7 @@ /* eslint-disable react/prefer-stateless-function */ import * as React from 'react'; import { expect } from 'chai'; -import getDisplayName, { getFunctionName } from './getDisplayName'; +import getDisplayName from './getDisplayName'; describe('utils/getDisplayName.js', () => { describe('getDisplayName', () => { @@ -75,14 +75,4 @@ describe('utils/getDisplayName.js', () => { expect(getDisplayName(false)).to.equal(undefined); }); }); - - describe('getFunctionName', () => { - it('gets the name of a function', () => { - function SomeFunction() { - return
; - } - - expect(getFunctionName(SomeFunction)).to.equal('SomeFunction'); - }); - }); }); diff --git a/packages/mui-utils/src/getDisplayName/getDisplayName.ts b/packages/mui-utils/src/getDisplayName/getDisplayName.ts index 02164eed56390f..5290cabeea2e29 100644 --- a/packages/mui-utils/src/getDisplayName/getDisplayName.ts +++ b/packages/mui-utils/src/getDisplayName/getDisplayName.ts @@ -1,20 +1,11 @@ import * as React from 'react'; import { ForwardRef, Memo } from 'react-is'; -// Simplified polyfill for IE11 support -// https://github.com/JamesMGreene/Function.name/blob/58b314d4a983110c3682f1228f845d39ccca1817/Function.name.js#L3 -const fnNameMatchRegex = /^\s*function(?:\s|\s*\/\*.*\*\/\s*)+([^(\s/]*)\s*/; -export function getFunctionName(fn: Function): string { - const match = `${fn}`.match(fnNameMatchRegex); - const name = match && match[1]; - return name || ''; -} - function getFunctionComponentName( Component: React.FunctionComponent | React.ComponentClass, fallback = '', ) { - return Component.displayName || Component.name || getFunctionName(Component) || fallback; + return Component.displayName || Component.name || fallback; } function getWrappedName(outerType: any, innerType: any, wrapperName: string) { diff --git a/packages/mui-utils/src/getDisplayName/index.ts b/packages/mui-utils/src/getDisplayName/index.ts index 601cc5db1f7b67..64a7a4597931fb 100644 --- a/packages/mui-utils/src/getDisplayName/index.ts +++ b/packages/mui-utils/src/getDisplayName/index.ts @@ -1,2 +1 @@ export { default } from './getDisplayName'; -export * from './getDisplayName'; diff --git a/packages/mui-utils/src/integerPropType/integerPropType.js b/packages/mui-utils/src/integerPropType/integerPropType.js index 99105c3d03cd79..ca3afc0fab0583 100644 --- a/packages/mui-utils/src/integerPropType/integerPropType.js +++ b/packages/mui-utils/src/integerPropType/integerPropType.js @@ -24,18 +24,10 @@ export function getTypeByValue(value) { } } -// IE 11 support -function ponyfillIsInteger(x) { - // eslint-disable-next-line no-restricted-globals - return typeof x === 'number' && isFinite(x) && Math.floor(x) === x; -} - -const isInteger = Number.isInteger || ponyfillIsInteger; - function requiredInteger(props, propName, componentName, location) { const propValue = props[propName]; - if (propValue == null || !isInteger(propValue)) { + if (propValue == null || !Number.isInteger(propValue)) { const propType = getTypeByValue(propValue); return new RangeError( From e6725107af9115c573b250b23273cc4b04780fac Mon Sep 17 00:00:00 2001 From: minjee <104430030+iammminzzy@users.noreply.github.com> Date: Tue, 26 Mar 2024 13:38:46 +0000 Subject: [PATCH 2/9] Remove legacy build and update docs --- .browserslistrc | 60 ---------------------- babel.config.js | 8 +-- packages/mui-base/package.json | 3 +- packages/mui-docs/package.json | 3 +- packages/mui-icons-material/package.json | 1 - packages/mui-lab/package.json | 3 +- packages/mui-material-nextjs/package.json | 3 +- packages/mui-material/package.json | 3 +- packages/mui-private-theming/package.json | 3 +- packages/mui-styled-engine-sc/package.json | 3 +- packages/mui-styled-engine/package.json | 3 +- packages/mui-styles/package.json | 3 +- packages/mui-system/package.json | 3 +- packages/mui-utils/package.json | 3 +- scripts/build.mjs | 3 -- scripts/sizeSnapshot/webpack.config.js | 4 -- 16 files changed, 12 insertions(+), 97 deletions(-) diff --git a/.browserslistrc b/.browserslistrc index 6ab4c0c15806ec..6bf6f0e0e1e601 100644 --- a/.browserslistrc +++ b/.browserslistrc @@ -72,66 +72,6 @@ safari 15.4 samsung 23 samsung 22 -[legacy] -ie 11 -and_chr 122 -and_chr 121 -and_ff 123 -and_ff 122 -and_qq 14.9 -and_uc 15.5 -android 122 -android 121 -chrome 122 -chrome 121 -chrome 120 -chrome 119 -chrome 109 -edge 122 -edge 121 -firefox 123 -firefox 122 -firefox 115 -ios_saf 17.4 -ios_saf 17.3 -ios_saf 17.2 -ios_saf 17.1 -ios_saf 17.0 -ios_saf 16.6-16.7 -ios_saf 16.5 -ios_saf 16.4 -ios_saf 16.3 -ios_saf 16.2 -ios_saf 16.1 -ios_saf 16.0 -ios_saf 15.6-15.8 -ios_saf 15.5 -ios_saf 15.4 -kaios 3.0-3.1 -kaios 2.5 -op_mini all -op_mob 80 -opera 108 -opera 107 -opera 106 -safari 17.4 -safari 17.3 -safari 17.2 -safari 17.1 -safari 17.0 -safari 16.6 -safari 16.5 -safari 16.4 -safari 16.3 -safari 16.2 -safari 16.1 -safari 16.0 -safari 15.6 -safari 15.5 -safari 15.4 -samsung 23 -samsung 22 - # snapshot of `npx browserslist "maintained node versions"` # On update check all #stable-snapshot markers [node] diff --git a/babel.config.js b/babel.config.js index 48ca2abea4ce50..ad22418643bf84 100644 --- a/babel.config.js +++ b/babel.config.js @@ -13,7 +13,7 @@ const productionPlugins = [ ]; module.exports = function getBabelConfig(api) { - const useESModules = api.env(['regressions', 'legacy', 'modern', 'stable', 'rollup']); + const useESModules = api.env(['regressions', 'modern', 'stable', 'rollup']); const defaultAlias = { '@mui/material': resolveAliasPath('./packages/mui-material/src'), @@ -153,12 +153,6 @@ module.exports = function getBabelConfig(api) { ], ], }, - legacy: { - plugins: [ - // IE11 support - '@babel/plugin-transform-object-assign', - ], - }, test: { sourceMaps: 'both', plugins: [ diff --git a/packages/mui-base/package.json b/packages/mui-base/package.json index e9a512b10d2faa..13f4e6d9a82f56 100644 --- a/packages/mui-base/package.json +++ b/packages/mui-base/package.json @@ -27,8 +27,7 @@ "url": "https://opencollective.com/mui-org" }, "scripts": { - "build": "pnpm build:legacy && pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:types && pnpm build:copy-files", - "build:legacy": "node ../../scripts/build.mjs legacy", + "build": "pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:types && pnpm build:copy-files", "build:modern": "node ../../scripts/build.mjs modern", "build:node": "node ../../scripts/build.mjs node", "build:stable": "node ../../scripts/build.mjs stable", diff --git a/packages/mui-docs/package.json b/packages/mui-docs/package.json index 83df3edba09fc0..b698cee4cce783 100644 --- a/packages/mui-docs/package.json +++ b/packages/mui-docs/package.json @@ -23,8 +23,7 @@ }, "homepage": "https://github.com/mui/material-ui/tree/master/packages/mui-docs", "scripts": { - "build": "pnpm build:legacy && pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:types && pnpm build:copy-files", - "build:legacy": "node ../../scripts/build.mjs legacy", + "build": "pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:types && pnpm build:copy-files", "build:modern": "echo 'Skip modern build'", "build:node": "node ../../scripts/build.mjs node", "build:stable": "node ../../scripts/build.mjs stable", diff --git a/packages/mui-icons-material/package.json b/packages/mui-icons-material/package.json index 26a1ac8334359a..a2c20ec5e3c6a1 100644 --- a/packages/mui-icons-material/package.json +++ b/packages/mui-icons-material/package.json @@ -31,7 +31,6 @@ "build": "shx cp -r lib/ build/ && pnpm build:typings && pnpm build:copy-files", "build:lib": "pnpm build:node && pnpm build:stable", "build:lib:clean": "rimraf lib/ && pnpm build:lib", - "build:legacy": "echo 'Skip legacy build'", "build:modern": "echo 'Skip modern build'", "build:node": "node ../../scripts/build.mjs node --largeFiles --outDir lib", "build:stable": "node ../../scripts/build.mjs stable --largeFiles --outDir lib", diff --git a/packages/mui-lab/package.json b/packages/mui-lab/package.json index afc6243c9efbe5..aaf1fcea9417f2 100644 --- a/packages/mui-lab/package.json +++ b/packages/mui-lab/package.json @@ -28,8 +28,7 @@ "url": "https://opencollective.com/mui-org" }, "scripts": { - "build": "pnpm build:legacy && pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:types && pnpm build:copy-files", - "build:legacy": "node ../../scripts/build.mjs legacy", + "build": "pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:types && pnpm build:copy-files", "build:modern": "node ../../scripts/build.mjs modern", "build:node": "node ../../scripts/build.mjs node", "build:stable": "node ../../scripts/build.mjs stable", diff --git a/packages/mui-material-nextjs/package.json b/packages/mui-material-nextjs/package.json index 6f916e47fe5983..431d6d7ebcd00f 100644 --- a/packages/mui-material-nextjs/package.json +++ b/packages/mui-material-nextjs/package.json @@ -24,8 +24,7 @@ "url": "https://opencollective.com/mui-org" }, "scripts": { - "build": "pnpm build:legacy && pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:types && pnpm build:copy-files", - "build:legacy": "node ../../scripts/build.mjs legacy", + "build": "pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:types && pnpm build:copy-files", "build:modern": "node ../../scripts/build.mjs modern", "build:node": "node ../../scripts/build.mjs node", "build:stable": "node ../../scripts/build.mjs stable", diff --git a/packages/mui-material/package.json b/packages/mui-material/package.json index e82242b4699c1c..0684205c3b9635 100644 --- a/packages/mui-material/package.json +++ b/packages/mui-material/package.json @@ -27,8 +27,7 @@ "url": "https://opencollective.com/mui-org" }, "scripts": { - "build": "pnpm build:legacy && pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:umd && pnpm build:types && pnpm build:copy-files", - "build:legacy": "node ../../scripts/build.mjs legacy", + "build": "pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:umd && pnpm build:types && pnpm build:copy-files", "build:modern": "node ../../scripts/build.mjs modern", "build:node": "node ../../scripts/build.mjs node", "build:stable": "node ../../scripts/build.mjs stable", diff --git a/packages/mui-private-theming/package.json b/packages/mui-private-theming/package.json index 24815bbbb6b8e4..9a5bf4d406d13f 100644 --- a/packages/mui-private-theming/package.json +++ b/packages/mui-private-theming/package.json @@ -26,8 +26,7 @@ "url": "https://opencollective.com/mui-org" }, "scripts": { - "build": "pnpm build:legacy && pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:copy-files", - "build:legacy": "node ../../scripts/build.mjs legacy", + "build": "pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:copy-files", "build:modern": "node ../../scripts/build.mjs modern", "build:node": "node ../../scripts/build.mjs node", "build:stable": "node ../../scripts/build.mjs stable", diff --git a/packages/mui-styled-engine-sc/package.json b/packages/mui-styled-engine-sc/package.json index 756b4e0596d84b..753f94156838f2 100644 --- a/packages/mui-styled-engine-sc/package.json +++ b/packages/mui-styled-engine-sc/package.json @@ -26,8 +26,7 @@ "url": "https://opencollective.com/mui-org" }, "scripts": { - "build": "pnpm build:legacy && pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:copy-files", - "build:legacy": "node ../../scripts/build.mjs legacy", + "build": "pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:copy-files", "build:modern": "node ../../scripts/build.mjs modern", "build:node": "node ../../scripts/build.mjs node", "build:stable": "node ../../scripts/build.mjs stable", diff --git a/packages/mui-styled-engine/package.json b/packages/mui-styled-engine/package.json index 22e13788d0a4af..dd98d67bb538bb 100644 --- a/packages/mui-styled-engine/package.json +++ b/packages/mui-styled-engine/package.json @@ -26,8 +26,7 @@ "url": "https://opencollective.com/mui-org" }, "scripts": { - "build": "pnpm build:legacy && pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:copy-files", - "build:legacy": "node ../../scripts/build.mjs legacy", + "build": "pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:copy-files", "build:modern": "node ../../scripts/build.mjs modern", "build:node": "node ../../scripts/build.mjs node", "build:stable": "node ../../scripts/build.mjs stable", diff --git a/packages/mui-styles/package.json b/packages/mui-styles/package.json index 229341dc6735ad..b15fb042a30dbf 100644 --- a/packages/mui-styles/package.json +++ b/packages/mui-styles/package.json @@ -26,8 +26,7 @@ "url": "https://opencollective.com/mui-org" }, "scripts": { - "build": "pnpm build:legacy && pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:copy-files", - "build:legacy": "node ../../scripts/build.mjs legacy", + "build": "pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:copy-files", "build:modern": "node ../../scripts/build.mjs modern", "build:node": "node ../../scripts/build.mjs node", "build:stable": "node ../../scripts/build.mjs stable", diff --git a/packages/mui-system/package.json b/packages/mui-system/package.json index e0c3e06e7123d7..5c033f27dbb532 100644 --- a/packages/mui-system/package.json +++ b/packages/mui-system/package.json @@ -26,8 +26,7 @@ "url": "https://opencollective.com/mui-org" }, "scripts": { - "build": "pnpm build:legacy && pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:types && pnpm build:copy-files", - "build:legacy": "node ../../scripts/build.mjs legacy", + "build": "pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:types && pnpm build:copy-files", "build:modern": "node ../../scripts/build.mjs modern", "build:node": "node ../../scripts/build.mjs node", "build:stable": "node ../../scripts/build.mjs stable", diff --git a/packages/mui-utils/package.json b/packages/mui-utils/package.json index 216b9a102e1c4b..7fa282744cf349 100644 --- a/packages/mui-utils/package.json +++ b/packages/mui-utils/package.json @@ -26,8 +26,7 @@ "url": "https://opencollective.com/mui-org" }, "scripts": { - "build": "pnpm build:legacy && pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:types && pnpm build:copy-files", - "build:legacy": "node ../../scripts/build.mjs legacy", + "build": "pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:types && pnpm build:copy-files", "build:modern": "node ../../scripts/build.mjs modern", "build:node": "node ../../scripts/build.mjs node", "build:stable": "node ../../scripts/build.mjs stable", diff --git a/scripts/build.mjs b/scripts/build.mjs index 711bcf389ae274..3a9f594a72844e 100644 --- a/scripts/build.mjs +++ b/scripts/build.mjs @@ -8,8 +8,6 @@ import { getWorkspaceRoot } from './utils.mjs'; const exec = promisify(childProcess.exec); const validBundles = [ - // legacy build using ES6 modules - 'legacy', // modern build with a rolling target using ES6 modules 'modern', // build for node using commonJS modules @@ -65,7 +63,6 @@ async function run(argv) { node: topLevelPathImportsCanBePackages ? './node' : './', modern: './modern', stable: topLevelPathImportsCanBePackages ? './' : './esm', - legacy: './legacy', }[bundle], ); diff --git a/scripts/sizeSnapshot/webpack.config.js b/scripts/sizeSnapshot/webpack.config.js index 6a63b053c7ae50..92c97758bc8792 100644 --- a/scripts/sizeSnapshot/webpack.config.js +++ b/scripts/sizeSnapshot/webpack.config.js @@ -136,10 +136,6 @@ async function getWebpackEntries() { // webpack: true, // path: path.join(path.relative(workspaceRoot, materialPackagePath), 'modern/index.js'), // }, - { - id: '@material-ui/core.legacy', - path: path.join(path.relative(workspaceRoot, materialPackagePath), 'legacy/index.js'), - }, { id: '@mui/joy', path: path.join(path.relative(workspaceRoot, joyPackagePath), 'index.js'), From 3663cca917215be65146c1249bb3a07a49c4ddd0 Mon Sep 17 00:00:00 2001 From: Minjee Son <104430030+iammminzzy@users.noreply.github.com> Date: Sat, 30 Mar 2024 01:13:35 +0000 Subject: [PATCH 3/9] remove @babel/plugin-transform-object-assign --- docs/babel.config.js | 2 -- docs/package.json | 1 - package.json | 1 - pnpm-lock.yaml | 15 --------------- 4 files changed, 19 deletions(-) diff --git a/docs/babel.config.js b/docs/babel.config.js index 57d4fab1b602af..1ccf95cfbb1b80 100644 --- a/docs/babel.config.js +++ b/docs/babel.config.js @@ -32,8 +32,6 @@ module.exports = { }, ], 'babel-plugin-optimize-clsx', - // for IE11 support - '@babel/plugin-transform-object-assign', ], ignore: [/@babel[\\|/]runtime/], // Fix a Windows issue. env: { diff --git a/docs/package.json b/docs/package.json index 64d69baf6c8f36..81a0d21754ecc9 100644 --- a/docs/package.json +++ b/docs/package.json @@ -20,7 +20,6 @@ }, "dependencies": { "@babel/core": "^7.24.4", - "@babel/plugin-transform-object-assign": "^7.24.1", "@babel/runtime": "^7.24.4", "@babel/runtime-corejs2": "^7.24.1", "@docsearch/react": "^3.6.0", diff --git a/package.json b/package.json index c8baca2b302388..2d3475a63679b4 100644 --- a/package.json +++ b/package.json @@ -98,7 +98,6 @@ "@babel/plugin-proposal-object-rest-spread": "^7.20.7", "@babel/plugin-proposal-private-methods": "^7.18.6", "@babel/plugin-proposal-private-property-in-object": "^7.21.11", - "@babel/plugin-transform-object-assign": "^7.24.1", "@babel/plugin-transform-react-constant-elements": "^7.24.1", "@babel/plugin-transform-runtime": "^7.24.3", "@babel/preset-env": "^7.24.4", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 916a77b0389f3d..ab52cfbdaedf3e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -71,9 +71,6 @@ importers: '@babel/plugin-proposal-private-property-in-object': specifier: ^7.21.11 version: 7.21.11(@babel/core@7.24.4) - '@babel/plugin-transform-object-assign': - specifier: ^7.24.1 - version: 7.24.1(@babel/core@7.24.4) '@babel/plugin-transform-react-constant-elements': specifier: ^7.24.1 version: 7.24.1(@babel/core@7.24.4) @@ -583,9 +580,6 @@ importers: '@babel/core': specifier: ^7.24.4 version: 7.24.4 - '@babel/plugin-transform-object-assign': - specifier: ^7.24.1 - version: 7.24.1(@babel/core@7.24.4) '@babel/runtime': specifier: ^7.24.4 version: 7.24.4 @@ -3706,15 +3700,6 @@ packages: '@babel/helper-plugin-utils': 7.24.0 '@babel/plugin-syntax-numeric-separator': 7.10.4(@babel/core@7.24.4) - /@babel/plugin-transform-object-assign@7.24.1(@babel/core@7.24.4): - resolution: {integrity: sha512-I1kctor9iKtupb7jv7FyjApHCuKLBKCblVAeHVK9PB6FW7GI0ac6RtobC3MwwJy8CZ1JxuhQmnbrsqI5G8hAIg==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.24.4 - dependencies: - '@babel/core': 7.24.4 - '@babel/helper-plugin-utils': 7.24.0 - /@babel/plugin-transform-object-rest-spread@7.24.1(@babel/core@7.24.4): resolution: {integrity: sha512-XjD5f0YqOtebto4HGISLNfiNMTTs6tbkFf2TOqJlYKYmbo+mN9Dnpl4SRoofiziuOWMIyq3sZEUqLo3hLITFEA==} engines: {node: '>=6.9.0'} From d4ae0fe185985f5944e59026e2e477f75240e047 Mon Sep 17 00:00:00 2001 From: Minjee Son <104430030+iammminzzy@users.noreply.github.com> Date: Sat, 6 Apr 2024 09:39:26 +0000 Subject: [PATCH 4/9] Remove IE comment --- .eslintrc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.eslintrc.js b/.eslintrc.js index a06ac35ae3f3ae..a75d1e007728ff 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -164,7 +164,7 @@ module.exports = { 'react/state-in-constructor': 'off', // stylistic opinion. For conditional assignment we want it outside, otherwise as static 'react/static-property-placement': 'off', - // noopener is enough, no IE 11 support + // noopener is enough // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-target-blank.md#rule-options 'react/jsx-no-target-blank': ['error', { allowReferrer: true }], From 2cd04d88c4b58efc3ceb22fd6d7c8017bdd4e18d Mon Sep 17 00:00:00 2001 From: Minjee Son <104430030+iammminzzy@users.noreply.github.com> Date: Tue, 9 Apr 2024 10:07:14 +0000 Subject: [PATCH 5/9] Remove stableSort --- .../components/table/TableSortAndSelection.js | 19 +- .../table/TableSortAndSelection.tsx | 19 +- .../order-dashboard/components/OrderTable.tsx | 18 +- .../components/table/EnhancedTable.js | 23 +-- .../components/table/EnhancedTable.tsx | 23 +-- docs/src/components/showcase/FolderTable.tsx | 18 +- .../modules/components/MaterialShowcase.js | 192 +++++++++--------- 7 files changed, 104 insertions(+), 208 deletions(-) diff --git a/docs/data/joy/components/table/TableSortAndSelection.js b/docs/data/joy/components/table/TableSortAndSelection.js index 2455a21333b4cf..c7649aa9609b6d 100644 --- a/docs/data/joy/components/table/TableSortAndSelection.js +++ b/docs/data/joy/components/table/TableSortAndSelection.js @@ -65,22 +65,6 @@ function getComparator(order, orderBy) { : (a, b) => -descendingComparator(a, b, orderBy); } -// Since 2020 all major browsers ensure sort stability with Array.prototype.sort(). -// stableSort() brings sort stability to non-modern browsers (notably IE11). If you -// only support modern browsers you can replace stableSort(exampleArray, exampleComparator) -// with exampleArray.slice().sort(exampleComparator) -function stableSort(array, comparator) { - const stabilizedThis = array.map((el, index) => [el, index]); - stabilizedThis.sort((a, b) => { - const order = comparator(a[0], b[0]); - if (order !== 0) { - return order; - } - return a[1] - b[1]; - }); - return stabilizedThis.map((el) => el[0]); -} - const headCells = [ { id: 'name', @@ -348,7 +332,8 @@ export default function TableSortAndSelection() { rowCount={rows.length} /> - {stableSort(rows, getComparator(order, orderBy)) + {[...rows] + .sort(getComparator(order, orderBy)) .slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage) .map((row, index) => { const isItemSelected = isSelected(row.name); diff --git a/docs/data/joy/components/table/TableSortAndSelection.tsx b/docs/data/joy/components/table/TableSortAndSelection.tsx index f063700890b412..06026b6cfa0758 100644 --- a/docs/data/joy/components/table/TableSortAndSelection.tsx +++ b/docs/data/joy/components/table/TableSortAndSelection.tsx @@ -94,22 +94,6 @@ function getComparator