Skip to content

Commit

Permalink
feat: add strict prop for file type validation
Browse files Browse the repository at this point in the history
  • Loading branch information
nzambello committed Feb 23, 2021
1 parent 507f90f commit 42078e5
Show file tree
Hide file tree
Showing 40 changed files with 82 additions and 17 deletions.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[*]
indent_style = space
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8

[{*.css,*.scss}]
indent_size = 4

[{*.js,*.json}]
indent_size = 2
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ ReactDOM.render(<App />, document.getElementById('root'))
| inputStyle | object | `{}` | Some style to be applied to the `<input>` element. |
| fileEncoding | string | `UTF-8` | Encoding type of the input file. |
| disabled | boolean | `false` | Set input disabled attribute. |
| strict | boolean | `false` | Throws error on `onError` if file type is different from `accept`. |

### onFileLoaded

Expand Down
1 change: 1 addition & 0 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export interface CSVReaderProps {
onFileLoaded: (data: Array<any>, fileInfo: IFileInfo) => any;
parserOptions?: PapaParse.ParseConfig;
disabled?: boolean;
strict?: boolean;
}
declare const CSVReader: React.FC<CSVReaderProps>;
export default CSVReader;
4 changes: 2 additions & 2 deletions dist/react-csv-reader.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/react-csv-reader.js.map

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/404.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="ie=edge"/><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/><style data-href="/react-csv-reader/styles.2543ff947a193d7f33b1.css">@import url(https://fonts.googleapis.com/css?family=Inconsolata&display=swap);@import url(https://fonts.googleapis.com/css?family=Source+Sans+Pro&display=swap);</style><meta name="generator" content="Gatsby 2.24.47"/><title data-rh="true"></title><link as="script" rel="preload" href="/react-csv-reader/webpack-runtime-67c59502f5b1a0d64647.js"/><link as="script" rel="preload" href="/react-csv-reader/framework-b78375d5ac8251e457fa.js"/><link as="script" rel="preload" href="/react-csv-reader/styles-2c77e34bdfc18dfe38bd.js"/><link as="script" rel="preload" href="/react-csv-reader/app-2f9bfb7e1140136961fc.js"/><link as="script" rel="preload" href="/react-csv-reader/component---src-pages-404-js-db753cdb2043952b245a.js"/><link as="fetch" rel="preload" href="/react-csv-reader/page-data/404.html/page-data.json" crossorigin="anonymous"/><link as="fetch" rel="preload" href="/react-csv-reader/page-data/app-data.json" crossorigin="anonymous"/></head><body><div id="___gatsby"><div style="outline:none" tabindex="-1" id="gatsby-focus-wrapper"><div style="display:flex;align-items:center;justify-content:center;height:100vh;width:100vw;font-size:32px">Not Found</div></div><div id="gatsby-announcer" style="position:absolute;top:0;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border:0" aria-live="assertive" aria-atomic="true"></div></div><script id="gatsby-script-loader">/*<![CDATA[*/window.pagePath="/404.html";/*]]>*/</script><script id="gatsby-chunk-mapping">/*<![CDATA[*/window.___chunkMapping={"polyfill":["/polyfill-e9d1aeba5f5365d2e706.js"],"app":["/app-2f9bfb7e1140136961fc.js"],"component---docz-index-mdx":["/component---docz-index-mdx-473152bc17ab119d2de3.js"],"component---docz-usage-mdx":["/component---docz-usage-mdx-1eb92be2297b0483f484.js"],"component---src-pages-404-js":["/component---src-pages-404-js-db753cdb2043952b245a.js"]};/*]]>*/</script><script src="/react-csv-reader/polyfill-e9d1aeba5f5365d2e706.js" nomodule=""></script><script src="/react-csv-reader/component---src-pages-404-js-db753cdb2043952b245a.js" async=""></script><script src="/react-csv-reader/app-2f9bfb7e1140136961fc.js" async=""></script><script src="/react-csv-reader/styles-2c77e34bdfc18dfe38bd.js" async=""></script><script src="/react-csv-reader/framework-b78375d5ac8251e457fa.js" async=""></script><script src="/react-csv-reader/webpack-runtime-67c59502f5b1a0d64647.js" async=""></script></body></html>
<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="ie=edge"/><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/><style data-href="/react-csv-reader/styles.2543ff947a193d7f33b1.css">@import url(https://fonts.googleapis.com/css?family=Inconsolata&display=swap);@import url(https://fonts.googleapis.com/css?family=Source+Sans+Pro&display=swap);</style><meta name="generator" content="Gatsby 2.24.47"/><title data-rh="true"></title><link as="script" rel="preload" href="/react-csv-reader/webpack-runtime-714cf9e7272c81dbd362.js"/><link as="script" rel="preload" href="/react-csv-reader/framework-b78375d5ac8251e457fa.js"/><link as="script" rel="preload" href="/react-csv-reader/styles-2c77e34bdfc18dfe38bd.js"/><link as="script" rel="preload" href="/react-csv-reader/app-34e6cffcaad7f6d50834.js"/><link as="script" rel="preload" href="/react-csv-reader/component---src-pages-404-js-db753cdb2043952b245a.js"/><link as="fetch" rel="preload" href="/react-csv-reader/page-data/404.html/page-data.json" crossorigin="anonymous"/><link as="fetch" rel="preload" href="/react-csv-reader/page-data/app-data.json" crossorigin="anonymous"/></head><body><div id="___gatsby"><div style="outline:none" tabindex="-1" id="gatsby-focus-wrapper"><div style="display:flex;align-items:center;justify-content:center;height:100vh;width:100vw;font-size:32px">Not Found</div></div><div id="gatsby-announcer" style="position:absolute;top:0;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border:0" aria-live="assertive" aria-atomic="true"></div></div><script id="gatsby-script-loader">/*<![CDATA[*/window.pagePath="/404.html";/*]]>*/</script><script id="gatsby-chunk-mapping">/*<![CDATA[*/window.___chunkMapping={"polyfill":["/polyfill-e9d1aeba5f5365d2e706.js"],"app":["/app-34e6cffcaad7f6d50834.js"],"component---docz-index-mdx":["/component---docz-index-mdx-473152bc17ab119d2de3.js"],"component---docz-usage-mdx":["/component---docz-usage-mdx-1eb92be2297b0483f484.js"],"component---src-pages-404-js":["/component---src-pages-404-js-db753cdb2043952b245a.js"]};/*]]>*/</script><script src="/react-csv-reader/polyfill-e9d1aeba5f5365d2e706.js" nomodule=""></script><script src="/react-csv-reader/component---src-pages-404-js-db753cdb2043952b245a.js" async=""></script><script src="/react-csv-reader/app-34e6cffcaad7f6d50834.js" async=""></script><script src="/react-csv-reader/styles-2c77e34bdfc18dfe38bd.js" async=""></script><script src="/react-csv-reader/framework-b78375d5ac8251e457fa.js" async=""></script><script src="/react-csv-reader/webpack-runtime-714cf9e7272c81dbd362.js" async=""></script></body></html>
2 changes: 1 addition & 1 deletion docs/404/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="ie=edge"/><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/><style data-href="/react-csv-reader/styles.2543ff947a193d7f33b1.css">@import url(https://fonts.googleapis.com/css?family=Inconsolata&display=swap);@import url(https://fonts.googleapis.com/css?family=Source+Sans+Pro&display=swap);</style><meta name="generator" content="Gatsby 2.24.47"/><title data-rh="true"></title><link as="script" rel="preload" href="/react-csv-reader/webpack-runtime-67c59502f5b1a0d64647.js"/><link as="script" rel="preload" href="/react-csv-reader/framework-b78375d5ac8251e457fa.js"/><link as="script" rel="preload" href="/react-csv-reader/styles-2c77e34bdfc18dfe38bd.js"/><link as="script" rel="preload" href="/react-csv-reader/app-2f9bfb7e1140136961fc.js"/><link as="script" rel="preload" href="/react-csv-reader/component---src-pages-404-js-db753cdb2043952b245a.js"/><link as="fetch" rel="preload" href="/react-csv-reader/page-data/404/page-data.json" crossorigin="anonymous"/><link as="fetch" rel="preload" href="/react-csv-reader/page-data/app-data.json" crossorigin="anonymous"/></head><body><div id="___gatsby"><div style="outline:none" tabindex="-1" id="gatsby-focus-wrapper"><div style="display:flex;align-items:center;justify-content:center;height:100vh;width:100vw;font-size:32px">Not Found</div></div><div id="gatsby-announcer" style="position:absolute;top:0;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border:0" aria-live="assertive" aria-atomic="true"></div></div><script id="gatsby-script-loader">/*<![CDATA[*/window.pagePath="/404/";/*]]>*/</script><script id="gatsby-chunk-mapping">/*<![CDATA[*/window.___chunkMapping={"polyfill":["/polyfill-e9d1aeba5f5365d2e706.js"],"app":["/app-2f9bfb7e1140136961fc.js"],"component---docz-index-mdx":["/component---docz-index-mdx-473152bc17ab119d2de3.js"],"component---docz-usage-mdx":["/component---docz-usage-mdx-1eb92be2297b0483f484.js"],"component---src-pages-404-js":["/component---src-pages-404-js-db753cdb2043952b245a.js"]};/*]]>*/</script><script src="/react-csv-reader/polyfill-e9d1aeba5f5365d2e706.js" nomodule=""></script><script src="/react-csv-reader/component---src-pages-404-js-db753cdb2043952b245a.js" async=""></script><script src="/react-csv-reader/app-2f9bfb7e1140136961fc.js" async=""></script><script src="/react-csv-reader/styles-2c77e34bdfc18dfe38bd.js" async=""></script><script src="/react-csv-reader/framework-b78375d5ac8251e457fa.js" async=""></script><script src="/react-csv-reader/webpack-runtime-67c59502f5b1a0d64647.js" async=""></script></body></html>
<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="ie=edge"/><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/><style data-href="/react-csv-reader/styles.2543ff947a193d7f33b1.css">@import url(https://fonts.googleapis.com/css?family=Inconsolata&display=swap);@import url(https://fonts.googleapis.com/css?family=Source+Sans+Pro&display=swap);</style><meta name="generator" content="Gatsby 2.24.47"/><title data-rh="true"></title><link as="script" rel="preload" href="/react-csv-reader/webpack-runtime-714cf9e7272c81dbd362.js"/><link as="script" rel="preload" href="/react-csv-reader/framework-b78375d5ac8251e457fa.js"/><link as="script" rel="preload" href="/react-csv-reader/styles-2c77e34bdfc18dfe38bd.js"/><link as="script" rel="preload" href="/react-csv-reader/app-34e6cffcaad7f6d50834.js"/><link as="script" rel="preload" href="/react-csv-reader/component---src-pages-404-js-db753cdb2043952b245a.js"/><link as="fetch" rel="preload" href="/react-csv-reader/page-data/404/page-data.json" crossorigin="anonymous"/><link as="fetch" rel="preload" href="/react-csv-reader/page-data/app-data.json" crossorigin="anonymous"/></head><body><div id="___gatsby"><div style="outline:none" tabindex="-1" id="gatsby-focus-wrapper"><div style="display:flex;align-items:center;justify-content:center;height:100vh;width:100vw;font-size:32px">Not Found</div></div><div id="gatsby-announcer" style="position:absolute;top:0;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border:0" aria-live="assertive" aria-atomic="true"></div></div><script id="gatsby-script-loader">/*<![CDATA[*/window.pagePath="/404/";/*]]>*/</script><script id="gatsby-chunk-mapping">/*<![CDATA[*/window.___chunkMapping={"polyfill":["/polyfill-e9d1aeba5f5365d2e706.js"],"app":["/app-34e6cffcaad7f6d50834.js"],"component---docz-index-mdx":["/component---docz-index-mdx-473152bc17ab119d2de3.js"],"component---docz-usage-mdx":["/component---docz-usage-mdx-1eb92be2297b0483f484.js"],"component---src-pages-404-js":["/component---src-pages-404-js-db753cdb2043952b245a.js"]};/*]]>*/</script><script src="/react-csv-reader/polyfill-e9d1aeba5f5365d2e706.js" nomodule=""></script><script src="/react-csv-reader/component---src-pages-404-js-db753cdb2043952b245a.js" async=""></script><script src="/react-csv-reader/app-34e6cffcaad7f6d50834.js" async=""></script><script src="/react-csv-reader/styles-2c77e34bdfc18dfe38bd.js" async=""></script><script src="/react-csv-reader/framework-b78375d5ac8251e457fa.js" async=""></script><script src="/react-csv-reader/webpack-runtime-714cf9e7272c81dbd362.js" async=""></script></body></html>
2 changes: 2 additions & 0 deletions docs/app-34e6cffcaad7f6d50834.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/app-34e6cffcaad7f6d50834.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions docs/app-4db72b120c10b7b7aca6.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/app-4db72b120c10b7b7aca6.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions docs/app-5349113d739548149eda.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/app-5349113d739548149eda.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions docs/app-7a619b62bb16133d8c92.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/app-7a619b62bb16133d8c92.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions docs/app-8d7b95604e0b1f48a342.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/app-8d7b95604e0b1f48a342.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/chunk-map.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"polyfill":["/polyfill-e9d1aeba5f5365d2e706.js"],"app":["/app-2f9bfb7e1140136961fc.js"],"component---docz-index-mdx":["/component---docz-index-mdx-473152bc17ab119d2de3.js"],"component---docz-usage-mdx":["/component---docz-usage-mdx-1eb92be2297b0483f484.js"],"component---src-pages-404-js":["/component---src-pages-404-js-db753cdb2043952b245a.js"]}
{"polyfill":["/polyfill-e9d1aeba5f5365d2e706.js"],"app":["/app-34e6cffcaad7f6d50834.js"],"component---docz-index-mdx":["/component---docz-index-mdx-473152bc17ab119d2de3.js"],"component---docz-usage-mdx":["/component---docz-usage-mdx-1eb92be2297b0483f484.js"],"component---src-pages-404-js":["/component---src-pages-404-js-db753cdb2043952b245a.js"]}
2 changes: 2 additions & 0 deletions docs/component---docz-usage-mdx-5276e20c9807e3c1d63f.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions docs/component---docz-usage-mdx-74bb706b80ce9471bc9a.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 42078e5

Please sign in to comment.