Skip to content

Commit da639f7

Browse files
authored
Merge pull request #19 from openscript/develop
Upgrade storybook to version 6 and enhance exports
2 parents fbe9a3a + 2f19734 commit da639f7

File tree

10 files changed

+1496
-1818
lines changed

10 files changed

+1496
-1818
lines changed

.storybook/manager.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ import { addons } from '@storybook/addons';
22
import theme from './theme';
33

44
addons.setConfig({
5-
theme: theme,
5+
theme: theme
66
});

.storybook/preview.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const parameters = {
2+
viewMode: 'docs'
3+
}

.storybook/theme.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ export default create({
44
base: 'light',
55

66
brandTitle: 'React DSV Import',
7-
brandUrl: 'https://github.com/openscript/react-dsv-import',
7+
brandUrl: 'https://github.com/openscript/react-dsv-import'
88
});

docs/start.stories.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Meta, Description } from '@storybook/addon-docs/blocks';
22
import Readme from '../README.md';
33

4-
<Meta title="Start" />
4+
<Meta title="Start" parameters={{ previewTabs: { canvas: { hidden: true }}}} />
55

66
<Description markdown={Readme} />

package.json

+28-28
Original file line numberDiff line numberDiff line change
@@ -7,47 +7,47 @@
77
"react"
88
],
99
"homepage": "https://openscript.github.io/react-dsv-import/",
10-
"version": "0.3.5",
10+
"version": "0.3.6",
1111
"main": "dist/index.js",
1212
"module": "dist/es/index.js",
1313
"types": "dist/index.d.ts",
1414
"devDependencies": {
15-
"@babel/core": "^7.10.5",
16-
"@emotion/core": "^10.0.28",
15+
"@babel/core": "^7.11.6",
16+
"@emotion/core": "^10.0.35",
1717
"@emotion/styled": "^10.0.27",
18-
"@rollup/plugin-typescript": "^5.0.2",
19-
"@storybook/addon-actions": "^6.0.0-rc.5",
20-
"@storybook/addon-docs": "^6.0.0-rc.5",
21-
"@storybook/addon-links": "^6.0.0-rc.5",
22-
"@storybook/addon-storysource": "^6.0.0-rc.5",
23-
"@storybook/addons": "^6.0.0-rc.5",
24-
"@storybook/react": "^6.0.0-rc.5",
25-
"@testing-library/jest-dom": "^5.11.1",
26-
"@testing-library/react": "^10.4.7",
27-
"@testing-library/react-hooks": "^3.3.0",
28-
"@types/jest": "^26.0.4",
29-
"@types/node": "^14.0.23",
30-
"@types/react": "^16.9.43",
18+
"@rollup/plugin-typescript": "^6.0.0",
19+
"@storybook/addon-actions": "^6.0.21",
20+
"@storybook/addon-docs": "^6.0.21",
21+
"@storybook/addon-links": "^6.0.21",
22+
"@storybook/addon-storysource": "^6.0.21",
23+
"@storybook/addons": "^6.0.21",
24+
"@storybook/react": "^6.0.21",
25+
"@testing-library/jest-dom": "^5.11.4",
26+
"@testing-library/react": "^11.0.3",
27+
"@testing-library/react-hooks": "^3.4.1",
28+
"@types/jest": "^26.0.13",
29+
"@types/node": "^14.10.1",
30+
"@types/react": "^16.9.49",
3131
"@types/react-dom": "^16.9.8",
32-
"@typescript-eslint/eslint-plugin": "^3.6.1",
33-
"@typescript-eslint/parser": "^3.6.1",
32+
"@typescript-eslint/eslint-plugin": "^4.1.0",
33+
"@typescript-eslint/parser": "^4.1.0",
3434
"babel-loader": "^8.1.0",
3535
"babel-preset-react-app": "^9.1.2",
36-
"eslint": "^7.4.0",
36+
"eslint": "^7.9.0",
3737
"eslint-config-prettier": "^6.11.0",
3838
"eslint-plugin-prettier": "^3.1.4",
39-
"eslint-plugin-react": "^7.20.3",
40-
"jest": "^26.1.0",
41-
"prettier": "^2.0.5",
39+
"eslint-plugin-react": "^7.20.6",
40+
"jest": "^26.4.2",
41+
"prettier": "^2.1.1",
4242
"react-docgen": "^5.3.0",
4343
"react-is": "^16.13.1",
4444
"react-test-renderer": "^16.13.1",
45-
"rollup": "^2.21.0",
46-
"ts-jest": "^26.1.2",
47-
"ts-loader": "^8.0.1",
48-
"ts-node": "^8.10.2",
49-
"tslib": "^2.0.0",
50-
"typescript": "^3.9.6"
45+
"rollup": "^2.26.11",
46+
"ts-jest": "^26.3.0",
47+
"ts-loader": "^8.0.3",
48+
"ts-node": "^9.0.0",
49+
"tslib": "^2.0.1",
50+
"typescript": "^4.0.2"
5151
},
5252
"scripts": {
5353
"build": "yarn build:rollup",

src/DSVImport.stories.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export const BasicUsage = () => {
2828
</DSVImport>
2929
);
3030
};
31-
BasicUsage.story = { name: 'Basic usage', parameters: { docs: { storyDescription: 'Hello' } } };
31+
BasicUsage.story = { name: 'Basic usage' };
3232

