Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependencies #813

Merged
merged 9 commits into from
Jun 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .codesandbox/ci.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"buildCommand": "build",
"sandboxes": ["/.codesandbox/templates/reach-ui"]
"sandboxes": ["/.codesandbox/templates/reach-ui"],
"node": "14"
}
8 changes: 4 additions & 4 deletions .codesandbox/templates/reach-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@
"@reach/utils": "latest",
"@reach/visually-hidden": "latest",
"@reach/window-size": "latest",
"@types/react": "^17.0.3",
"@types/react-dom": "^17.0.3",
"@types/react": "^17.0.11",
"@types/react-dom": "^17.0.8",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-scripts": "3.4.1"
"react-scripts": "4.0.3"
},
"devDependencies": {
"typescript": "4.1.5"
"typescript": "4.3.4"
},
"scripts": {
"start": "react-scripts start",
Expand Down
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn pretty-quick --staged
2 changes: 2 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ module.exports = {
"\\$test(.*)$": "<rootDir>/test/$1",
},
setupFilesAfterEnv: ["<rootDir>/test/setupTests.ts"],
timers: "modern",
testEnvironment: "jsdom",
testMatch: ["<rootDir>/**/*.(spec|test).{ts,tsx,js,jsx}"],
testURL: "http://localhost",
transformIgnorePatterns: [
Expand Down
115 changes: 56 additions & 59 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,72 +23,75 @@
"dev": "preconstruct dev && yarn start",
"pc": "preconstruct",
"postinstall": "manypkg check && preconstruct dev",
"prepare": "husky install",
"release": "lerna publish from-git --yes --pre-dist-tag next"
},
"dependencies": {
"@babel/core": "^7.13.14",
"@babel/plugin-proposal-class-properties": "^7.13.0",
"@babel/preset-env": "^7.13.12",
"@babel/preset-react": "^7.13.13",
"@babel/preset-typescript": "^7.13.0",
"@manypkg/cli": "^0.17.0",
"@preconstruct/cli": "^2.0.6",
"@babel/core": "^7.14.6",
"@babel/plugin-proposal-class-properties": "^7.14.5",
"@babel/preset-env": "^7.14.7",
"@babel/preset-react": "^7.14.5",
"@babel/preset-typescript": "^7.14.5",
"@manypkg/cli": "^0.18.0",
"@preconstruct/cli": "^2.1.0",
"@reach/router": "^1.3.4",
"@storybook/addon-actions": "^6.2.9",
"@storybook/addon-docs": "^6.2.9",
"@storybook/addon-links": "^6.2.9",
"@react-spring/web": "^9.2.3",
"@storybook/addon-actions": "^6.3.1",
"@storybook/addon-docs": "^6.3.1",
"@storybook/addon-links": "^6.3.1",
"@storybook/addon-postcss": "^2.0.0",
"@storybook/addons": "^6.2.9",
"@storybook/react": "^6.2.9",
"@testing-library/dom": "^7.30.1",
"@testing-library/jest-dom": "^5.11.10",
"@testing-library/react": "^11.2.5",
"@testing-library/react-hooks": "^5.1.0",
"@testing-library/user-event": "^13.0.16",
"@types/eslint": "^7.2.7",
"@types/invariant": "^2.2.33",
"@types/jest": "^26.0.0",
"@types/lodash": "^4.14.155",
"@types/node": "^12.12.47",
"@types/react": "^17.0.3",
"@types/react-dom": "^17.0.3",
"@storybook/addons": "^6.3.1",
"@storybook/react": "^6.3.1",
"@testing-library/dom": "^8.0.0",
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^12.0.0",
"@testing-library/react-hooks": "^7.0.0",
"@testing-library/user-event": "^13.1.9",
"@types/eslint": "^7.2.13",
"@types/invariant": "^2.2.34",
"@types/jest": "^26.0.23",
"@types/lodash": "^4.14.170",
"@types/node": "^14.15.0",
"@types/react": "^17.0.11",
"@types/react-dom": "^17.0.8",
"@types/react-router-dom": "^5.1.7",
"@types/react-test-renderer": "^17.0.1",
"@types/sinon": "^9.0.4",
"@types/styled-components": "^5.1.2",
"@types/sinon": "^10.0.2",
"@types/styled-components": "^5.1.10",
"@types/tabbable": "^3.1.0",
"@types/warning": "^3.0.0",
"@typescript-eslint/eslint-plugin": "^4.20.0",
"@typescript-eslint/parser": "^4.20.0",
"autoprefixer": "^9.8.6",
"@typescript-eslint/eslint-plugin": "^4.28.0",
"@typescript-eslint/parser": "^4.28.0",
"autoprefixer": "^10.2.6",
"babel-eslint": "^10.1.0",
"babel-jest": "^26.6.3",
"babel-jest": "^27.0.5",
"babel-loader": "^8.2.2",
"babel-plugin-annotate-pure-calls": "0.4.0",
"babel-plugin-dev-expression": "0.2.2",
"babel-plugin-macros": "^3.0.1",
"cross-env": "^7.0.2",
"dotenv-cli": "^3.2.0",
"eslint": "^7.23.0",
"cross-env": "^7.0.3",
"dotenv-cli": "^4.0.0",
"eslint": "^7.29.0",
"eslint-config-react-app": "^6.0.0",
"eslint-plugin-flowtype": "^5.4.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jest": "^24.3.2",
"eslint-plugin-flowtype": "^5.7.2",
"eslint-plugin-import": "^2.23.4",
"eslint-plugin-jest": "^24.3.6",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-react": "^7.23.1",
"eslint-plugin-react": "^7.24.0",
"eslint-plugin-react-hooks": "^4.2.0",
"eslint-plugin-testing-library": "^3.10.2",
"husky": "^4.2.5",
"jest": "^26.6.3",
"jest-axe": "^4.1.0",
"jest-watch-typeahead": "0.6.1",
"lerna": "^3.22.1",
"eslint-plugin-testing-library": "^3.9.0",
"husky": "^6.0.0",
"jest": "^27.0.5",
"jest-axe": "^5.0.1",
"jest-watch-typeahead": "0.6.4",
"lerna": "^4.0.0",
"lerna-changelog": "^1.0.1",
"lodash": "^4.17.21",
"match-sorter": "^6.0.1",
"match-sorter": "^6.3.0",
"postcss": "^8.3.5",
"postcss-preset-env": "^6.7.0",
"prettier": "^2.0.5",
"pretty-quick": "^3.0.0",
"prettier": "^2.3.2",
"pretty-quick": "^3.1.1",
"prop-types": "^15.7.2",
"react": "^17.0.2",
"react-16": "npm:react@^16.14.0",
Expand All @@ -98,25 +101,19 @@
"react-is-16": "npm:react-is@^16.13.1",
"react-router": "^5.2.0",
"react-router-dom": "^5.2.0",
"react-spring": "^8.0.27",
"react-test-renderer": "^16.13.1",
"sinon": "^9.0.3",
"styled-components": "^5.1.1",
"ts-jest": "^26.5.4",
"typescript": "^4.2.3"
"react-test-renderer": "^17.0.2",
"sinon": "^11.1.1",
"styled-components": "^5.3.0",
"ts-jest": "^27.0.3",
"typescript": "^4.3.4"
},
"resolutions": {
"@types/react": "^17.0.3",
"@types/react-dom": "^17.0.3"
"@types/react": "^17.0.11",
"@types/react-dom": "^17.0.8"
},
"workspaces": [
"packages/*"
],
"husky": {
"hooks": {
"pre-commit": "pretty-quick --staged"
}
},
"changelog": {
"labels": {
"Type: Breaking Change": "🔨 Breaking Changes",
Expand Down
40 changes: 40 additions & 0 deletions packages/accordion/__tests__/accordion-axe.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import * as React from "react";
import { render, fireEvent } from "$test/utils";
import { axe } from "jest-axe";
import {
Accordion,
AccordionItem,
AccordionButton,
AccordionPanel,
} from "@reach/accordion";

describe("<Accordion /> with axe", () => {
it("Should not have ARIA violations", async () => {
jest.useRealTimers();
let { getByText, container } = render(
<Accordion data-testid="wrapper">
<AccordionItem data-testid="item1">
<AccordionButton>Button One</AccordionButton>
<AccordionPanel>Panel One</AccordionPanel>
</AccordionItem>
<AccordionItem data-testid="item2">
<AccordionButton>Button Two</AccordionButton>
<AccordionPanel>Panel Two</AccordionPanel>
</AccordionItem>
<AccordionItem data-testid="item3">
<AccordionButton>Button Three</AccordionButton>
<AccordionPanel>Panel Three</AccordionPanel>
</AccordionItem>
</Accordion>
);

let results = await axe(container);

expect(results).toHaveNoViolations();

// Toggle to another panel and check again
fireEvent.click(getByText("Button Two"));
results = await axe(container);
expect(results).toHaveNoViolations();
});
});
13 changes: 0 additions & 13 deletions packages/accordion/__tests__/accordion.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as React from "react";
import { render, fireEvent } from "$test/utils";
import { axe } from "jest-axe";
import {
Accordion,
AccordionItem,
Expand All @@ -10,18 +9,6 @@ import {

describe("<Accordion />", () => {
describe("a11y", () => {
it("Should not have ARIA violations", async () => {
let { container, buttons } = renderTestAccordion();
let results = await axe(container);

expect(results).toHaveNoViolations();

// Toggle to another panel and check again
fireEvent.click(buttons[1]);
results = await axe(container);
expect(results).toHaveNoViolations();
});

describe("ARIA attributes", () => {
let buttons: HTMLElement[];
let panels: HTMLElement[];
Expand Down
3 changes: 1 addition & 2 deletions packages/accordion/examples/animated.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
AccordionPanel,
useAccordionItemContext,
} from "@reach/accordion";
import { animated, config, useSpring } from "react-spring";
import { animated, useSpring } from "@react-spring/web";
import { action } from "@storybook/addon-actions";
import "@reach/accordion/styles.css";

Expand Down Expand Up @@ -78,7 +78,6 @@ const AnimatedPanel = React.forwardRef(({ children }, forwardedRef) => {
opacity: isExpanded ? 1 : 0,
height: isExpanded ? height : 0,
overflow: "hidden",
config: config.default,
});

return (
Expand Down
2 changes: 1 addition & 1 deletion packages/accordion/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@reach/utils": "0.15.0",
"prop-types": "^15.7.2",
"tiny-warning": "^1.0.3",
"tslib": "^2.1.0"
"tslib": "^2.3.0"
},
"devDependencies": {
"react": "^17.0.2",
Expand Down
23 changes: 11 additions & 12 deletions packages/accordion/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,11 @@ const AccordionContext = createNamedContext<InternalAccordionContextValue>(
"AccordionContext",
{} as InternalAccordionContextValue
);
const AccordionItemContext = createNamedContext<
InternalAccordionItemContextValue
>("AccordionItemContext", {} as InternalAccordionItemContextValue);
const AccordionItemContext =
createNamedContext<InternalAccordionItemContextValue>(
"AccordionItemContext",
{} as InternalAccordionItemContextValue
);

////////////////////////////////////////////////////////////////////////////////

Expand Down Expand Up @@ -80,9 +82,8 @@ const Accordion = React.forwardRef(function Accordion(
const wasControlled = typeof controlledIndex !== "undefined";
const { current: isControlled } = React.useRef(wasControlled);

const [descendants, setDescendants] = useDescendantsInit<
AccordionDescendant
>();
const [descendants, setDescendants] =
useDescendantsInit<AccordionDescendant>();

const id = useId(props.id);

Expand Down Expand Up @@ -341,9 +342,8 @@ const AccordionItem = React.forwardRef(function AccordionItem(
{ as: Comp = "div", children, disabled = false, ...props },
forwardedRef
) {
const { accordionId, openPanels, readOnly } = React.useContext(
AccordionContext
);
const { accordionId, openPanels, readOnly } =
React.useContext(AccordionContext);
const buttonRef: ButtonRef = React.useRef(null);

const index = useDescendant(
Expand Down Expand Up @@ -569,9 +569,8 @@ const AccordionPanel = React.forwardRef(function AccordionPanel(
{ as: Comp = "div", children, ...props },
forwardedRef
) {
const { disabled, panelId, buttonId, state } = React.useContext(
AccordionItemContext
);
const { disabled, panelId, buttonId, state } =
React.useContext(AccordionItemContext);

return (
<Comp
Expand Down
58 changes: 58 additions & 0 deletions packages/alert-dialog/__tests__/alert-dialog-axe.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import * as React from "react";
import { axe } from "jest-axe";
import { render, fireEvent, act } from "$test/utils";
import { AxeResults } from "$test/types";
import {
AlertDialog,
AlertDialogLabel,
AlertDialogDescription,
} from "@reach/alert-dialog";

describe("<AlertDialog /> with axe", () => {
it("Should not have ARIA violations", async () => {
jest.useRealTimers();
let { container, getByText, getByTestId } = render(<BasicAlertDialog />);
let results: AxeResults = null as any;
await act(async () => {
results = await axe(container);
});
expect(results).toHaveNoViolations();

let newResults: AxeResults = null as any;
act(() => void fireEvent.click(getByText("Show Dialog")));
await act(async () => {
newResults = await axe(getByTestId("dialog"));
});
expect(newResults).toHaveNoViolations();
});
});

////////////////////////////////////////////////////////////////////////////////

function BasicAlertDialog() {
const close = React.useRef(null);
const [showDialog, setShowDialog] = React.useState(false);
return (
<div>
<button onClick={() => setShowDialog(true)}>Show Dialog</button>
{showDialog && (
<AlertDialog
leastDestructiveRef={close}
data-testid="dialog"
id="great-work"
>
<AlertDialogLabel>Confirmation!</AlertDialogLabel>
<AlertDialogDescription>
Are you sure you want to have that milkshake?
</AlertDialogDescription>
<p>
<button>Do nothing here</button>{" "}
<button ref={close} onClick={() => setShowDialog(false)}>
Cancel
</button>
</p>
</AlertDialog>
)}
</div>
);
}
Loading