Skip to content

Commit 129ed3c

Browse files
authored
Merge pull request #7 from PDFTron/next
0.1.0
2 parents 418ab95 + 5ec004a commit 129ed3c

File tree

145 files changed

+4136
-1227
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

145 files changed

+4136
-1227
lines changed

.env.example

Lines changed: 0 additions & 3 deletions
This file was deleted.

.eslintrc.js

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
module.exports = {
2+
parser: '@typescript-eslint/parser',
3+
parserOptions: { project: './tsconfig.lint.json' },
4+
plugins: ['react-hooks'],
5+
extends: [
6+
'plugin:jsx-a11y/recommended',
7+
'plugin:jest/recommended',
8+
'plugin:jest/style',
9+
'eslint:recommended',
10+
'plugin:react/recommended',
11+
'plugin:@typescript-eslint/eslint-recommended',
12+
'plugin:@typescript-eslint/recommended',
13+
14+
// Prettier overrides
15+
'prettier',
16+
'prettier/react',
17+
'prettier/@typescript-eslint',
18+
],
19+
settings: {
20+
react: {
21+
version: 'detect',
22+
},
23+
},
24+
env: {
25+
browser: true,
26+
es6: true,
27+
commonjs: true,
28+
node: true,
29+
jest: true,
30+
},
31+
rules: {
32+
// Off
33+
'react/prop-types': 'off',
34+
'react/display-name': 'off',
35+
'@typescript-eslint/explicit-function-return-type': 'off',
36+
'@typescript-eslint/no-var-requires': 'off',
37+
'@typescript-eslint/no-empty-interface': 'off',
38+
'@typescript-eslint/camelcase': 'off',
39+
'@typescript-eslint/no-triple-slash-reference': 'off',
40+
'@typescript-eslint/no-non-null-assertion': 'off',
41+
'@typescript-eslint/ban-ts-ignore': 'off',
42+
'@typescript-eslint/no-use-before-define': 'off',
43+
44+
// On.
45+
'prefer-const': 'error',
46+
'react-hooks/rules-of-hooks': 'error',
47+
'react-hooks/exhaustive-deps': 'error',
48+
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
49+
'@typescript-eslint/unbound-method': 'error',
50+
},
51+
};

.eslintrc.yaml

Lines changed: 0 additions & 42 deletions
This file was deleted.

.github/CODEOWNERS

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030

3131
# SCRIPT(Make): Make script and utilities.
3232
/scripts/make/ @liamross
33-
/scripts/utils/ @liamross
3433

3534
# SCRIPT(Sass): Sass AST parser and docs generator.
3635
/scripts/parse_scss.js @liamross