3333
export const UsingOnChangeCallback = () => {
3434
const columns: ColumnType<BasicType>[] = [

src/DSVImport.tsx

+6-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import { createValidatorMiddleware } from './middlewares/validatorMiddleware';
88
import { ValidationError } from './models/validation';
99
import { createTransformerMiddleware } from './middlewares/transformerMiddleware';
1010
import { Transformer } from './models/transformer';
11+
import { TextareaInput } from './components/inputs/TextareaInput';
12+
import { TablePreview } from './components/previews/TablePreview';
1113

1214
interface EventListenerProps<T> {
1315
onChange?: (value: T[]) => void;
@@ -52,7 +54,7 @@ export type Props<T> = {
5254
};
5355

5456
/**
55-
* Hello
57+
* This is the main component, which creates a context for it's children. All children can access the information of the `DSVImport`.
5658
*/
5759
export function DSVImport<T extends GenericColumnType>(props: PropsWithChildren<Props<T>>) {
5860
const DSVImportContext = getDSVImportContext<T>();
@@ -73,3 +75,6 @@ export function DSVImport<T extends GenericColumnType>(props: PropsWithChildren<
7375
</DSVImportContext.Provider>
7476
);
7577
}
78+
79+
DSVImport.TextareaInput = TextareaInput;
80+
DSVImport.TablePreview = TablePreview;

src/index.tsx

+1-13
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,4 @@
1-
import { PropsWithChildren } from 'react';
2-
import { DSVImport as Import, Props } from './DSVImport';
3-
import { GenericColumnType } from './models/column';
4-
import { TextareaInput } from './components/inputs/TextareaInput';
5-
import { TablePreview } from './components/previews/TablePreview';
6-
7-
export function DSVImport<T extends GenericColumnType>(props: PropsWithChildren<Props<T>>) {
8-
return Import<T>(props);
9-
}
10-
11-
DSVImport.TextareaInput = TextareaInput;
12-
DSVImport.TablePreview = TablePreview;
13-
1+
export { DSVImport } from './DSVImport';
142
export { ColumnType, GenericColumnType } from './models/column';
153
export { useDSVImport } from './features/context';
164
export { Rule } from './models/rule';

src/models/middleware.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { State } from "./state";
2-
import { Dispatch } from "react";
1+
import { State } from './state';
2+
import { Dispatch } from 'react';
33

44
export type Middleware<T, A> = (state: State<T>, dispatch: Dispatch<A>, action: A) => void;

0 commit comments

Comments
 (0)