From 5ca0df47cfb1fb548ad1329bcc8deb0ee8dba070 Mon Sep 17 00:00:00 2001 From: Maik Marschner Date: Sat, 6 Feb 2021 15:37:01 +0100 Subject: [PATCH] Update for Material-UI v5. --- generate-module.js | 4 +- package-lock.json | 497 +++++++++++++++++++++++++++++++++-------- package.json | 6 +- src/util/createIcon.js | 16 +- test.js | 86 ++++--- 5 files changed, 467 insertions(+), 142 deletions(-) diff --git a/generate-module.js b/generate-module.js index 54d3600..40d3207 100755 --- a/generate-module.js +++ b/generate-module.js @@ -48,7 +48,7 @@ function checkNameClashes (icons) { for (const { name, filename, svgPath } of icons) { const code = `import createIcon from './util/createIcon' - export default createIcon('${svgPath}') + export default createIcon('${svgPath}', '${name}') ` // commonjs module syntax @@ -65,7 +65,7 @@ function checkNameClashes (icons) { for (const { name, filename, svgPath } of lightIcons) { const code = `import createIcon from '../util/createIcon' - export default createIcon('${svgPath}') + export default createIcon('${svgPath}', '${name}') ` // commonjs module syntax diff --git a/package-lock.json b/package-lock.json index 93e11d9..11043b4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1895,6 +1895,80 @@ "arrify": "^1.0.1" } }, + "@emotion/babel-plugin": { + "version": "11.1.2", + "resolved": "https://registry.npmjs.org/@emotion/babel-plugin/-/babel-plugin-11.1.2.tgz", + "integrity": "sha512-Nz1k7b11dWw8Nw4Z1R99A9mlB6C6rRsCtZnwNUOj4NsoZdrO2f2A/83ST7htJORD5zpOiLKY59aJN23092949w==", + "dev": true, + "requires": { + "@babel/helper-module-imports": "^7.7.0", + "@babel/plugin-syntax-jsx": "^7.12.1", + "@babel/runtime": "^7.7.2", + "@emotion/hash": "^0.8.0", + "@emotion/memoize": "^0.7.5", + "@emotion/serialize": "^1.0.0", + "babel-plugin-macros": "^2.6.1", + "convert-source-map": "^1.5.0", + "escape-string-regexp": "^4.0.0", + "find-root": "^1.1.0", + "source-map": "^0.5.7", + "stylis": "^4.0.3" + }, + "dependencies": { + "@babel/helper-plugin-utils": { + "version": "7.12.13", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.12.13.tgz", + "integrity": "sha512-C+10MXCXJLiR6IeG9+Wiejt9jmtFpxUc3MQqCmPY8hfCjyUGl9kT+B2okzEZrtykiwrc4dbCPdDoz0A/HQbDaA==", + "dev": true + }, + "@babel/plugin-syntax-jsx": { + "version": "7.12.13", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.12.13.tgz", + "integrity": "sha512-d4HM23Q1K7oq/SLNmG6mRt85l2csmQ0cHRaxRXjKW0YFdEXqlZ5kzFQKH5Uc3rDJECgu+yCRgPkG04Mm98R/1g==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.12.13" + } + }, + "@emotion/memoize": { + "version": "0.7.5", + "resolved": "https://registry.npmjs.org/@emotion/memoize/-/memoize-0.7.5.tgz", + "integrity": "sha512-igX9a37DR2ZPGYtV6suZ6whr8pTFtyHL3K/oLUotxpSVO2ASaprmAe2Dkq7tBo7CRY7MMDrAa9nuQP9/YG8FxQ==", + "dev": true + }, + "@emotion/serialize": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@emotion/serialize/-/serialize-1.0.0.tgz", + "integrity": "sha512-zt1gm4rhdo5Sry8QpCOpopIUIKU+mUSpV9WNmFILUraatm5dttNEaYzUWWSboSMUE6PtN2j1cAsuvcugfdI3mw==", + "dev": true, + "requires": { + "@emotion/hash": "^0.8.0", + "@emotion/memoize": "^0.7.4", + "@emotion/unitless": "^0.7.5", + "@emotion/utils": "^1.0.0", + "csstype": "^3.0.2" + } + }, + "@emotion/utils": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@emotion/utils/-/utils-1.0.0.tgz", + "integrity": "sha512-mQC2b3XLDs6QCW+pDQDiyO/EdGZYOygE8s5N5rrzjSI4M3IejPE/JPndCBwRT9z982aqQNi6beWs1UeayrQxxA==", + "dev": true + }, + "csstype": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.0.6.tgz", + "integrity": "sha512-+ZAmfyWMT7TiIlzdqJgjMb7S4f1beorDbWbsocyK4RaiqA5RTX3K14bnBWmmA9QEM0gRdsjyyrEmcyga8Zsxmw==", + "dev": true + }, + "escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true + } + } + }, "@emotion/cache": { "version": "10.0.29", "resolved": "https://registry.npmjs.org/@emotion/cache/-/cache-10.0.29.tgz", @@ -1953,6 +2027,67 @@ "integrity": "sha512-Ja/Vfqe3HpuzRsG1oBtWTHk2PGZ7GR+2Vz5iYGelAw8dx32K0y7PjVuxK6z1nMpZOqAFsRUPCkK1YjJ56qJlgw==", "dev": true }, + "@emotion/react": { + "version": "11.1.5", + "resolved": "https://registry.npmjs.org/@emotion/react/-/react-11.1.5.tgz", + "integrity": "sha512-xfnZ9NJEv9SU9K2sxXM06lzjK245xSeHRpUh67eARBm3PBHjjKIZlfWZ7UQvD0Obvw6ZKjlC79uHrlzFYpOB/Q==", + "dev": true, + "requires": { + "@babel/runtime": "^7.7.2", + "@emotion/cache": "^11.1.3", + "@emotion/serialize": "^1.0.0", + "@emotion/sheet": "^1.0.1", + "@emotion/utils": "^1.0.0", + "@emotion/weak-memoize": "^0.2.5", + "hoist-non-react-statics": "^3.3.1" + }, + "dependencies": { + "@emotion/cache": { + "version": "11.1.3", + "resolved": "https://registry.npmjs.org/@emotion/cache/-/cache-11.1.3.tgz", + "integrity": "sha512-n4OWinUPJVaP6fXxWZD9OUeQ0lY7DvtmtSuqtRWT0Ofo/sBLCVSgb4/Oa0Q5eFxcwablRKjUXqXtNZVyEwCAuA==", + "dev": true, + "requires": { + "@emotion/memoize": "^0.7.4", + "@emotion/sheet": "^1.0.0", + "@emotion/utils": "^1.0.0", + "@emotion/weak-memoize": "^0.2.5", + "stylis": "^4.0.3" + } + }, + "@emotion/serialize": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@emotion/serialize/-/serialize-1.0.0.tgz", + "integrity": "sha512-zt1gm4rhdo5Sry8QpCOpopIUIKU+mUSpV9WNmFILUraatm5dttNEaYzUWWSboSMUE6PtN2j1cAsuvcugfdI3mw==", + "dev": true, + "requires": { + "@emotion/hash": "^0.8.0", + "@emotion/memoize": "^0.7.4", + "@emotion/unitless": "^0.7.5", + "@emotion/utils": "^1.0.0", + "csstype": "^3.0.2" + } + }, + "@emotion/sheet": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@emotion/sheet/-/sheet-1.0.1.tgz", + "integrity": "sha512-GbIvVMe4U+Zc+929N1V7nW6YYJtidj31lidSmdYcWozwoBIObXBnaJkKNDjZrLm9Nc0BR+ZyHNaRZxqNZbof5g==", + "dev": true + }, + "@emotion/utils": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@emotion/utils/-/utils-1.0.0.tgz", + "integrity": "sha512-mQC2b3XLDs6QCW+pDQDiyO/EdGZYOygE8s5N5rrzjSI4M3IejPE/JPndCBwRT9z982aqQNi6beWs1UeayrQxxA==", + "dev": true + }, + "csstype": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.0.6.tgz", + "integrity": "sha512-+ZAmfyWMT7TiIlzdqJgjMb7S4f1beorDbWbsocyK4RaiqA5RTX3K14bnBWmmA9QEM0gRdsjyyrEmcyga8Zsxmw==", + "dev": true + } + } + }, "@emotion/serialize": { "version": "0.11.16", "resolved": "https://registry.npmjs.org/@emotion/serialize/-/serialize-0.11.16.tgz", @@ -1973,13 +2108,52 @@ "dev": true }, "@emotion/styled": { - "version": "10.0.27", - "resolved": "https://registry.npmjs.org/@emotion/styled/-/styled-10.0.27.tgz", - "integrity": "sha512-iK/8Sh7+NLJzyp9a5+vIQIXTYxfT4yB/OJbjzQanB2RZpvmzBQOHZWhpAMZWYEKRNNbsD6WfBw5sVWkb6WzS/Q==", + "version": "11.1.5", + "resolved": "https://registry.npmjs.org/@emotion/styled/-/styled-11.1.5.tgz", + "integrity": "sha512-nIq7pOBEDqT5xSFbclQ3XFy0q8C9EUU8ECqKN2kJKGxKh+vLz/x26kEih4aOpoAsyzc+R60rQxh7VJiLTUEdmg==", "dev": true, "requires": { - "@emotion/styled-base": "^10.0.27", - "babel-plugin-emotion": "^10.0.27" + "@babel/runtime": "^7.7.2", + "@emotion/babel-plugin": "^11.1.2", + "@emotion/is-prop-valid": "^1.1.0", + "@emotion/serialize": "^1.0.0", + "@emotion/utils": "^1.0.0" + }, + "dependencies": { + "@emotion/is-prop-valid": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@emotion/is-prop-valid/-/is-prop-valid-1.1.0.tgz", + "integrity": "sha512-9RkilvXAufQHsSsjQ3PIzSns+pxuX4EW8EbGeSPjZMHuMx6z/MOzb9LpqNieQX4F3mre3NWS2+X3JNRHTQztUQ==", + "dev": true, + "requires": { + "@emotion/memoize": "^0.7.4" + } + }, + "@emotion/serialize": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@emotion/serialize/-/serialize-1.0.0.tgz", + "integrity": "sha512-zt1gm4rhdo5Sry8QpCOpopIUIKU+mUSpV9WNmFILUraatm5dttNEaYzUWWSboSMUE6PtN2j1cAsuvcugfdI3mw==", + "dev": true, + "requires": { + "@emotion/hash": "^0.8.0", + "@emotion/memoize": "^0.7.4", + "@emotion/unitless": "^0.7.5", + "@emotion/utils": "^1.0.0", + "csstype": "^3.0.2" + } + }, + "@emotion/utils": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@emotion/utils/-/utils-1.0.0.tgz", + "integrity": "sha512-mQC2b3XLDs6QCW+pDQDiyO/EdGZYOygE8s5N5rrzjSI4M3IejPE/JPndCBwRT9z982aqQNi6beWs1UeayrQxxA==", + "dev": true + }, + "csstype": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.0.6.tgz", + "integrity": "sha512-+ZAmfyWMT7TiIlzdqJgjMb7S4f1beorDbWbsocyK4RaiqA5RTX3K14bnBWmmA9QEM0gRdsjyyrEmcyga8Zsxmw==", + "dev": true + } } }, "@emotion/styled-base": { @@ -2025,37 +2199,86 @@ "dev": true }, "@material-ui/core": { - "version": "4.9.7", - "resolved": "https://registry.npmjs.org/@material-ui/core/-/core-4.9.7.tgz", - "integrity": "sha512-RTRibZgq572GHEskMAG4sP+bt3P3XyIkv3pOTR8grZAW2rSUd6JoGZLRM4S2HkuO7wS7cAU5SpU2s1EsmTgWog==", + "version": "5.0.0-alpha.24", + "resolved": "https://registry.npmjs.org/@material-ui/core/-/core-5.0.0-alpha.24.tgz", + "integrity": "sha512-X4CFyL0De9aWy6G+CAolfbEcl1UsAI74BQZeEY+cE1MZHGfJl992LeXnhgtR3OpQoCtS7FUlptsed0kcsertDA==", "dev": true, "requires": { "@babel/runtime": "^7.4.4", - "@material-ui/styles": "^4.9.6", - "@material-ui/system": "^4.9.6", - "@material-ui/types": "^5.0.0", - "@material-ui/utils": "^4.9.6", + "@material-ui/styled-engine": "5.0.0-alpha.24", + "@material-ui/styles": "5.0.0-alpha.24", + "@material-ui/system": "5.0.0-alpha.24", + "@material-ui/types": "5.1.6", + "@material-ui/unstyled": "5.0.0-alpha.24", + "@material-ui/utils": "5.0.0-alpha.24", + "@popperjs/core": "^2.4.4", "@types/react-transition-group": "^4.2.0", - "clsx": "^1.0.2", + "clsx": "^1.0.4", + "csstype": "^3.0.2", "hoist-non-react-statics": "^3.3.2", - "popper.js": "^1.14.1", "prop-types": "^15.7.2", - "react-is": "^16.8.0", - "react-transition-group": "^4.3.0" + "react-is": "^16.8.0 || ^17.0.0", + "react-transition-group": "^4.4.0" + }, + "dependencies": { + "csstype": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.0.6.tgz", + "integrity": "sha512-+ZAmfyWMT7TiIlzdqJgjMb7S4f1beorDbWbsocyK4RaiqA5RTX3K14bnBWmmA9QEM0gRdsjyyrEmcyga8Zsxmw==", + "dev": true + } + } + }, + "@material-ui/styled-engine": { + "version": "5.0.0-alpha.24", + "resolved": "https://registry.npmjs.org/@material-ui/styled-engine/-/styled-engine-5.0.0-alpha.24.tgz", + "integrity": "sha512-b6sYanUFOJ5lfo13vgqGm/xhpFxkGitjlvl7WxN4o0Lh+Y6v+bNMFsDw7X4JTyNJrJES2kLhKbAbCdIwdkCSGw==", + "dev": true, + "requires": { + "@babel/runtime": "^7.4.4", + "@emotion/cache": "^11.0.0", + "prop-types": "^15.7.2" + }, + "dependencies": { + "@emotion/cache": { + "version": "11.1.3", + "resolved": "https://registry.npmjs.org/@emotion/cache/-/cache-11.1.3.tgz", + "integrity": "sha512-n4OWinUPJVaP6fXxWZD9OUeQ0lY7DvtmtSuqtRWT0Ofo/sBLCVSgb4/Oa0Q5eFxcwablRKjUXqXtNZVyEwCAuA==", + "dev": true, + "requires": { + "@emotion/memoize": "^0.7.4", + "@emotion/sheet": "^1.0.0", + "@emotion/utils": "^1.0.0", + "@emotion/weak-memoize": "^0.2.5", + "stylis": "^4.0.3" + } + }, + "@emotion/sheet": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@emotion/sheet/-/sheet-1.0.1.tgz", + "integrity": "sha512-GbIvVMe4U+Zc+929N1V7nW6YYJtidj31lidSmdYcWozwoBIObXBnaJkKNDjZrLm9Nc0BR+ZyHNaRZxqNZbof5g==", + "dev": true + }, + "@emotion/utils": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@emotion/utils/-/utils-1.0.0.tgz", + "integrity": "sha512-mQC2b3XLDs6QCW+pDQDiyO/EdGZYOygE8s5N5rrzjSI4M3IejPE/JPndCBwRT9z982aqQNi6beWs1UeayrQxxA==", + "dev": true + } } }, "@material-ui/styles": { - "version": "4.9.6", - "resolved": "https://registry.npmjs.org/@material-ui/styles/-/styles-4.9.6.tgz", - "integrity": "sha512-ijgwStEkw1OZ6gCz18hkjycpr/3lKs1hYPi88O/AUn4vMuuGEGAIrqKVFq/lADmZUNF3DOFIk8LDkp7zmjPxtA==", + "version": "5.0.0-alpha.24", + "resolved": "https://registry.npmjs.org/@material-ui/styles/-/styles-5.0.0-alpha.24.tgz", + "integrity": "sha512-ehGfDXSqCI2OJw3r+yiatOivjduziXVfm90nBb3YRjCKNIlAfiFaOklX7DQ/DL1nMUbbhExqaEhhKarQT2WIwQ==", "dev": true, "requires": { "@babel/runtime": "^7.4.4", "@emotion/hash": "^0.8.0", - "@material-ui/types": "^5.0.0", - "@material-ui/utils": "^4.9.6", - "clsx": "^1.0.2", - "csstype": "^2.5.2", + "@material-ui/types": "5.1.6", + "@material-ui/utils": "5.0.0-alpha.24", + "clsx": "^1.0.4", + "csstype": "^3.0.2", "hoist-non-react-statics": "^3.3.2", "jss": "^10.0.3", "jss-plugin-camel-case": "^10.0.3", @@ -2066,34 +2289,66 @@ "jss-plugin-rule-value-function": "^10.0.3", "jss-plugin-vendor-prefixer": "^10.0.3", "prop-types": "^15.7.2" + }, + "dependencies": { + "csstype": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.0.6.tgz", + "integrity": "sha512-+ZAmfyWMT7TiIlzdqJgjMb7S4f1beorDbWbsocyK4RaiqA5RTX3K14bnBWmmA9QEM0gRdsjyyrEmcyga8Zsxmw==", + "dev": true + } } }, "@material-ui/system": { - "version": "4.9.6", - "resolved": "https://registry.npmjs.org/@material-ui/system/-/system-4.9.6.tgz", - "integrity": "sha512-QtfoAePyqXoZ2HUVSwGb1Ro0kucMCvVjbI0CdYIR21t0Opgfm1Oer6ni9P5lfeXA39xSt0wCierw37j+YES48Q==", + "version": "5.0.0-alpha.24", + "resolved": "https://registry.npmjs.org/@material-ui/system/-/system-5.0.0-alpha.24.tgz", + "integrity": "sha512-3sIeS6zvLdzntM3CWL2HHiX52IycHxHOwbdacKz72te/VA5y6nunOgBOyR3/p3Zb9MuuQ9KnE7lDWJtR/UKsBA==", "dev": true, "requires": { "@babel/runtime": "^7.4.4", - "@material-ui/utils": "^4.9.6", + "@material-ui/utils": "5.0.0-alpha.24", + "csstype": "^3.0.2", "prop-types": "^15.7.2" + }, + "dependencies": { + "csstype": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.0.6.tgz", + "integrity": "sha512-+ZAmfyWMT7TiIlzdqJgjMb7S4f1beorDbWbsocyK4RaiqA5RTX3K14bnBWmmA9QEM0gRdsjyyrEmcyga8Zsxmw==", + "dev": true + } } }, "@material-ui/types": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/@material-ui/types/-/types-5.0.0.tgz", - "integrity": "sha512-UeH2BuKkwDndtMSS0qgx1kCzSMw+ydtj0xx/XbFtxNSTlXydKwzs5gVW5ZKsFlAkwoOOQ9TIsyoCC8hq18tOwg==", + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/@material-ui/types/-/types-5.1.6.tgz", + "integrity": "sha512-4QJmcgoxTNn7F6H011AYDeThoxtR9IpJRu46YGA+Z01g/6+7iN9Jo7/MWQraYAd+jN0yGHAoI2KnY2Nbbk5Wsg==", "dev": true }, + "@material-ui/unstyled": { + "version": "5.0.0-alpha.24", + "resolved": "https://registry.npmjs.org/@material-ui/unstyled/-/unstyled-5.0.0-alpha.24.tgz", + "integrity": "sha512-qfCpZn4VQwVp3LQwtDpS9ufAim7NggZqm5+GfOxILh0qvtyK6mPzVNcAmKFURJO+ClUoL2ySkLqID9S9Pmkelg==", + "dev": true, + "requires": { + "@babel/runtime": "^7.4.4", + "@material-ui/utils": "5.0.0-alpha.24", + "clsx": "^1.0.4", + "prop-types": "^15.7.2", + "react-is": "^16.8.0 || ^17.0.0" + } + }, "@material-ui/utils": { - "version": "4.9.6", - "resolved": "https://registry.npmjs.org/@material-ui/utils/-/utils-4.9.6.tgz", - "integrity": "sha512-gqlBn0JPPTUZeAktn1rgMcy9Iczrr74ecx31tyZLVGdBGGzsxzM6PP6zeS7FuoLS6vG4hoZP7hWnOoHtkR0Kvw==", + "version": "5.0.0-alpha.24", + "resolved": "https://registry.npmjs.org/@material-ui/utils/-/utils-5.0.0-alpha.24.tgz", + "integrity": "sha512-di0zaQKHiRi6NwPAt/4mRNfUYTa5aWVTqfzTYN/OdnQTGtOLPPFo9Om+uYgkunZIOa3lsahveo6ieH/YgFnJfQ==", "dev": true, "requires": { "@babel/runtime": "^7.4.4", + "@types/prop-types": "^15.7.3", + "@types/react-is": "^16.7.1 || ^17.0.0", "prop-types": "^15.7.2", - "react-is": "^16.8.0" + "react-is": "^16.8.0 || ^17.0.0" } }, "@mdi/js": { @@ -2169,6 +2424,12 @@ } } }, + "@popperjs/core": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.6.0.tgz", + "integrity": "sha512-cPqjjzuFWNK3BSKLm0abspP0sp/IGOli4p5I5fKFAzdS8fvjdOwDCfZqAaIiXd9lPkOWi3SUUfZof3hEb7J/uw==", + "dev": true + }, "@reach/router": { "version": "1.3.4", "resolved": "https://registry.npmjs.org/@reach/router/-/router-1.3.4.tgz", @@ -3659,6 +3920,18 @@ "polished": "^3.4.4", "resolve-from": "^5.0.0", "ts-dedent": "^1.1.1" + }, + "dependencies": { + "@emotion/styled": { + "version": "10.0.27", + "resolved": "https://registry.npmjs.org/@emotion/styled/-/styled-10.0.27.tgz", + "integrity": "sha512-iK/8Sh7+NLJzyp9a5+vIQIXTYxfT4yB/OJbjzQanB2RZpvmzBQOHZWhpAMZWYEKRNNbsD6WfBw5sVWkb6WzS/Q==", + "dev": true, + "requires": { + "@emotion/styled-base": "^10.0.27", + "babel-plugin-emotion": "^10.0.27" + } + } } }, "@storybook/ui": { @@ -5040,6 +5313,15 @@ "@types/reactcss": "*" } }, + "@types/react-is": { + "version": "17.0.0", + "resolved": "https://registry.npmjs.org/@types/react-is/-/react-is-17.0.0.tgz", + "integrity": "sha512-A0DQ1YWZ0RG2+PV7neAotNCIh8gZ3z7tQnDJyS2xRPDNtAtSPcJ9YyfMP8be36Ha0kQRzbZCrrTMznA4blqO5g==", + "dev": true, + "requires": { + "@types/react": "*" + } + }, "@types/react-syntax-highlighter": { "version": "11.0.4", "resolved": "https://registry.npmjs.org/@types/react-syntax-highlighter/-/react-syntax-highlighter-11.0.4.tgz", @@ -5050,9 +5332,9 @@ } }, "@types/react-transition-group": { - "version": "4.2.4", - "resolved": "https://registry.npmjs.org/@types/react-transition-group/-/react-transition-group-4.2.4.tgz", - "integrity": "sha512-8DMUaDqh0S70TjkqU0DxOu80tFUiiaS9rxkWip/nb7gtvAsbqOXm02UCmR8zdcjWujgeYPiPNTVpVpKzUDotwA==", + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/@types/react-transition-group/-/react-transition-group-4.4.0.tgz", + "integrity": "sha512-/QfLHGpu+2fQOqQaXh8MG9q03bFENooTb/it4jr5kKaZlDQfWvjqWZg48AwzPVMBHlRuTRAY7hRHCEOXz5kV6w==", "dev": true, "requires": { "@types/react": "*" @@ -7536,9 +7818,9 @@ } }, "clsx": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/clsx/-/clsx-1.1.0.tgz", - "integrity": "sha512-3avwM37fSK5oP6M5rQ9CNe99lwxhXDOeSWVPAOYF6OazUTgZCMb0yWlJpmdD74REy1gkEaFiub2ULv4fq9GUhA==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/clsx/-/clsx-1.1.1.tgz", + "integrity": "sha512-6/bPho624p3S2pMyvP5kKBPXnI3ufHLObBFCfgx+LkeR5lg2XYy2hqZqUf45ypD8COn2bhgGJSUE+l5dhNBieA==", "dev": true }, "coa": { @@ -8012,12 +8294,12 @@ } }, "css-vendor": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/css-vendor/-/css-vendor-2.0.7.tgz", - "integrity": "sha512-VS9Rjt79+p7M0WkPqcAza4Yq1ZHrsHrwf7hPL/bjQB+c1lwmAI+1FXxYTYt818D/50fFVflw0XKleiBN5RITkg==", + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/css-vendor/-/css-vendor-2.0.8.tgz", + "integrity": "sha512-x9Aq0XTInxrkuFeHKbYC7zWY8ai7qJ04Kxd9MnvbC1uO5DagxoHQjm4JvG+vCdXOoFtCjbL2XSZfxmoYa9uQVQ==", "dev": true, "requires": { - "@babel/runtime": "^7.6.2", + "@babel/runtime": "^7.8.3", "is-in-browser": "^1.0.2" } }, @@ -8495,13 +8777,21 @@ } }, "dom-helpers": { - "version": "5.1.3", - "resolved": "https://registry.npmjs.org/dom-helpers/-/dom-helpers-5.1.3.tgz", - "integrity": "sha512-nZD1OtwfWGRBWlpANxacBEZrEuLa16o1nh7YopFWeoF68Zt8GGEmzHu6Xv4F3XaFIC+YXtTLrzgqKxFgLEe4jw==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/dom-helpers/-/dom-helpers-5.2.0.tgz", + "integrity": "sha512-Ru5o9+V8CpunKnz5LGgWXkmrH/20cGKwcHwS4m73zIvs54CN9epEmT/HLqFJW3kXpakAFkEdzgy1hzlJe3E4OQ==", "dev": true, "requires": { - "@babel/runtime": "^7.6.3", - "csstype": "^2.6.7" + "@babel/runtime": "^7.8.7", + "csstype": "^3.0.2" + }, + "dependencies": { + "csstype": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.0.6.tgz", + "integrity": "sha512-+ZAmfyWMT7TiIlzdqJgjMb7S4f1beorDbWbsocyK4RaiqA5RTX3K14bnBWmmA9QEM0gRdsjyyrEmcyga8Zsxmw==", + "dev": true + } } }, "dom-serializer": { @@ -10207,9 +10497,9 @@ "dev": true }, "hyphenate-style-name": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/hyphenate-style-name/-/hyphenate-style-name-1.0.3.tgz", - "integrity": "sha512-EcuixamT82oplpoJ2XU4pDtKGWQ7b00CD9f1ug9IaQ3p1bkHMiKCZ9ut9QDI6qsa6cpUuB+A/I+zLtdNK4n2DQ==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/hyphenate-style-name/-/hyphenate-style-name-1.0.4.tgz", + "integrity": "sha512-ygGZLjmXfPHj+ZWh6LwbC37l43MhfztxetbFCoYTM2VjkIUpeHgSNn7QIyVFj7YQ1Wl9Cbw5sholVJPzWvC2MQ==", "dev": true }, "iconv-lite": { @@ -10326,6 +10616,15 @@ "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", "dev": true }, + "indefinite-observable": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/indefinite-observable/-/indefinite-observable-2.0.1.tgz", + "integrity": "sha512-G8vgmork+6H9S8lUAg1gtXEj2JxIQTo0g2PbFiYOdjkziSI0F7UYBiVwhZRuixhBCNGczAls34+5HJPyZysvxQ==", + "dev": true, + "requires": { + "symbol-observable": "1.2.0" + } + }, "indent-string": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", @@ -11007,88 +11306,98 @@ } }, "jss": { - "version": "10.1.1", - "resolved": "https://registry.npmjs.org/jss/-/jss-10.1.1.tgz", - "integrity": "sha512-Xz3qgRUFlxbWk1czCZibUJqhVPObrZHxY3FPsjCXhDld4NOj1BgM14Ir5hVm+Qr6OLqVljjGvoMcCdXNOAbdkQ==", + "version": "10.5.1", + "resolved": "https://registry.npmjs.org/jss/-/jss-10.5.1.tgz", + "integrity": "sha512-hbbO3+FOTqVdd7ZUoTiwpHzKXIo5vGpMNbuXH1a0wubRSWLWSBvwvaq4CiHH/U42CmjOnp6lVNNs/l+Z7ZdDmg==", "dev": true, "requires": { "@babel/runtime": "^7.3.1", - "csstype": "^2.6.5", + "csstype": "^3.0.2", + "indefinite-observable": "^2.0.1", "is-in-browser": "^1.1.3", "tiny-warning": "^1.0.2" + }, + "dependencies": { + "csstype": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.0.6.tgz", + "integrity": "sha512-+ZAmfyWMT7TiIlzdqJgjMb7S4f1beorDbWbsocyK4RaiqA5RTX3K14bnBWmmA9QEM0gRdsjyyrEmcyga8Zsxmw==", + "dev": true + } } }, "jss-plugin-camel-case": { - "version": "10.1.1", - "resolved": "https://registry.npmjs.org/jss-plugin-camel-case/-/jss-plugin-camel-case-10.1.1.tgz", - "integrity": "sha512-MDIaw8FeD5uFz1seQBKz4pnvDLnj5vIKV5hXSVdMaAVq13xR6SVTVWkIV/keyTs5txxTvzGJ9hXoxgd1WTUlBw==", + "version": "10.5.1", + "resolved": "https://registry.npmjs.org/jss-plugin-camel-case/-/jss-plugin-camel-case-10.5.1.tgz", + "integrity": "sha512-9+oymA7wPtswm+zxVti1qiowC5q7bRdCJNORtns2JUj/QHp2QPXYwSNRD8+D2Cy3/CEMtdJzlNnt5aXmpS6NAg==", "dev": true, "requires": { "@babel/runtime": "^7.3.1", "hyphenate-style-name": "^1.0.3", - "jss": "10.1.1" + "jss": "10.5.1" } }, "jss-plugin-default-unit": { - "version": "10.1.1", - "resolved": "https://registry.npmjs.org/jss-plugin-default-unit/-/jss-plugin-default-unit-10.1.1.tgz", - "integrity": "sha512-UkeVCA/b3QEA4k0nIKS4uWXDCNmV73WLHdh2oDGZZc3GsQtlOCuiH3EkB/qI60v2MiCq356/SYWsDXt21yjwdg==", + "version": "10.5.1", + "resolved": "https://registry.npmjs.org/jss-plugin-default-unit/-/jss-plugin-default-unit-10.5.1.tgz", + "integrity": "sha512-D48hJBc9Tj3PusvlillHW8Fz0y/QqA7MNmTYDQaSB/7mTrCZjt7AVRROExoOHEtd2qIYKOYJW3Jc2agnvsXRlQ==", "dev": true, "requires": { "@babel/runtime": "^7.3.1", - "jss": "10.1.1" + "jss": "10.5.1" } }, "jss-plugin-global": { - "version": "10.1.1", - "resolved": "https://registry.npmjs.org/jss-plugin-global/-/jss-plugin-global-10.1.1.tgz", - "integrity": "sha512-VBG3wRyi3Z8S4kMhm8rZV6caYBegsk+QnQZSVmrWw6GVOT/Z4FA7eyMu5SdkorDlG/HVpHh91oFN56O4R9m2VA==", + "version": "10.5.1", + "resolved": "https://registry.npmjs.org/jss-plugin-global/-/jss-plugin-global-10.5.1.tgz", + "integrity": "sha512-jX4XpNgoaB8yPWw/gA1aPXJEoX0LNpvsROPvxlnYe+SE0JOhuvF7mA6dCkgpXBxfTWKJsno7cDSCgzHTocRjCQ==", "dev": true, "requires": { "@babel/runtime": "^7.3.1", - "jss": "10.1.1" + "jss": "10.5.1" } }, "jss-plugin-nested": { - "version": "10.1.1", - "resolved": "https://registry.npmjs.org/jss-plugin-nested/-/jss-plugin-nested-10.1.1.tgz", - "integrity": "sha512-ozEu7ZBSVrMYxSDplPX3H82XHNQk2DQEJ9TEyo7OVTPJ1hEieqjDFiOQOxXEj9z3PMqkylnUbvWIZRDKCFYw5Q==", + "version": "10.5.1", + "resolved": "https://registry.npmjs.org/jss-plugin-nested/-/jss-plugin-nested-10.5.1.tgz", + "integrity": "sha512-xXkWKOCljuwHNjSYcXrCxBnjd8eJp90KVFW1rlhvKKRXnEKVD6vdKXYezk2a89uKAHckSvBvBoDGsfZrldWqqQ==", "dev": true, "requires": { "@babel/runtime": "^7.3.1", - "jss": "10.1.1", + "jss": "10.5.1", "tiny-warning": "^1.0.2" } }, "jss-plugin-props-sort": { - "version": "10.1.1", - "resolved": "https://registry.npmjs.org/jss-plugin-props-sort/-/jss-plugin-props-sort-10.1.1.tgz", - "integrity": "sha512-g/joK3eTDZB4pkqpZB38257yD4LXB0X15jxtZAGbUzcKAVUHPl9Jb47Y7lYmiGsShiV4YmQRqG1p2DHMYoK91g==", + "version": "10.5.1", + "resolved": "https://registry.npmjs.org/jss-plugin-props-sort/-/jss-plugin-props-sort-10.5.1.tgz", + "integrity": "sha512-t+2vcevNmMg4U/jAuxlfjKt46D/jHzCPEjsjLRj/J56CvP7Iy03scsUP58Iw8mVnaV36xAUZH2CmAmAdo8994g==", "dev": true, "requires": { "@babel/runtime": "^7.3.1", - "jss": "10.1.1" + "jss": "10.5.1" } }, "jss-plugin-rule-value-function": { - "version": "10.1.1", - "resolved": "https://registry.npmjs.org/jss-plugin-rule-value-function/-/jss-plugin-rule-value-function-10.1.1.tgz", - "integrity": "sha512-ClV1lvJ3laU9la1CUzaDugEcwnpjPTuJ0yGy2YtcU+gG/w9HMInD5vEv7xKAz53Bk4WiJm5uLOElSEshHyhKNw==", + "version": "10.5.1", + "resolved": "https://registry.npmjs.org/jss-plugin-rule-value-function/-/jss-plugin-rule-value-function-10.5.1.tgz", + "integrity": "sha512-3gjrSxsy4ka/lGQsTDY8oYYtkt2esBvQiceGBB4PykXxHoGRz14tbCK31Zc6DHEnIeqsjMUGbq+wEly5UViStQ==", "dev": true, "requires": { "@babel/runtime": "^7.3.1", - "jss": "10.1.1" + "jss": "10.5.1", + "tiny-warning": "^1.0.2" } }, "jss-plugin-vendor-prefixer": { - "version": "10.1.1", - "resolved": "https://registry.npmjs.org/jss-plugin-vendor-prefixer/-/jss-plugin-vendor-prefixer-10.1.1.tgz", - "integrity": "sha512-09MZpQ6onQrhaVSF6GHC4iYifQ7+4YC/tAP6D4ZWeZotvCMq1mHLqNKRIaqQ2lkgANjlEot2JnVi1ktu4+L4pw==", + "version": "10.5.1", + "resolved": "https://registry.npmjs.org/jss-plugin-vendor-prefixer/-/jss-plugin-vendor-prefixer-10.5.1.tgz", + "integrity": "sha512-cLkH6RaPZWHa1TqSfd2vszNNgxT1W0omlSjAd6hCFHp3KIocSrW21gaHjlMU26JpTHwkc+tJTCQOmE/O1A4FKQ==", "dev": true, "requires": { "@babel/runtime": "^7.3.1", - "css-vendor": "^2.0.7", - "jss": "10.1.1" + "css-vendor": "^2.0.8", + "jss": "10.5.1" } }, "keyv": { @@ -13644,9 +13953,9 @@ } }, "react-transition-group": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/react-transition-group/-/react-transition-group-4.3.0.tgz", - "integrity": "sha512-1qRV1ZuVSdxPlPf4O8t7inxUGpdyO5zG9IoNfJxSO0ImU2A1YWkEQvFPuIPZmMLkg5hYs7vv5mMOyfgSkvAwvw==", + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/react-transition-group/-/react-transition-group-4.4.1.tgz", + "integrity": "sha512-Djqr7OQ2aPUiYurhPalTrVy9ddmFCCzwhqQmtN+J3+3DzLO209Fdr70QrN8Z3DsglWql6iY1lDWAfpFiBtuKGw==", "dev": true, "requires": { "@babel/runtime": "^7.5.5", @@ -14888,6 +15197,12 @@ } } }, + "stylis": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/stylis/-/stylis-4.0.7.tgz", + "integrity": "sha512-OFFeUXFgwnGOKvEXaSv0D0KQ5ADP0n6g3SVONx6I/85JzNZ3u50FRwB3lVIk1QO2HNdI75tbVzc4Z66Gdp9voA==", + "dev": true + }, "supertap": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/supertap/-/supertap-1.0.0.tgz", @@ -14990,6 +15305,12 @@ } } }, + "symbol-observable": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.2.0.tgz", + "integrity": "sha512-e900nM8RRtGhlV36KGEU9k65K3mPb1WV70OdjfxlG2EAuM1noi/E/BaW/uMhL7bPEssK8QV57vN3esixjUvcXQ==", + "dev": true + }, "symbol.prototype.description": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/symbol.prototype.description/-/symbol.prototype.description-1.0.2.tgz", diff --git a/package.json b/package.json index 79acee0..b8d0794 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,9 @@ "@babel/plugin-transform-modules-commonjs": "^7.4.4", "@babel/preset-env": "^7.4.5", "@babel/preset-react": "^7.0.0", - "@material-ui/core": "^4.0.0", + "@emotion/react": "^11.1.5", + "@emotion/styled": "^11.1.5", + "@material-ui/core": "^5.0.0-alpha.24", "@mdi/js": "^5.9.55", "@mdi/light-js": "^0.2.63", "@storybook/react": "^6.0.5", @@ -44,7 +46,7 @@ "xml2js": "^0.4.19" }, "peerDependencies": { - "@material-ui/core": "^4.0.0", + "@material-ui/core": "^5.0.0 || ^5.0.0-alpha.24", "react": "^16.8.0 || ^17.0.0" }, "scripts": { diff --git a/src/util/createIcon.js b/src/util/createIcon.js index 5c29baa..5e10de5 100644 --- a/src/util/createIcon.js +++ b/src/util/createIcon.js @@ -1,14 +1,4 @@ -import * as React from 'react' -import SvgIcon from '@material-ui/core/SvgIcon' +import * as React from "react"; +import { createSvgIcon } from "@material-ui/core/utils"; -export default (path) => { - const Icon = React.memo( - React.forwardRef((props, ref) => ( - - - - )) - ) - Icon.muiName = 'SvgIcon' - return Icon -} +export default (path, name) => createSvgIcon(, name); diff --git a/test.js b/test.js index 01eb5dd..7c07dba 100644 --- a/test.js +++ b/test.js @@ -1,55 +1,67 @@ -const test = require('ava') -const React = require('react') -const renderer = require('react-test-renderer') -const fs = require('fs') -const filenameMap = require('./filenameMap') -const commonjsIcons = require('./package/index') -const commonjsIconsLight = require('./package/light/index') +const test = require("ava"); +const React = require("react"); +const renderer = require("react-test-renderer"); +const fs = require("fs"); +const filenameMap = require("./filenameMap"); +const commonjsIcons = require("./package/index"); +const commonjsIconsLight = require("./package/light/index"); -test('the npm package', (t) => { +test("the npm package", (t) => { // should set sideEffects to false to allow webpack to optimize re-exports - const packageJson = require('./package/package.json') - t.false(packageJson.sideEffects) -}) + const packageJson = require("./package/package.json"); + t.false(packageJson.sideEffects); +}); for (const iconName of Object.keys(commonjsIcons)) { test(`icons > ${iconName}`, (t) => { - const renderedIcon = renderer.create(React.createElement(commonjsIcons[iconName])).toJSON() - t.is(renderedIcon.type, 'svg') - t.is(commonjsIcons[iconName].muiName, 'SvgIcon') - }) + const renderedIcon = renderer + .create(React.createElement(commonjsIcons[iconName])) + .toJSON(); + // t.is(renderedIcon[0].type, 'style') // generated by emotion + t.is(renderedIcon[1].type, "svg"); + t.is(renderedIcon[1].props["data-testid"], `${iconName}Icon`); + }); } -test('ES module index file', (t) => { - const esmReExports = fs.readFileSync('./package/index.es.js', 'utf-8') - .split('\n') - .filter((line) => line.length > 0) - t.is(esmReExports.length, Object.keys(commonjsIcons).length) +test("ES module index file", (t) => { + const esmReExports = fs + .readFileSync("./package/index.es.js", "utf-8") + .split("\n") + .filter((line) => line.length > 0); + t.is(esmReExports.length, Object.keys(commonjsIcons).length); for (const line of esmReExports) { - const match = line.match(/^export \{ default as (.+?) \} from '\.\/(.+?)'$/) - t.is(filenameMap[match[1]] || match[1], match[2]) - t.truthy(commonjsIcons[match[1]]) + const match = line.match( + /^export \{ default as (.+?) \} from '\.\/(.+?)'$/ + ); + t.is(filenameMap[match[1]] || match[1], match[2]); + t.truthy(commonjsIcons[match[1]]); } -}) +}); for (const iconName of Object.keys(commonjsIconsLight)) { test(`light icons > ${iconName}`, (t) => { - const renderedIcon = renderer.create(React.createElement(commonjsIconsLight[iconName])).toJSON() - t.is(renderedIcon.type, 'svg') - t.is(commonjsIconsLight[iconName].muiName, 'SvgIcon') - }) + const renderedIcon = renderer + .create(React.createElement(commonjsIconsLight[iconName])) + .toJSON(); + // t.is(renderedIcon[0].type, 'style') // generated by emotion + t.is(renderedIcon[1].type, "svg"); + t.is(renderedIcon[1].props["data-testid"], `${iconName}Icon`); + }); } -test('mdi-light ES module index file', (t) => { - const esmReExports = fs.readFileSync('./package/light/index.es.js', 'utf-8') - .split('\n') - .filter((line) => line.length > 0) - t.is(esmReExports.length, Object.keys(commonjsIconsLight).length) +test("mdi-light ES module index file", (t) => { + const esmReExports = fs + .readFileSync("./package/light/index.es.js", "utf-8") + .split("\n") + .filter((line) => line.length > 0); + t.is(esmReExports.length, Object.keys(commonjsIconsLight).length); for (const line of esmReExports) { - const match = line.match(/^export \{ default as (.+?) \} from '\.\/(.+?)'$/) - t.is(match[1], match[2]) - t.truthy(commonjsIconsLight[match[1]]) + const match = line.match( + /^export \{ default as (.+?) \} from '\.\/(.+?)'$/ + ); + t.is(match[1], match[2]); + t.truthy(commonjsIconsLight[match[1]]); } -}) +});