Skip to content

Commit

Permalink
Target React 18.
Browse files Browse the repository at this point in the history
  • Loading branch information
yjwong committed Sep 6, 2024
1 parent b27fc36 commit 55bd8df
Show file tree
Hide file tree
Showing 9 changed files with 77 additions and 88 deletions.
26 changes: 12 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"module": "./es/index.js",
"sideEffects": false,
"engines": {
"node": ">=14"
"node": ">=16"
},
"scripts": {
"build": "npm run build:icon && npm run build:next:icon && npm run build:lib && npm run build:es && npm run build:ts",
Expand Down Expand Up @@ -79,10 +79,10 @@
"@types/jest": "^27.4.1",
"@types/lodash": "^4.14.188",
"@types/lodash-es": "^4.17.6",
"@types/node": "^12.12.7",
"@types/react": "^17.0.37",
"@types/react-dom": "^17.0.11",
"@types/react-test-renderer": "^17.0.1",
"@types/node": "^16.18.108",
"@types/react": "^18.3.5",
"@types/react-dom": "^18.3.0",
"@types/react-test-renderer": "^18.3.0",
"@types/styled-components": "^5.1.1",
"@types/styled-system": "^5.1.10",
"@typescript-eslint/eslint-plugin": "^5.6.0",
Expand Down Expand Up @@ -116,10 +116,10 @@
"lodash": "^4.17.21",
"lodash-es": "^4.17.21",
"prettier": "^3.0.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-is": "^17.0.2",
"react-test-renderer": "^17.0.2",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-is": "^18.3.1",
"react-test-renderer": "^18.3.1",
"start-server-and-test": "^1.15.2",
"styled-components": "^5.1.1",
"stylelint": "^10.0.1",
Expand All @@ -143,8 +143,8 @@
},
"peerDependencies": {
"lodash-es": "^4.0.0",
"react": "^17",
"react-dom": "^17",
"react": "^17 || ^18",
"react-dom": "^17 || ^18",
"styled-components": "^4.0.0 || ^5.0.0"
},
"jest": {
Expand All @@ -167,9 +167,7 @@
"@glints/poppins": "^1.0.2"
},
"resolutions": {
"immer": "^9.0.6",
"@types/react": "^17.0.37",
"@types/react-dom": "^17.0.11"
"immer": "^9.0.6"
},
"lint-staged": {
"**/*.{ts,tsx}": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const ComboboxMultiSelect = ({
...args
}: ComboboxMultiSelectProps) => {
const [inputValue, setInputValue] = useState('');
const [selectedOptions, setSelectedOptions] = useState([]);
const [selectedOptions, setSelectedOptions] = useState<string[]>([]);
const [isSearchEmpty, setIsSearchEmpty] = useState(false);

const [options, setOptions] = useState(countries);
Expand Down Expand Up @@ -58,7 +58,7 @@ export const ComboboxMultiSelect = ({
: null;

const removeTag = useCallback(
tag => () => {
(tag: string) => () => {
const options = [...selectedOptions];
options.splice(options.indexOf(tag), 1);
setSelectedOptions(options);
Expand Down
2 changes: 1 addition & 1 deletion src/@next/Tag/Tag.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const RemoveableTemplate: Story<TagProps> = () => {
]);

const removeTag = useCallback(
tag => () => {
(tag: string) => () => {
setSelectedTags(previousTags =>
previousTags.filter(previousTag => previousTag !== tag)
);
Expand Down
3 changes: 2 additions & 1 deletion src/@next/Tooltip/Tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ const tooltipPositionResolvers: Record<
},
};

export interface TooltipProps extends React.HTMLAttributes<HTMLDivElement> {
export interface TooltipProps
extends Omit<React.HTMLAttributes<HTMLDivElement>, 'content'> {
preferredPosition?: TooltipPosition;
children: React.ReactNode;
content: React.ReactNode;
Expand Down
1 change: 1 addition & 0 deletions src/Input/DownshiftSelect/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export const defaultEmptyListText =
// sometimes we want to make additional props available to the subcomponent,
// e.g. a Item subcomponent needs to know the item it represents.
export type ItemProps = {
children?: React.ReactNode;
item: Item;
};

Expand Down
8 changes: 3 additions & 5 deletions src/Input/Select/Select.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -363,11 +363,9 @@ describe('when renderError is given', () => {
});

it('should render the custom error in the custom error container', () => {
const customError = () => (
<span data-testid="custom-error">nasty error</span>
);
const errorContainer = (e: () => React.ReactNode) => (
<div data-testid="error-component">{e()}</div>
const customError = <span data-testid="custom-error">nasty error</span>;
const errorContainer = (e: React.ReactNode) => (
<div data-testid="error-component">{e}</div>
);
const { container, getByTestId } = render(
<Select renderError={errorContainer} error={customError}>
Expand Down
4 changes: 2 additions & 2 deletions src/Input/ToggleSwitch/ToggleSwitch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ export interface ToggleSwitchProps {
defaultActive?: boolean;
/** The icon components that will be used in both active and inactive states. Both icons have to be defined when opting to use this. */
iconOptions?: {
active: React.ReactType;
inactive: React.ReactType;
active: React.ElementType;
inactive: React.ElementType;
};
/** Called when the state of the toggle has been changed. Called with true or false depending on whether the toggle became active or inactive. */
onChange?: (active: boolean) => void;
Expand Down
1 change: 1 addition & 0 deletions src/Utils/DelayedUnmount.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useLayoutEffect, useState } from 'react';

interface Props {
children?: React.ReactNode;
mount: boolean;
delay?: number;
}
Expand Down
116 changes: 53 additions & 63 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@
regenerator-runtime "^0.13.11"
v8flags "^3.1.1"

"@babel/parser@^7.1.0", "@babel/parser@^7.12.11", "@babel/parser@^7.12.7", "@babel/parser@^7.14.7", "@babel/parser@^7.20.7", "@babel/parser@^7.8.3", "babylon7@npm:@babel/parser@^7":
"@babel/parser@^7.1.0", "@babel/parser@^7.12.11", "@babel/parser@^7.12.7", "@babel/parser@^7.14.7", "@babel/parser@^7.20.7", "@babel/parser@^7.8.3":
version "7.20.7"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.20.7.tgz#66fe23b3c8569220817d5feb8b9dcdc95bb4f71b"
integrity sha512-T3Z9oHybU+0vZlY9CiDSJQTD5ZapcW18ZctFMi0MOAl/4BjFF4ul7NVSARLdbGO5vDqy9eQiGTV0LtKfvCYvcg==
Expand Down Expand Up @@ -3272,20 +3272,10 @@
"@types/node" "*"
form-data "^3.0.0"

"@types/node@*":
version "17.0.22"
resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.22.tgz#38b6c4b9b2f3ed9f2e376cce42a298fb2375251e"
integrity sha512-8FwbVoG4fy+ykY86XCAclKZDORttqE5/s7dyWZKLXTdv3vRy5HozBEinG5IqhvPXXzIZEcTVbuHlQEI6iuwcmw==

"@types/node@^12.12.7":
version "12.20.47"
resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.47.tgz#ca9237d51f2a2557419688511dab1c8daf475188"
integrity sha512-BzcaRsnFuznzOItW1WpQrDHM7plAa7GIDMZ6b5pnMbkqEtM/6WCOhvZar39oeMQP79gwvFUWjjptE7/KGcNqFg==

"@types/node@^14.0.10 || ^16.0.0", "@types/node@^14.14.20 || ^16.0.0":
version "16.18.10"
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.18.10.tgz#d7415ef18c94f8d4e4a82ebcc8b8999f965d8920"
integrity sha512-XU1+v7h81p7145ddPfjv7jtWvkSilpcnON3mQ+bDi9Yuf7OI56efOglXRyXWgQ57xH3fEQgh7WOJMncRHVew5w==
"@types/node@*", "@types/node@^16.18.108", "@types/node@^14.0.10 || ^16.0.0", "@types/node@^14.14.20 || ^16.0.0":
version "16.18.108"
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.18.108.tgz#b794e2b2a85b4c12935ea7d0f18641be68b352f9"
integrity sha512-fj42LD82fSv6yN9C6Q4dzS+hujHj+pTv0IpRR3kI20fnYeS0ytBpjFO9OjmDowSPPt4lNKN46JLaKbCyP+BW2A==

"@types/normalize-package-data@^2.4.0":
version "2.4.1"
Expand Down Expand Up @@ -3327,17 +3317,17 @@
resolved "https://registry.yarnpkg.com/@types/qs/-/qs-6.9.7.tgz#63bb7d067db107cc1e457c303bc25d511febf6cb"
integrity sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw==

"@types/react-dom@^17.0.11", "@types/react-dom@^18.0.6":
version "17.0.14"
resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-17.0.14.tgz#c8f917156b652ddf807711f5becbd2ab018dea9f"
integrity sha512-H03xwEP1oXmSfl3iobtmQ/2dHF5aBHr8aUMwyGZya6OW45G+xtdzmq6HkncefiBt5JU8DVyaWl/nWZbjZCnzAQ==
"@types/react-dom@^18.0.6", "@types/react-dom@^18.3.0":
version "18.3.0"
resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-18.3.0.tgz#0cbc818755d87066ab6ca74fbedb2547d74a82b0"
integrity sha512-EhwApuTmMBmXuFOikhQLIBUn6uFg81SwLMOAUgodJF14SOBOCMdU04gDoYi0WOJJHD144TL32z4yDqCW3dnkQg==
dependencies:
"@types/react" "*"

"@types/react-test-renderer@^17.0.1":
version "17.0.1"
resolved "https://registry.yarnpkg.com/@types/react-test-renderer/-/react-test-renderer-17.0.1.tgz#3120f7d1c157fba9df0118dae20cb0297ee0e06b"
integrity sha512-3Fi2O6Zzq/f3QR9dRnlnHso9bMl7weKCviFmfF6B4LS1Uat6Hkm15k0ZAQuDz+UBq6B3+g+NM6IT2nr5QgPzCw==
"@types/react-test-renderer@^18.3.0":
version "18.3.0"
resolved "https://registry.yarnpkg.com/@types/react-test-renderer/-/react-test-renderer-18.3.0.tgz#839502eae70058a4ae161f63385a8e7929cef4c0"
integrity sha512-HW4MuEYxfDbOHQsVlY/XtOvNHftCVEPhJF2pQXXwcUiUF+Oyb0usgp48HSgpK5rt8m9KZb22yqOeZm+rrVG8gw==
dependencies:
"@types/react" "*"

Expand All @@ -3348,20 +3338,14 @@
dependencies:
"@types/react" "*"

"@types/react@*", "@types/react@^17.0.37", "@types/react@^18.0.15":
version "17.0.41"
resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.41.tgz#6e179590d276394de1e357b3f89d05d7d3da8b85"
integrity sha512-chYZ9ogWUodyC7VUTRBfblysKLjnohhFY9bGLwvnUFFy48+vB9DikmB3lW0qTFmBcKSzmdglcvkHK71IioOlDA==
"@types/react@*", "@types/react@^18.0.15", "@types/react@^18.3.5":
version "18.3.5"
resolved "https://registry.yarnpkg.com/@types/react/-/react-18.3.5.tgz#5f524c2ad2089c0ff372bbdabc77ca2c4dbadf8f"
integrity sha512-WeqMfGJLGuLCqHGYRGHxnKrXcTitc6L/nBUWfWPcTarG3t9PsquqUMuVeXZeca+mglY4Vo5GZjCi0A3Or2lnxA==
dependencies:
"@types/prop-types" "*"
"@types/scheduler" "*"
csstype "^3.0.2"

"@types/scheduler@*":
version "0.16.2"
resolved "https://registry.yarnpkg.com/@types/scheduler/-/scheduler-0.16.2.tgz#1a62f89525723dde24ba1b01b092bf5df8ad4d39"
integrity sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew==

"@types/semver@^7.3.12":
version "7.3.13"
resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.3.13.tgz#da4bfd73f49bd541d28920ab0e2bf0ee80f71c91"
Expand Down Expand Up @@ -4644,6 +4628,11 @@ babel-preset-jest@^27.5.1:
babel-plugin-jest-hoist "^27.5.1"
babel-preset-current-node-syntax "^1.0.0"

"babylon7@npm:@babel/parser@^7":
version "7.20.7"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.20.7.tgz#66fe23b3c8569220817d5feb8b9dcdc95bb4f71b"
integrity sha512-T3Z9oHybU+0vZlY9CiDSJQTD5ZapcW18ZctFMi0MOAl/4BjFF4ul7NVSARLdbGO5vDqy9eQiGTV0LtKfvCYvcg==

bail@^1.0.0:
version "1.0.5"
resolved "https://registry.yarnpkg.com/bail/-/bail-1.0.5.tgz#b6fa133404a392cbc1f8c4bf63f5953351e7a776"
Expand Down Expand Up @@ -12224,14 +12213,13 @@ react-docgen@^5.0.0:
node-dir "^0.1.10"
strip-indent "^3.0.0"

react-dom@^17.0.2:
version "17.0.2"
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-17.0.2.tgz#ecffb6845e3ad8dbfcdc498f0d0a939736502c23"
integrity sha512-s4h96KtLDUQlsENhMn1ar8t2bEa+q/YAtj8pPPdIjPDGBDIVNsrD9aXNWqspUe6AzKCIG0C1HZZLqLV7qpOBGA==
react-dom@^18.3.1:
version "18.3.1"
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-18.3.1.tgz#c2265d79511b57d479b3dd3fdfa51536494c5cb4"
integrity sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==
dependencies:
loose-envify "^1.1.0"
object-assign "^4.1.1"
scheduler "^0.20.2"
scheduler "^0.23.2"

react-element-to-jsx-string@^14.3.4:
version "14.3.4"
Expand Down Expand Up @@ -12261,11 +12249,16 @@ react-inspector@^5.1.0:
is-dom "^1.0.0"
prop-types "^15.0.0"

[email protected], "react-is@^16.12.0 || ^17.0.0", react-is@^17.0.1, react-is@^17.0.2:
[email protected], react-is@^17.0.1, react-is@^17.0.2:
version "17.0.2"
resolved "https://registry.yarnpkg.com/react-is/-/react-is-17.0.2.tgz#e691d4a8e9c789365655539ab372762b0efb54f0"
integrity sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==

"react-is@^16.12.0 || ^17.0.0 || ^18.0.0", react-is@^18.3.1:
version "18.3.1"
resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.3.1.tgz#e83557dc12eae63a99e003a46388b1dcbb44db7e"
integrity sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==

react-is@^16.13.1, react-is@^16.7.0:
version "16.13.1"
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"
Expand All @@ -12276,23 +12269,22 @@ react-refresh@^0.11.0:
resolved "https://registry.yarnpkg.com/react-refresh/-/react-refresh-0.11.0.tgz#77198b944733f0f1f1a90e791de4541f9f074046"
integrity sha512-F27qZr8uUqwhWZboondsPx8tnC3Ct3SxZA3V5WyEvujRyyNv0VYPhoBg1gZ8/MV5tubQp76Trw8lTv9hzRBa+A==

react-shallow-renderer@^16.13.1:
version "16.14.1"
resolved "https://registry.yarnpkg.com/react-shallow-renderer/-/react-shallow-renderer-16.14.1.tgz#bf0d02df8a519a558fd9b8215442efa5c840e124"
integrity sha512-rkIMcQi01/+kxiTE9D3fdS959U1g7gs+/rborw++42m1O9FAQiNI/UNRZExVUoAOprn4umcXf+pFRou8i4zuBg==
react-shallow-renderer@^16.15.0:
version "16.15.0"
resolved "https://registry.yarnpkg.com/react-shallow-renderer/-/react-shallow-renderer-16.15.0.tgz#48fb2cf9b23d23cde96708fe5273a7d3446f4457"
integrity sha512-oScf2FqQ9LFVQgA73vr86xl2NaOIX73rh+YFqcOp68CWj56tSfgtGKrEbyhCj0rSijyG9M1CYprTh39fBi5hzA==
dependencies:
object-assign "^4.1.1"
react-is "^16.12.0 || ^17.0.0"
react-is "^16.12.0 || ^17.0.0 || ^18.0.0"

react-test-renderer@^17.0.2:
version "17.0.2"
resolved "https://registry.yarnpkg.com/react-test-renderer/-/react-test-renderer-17.0.2.tgz#4cd4ae5ef1ad5670fc0ef776e8cc7e1231d9866c"
integrity sha512-yaQ9cB89c17PUb0x6UfWRs7kQCorVdHlutU1boVPEsB8IDZH6n9tHxMacc3y0JoXOJUsZb/t/Mb8FUWMKaM7iQ==
react-test-renderer@^18.3.1:
version "18.3.1"
resolved "https://registry.yarnpkg.com/react-test-renderer/-/react-test-renderer-18.3.1.tgz#e693608a1f96283400d4a3afead6893f958b80b4"
integrity sha512-KkAgygexHUkQqtvvx/otwxtuFu5cVjfzTCtjXLH9boS19/Nbtg84zS7wIQn39G8IlrhThBpQsMKkq5ZHZIYFXA==
dependencies:
object-assign "^4.1.1"
react-is "^17.0.2"
react-shallow-renderer "^16.13.1"
scheduler "^0.20.2"
react-is "^18.3.1"
react-shallow-renderer "^16.15.0"
scheduler "^0.23.2"

react-transition-group@^4.4.2:
version "4.4.5"
Expand All @@ -12304,13 +12296,12 @@ react-transition-group@^4.4.2:
loose-envify "^1.4.0"
prop-types "^15.6.2"

react@^17.0.2:
version "17.0.2"
resolved "https://registry.yarnpkg.com/react/-/react-17.0.2.tgz#d0b5cc516d29eb3eee383f75b62864cfb6800037"
integrity sha512-gnhPt75i/dq/z3/6q/0asP78D0u592D5L1pd7M8P+dck6Fu/jJeL6iVVK23fptSUZj8Vjf++7wXA8UNclGQcbA==
react@^18.3.1:
version "18.3.1"
resolved "https://registry.yarnpkg.com/react/-/react-18.3.1.tgz#49ab892009c53933625bd16b2533fc754cab2891"
integrity sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==
dependencies:
loose-envify "^1.1.0"
object-assign "^4.1.1"

read-pkg-up@^1.0.1:
version "1.0.1"
Expand Down Expand Up @@ -12953,13 +12944,12 @@ saxes@^5.0.1:
dependencies:
xmlchars "^2.2.0"

scheduler@^0.20.2:
version "0.20.2"
resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.20.2.tgz#4baee39436e34aa93b4874bddcbf0fe8b8b50e91"
integrity sha512-2eWfGgAqqWFGqtdMmcL5zCMK1U8KlXv8SQFGglL3CEtd0aDVDWgeF/YoCmvln55m5zSk3J/20hTaSBeSObsQDQ==
scheduler@^0.23.2:
version "0.23.2"
resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.23.2.tgz#414ba64a3b282892e944cf2108ecc078d115cdc3"
integrity sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==
dependencies:
loose-envify "^1.1.0"
object-assign "^4.1.1"

[email protected]:
version "2.7.0"
Expand Down

0 comments on commit 55bd8df

Please sign in to comment.