Skip to content

Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.

Static props (#11)

Adam Krebs995acadd37ad
diff --git a/src/components/common/checkbox.js b/src/components/common/checkbox.js
index cf4948ae4..75564dec6 100644
--- a/src/components/common/checkbox.js
+++ b/src/components/common/checkbox.js
@@ -18,38 +18,13 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import React from 'react';
+import React, {Component} from 'react';
import PropTypes from 'prop-types';
import styled from 'styled-components';
import pick from 'lodash.pick';
function noop() {}
-const propTypes = {
- id: PropTypes.string.isRequired,
- label: PropTypes.node,
- value: PropTypes.oneOf([true, false, 'indeterminate']),
- checked: PropTypes.bool,
- disabled: PropTypes.bool,
-
- error: PropTypes.string,
- switch: PropTypes.bool,
- activeColor: PropTypes.string,
- secondary: PropTypes.bool,
- onBlur: PropTypes.func,
- onChange: PropTypes.func,
- onFocus: PropTypes.func
-};
-
-const defaultProps = {
- disabled: false,
- checked: false,
- onBlur: noop,
- onChange: noop,
- onFocus: noop,
- label: ''
-};
-
const StyledSwitchInput = styled.label`
${props =>
props.secondary ? props.theme.secondarySwitch : props.theme.inputSwitch};
@@ -70,7 +45,32 @@ const StyledCheckbox = styled.div`
margin-left: ${props => props.theme.switchLabelMargin}px;
`;
-class Checkbox extends React.Component {
+export default class Checkbox extends Component {
+ static propTypes = {
+ id: PropTypes.string.isRequired,
+ label: PropTypes.node,
+ value: PropTypes.oneOf([true, false, 'indeterminate']),
+ checked: PropTypes.bool,
+ disabled: PropTypes.bool,
+
+ error: PropTypes.string,
+ switch: PropTypes.bool,
+ activeColor: PropTypes.string,
+ secondary: PropTypes.bool,
+ onBlur: PropTypes.func,
+ onChange: PropTypes.func,
+ onFocus: PropTypes.func
+ };
+
+ static defaultProps = {
+ disabled: false,
+ checked: false,
+ onBlur: noop,
+ onChange: noop,
+ onFocus: noop,
+ label: ''
+ };
+
state = {
focused: false
};
@@ -109,8 +109,3 @@ class Checkbox extends React.Component {
);
}
}
-
-Checkbox.propTypes = propTypes;
-Checkbox.defaultProps = defaultProps;
-
-export default Checkbox;
diff --git a/src/components/common/color-legend.js b/src/components/common/color-legend.js
index fbbbc3cd6..4cf0f1185 100644
--- a/src/components/common/color-legend.js
+++ b/src/components/common/color-legend.js
@@ -51,15 +51,6 @@ const StyledLegend = styled.div`
const defaultFormat = d => d;
-const propTypes = {
- width: PropTypes.number.isRequired,
- scaleType: PropTypes.string.isRequired,
- domain: PropTypes.oneOfType([PropTypes.array, PropTypes.object]).isRequired,
- fieldType: PropTypes.string,
- range: PropTypes.arrayOf(PropTypes.string),
- abelFormat: PropTypes.func
-};
-
const getTimeLabelFormat = domain => {
const formatter = getTimeWidgetHintFormatter(domain);
return val => moment.utc(val).format(formatter);
@@ -103,6 +94,15 @@ const getQuantLegends = (scale, labelFormat) => {
};
export default class ColorLegend extends Component {
+ static propTypes = {
+ width: PropTypes.number.isRequired,
+ scaleType: PropTypes.string.isRequired,
+ domain: PropTypes.oneOfType([PropTypes.array, PropTypes.object]).isRequired,
+ fieldType: PropTypes.string,
+ range: PropTypes.arrayOf(PropTypes.string),
+ labelFormat: PropTypes.func
+ };
+
domainSelector = props => props.domain;
rangeSelector = props => props.range;
labelFormatSelector = props => props.labelFormat;
@@ -169,5 +169,3 @@ const LegendRow = ({label = '', displayLabel, color, idx}) => (
</text>
</g>
);
-
-ColorLegend.propTypes = propTypes;
diff --git a/src/components/common/field-selector.js b/src/components/common/field-selector.js
index 9d06e97c1..267e8ee3b 100644
--- a/src/components/common/field-selector.js
+++ b/src/components/common/field-selector.js
@@ -44,37 +44,49 @@ const FieldListItemFactory = showToken => {
return FieldListItem;
};
-const propTypes = {
- fields: PropTypes.array.isRequired,
- onSelect: PropTypes.func.isRequired,
- placement: PropTypes.string,
- value: PropTypes.oneOfType([PropTypes.array, PropTypes.string]),
- filterFieldTypes: PropTypes.oneOfType([PropTypes.array, PropTypes.string]),
- inputTheme: PropTypes.string,
- erasable: PropTypes.bool,
- error: PropTypes.bool,
- multiSelect: PropTypes.bool,
- closeOnSelect: PropTypes.bool,
- showToken: PropTypes.bool,
- suggested: PropTypes.array
-};
-
-const defaultProps = {
- erasable: true,
- error: false,
- fields: [],
- onSelect: () => {},
- placement: 'bottom',
- value: null,
- multiSelect: false,
- closeOnSelect: true,
- showToken: true,
- placeholder: 'Select a field'
-};
-
const SuggestedFieldHeader = () => <div>Suggested Field</div>;
+const FieldType = PropTypes.oneOfType([
+ PropTypes.arrayOf(PropTypes.string),
+ PropTypes.string,
+ PropTypes.shape({
+ format: PropTypes.string,
+ id: PropTypes.string,
+ name: PropTypes.string,
+ tableFieldIndex: PropTypes.number,
+ type: PropTypes.number
+ })
+]);
+
export default class FieldSelector extends Component {
+ static propTypes = {
+ fields: PropTypes.arrayOf(FieldType).isRequired,
+ onSelect: PropTypes.func.isRequired,
+ placement: PropTypes.string,
+ value: FieldType,
+ filterFieldTypes: PropTypes.oneOfType([FieldType, PropTypes.arrayOf(FieldType)]),
+ inputTheme: PropTypes.string,
+ erasable: PropTypes.bool,
+ error: PropTypes.bool,
+ multiSelect: PropTypes.bool,
+ closeOnSelect: PropTypes.bool,
+ showToken: PropTypes.bool,
+ suggested: PropTypes.arrayOf(PropTypes.any)
+ };
+
+ static defaultProps = {
+ erasable: true,
+ error: false,
+ fields: [],
+ onSelect: () => {},
+ placement: 'bottom',
+ value: null,
+ multiSelect: false,
+ closeOnSelect: true,
+ showToken: true,
+ placeholder: 'Select a field'
+ };
+
fieldsSelector = props => props.fields;
valueSelector = props => props.value;
filterFieldTypesSelector = props => props.filterFieldTypes;
@@ -138,7 +150,4 @@ export default class FieldSelector extends Component {
</div>
);
}
-}
-
-FieldSelector.propTypes = propTypes;
-FieldSelector.defaultProps = defaultProps;
+};
diff --git a/src/components/common/file-uploader/file-upload.js b/src/components/common/file-uploader/file-upload.js
index cbeca4854..74e0785ba 100644
--- a/src/components/common/file-uploader/file-upload.js
+++ b/src/components/common/file-uploader/file-upload.js
@@ -28,10 +28,6 @@ import {isChrome} from 'utils/utils';
const FileDrop =
typeof document !== 'undefined' ? require('react-file-drop') : null;
-const propTypes = {
- onFileUpload: PropTypes.func.isRequired,
- validFileExt: PropTypes.array
-};
// File.type is not reliable if the OS does not have a
// registered mapping for the extension.
@@ -48,10 +44,6 @@ const defaultValidFileExt = [
'geojson'
];
-const defaultProps = {
- validFileExt: defaultValidFileExt
-};
-
const MESSAGE = ' Drag & Drop Your File(s) Here';
const CHROME_MSG =
'*Chrome user: Limit file size to 250mb, if need to upload larger file, try Safari';
@@ -104,7 +96,16 @@ const StyledFileUpload = styled.div`
}
`;
-class FileUpload extends Component {
+export default class FileUpload extends Component {
+ static defaultProps = {
+ validFileExt: defaultValidFileExt
+ };
+
+ static propTypes = {
+ onFileUpload: PropTypes.func.isRequired,
+ validFileExt: PropTypes.arrayOf(PropTypes.string)
+ };
+
state = {
dragOver: false,
files: null,
@@ -216,8 +217,3 @@ class FileUpload extends Component {
);
}
}
-
-FileUpload.propTypes = propTypes;
-FileUpload.defaultProps = defaultProps;
-
-export default FileUpload;
diff --git a/src/components/common/file-uploader/upload-button.js b/src/components/common/file-uploader/upload-button.js
index 1e8a373b4..e8c2102ac 100644
--- a/src/components/common/file-uploader/upload-button.js
+++ b/src/components/common/file-uploader/upload-button.js
@@ -22,10 +22,6 @@ import React, {Component} from 'react';
import PropTypes from 'prop-types';
import styled from 'styled-components';
-const propTypes = {
- onUpload: PropTypes.func.isRequired
-};
-
const Wrapper = styled.div`
display: inline-block;
color: ${props => props.theme.textColorLT};
@@ -41,6 +37,10 @@ const Wrapper = styled.div`
Inspired by https://github.com/okonet/react-dropzone/blob/master/src/index.js
*/
export default class UploadButton extends Component {
+ static propTypes = {
+ onUpload: PropTypes.func.isRequired
+ };
+
_onClick = () => {
this.refs.fileInput.value = null;
this.refs.fileInput.click();
@@ -67,6 +67,4 @@ export default class UploadButton extends Component {
</Wrapper>
);
}
-}
-
-UploadButton.propTypes = propTypes;
+};
diff --git a/src/components/common/icons/add.js b/src/components/common/icons/add.js
index 1aa7ae3d0..889c3b945 100644
--- a/src/components/common/icons/add.js
+++ b/src/components/common/icons/add.js
@@ -18,13 +18,11 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import React from 'react';
+import React, {Component} from 'react';
import PropTypes from 'prop-types';
import Base from './base';
-class Add extends React.Component {
- static displayName = 'Add';
-
+export default class Add extends Component {
static propTypes = {
/** Set the height of the icon, ex. '16px' */
height: PropTypes.string
@@ -43,5 +41,3 @@ class Add extends React.Component {
);
}
}
-
-export default Add;
diff --git a/src/components/common/icons/arrow-down.js b/src/components/common/icons/arrow-down.js
index c0c242e74..381c2dc7e 100644
--- a/src/components/common/icons/arrow-down.js
+++ b/src/components/common/icons/arrow-down.js
@@ -18,13 +18,11 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import React from 'react';
+import React, {Component} from 'react';
import PropTypes from 'prop-types';
import Base from './base';
-class ArrowDown extends React.Component {
- static displayName = 'ArrowDown';
-
+export default class ArrowDown extends Component {
static propTypes = {
/** Set the height of the icon, ex. '16px' */
height: PropTypes.string
@@ -42,6 +40,4 @@ class ArrowDown extends React.Component {
</Base>
);
}
-}
-
-export default ArrowDown;
+};
diff --git a/src/components/common/icons/arrow-left.js b/src/components/common/icons/arrow-left.js
index 514923cda..100b53c66 100644
--- a/src/components/common/icons/arrow-left.js
+++ b/src/components/common/icons/arrow-left.js
@@ -18,13 +18,11 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import React from 'react';
+import React, {Component} from 'react';
import PropTypes from 'prop-types';
import Base from './base';
-class ArrowLeft extends React.Component {
- static displayName = 'ArrowLeft';
-
+export default class ArrowLeft extends Component {
static propTypes = {
/** Set the height of the icon, ex. '16px' */
height: PropTypes.string
@@ -42,6 +40,4 @@ class ArrowLeft extends React.Component {
</Base>
);
}
-}
-
-export default ArrowLeft;
+};
diff --git a/src/components/common/icons/arrow-right.js b/src/components/common/icons/arrow-right.js
index 1872d067a..d1dae8179 100644
--- a/src/components/common/icons/arrow-right.js
+++ b/src/components/common/icons/arrow-right.js
@@ -18,13 +18,11 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import React from 'react';
+import React, {Component} from 'react';
import PropTypes from 'prop-types';
import Base from './base';
-class ArrowRight extends React.Component {
- static displayName = 'ArrowRight';
-
+export default class ArrowRight extends Component {
static propTypes = {
/** Set the height of the icon, ex. '16px' */
height: PropTypes.string
@@ -44,5 +42,3 @@ class ArrowRight extends React.Component {
);
}
}
-
-export default ArrowRight;
diff --git a/src/components/common/icons/base.js b/src/components/common/icons/base.js
index 86ebf0212..13c4eef76 100644
--- a/src/components/common/icons/base.js
+++ b/src/components/common/icons/base.js
@@ -18,7 +18,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import React from 'react';
+import React, {Component} from 'react';
import PropTypes from 'prop-types';
const getStyleClassFromColor = (totalColor, colors) =>
@@ -29,7 +29,7 @@ const getStyleClassFromColor = (totalColor, colors) =>
''
);
-class Base extends React.Component {
+export default class Base extends Component {
static displayName = 'Base Icon';
static propTypes = {
@@ -91,6 +91,4 @@ class Base extends React.Component {
</svg>
);
}
-}
-
-export default Base;
+};
diff --git a/src/components/common/icons/clock.js b/src/components/common/icons/clock.js
index 3cd2ae766..213caea4c 100644
--- a/src/components/common/icons/clock.js
+++ b/src/components/common/icons/clock.js
@@ -18,12 +18,11 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import React from 'react';
+import React, {Component} from 'react';
import PropTypes from 'prop-types';
import Base from './base';
-class Clock extends React.Component {
- static displayName = 'Clock';
+export default class Clock extends Component {
static propTypes = {
/** Set the height of the icon, ex. '16px' */
@@ -43,6 +42,4 @@ class Clock extends React.Component {
</Base>
);
}
-}
-
-export default Clock;
+};
diff --git a/src/components/common/icons/close.js b/src/components/common/icons/close.js
index 61ab57dd8..f318f94d7 100644
--- a/src/components/common/icons/close.js
+++ b/src/components/common/icons/close.js
@@ -18,13 +18,11 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import React from 'react';
+import React, {Component} from 'react';
import PropTypes from 'prop-types';
import Base from './base';
-class Close extends React.Component {
- static displayName = 'Close';
-
+export default class Close extends Component {
static propTypes = {
/** Set the height of the icon, ex. '16px' */
height: PropTypes.string
@@ -48,6 +46,4 @@ class Close extends React.Component {
</Base>
);
}
-}
-
-export default Close;
+};
diff --git a/src/components/common/icons/crosshairs.js b/src/components/common/icons/crosshairs.js
index 9e101de29..30c9aaa53 100644
--- a/src/components/common/icons/crosshairs.js
+++ b/src/components/common/icons/crosshairs.js
@@ -18,13 +18,11 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
+import React, {Component} from 'react';
import PropTypes from 'prop-types';
-import React from 'react';
import Base from './base';
-class Crosshairs extends React.Component {
- static displayName = 'Crosshairs';
-
+export default class Crosshairs extends Component {
static propTypes = {
/** Set the height of the icon, ex. '16px' */
height: PropTypes.string
@@ -42,6 +40,4 @@ class Crosshairs extends React.Component {
</Base>
);
}
-}
-
-export default Crosshairs;
+};
diff --git a/src/components/common/icons/cube-3d.js b/src/components/common/icons/cube-3d.js
index c4553735a..bd9d48bf7 100644
--- a/src/components/common/icons/cube-3d.js
+++ b/src/components/common/icons/cube-3d.js
@@ -18,13 +18,11 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import React from 'react';
+import React, {Component} from 'react';
import PropTypes from 'prop-types';
import Base from './base';
-class Cube3D extends React.Component {
- static displayName = 'Cube3D';
-
+export default class Cube3D extends Component {
static propTypes = {
/** Set the height of the icon, ex. '16px' */
height: PropTypes.string
@@ -44,6 +42,4 @@ class Cube3D extends React.Component {
</Base>
);
}
-}
-
-export default Cube3D;
+};
diff --git a/src/components/common/icons/cursor-click.js b/src/components/common/icons/cursor-click.js
index 459d2d639..a5a8f571b 100644
--- a/src/components/common/icons/cursor-click.js
+++ b/src/components/common/icons/cursor-click.js
@@ -18,13 +18,11 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import React from 'react';
+import React, {Component} from 'react';
import PropTypes from 'prop-types';
import Base from './base';
-class CursorClick extends React.Component {
- static displayName = 'CursorClick';
-
+export default class CursorClick extends Component {
static propTypes = {
/** Set the height of the icon, ex. '16px' */
height: PropTypes.string
@@ -46,6 +44,4 @@ class CursorClick extends React.Component {
</Base>
);
}
-}
-
-export default CursorClick;
+};
diff --git a/src/components/common/icons/delete.js b/src/components/common/icons/delete.js
index 0f07df3b8..3cd95d101 100644
--- a/src/components/common/icons/delete.js
+++ b/src/components/common/icons/delete.js
@@ -18,13 +18,11 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import React from 'react';
+import React, {Component} from 'react';
import PropTypes from 'prop-types';
import Base from './base';
-class Cross extends React.Component {
- static displayName = 'Cross';
-
+export default class Cross extends Component {
static propTypes = {
height: PropTypes.string
};
@@ -44,5 +42,3 @@ class Cross extends React.Component {
);
}
}
-
-export default Cross;
diff --git a/src/components/common/icons/docs.js b/src/components/common/icons/docs.js
index fbf946a2c..e45eba06f 100644
--- a/src/components/common/icons/docs.js
+++ b/src/components/common/icons/docs.js
@@ -18,13 +18,11 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import React from 'react';
+import React, {Component} from 'react';
import PropTypes from 'prop-types';
import Base from './base';
-class Docs extends React.Component {
- static displayName = 'Docs';
-
+export default class Docs extends Component {
static propTypes = {
/** Set the height of the icon, ex. '16px' */
height: PropTypes.string
@@ -52,6 +50,4 @@ class Docs extends React.Component {
</Base>
);
}
-}
-
-export default Docs;
+};
diff --git a/src/components/common/icons/drag-n-drop.js b/src/components/common/icons/drag-n-drop.js
index 46a1b2e4c..7b86b0572 100644
--- a/src/components/common/icons/drag-n-drop.js
+++ b/src/components/common/icons/drag-n-drop.js
@@ -18,13 +18,11 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import React from 'react';
+import React, {Component} from 'react';
import PropTypes from 'prop-types';
import Base from './base';
-class DragNDrop extends React.Component {
- static displayName = 'DragNDrop';
-
+export default class DragNDrop extends Component {
static propTypes = {
/** Set the height of the icon, ex. '16px' */
height: PropTypes.string
@@ -44,5 +42,3 @@ class DragNDrop extends React.Component {
);
}
}
-
-export default DragNDrop;
diff --git a/src/components/common/icons/email.js b/src/components/common/icons/email.js
index 22f61f181..38f04af20 100644
--- a/src/components/common/icons/email.js
+++ b/src/components/common/icons/email.js
@@ -18,13 +18,11 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import React from 'react';
+import React, {Component} from 'react';
import PropTypes from 'prop-types';
import Base from './base';
-class Email extends React.Component {
- static displayName = 'Email';
-
+export default class Email extends Component {
static propTypes = {
/** Set the height of the icon, ex. '16px' */
height: PropTypes.string
@@ -44,7 +42,4 @@ class Email extends React.Component {
</Base>
);
}
-}
-
-// this export method must be used for generated documentation to work
-export default Email;
+};
diff --git a/src/components/common/icons/expand.js b/src/components/common/icons/expand.js
index 31ef4fe64..abfed289e 100644
--- a/src/components/common/icons/expand.js
+++ b/src/components/common/icons/expand.js
@@ -18,13 +18,11 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import React from 'react';
+import React, {Component} from 'react';
import PropTypes from 'prop-types';
import Base from './base';
-class Expand extends React.Component {
- static displayName = 'Expand';
-
+export default class Expand extends Component {
static propTypes = {
/** Set the height of the icon, ex. '16px' */
height: PropTypes.string
@@ -44,6 +42,4 @@ class Expand extends React.Component {
</Base>
);
}
-}
-
-export default Expand;
+};
diff --git a/src/components/common/icons/eye-seen.js b/src/components/common/icons/eye-seen.js
index 86a9ef55b..f2d01babd 100644
--- a/src/components/common/icons/eye-seen.js
+++ b/src/components/common/icons/eye-seen.js
@@ -18,13 +18,11 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import React from 'react';
+import React, {Component} from 'react';
import PropTypes from 'prop-types';
import Base from './base';
-class EyeSeen extends React.Component {
- static displayName = 'EyeSeen';
-
+export default class EyeSeen extends Component {
static propTypes = {
/** Set the height of the icon, ex. '16px' */
height: PropTypes.string
@@ -43,6 +41,4 @@ class EyeSeen extends React.Component {
</Base>
);
}
-}
-
-export default EyeSeen;
+};
diff --git a/src/components/common/icons/eye-unseen.js b/src/components/common/icons/eye-unseen.js
index bcf2f8ad0..388dbdd48 100644
--- a/src/components/common/icons/eye-unseen.js
+++ b/src/components/common/icons/eye-unseen.js
@@ -18,13 +18,11 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import React from 'react';
+import React, {Component} from 'react';
import PropTypes from 'prop-types';
import Base from './base';
-class EyeUnseen extends React.Component {
- static displayName = 'EyeUnseen';
-
+export default class EyeUnseen extends Component {
static propTypes = {
/** Set the height of the icon, ex. '16px' */
height: PropTypes.string
@@ -43,6 +41,4 @@ class EyeUnseen extends React.Component {
</Base>
);
}
-}
-
-export default EyeUnseen;
+};
diff --git a/src/components/common/icons/file.js b/src/components/common/icons/file.js
index 4b88a66cc..3204e3018 100644
--- a/src/components/common/icons/file.js
+++ b/src/components/common/icons/file.js
@@ -18,13 +18,11 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import React from 'react';
+import React, {Component} from 'react';
import PropTypes from 'prop-types';
import Base from './base';
-class File extends React.Component {
- static displayName = 'File';
-
+export default class File extends Component {
static propTypes = {
/** Set the height of the icon, ex. '16px' */
height: PropTypes.string
@@ -42,6 +40,4 @@ class File extends React.Component {
</Base>
);
}
-}
-
-export default File;
+};
diff --git a/src/components/common/icons/filter-funnel.js b/src/components/common/icons/filter-funnel.js
index 6820da58b..6a45a272d 100644
--- a/src/components/common/icons/filter-funnel.js
+++ b/src/components/common/icons/filter-funnel.js
@@ -18,13 +18,11 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import React from 'react';
+import React, {Component} from 'react';
import PropTypes from 'prop-types';
import Base from './base';
-class FilterFunnel extends React.Component {
- static displayName = 'FilterFunnel';
-
+export default class FilterFunnel extends Component {
static propTypes = {
/** Set the height of the icon, ex. '16px' */
height: PropTypes.string
@@ -43,6 +41,3 @@ class FilterFunnel extends React.Component {
);
}
}
-
-// this export method must be used for generated documentation to work
-export default FilterFunnel;
diff --git a/src/components/common/icons/histogram.js b/src/components/common/icons/histogram.js
index 9081cd891..4169652ef 100644
--- a/src/components/common/icons/histogram.js
+++ b/src/components/common/icons/histogram.js
@@ -22,9 +22,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import Base from './base';
-class Histogram extends React.Component {
- static displayName = 'Histogram';
-
+export default class Histogram extends React.Component {
static propTypes = {
height: PropTypes.string
};
@@ -47,5 +45,3 @@ class Histogram extends React.Component {
);
}
}
-
-export default Histogram;
diff --git a/src/components/common/icons/layers.js b/src/components/common/icons/layers.js
index 0ac573e7c..f64b72ce1 100644
--- a/src/components/common/icons/layers.js
+++ b/src/components/common/icons/layers.js
@@ -18,13 +18,11 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import React from 'react';
+import React, {Component} from 'react';
import PropTypes from 'prop-types';
import Base from './base';
-class Layers extends React.Component {
- static displayName = 'Layers';
-
+export default class Layers extends Component {
static propTypes = {
/** Set the height of the icon, ex. '16px' */
height: PropTypes.string
@@ -43,5 +41,3 @@ class Layers extends React.Component {
);
}
}
-
-export default Layers;
diff --git a/src/components/common/icons/left-arrow.js b/src/components/common/icons/left-arrow.js
index 9c4b3c911..0e6be0abc 100644
--- a/src/components/common/icons/left-arrow.js
+++ b/src/components/common/icons/left-arrow.js
@@ -18,13 +18,11 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
+import React, {Component} from 'react';
import PropTypes from 'prop-types';
-import React from 'react';
import Base from './base';
-class LeftArrow extends React.Component {
- static displayName = 'LeftArrow';
-
+export default class LeftArrow extends Component {
static propTypes = {
/** Set the height of the icon, ex. '16px' */
height: PropTypes.string
@@ -43,5 +41,3 @@ class LeftArrow extends React.Component {
);
}
}
-
-export default LeftArrow;
diff --git a/src/components/common/icons/legend.js b/src/components/common/icons/legend.js
index cf0941295..fc14c6c82 100644
--- a/src/components/common/icons/legend.js
+++ b/src/components/common/icons/legend.js
@@ -18,13 +18,11 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import React from 'react';
+import React, {Component} from 'react';
import PropTypes from 'prop-types';
import Base from './base';
-class Legend extends React.Component {
- static displayName = 'Legend';
-
+export default class Legend extends Component {
static propTypes = {
/** Set the height of the icon, ex. '16px' */
height: PropTypes.string
@@ -42,6 +40,4 @@ class Legend extends React.Component {
</Base>
);
}
-}
-
-export default Legend;
+};
diff --git a/src/components/common/icons/line-chart.js b/src/components/common/icons/line-chart.js
index bb90dc89b..256cb63aa 100644
--- a/src/components/common/icons/line-chart.js
+++ b/src/components/common/icons/line-chart.js
@@ -18,13 +18,11 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import React from 'react';
+import React, {Component} from 'react';
import PropTypes from 'prop-types';
import Base from './base';
-class LineChart extends React.Component {
- static displayName = 'LineChart';
-
+export default class LineChart extends Component {
static propTypes = {
height: PropTypes.string
};
@@ -42,6 +40,4 @@ class LineChart extends React.Component {
</Base>
);
}
-}
-
-export default LineChart;
+};
diff --git a/src/components/common/icons/messages.js b/src/components/common/icons/messages.js
index 657542674..6d19af0a9 100644
--- a/src/components/common/icons/messages.js
+++ b/src/components/common/icons/messages.js
@@ -18,13 +18,11 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
+import React, {Component} from 'react';
import PropTypes from 'prop-types';
-import React from 'react';
import Base from './base';
-class Messages extends React.Component {
- static displayName = 'Messages';
-
+export default class Messages extends Component {
static propTypes = {
/** Set the height of the icon, ex. '16px' */
height: PropTypes.string
@@ -42,6 +40,4 @@ class Messages extends React.Component {
</Base>
);
}
-}
-
-export default Messages;
+};
diff --git a/src/components/common/icons/minus.js b/src/components/common/icons/minus.js
index 40e6d69ba..df392fa65 100644
--- a/src/components/common/icons/minus.js
+++ b/src/components/common/icons/minus.js
@@ -18,13 +18,11 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
+import React, {Component} from 'react';
import PropTypes from 'prop-types';
-import React from 'react';
import Base from './base';
-class Minus extends React.Component {
- static displayName = 'Minus';
-
+export default class Minus extends Component {
static propTypes = {
/** Set the height of the icon, ex. '16px' */
height: PropTypes.string
@@ -42,6 +40,4 @@ class Minus extends React.Component {
</Base>
);
}
-}
-
-export default Minus;
+};
diff --git a/src/components/common/icons/pause.js b/src/components/common/icons/pause.js
index fee4af911..e91dcb830 100644
--- a/src/components/common/icons/pause.js
+++ b/src/components/common/icons/pause.js
@@ -18,13 +18,11 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
+import React, {Component} from 'react';
import PropTypes from 'prop-types';
-import React from 'react';
import Base from './base';
-class Pause extends React.Component {
- static displayName = 'Pause';
-
+export default class Pause extends Component {
static propTypes = {
/** Set the height of the icon, ex. '16px' */
height: PropTypes.string
@@ -42,6 +40,4 @@ class Pause extends React.Component {
</Base>
);
}
-}
-
-export default Pause;
+};
diff --git a/src/components/common/icons/pin.js b/src/components/common/icons/pin.js
index 488993924..96ac009ab 100644
--- a/src/components/common/icons/pin.js
+++ b/src/components/common/icons/pin.js
@@ -18,13 +18,11 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
+import React, {Component} from 'react';
import PropTypes from 'prop-types';
-import React from 'react';
import Base from './base';
-class Pin extends React.Component {
- static displayName = 'Pin';
-
+export default class Pin extends Component {
static propTypes = {
/** Set the height of the icon, ex. '16px' */
height: PropTypes.string
@@ -43,6 +41,4 @@ class Pin extends React.Component {
</Base>
);
}
-}
-
-export default Pin;
+};
diff --git a/src/components/common/icons/play.js b/src/components/common/icons/play.js
index f6c1a536c..be0e410c6 100644
--- a/src/components/common/icons/play.js
+++ b/src/components/common/icons/play.js
@@ -18,13 +18,11 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
+import React, {Component} from 'react';
import PropTypes from 'prop-types';
-import React from 'react';
import Base from './base';
-class Play extends React.Component {
- static displayName = 'Play';
-
+export default class Play extends Component {
static propTypes = {
/** Set the height of the icon, ex. '16px' */
height: PropTypes.string
@@ -42,6 +40,4 @@ class Play extends React.Component {
</Base>
);
}
-}
-
-export default Play;
+};
diff --git a/src/components/common/icons/reduce.js b/src/components/common/icons/reduce.js
index c7852db30..3fe3f718e 100644
--- a/src/components/common/icons/reduce.js
+++ b/src/components/common/icons/reduce.js
@@ -18,13 +18,11 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import React from 'react';
+import React, {Component} from 'react';
import PropTypes from 'prop-types';
import Base from './base';
-class Reduce extends React.Component {
- static displayName = 'Reduce';
-
+export default class Reduce extends Component {
static propTypes = {
/** Set the height of the icon, ex. '16px' */
height: PropTypes.string
@@ -47,6 +45,4 @@ class Reduce extends React.Component {
</Base>
);
}
-}
-
-export default Reduce;
+};
diff --git a/src/components/common/icons/reset.js b/src/components/common/icons/reset.js
index c56d48c20..8b3918dad 100644
--- a/src/components/common/icons/reset.js
+++ b/src/components/common/icons/reset.js
@@ -18,13 +18,11 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
+import React, {Component} from 'react';
import PropTypes from 'prop-types';
-import React from 'react';
import Base from './base';
-class Reset extends React.Component {
- static displayName = 'Reset';
-
+export default class Reset extends Component {
static propTypes = {
/** Set the height of the icon, ex. '16px' */
height: PropTypes.string
@@ -42,6 +40,4 @@ class Reset extends React.Component {
</Base>
);
}
-}
-
-export default Reset;
+};
diff --git a/src/components/common/icons/save.js b/src/components/common/icons/save.js
index a5f006521..9b356ee51 100644
--- a/src/components/common/icons/save.js
+++ b/src/components/common/icons/save.js
@@ -18,13 +18,11 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import React from 'react';
+import React, {Component} from 'react';
import PropTypes from 'prop-types';
import Base from './base';
-class Save extends React.Component {
- static displayName = 'Save';
-
+export default class Save extends Component {
static propTypes = {
/** Set the height of the icon, ex. '16px' */
height: PropTypes.string
@@ -43,6 +41,4 @@ class Save extends React.Component {
</Base>
);
}
-}
-
-export default Save;
+};
diff --git a/src/components/common/icons/search.js b/src/components/common/icons/search.js
index b1abfd481..308d5d3fb 100644
--- a/src/components/common/icons/search.js
+++ b/src/components/common/icons/search.js
@@ -18,13 +18,11 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import React from 'react';
+import React, {Component} from 'react';
import PropTypes from 'prop-types';
import Base from './base';
-class Search extends React.Component {
- static displayName = 'Search';
-
+export default class Search extends Component {
static propTypes = {
/** Set the height of the icon, ex. '16px' */
height: PropTypes.string
@@ -43,6 +41,4 @@ class Search extends React.Component {
</Base>
);
}
-}
-
-export default Search;
+};
diff --git a/src/components/common/icons/settings.js b/src/components/common/icons/settings.js
index f0b208d25..2d5919e5a 100644
--- a/src/components/common/icons/settings.js
+++ b/src/components/common/icons/settings.js
@@ -18,13 +18,11 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import React from 'react';
+import React, {Component} from 'react';
import PropTypes from 'prop-types';
import Base from './base';
-class Settings extends React.Component {
- static displayName = 'Settings';
-
+export default class Settings extends Component {
static propTypes = {
/** Set the height of the icon, ex. '16px' */
height: PropTypes.string
@@ -44,6 +42,4 @@ class Settings extends React.Component {
</Base>
);
}
-}
-
-export default Settings;
+};
diff --git a/src/components/common/icons/share.js b/src/components/common/icons/share.js
index 7a251376c..0f50c3eb4 100644
--- a/src/components/common/icons/share.js
+++ b/src/components/common/icons/share.js
@@ -18,19 +18,17 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
+import React, {Component} from 'react';
import PropTypes from 'prop-types';
-import React from 'react';
import Base from './base';
-class Share extends React.Component {
- displayName: 'Share';
-
- propTypes: {
+export default class Share extends Component {
+ static propTypes = {
/** Set the height of the icon, ex. '16px' */
height: PropTypes.string
};
- defaultProps = {
+ static defaultProps = {
height: '16px',
predefinedClassName: 'data-ex-icons-share'
};
@@ -42,6 +40,4 @@ class Share extends React.Component {
</Base>
);
}
-}
-
-export default Share;
+};
diff --git a/src/components/common/icons/split.js b/src/components/common/icons/split.js
index 61760ff85..3f3fc3e15 100644
--- a/src/components/common/icons/split.js
+++ b/src/components/common/icons/split.js
@@ -18,13 +18,11 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import React from 'react';
+import React, {Component} from 'react';
import PropTypes from 'prop-types';
import Base from './base';
-class Split extends React.Component {
- static displayName = 'Split';
-
+export default class Split extends Component {
static propTypes = {
/** Set the height of the icon, ex. '16px' */
height: PropTypes.string
@@ -62,6 +60,4 @@ class Split extends React.Component {
</Base>
);
}
-}
-
-export default Split;
+};
diff --git a/src/components/common/icons/square-select.js b/src/components/common/icons/square-select.js
index be7d70a72..1aebcdbac 100644
--- a/src/components/common/icons/square-select.js
+++ b/src/components/common/icons/square-select.js
@@ -18,12 +18,11 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import React from 'react';
+import React, {Component} from 'react';
import PropTypes from 'prop-types';
import Base from './base';
-class SquareSelect extends React.Component {
- static displayName = 'SquareSelect';
+export default class SquareSelect extends Component {
static propTypes = {
/** Set the height of the icon, ex. '16px' */
height: PropTypes.string
@@ -43,5 +42,3 @@ class SquareSelect extends React.Component {
);
}
}
-
-export default SquareSelect;
diff --git a/src/components/common/icons/table.js b/src/components/common/icons/table.js
index fafa68eb0..286fe6c4d 100644
--- a/src/components/common/icons/table.js
+++ b/src/components/common/icons/table.js
@@ -18,13 +18,11 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import React from 'react';
+import React, {Component} from 'react';
import PropTypes from 'prop-types';
import Base from './base';
-class Table extends React.Component {
- static displayName = 'Table';
-
+export default class Table extends Component {
static propTypes = {
height: PropTypes.string
};
@@ -43,6 +41,4 @@ class Table extends React.Component {
</Base>
);
}
-}
-
-export default Table;
+};
diff --git a/src/components/common/icons/trash.js b/src/components/common/icons/trash.js
index 27de7545a..19bfa80eb 100644
--- a/src/components/common/icons/trash.js
+++ b/src/components/common/icons/trash.js
@@ -18,13 +18,11 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import React from 'react';
+import React, {Component} from 'react';
import PropTypes from 'prop-types';
import Base from './base';
-class Trash extends React.Component {
- static displayName = 'Trash';
-
+export default class Trash extends Component {
static propTypes = {
/** Set the height of the icon, ex. '16px' */
height: PropTypes.string
@@ -47,5 +45,3 @@ class Trash extends React.Component {
);
}
}
-
-export default Trash;
diff --git a/src/components/common/icons/upload.js b/src/components/common/icons/upload.js
index ec3ced244..346364aa2 100644
--- a/src/components/common/icons/upload.js
+++ b/src/components/common/icons/upload.js
@@ -18,13 +18,11 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
+import React, {Component} from 'react';
import PropTypes from 'prop-types';
-import React from 'react';
import Base from './base';
-class Upload extends React.Component {
- static displayName = 'Upload';
-
+export default class Upload extends Component {
static propTypes = {
/** Set the height of the icon, ex. '16px' */
height: PropTypes.string,
@@ -44,5 +42,3 @@ class Upload extends React.Component {
);
}
}
-
-export default Upload;
diff --git a/src/components/common/icons/vert-dots.js b/src/components/common/icons/vert-dots.js
index 60d27720a..479b91058 100644
--- a/src/components/common/icons/vert-dots.js
+++ b/src/components/common/icons/vert-dots.js
@@ -18,13 +18,11 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import React from 'react';
+import React, {Component} from 'react';
import PropTypes from 'prop-types';
import Base from './base';
-class VertDots extends React.Component {
- static displayName = 'VertDot';
-
+export default class VertDots extends Component {
static propTypes = {
/** Set the height of the icon, ex. '16px' */
height: PropTypes.string
@@ -50,5 +48,3 @@ class VertDots extends React.Component {
);
}
}
-
-export default VertDots;
diff --git a/src/components/common/item-selector/chickleted-input.js b/src/components/common/item-selector/chickleted-input.js
index ba3f72cba..c13459b5b 100644
--- a/src/components/common/item-selector/chickleted-input.js
+++ b/src/components/common/item-selector/chickleted-input.js
@@ -30,7 +30,7 @@ const propTypes = {
removeItem: PropTypes.func.isRequired,
// optional properties
- selectedItems: PropTypes.array,
+ selectedItems: PropTypes.arrayOf(PropTypes.any),
disabled: PropTypes.bool,
displayOption: PropTypes.func,
focus: PropTypes.bool,
@@ -60,7 +60,7 @@ const ChickletTag = styled.span`
text-overflow: ellipsis;
width: 100%;
overflow: hidden;
-
+
:hover {
overflow: visible;
}
@@ -74,7 +74,7 @@ const Chicklet = ({disabled, name, remove}) => (
);
const ChickletedInputContainer = styled.div`
- ${props => props.theme.chickletedInput}
+ ${props => props.theme.chickletedInput}
`;
const ChickletedInput = ({
diff --git a/src/components/common/item-selector/dropdown-list.js b/src/components/common/item-selector/dropdown-list.js
index 858632426..8dcde2015 100644
--- a/src/components/common/item-selector/dropdown-list.js
+++ b/src/components/common/item-selector/dropdown-list.js
@@ -36,47 +36,47 @@ export const ListItem = ({value, displayOption = defaultDisplay}) => (
<span className={classList.listItemAnchor}>{displayOption(value)}</span>
);
-const propTypes = {
- options: PropTypes.array,
- allowCustomValues: PropTypes.number,
- customClasses: PropTypes.object,
- customValues: PropTypes.array,
- customListItemComponent: PropTypes.oneOfType([
- PropTypes.element,
- PropTypes.func
- ]),
- customListHeaderComponent: PropTypes.oneOfType([
- PropTypes.element,
- PropTypes.func
- ]),
- selectionIndex: PropTypes.number,
- onOptionSelected: PropTypes.func,
- displayOption: PropTypes.func.isRequired,
- defaultClassNames: PropTypes.bool,
- areResultsTruncated: PropTypes.bool,
- resultsTruncatedMessage: PropTypes.string,
- listItemComponent: PropTypes.func
-};
-
-const defaultProps = {
- customClasses: {},
- customListItemComponent: ListItem,
- customListHeaderComponent: null,
- allowCustomValues: 0,
- customValues: [],
- displayOption: defaultDisplay,
- onOptionSelected: () => {},
- defaultClassNames: true,
- selectionIndex: null
-};
-
const DropdownListWrapper = styled.div`
background-color: ${props => props.theme.dropdownListBgd};
border-top: 1px solid ${props => props.theme.dropdownListBorderTop};
${props => props.theme.dropdownList};
`;
-class DropdownList extends Component {
+export default class DropdownList extends Component {
+ static propTypes = {
+ options: PropTypes.arrayOf(PropTypes.any),
+ allowCustomValues: PropTypes.number,
+ customClasses: PropTypes.object,
+ customValues: PropTypes.arrayOf(PropTypes.any),
+ customListItemComponent: PropTypes.oneOfType([
+ PropTypes.element,
+ PropTypes.func
+ ]),
+ customListHeaderComponent: PropTypes.oneOfType([
+ PropTypes.element,
+ PropTypes.func
+ ]),
+ selectionIndex: PropTypes.number,
+ onOptionSelected: PropTypes.func,
+ displayOption: PropTypes.func.isRequired,
+ defaultClassNames: PropTypes.bool,
+ areResultsTruncated: PropTypes.bool,
+ resultsTruncatedMessage: PropTypes.string,
+ listItemComponent: PropTypes.func
+ };
+
+ static defaultProps = {
+ customClasses: {},
+ customListItemComponent: ListItem,
+ customListHeaderComponent: null,
+ allowCustomValues: 0,
+ customValues: [],
+ displayOption: defaultDisplay,
+ onOptionSelected: () => {},
+ defaultClassNames: true,
+ selectionIndex: null
+ };
+
_onClick(result, event) {
event.preventDefault();
this.props.onOptionSelected(result, event);
@@ -142,9 +142,4 @@ class DropdownList extends Component {
</DropdownListWrapper>
);
}
-}
-
-DropdownList.propTypes = propTypes;
-DropdownList.defaultProps = defaultProps;
-
-export default DropdownList;
+};
diff --git a/src/components/common/item-selector/item-selector.js b/src/components/common/item-selector/item-selector.js
index 0564f8cda..dbf9edf3c 100644
--- a/src/components/common/item-selector/item-selector.js
+++ b/src/components/common/item-selector/item-selector.js
@@ -88,51 +88,51 @@ const DropdownWrapper = styled.div`
margin-bottom: ${props => (props.placement === 'top' ? '4px' : 'auto')};
`;
-const propTypes = {
- // required properties
- selectedItems: PropTypes.any,
- onChange: PropTypes.func.isRequired,
- options: PropTypes.array.isRequired,
-
- // optional properties
- fixedOptions: PropTypes.array,
- erasable: PropTypes.bool,
- displayOption: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
- getOptionValue: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
- filterOption: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
- placement: PropTypes.string,
- disabled: PropTypes.bool,
- isError: PropTypes.bool,
- multiSelect: PropTypes.bool,
- inputTheme: PropTypes.string,
- onBlur: PropTypes.func,
- placeholder: PropTypes.string,
- closeOnSelect: PropTypes.bool,
- DropdownHeaderComponent: PropTypes.func,
- DropDownRenderComponent: PropTypes.func,
- DropDownLineItemRenderComponent: PropTypes.func
-};
+class ItemSelector extends Component {
+ static propTypes = {
+ // required properties
+ selectedItems: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.any), PropTypes.string]),
+ onChange: PropTypes.func.isRequired,
+ options: PropTypes.arrayOf(PropTypes.any).isRequired,
+
+ // optional properties
+ fixedOptions: PropTypes.arrayOf(PropTypes.any),
+ erasable: PropTypes.bool,
+ displayOption: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
+ getOptionValue: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
+ filterOption: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
+ placement: PropTypes.string,
+ disabled: PropTypes.bool,
+ isError: PropTypes.bool,
+ multiSelect: PropTypes.bool,
+ inputTheme: PropTypes.string,
+ onBlur: PropTypes.func,
+ placeholder: PropTypes.string,
+ closeOnSelect: PropTypes.bool,
+ DropdownHeaderComponent: PropTypes.func,
+ DropDownRenderComponent: PropTypes.func,
+ DropDownLineItemRenderComponent: PropTypes.func
+ };
-const defaultProps = {
- erasable: false,
- placement: 'bottom',
- selectedItems: [],
- displayOption: null,
- getOptionValue: null,
- filterOption: null,
- fixedOptions: null,
- inputTheme: 'primary',
- multiSelect: true,
- placeholder: 'Enter a value',
- closeOnSelect: true,
- searchable: true,
- dropdownHeader: null,
- DropdownHeaderComponent: null,
- DropDownRenderComponent: DropdownList,
- DropDownLineItemRenderComponent: ListItem
-};
+ static defaultProps = {
+ erasable: false,
+ placement: 'bottom',
+ selectedItems: [],
+ displayOption: null,
+ getOptionValue: null,
+ filterOption: null,
+ fixedOptions: null,
+ inputTheme: 'primary',
+ multiSelect: true,
+ placeholder: 'Enter a value',
+ closeOnSelect: true,
+ searchable: true,
+ dropdownHeader: null,
+ DropdownHeaderComponent: null,
+ DropDownRenderComponent: DropdownList,
+ DropDownLineItemRenderComponent: ListItem
+ };
-class ItemSelector extends Component {
state = {
showTypeahead: false
};
@@ -295,9 +295,6 @@ class ItemSelector extends Component {
</div>
);
}
-}
-
-ItemSelector.propTypes = propTypes;
-ItemSelector.defaultProps = defaultProps;
+};
export default listensToClickOutside(ItemSelector);
diff --git a/src/components/common/item-selector/typeahead.js b/src/components/common/item-selector/typeahead.js
index a0ad1608b..b7bd99661 100644
--- a/src/components/common/item-selector/typeahead.js
+++ b/src/components/common/item-selector/typeahead.js
@@ -37,74 +37,6 @@ const DEFAULT_CLASS = 'typeahead';
* Renders an text input that shows options nearby that you can use the
* keyboard or mouse to select.
*/
-const propTypes = {
- name: PropTypes.string,
- customClasses: PropTypes.object,
- maxVisible: PropTypes.number,
- resultsTruncatedMessage: PropTypes.string,
- options: PropTypes.array,
- fixedOptions: PropTypes.array,
- allowCustomValues: PropTypes.number,
- initialValue: PropTypes.string,
- value: PropTypes.string,
- placeholder: PropTypes.string,
- disabled: PropTypes.bool,
- textarea: PropTypes.bool,
- inputProps: PropTypes.object,
- onOptionSelected: PropTypes.func,
- onChange: PropTypes.func,
- onKeyDown: PropTypes.func,
- onKeyPress: PropTypes.func,
- onKeyUp: PropTypes.func,
- onFocus: PropTypes.func,
- onBlur: PropTypes.func,
- filterOption: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
- searchOptions: PropTypes.func,
- displayOption: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
- inputDisplayOption: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
- formInputOption: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
- defaultClassNames: PropTypes.bool,
- customListComponent: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
- customListItemComponent: PropTypes.oneOfType([
- PropTypes.element,
- PropTypes.func
- ]),
- customListHeaderComponent: PropTypes.oneOfType([
- PropTypes.element,
- PropTypes.func
- ]),
- showOptionsWhenEmpty: PropTypes.bool,
- searchable: PropTypes.bool
-};
-
-const defaultProps = {
- options: [],
- customClasses: {},
- allowCustomValues: 0,
- initialValue: '',
- value: '',
- placeholder: '',
- disabled: false,
- textarea: false,
- inputProps: {},
- onOptionSelected(option) {},
- onChange(event) {},
- onKeyDown(event) {},
- onKeyPress(event) {},
- onKeyUp(event) {},
- onFocus(event) {},
- onBlur(event) {},
- filterOption: null,
- searchOptions: null,
- inputDisplayOption: null,
- defaultClassNames: true,
- customListComponent: DropdownList,
- customListItemComponent: ListItem,
- customListHeaderComponent: null,
- showOptionsWhenEmpty: true,
- searchable: true,
- resultsTruncatedMessage: null
-};
const TypeaheadWrapper = styled.div`
display: flex;
@@ -136,7 +68,76 @@ const InputIcon = styled.div`
color: ${props => props.theme.inputPlaceholderColor};
`;
-class Typeahead extends Component {
+export default class Typeahead extends Component {
+ static propTypes = {
+ name: PropTypes.string,
+ customClasses: PropTypes.object,
+ maxVisible: PropTypes.number,
+ resultsTruncatedMessage: PropTypes.string,
+ options: PropTypes.arrayOf(PropTypes.any),
+ fixedOptions: PropTypes.arrayOf(PropTypes.any),
+ allowCustomValues: PropTypes.number,
+ initialValue: PropTypes.string,
+ value: PropTypes.string,
+ placeholder: PropTypes.string,
+ disabled: PropTypes.bool,
+ textarea: PropTypes.bool,
+ inputProps: PropTypes.object,
+ onOptionSelected: PropTypes.func,
+ onChange: PropTypes.func,
+ onKeyDown: PropTypes.func,
+ onKeyPress: PropTypes.func,
+ onKeyUp: PropTypes.func,
+ onFocus: PropTypes.func,
+ onBlur: PropTypes.func,
+ filterOption: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
+ searchOptions: PropTypes.func,
+ displayOption: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
+ inputDisplayOption: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
+ formInputOption: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
+ defaultClassNames: PropTypes.bool,
+ customListComponent: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
+ customListItemComponent: PropTypes.oneOfType([
+ PropTypes.element,
+ PropTypes.func
+ ]),
+ customListHeaderComponent: PropTypes.oneOfType([
+ PropTypes.element,
+ PropTypes.func
+ ]),
+ showOptionsWhenEmpty: PropTypes.bool,
+ searchable: PropTypes.bool
+ };
+
+ static defaultProps = {
+ options: [],
+ customClasses: {},
+ allowCustomValues: 0,
+ initialValue: '',
+ value: '',
+ placeholder: '',
+ disabled: false,
+ textarea: false,
+ inputProps: {},
+ onOptionSelected(option) {},
+ onChange(event) {},
+ onKeyDown(event) {},
+ onKeyPress(event) {},
+ onKeyUp(event) {},
+ onFocus(event) {},
+ onBlur(event) {},
+ filterOption: null,
+ searchOptions: null,
+ inputDisplayOption: null,
+ defaultClassNames: true,
+ customListComponent: DropdownList,
+ customListItemComponent: ListItem,
+ customListHeaderComponent: null,
+ showOptionsWhenEmpty: true,
+ searchable: true,
+ resultsTruncatedMessage: null
+ };
+
constructor(props) {
super(props);
@@ -514,9 +515,4 @@ class Typeahead extends Component {
</TypeaheadWrapper>
);
}
-}
-
-Typeahead.propTypes = propTypes;
-Typeahead.defaultProps = defaultProps;
-
-export default Typeahead;
+};
diff --git a/src/components/common/logo.js b/src/components/common/logo.js
index bc34501db..e4b3f3788 100644
--- a/src/components/common/logo.js
+++ b/src/components/common/logo.js
@@ -21,6 +21,11 @@
import React from 'react';
import styled from 'styled-components';
+const defaultProps = {
+ appName: 'Kepler.Gl',
+ version: 'v1.0'
+};
+
const LogoTitle = styled.div`
display: inline-block;
margin-left: 6px;
@@ -74,9 +79,6 @@ const KeplerGlLogo = ({appName, version}) => (
</LogoWrapper>
);
-KeplerGlLogo.defaultProps = {
- appName: 'Kepler.Gl',
- version: 'v1.0'
-};
+KeplerGlLogo.defaultProps = defaultProps;
export default KeplerGlLogo;
diff --git a/src/components/common/map-layer-selector.js b/src/components/common/map-layer-selector.js
index 46d69345e..eceae9491 100644
--- a/src/components/common/map-layer-selector.js
+++ b/src/components/common/map-layer-selector.js
@@ -32,7 +32,7 @@ const propTypes = {
const MapLayerSelect = styled.div`
padding: 12px;
-
+
.map-layer-selector__item {
margin: 12px 0;
}
@@ -56,7 +56,6 @@ const MapLayerSelector = ({layers, onMapToggleLayer}) => (
</MapLayerSelect>
);
-MapLayerSelector.displayName = 'LayerSelector';
MapLayerSelector.propTypes = propTypes;
export default MapLayerSelector;
diff --git a/src/components/common/modal.js b/src/components/common/modal.js
index 93672a619..b9eb2f6d9 100644
--- a/src/components/common/modal.js
+++ b/src/components/common/modal.js
@@ -26,36 +26,6 @@ import Modal from 'react-modal';
import {Delete} from 'components/common/icons';
import {Button} from 'components/common/styled-components';
-const propTypes = {
- footer: PropTypes.bool,
- close: PropTypes.func.isRequired,
- onConfirm: PropTypes.func,
- onCancel: PropTypes.func,
- confirmButton: PropTypes.object,
- confirmButtonLabel: PropTypes.string,
- cancelButton: PropTypes.object,
- cancelButtonLabel: PropTypes.string,
- cssStyle: PropTypes.array
-};
-
-const defaultProps = {
- footer: false,
- close: () => {},
- onConfirm: () => {},
- onCancel: () => {},
- cancelButton: {
- link: true,
- large: true,
- children: 'Cancel'
- },
- confirmButton: {
- large: true,
- width: '160px',
- children: 'Confirm'
- },
- cssStyle: []
-};
-
const ModalContentWrapper = styled.div`
width: 60%;
max-width: 960px;
@@ -122,14 +92,26 @@ const FooterActionWrapper = styled.div`
justify-content: flex-end;
`;
+const defaultCancelButton = {
+ link: true,
+ large: true,
+ children: 'Cancel'
+};
+
+const defaultConfirmButton = {
+ large: true,
+ width: '160px',
+ children: 'Confirm'
+};
+
export const ModalFooter = ({
cancel,
confirm,
cancelButton,
confirmButton
}) => {
- const cancelButtonProps = {...defaultProps.cancelButton, ...cancelButton};
- const confirmButtonProps = {...defaultProps.confirmButton, ...confirmButton};
+ const cancelButtonProps = {...defaultCancelButton, ...cancelButton};
+ const confirmButtonProps = {...defaultConfirmButton, ...confirmButton};
return (
<StyledModalFooter className="modal--footer">
<FooterActionWrapper>
@@ -143,7 +125,30 @@ export const ModalFooter = ({
</StyledModalFooter>
);
}
+
class ModalDialog extends Component {
+ static propTypes = {
+ footer: PropTypes.bool,
+ close: PropTypes.func.isRequired,
+ onConfirm: PropTypes.func,
+ onCancel: PropTypes.func,
+ confirmButton: PropTypes.object,
+ confirmButtonLabel: PropTypes.string,
+ cancelButton: PropTypes.object,
+ cancelButtonLabel: PropTypes.string,
+ cssStyle: PropTypes.arrayOf(PropTypes.any)
+ };
+
+ static defaultProps = {
+ footer: false,
+ close: () => {},
+ onConfirm: () => {},
+ onCancel: () => {},
+ cancelButton: defaultCancelButton,
+ confirmButton: defaultConfirmButton,
+ cssStyle: []
+ };
+
render() {
const {props} = this;
return (
@@ -187,9 +192,6 @@ class ModalDialog extends Component {
}
}
-ModalDialog.defaultProps = defaultProps;
-ModalDialog.propTypes = propTypes;
-
const StyledModal = styled(ModalDialog)`
width: 100%;
height: 100%;
diff --git a/src/components/common/range-brush.js b/src/components/common/range-brush.js
index 0dfea5a6a..99696597d 100644
--- a/src/components/common/range-brush.js
+++ b/src/components/common/range-brush.js
@@ -18,20 +18,12 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import React from 'react';
+import React, {Component} from 'react';
import PropTypes from 'prop-types';
import styled from 'styled-components';
import {event, select} from 'd3-selection';
import {brushX} from 'd3-brush';
-const propTypes = {
- domain: PropTypes.arrayOf(PropTypes.number).isRequired,
- onBrush: PropTypes.func.isRequired,
- range: PropTypes.arrayOf(PropTypes.number).isRequired,
- value: PropTypes.arrayOf(PropTypes.number).isRequired,
- width: PropTypes.number.isRequired
-};
-
const StyledG = styled.g`
.selection {
stroke: none;
@@ -39,7 +31,16 @@ const StyledG = styled.g`
opacity: 1;
}
`;
-export default class RangeBrush extends React.Component {
+
+export default class RangeBrush extends Component {
+ static propTypes = {
+ domain: PropTypes.arrayOf(PropTypes.number).isRequired,
+ onBrush: PropTypes.func.isRequired,
+ range: PropTypes.arrayOf(PropTypes.number).isRequired,
+ value: PropTypes.arrayOf(PropTypes.number).isRequired,
+ width: PropTypes.number.isRequired
+ };
+
componentDidMount() {
const {range: [min, max], value: [val0, val1]} = this.props;
// We want the React app to respond to brush state and vice-versa
@@ -124,7 +125,4 @@ export default class RangeBrush extends React.Component {
this.rootContainer = comp;
}}/>;
}
-}
-
-RangeBrush.displayName = 'RangeBrush';
-RangeBrush.propTypes = propTypes;
+};
diff --git a/src/components/common/range-plot.js b/src/components/common/range-plot.js
index 755c63f87..39cefff51 100644
--- a/src/components/common/range-plot.js
+++ b/src/components/common/range-plot.js
@@ -30,16 +30,6 @@ import RangeBrush from './range-brush';
import {getTimeWidgetHintFormatter} from 'utils/filter-utils';
import {theme} from 'styles/base';
-const propTypes = {
- value: PropTypes.array.isRequired,
- histogram: PropTypes.array,
- lineChart: PropTypes.object,
- plotType: PropTypes.string,
- isEnlarged: PropTypes.bool,
- onBlur: PropTypes.func,
- width: PropTypes.number.isRequired
-};
-
const chartMargin = {top: 18, bottom: 0, left: 0, right: 0};
const chartH = 52;
const containerH = 78;
@@ -51,6 +41,21 @@ const histogramStyle = {
};
export default class RangePlot extends Component {
+ static propTypes = {
+ value: PropTypes.arrayOf(PropTypes.number).isRequired,
+ histogram: PropTypes.arrayOf(
+ PropTypes.shape({
+ x0: PropTypes.number,
+ x1: PropTypes.number
+ })
+ ),
+ lineChart: PropTypes.object,
+ plotType: PropTypes.string,
+ isEnlarged: PropTypes.bool,
+ onBlur: PropTypes.func,
+ width: PropTypes.number.isRequired
+ };
+
state = {
hoveredDP: null
};
@@ -120,8 +125,6 @@ export default class RangePlot extends Component {
}
}
-RangePlot.propTypes = propTypes;
-
const Histogram = ({
width,
height,
diff --git a/src/components/common/range-slider.js b/src/components/common/range-slider.js
index d7928251e..c2d963833 100644
--- a/src/components/common/range-slider.js
+++ b/src/components/common/range-slider.js
@@ -28,29 +28,6 @@ import {Input} from 'components/common/styled-components';
import {roundValToStep} from 'utils/data-utils';
-const propTypes = {
- range: PropTypes.arrayOf(PropTypes.number).isRequired,
- value0: PropTypes.number.isRequired,
- value1: PropTypes.number.isRequired,
- onChange: PropTypes.func.isRequired,
- histogram: PropTypes.array,
- isRanged: PropTypes.bool,
- isEnlarged: PropTypes.bool,
- showInput: PropTypes.bool,
- inputTheme: PropTypes.string,
- step: PropTypes.number,
- sliderHandleWidth: PropTypes.number,
- xAxis: PropTypes.func
-};
-
-const defaultProps = {
- isEnlarged: false,
- isRanged: true,
- showInput: true,
- sliderHandleWidth: 12,
- onChange: () => {}
-};
-
const SliderInput = Input.extend`
height: 24px;
width: 40px;
@@ -70,6 +47,29 @@ const RangeInputWrapper =styled.div`
`;
export default class RangeSlider extends Component {
+ static propTypes = {
+ range: PropTypes.arrayOf(PropTypes.number).isRequired,
+ value0: PropTypes.number.isRequired,
+ value1: PropTypes.number.isRequired,
+ onChange: PropTypes.func.isRequired,
+ histogram: PropTypes.arrayOf(PropTypes.any),
+ isRanged: PropTypes.bool,
+ isEnlarged: PropTypes.bool,
+ showInput: PropTypes.bool,
+ inputTheme: PropTypes.string,
+ step: PropTypes.number,
+ sliderHandleWidth: PropTypes.number,
+ xAxis: PropTypes.func
+ };
+
+ static defaultProps = {
+ isEnlarged: false,
+ isRanged: true,
+ showInput: true,
+ sliderHandleWidth: 12,
+ onChange: () => {}
+ };
+
state = {value0: 0, value1: 1, width: 288};
componentDidMount() {
@@ -247,7 +247,4 @@ export default class RangeSlider extends Component {
</div>
);
}
-}
-
-RangeSlider.propTypes = propTypes;
-RangeSlider.defaultProps = defaultProps;
+};
diff --git a/src/components/common/slider/slider-bar-handle.js b/src/components/common/slider/slider-bar-handle.js
index 4f1c43871..20631dc04 100644
--- a/src/components/common/slider/slider-bar-handle.js
+++ b/src/components/common/slider/slider-bar-handle.js
@@ -19,23 +19,11 @@
// THE SOFTWARE.
import document from 'global/document';
-import React from 'react';
+import React, {Component} from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
import styled from 'styled-components';
-const propTypes = {
- width: PropTypes.number,
- left: PropTypes.string,
- sliderBarListener: PropTypes.func,
- enableBarDrag: PropTypes.bool
-};
-
-const defaultProps = {
- sliderBarListener: function sliderBarListenerTn() {},
- enableBarDrag: false
-};
-
const StyledSlider = styled.div`
position: relative;
background-color: ${props =>
@@ -58,7 +46,19 @@ const StyledSlider = styled.div`
* onMove
* sliderBarListener
*/
-class SliderHandle extends React.Component {
+export default class SliderHandle extends Component {
+ static propTypes = {
+ width: PropTypes.number,
+ left: PropTypes.string,
+ sliderBarListener: PropTypes.func,
+ enableBarDrag: PropTypes.bool
+ };
+
+ static defaultProps = {
+ sliderBarListener: function sliderBarListenerTn() {},
+ enableBarDrag: false
+ };
+
state = {mouseOver: false};
prevX = 0;
@@ -114,9 +114,4 @@ class SliderHandle extends React.Component {
/>
);
}
-}
-
-SliderHandle.propTypes = propTypes;
-SliderHandle.defaultProps = defaultProps;
-
-export default SliderHandle;
+};
diff --git a/src/components/common/slider/slider-handle.js b/src/components/common/slider/slider-handle.js
index a3780a651..0183bd09c 100644
--- a/src/components/common/slider/slider-handle.js
+++ b/src/components/common/slider/slider-handle.js
@@ -19,25 +19,11 @@
// THE SOFTWARE.
import document from 'global/document';
-import React from 'react';
+import React, {Component} from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
import styled from 'styled-components';
-const propTypes = {
- width: PropTypes.number,
- height: PropTypes.number,
- left: PropTypes.string,
- display: PropTypes.bool,
- valueListener: PropTypes.func
-};
-
-const defaultProps = {
- left: '50%',
- display: true,
- valueListener: function valueListenerFn() {}
-};
-
const StyledSliderHandle = styled.span`
position: absolute;
z-index: 10;
@@ -76,7 +62,21 @@ const StyledSliderHandle = styled.span`
* onMove
* valueListener
*/
-class SliderHandle extends React.Component {
+export default class SliderHandle extends Component {
+ static propTypes = {
+ width: PropTypes.number,
+ height: PropTypes.number,
+ left: PropTypes.string,
+ display: PropTypes.bool,
+ valueListener: PropTypes.func
+ };
+
+ static defaultProps = {
+ left: '50%',
+ display: true,
+ valueListener: function valueListenerFn() {}
+ };
+
state = {mouseOver: false};
prevX = 0;
@@ -131,9 +131,4 @@ class SliderHandle extends React.Component {
/>
);
}
-}
-
-SliderHandle.defaultProps = defaultProps;
-SliderHandle.propTypes = propTypes;
-
-export default SliderHandle;
+};
diff --git a/src/components/common/slider/slider.js b/src/components/common/slider/slider.js
index b1d68363c..1515f9018 100644
--- a/src/components/common/slider/slider.js
+++ b/src/components/common/slider/slider.js
@@ -18,7 +18,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import React from 'react';
+import React, {Component} from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
import styled from 'styled-components';
@@ -28,41 +28,6 @@ import SliderBarHandle from './slider-bar-handle';
function noop() {}
-const propTypes = {
- title: PropTypes.string,
- isRanged: PropTypes.bool,
- value0: PropTypes.number,
- value1: PropTypes.number,
- minValue: PropTypes.number,
- maxValue: PropTypes.number,
- sliderHandleWidth: PropTypes.number,
- onSlider0Change: PropTypes.func,
- onInput0Change: PropTypes.func,
- onSlider1Change: PropTypes.func,
- onInput1Change: PropTypes.func,
- onSliderBarChange: PropTypes.func,
- step: PropTypes.number,
- enableBarDrag: PropTypes.bool
-};
-
-const defaultProps = {
- title: '',
- isRanged: true,
- value0: 0,
- value1: 100,
- minValue: 0,
- maxValue: 100,
- step: 1,
- sliderHandleWidth: 12,
- enableBarDrag: false,
- onSlider0Change: noop,
- onInput0Change: noop,
- onSlider1Change: noop,
- onInput1Change: noop,
- onSliderBarChange: noop,
- disabled: false
-};
-
const StyledRangeSlider = styled.div`
position: relative;
margin-bottom: 12px;
@@ -75,7 +40,41 @@ const SliderWrapper = styled.div`
margin-top: ${props => props.isRanged ? 0 : 10}px;
`;
-class Slider extends React.Component {
+export default class Slider extends Component {
+ static propTypes = {
+ title: PropTypes.string,
+ isRanged: PropTypes.bool,
+ value0: PropTypes.number,
+ value1: PropTypes.number,
+ minValue: PropTypes.number,
+ maxValue: PropTypes.number,
+ sliderHandleWidth: PropTypes.number,
+ onSlider0Change: PropTypes.func,
+ onInput0Change: PropTypes.func,
+ onSlider1Change: PropTypes.func,
+ onInput1Change: PropTypes.func,
+ onSliderBarChange: PropTypes.func,
+ step: PropTypes.number,
+ enableBarDrag: PropTypes.bool
+ };
+
+ static defaultProps = {
+ title: '',
+ isRanged: true,
+ value0: 0,
+ value1: 100,
+ minValue: 0,
+ maxValue: 100,
+ step: 1,
+ sliderHandleWidth: 12,
+ enableBarDrag: false,
+ onSlider0Change: noop,
+ onInput0Change: noop,
+ onSlider1Change: noop,
+ onInput1Change: noop,
+ onSliderBarChange: noop,
+ disabled: false
+ };
ref = undefined;
@@ -171,8 +170,3 @@ class Slider extends React.Component {
);
}
}
-
-Slider.defaultProps = defaultProps;
-Slider.propTypes = propTypes;
-
-export default Slider;
diff --git a/src/components/common/time-range-slider.js b/src/components/common/time-range-slider.js
index 3645d87a5..3024eaa79 100644
--- a/src/components/common/time-range-slider.js
+++ b/src/components/common/time-range-slider.js
@@ -32,20 +32,6 @@ import {getTimeWidgetTitleFormatter, BASE_SPEED} from 'utils/filter-utils';
import RangeSlider from './range-slider';
import TimeSliderMarker from './time-slider-marker';
-const propTypes = {
- onChange: PropTypes.func.isRequired,
- domain: PropTypes.array.isRequired,
- value: PropTypes.array.isRequired,
- step: PropTypes.number.isRequired,
- plotType: PropTypes.string,
- histogram: PropTypes.array,
- lineChart: PropTypes.object,
- toggleAnimation: PropTypes.func.isRequired,
- isAnimatable: PropTypes.bool,
- isEnlarged: PropTypes.bool,
- speed: PropTypes.number
-};
-
const defaultTimeFormat = val => moment.utc(val).format('MM/DD/YY hh:mma');
const StyledSliderContainer = styled.div`
@@ -57,6 +43,20 @@ const StyledSliderContainer = styled.div`
`;
export default class TimeRangeSlider extends Component {
+ static propTypes = {
+ onChange: PropTypes.func.isRequired,
+ domain: PropTypes.arrayOf(PropTypes.number).isRequired,
+ value: PropTypes.arrayOf(PropTypes.number).isRequired,
+ step: PropTypes.number.isRequired,
+ plotType: PropTypes.string,
+ histogram: PropTypes.arrayOf(PropTypes.any),
+ lineChart: PropTypes.object,
+ toggleAnimation: PropTypes.func.isRequired,
+ isAnimatable: PropTypes.bool,
+ isEnlarged: PropTypes.bool,
+ speed: PropTypes.number
+ };
+
constructor(props) {
super(props);
this.state = {
@@ -165,17 +165,17 @@ const TimeValueWrapper = styled.div`
font-size: 11px;
justify-content: ${props => props.isEnlarged ? 'center' : 'space-between'};
color: ${props => props.theme.labelColor};
-
+
.horizontal-bar {
padding: 0 12px;
}
-
+
.time-value {
display: flex;
flex-direction: ${props => props.isEnlarged ? 'row' : 'column'};
align-items: flex-start;
}
-
+
.time-value:last-child {
align-items: flex-end;
}
@@ -208,7 +208,7 @@ const TimeValue = ({value, split}) => (
const StyledAnimationControls = styled.div`
margin-bottom: 12px;
margin-right: 42px;
-
+
&.disabled {
opacity: 0.4;
pointer-events: none;
@@ -243,6 +243,3 @@ const AnimationControls = ({
</ButtonGroup>
</StyledAnimationControls>
);
-
-TimeRangeSlider.propTypes = propTypes;
-TimeRangeSlider.displayName = 'TimeRangeSlider';
diff --git a/src/components/common/time-slider-marker.js b/src/components/common/time-slider-marker.js
index 92b4e6c2a..3ade80a3d 100644
--- a/src/components/common/time-slider-marker.js
+++ b/src/components/common/time-slider-marker.js
@@ -61,14 +61,14 @@ const TimeSliderContainer = styled.svg`
}
`;
-const propTypes = {
- domain: PropTypes.array.isRequired,
- width: PropTypes.number.isRequired
-};
-
const height = 30;
export default class TimeSliderMarker extends Component {
+ static propTypes = {
+ domain: PropTypes.arrayOf(PropTypes.any).isRequired,
+ width: PropTypes.number.isRequired
+ };
+
componentDidMount() {
this._updateAxis(this.scaleSelector(this.props));
}
@@ -123,6 +123,4 @@ export default class TimeSliderMarker extends Component {
</TimeSliderContainer>
);
}
-}
-
-TimeSliderMarker.propTypes = propTypes;
+};
diff --git a/src/components/container.js b/src/components/container.js
index 61506b8ea..3f6f40812 100644
--- a/src/components/container.js
+++ b/src/components/container.js
@@ -32,12 +32,6 @@ import {
renameEntry
} from 'actions/identity-actions';
-// default id and address if not provided
-const defaultProps = {
- id: 'map',
- getState: state => state.keplerGl
-};
-
export const errorMsg = {
noState:
`kepler.gl state doesnt exist. ` +
@@ -55,6 +49,12 @@ ContainerFactory.deps = [KeplerGlFactory];
export function ContainerFactory(KeplerGl) {
class Container extends Component {
+ // default id and address if not provided
+ static defaultProps = {
+ id: 'map',
+ getState: state => state.keplerGl
+ };
+
constructor(props, ctx) {
super(props, ctx);
@@ -108,7 +108,6 @@ export function ContainerFactory(KeplerGl) {
}
}
- Container.defaultProps = defaultProps;
const mapStateToProps = (state, props) => ({state, ...props});
const dispatchToProps = dispatch => ({dispatch});
return connect(mapStateToProps, dispatchToProps)(Container);
diff --git a/src/components/kepler-gl.js b/src/components/kepler-gl.js
index 182a66eae..4d1de3b1d 100644
--- a/src/components/kepler-gl.js
+++ b/src/components/kepler-gl.js
@@ -40,14 +40,6 @@ import PlotContainerFactory from './plot-container';
import {theme} from 'styles/base';
-const defaultProps = {
- mapStyles: [],
- width: 800,
- height: 800,
- appName: 'Kepler.Gl',
- version: 'v1.0'
-};
-
const GlobalStyle = styled.div`
font-family: ff-clan-web-pro, 'Helvetica Neue', Helvetica, sans-serif;
font-weight: 400;
@@ -100,6 +92,14 @@ function KeplerGlFactory(
PlotContainer
) {
class KeplerGL extends Component {
+ static defaultProps = {
+ mapStyles: [],
+ width: 800,
+ height: 800,
+ appName: 'Kepler.Gl',
+ version: 'v1.0'
+ };
+
componentDidMount() {
this._loadMapStyle(this.props.mapStyles);
this._handleResize(this.props);
@@ -305,8 +305,6 @@ function KeplerGlFactory(
}
}
- KeplerGL.defaultProps = defaultProps;
-
return keplerGlConnect(mapStateToProps, mapDispatchToProps)(KeplerGL);
}
diff --git a/src/components/map-container.js b/src/components/map-container.js
index a3a26e882..f90315ab9 100644
--- a/src/components/map-container.js
+++ b/src/components/map-container.js
@@ -48,28 +48,28 @@ const MAP_STYLE = {
const getGlConst = d => GL[d];
-const propTypes = {
- // required
- data: PropTypes.array.isRequired,
- fields: PropTypes.array.isRequired,
- interactionConfig: PropTypes.object.isRequired,
- layerBlending: PropTypes.string.isRequired,
- layerData: PropTypes.array.isRequired,
- layers: PropTypes.array.isRequired,
- mapState: PropTypes.object.isRequired,
- mapStyle: PropTypes.object.isRequired,
- popoverOffset: PropTypes.object.isRequired,
-
- // optional
- mapLayers: PropTypes.object,
- onMapToggleLayer: PropTypes.func
-};
const MAPBOXGL_STYLE_UPDATE = 'style.load';
MapContainerFactory.deps = [
MapPopoverFactory, MapControlFactory];
export default function MapContainerFactory(MapPopover, MapControl) {
class MapContainer extends Component {
+ static propTypes = {
+ // required
+ data: PropTypes.arrayOf(PropTypes.any),
+ fields: PropTypes.arrayOf(PropTypes.any),
+ interactionConfig: PropTypes.object.isRequired,
+ layerBlending: PropTypes.string.isRequired,
+ layerData: PropTypes.arrayOf(PropTypes.any).isRequired,
+ layers: PropTypes.arrayOf(PropTypes.any).isRequired,
+ mapState: PropTypes.object.isRequired,
+ mapStyle: PropTypes.object.isRequired,
+
+ // optional
+ mapLayers: PropTypes.object,
+ onMapToggleLayer: PropTypes.func
+ };
+
constructor(props) {
super(props);
this.state = {
@@ -443,7 +443,5 @@ export default function MapContainerFactory(MapPopover, MapControl) {
}
}
- MapContainer.propsTypes = propTypes;
-
return MapContainer;
}
diff --git a/src/components/map/map-control.js b/src/components/map/map-control.js
index 12c66ef95..6f17b31e7 100644
--- a/src/components/map/map-control.js
+++ b/src/components/map/map-control.js
@@ -114,20 +114,6 @@ const StyledMapControlPanelHeader = styled.div`
}
`;
-const propTypes = {
- dragRotate: PropTypes.bool.isRequired,
- isSplit: PropTypes.bool.isRequired,
- onToggleFullScreen: PropTypes.func.isRequired,
- onTogglePerspective: PropTypes.func.isRequired,
- onToggleSplitMap: PropTypes.func.isRequired,
- top: PropTypes.number.isRequired
-};
-
-const defaultProps = {
- isSplit: false,
- top: 0
-};
-
/**
* Generates all layers available for the current map
* TODO: this may be moved into map-container or map-control or even at the reducer level
@@ -175,6 +161,20 @@ const layerSelector = (layers, mapLayers) => {
};
export class MapControl extends Component {
+ static propTypes = {
+ dragRotate: PropTypes.bool.isRequired,
+ isSplit: PropTypes.bool.isRequired,
+ onToggleFullScreen: PropTypes.func.isRequired,
+ onTogglePerspective: PropTypes.func.isRequired,
+ onToggleSplitMap: PropTypes.func.isRequired,
+ top: PropTypes.number.isRequired
+ };
+
+ static defaultProps = {
+ isSplit: false,
+ top: 0
+ };
+
constructor(props) {
super(props);
this.state = {
@@ -353,8 +353,5 @@ const MapLegendTooltip = ({id, message}) => (
</Tooltip>
);
-MapControl.propTypes = propTypes;
-MapControl.defaultProps = defaultProps;
-
const MapControlFactory = () => MapControl;
export default MapControlFactory;
diff --git a/src/components/map/map-popover.js b/src/components/map/map-popover.js
index b0bd14f41..b8fdca094 100644
--- a/src/components/map/map-popover.js
+++ b/src/components/map/map-popover.js
@@ -29,21 +29,8 @@ import {FIELD_DISPLAY_FORMAT} from 'constants/default-settings';
const MAX_WIDTH = 400;
const MAX_HEIGHT = 600;
-const propTypes = {
- fields: PropTypes.array,
- fieldsToShow: PropTypes.array,
- isVisible: PropTypes.bool,
- layer: PropTypes.object,
- data: PropTypes.oneOfType([PropTypes.array, PropTypes.object]),
- freezed: PropTypes.bool,
- x: PropTypes.number,
- y: PropTypes.number,
- onClose: PropTypes.func,
- mapState: PropTypes.object.isRequired
-};
-
const StyledMapPopover = styled.div`
- ${props => props.theme.scrollBar}
+ ${props => props.theme.scrollBar}
font-size: 11px;
font-weight: 500;
background-color: ${props => props.theme.panelBackground};
@@ -51,7 +38,7 @@ const StyledMapPopover = styled.div`
z-index: 1001;
position: absolute;
overflow-x: auto;
-
+
.gutter {
height: 6px;
}
@@ -59,18 +46,18 @@ const StyledMapPopover = styled.div`
table {
margin: 2px 12px 12px 12px;
width: auto;
-
+
tbody {
border-top: transparent;
border-bottom: transparent;
}
-
+
td {
border-color: transparent;
padding: 4px;
color: ${props => props.theme.textColor};
}
-
+
td.row__value {
text-align: right;
font-weight: 500;
@@ -99,13 +86,26 @@ const StyledLayerName = CenterFlexbox.extend`
text-transform: capitalize;
padding-left: 14px;
margin-top: 12px;
-
+
svg {
margin-right: 4px;
}
`;
export class MapPopover extends Component {
+ static propTypes = {
+ fields: PropTypes.arrayOf(PropTypes.any),
+ fieldsToShow: PropTypes.arrayOf(PropTypes.any),
+ isVisible: PropTypes.bool,
+ layer: PropTypes.object,
+ data: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.any), PropTypes.object]),
+ freezed: PropTypes.bool,
+ x: PropTypes.number,
+ y: PropTypes.number,
+ onClose: PropTypes.func,
+ mapState: PropTypes.object.isRequired
+ };
+
constructor(props) {
super(props);
this.state = {
@@ -296,7 +296,5 @@ function _getCellFormat(type) {
return FIELD_DISPLAY_FORMAT[type];
}
-MapPopover.propTypes = propTypes;
-
const MapPopoverFactory = () => MapPopover;
export default MapPopoverFactory;
diff --git a/src/components/modal-container.js b/src/components/modal-container.js
index 90fc60028..eb7470c42 100644
--- a/src/components/modal-container.js
+++ b/src/components/modal-container.js
@@ -49,20 +49,6 @@ import {
ADD_MAP_STYLE_ID
} from 'constants/default-settings';
-const propTypes = {
- rootNode: PropTypes.object,
- containerW: PropTypes.number,
- containerH: PropTypes.number,
- mapboxApiAccessToken: PropTypes.string.isRequired,
- mapState: PropTypes.object.isRequired,
- mapStyle: PropTypes.object.isRequired,
- uiState: PropTypes.object.isRequired,
- visState: PropTypes.object.isRequired,
- visStateActions: PropTypes.object.isRequired,
- uiStateActions: PropTypes.object.isRequired,
- mapStyleActions: PropTypes.object.isRequired
-};
-
const DataTableModalStyle = css`
height: 85%;
width: 90%;
@@ -100,6 +86,20 @@ export default function ModalContainerFactory(
AddMapStyleModal
) {
class ModalWrapper extends Component {
+ static propTypes = {
+ rootNode: PropTypes.object,
+ containerW: PropTypes.number,
+ containerH: PropTypes.number,
+ mapboxApiAccessToken: PropTypes.string.isRequired,
+ mapState: PropTypes.object.isRequired,
+ mapStyle: PropTypes.object.isRequired,
+ uiState: PropTypes.object.isRequired,
+ visState: PropTypes.object.isRequired,
+ visStateActions: PropTypes.object.isRequired,
+ uiStateActions: PropTypes.object.isRequired,
+ mapStyleActions: PropTypes.object.isRequired
+ };
+
_closeModal = () => {
this.props.uiStateActions.toggleModal(null);
};
@@ -353,7 +353,5 @@ export default function ModalContainerFactory(
}
}
- ModalWrapper.propTypes = propTypes;
-
return ModalWrapper;
}
diff --git a/src/components/side-panel.js b/src/components/side-panel.js
index 11ed69da9..7c3b605ee 100644
--- a/src/components/side-panel.js
+++ b/src/components/side-panel.js
@@ -39,19 +39,6 @@ import {
PANELS
} from 'constants/default-settings';
-const propTypes = {
- filters: PropTypes.array.isRequired,
- interactionConfig: PropTypes.object.isRequired,
- layerBlending: PropTypes.string.isRequired,
- layers: PropTypes.array.isRequired,
- layerClasses: PropTypes.object.isRequired,
- mapStyle: PropTypes.object.isRequired,
- width: PropTypes.number.isRequired,
- datasets: PropTypes.object.isRequired,
- visStateActions: PropTypes.object.isRequired,
- mapStyleActions: PropTypes.object.isRequired
-};
-
const SidePanelContent = styled.div`
${props => props.theme.sidePanelScrollBar};
flex-grow: 1;
@@ -76,7 +63,19 @@ SidePanelFactory.deps = [PanelHeaderFactory];
*/
export default function SidePanelFactory(PanelHeader) {
- class SidePanel extends Component {
+ return class SidePanel extends Component {
+ static propTypes = {
+ filters: PropTypes.arrayOf(PropTypes.any).isRequired,
+ interactionConfig: PropTypes.object.isRequired,
+ layerBlending: PropTypes.string.isRequired,
+ layers: PropTypes.arrayOf(PropTypes.any).isRequired,
+ layerClasses: PropTypes.object.isRequired,
+ mapStyle: PropTypes.object.isRequired,
+ width: PropTypes.number.isRequired,
+ datasets: PropTypes.object.isRequired,
+ visStateActions: PropTypes.object.isRequired,
+ mapStyleActions: PropTypes.object.isRequired
+ };
/* component private functions */
_onOpenOrClose = () => {
@@ -226,9 +225,5 @@ export default function SidePanelFactory(PanelHeader) {
</div>
);
}
- }
-
- SidePanel.propTypes = propTypes;
-
- return SidePanel;
+ };
}
diff --git a/src/components/side-panel/filter-manager.js b/src/components/side-panel/filter-manager.js
index 5c3eb46ba..2a4e0a7b4 100644
--- a/src/components/side-panel/filter-manager.js
+++ b/src/components/side-panel/filter-manager.js
@@ -30,21 +30,21 @@ import {Add} from 'components/common/icons';
import SourceDataCatalog from './source-data-catalog';
import FilterPanel from './filter-panel/filter-panel';
-const propTypes = {
- datasets: PropTypes.object,
- addFilter: PropTypes.func.isRequired,
- removeFilter: PropTypes.func.isRequired,
- enlargeFilter: PropTypes.func.isRequired,
- toggleAnimation: PropTypes.func.isRequired,
- setFilter: PropTypes.func.isRequired,
- filters: PropTypes.array.isRequired,
- showDatasetTable: PropTypes.func,
+export default class FilterManager extends Component {
+ static propTypes = {
+ datasets: PropTypes.object,
+ addFilter: PropTypes.func.isRequired,
+ removeFilter: PropTypes.func.isRequired,
+ enlargeFilter: PropTypes.func.isRequired,
+ toggleAnimation: PropTypes.func.isRequired,
+ setFilter: PropTypes.func.isRequired,
+ filters: PropTypes.arrayOf(PropTypes.any).isRequired,
+ showDatasetTable: PropTypes.func,
- // fields can be undefined when dataset is not selected
- fields: PropTypes.array
-};
+ // fields can be undefined when dataset is not selected
+ fields: PropTypes.arrayOf(PropTypes.any)
+ };
-export default class FilterManager extends Component {
/* selectors */
datasetsSelector = state => state.datasets;
defaultDatasetSelector = createSelector(
@@ -99,6 +99,4 @@ export default class FilterManager extends Component {
</div>
);
}
-}
-
-FilterManager.propTypes = propTypes;
+};
diff --git a/src/components/side-panel/filter-panel/filter-panel.js b/src/components/side-panel/filter-panel/filter-panel.js
index cfc34c03c..adceec4c8 100644
--- a/src/components/side-panel/filter-panel/filter-panel.js
+++ b/src/components/side-panel/filter-panel/filter-panel.js
@@ -32,19 +32,6 @@ import * as Filters from 'components/filters';
import {FILTER_TYPES, FILTER_COMPONENTS} from 'utils/filter-utils';
import {ALL_FIELD_TYPES} from 'constants/default-settings';
-const propTypes = {
- idx: PropTypes.number,
- filters: PropTypes.array.isRequired,
- filter: PropTypes.object.isRequired,
- setFilter: PropTypes.func.isRequired,
- removeFilter: PropTypes.func.isRequired,
- enlargeFilter: PropTypes.func.isRequired,
- toggleAnimation: PropTypes.func.isRequired,
- datasets: PropTypes.object,
- showDatasetTable: PropTypes.func,
- isAnyFilterAnimating: PropTypes.bool
-};
-
const StyledFilterPanel = styled.div`
margin-bottom: 12px;
border-radius: 1px;
@@ -65,6 +52,19 @@ const StyledFilterContent = styled.div`
`;
export default class FilterPanel extends Component {
+ static propTypes = {
+ idx: PropTypes.number,
+ filters: PropTypes.arrayOf(PropTypes.any).isRequired,
+ filter: PropTypes.object.isRequired,
+ setFilter: PropTypes.func.isRequired,
+ removeFilter: PropTypes.func.isRequired,
+ enlargeFilter: PropTypes.func.isRequired,
+ toggleAnimation: PropTypes.func.isRequired,
+ datasets: PropTypes.object,
+ showDatasetTable: PropTypes.func,
+ isAnyFilterAnimating: PropTypes.bool
+ };
+
/* selectors */
fieldsSelector = props =>
(props.filter.dataId && props.datasets[props.filter.dataId].fields) || [];
@@ -161,5 +161,3 @@ export default class FilterPanel extends Component {
);
}
}
-
-FilterPanel.propTypes = propTypes;
diff --git a/src/components/side-panel/interaction-panel/interaction-panel.js b/src/components/side-panel/interaction-panel/interaction-panel.js
index db8f25bf2..3a80d95c6 100644
--- a/src/components/side-panel/interaction-panel/interaction-panel.js
+++ b/src/components/side-panel/interaction-panel/interaction-panel.js
@@ -35,12 +35,6 @@ import {
import {DatasetTag} from '../source-data-catalog';
import {BRUSH_CONFIG} from 'utils/interaction-utils';
-const propTypes = {
- datasets: PropTypes.object.isRequired,
- config: PropTypes.object.isRequired,
- onConfigChange: PropTypes.func.isRequired
-};
-
const StyledPanelContent = PanelContent.extend`
border-top: 1px solid ${props => props.theme.panelBorderColor};
`;
@@ -50,6 +44,12 @@ const StyledInteractionPanel = styled.div`
`;
export default class InteractionPanel extends Component {
+ static propTypes = {
+ datasets: PropTypes.object.isRequired,
+ config: PropTypes.object.isRequired,
+ onConfigChange: PropTypes.func.isRequired
+ };
+
state = {isConfigActive: false};
_updateConfig = newProp => {
@@ -121,8 +121,6 @@ export default class InteractionPanel extends Component {
}
}
-InteractionPanel.propTypes = propTypes;
-
const TooltipConfig = ({config, datasets, width, onChange}) => (
<div>
{Object.keys(config.fieldsToShow).map(dataId => (
diff --git a/src/components/side-panel/layer-manager.js b/src/components/side-panel/layer-manager.js
index a37956916..964e120a4 100644
--- a/src/components/side-panel/layer-manager.js
+++ b/src/components/side-panel/layer-manager.js
@@ -37,24 +37,6 @@ import {
import {LAYER_BLENDINGS} from 'constants/default-settings';
-const propTypes = {
- addLayer: PropTypes.func.isRequired,
- datasets: PropTypes.object.isRequired,
- layerBlending: PropTypes.string.isRequired,
- layerClasses: PropTypes.object.isRequired,
- layers: PropTypes.array.isRequired,
- layerConfigChange: PropTypes.func.isRequired,
- layerVisualChannelConfigChange: PropTypes.func.isRequired,
- layerTypeChange: PropTypes.func.isRequired,
- layerVisConfigChange: PropTypes.func.isRequired,
- openModal: PropTypes.func.isRequired,
- removeLayer: PropTypes.func.isRequired,
- removeDataset: PropTypes.func.isRequired,
- showDatasetTable: PropTypes.func.isRequired,
- updateLayerBlending: PropTypes.func.isRequired,
- updateLayerOrder: PropTypes.func.isRequired
-};
-
const StyledSortable = styled.div`
.ui-sortable {
display: block;
@@ -96,6 +78,24 @@ const StyledSortable = styled.div`
`;
export default class LayerManager extends Component {
+ static propTypes = {
+ addLayer: PropTypes.func.isRequired,
+ datasets: PropTypes.object.isRequired,
+ layerBlending: PropTypes.string.isRequired,
+ layerClasses: PropTypes.object.isRequired,
+ layers: PropTypes.arrayOf(PropTypes.any).isRequired,
+ layerConfigChange: PropTypes.func.isRequired,
+ layerVisualChannelConfigChange: PropTypes.func.isRequired,
+ layerTypeChange: PropTypes.func.isRequired,
+ layerVisConfigChange: PropTypes.func.isRequired,
+ openModal: PropTypes.func.isRequired,
+ removeLayer: PropTypes.func.isRequired,
+ removeDataset: PropTypes.func.isRequired,
+ showDatasetTable: PropTypes.func.isRequired,
+ updateLayerBlending: PropTypes.func.isRequired,
+ updateLayerOrder: PropTypes.func.isRequired
+ };
+
layerClassSelector = props => props.layerClasses;
layerTypeOptionsSelector = createSelector(
this.layerClassSelector,
@@ -183,8 +183,6 @@ export default class LayerManager extends Component {
}
}
-LayerManager.propTypes = propTypes;
-
const LayerBlendingSelector = ({layerBlending, updateLayerBlending}) => (
<SidePanelSection>
<PanelLabel>Layer Blending</PanelLabel>
diff --git a/src/components/side-panel/layer-panel/color-range-selector.js b/src/components/side-panel/layer-panel/color-range-selector.js
index 774a76c8b..a3679d68f 100644
--- a/src/components/side-panel/layer-panel/color-range-selector.js
+++ b/src/components/side-panel/layer-panel/color-range-selector.js
@@ -33,17 +33,6 @@ import {COLOR_RANGES} from 'constants/color-ranges';
const ALL_TYPES = uniq(COLOR_RANGES.map(c => c.type).concat(['all']));
const ALL_STEPS = uniq(COLOR_RANGES.map(d => d.colors.length));
-const propTypes = {
- colorRanges: PropTypes.array,
- selectedColorRange: PropTypes.object,
- onSelectColorRange: PropTypes.func.isRequired
-};
-
-const defaultProps = {
- colorRanges: COLOR_RANGES,
- onSelectColorRange: () => {}
-};
-
const StyledColorConfig = styled.div`
padding: 12px 12px 0 12px;
`;
@@ -52,6 +41,17 @@ const ColorRangeSelector = styled.div`
padding-bottom: 12px;
`;
export default class ColorRangeSelect extends Component {
+ static propTypes = {
+ colorRanges: PropTypes.arrayOf(PropTypes.any),
+ selectedColorRange: PropTypes.object,
+ onSelectColorRange: PropTypes.func.isRequired
+ };
+
+ static defaultProps = {
+ colorRanges: COLOR_RANGES,
+ onSelectColorRange: () => {}
+ };
+
state = {
config: {
type: {
@@ -232,6 +232,3 @@ const ColorPaletteGroup = ({config = {}, onSelect, selected, colorRanges}) => {
</div>
);
};
-
-ColorRangeSelect.propTypes = propTypes;
-ColorRangeSelect.defaultProps = defaultProps;
diff --git a/src/components/side-panel/layer-panel/color-selector.js b/src/components/side-panel/layer-panel/color-selector.js
index 04366e2da..9cf56bd8a 100644
--- a/src/components/side-panel/layer-panel/color-selector.js
+++ b/src/components/side-panel/layer-panel/color-selector.js
@@ -31,23 +31,6 @@ import {
} from 'components/common/styled-components';
import listensToClickOutside from 'react-onclickoutside/decorator';
-const propTypes = {
- colorSets: PropTypes.arrayOf(
- PropTypes.shape({
- selectedColor: PropTypes.oneOfType([PropTypes.array, PropTypes.object]),
- setColor: PropTypes.func.isRequired,
- isRange: PropTypes.bool,
- label: PropTypes.string
- })
- ),
- inputTheme: PropTypes.string,
- disabled: PropTypes.bool
-};
-
-const defaultProps = {
- colorSets: []
-};
-
const ColorBlock = styled.div`
width: 32px;
height: 18px;
@@ -76,6 +59,23 @@ const InputBoxContainer = styled.div`
`;
class ColorSelector extends Component {
+ static propTypes = {
+ colorSets: PropTypes.arrayOf(
+ PropTypes.shape({
+ selectedColor: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.any), PropTypes.object]),
+ setColor: PropTypes.func.isRequired,
+ isRange: PropTypes.bool,
+ label: PropTypes.string
+ })
+ ),
+ inputTheme: PropTypes.string,
+ disabled: PropTypes.bool
+ };
+
+ static defaultProps = {
+ colorSets: []
+ };
+
state = {
editing: false
};
@@ -147,9 +147,6 @@ class ColorSelector extends Component {
</div>
);
}
-}
-
-ColorSelector.propTypes = propTypes;
-ColorSelector.defaultProps = defaultProps;
+};
export default listensToClickOutside(ColorSelector);
diff --git a/src/components/side-panel/layer-panel/layer-column-config.js b/src/components/side-panel/layer-panel/layer-column-config.js
index 20f7933cd..cb828ccab 100644
--- a/src/components/side-panel/layer-panel/layer-column-config.js
+++ b/src/components/side-panel/layer-panel/layer-column-config.js
@@ -31,20 +31,20 @@ import {
SidePanelSection
} from 'components/common/styled-components';
-const propTypes = {
- layer: PropTypes.object.isRequired,
- fields: PropTypes.array.isRequired,
- updateLayerConfig: PropTypes.func.isRequired,
- openModal: PropTypes.func.isRequired,
- fieldPairs: PropTypes.array
-};
-
const TopRow = styled.div`
display: flex;
justify-content: space-between;
`;
export default class LayerColumnConfig extends Component {
+ static propTypes = {
+ layer: PropTypes.object.isRequired,
+ fields: PropTypes.arrayOf(PropTypes.any).isRequired,
+ updateLayerConfig: PropTypes.func.isRequired,
+ openModal: PropTypes.func.isRequired,
+ fieldPairs: PropTypes.arrayOf(PropTypes.any)
+ };
+
_updateColumn(key, value) {
const {layer} = this.props;
@@ -92,9 +92,7 @@ export default class LayerColumnConfig extends Component {
</div>
);
}
-}
-
-LayerColumnConfig.propTypes = propTypes;
+};
const ColumnRow = styled.div`
display: flex;
diff --git a/src/components/side-panel/layer-panel/layer-configurator.js b/src/components/side-panel/layer-panel/layer-configurator.js
index ea97117ee..bc15ca291 100644
--- a/src/components/side-panel/layer-panel/layer-configurator.js
+++ b/src/components/side-panel/layer-panel/layer-configurator.js
@@ -48,17 +48,6 @@ import {
CHANNEL_SCALE_SUPPORTED_FIELDS
} from 'constants/default-settings';
-const propTypes = {
- layer: PropTypes.object.isRequired,
- datasets: PropTypes.object.isRequired,
- layerTypeOptions: PropTypes.array.isRequired,
- openModal: PropTypes.func.isRequired,
- updateLayerConfig: PropTypes.func.isRequired,
- updateLayerType: PropTypes.func.isRequired,
- updateLayerVisConfig: PropTypes.func.isRequired,
- updateLayerVisualChannelConfig: PropTypes.func.isRequired
-};
-
const StyledLayerConfigurator = styled.div.attrs({
className: 'layer-panel__config'
})`
@@ -72,6 +61,17 @@ const StyledLayerVisualConfigurator = styled.div.attrs({
`;
export default class LayerConfigurator extends Component {
+ static propTypes = {
+ layer: PropTypes.object.isRequired,
+ datasets: PropTypes.object.isRequired,
+ layerTypeOptions: PropTypes.arrayOf(PropTypes.any).isRequired,
+ openModal: PropTypes.func.isRequired,
+ updateLayerConfig: PropTypes.func.isRequired,
+ updateLayerType: PropTypes.func.isRequired,
+ updateLayerVisConfig: PropTypes.func.isRequired,
+ updateLayerVisualChannelConfig: PropTypes.func.isRequired
+ };
+
_renderPointLayerConfig(props) {
return this._renderScatterplotLayerConfig(props);
}
@@ -626,8 +626,6 @@ export default class LayerConfigurator extends Component {
}
}
-LayerConfigurator.propTypes = propTypes;
-
/*
* Componentize config component into pure functional components
*/
diff --git a/src/components/side-panel/layer-panel/layer-panel.js b/src/components/side-panel/layer-panel/layer-panel.js
index 7bf991edd..e0bafa3ed 100644
--- a/src/components/side-panel/layer-panel/layer-panel.js
+++ b/src/components/side-panel/layer-panel/layer-panel.js
@@ -26,26 +26,11 @@ import {sortable} from 'react-anything-sortable';
import LayerConfigurator from './layer-configurator';
import LayerPanelHeader from './layer-panel-header';
-const propTypes = {
- layer: PropTypes.object.isRequired,
- datasets: PropTypes.object.isRequired,
- idx: PropTypes.number.isRequired,
- layerConfigChange: PropTypes.func.isRequired,
- layerTypeChange: PropTypes.func.isRequired,
- openModal: PropTypes.func.isRequired,
- removeLayer: PropTypes.func.isRequired,
- onCloseConfig: PropTypes.func,
-
- layerTypeOptions: PropTypes.array,
- layerVisConfigChange: PropTypes.func,
- layerVisualChannelConfigChange: PropTypes.func
-};
-
const PanelWrapper = styled.div`
font-size: 12px;
border-radius: 1px;
margin-bottom: 8px;
-
+
&.dragging {
cursor: move;
}
@@ -53,6 +38,21 @@ const PanelWrapper = styled.div`
@sortable
export default class LayerPanel extends Component {
+ static propTypes = {
+ layer: PropTypes.object.isRequired,
+ datasets: PropTypes.object.isRequired,
+ idx: PropTypes.number.isRequired,
+ layerConfigChange: PropTypes.func.isRequired,
+ layerTypeChange: PropTypes.func.isRequired,
+ openModal: PropTypes.func.isRequired,
+ removeLayer: PropTypes.func.isRequired,
+ onCloseConfig: PropTypes.func,
+
+ layerTypeOptions: PropTypes.arrayOf(PropTypes.any),
+ layerVisConfigChange: PropTypes.func,
+ layerVisualChannelConfigChange: PropTypes.func
+ };
+
updateLayerConfig = newProp => {
this.props.layerConfigChange(this.props.layer, newProp);
};
@@ -136,6 +136,3 @@ export default class LayerPanel extends Component {
);
}
}
-
-LayerPanel.propTypes = propTypes;
-LayerPanel.displayName = 'LayerPanel';
diff --git a/src/components/side-panel/layer-panel/vis-config-by-field-selector.js b/src/components/side-panel/layer-panel/vis-config-by-field-selector.js
index 936421a81..a4f2feb53 100644
--- a/src/components/side-panel/layer-panel/vis-config-by-field-selector.js
+++ b/src/components/side-panel/layer-panel/vis-config-by-field-selector.js
@@ -31,24 +31,24 @@ import InfoHelper from 'components/common/info-helper';
import DimensionScaleSelector from './dimension-scale-selector';
import {capitalizeFirstLetter} from 'utils/utils';
-const propTypes = {
- channel: PropTypes.string.isRequired,
- domain: PropTypes.array.isRequired,
- fields: PropTypes.array.isRequired,
- id: PropTypes.string.isRequired,
- property: PropTypes.string.isRequired,
- scaleType: PropTypes.string.isRequired,
- showScale: PropTypes.bool.isRequired,
- updateField: PropTypes.func.isRequired,
- updateScale: PropTypes.func.isRequired,
+export default class VisConfigByFieldSelector extends Component {
+ static propTypes = {
+ channel: PropTypes.string.isRequired,
+ domain: PropTypes.arrayOf(PropTypes.any).isRequired,
+ fields: PropTypes.arrayOf(PropTypes.any).isRequired,
+ id: PropTypes.string.isRequired,
+ property: PropTypes.string.isRequired,
+ scaleType: PropTypes.string.isRequired,
+ showScale: PropTypes.bool.isRequired,
+ updateField: PropTypes.func.isRequired,
+ updateScale: PropTypes.func.isRequired,
- // optional
- selectedField: PropTypes.object,
- description: PropTypes.string,
- label: PropTypes.string
-};
+ // optional
+ selectedField: PropTypes.object,
+ description: PropTypes.string,
+ label: PropTypes.string
+ };
-export default class VisConfigByFieldSelector extends Component {
_updateVisByField = val => {
this.props.updateField(val);
};
@@ -97,6 +97,4 @@ export default class VisConfigByFieldSelector extends Component {
</SidePanelSection>
);
}
-}
-
-VisConfigByFieldSelector.propTypes = propTypes;
+};
diff --git a/src/components/side-panel/panel-dropdown.js b/src/components/side-panel/panel-dropdown.js
index 47cc0a75c..d4e36b198 100644
--- a/src/components/side-panel/panel-dropdown.js
+++ b/src/components/side-panel/panel-dropdown.js
@@ -23,11 +23,11 @@ import PropTypes from 'prop-types';
import {StyledPanelDropdown} from 'components/common/styled-components';
import listensToClickOutside from 'react-onclickoutside/decorator';
-const propTypes = {
- onClose: PropTypes.func
-};
-
class PanelDropdown extends Component {
+ static propTypes = {
+ onClose: PropTypes.func
+ };
+
handleClickOutside = (e) => {
this.props.onClose(e);
};
@@ -39,8 +39,6 @@ class PanelDropdown extends Component {
</StyledPanelDropdown>
);
}
-}
-
-PanelDropdown.propTypes = propTypes;
+};
export default listensToClickOutside(PanelDropdown);
diff --git a/src/components/side-panel/panel-header-action.js b/src/components/side-panel/panel-header-action.js
index a8966e0d7..2ddcc36c4 100644
--- a/src/components/side-panel/panel-header-action.js
+++ b/src/components/side-panel/panel-header-action.js
@@ -24,24 +24,6 @@ import classnames from 'classnames';
import styled from 'styled-components';
import {Tooltip} from 'components/common/styled-components';
-const propTypes = {
- id: PropTypes.string,
- flush: PropTypes.bool,
- tooltip: PropTypes.string,
- onClick: PropTypes.func,
- active: PropTypes.bool,
- disabled: PropTypes.bool,
- hoverColor: PropTypes.string,
- className: PropTypes.string,
- tooltipType: PropTypes.string
-};
-
-const defaultProps = {
- onClick: () => {},
- hoverColor: null,
- active: false
-};
-
const HeaderActionWrapper = styled.div`
margin-left: ${props => (props.flush ? 0 : 8)}px;
display: flex;
@@ -67,6 +49,24 @@ const HeaderActionWrapper = styled.div`
// Need to use react class to access props.component
export default class PanelHeaderAction extends Component {
+ static propTypes = {
+ id: PropTypes.string,
+ flush: PropTypes.bool,
+ tooltip: PropTypes.string,
+ onClick: PropTypes.func,
+ active: PropTypes.bool,
+ disabled: PropTypes.bool,
+ hoverColor: PropTypes.string,
+ className: PropTypes.string,
+ tooltipType: PropTypes.string
+ };
+
+ static defaultProps = {
+ onClick: () => {},
+ hoverColor: null,
+ active: false
+ };
+
render() {
const {
onClick,
@@ -105,7 +105,4 @@ export default class PanelHeaderAction extends Component {
</HeaderActionWrapper>
);
}
-}
-
-PanelHeaderAction.defaultProps = defaultProps;
-PanelHeaderAction.propTypes = propTypes;
+};
diff --git a/src/components/side-panel/panel-header.js b/src/components/side-panel/panel-header.js
index 460d8bdfb..00eafebcc 100644
--- a/src/components/side-panel/panel-header.js
+++ b/src/components/side-panel/panel-header.js
@@ -60,16 +60,16 @@ const StyledPanelAction = styled.div.attrs({
justify-content: center;
margin-left: 4px;
width: 26px;
-
+
a {
height: 20px;
}
-
+
:hover {
cursor: pointer;
background-color: ${props => props.theme.secondaryBtnActBgd};
color: ${props => props.theme.textColorHl};
-
+
a {
color: ${props => props.theme.textColorHl};
}
@@ -89,7 +89,7 @@ const StyledPanelDropdown = styled.div`
transform: translateX(calc(-50% + 20px));
pointer-events: ${props => props.show ? 'all' : 'none'};
z-index: 1000;
-
+
.save-export-dropdown__inner {
box-shadow: none;
background-color: transparent;
@@ -120,11 +120,6 @@ const StyledPanelDropdown = styled.div`
}
`;
-const propTypes = {
- logoComponent: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
- actionItems: PropTypes.array
-};
-
export const PanelAction = ({item, onClick}) => (
<StyledPanelAction className="side-panel__panel-header__action"
data-tip data-for={`${item.id}-action`} onClick={onClick}>
@@ -196,13 +191,18 @@ const defaultActionItems = [
}
];
-const defaultProps = {
- logoComponent: KeplerGlLogo,
- actionItems: defaultActionItems
-};
-
function PanelHeaderFactory() {
- class PanelHeader extends Component {
+ return class PanelHeader extends Component {
+ static propTypes = {
+ logoComponent: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
+ actionItems: PropTypes.arrayOf(PropTypes.any)
+ };
+
+ static defaultProps = {
+ logoComponent: KeplerGlLogo,
+ actionItems: defaultActionItems
+ };
+
state = {
dropdown: null
};
@@ -261,11 +261,6 @@ function PanelHeaderFactory() {
);
}
}
-
- PanelHeader.defaultProps = defaultProps;
- PanelHeader.propTypes = propTypes;
-
- return PanelHeader;
}
export default PanelHeaderFactory;
diff --git a/src/components/side-panel/side-bar.js b/src/components/side-panel/side-bar.js
index ed0b17d0b..91d97248e 100644
--- a/src/components/side-panel/side-bar.js
+++ b/src/components/side-panel/side-bar.js
@@ -23,20 +23,6 @@ import PropTypes from 'prop-types';
import styled from 'styled-components';
import {ArrowRight} from 'components/common/icons';
-const defaultProps = {
- width: 300,
- minifiedWidth: 0,
- isOpen: true,
- onOpenOrClose: function noop() {}
-};
-
-const propTypes = {
- width: PropTypes.number,
- isOpen: PropTypes.bool,
- minifiedWidth: PropTypes.number,
- onOpenOrClose: PropTypes.func
-};
-
const StyledSidePanelContainer = styled.div`
z-index: 99;
height: 100%;
@@ -85,6 +71,20 @@ const CollapseButton = styled.div`
`;
export default class SideBar extends Component {
+ static defaultProps = {
+ width: 300,
+ minifiedWidth: 0,
+ isOpen: true,
+ onOpenOrClose: function noop() {}
+ };
+
+ static propTypes = {
+ width: PropTypes.number,
+ isOpen: PropTypes.bool,
+ minifiedWidth: PropTypes.number,
+ onOpenOrClose: PropTypes.func
+ };
+
_onOpenOrClose = () => {
this.props.onOpenOrClose({isOpen: !this.props.isOpen});
};
@@ -118,7 +118,4 @@ export default class SideBar extends Component {
</StyledSidePanelContainer>
);
}
-}
-
-SideBar.propTypes = propTypes;
-SideBar.defaultProps = defaultProps;
+};
diff --git a/src/layers/arc-layer/arc-layer-icon.js b/src/layers/arc-layer/arc-layer-icon.js
index cdf99ee10..5d184f9cb 100644
--- a/src/layers/arc-layer/arc-layer-icon.js
+++ b/src/layers/arc-layer/arc-layer-icon.js
@@ -22,19 +22,19 @@ import React, {Component} from 'react';
import PropTypes from 'prop-types';
import Base from 'components/common/icons/base';
-const propTypes = {
- /** Set the height of the icon, ex. '16px' */
- height: PropTypes.string,
- colors: PropTypes.arrayOf(PropTypes.string)
-};
+class ArcLayerIcon extends Component {
+ static propTypes = {
+ /** Set the height of the icon, ex. '16px' */
+ height: PropTypes.string,
+ colors: PropTypes.arrayOf(PropTypes.string)
+ };
-const defaultProps = {
- height: '16px',
- predefinedClassName: 'point-layer-icon',
- totalColor: 4
-};
+ static defaultProps = {
+ height: '16px',
+ predefinedClassName: 'point-layer-icon',
+ totalColor: 4
+ };
-class ArcLayerIcon extends Component {
render() {
return (
<Base {...this.props}>
@@ -63,8 +63,5 @@ class ArcLayerIcon extends Component {
);
}
};
-ArcLayerIcon.displayName = 'ArcLayerIcon';
-ArcLayerIcon.propTypes = propTypes;
-ArcLayerIcon.defaultProps = defaultProps;
export default ArcLayerIcon;
diff --git a/src/layers/cluster-layer/cluster-layer-icon.js b/src/layers/cluster-layer/cluster-layer-icon.js
index 99e64afcc..32b7eb836 100644
--- a/src/layers/cluster-layer/cluster-layer-icon.js
+++ b/src/layers/cluster-layer/cluster-layer-icon.js
@@ -22,19 +22,19 @@ import React, {Component} from 'react';
import PropTypes from 'prop-types';
import Base from 'components/common/icons/base';
-const propTypes = {
- /** Set the height of the icon, ex. '16px' */
- height: PropTypes.string,
- colors: PropTypes.arrayOf(PropTypes.string)
-};
+class ClusterLayerIcon extends Component {
+ static propTypes = {
+ /** Set the height of the icon, ex. '16px' */
+ height: PropTypes.string,
+ colors: PropTypes.arrayOf(PropTypes.string)
+ };
-const defaultProps = {
- height: '16px',
- predefinedClassName: 'cluster-layer-icon',
- totalColor: 5
-};
+ static defaultProps = {
+ height: '16px',
+ predefinedClassName: 'cluster-layer-icon',
+ totalColor: 5
+ };
-class ClusterLayerIcon extends Component {
render() {
return (
<Base {...this.props}>
@@ -68,8 +68,4 @@ class ClusterLayerIcon extends Component {
}
};
-ClusterLayerIcon.displayName = 'ClusterLayerIcon';
-ClusterLayerIcon.propTypes = propTypes;
-ClusterLayerIcon.defaultProps = defaultProps;
-
export default ClusterLayerIcon;
diff --git a/src/layers/default-layer-icon.js b/src/layers/default-layer-icon.js
index 1cd98da87..4ace4141e 100644
--- a/src/layers/default-layer-icon.js
+++ b/src/layers/default-layer-icon.js
@@ -22,17 +22,17 @@ import React, {Component} from 'react';
import PropTypes from 'prop-types';
import Base from 'components/common/icons/base';
-const propTypes = {
- height: PropTypes.string,
- colors: PropTypes.arrayOf(PropTypes.string)
-};
+class DefaultLayerIcon extends Component {
+ static propTypes = {
+ height: PropTypes.string,
+ colors: PropTypes.arrayOf(PropTypes.string)
+ };
-const defaultProps = {
- height: '16px',
- predefinedClassName: 'default-layer-icon'
-};
+ static defaultProps = {
+ height: '16px',
+ predefinedClassName: 'default-layer-icon'
+ };
-class DefaultLayerIcon extends Component {
render() {
return (
<Base {...this.props}>
@@ -47,8 +47,4 @@ class DefaultLayerIcon extends Component {
}
};
-DefaultLayerIcon.displayName = 'DefaultLayerIcon';
-DefaultLayerIcon.propTypes = propTypes;
-DefaultLayerIcon.defaultProps = defaultProps;
-
export default DefaultLayerIcon;
diff --git a/src/layers/geojson-layer/geojson-layer-icon.js b/src/layers/geojson-layer/geojson-layer-icon.js
index 283d63776..bcd6cec50 100644
--- a/src/layers/geojson-layer/geojson-layer-icon.js
+++ b/src/layers/geojson-layer/geojson-layer-icon.js
@@ -22,19 +22,19 @@ import React, {Component} from 'react';
import PropTypes from 'prop-types';
import Base from 'components/common/icons/base';
-const propTypes = {
- /** Set the height of the icon, ex. '16px' */
- height: PropTypes.string,
- colors: PropTypes.arrayOf(PropTypes.string)
-};
+export default class GeojsonLayerIcon extends Component {
+ static propTypes = {
+ /** Set the height of the icon, ex. '16px' */
+ height: PropTypes.string,
+ colors: PropTypes.arrayOf(PropTypes.string)
+ };
-const defaultProps = {
- height: null,
- size: 'tiny',
- predefinedClassName: 'geojson-layer-icon'
-};
+ static defaultProps = {
+ height: null,
+ size: 'tiny',
+ predefinedClassName: 'geojson-layer-icon'
+ };
-class GeojsonLayerIcon extends Component {
render() {
return (
<Base {...this.props}>
@@ -65,10 +65,4 @@ class GeojsonLayerIcon extends Component {
</Base>
);
}
-}
-
-GeojsonLayerIcon.displayName = 'GeojsonLayerIcon';
-GeojsonLayerIcon.propTypes = propTypes;
-GeojsonLayerIcon.defaultProps = defaultProps;
-
-export default GeojsonLayerIcon;
+};
diff --git a/src/layers/grid-layer/grid-layer-icon.js b/src/layers/grid-layer/grid-layer-icon.js
index 20e36d07d..af7b14c93 100644
--- a/src/layers/grid-layer/grid-layer-icon.js
+++ b/src/layers/grid-layer/grid-layer-icon.js
@@ -22,19 +22,19 @@ import React, {Component} from 'react';
import PropTypes from 'prop-types';
import Base from 'components/common/icons/base';
-const propTypes = {
- /** Set the height of the icon, ex. '16px' */
- height: PropTypes.string,
- colors: PropTypes.arrayOf(PropTypes.string)
-};
+export default class GridLayerIcon extends Component {
+ static propTypes = {
+ /** Set the height of the icon, ex. '16px' */
+ height: PropTypes.string,
+ colors: PropTypes.arrayOf(PropTypes.string)
+ };
-const defaultProps = {
- height: '16px',
- predefinedClassName: 'grid-layer-icon',
- totalColor: 6
-};
+ static defaultProps = {
+ height: '16px',
+ predefinedClassName: 'grid-layer-icon',
+ totalColor: 6
+ };
-class GridLayerIcon extends Component {
render() {
return (
<Base {...this.props}>
@@ -93,9 +93,3 @@ class GridLayerIcon extends Component {
);
}
};
-
-GridLayerIcon.displayName = 'GridLayerIcon';
-GridLayerIcon.propTypes = propTypes;
-GridLayerIcon.defaultProps = defaultProps;
-
-export default GridLayerIcon;
diff --git a/src/layers/heatmap-layer/heatmap-layer-icon.js b/src/layers/heatmap-layer/heatmap-layer-icon.js
index 76a06509a..b7e18c6e1 100644
--- a/src/layers/heatmap-layer/heatmap-layer-icon.js
+++ b/src/layers/heatmap-layer/heatmap-layer-icon.js
@@ -22,19 +22,19 @@ import React, {Component} from 'react';
import PropTypes from 'prop-types';
import Base from 'components/common/icons/base';
-const propTypes = {
- /** Set the height of the icon, ex. '16px' */
- height: PropTypes.string,
- colors: PropTypes.arrayOf(PropTypes.string)
-};
+export default class HeatmapLayerIcon extends Component {
+ static propTypes = {
+ /** Set the height of the icon, ex. '16px' */
+ height: PropTypes.string,
+ colors: PropTypes.arrayOf(PropTypes.string)
+ };
-const defaultProps = {
- height: '16px',
- predefinedClassName: 'heatmap-layer-icon',
- totalColor: 3
-};
+ static defaultProps = {
+ height: '16px',
+ predefinedClassName: 'heatmap-layer-icon',
+ totalColor: 3
+ };
-class HeatmapLayerIcon extends Component {
render() {
return (
<Base {...this.props}>
@@ -52,9 +52,3 @@ class HeatmapLayerIcon extends Component {
);
}
};
-
-HeatmapLayerIcon.displayName = 'HeatmapLayerIcon';
-HeatmapLayerIcon.propTypes = propTypes;
-HeatmapLayerIcon.defaultProps = defaultProps;
-
-export default HeatmapLayerIcon;
diff --git a/src/layers/hexagon-layer/hexagon-layer-icon.js b/src/layers/hexagon-layer/hexagon-layer-icon.js
index ce919780c..7808c780f 100644
--- a/src/layers/hexagon-layer/hexagon-layer-icon.js
+++ b/src/layers/hexagon-layer/hexagon-layer-icon.js
@@ -22,19 +22,19 @@ import React, {Component} from 'react';
import PropTypes from 'prop-types';
import Base from 'components/common/icons/base';
-const propTypes = {
- /** Set the height of the icon, ex. '16px' */
- height: PropTypes.string,
- colors: PropTypes.arrayOf(PropTypes.string)
-};
+export default class HexagonLayerIcon extends Component {
+ static propTypes = {
+ /** Set the height of the icon, ex. '16px' */
+ height: PropTypes.string,
+ colors: PropTypes.arrayOf(PropTypes.string)
+ };
-const defaultProps = {
- height: '16px',
- predefinedClassName: 'hexagon-layer-icon',
- totalColor: 6
-};
+ static defaultProps = {
+ height: '16px',
+ predefinedClassName: 'hexagon-layer-icon',
+ totalColor: 6
+ };
-class HexagonLayerIcon extends Component {
render() {
return (
<Base {...this.props}>
@@ -75,9 +75,3 @@ class HexagonLayerIcon extends Component {
);
}
};
-
-HexagonLayerIcon.displayName = 'HexagonLayerIcon';
-HexagonLayerIcon.propTypes = propTypes;
-HexagonLayerIcon.defaultProps = defaultProps;
-
-export default HexagonLayerIcon;
diff --git a/src/layers/icon-layer/icon-layer-icon.js b/src/layers/icon-layer/icon-layer-icon.js
index af36dd5fc..775bf83cf 100644
--- a/src/layers/icon-layer/icon-layer-icon.js
+++ b/src/layers/icon-layer/icon-layer-icon.js
@@ -22,19 +22,19 @@ import React, {Component} from 'react';
import PropTypes from 'prop-types';
import Base from 'components/common/icons/base';
-const propTypes = {
- /** Set the height of the icon, ex. '16px' */
- height: PropTypes.string,
- colors: PropTypes.arrayOf(PropTypes.string)
-};
+export default class IconLayerIcon extends Component {
+ static propTypes = {
+ /** Set the height of the icon, ex. '16px' */
+ height: PropTypes.string,
+ colors: PropTypes.arrayOf(PropTypes.string)
+ };
-const defaultProps = {
- height: '16px',
- predefinedClassName: 'icon-layer-icon',
- totalColor: 3
-};
+ static defaultProps = {
+ height: '16px',
+ predefinedClassName: 'icon-layer-icon',
+ totalColor: 3
+ };
-class IconLayerIcon extends Component {
render() {
return (
<Base {...this.props}>
@@ -45,9 +45,3 @@ class IconLayerIcon extends Component {
);
}
}
-
-IconLayerIcon.displayName = 'IconLayerIcon';
-IconLayerIcon.propTypes = propTypes;
-IconLayerIcon.defaultProps = defaultProps;
-
-export default IconLayerIcon;
diff --git a/src/layers/line-layer/line-layer-icon.js b/src/layers/line-layer/line-layer-icon.js
index 641086be1..9c8646858 100644
--- a/src/layers/line-layer/line-layer-icon.js
+++ b/src/layers/line-layer/line-layer-icon.js
@@ -22,19 +22,19 @@ import React, {Component} from 'react';
import PropTypes from 'prop-types';
import Base from 'components/common/icons/base';
-const propTypes = {
- /** Set the height of the icon, ex. '16px' */
- height: PropTypes.string,
- colors: PropTypes.arrayOf(PropTypes.string)
-};
+export default class LineLayerIcon extends Component {
+ static propTypes = {
+ /** Set the height of the icon, ex. '16px' */
+ height: PropTypes.string,
+ colors: PropTypes.arrayOf(PropTypes.string)
+ };
-const defaultProps = {
- height: '16px',
- predefinedClassName: 'line-layer-icon',
- totalColor: 5
-};
+ static defaultProps = {
+ height: '16px',
+ predefinedClassName: 'line-layer-icon',
+ totalColor: 5
+ };
-class LineLayerIcon extends Component {
render() {
return (
<Base {...this.props}>
@@ -67,9 +67,3 @@ class LineLayerIcon extends Component {
);
}
};
-
-LineLayerIcon.displayName = 'LineLayerIcon';
-LineLayerIcon.propTypes = propTypes;
-LineLayerIcon.defaultProps = defaultProps;
-
-export default LineLayerIcon;
diff --git a/src/layers/point-layer/point-layer-icon.js b/src/layers/point-layer/point-layer-icon.js
index 1587302bf..cfe52c932 100644
--- a/src/layers/point-layer/point-layer-icon.js
+++ b/src/layers/point-layer/point-layer-icon.js
@@ -22,18 +22,18 @@ import React, {Component} from 'react';
import PropTypes from 'prop-types';
import Base from 'components/common/icons/base';
-const propTypes = {
- height: PropTypes.string,
- colors: PropTypes.arrayOf(PropTypes.string)
-};
+class PointLayerIcon extends Component {
+ static propTypes = {
+ height: PropTypes.string,
+ colors: PropTypes.arrayOf(PropTypes.string)
+ };
-const defaultProps = {
- height: '16px',
- predefinedClassName: 'point-layer-icon',
- totalColor: 6
-};
+ static defaultProps = {
+ height: '16px',
+ predefinedClassName: 'point-layer-icon',
+ totalColor: 6
+ };
-class PointLayerIcon extends Component {
render() {
return (
<Base {...this.props}>
@@ -48,8 +48,4 @@ class PointLayerIcon extends Component {
}
};
-PointLayerIcon.displayName = 'PointLayerIcon';
-PointLayerIcon.propTypes = propTypes;
-PointLayerIcon.defaultProps = defaultProps;
-
export default PointLayerIcon;