11import PropTypes from 'prop-types' ;
22import { mouseEvents , touchEvents , keyboardEvents } from 'make-event-props' ;
3+ import { PDFDataRangeTransport } from 'pdfjs-dist' ;
34
45import { isDefined } from './utils' ;
56
@@ -15,13 +16,34 @@ export const eventProps = (() => {
1516 return result ;
1617} ) ( ) ;
1718
19+ const isTypedArray = PropTypes . oneOfType ( [
20+ PropTypes . instanceOf ( Int8Array ) ,
21+ PropTypes . instanceOf ( Uint8Array ) ,
22+ PropTypes . instanceOf ( Uint8ClampedArray ) ,
23+ PropTypes . instanceOf ( Int16Array ) ,
24+ PropTypes . instanceOf ( Uint16Array ) ,
25+ PropTypes . instanceOf ( Int32Array ) ,
26+ PropTypes . instanceOf ( Uint32Array ) ,
27+ PropTypes . instanceOf ( Float32Array ) ,
28+ PropTypes . instanceOf ( Float64Array ) ,
29+ ] ) ;
30+
1831const fileTypes = [
1932 PropTypes . string ,
2033 PropTypes . instanceOf ( ArrayBuffer ) ,
2134 PropTypes . shape ( {
22- data : PropTypes . oneOfType ( [ PropTypes . object , PropTypes . string ] ) ,
23- range : PropTypes . object ,
24- url : PropTypes . string ,
35+ data : PropTypes . oneOfType ( [
36+ PropTypes . string ,
37+ PropTypes . instanceOf ( ArrayBuffer ) ,
38+ PropTypes . arrayOf ( PropTypes . number . isRequired ) ,
39+ isTypedArray ,
40+ ] ) . isRequired ,
41+ } ) ,
42+ PropTypes . shape ( {
43+ range : PropTypes . instanceOf ( PDFDataRangeTransport ) . isRequired ,
44+ } ) ,
45+ PropTypes . shape ( {
46+ url : PropTypes . string . isRequired ,
2547 } ) ,
2648] ;
2749if ( typeof Blob !== 'undefined' ) {
0 commit comments