.storybook/preview.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,8 @@ addParameters({
5858

5959
// Since we do not add component description in code (instead inserting it
6060
// into a .md file) we extract it using the following.
61-
extractComponentDescription: (_c: unknown, { info }: { info: string | { info?: string; text?: string } }) => {
62-
if (typeof info === 'string') return info;
63-
if (info.info) return info.info;
64-
if (info.text) return info.text;
61+
extractComponentDescription: (_c: unknown, { readme }: { readme: string }) => {
62+
if (readme) return readme;
6563
return null;
6664
},
6765

CHANGELOG.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,82 @@
22

33
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
44

5+
## [0.1.0-beta.8](https://github.com/PDFTron/webviewer-react-toolkit/compare/v0.1.0-beta.7...v0.1.0-beta.8) (2020-02-19)
6+
7+
### ⚠ BREAKING CHANGES
8+
9+
- **Overlay:** removed blockClicks and darkOverlay from Overlay, will be moved into components that require these properties
10+
- **colors:** since color-blue-gray-4 was unused, shifted every color-blue-gray over so there is no longer a color-blue-gray-7, and every color above color-blue-gray-3 has been updated
11+
12+
### Features
13+
14+
- **ButtonGroup:** added button group for easy button layout ([9457c44](https://github.com/PDFTron/webviewer-react-toolkit/commit/9457c44242e6b8a92426cf3fbccd5ae3daa194a0))
15+
- **IconButton:** added icon button ([6fa450b](https://github.com/PDFTron/webviewer-react-toolkit/commit/6fa450be8d9242d8ce4656495bd930dec6382d7b))
16+
- **icons:** exposed single and multi page icons ([a45e459](https://github.com/PDFTron/webviewer-react-toolkit/commit/a45e459f542f566bceb747349d3df463740eb174))
17+
- **icons:** exposed some icons that are used internally ([0a35b58](https://github.com/PDFTron/webviewer-react-toolkit/commit/0a35b586ed437fb35cce32bae4cd479b647323ed))
18+
- **Modal:** added focus lock to modal to ensure user can't tab out ([7b005a8](https://github.com/PDFTron/webviewer-react-toolkit/commit/7b005a8741fe423e421d5ad32320bca0b574a436))
19+
- **Modal:** added modal component for displaying confirmations and info ([8a69e44](https://github.com/PDFTron/webviewer-react-toolkit/commit/8a69e44640e86701aeb271b39d4ed64188deefde))
20+
- **ToastProvider:** if added toast has timeout of 0 will not timeout ([c8c4f3c](https://github.com/PDFTron/webviewer-react-toolkit/commit/c8c4f3cdee1ecf8af5a5af1ba52866117302e00f))
21+
- **useUnmountDelay:** added hook for delayed unmounts, used in Modal ([1ef4338](https://github.com/PDFTron/webviewer-react-toolkit/commit/1ef433879b1cdac27cfad98ca8bc7602cd31fb94))
22+
23+
### Bug Fixes
24+
25+
- **Overlay:** no longer unmounts when first item removed ([52ae549](https://github.com/PDFTron/webviewer-react-toolkit/commit/52ae549d7b774b3eeea71275a98f3c82c6dc1245))
26+
27+
### Styles
28+
29+
- **colors:** removed unused color-blue-gray-4 ([89a4a5a](https://github.com/PDFTron/webviewer-react-toolkit/commit/89a4a5a65308b476c2c63bddec44523b8063df48))
30+
- **IconButton:** added padding to make button square given square icon ([39caaca](https://github.com/PDFTron/webviewer-react-toolkit/commit/39caacad795f8794d848ddc60e7cc45fe1b31a82))
31+
32+
## [0.1.0-beta.7](https://github.com/PDFTron/webviewer-react-toolkit/compare/v0.1.0-beta.6...v0.1.0-beta.7) (2020-02-13)
33+
34+
### ⚠ BREAKING CHANGES
35+
36+
- **padding:** padding-half renamed to padding-small, padding-small renamed to padding-medium
37+
- **breakpoints:** media queries do not work with CSS variables, so created new Sass file for breakpoints, and removed breakpoints from mixins file
38+
39+
### Features
40+
41+
- **FocusTrap:** added FocusTrap and useFocusTrap hook ([b691590](https://github.com/PDFTron/webviewer-react-toolkit/commit/b691590c3dc1a885eff81798ff66ce01932c6a41))
42+
- **Toast:** added the Toast visual component ([b7b5eb0](https://github.com/PDFTron/webviewer-react-toolkit/commit/b7b5eb090f1f0323de2736ef0cdb5d401b65f328))
43+
- **ToastProvider:** added toast provider to access toast management ([1452669](https://github.com/PDFTron/webviewer-react-toolkit/commit/1452669447f85c48a8ace9b50ae492c94e248fdd))
44+
- **useToast:** added hook for accessing adding and removal of toasts ([34b7e5d](https://github.com/PDFTron/webviewer-react-toolkit/commit/34b7e5d1b60bccaaf266d929e6b43a87fb9830ec))
45+
46+
### Bug Fixes
47+
48+
- **Button:** now works with svg icon children ([2c40b9d](https://github.com/PDFTron/webviewer-react-toolkit/commit/2c40b9d5dc0a78ca7b51bf0d3290c8fe887828c0))
49+
50+
### Styles
51+
52+
- **breakpoints:** moved breakpoints to own file, removed CSS variables ([39b1c4c](https://github.com/PDFTron/webviewer-react-toolkit/commit/39b1c4ce0d69003e76b8536cf180078917f8fe9c))
53+
- **font:** made webkit font smoothing auto instead of antialiased ([0b2dca7](https://github.com/PDFTron/webviewer-react-toolkit/commit/0b2dca7c2537ab872351e398330c27a9d09c9b7d))
54+
- **padding:** renamed paddings to be more obvious as to size ([bef4c39](https://github.com/PDFTron/webviewer-react-toolkit/commit/bef4c3949b5a200f0460c45accd16dc5a13192b5))
55+
- **Spinner:** references new spinner mixin for animation ([477cdc1](https://github.com/PDFTron/webviewer-react-toolkit/commit/477cdc1cf990cc7d7499ca9f6041d52e4c9478fa))
56+
57+
## [0.1.0-beta.6](https://github.com/PDFTron/webviewer-react-toolkit/compare/v0.1.0-beta.5...v0.1.0-beta.6) (2020-02-10)
58+
59+
### Refactors
60+
61+
- **Overlay:** correct memoization of props to avoid rerenders ([6e2879c](https://github.com/PDFTron/webviewer-react-toolkit/commit/6e2879cf82f4832e332c5d24fb487e28bce612ce))
62+
63+
## [0.1.0-beta.5](https://github.com/PDFTron/webviewer-react-toolkit/compare/v0.1.0-beta.4...v0.1.0-beta.5) (2020-02-10)
64+
65+
### ⚠ BREAKING CHANGES
66+
67+
- **css:** renamed tablet-lower-boundary to breakpoint-tablet, and desktop-lower-boundary to breakpoint-desktop
68+
69+
### Features
70+
71+
- **Overlay:** created component ([946772c](https://github.com/PDFTron/webviewer-react-toolkit/commit/946772c606f8b21c4fbb5dfc539074cee6c23c35))
72+
73+
### Bug Fixes
74+
75+
- **css:** breakpoints renamed to breakpoint-\<device\> ([e0aeafc](https://github.com/PDFTron/webviewer-react-toolkit/commit/e0aeafc72f5a34e74dea764e63c039f231026908))
76+
77+
### Styles
78+
79+
- **mixins:** use CSS variables in mixins instead of Sass variables ([4fbe555](https://github.com/PDFTron/webviewer-react-toolkit/commit/4fbe555dbb5f62b615dc89773b96516b31804f4d))
80+
581
## [0.1.0-beta.4](https://github.com/PDFTron/webviewer-react-toolkit/compare/v0.1.0-beta.3...v0.1.0-beta.4) (2020-02-06)
682

783
### ⚠ BREAKING CHANGES

package.json

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pdftron/webviewer-react-toolkit",
3-
"version": "0.1.0-beta.4",
3+
"version": "0.1.0-beta.8",
44
"description": "A React component library for integrating with PDFTron WebViewer API.",
55
"license": "SEE LICENSE IN LICENSE",
66
"repository": {
@@ -13,17 +13,16 @@
1313
"start": "start-storybook -s public -p 6006",
1414
"make": "ts-node scripts/make",
1515
"parse-scss": "node scripts/parse_scss",
16-
"lint": "eslint './src' --ext .js,.jsx,.ts,.tsx --cache",
17-
"build": "yarn clean && webpack --config webpack.config.ts && scripts/build_package.sh",
1816
"clean": "rm -rf dist & rm -rf lib",
17+
"build": "yarn clean && webpack --config webpack.config.ts && scripts/build_package.sh",
18+
"lint": "eslint './src' --ext .js,.jsx,.ts,.tsx --cache",
1919
"test": "jest ./src --config ./jest.config.js",
20+
"ci": "yarn lint && yarn test",
2021
"build-storybook": "build-storybook -s public",
2122
"deploy-storybook": "storybook-to-ghpages --out=.out",
2223
"commit": "commit",
23-
"release": "yarn build && standard-version && git push && git push --tags && yarn publish",
24-
"postrelease": "conventional-github-releaser --draft",
25-
"release-next": "yarn build && standard-version --prerelease beta && git push && git push --tags && yarn publish --tag next",
26-
"postrelease-next": "conventional-github-releaser --draft"
24+
"release": "yarn ci && yarn build && standard-version && git push --follow-tags && yarn publish --non-interactive && yarn deploy-storybook",
25+
"release-next": "yarn ci && yarn build && standard-version --prerelease beta && git push --follow-tags && yarn publish --non-interactive --tag next && yarn deploy-storybook"
2726
},
2827
"keywords": [
2928
"pdftron",
@@ -66,26 +65,26 @@
6665
"@commitlint/cli": "^8.3.5",
6766
"@commitlint/config-conventional": "^8.3.4",
6867
"@commitlint/prompt-cli": "^8.3.5",
69-
"@storybook/addon-actions": "6.0.0-alpha.3",
70-
"@storybook/addon-docs": "6.0.0-alpha.3",
71-
"@storybook/addon-google-analytics": "6.0.0-alpha.3",
72-
"@storybook/addon-info": "6.0.0-alpha.2",
73-
"@storybook/addon-knobs": "6.0.0-alpha.3",
74-
"@storybook/addon-links": "6.0.0-alpha.3",
75-
"@storybook/addon-viewport": "6.0.0-alpha.3",
76-
"@storybook/addons": "6.0.0-alpha.3",
68+
"@storybook/addon-actions": "^6.0.0-alpha.9",
69+
"@storybook/addon-docs": "^6.0.0-alpha.9",
70+
"@storybook/addon-google-analytics": "^6.0.0-alpha.9",
71+
"@storybook/addon-info": "^6.0.0-alpha.2",
72+
"@storybook/addon-knobs": "^6.0.0-alpha.9",
73+
"@storybook/addon-links": "^6.0.0-alpha.9",
74+
"@storybook/addon-viewport": "^6.0.0-alpha.9",
75+
"@storybook/addons": "^6.0.0-alpha.9",
7776
"@storybook/preset-typescript": "^1.2.0",
78-
"@storybook/react": "6.0.0-alpha.3",
77+
"@storybook/react": "^6.0.0-alpha.9",
7978
"@storybook/storybook-deployer": "^2.8.1",
8079
"@types/classnames": "^2.2.9",
8180
"@types/copy-webpack-plugin": "^5.0.0",
8281
"@types/enzyme": "^3.10.3",
83-
"@types/jest": "^24.0.23",
82+
"@types/jest": "^25.1.2",
8483
"@types/mini-css-extract-plugin": "^0.9.0",
8584
"@types/node": "^13.1.4",
8685
"@types/optimize-css-assets-webpack-plugin": "^5.0.1",
8786
"@types/react": "^16.9.17",
88-
"@types/react-dnd-multi-backend": "^4.0.1",
87+
"@types/react-dnd-multi-backend": "^5.0.0",
8988
"@types/react-dom": "^16.9.4",
9089
"@types/react-motion": "^0.0.29",
9190
"@types/react-virtualized-auto-sizer": "^1.0.0",
@@ -114,7 +113,7 @@
114113
"eslint-plugin-react-hooks": "^2.3.0",
115114
"file-loader": "^5.0.2",
116115
"husky": "^4.0.10",
117-
"jest": "^24.9.0",
116+
"jest": "^25.1.0",
118117
"jest-svg-transformer": "^1.0.0",
119118
"node-sass": "^4.13.0",
120119
"normalize.css": "^8.0.1",
@@ -131,7 +130,7 @@
131130
"sinon": "^8.1.0",
132131
"standard-version": "^7.1.0",
133132
"style-loader": "^1.0.1",
134-
"ts-jest": "^24.2.0",
133+
"ts-jest": "^25.2.0",
135134
"ts-loader": "^6.2.1",
136135
"ts-node": "^8.5.4",
137136
"tsconfig-paths-webpack-plugin": "^3.2.0",

scripts/make/file-content/component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ export interface ${componentName}Props extends ButtonHTMLAttributes<HTMLButtonEl
1414
someProp?: string;
1515
}
1616
17-
export const ${componentName}: FC<${componentName}Props> = ({ someProp = 'Default value', className, ...buttonProps }) => {
17+
export const ${componentName}: FC<${componentName}Props> = ({ someProp = 'Default value', className, ...props }) => {
1818
const ${pascalToCamel(componentName)}Class = classnames(
1919
'${STYLE_PREFIX}__base ${STYLE_PREFIX}__${pascalToCamel(componentName)}',
20-
{ '${STYLE_PREFIX}__${pascalToCamel(componentName)}--disabled': buttonProps.disabled },
20+
{ '${STYLE_PREFIX}__${pascalToCamel(componentName)}--disabled': props.disabled },
2121
className,
2222
);
2323
2424
return (
25-
<button {...buttonProps} className={${pascalToCamel(componentName)}Class}>
25+
<button {...props} className={${pascalToCamel(componentName)}Class}>
2626
{someProp}
2727
</button>
2828
);

scripts/make/file-content/componentRef.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ export interface ${componentName}Props extends ButtonHTMLAttributes<HTMLButtonEl
1515
}
1616
1717
export const ${componentName} = forwardRef<HTMLButtonElement, ${componentName}Props>(
18-
({ someProp = 'Default value', className, ...buttonProps }, ref) => {
18+
({ someProp = 'Default value', className, ...props }, ref) => {
1919
const ${pascalToCamel(componentName)}Class = classnames(
2020
'${STYLE_PREFIX}__base ${STYLE_PREFIX}__${pascalToCamel(componentName)}',
21-
{ '${STYLE_PREFIX}__${pascalToCamel(componentName)}--disabled': buttonProps.disabled },
21+
{ '${STYLE_PREFIX}__${pascalToCamel(componentName)}--disabled': props.disabled },
2222
className,
2323
);
2424
2525
return (
26-
<button {...buttonProps} className={${pascalToCamel(componentName)}Class} ref={ref}>
26+
<button {...props} className={${pascalToCamel(componentName)}Class} ref={ref}>
2727
{someProp}
2828
</button>
2929
);

scripts/make/file-content/componentStory.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ export const componentStory = (componentName: string) =>
33
import { boolean, text } from '@storybook/addon-knobs';
44
import React from 'react';
55
import { ${componentName} } from '../${componentName}';
6-
import info from './README.md';
6+
import readme from './README.md';
77
8-
export default { title: 'Components/${componentName}', component: ${componentName}, parameters: { info } };
8+
export default { title: 'Components/${componentName}', component: ${componentName}, parameters: { readme } };
99
1010
export const Basic = () => (
1111
<${componentName}

0 commit comments

Comments
 (0)