1- import _objectWithoutProperties from "/Users/hlthi/WebstormProjects/react-element-based-device-dedector/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties" ;
2- import _classCallCheck from "/Users/hlthi/WebstormProjects/react-element-based-device-dedector/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/classCallCheck" ;
3- import _createClass from "/Users/hlthi/WebstormProjects/react-element-based-device-dedector/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/createClass" ;
4- import _possibleConstructorReturn from "/Users/hlthi/WebstormProjects/react-element-based-device-dedector/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn" ;
5- import _getPrototypeOf from "/Users/hlthi/WebstormProjects/react-element-based-device-dedector/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/getPrototypeOf" ;
6- import _inherits from "/Users/hlthi/WebstormProjects/react-element-based-device-dedector/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/inherits" ;
7- import React , { PureComponent } from 'react' ;
8- import ReactResizeDetector from 'react-resize-detector' ;
1+ "use strict" ;
2+
3+ Object . defineProperty ( exports , "__esModule" , {
4+ value : true
5+ } ) ;
6+ exports . default = void 0 ;
7+
8+ var _react = _interopRequireWildcard ( require ( "react" ) ) ;
9+
10+ var _propTypes = _interopRequireDefault ( require ( "prop-types" ) ) ;
11+
12+ var _reactResizeDetector = _interopRequireDefault ( require ( "react-resize-detector" ) ) ;
13+
14+ function _interopRequireDefault ( obj ) { return obj && obj . __esModule ? obj : { default : obj } ; }
15+
16+ function _interopRequireWildcard ( obj ) { if ( obj && obj . __esModule ) { return obj ; } else { var newObj = { } ; if ( obj != null ) { for ( var key in obj ) { if ( Object . prototype . hasOwnProperty . call ( obj , key ) ) { var desc = Object . defineProperty && Object . getOwnPropertyDescriptor ? Object . getOwnPropertyDescriptor ( obj , key ) : { } ; if ( desc . get || desc . set ) { Object . defineProperty ( newObj , key , desc ) ; } else { newObj [ key ] = obj [ key ] ; } } } } newObj . default = obj ; return newObj ; } }
17+
18+ function _typeof ( obj ) { if ( typeof Symbol === "function" && typeof Symbol . iterator === "symbol" ) { _typeof = function _typeof ( obj ) { return typeof obj ; } ; } else { _typeof = function _typeof ( obj ) { return obj && typeof Symbol === "function" && obj . constructor === Symbol && obj !== Symbol . prototype ? "symbol" : typeof obj ; } ; } return _typeof ( obj ) ; }
19+
20+ function _extends ( ) { _extends = Object . assign || function ( target ) { for ( var i = 1 ; i < arguments . length ; i ++ ) { var source = arguments [ i ] ; for ( var key in source ) { if ( Object . prototype . hasOwnProperty . call ( source , key ) ) { target [ key ] = source [ key ] ; } } } return target ; } ; return _extends . apply ( this , arguments ) ; }
21+
22+ function _objectWithoutProperties ( source , excluded ) { if ( source == null ) return { } ; var target = _objectWithoutPropertiesLoose ( source , excluded ) ; var key , i ; if ( Object . getOwnPropertySymbols ) { var sourceSymbolKeys = Object . getOwnPropertySymbols ( source ) ; for ( i = 0 ; i < sourceSymbolKeys . length ; i ++ ) { key = sourceSymbolKeys [ i ] ; if ( excluded . indexOf ( key ) >= 0 ) continue ; if ( ! Object . prototype . propertyIsEnumerable . call ( source , key ) ) continue ; target [ key ] = source [ key ] ; } } return target ; }
23+
24+ function _objectWithoutPropertiesLoose ( source , excluded ) { if ( source == null ) return { } ; var target = { } ; var sourceKeys = Object . keys ( source ) ; var key , i ; for ( i = 0 ; i < sourceKeys . length ; i ++ ) { key = sourceKeys [ i ] ; if ( excluded . indexOf ( key ) >= 0 ) continue ; target [ key ] = source [ key ] ; } return target ; }
25+
26+ function _classCallCheck ( instance , Constructor ) { if ( ! ( instance instanceof Constructor ) ) { throw new TypeError ( "Cannot call a class as a function" ) ; } }
27+
28+ function _defineProperties ( target , props ) { for ( var i = 0 ; i < props . length ; i ++ ) { var descriptor = props [ i ] ; descriptor . enumerable = descriptor . enumerable || false ; descriptor . configurable = true ; if ( "value" in descriptor ) descriptor . writable = true ; Object . defineProperty ( target , descriptor . key , descriptor ) ; } }
29+
30+ function _createClass ( Constructor , protoProps , staticProps ) { if ( protoProps ) _defineProperties ( Constructor . prototype , protoProps ) ; if ( staticProps ) _defineProperties ( Constructor , staticProps ) ; return Constructor ; }
31+
32+ function _possibleConstructorReturn ( self , call ) { if ( call && ( _typeof ( call ) === "object" || typeof call === "function" ) ) { return call ; } return _assertThisInitialized ( self ) ; }
33+
34+ function _getPrototypeOf ( o ) { _getPrototypeOf = Object . setPrototypeOf ? Object . getPrototypeOf : function _getPrototypeOf ( o ) { return o . __proto__ || Object . getPrototypeOf ( o ) ; } ; return _getPrototypeOf ( o ) ; }
35+
36+ function _inherits ( subClass , superClass ) { if ( typeof superClass !== "function" && superClass !== null ) { throw new TypeError ( "Super expression must either be null or a function" ) ; } subClass . prototype = Object . create ( superClass && superClass . prototype , { constructor : { value : subClass , writable : true , configurable : true } } ) ; if ( superClass ) _setPrototypeOf ( subClass , superClass ) ; }
37+
38+ function _setPrototypeOf ( o , p ) { _setPrototypeOf = Object . setPrototypeOf || function _setPrototypeOf ( o , p ) { o . __proto__ = p ; return o ; } ; return _setPrototypeOf ( o , p ) ; }
39+
40+ function _assertThisInitialized ( self ) { if ( self === void 0 ) { throw new ReferenceError ( "this hasn't been initialised - super() hasn't been called" ) ; } return self ; }
41+
42+ function _defineProperty ( obj , key , value ) { if ( key in obj ) { Object . defineProperty ( obj , key , { value : value , enumerable : true , configurable : true , writable : true } ) ; } else { obj [ key ] = value ; } return obj ; }
43+
944/**
1045 * https://usehooks.com/
1146 */
12-
1347var ElementBasedDeviceDedector =
1448/*#__PURE__*/
1549function ( _PureComponent ) {
@@ -22,11 +56,11 @@ function (_PureComponent) {
2256
2357 _this = _possibleConstructorReturn ( this , _getPrototypeOf ( ElementBasedDeviceDedector ) . call ( this , props ) ) ;
2458
25- _this . onResize = function ( width ) {
59+ _defineProperty ( _assertThisInitialized ( _assertThisInitialized ( _this ) ) , "onResize" , function ( width ) {
2660 _this . dedectDeviceType ( width ) ;
27- } ;
61+ } ) ;
2862
29- _this . dedectDeviceType = function ( width ) {
63+ _defineProperty ( _assertThisInitialized ( _assertThisInitialized ( _this ) ) , "dedectDeviceType" , function ( width ) {
3064 var _this$props = _this . props ,
3165 onChangeType = _this$props . onChangeType ,
3266 _devices = _this$props . devices ; // sort descending devices by breakpoint px
@@ -48,7 +82,7 @@ function (_PureComponent) {
4882 break ;
4983 }
5084 }
51- } ;
85+ } ) ;
5286
5387 _this . lastType = null ;
5488 return _this ;
@@ -61,16 +95,23 @@ function (_PureComponent) {
6195 devices = _this$props2 . devices ,
6296 otherProps = _objectWithoutProperties ( _this$props2 , [ "devices" ] ) ;
6397
64- return React . createElement ( ReactResizeDetector , Object . assign ( {
98+ return _react . default . createElement ( _reactResizeDetector . default , _extends ( {
6599 handleWidth : true ,
66100 onResize : this . onResize
67101 } , otherProps ) ) ;
68102 }
69103 } ] ) ;
70104
71105 return ElementBasedDeviceDedector ;
72- } ( PureComponent ) ;
106+ } ( _react . PureComponent ) ;
73107
108+ ElementBasedDeviceDedector . propTypes = {
109+ onChangeType : _propTypes . default . func . isRequired ,
110+ devices : _propTypes . default . arrayOf ( _propTypes . default . shape ( {
111+ name : _propTypes . default . string ,
112+ breakpointPx : _propTypes . default . number
113+ } ) )
114+ } ;
74115ElementBasedDeviceDedector . defaultProps = {
75116 devices : [ // below 768px
76117 {
@@ -86,4 +127,5 @@ ElementBasedDeviceDedector.defaultProps = {
86127 breakpointPx : 1200
87128 } ]
88129} ;
89- export default ElementBasedDeviceDedector ;
130+ var _default = ElementBasedDeviceDedector ;
131+ exports . default = _default ;
0 commit comments