Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
chaance committed Jun 28, 2021
2 parents 18b182e + 37315e7 commit ff26041
Show file tree
Hide file tree
Showing 224 changed files with 7,433 additions and 6,351 deletions.
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
4 changes: 2 additions & 2 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ function Example() {
}

// Assign the name to the example and then export it as a named constant
Example.story = { name };
export const Comp = Example;
Example.storyName = name;
export const Basic = Example;

// Default export an object with the title matching the name of the Reach package
export default { title: "Dialog" };
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
3 changes: 2 additions & 1 deletion .storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ const alias = packages.reduce((memo, pkg) => {
}, {});

module.exports = {
// stories: ["../packages/**/examples/*.example.(js|ts|tsx)"],
stories: ["../packages/**/*/*.example.@(js|ts|tsx)"],
addons: [
"@storybook/addon-actions/register",
"@storybook/addon-docs/register",
"@storybook/addon-links/register",
"@storybook/addon-postcss",
],
webpackFinal: async (config) => {
config.resolve = {
Expand Down
31 changes: 0 additions & 31 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -1,32 +1 @@
import { configure } from "@storybook/react";
import "./styles.css";

configure(() => {
const req = require.context(
"../packages",
true,
/^((?!node_modules).)*\.example\.(js|ts|tsx)$/
);

let allExports = {};
for (let pathToExample of req.keys()) {
let { Comp, default: defaultExport } = req(pathToExample);

if (!Comp || !defaultExport) {
continue;
}

let { name } = Comp.story;
let { title } = defaultExport;

allExports[title] = {
...(allExports[title] || {}),
default: { title },
[name]: Comp,
};
}

return Object.keys(allExports).reduce((prev, cur) => {
return [...prev, allExports[cur]];
}, []);
}, module);
4 changes: 0 additions & 4 deletions .storybook/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ body {
Ubuntu, Cantarell, Helvetica Neue, sans-serif;
}

:focus:not(:focus-visible) {
outline: none;
}

* {
box-sizing: border-box;
}
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ function Example() {
}

// Assign the name to the example and then export it as a named constant
Example.story = { name };
export const Comp = Example;
Example.storyName = name;
export const Basic = Example;

// Default export an object with the title matching the name of the Reach package
export default { title: "Dialog" };
Expand Down
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
117 changes: 58 additions & 59 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,70 +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.0.28",
"@storybook/addon-docs": "^6.0.28",
"@storybook/addon-links": "^6.0.28",
"@storybook/addons": "^6.0.28",
"@storybook/react": "^6.0.28",
"@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",
"@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.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",
"prettier": "^2.0.5",
"pretty-quick": "^3.0.0",
"match-sorter": "^6.3.0",
"postcss": "^8.3.5",
"postcss-preset-env": "^6.7.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 @@ -96,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
7 changes: 3 additions & 4 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 All @@ -96,6 +95,6 @@ const AnimatedPanel = React.forwardRef(({ children }, forwardedRef) => {
);
});

Example.story = { name };
export const Comp = Example;
Example.storyName = name;
export const Animated = Example;
export default { title: "Accordion" };
4 changes: 2 additions & 2 deletions packages/accordion/examples/basic.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ function Example() {
);
}

Example.story = { name };
export const Comp = Example;
Example.storyName = name;
export const Basic = Example;
export default { title: "Accordion" };

////////////////////////////////////////////////////////////////////////////////
Expand Down
4 changes: 2 additions & 2 deletions packages/accordion/examples/collapsible.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,6 @@ function Example() {
);
}

Example.story = { name };
export const Comp = Example;
Example.storyName = name;
export const Collapsible = Example;
export default { title: "Accordion" };
4 changes: 2 additions & 2 deletions packages/accordion/examples/controlled.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,6 @@ function Example() {
);
}

Example.story = { name };
export const Comp = Example;
Example.storyName = name;
export const Controlled = Example;
export default { title: "Accordion" };
Loading

0 comments on commit ff26041

Please sign in to comment.