Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.
[Feat] Move more css to theme and create more factories (#1248)
Nicolas Rojod677c18f9bc5
diff --git a/src/components/common/data-table/index.js b/src/components/common/data-table/index.jsindex ee0cd35bf..ae1f8f005 100644--- a/src/components/common/data-table/index.js+++ b/src/components/common/data-table/index.js@@ -32,12 +32,11 @@ import Grid from './grid';import Button from './button';import {ArrowUp, ArrowDown} from 'components/common/icons';import {VertThreeDots} from 'components/common/icons';-import FieldToken from 'components/common/field-token';-import {parseFieldValue} from 'utils/data-utils';import {adjustCellsToContainer} from './cell-size';import {ALL_FIELD_TYPES, SORT_ORDER} from 'constants/default-settings';+import FieldTokenFactory from 'components/common/field-token';const defaultHeaderRowHeight = 55;const defaultRowHeight = 32;@@ -249,129 +248,6 @@ const getRowCell = ({rows, columns, column, colMeta, rowIndex, sortColumn, sortOreturn parseFieldValue(get(rows, [rowIdx, columns.indexOf(column)], 'Err'), type);};-const renderHeaderCell = (columns, isPinned, props, toggleMoreOptions, moreOptionsColumn) => {- // eslint-disable-next-line react/display-name- return cellInfo => {- const {columnIndex, key, style} = cellInfo;- const {- colMeta,- sortColumn,- sortTableColumn,- unsortColumn,- pinTableColumn,- copyTableColumn,- dataId- } = props;-- const column = columns[columnIndex];- const isGhost = column.ghost;- const isSorted = sortColumn[column];- const firstCell = columnIndex === 0;-- return (- <div- className={classnames('header-cell', {- [`column-${columnIndex}`]: true,- 'pinned-header-cell': isPinned,- 'first-cell': firstCell- })}- key={key}- style={style}- onClick={e => {- e.shiftKey ? sortTableColumn(dataId, column) : null;- }}- onDoubleClick={() => sortTableColumn(dataId, column)}- title={column}- >- {isGhost ? (- <div />- ) : (- <>- <section className="details">- <div className="col-name">- <div className="col-name__left">- <div className="col-name__name">{column}</div>- <Button- className="col-name__sort"- onClick={() => sortTableColumn(dataId, column)}- >- {isSorted ? (- isSorted === SORT_ORDER.ASCENDING ? (- <ArrowUp height="14px" />- ) : (- <ArrowDown height="14px" />- )- ) : null}- </Button>- </div>- <Button className="more" onClick={() => toggleMoreOptions(column)}>- <VertThreeDots height="14px" />- </Button>- </div>-- <FieldToken type={colMeta[column]} />- </section>-- <section className="options">- <OptionDropdown- isOpened={moreOptionsColumn === column}- type={colMeta[column]}- column={column}- toggleMoreOptions={toggleMoreOptions}- sortTableColumn={mode => sortTableColumn(dataId, column, mode)}- sortMode={sortColumn && sortColumn[column]}- pinTableColumn={() => pinTableColumn(dataId, column)}- copyTableColumn={() => copyTableColumn(dataId, column)}- isSorted={isSorted}- isPinned={isPinned}- unsortColumn={unsortColumn}- />- </section>- </>- )}- </div>- );- };-};--const renderDataCell = (columns, isPinned, props) => {- return cellInfo => {- const {columnIndex, key, style, rowIndex} = cellInfo;- const {rows, colMeta} = props;- const column = columns[columnIndex];- const isGhost = column.ghost;-- const rowCell = isGhost ? '' : getRowCell({...props, column, rowIndex});- const type = isGhost ? null : colMeta[column];-- const endCell = columnIndex === columns.length - 1;- const firstCell = columnIndex === 0;- const bottomCell = rowIndex === rows.length - 1;- const alignRight = fieldToAlignRight[type];-- const cell = (- <div- className={classnames('cell', {- [rowIndex % 2 === 0 ? 'even-row' : 'odd-row']: true,- [`row-${rowIndex}`]: true,- 'pinned-cell': isPinned,- 'first-cell': firstCell,- 'end-cell': endCell,- 'bottom-cell': bottomCell,- 'align-right': alignRight- })}- key={key}- style={style}- title={isGhost ? undefined : rowCell}- >- {`${rowCell}${endCell ? '\n' : '\t'}`}- </div>- );-- return cell;- };-};-export const TableSection = ({classList,isPinned,@@ -428,188 +304,324 @@ export const TableSection = ({}}</AutoSizer>);+DataTableFactory.deps = [FieldTokenFactory];+function DataTableFactory(FieldToken) {+ class DataTable extends Component {+ static defaultProps = {+ rows: [],+ pinnedColumns: [],+ colMeta: {},+ cellSizeCache: {},+ sortColumn: {},+ fixedWidth: null,+ fixedHeight: null,+ theme: {}+ };-export class DataTable extends Component {- static defaultProps = {- rows: [],- pinnedColumns: [],- colMeta: {},- cellSizeCache: {},- sortColumn: {},- fixedWidth: null,- fixedHeight: null,- theme: {}- };-- state = {- cellSizeCache: {},- moreOptionsColumn: null- };-- componentDidMount() {- window.addEventListener('resize', this.scaleCellsToWidth);- this.scaleCellsToWidth();- }+ state = {+ cellSizeCache: {},+ moreOptionsColumn: null+ };- componentDidUpdate(prevProps) {- if (- this.props.cellSizeCache !== prevProps.cellSizeCache ||- this.props.pinnedColumns !== prevProps.pinnedColumns- ) {+ componentDidMount() {+ window.addEventListener('resize', this.scaleCellsToWidth);this.scaleCellsToWidth();}- }- componentWillUnmount() {- window.removeEventListener('resize', this.scaleCellsToWidth);- }- root = createRef();- columns = props => props.columns;- pinnedColumns = props => props.pinnedColumns;- unpinnedColumns = createSelector(this.columns, this.pinnedColumns, (columns, pinnedColumns) =>- !Array.isArray(pinnedColumns) ? columns : columns.filter(c => !pinnedColumns.includes(c))- );-- toggleMoreOptions = moreOptionsColumn =>- this.setState({- moreOptionsColumn:- this.state.moreOptionsColumn === moreOptionsColumn ? null : moreOptionsColumn- });-- getCellSizeCache = () => {- const {cellSizeCache: propsCache, fixedWidth, pinnedColumns} = this.props;- const unpinnedColumns = this.unpinnedColumns(this.props);-- const width = fixedWidth ? fixedWidth : this.root.current ? this.root.current.clientWidth : 0;-- // pin column border is 2 pixel vs 1 pixel- const adjustWidth = pinnedColumns.length ? width - 1 : width;- const {cellSizeCache, ghost} = adjustCellsToContainer(- adjustWidth,- propsCache,- pinnedColumns,- unpinnedColumns+ componentDidUpdate(prevProps) {+ if (+ this.props.cellSizeCache !== prevProps.cellSizeCache ||+ this.props.pinnedColumns !== prevProps.pinnedColumns+ ) {+ this.scaleCellsToWidth();+ }+ }++ componentWillUnmount() {+ window.removeEventListener('resize', this.scaleCellsToWidth);+ }+ root = createRef();+ columns = props => props.columns;+ pinnedColumns = props => props.pinnedColumns;+ unpinnedColumns = createSelector(this.columns, this.pinnedColumns, (columns, pinnedColumns) =>+ !Array.isArray(pinnedColumns) ? columns : columns.filter(c => !pinnedColumns.includes(c)));- return {- cellSizeCache,- ghost++ toggleMoreOptions = moreOptionsColumn =>+ this.setState({+ moreOptionsColumn:+ this.state.moreOptionsColumn === moreOptionsColumn ? null : moreOptionsColumn+ });++ getCellSizeCache = () => {+ const {cellSizeCache: propsCache, fixedWidth, pinnedColumns} = this.props;+ const unpinnedColumns = this.unpinnedColumns(this.props);++ const width = fixedWidth ? fixedWidth : this.root.current ? this.root.current.clientWidth : 0;++ // pin column border is 2 pixel vs 1 pixel+ const adjustWidth = pinnedColumns.length ? width - 1 : width;+ const {cellSizeCache, ghost} = adjustCellsToContainer(+ adjustWidth,+ propsCache,+ pinnedColumns,+ unpinnedColumns+ );+ return {+ cellSizeCache,+ ghost+ };};- };- doScaleCellsToWidth = () => {- this.setState(this.getCellSizeCache());- };+ doScaleCellsToWidth = () => {+ this.setState(this.getCellSizeCache());+ };++ scaleCellsToWidth = debounce(this.doScaleCellsToWidth, 300);++ renderHeaderCell = (+ columns,+ isPinned,+ props,+ toggleMoreOptions,+ moreOptionsColumn,+ TokenComponent+ ) => {+ // eslint-disable-next-line react/display-name+ return cellInfo => {+ const {columnIndex, key, style} = cellInfo;+ const {+ colMeta,+ sortColumn,+ sortTableColumn,+ unsortColumn,+ pinTableColumn,+ copyTableColumn,+ dataId+ } = props;++ const column = columns[columnIndex];+ const isGhost = column.ghost;+ const isSorted = sortColumn[column];+ const firstCell = columnIndex === 0;+ return (+ <div+ className={classnames('header-cell', {+ [`column-${columnIndex}`]: true,+ 'pinned-header-cell': isPinned,+ 'first-cell': firstCell+ })}+ key={key}+ style={style}+ onClick={e => {+ e.shiftKey ? sortTableColumn(dataId, column) : null;+ }}+ onDoubleClick={() => sortTableColumn(dataId, column)}+ title={column}+ >+ {isGhost ? (+ <div />+ ) : (+ <>+ <section className="details">+ <div className="col-name">+ <div className="col-name__left">+ <div className="col-name__name">{column}</div>+ <Button+ className="col-name__sort"+ onClick={() => sortTableColumn(dataId, column)}+ >+ {isSorted ? (+ isSorted === SORT_ORDER.ASCENDING ? (+ <ArrowUp height="14px" />+ ) : (+ <ArrowDown height="14px" />+ )+ ) : null}+ </Button>+ </div>+ <Button className="more" onClick={() => toggleMoreOptions(column)}>+ <VertThreeDots height="14px" />+ </Button>+ </div>++ <FieldToken type={colMeta[column]} />+ </section>++ <section className="options">+ <OptionDropdown+ isOpened={moreOptionsColumn === column}+ type={colMeta[column]}+ column={column}+ toggleMoreOptions={toggleMoreOptions}+ sortTableColumn={mode => sortTableColumn(dataId, column, mode)}+ sortMode={sortColumn && sortColumn[column]}+ pinTableColumn={() => pinTableColumn(dataId, column)}+ copyTableColumn={() => copyTableColumn(dataId, column)}+ isSorted={isSorted}+ isPinned={isPinned}+ unsortColumn={unsortColumn}+ />+ </section>+ </>+ )}+ </div>+ );+ };+ };- scaleCellsToWidth = debounce(this.doScaleCellsToWidth, 300);+ renderDataCell = (columns, isPinned, props) => {+ return cellInfo => {+ const {columnIndex, key, style, rowIndex} = cellInfo;+ const {rows, colMeta} = props;+ const column = columns[columnIndex];+ const isGhost = column.ghost;- render() {- const {rows, pinnedColumns, theme = {}, fixedWidth, fixedHeight} = this.props;- const unpinnedColumns = this.unpinnedColumns(this.props);+ const rowCell = isGhost ? '' : getRowCell({...props, column, rowIndex});+ const type = isGhost ? null : colMeta[column];- const {cellSizeCache, moreOptionsColumn, ghost} = this.state;- const unpinnedColumnsGhost = ghost ? [...unpinnedColumns, {ghost: true}] : unpinnedColumns;- const pinnedColumnsWidth = pinnedColumns.reduce(- (acc, val) => acc + get(cellSizeCache, val, 0),- 0- );+ const endCell = columnIndex === columns.length - 1;+ const firstCell = columnIndex === 0;+ const bottomCell = rowIndex === rows.length - 1;+ const alignRight = fieldToAlignRight[type];- const hasPinnedColumns = Boolean(pinnedColumns.length);- const {headerRowHeight = defaultHeaderRowHeight, rowHeight = defaultRowHeight} = theme;+ const cell = (+ <div+ className={classnames('cell', {+ [rowIndex % 2 === 0 ? 'even-row' : 'odd-row']: true,+ [`row-${rowIndex}`]: true,+ 'pinned-cell': isPinned,+ 'first-cell': firstCell,+ 'end-cell': endCell,+ 'bottom-cell': bottomCell,+ 'align-right': alignRight+ })}+ key={key}+ style={style}+ title={isGhost ? undefined : rowCell}+ >+ {`${rowCell}${endCell ? '\n' : '\t'}`}+ </div>+ );- const headerGridProps = {- cellSizeCache,- className: 'header-grid',- height: headerRowHeight,- rowCount: 1,- rowHeight: headerRowHeight+ return cell;+ };};+ render() {+ const {rows, pinnedColumns, theme = {}, fixedWidth, fixedHeight} = this.props;+ const unpinnedColumns = this.unpinnedColumns(this.props);++ const {cellSizeCache, moreOptionsColumn, ghost} = this.state;+ const unpinnedColumnsGhost = ghost ? [...unpinnedColumns, {ghost: true}] : unpinnedColumns;+ const pinnedColumnsWidth = pinnedColumns.reduce(+ (acc, val) => acc + get(cellSizeCache, val, 0),+ 0+ );- const dataGridProps = {- cellSizeCache,- overscanColumnCount,- overscanRowCount,- rowCount: (rows || []).length,- rowHeight- };+ const hasPinnedColumns = Boolean(pinnedColumns.length);+ const {headerRowHeight = defaultHeaderRowHeight, rowHeight = defaultRowHeight} = theme;++ const headerGridProps = {+ cellSizeCache,+ className: 'header-grid',+ height: headerRowHeight,+ rowCount: 1,+ rowHeight: headerRowHeight+ };++ const dataGridProps = {+ cellSizeCache,+ overscanColumnCount,+ overscanRowCount,+ rowCount: (rows || []).length,+ rowHeight+ };- return (- <Container className="data-table-container" ref={this.root}>- {Object.keys(cellSizeCache).length && (- <ScrollSync>- {({onScroll, scrollLeft, scrollTop}) => {- return (- <div className="results-table-wrapper">- {hasPinnedColumns && (- <div key="pinned-columns" className="pinned-columns grid-row">+ return (+ <Container className="data-table-container" ref={this.root}>+ {Object.keys(cellSizeCache).length && (+ <ScrollSync>+ {({onScroll, scrollLeft, scrollTop}) => {+ return (+ <div className="results-table-wrapper">+ {hasPinnedColumns && (+ <div key="pinned-columns" className="pinned-columns grid-row">+ <TableSection+ classList={{+ header: 'pinned-columns--header pinned-grid-container',+ rows: 'pinned-columns--rows pinned-grid-container'+ }}+ isPinned+ columns={pinnedColumns}+ headerGridProps={headerGridProps}+ fixedWidth={pinnedColumnsWidth}+ onScroll={args => onScroll({...args, scrollLeft})}+ scrollTop={scrollTop}+ dataGridProps={dataGridProps}+ setGridRef={pinnedGrid => (this.pinnedGrid = pinnedGrid)}+ columnWidth={columnWidthFunction(pinnedColumns, cellSizeCache)}+ headerCellRender={this.renderHeaderCell(+ pinnedColumns,+ true,+ this.props,+ this.toggleMoreOptions,+ moreOptionsColumn+ )}+ dataCellRender={this.renderDataCell(pinnedColumns, true, this.props)}+ />+ </div>+ )}+ <div+ key="unpinned-columns"+ style={{+ marginLeft: `${hasPinnedColumns ? `${pinnedColumnsWidth}px` : '0'}`+ }}+ className="unpinned-columns grid-column"+ ><TableSectionclassList={{- header: 'pinned-columns--header pinned-grid-container',- rows: 'pinned-columns--rows pinned-grid-container'+ header: 'unpinned-columns--header unpinned-grid-container',+ rows: 'unpinned-columns--rows unpinned-grid-container'}}- isPinned- columns={pinnedColumns}+ isPinned={false}+ columns={unpinnedColumnsGhost}headerGridProps={headerGridProps}- fixedWidth={pinnedColumnsWidth}- onScroll={args => onScroll({...args, scrollLeft})}+ fixedWidth={fixedWidth}+ fixedHeight={fixedHeight}+ onScroll={onScroll}scrollTop={scrollTop}+ scrollLeft={scrollLeft}dataGridProps={dataGridProps}- setGridRef={pinnedGrid => (this.pinnedGrid = pinnedGrid)}- columnWidth={columnWidthFunction(pinnedColumns, cellSizeCache)}- headerCellRender={renderHeaderCell(- pinnedColumns,- true,+ setGridRef={unpinnedGrid => (this.unpinnedGrid = unpinnedGrid)}+ columnWidth={columnWidthFunction(+ unpinnedColumnsGhost,+ cellSizeCache,+ ghost+ )}+ headerCellRender={this.renderHeaderCell(+ unpinnedColumnsGhost,+ false,this.props,this.toggleMoreOptions,moreOptionsColumn)}- dataCellRender={renderDataCell(pinnedColumns, true, this.props)}+ dataCellRender={this.renderDataCell(+ unpinnedColumnsGhost,+ false,+ this.props+ )}/></div>- )}- <div- key="unpinned-columns"- style={{- marginLeft: `${hasPinnedColumns ? `${pinnedColumnsWidth}px` : '0'}`- }}- className="unpinned-columns grid-column"- >- <TableSection- classList={{- header: 'unpinned-columns--header unpinned-grid-container',- rows: 'unpinned-columns--rows unpinned-grid-container'- }}- isPinned={false}- columns={unpinnedColumnsGhost}- headerGridProps={headerGridProps}- fixedWidth={fixedWidth}- fixedHeight={fixedHeight}- onScroll={onScroll}- scrollTop={scrollTop}- scrollLeft={scrollLeft}- dataGridProps={dataGridProps}- setGridRef={unpinnedGrid => (this.unpinnedGrid = unpinnedGrid)}- columnWidth={columnWidthFunction(unpinnedColumnsGhost, cellSizeCache, ghost)}- headerCellRender={renderHeaderCell(- unpinnedColumnsGhost,- false,- this.props,- this.toggleMoreOptions,- moreOptionsColumn- )}- dataCellRender={renderDataCell(unpinnedColumnsGhost, false, this.props)}- /></div>- </div>- );- }}- </ScrollSync>- )}- </Container>- );+ );+ }}+ </ScrollSync>+ )}+ </Container>+ );+ }}-}-function DataTableFactory() {return withTheme(DataTable);}diff --git a/src/components/common/field-selector.js b/src/components/common/field-selector.jsindex 610b1f3e3..a3009e5f3 100644--- a/src/components/common/field-selector.js+++ b/src/components/common/field-selector.js@@ -24,33 +24,39 @@ import PropTypes from 'prop-types';import {createSelector} from 'reselect';import ItemSelector from './item-selector/item-selector';-import FieldToken from '../common/field-token';import {classList} from './item-selector/dropdown-list';import {toArray} from 'utils/utils';import {notNullorUndefined} from 'utils/data-utils';+import FieldTokenFactory from '../common/field-token';const defaultDisplayOption = d => d.name;const StyledToken = styled.div`display: inline-block;- margin: 0 4px 0 0;+ margin: 0 ${props => props.theme.fieldTokenRightMargin}px 0 0;+`;+const StyledFieldListItem = styled.div`+ line-height: 0;`;+FieldListItemFactoryFactory.deps = [FieldTokenFactory];// custom list Item-export const FieldListItemFactory = (showToken = true) => {- const FieldListItem = ({value, displayOption = defaultDisplayOption}) => (- <div className="field-selector_list-item">- {showToken ? (- <StyledToken>- <FieldToken type={value.type} />- </StyledToken>- ) : null}- <span className={classList.listItemAnchor}>{displayOption(value)}</span>- </div>- );-- return FieldListItem;-};+export function FieldListItemFactoryFactory(FieldToken) {+ const FieldListItemFactory = (showToken = true) => {+ const FieldListItem = ({value, displayOption = defaultDisplayOption}) => (+ <StyledFieldListItem className="field-selector_list-item">+ {showToken ? (+ <StyledToken>+ <FieldToken type={value.type} />+ </StyledToken>+ ) : null}+ <span className={classList.listItemAnchor}>{displayOption(value)}</span>+ </StyledFieldListItem>+ );+ return FieldListItem;+ };+ return FieldListItemFactory;+}const SuggestedFieldHeader = () => <div>Suggested Field</div>;@@ -72,97 +78,105 @@ const FieldType = PropTypes.oneOfType([})]);-class FieldSelector extends Component {- static propTypes = {- fields: PropTypes.oneOfType([PropTypes.array, PropTypes.arrayOf(FieldType)]),- onSelect: PropTypes.func.isRequired,- placement: PropTypes.string,- value: FieldType,- filterFieldTypes: PropTypes.oneOfType([FieldType, PropTypes.arrayOf(FieldType)]),- inputTheme: PropTypes.string,- placeholder: PropTypes.string,- erasable: PropTypes.bool,- error: PropTypes.bool,- multiSelect: PropTypes.bool,- closeOnSelect: PropTypes.bool,- showToken: PropTypes.bool,- suggested: PropTypes.arrayOf(PropTypes.any),- CustomChickletComponent: PropTypes.func- };-- static defaultProps = {- erasable: true,- error: false,- fields: [],- onSelect: () => {},- placement: 'bottom',- value: null,- multiSelect: false,- closeOnSelect: true,- showToken: true,- placeholder: 'placeholder.selectField'- };-- fieldsSelector = props => props.fields;- filteredFieldsSelector = props =>- props.fields.filter(- field => !toArray(props.value).find(d => (d.name ? d.name === field.name : d === field.name))+const FieldSelectorFactory = FieldListItemFactory => {+ class FieldSelector extends Component {+ static propTypes = {+ fields: PropTypes.oneOfType([PropTypes.array, PropTypes.arrayOf(FieldType)]),+ onSelect: PropTypes.func.isRequired,+ placement: PropTypes.string,+ value: FieldType,+ filterFieldTypes: PropTypes.oneOfType([FieldType, PropTypes.arrayOf(FieldType)]),+ inputTheme: PropTypes.string,+ placeholder: PropTypes.string,+ erasable: PropTypes.bool,+ error: PropTypes.bool,+ multiSelect: PropTypes.bool,+ closeOnSelect: PropTypes.bool,+ showToken: PropTypes.bool,+ suggested: PropTypes.arrayOf(PropTypes.any),+ CustomChickletComponent: PropTypes.func+ };++ static defaultProps = {+ erasable: true,+ error: false,+ fields: [],+ onSelect: () => {},+ placement: 'bottom',+ value: null,+ multiSelect: false,+ closeOnSelect: true,+ showToken: true,+ placeholder: 'placeholder.selectField'+ };++ fieldsSelector = props => props.fields;+ filteredFieldsSelector = props =>+ props.fields.filter(+ field =>+ !toArray(props.value).find(d => (d.name ? d.name === field.name : d === field.name))+ );+ valueSelector = props => props.value;+ filterFieldTypesSelector = props => props.filterFieldTypes;+ showTokenSelector = props => props.showToken;++ selectedItemsSelector = createSelector(+ this.fieldsSelector,+ this.valueSelector,+ (fields, value) =>+ toArray(value)+ .map(d =>+ fields.find(f =>+ notNullorUndefined(d) && d.name+ ? d.name === defaultDisplayOption(f)+ : d === defaultDisplayOption(f)+ )+ )+ .filter(d => d));- valueSelector = props => props.value;- filterFieldTypesSelector = props => props.filterFieldTypes;- showTokenSelector = props => props.showToken;-- selectedItemsSelector = createSelector(this.fieldsSelector, this.valueSelector, (fields, value) =>- toArray(value)- .map(d =>- fields.find(f =>- notNullorUndefined(d) && d.name- ? d.name === defaultDisplayOption(f)- : d === defaultDisplayOption(f)- )- )- .filter(d => d)- );- fieldOptionsSelector = createSelector(- this.filteredFieldsSelector,- this.filterFieldTypesSelector,- (fields, filterFieldTypes) => {- if (!filterFieldTypes) {- return fields;+ fieldOptionsSelector = createSelector(+ this.filteredFieldsSelector,+ this.filterFieldTypesSelector,+ (fields, filterFieldTypes) => {+ if (!filterFieldTypes) {+ return fields;+ }+ const filters = Array.isArray(filterFieldTypes) ? filterFieldTypes : [filterFieldTypes];+ return fields.filter(f => filters.includes(f.type));}- const filters = Array.isArray(filterFieldTypes) ? filterFieldTypes : [filterFieldTypes];- return fields.filter(f => filters.includes(f.type));- }- );-- fieldListItemSelector = createSelector(this.showTokenSelector, FieldListItemFactory);-- render() {- return (- <div className="field-selector">- <ItemSelector- getOptionValue={d => d}- closeOnSelect={this.props.closeOnSelect}- displayOption={defaultDisplayOption}- filterOption="name"- fixedOptions={this.props.suggested}- inputTheme={this.props.inputTheme}- isError={this.props.error}- selectedItems={this.selectedItemsSelector(this.props)}- erasable={this.props.erasable}- options={this.fieldOptionsSelector(this.props)}- multiSelect={this.props.multiSelect}- placeholder={this.props.placeholder}- placement={this.props.placement}- onChange={this.props.onSelect}- DropDownLineItemRenderComponent={this.fieldListItemSelector(this.props)}- DropdownHeaderComponent={this.props.suggested ? SuggestedFieldHeader : null}- CustomChickletComponent={this.props.CustomChickletComponent}- />- </div>);++ fieldListItemSelector = createSelector(this.showTokenSelector, FieldListItemFactory);++ render() {+ return (+ <div className="field-selector">+ <ItemSelector+ getOptionValue={d => d}+ closeOnSelect={this.props.closeOnSelect}+ displayOption={defaultDisplayOption}+ filterOption="name"+ fixedOptions={this.props.suggested}+ inputTheme={this.props.inputTheme}+ isError={this.props.error}+ selectedItems={this.selectedItemsSelector(this.props)}+ erasable={this.props.erasable}+ options={this.fieldOptionsSelector(this.props)}+ multiSelect={this.props.multiSelect}+ placeholder={this.props.placeholder}+ placement={this.props.placement}+ onChange={this.props.onSelect}+ DropDownLineItemRenderComponent={this.fieldListItemSelector(this.props)}+ DropdownHeaderComponent={this.props.suggested ? SuggestedFieldHeader : null}+ CustomChickletComponent={this.props.CustomChickletComponent}+ />+ </div>+ );+ }}-}+ return FieldSelector;+};-export default FieldSelector;+FieldSelectorFactory.deps = [FieldListItemFactoryFactory];+export default FieldSelectorFactory;diff --git a/src/components/common/field-token.js b/src/components/common/field-token.jsindex 4b4025693..da113135b 100644--- a/src/components/common/field-token.js+++ b/src/components/common/field-token.js@@ -20,28 +20,37 @@import React from 'react';import styled from 'styled-components';+import {FILED_TYPE_DISPLAY, FIELD_COLORS} from 'constants/default-settings';+function FieldTokenFactory(fieldTypeDisplay, fieldColors) {+ const FieldTag = styled.div`+ background-color: rgba(${props => props.color}, 0.2);+ border-radius: 2px;+ border: 1px solid rgb(${props => props.color});+ color: rgb(${props => props.color});+ display: inline-block;+ font-size: 10px;+ font-weight: 400;+ padding: 0 5px;+ text-align: center;+ width: 40px;+ `;-import {FILED_TYPE_DISPLAY, FIELD_COLORS} from '../../constants/default-settings';+ const FieldToken = ({type}) => (+ <FieldTag+ color={(fieldTypeDisplay[type] && fieldTypeDisplay[type].color) || fieldColors.default}+ >+ {fieldTypeDisplay[type].label}+ </FieldTag>+ );+ return FieldToken;+}-const FieldTag = styled.div`- background-color: rgba(${props => props.color}, 0.2);- border-radius: 2px;- border: 1px solid rgb(${props => props.color});- color: rgb(${props => props.color});- display: inline-block;- font-size: 10px;- font-weight: 400;- padding: 0 5px;- text-align: center;- width: 40px;-`;+function getFieldTypes() {+ return FILED_TYPE_DISPLAY;+}-const FieldToken = ({type}) => (- <FieldTag- color={(FILED_TYPE_DISPLAY[type] && FILED_TYPE_DISPLAY[type].color) || FIELD_COLORS.default}- >- {FILED_TYPE_DISPLAY[type].label}- </FieldTag>-);--export default FieldToken;+function getFieldColors() {+ return FIELD_COLORS;+}+FieldTokenFactory.deps = [getFieldTypes, getFieldColors];+export default FieldTokenFactory;diff --git a/src/components/common/item-selector/chickleted-input.js b/src/components/common/item-selector/chickleted-input.jsindex c740b7705..02fae773c 100644--- a/src/components/common/item-selector/chickleted-input.js+++ b/src/components/common/item-selector/chickleted-input.js@@ -41,7 +41,7 @@ const propTypes = {};export const ChickletButton = styled.div`- background: ${props => props.theme.panelActiveBg};+ background: ${props => props.theme.chickletBgd};border-radius: 1px;color: ${props => props.theme.textColor};font-size: 11px;diff --git a/src/components/common/item-selector/item-selector.js b/src/components/common/item-selector/item-selector.jsindex a515c8377..282b3371b 100644--- a/src/components/common/item-selector/item-selector.js+++ b/src/components/common/item-selector/item-selector.js@@ -40,6 +40,8 @@ const StyledDropdownSelect = styled.div.attrs({})`${props => (props.inputTheme === 'secondary' ? props.theme.secondaryInput : props.theme.input)};+ height: ${props => props.theme.dropdownSelectHeight}px;+.list__item__anchor {${props => props.theme.dropdownListAnchor};}diff --git a/src/components/common/range-slider.js b/src/components/common/range-slider.jsindex e45e1ed1f..edddfecb9 100644--- a/src/components/common/range-slider.js+++ b/src/components/common/range-slider.js@@ -32,6 +32,8 @@ import {roundValToStep} from 'utils/data-utils';const SliderInput = styled(Input)`width: ${props => props.theme.sliderInputWidth}px;margin-left: ${props => (props.flush ? 0 : props.size === 'tiny' ? 12 : 18)}px;+ font-size: ${props => props.theme.sliderInputFontSize}; // 10px // 12px;+ padding: ${props => props.theme.sliderInputPadding}; // 4px 6px; // 6px 12px;`;const SliderWrapper = styled.div`diff --git a/src/components/common/slider/slider-bar-handle.js b/src/components/common/slider/slider-bar-handle.jsindex 48298117c..b4bdc1c27 100644--- a/src/components/common/slider/slider-bar-handle.js+++ b/src/components/common/slider/slider-bar-handle.js@@ -30,7 +30,6 @@ const StyledSlider = styled.div`props.active ? props.theme.sliderBarHoverColor : props.theme.sliderBarColor};${props => `${props.vertical ? 'width' : 'height'}: ${props.theme.sliderBarHeight}px`};border-radius: ${props => props.theme.sliderBarRadius};-:hover {cursor: pointer;}diff --git a/src/components/common/slider/slider-handle.js b/src/components/common/slider/slider-handle.jsindex f918f3682..976fcf0fa 100644--- a/src/components/common/slider/slider-handle.js+++ b/src/components/common/slider/slider-handle.js@@ -27,7 +27,8 @@ import MouseEventHandler from './mouse-event';const StyledSliderHandle = styled.span`position: absolute;z-index: 10;- ${props => (props.vertical ? 'margin-left' : 'margin-top')}: -${props => (props.sliderHandleWidth - props.theme.sliderBarHeight) / 2}px;+ ${props => (props.vertical ? 'margin-left' : 'margin-top')}: -${props =>+ (props.sliderHandleWidth - props.theme.sliderBarHeight) / 2}px;height: ${props =>Number.isFinite(props.sliderHandleWidth)@@ -39,7 +40,10 @@ const StyledSliderHandle = styled.span`: props.theme.sliderHandleHeight}px;box-shadow: ${props => props.theme.sliderHandleShadow};background-color: ${props => props.theme.sliderHandleColor};+ color: ${props => props.theme.sliderHandleTextColor};+border-width: 1px;+ border-radius: ${props => props.theme.sliderBorderRadius};border-style: solid;border-color: ${props =>props.active ? props.theme.selectBorderColor : props.theme.sliderHandleColor};@@ -48,6 +52,14 @@ const StyledSliderHandle = styled.span`background-color: ${props => props.theme.sliderHandleHoverColor};cursor: pointer;}++ line-height: 10px;+ font-size: 6px;+ padding: 0 3px;+ letter-spacing: 1px;+ :after {+ content: '${props => props.theme.sliderHandleAfterContent}';+ }`;const StyledSliderTooltip = styled.div`diff --git a/src/components/common/styled-components.js b/src/components/common/styled-components.jsindex ab639a91c..436457ca4 100644--- a/src/components/common/styled-components.js+++ b/src/components/common/styled-components.js@@ -44,8 +44,7 @@ export const IconRoundSmall = styled.div`width: 18px;height: 18px;border-radius: 9px;- background-color: ${props =>- props.theme.secondaryBtnBgdHover}; // updated after checking sketch file+ background-color: ${props => props.theme.secondaryBtnBgdHover};color: ${props => props.theme.secondaryBtnColor};align-items: center;justify-content: center;@@ -131,7 +130,7 @@ export const PanelHeaderContent = styled.div`export const PanelContent = styled.div.attrs({className: 'side-panel-panel__content'})`- background-color: ${props => props.theme.panelBackground};+ background-color: ${props => props.theme.panelContentBackground};padding: 12px;`;@@ -139,6 +138,7 @@ export const SidePanelSection = styled.div.attrs({className: 'side-panel-section'})`margin-bottom: 12px;+opacity: ${props => (props.disabled ? 0.4 : 1)};pointer-events: ${props => (props.disabled ? 'none' : 'all')};`;@@ -154,9 +154,10 @@ export const SidePanelDivider = styled.div.attrs({export const Tooltip = styled(ReactTooltip)`&.__react_component_tooltip {- font-size: 9.5px;+ font-size: ${props => props.theme.tooltipFontSize};font-weight: 500;padding: 7px 18px;+ box-shadow: ${props => props.theme.tooltipBoxShadow};&.type-dark {background-color: ${props => props.theme.tooltipBg};@@ -215,8 +216,14 @@ export const Button = styled.div.attrs(props => ({: props.theme.primaryBtnColor};cursor: pointer;display: inline-flex;- font-size: ${props => (props.large ? '14px' : props.small ? '10px' : '11px')};+ font-size: ${props =>+ props.large+ ? props.theme.primaryBtnFontSizeLarge+ : props.small+ ? props.theme.primaryBtnFontSizeSmall+ : props.theme.primaryBtnFontSizeDefault};font-weight: 500;+ font-family: ${props => props.theme.btnFontFamily};justify-content: center;letter-spacing: 0.3px;line-height: 14px;@@ -228,7 +235,14 @@ export const Button = styled.div.attrs(props => ({width: ${props => props.width || 'auto'};opacity: ${props => (props.disabled ? 0.4 : 1)};pointer-events: ${props => (props.disabled ? 'none' : 'all')};-+ border: ${props =>+ props.secondary+ ? props.theme.secondaryBtnBorder+ : props.floating+ ? props.theme.floatingBtnBorder+ : props.link+ ? props.theme.linkBtnBorder+ : props.theme.primaryBtnBorder};:hover,:focus,:active,@@ -304,7 +318,6 @@ export const StyledPanelDropdown = styled.div`overflow-y: auto;box-shadow: ${props => props.theme.panelBoxShadow};border-radius: ${props => props.theme.panelBorderRadius};- margin-top: 2px;max-height: 500px;position: relative;z-index: 999;@@ -336,18 +349,26 @@ export const DatasetSquare = styled.div``;export const SelectionButton = styled.div`+ position: relative;border-radius: 2px;border: 1px solid- ${props => (props.selected ? props.theme.primaryBtnBgd : props.theme.selectBorderColorLT)};- color: ${props => (props.selected ? props.theme.primaryBtnBgd : props.theme.selectBorderColorLT)};+ ${props =>+ props.selected+ ? props.theme.selectionBtnBorderActColor+ : props.theme.selectionBtnBorderColor};+ color: ${props =>+ props.selected ? props.theme.selectionBtnActColor : props.theme.selectionBtnColor};+ background-color: ${props =>+ props.selected ? props.theme.selectionBtnActBgd : props.theme.selectionBtnBgd};+cursor: pointer;font-weight: 500;margin-right: 6px;- padding: 6px 10px;+ padding: 6px 16px;:hover {- color: ${props => props.available && props.theme.primaryBtnBgd};- border: 1px solid ${props => props.available && props.theme.primaryBtnBgd};+ color: ${props => props.theme.selectionBtnActColor};+ border: 1px solid ${props => props.theme.selectionBtnBorderActColor};}`;@@ -549,52 +570,31 @@ export const StyledExportSection = styled.div`}`;-export const StyledFilteredOption = styled.div`+export const StyledFilteredOption = styled(SelectionButton)`align-items: center;- border-radius: 2px;- border: 1px solid- ${props => (props.selected ? props.theme.primaryBtnBgd : props.theme.selectBorderColorLT)};- cursor: pointer;display: flex;flex-direction: column;- height: 60px;justify-content: center;margin: 4px;padding: 8px 12px;width: 140px;- :hover {- border: 1px solid ${props => props.theme.primaryBtnBgd};- }-.filter-option-title {color: ${props => props.theme.textColorLT};font-size: 12px;font-weight: 500;}.filter-option-subtitle {- color: ${props => props.theme.textColor};+ color: ${props => props.theme.subtextColorLT};font-size: 11px;}`;-export const StyledType = styled.div`- border-radius: 2px;- border: 1px solid- ${props => (props.selected ? props.theme.primaryBtnBgdHover : props.theme.selectBorderColorLT)};- color: ${props =>- props.selected ? props.theme.primaryBtnBgdHover : props.theme.selectBorderColorLT};- cursor: pointer;- font-weight: 500;+export const StyledType = styled(SelectionButton)`height: 100px;margin: 4px;padding: 6px 10px;width: 100px;-- :hover {- color: ${props => props.available && props.theme.primaryBtnBgd};- border: 1px solid ${props => props.available && props.theme.primaryBtnBgd};- }`;export const WidgetContainer = styled.div`@@ -602,7 +602,7 @@ export const WidgetContainer = styled.div``;export const BottomWidgetInner = styled.div`- background-color: ${props => props.theme.panelBackground};+ background-color: ${props => props.theme.bottomWidgetBgd};padding: ${props => `${props.theme.bottomInnerPdVert}px ${props.theme.bottomInnerPdSide}px`};position: relative;margin-top: ${props => props.theme.bottomPanelGap}px;@@ -620,6 +620,8 @@ export const MapControlButton = styled(Button).attrs({props.active ? props.theme.floatingBtnBgdHover : props.theme.floatingBtnBgd};color: ${props =>props.active ? props.theme.floatingBtnActColor : props.theme.floatingBtnColor};+ border: ${props =>+ props.active ? props.theme.floatingBtnBorderHover : props.theme.floatingBtnBorder};:hover,:focus,@@ -627,6 +629,7 @@ export const MapControlButton = styled(Button).attrs({&.active {background-color: ${props => props.theme.floatingBtnBgdHover};color: ${props => props.theme.floatingBtnActColor};+ border: ${props => props.theme.floatingBtnBorderHover};}svg {margin-right: 0;@@ -634,7 +637,7 @@ export const MapControlButton = styled(Button).attrs({`;export const StyledFilterContent = styled.div`- background-color: ${props => props.theme.panelBackground};+ background-color: ${props => props.theme.panelContentBackground};padding: 12px;`;@@ -643,3 +646,31 @@ export const TruncatedTitleText = styled.div`text-overflow: ellipsis;overflow: hidden;`;++export const CheckMark = styled.span.attrs({+ className: 'checkbox-inner'+})`+ background-color: ${props => props.theme.selectionBtnBorderActColor};+ position: absolute;+ top: 0;+ right: 0;+ display: block;+ width: 10px;+ height: 10px;+ border-top-left-radius: 2px;++ :after {+ position: absolute;+ display: table;+ border: 1px solid #fff;+ border-top: 0;+ border-left: 0;+ transform: rotate(45deg) scale(1) translate(-50%, -50%);+ opacity: 1;+ content: ' ';+ top: 40%;+ left: 30%;+ width: 3.2px;+ height: 6.22px;+ }+`;diff --git a/src/components/common/toolbar-item.js b/src/components/common/toolbar-item.jsindex 911ac6cd3..40ebc4c0c 100644--- a/src/components/common/toolbar-item.js+++ b/src/components/common/toolbar-item.js@@ -25,7 +25,35 @@ import {FormattedMessage} from 'localization';const StyledDiv = styled.div.attrs({className: 'toolbar-item'})`- color: ${props => (props.active ? props.theme.titleTextColor : props.theme.textColor)};+ color: ${props =>+ props.active ? props.theme.toolbarItemIconHover : props.theme.panelHeaderIcon};+ padding: 12px 20px;+ align-items: center;+ display: flex;+ flex-direction: column;+ width: 110px;+ justify-content: space-between;+ border: 1px solid ${props => (props.active ? props.theme.toolbarItemBorderHover : 'transparent')};+ border-radius: ${props => props.theme.toolbarItemBorderRaddius};+ background-color: ${props =>+ props.active ? props.theme.toolbarItemBgdHover : props.theme.dropdownListBgd};++ svg {+ margin-bottom: 4px;+ }+ .toolbar-item__title {+ white-space: nowrap;+ color: ${props => props.theme.textColorHl};+ }++ :hover {+ background-color: ${props => props.theme.toolbarItemBgdHover};+ border-color: ${props => props.theme.toolbarItemBorderHover};+ svg {+ color: ${props => props.theme.toolbarItemIconHover};+ }+ cursor: pointer;+ }`;const ToolbarItem = React.memo(props => (diff --git a/src/components/common/toolbar.js b/src/components/common/toolbar.jsindex 4a452ae8d..a41ce88cf 100644--- a/src/components/common/toolbar.js+++ b/src/components/common/toolbar.js@@ -25,8 +25,7 @@ const Toolbar = styled.div`flex-direction: row;background-color: ${props => props.theme.dropdownListBgd};box-shadow: ${props => props.theme.dropdownListShadow};- font-size: 11px;- padding: 16px 0;+ font-size: 12px;transition: ${props => props.theme.transitionSlow};margin-top: ${props => (props.show ? '6px' : '20px')};opacity: ${props => (props.show ? 1 : 0)};@@ -39,28 +38,6 @@ const Toolbar = styled.div`background-color: transparent;display: flex;}-- .toolbar-item {- align-items: center;- border-right: 1px solid ${props => props.theme.panelHeaderIcon};- padding: 0 22px;- display: flex;- flex-direction: column;-- .toolbar-item__title {- white-space: nowrap;- margin-top: 4px;- }-- :hover {- cursor: pointer;- color: ${props => props.theme.textColorHl};- }-- &:last-child {- border-right: 0;- }- }`;Toolbar.displayName = 'Toolbar';diff --git a/src/components/common/vertical-toolbar.js b/src/components/common/vertical-toolbar.jsindex 39090870c..0848b63f6 100644--- a/src/components/common/vertical-toolbar.js+++ b/src/components/common/vertical-toolbar.js@@ -23,16 +23,10 @@ import Toolbar from './toolbar';const VerticalToolbar = styled(Toolbar)`flex-direction: column;- padding: 0 24px;.toolbar-item {- padding: 16px 0;- border-right: 0;- border-bottom: 1px solid ${props => props.theme.panelHeaderIcon};-- &:last-of-type {- border-bottom: 0;- }+ width: 78px;+ padding: 13px 16px;}`;diff --git a/src/components/filters/filter-panels/filter-panel-with-field-select.js b/src/components/filters/filter-panels/filter-panel-with-field-select.jsindex 4e16c6622..46e5ce056 100644--- a/src/components/filters/filter-panels/filter-panel-with-field-select.js+++ b/src/components/filters/filter-panels/filter-panel-with-field-select.js@@ -21,13 +21,17 @@import React, {useCallback, useMemo} from 'react';import {StyledFilterContent} from 'components/common/styled-components';import FilterPanelHeaderFactory from 'components/side-panel/filter-panel/filter-panel-header';-import FieldSelector from 'components/common/field-selector';import PanelHeaderAction from 'components/side-panel/panel-header-action';import SourceDataSelectorFactory from 'components/side-panel/common/source-data-selector';+import FieldSelectorFactory from '../../common/field-selector';-FieldPanelWithFieldSelectFactory.deps = [FilterPanelHeaderFactory, SourceDataSelectorFactory];+FieldPanelWithFieldSelectFactory.deps = [+ FilterPanelHeaderFactory,+ SourceDataSelectorFactory,+ FieldSelectorFactory+];-function FieldPanelWithFieldSelectFactory(FilterPanelHeader, SourceDataSelector) {+function FieldPanelWithFieldSelectFactory(FilterPanelHeader, SourceDataSelector, FieldSelector) {const FilterPanelWithFieldSelect = React.memo(({allAvailableFields,diff --git a/src/components/filters/filter-panels/new-filter-panel.js b/src/components/filters/filter-panels/new-filter-panel.jsindex 8745c0b38..e286a015e 100644--- a/src/components/filters/filter-panels/new-filter-panel.js+++ b/src/components/filters/filter-panels/new-filter-panel.js@@ -21,12 +21,16 @@import React, {useCallback} from 'react';import {StyledFilterContent} from 'components/common/styled-components';import FilterPanelHeaderFactory from 'components/side-panel/filter-panel/filter-panel-header';-import FieldSelector from 'components/common/field-selector';import SourceDataSelectorFactory from 'components/side-panel/common/source-data-selector';+import FieldSelectorFactory from '../../common/field-selector';-NewFilterPanelFactory.deps = [FilterPanelHeaderFactory, SourceDataSelectorFactory];+NewFilterPanelFactory.deps = [+ FilterPanelHeaderFactory,+ SourceDataSelectorFactory,+ FieldSelectorFactory+];-function NewFilterPanelFactory(FilterPanelHeader, SourceDataSelector) {+function NewFilterPanelFactory(FilterPanelHeader, SourceDataSelector, FieldSelector) {const NewFilterPanel = React.memo(({idx, filter, datasets, allAvailableFields, setFilter, removeFilter, enlargeFilter}) => {const onFieldSelector = useCallback(field => setFilter(idx, 'name', field.name), [diff --git a/src/components/filters/time-widget.js b/src/components/filters/time-widget.jsindex 0bb693b05..bc1889a48 100644--- a/src/components/filters/time-widget.js+++ b/src/components/filters/time-widget.js@@ -22,8 +22,6 @@ import React, {Component} from 'react';import styled from 'styled-components';import {createSelector} from 'reselect';-import FieldSelector from 'components/common/field-selector';-import {SelectTextBold,IconRoundSmall,@@ -34,6 +32,7 @@ import {Close, Clock, LineChart} from 'components/common/icons';import SpeedControlFactory from 'components/common/animation-control/speed-control';import TimeRangeFilterFactory from 'components/filters/time-range-filter';import FloatingTimeDisplayFactory from 'components/common/animation-control/floating-time-display';+import FieldSelectorFactory from '../common/field-selector';const TOP_SECTION_HEIGHT = '36px';@@ -103,9 +102,13 @@ const StyledTitle = styled(CenterFlexbox)`}`;-TimeWidgetFactory.deps = [SpeedControlFactory, TimeRangeFilterFactory, FloatingTimeDisplayFactory];--function TimeWidgetFactory(SpeedControl, TimeRangeFilter, FloatingTimeDisplay) {+TimeWidgetFactory.deps = [+ SpeedControlFactory,+ TimeRangeFilterFactory,+ FloatingTimeDisplayFactory,+ FieldSelectorFactory+];+function TimeWidgetFactory(SpeedControl, TimeRangeFilter, FloatingTimeDisplay, FieldSelector) {class TimeWidget extends Component {state = {showSpeedControl: falsediff --git a/src/components/index.js b/src/components/index.jsindex a208d6767..a3cd78efe 100644--- a/src/components/index.js+++ b/src/components/index.js@@ -23,6 +23,8 @@ import RangeSliderFactory from './common/range-slider';import VisConfigSliderFactory from './side-panel/layer-panel/vis-config-slider';import LayerConfigGroupFactory from './side-panel/layer-panel/layer-config-group';import {ChannelByValueSelectorFactory} from './side-panel/layer-panel/layer-configurator';+import FieldSelectorFactory from './common/field-selector';+import FieldTokenFactory from './common/field-token';import {appInjector} from './container';// Components@@ -101,7 +103,7 @@ export {default as FloatingTimeDisplayFactory} from './common/animation-control/export {default as AnimationSpeedSliderFactory} from './common/animation-control/animation-speed-slider';export {default as RangePlotFactory} from './common/range-plot';export {default as RangeBrushFactory} from './common/range-brush';-export {FieldListItemFactory} from './common/field-selector';+export {FieldListItemFactoryFactory} from './common/field-selector';export {default as TimeSliderMarkerFactory} from './common/time-slider-marker';export {default as InfoHelperFactory} from 'components/common/info-helper';@@ -124,13 +126,13 @@ export {default as CloudTile} from './modals/cloud-tile';export {default as FileUploadFactory, FileUpload} from './common/file-uploader/file-upload';export {default as DatasetLabel} from './common/dataset-label';export {default as ItemSelector} from './common/item-selector/item-selector';-export {default as FieldSelector} from './common/field-selector';+export {default as FieldSelectorFactory} from './common/field-selector';export {default as Modal, ModalFooter, ModalTitle} from './common/modal';export {default as AppLogo} from './common/logo';export {default as Switch} from './common/switch';export {default as LoadingSpinner} from './common/loading-spinner';export {default as LoadingDialog} from './modals/loading-dialog';-export {default as FieldToken} from './common/field-token';+export {default as FieldTokenFactory} from './common/field-token';export {default as Portaled} from './common/portaled';export {default as DropdownList} from './common/item-selector/dropdown-list';export {default as ProgressBar} from './common/progress-bar';@@ -163,6 +165,8 @@ export const RangeSlider = appInjector.get(RangeSliderFactory);export const VisConfigSlider = appInjector.get(VisConfigSliderFactory);export const LayerConfigGroup = appInjector.get(LayerConfigGroupFactory);export const ChannelByValueSelector = appInjector.get(ChannelByValueSelectorFactory);+export const FieldSelector = appInjector.get(FieldSelectorFactory);+export const FieldToken = appInjector.get(FieldTokenFactory);export {TimeRangeSliderFactory,diff --git a/src/components/modal-container.js b/src/components/modal-container.jsindex e0b4d5abf..1f1e68d2c 100644--- a/src/components/modal-container.js+++ b/src/components/modal-container.js@@ -355,6 +355,7 @@ export default function ModalContainerFactory(mapW={containerW}mapH={containerH}onUpdateImageSetting={uiStateActions.setExportImageSetting}+ cleanupExportImage={uiStateActions.cleanupExportImage}/>);modalProps = {diff --git a/src/components/modals/cloud-tile.js b/src/components/modals/cloud-tile.jsindex 2f08ffe70..5191034a7 100644--- a/src/components/modals/cloud-tile.js+++ b/src/components/modals/cloud-tile.js@@ -21,7 +21,7 @@import React from 'react';import styled from 'styled-components';import {Logout, Login} from 'components/common/icons';-import {CenterVerticalFlexbox, Button} from 'components/common/styled-components';+import {CenterVerticalFlexbox, Button, CheckMark} from 'components/common/styled-components';import LoadingSpinner from 'components/common/loading-spinner';const StyledTileWrapper = styled.div.attrs({@@ -52,33 +52,6 @@ const StyledTileWrapper = styled.div.attrs({}`;-const CheckMark = styled.span.attrs({- className: 'checkbox-inner'-})`- background-color: ${props => props.theme.primaryBtnBgd};- position: absolute;- bottom: 0;- right: 0;- display: block;- width: 16px;- height: 16px;- border-top-left-radius: 2px;-- :after {- position: absolute;- display: table;- border: 2px solid #fff;- border-top: 0;- border-left: 0;- transform: rotate(45deg) scale(1) translate(-50%, -50%);- opacity: 1;- content: ' ';- top: 50%;- left: 25%;- width: 5.7px;- height: 9.1px;- }-`;const StyledBox = styled(CenterVerticalFlexbox)`margin-right: 12px;`;diff --git a/src/components/modals/export-data-modal.js b/src/components/modals/export-data-modal.jsindex 02d59d24e..d34fdeac0 100644--- a/src/components/modals/export-data-modal.js+++ b/src/components/modals/export-data-modal.js@@ -27,7 +27,8 @@ import {StyledExportSection,StyledFilteredOption,StyledModalContent,- StyledType+ StyledType,+ CheckMark} from 'components/common/styled-components';import {injectIntl} from 'react-intl';import {FormattedMessage} from 'localization';@@ -132,6 +133,7 @@ const ExportDataModalFactory = () => {onClick={() => op.available && onChangeExportDataType(op.id)}><FileType ext={op.label} height="80px" fontSize="11px" />+ {dataType === op.id && <CheckMark />}</StyledType>))}</div>@@ -157,6 +159,7 @@ const ExportDataModalFactory = () => {<div className="filter-option-subtitle">{getDataRowCount(datasets, selectedDataset, false, intl)}</div>+ {!filtered && <CheckMark />}</StyledFilteredOption><StyledFilteredOptionclassName="filtered-option"@@ -169,6 +172,7 @@ const ExportDataModalFactory = () => {<div className="filter-option-subtitle">{getDataRowCount(datasets, selectedDataset, true, intl)}</div>+ {filtered && <CheckMark />}</StyledFilteredOption></div></StyledExportSection>diff --git a/src/components/modals/export-image-modal.js b/src/components/modals/export-image-modal.jsindex 2eac5dafb..feb70aedb 100644--- a/src/components/modals/export-image-modal.js+++ b/src/components/modals/export-image-modal.js@@ -24,7 +24,7 @@ import ImagePreview from 'components/common/image-preview';import {EXPORT_IMG_RATIO_OPTIONS, EXPORT_IMG_RESOLUTION_OPTIONS} from 'constants/default-settings';-import {StyledModalContent, SelectionButton} from 'components/common/styled-components';+import {StyledModalContent, SelectionButton, CheckMark} from 'components/common/styled-components';import Switch from 'components/common/switch';import {injectIntl} from 'react-intl';import {FormattedMessage} from 'localization';@@ -101,6 +101,7 @@ const ExportImageModalFactory = () => {onClick={() => onUpdateImageSetting({ratio: op.id})}><FormattedMessage id={op.label} />+ {ratio === op.id && <CheckMark />}</SelectionButton>))}</div>@@ -118,6 +119,7 @@ const ExportImageModalFactory = () => {onClick={() => op.available && onUpdateImageSetting({resolution: op.id})}>{op.label}+ {resolution === op.id && <CheckMark />}</SelectionButton>))}</div>diff --git a/src/components/modals/export-map-modal/export-html-map.d.ts b/src/components/modals/export-map-modal/export-html-map.d.tsnew file mode 100644index 000000000..ab30a67e4--- /dev/null+++ b/src/components/modals/export-map-modal/export-html-map.d.ts@@ -0,0 +1,18 @@+import React from 'react';+import {setUserMapboxAccessToken, setExportHTMLMapMode} from '../../actions';+import {WithIntlProps} from 'react-intl';++export type ExportHtmlMapProps = WithIntlProps<{+ onChangeExportMapHTMLMode: typeof setExportHTMLMapMode;+ onEditUserMapboxAccessToken: typeof setUserMapboxAccessToken;+ options: {+ userMapboxToken?: string;+ mode?: string;+ };+ intl: any;+}>;++export const ExportHtmlMap: React.FunctionComponent<ExportHtmlMapProps>;+function ExportHtmlMapFactory(): React.FunctionComponent<ExportHtmlMapProps>;++export default ExportHtmlMapFactory;diff --git a/src/components/modals/export-map-modal/export-html-map.js b/src/components/modals/export-map-modal/export-html-map.jsindex 8434e4027..8b881343e 100644--- a/src/components/modals/export-map-modal/export-html-map.js+++ b/src/components/modals/export-map-modal/export-html-map.js@@ -20,7 +20,7 @@import React from 'react';import PropTypes from 'prop-types';-import {StyledExportSection, StyledType} from 'components/common/styled-components';+import {StyledExportSection, StyledType, CheckMark} from 'components/common/styled-components';import {StyledExportMapSection, StyledWarning, ExportMapLink} from './components';import {EXPORT_HTML_MAP_MODE_OPTIONS} from 'constants/default-settings';import {EXPORT_HTML_MAP_DOC, EXPORT_HTML_MAP_MODES_DOC} from 'constants/user-guides';@@ -28,6 +28,8 @@ import styled from 'styled-components';import {injectIntl} from 'react-intl';import {FormattedMessage} from 'localization';+/** @typedef {import('./export-html-map').ExportHtmlMapProps} ExportHtmlMapProps */+const ExportMapStyledExportSection = styled(StyledExportSection)`.disclaimer {font-size: ${props => props.theme.inputFontSize};@@ -66,91 +68,89 @@ const exportHtmlPropTypes = {onEditUserMapboxAccessToken: PropTypes.func.isRequired};-const ExportHtmlMapUnmemoized = ({- onChangeExportMapHTMLMode = mode => {},- onEditUserMapboxAccessToken = token => {},- options = {},- intl-}) => (- <div>- <StyledExportMapSection>- <div className="description" />- <div className="selection">- <FormattedMessage id={'modal.exportMap.html.selection'} />- </div>- </StyledExportMapSection>- <ExportMapStyledExportSection className="export-map-modal__html-options">- <div className="description">- <div className="title">- <FormattedMessage id={'modal.exportMap.html.tokenTitle'} />+function ExportHtmlMapFactory() {+ /**+ * @type {React.FunctionComponent<ExportHtmlMapProps>}+ */+ const ExportHtmlMap = ({+ onChangeExportMapHTMLMode = mode => {},+ onEditUserMapboxAccessToken = token => {},+ options = {},+ intl+ }) => (+ <div>+ <StyledExportMapSection>+ <div className="description" />+ <div className="selection">+ <FormattedMessage id={'modal.exportMap.html.selection'} /></div>- <div className="subtitle">- <FormattedMessage id={'modal.exportMap.html.tokenSubtitle'} />+ </StyledExportMapSection>+ <ExportMapStyledExportSection className="export-map-modal__html-options">+ <div className="description">+ <div className="title">+ <FormattedMessage id={'modal.exportMap.html.tokenTitle'} />+ </div>+ <div className="subtitle">+ <FormattedMessage id={'modal.exportMap.html.tokenSubtitle'} />+ </div></div>- </div>- <div className="selection">- <StyledInput- onChange={e => onEditUserMapboxAccessToken(e.target.value)}- type="text"- placeholder={intl.formatMessage({id: 'modal.exportMap.html.tokenPlaceholder'})}- value={- // @ts-ignore- options ? options.userMapboxToken : ''- }- />- <div className="disclaimer">- <StyledWarning>- <FormattedMessage id={'modal.exportMap.html.tokenMisuseWarning'} />- </StyledWarning>- <FormattedMessage id={'modal.exportMap.html.tokenDisclaimer'} />- <ExportMapLink href={EXPORT_HTML_MAP_DOC}>- <FormattedMessage id={'modal.exportMap.html.tokenUpdate'} />- </ExportMapLink>+ <div className="selection">+ <StyledInput+ onChange={e => onEditUserMapboxAccessToken(e.target.value)}+ type="text"+ placeholder={intl.formatMessage({id: 'modal.exportMap.html.tokenPlaceholder'})}+ value={options ? options.userMapboxToken : ''}+ />+ <div className="disclaimer">+ <StyledWarning>+ <FormattedMessage id={'modal.exportMap.html.tokenMisuseWarning'} />+ </StyledWarning>+ <FormattedMessage id={'modal.exportMap.html.tokenDisclaimer'} />+ <ExportMapLink href={EXPORT_HTML_MAP_DOC}>+ <FormattedMessage id={'modal.exportMap.html.tokenUpdate'} />+ </ExportMapLink>+ </div></div>- </div>- </ExportMapStyledExportSection>- <ExportMapStyledExportSection>- <div className="description">- <div className="title">- <FormattedMessage id={'modal.exportMap.html.modeTitle'} />+ </ExportMapStyledExportSection>+ <ExportMapStyledExportSection>+ <div className="description">+ <div className="title">+ <FormattedMessage id={'modal.exportMap.html.modeTitle'} />+ </div>+ <div className="subtitle">+ <FormattedMessage id={'modal.exportMap.html.modeSubtitle1'} />+ <a href={EXPORT_HTML_MAP_MODES_DOC}>+ <FormattedMessage id={'modal.exportMap.html.modeSubtitle2'} />+ </a>+ </div></div>- <div className="subtitle">- <FormattedMessage id={'modal.exportMap.html.modeSubtitle1'} />- <a href={EXPORT_HTML_MAP_MODES_DOC}>- <FormattedMessage id={'modal.exportMap.html.modeSubtitle2'} />- </a>+ <div className="selection">+ {EXPORT_HTML_MAP_MODE_OPTIONS.map(mode => (+ <BigStyledTile+ key={mode.id}+ selected={options.mode === mode.id}+ available={mode.available}+ onClick={() => mode.available && onChangeExportMapHTMLMode(mode.id)}+ >+ <img src={mode.url} alt="" />+ <p>+ <FormattedMessage+ id={'modal.exportMap.html.modeDescription'}+ values={{mode: intl.formatMessage({id: mode.label})}}+ />+ </p>+ {options.mode === mode.id && <CheckMark />}+ </BigStyledTile>+ ))}</div>- </div>- <div className="selection">- {EXPORT_HTML_MAP_MODE_OPTIONS.map(mode => (- <BigStyledTile- key={mode.id}- selected={- // @ts-ignore- options.mode === mode.id- }- available={mode.available}- onClick={() => mode.available && onChangeExportMapHTMLMode(mode.id)}- >- <img src={mode.url} alt="" />- <p>- <FormattedMessage- id={'modal.exportMap.html.modeDescription'}- values={{mode: intl.formatMessage({id: mode.label})}}- />- </p>- </BigStyledTile>- ))}- </div>- </ExportMapStyledExportSection>- </div>-);--ExportHtmlMapUnmemoized.propTypes = exportHtmlPropTypes;-ExportHtmlMapUnmemoized.displayName = 'ExportHtmlMap';+ </ExportMapStyledExportSection>+ </div>+ );-const ExportHtmlMap = React.memo(ExportHtmlMapUnmemoized);+ ExportHtmlMap.propTypes = exportHtmlPropTypes;+ ExportHtmlMap.displayName = 'ExportHtmlMap';-const ExportHtmlMapFactory = () => injectIntl(ExportHtmlMap);+ return injectIntl(ExportHtmlMap);+}export default ExportHtmlMapFactory;diff --git a/src/components/modals/export-map-modal/export-map-modal.js b/src/components/modals/export-map-modal/export-map-modal.jsindex 14aa2a113..dd02f5cb4 100644--- a/src/components/modals/export-map-modal/export-map-modal.js+++ b/src/components/modals/export-map-modal/export-map-modal.js@@ -22,7 +22,7 @@ import React from 'react';import PropTypes from 'prop-types';import {FileType} from 'components/common/icons';-import {StyledModalContent, StyledType} from 'components/common/styled-components';+import {StyledModalContent, StyledType, CheckMark} from 'components/common/styled-components';import {EXPORT_MAP_FORMATS, EXPORT_MAP_FORMAT_OPTIONS} from 'constants/default-settings';import {StyledExportMapSection} from './components';import ExportHtmlMapFactory from './export-html-map';@@ -50,7 +50,7 @@ function ExportMapModalFactory(ExportHtmlMap, ExportJsonMap) {onChangeExportMapFormat = format => {},onChangeExportMapHTMLMode = NO_OP,onEditUserMapboxAccessToken = NO_OP,- options = {}+ options = {format: ''}}) => (<StyledModalContent className="export-map-modal"><div style={style}>@@ -67,14 +67,13 @@ function ExportMapModalFactory(ExportHtmlMap, ExportJsonMap) {{EXPORT_MAP_FORMAT_OPTIONS.map(op => (<StyledTypekey={op.id}- selected={- // @ts-ignore- options.format === op.id- }+ selected={options.format === op.id}available={op.available}onClick={() => op.available && onChangeExportMapFormat(op.id)}><FileType ext={op.label} height="80px" fontSize="11px" />++ {options.format === op.id && <CheckMark />}</StyledType>))}</div>@@ -85,20 +84,14 @@ function ExportMapModalFactory(ExportHtmlMap, ExportJsonMap) {<ExportHtmlMaponChangeExportMapHTMLMode={onChangeExportMapHTMLMode}onEditUserMapboxAccessToken={onEditUserMapboxAccessToken}- options={- // @ts-ignore- options[options.format]- }+ options={options[options.format]}/>),[EXPORT_MAP_FORMATS.JSON]: (<ExportJsonMapconfig={config}onChangeExportData={onChangeExportData}- options={- // @ts-ignore- options[options.format]- }+ options={options[options.format]}/>)}[diff --git a/src/components/side-panel.js b/src/components/side-panel.jsindex 2edeb3e56..291f68d48 100644--- a/src/components/side-panel.js+++ b/src/components/side-panel.js@@ -63,6 +63,7 @@ const SidePanelContent = styled.div`export const PanelTitleFactory = () => styled.div`color: ${props => props.theme.titleTextColor};font-size: ${props => props.theme.sidePanelTitleFontsize};+ line-height: ${props => props.theme.sidePanelTitleLineHeight};font-weight: 400;letter-spacing: 1.25px;margin-bottom: 14px;diff --git a/src/components/side-panel/interaction-panel/interaction-panel.js b/src/components/side-panel/interaction-panel/interaction-panel.jsindex a8e8bc0d8..46d37a2a2 100644--- a/src/components/side-panel/interaction-panel/interaction-panel.js+++ b/src/components/side-panel/interaction-panel/interaction-panel.js@@ -34,10 +34,6 @@ import {} from 'components/common/styled-components';import {FormattedMessage} from 'localization';-const StyledPanelContent = styled(PanelContent)`- border-top: 1px solid ${props => props.theme.panelBorderColor};-`;-const StyledInteractionPanel = styled.div`padding-bottom: 6px;`;@@ -90,7 +86,7 @@ function InteractionPanelFactory(TooltipConfig, BrushConfig) {<StyledPanelHeader className="interaction-panel__header" onClick={this._enableConfig}><PanelHeaderContent className="interaction-panel__header__content"><div className="interaction-panel__header__icon icon">- <config.iconComponent height="12px" />+ <config.iconComponent height="16px" /></div><div className="interaction-panel__header__title"><PanelHeaderTitle>@@ -108,9 +104,7 @@ function InteractionPanelFactory(TooltipConfig, BrushConfig) {</div></StyledPanelHeader>{config.enabled && template && (- <StyledPanelContent className="interaction-panel__content">- {template}- </StyledPanelContent>+ <PanelContent className="interaction-panel__content">{template}</PanelContent>)}</StyledInteractionPanel>);diff --git a/src/components/side-panel/interaction-panel/tooltip-config.js b/src/components/side-panel/interaction-panel/tooltip-config.jsindex 1b263bdf0..c7536e2a2 100644--- a/src/components/side-panel/interaction-panel/tooltip-config.js+++ b/src/components/side-panel/interaction-panel/tooltip-config.js@@ -29,13 +29,12 @@ import {Button,PanelLabel} from 'components/common/styled-components';-import FieldSelector from 'components/common/field-selector';import DatasetTagFactory from 'components/side-panel/common/dataset-tag';import TooltipChickletFactory from './tooltip-config/tooltip-chicklet';import Switch from 'components/common/switch';import ItemSelector from 'components/common/item-selector/item-selector';import {COMPARE_TYPES} from 'constants/tooltip';-TooltipConfigFactory.deps = [DatasetTagFactory];+import FieldSelectorFactory from '../../common/field-selector';const TooltipConfigWrapper = styled.div`.item-selector > div > div {@@ -68,7 +67,8 @@ const CompareSwitchWrapper = styled.div`margin-bottom: 8px;`;-function TooltipConfigFactory(DatasetTag) {+TooltipConfigFactory.deps = [DatasetTagFactory, FieldSelectorFactory];+function TooltipConfigFactory(DatasetTag, FieldSelector) {class TooltipConfig extends Component {render() {const {config, datasets, onChange, intl} = this.props;@@ -92,7 +92,7 @@ function TooltipConfigFactory(DatasetTag) {};onChange(newConfig);}}- width="48px"+ width="54px"secondary><FormattedMessage id="fieldSelector.clearAll" />diff --git a/src/components/side-panel/layer-panel/layer-column-config.js b/src/components/side-panel/layer-panel/layer-column-config.jsindex 166d402fc..2c1197568 100644--- a/src/components/side-panel/layer-panel/layer-column-config.js+++ b/src/components/side-panel/layer-panel/layer-column-config.js@@ -22,86 +22,113 @@ import React, {Component} from 'react';import PropTypes from 'prop-types';import styled from 'styled-components';import {FormattedMessage} from 'localization';-import FieldSelector from 'components/common/field-selector';import {createSelector} from 'reselect';import {PanelLabel, SidePanelSection} from 'components/common/styled-components';+import FieldSelectorFactory from '../../common/field-selector';const TopRow = styled.div`display: flex;justify-content: space-between;`;+LayerColumnConfigFactory.deps = [ColumnSelectorFactory];+function LayerColumnConfigFactory(ColumnSelector) {+ class LayerColumnConfig extends Component {+ static propTypes = {+ columns: PropTypes.object.isRequired,+ fields: PropTypes.arrayOf(PropTypes.any).isRequired,+ assignColumnPairs: PropTypes.func.isRequired,+ assignColumn: PropTypes.func.isRequired,+ updateLayerConfig: PropTypes.func.isRequired,+ columnPairs: PropTypes.object,+ fieldPairs: PropTypes.arrayOf(PropTypes.any),+ columnLabels: PropTypes.object+ };-export default class LayerColumnConfig extends Component {- static propTypes = {- columns: PropTypes.object.isRequired,- fields: PropTypes.arrayOf(PropTypes.any).isRequired,- assignColumnPairs: PropTypes.func.isRequired,- assignColumn: PropTypes.func.isRequired,- updateLayerConfig: PropTypes.func.isRequired,- columnPairs: PropTypes.object,- fieldPairs: PropTypes.arrayOf(PropTypes.any),- columnLabels: PropTypes.object- };-- columnPairs = props => props.columnPairs;- fieldPairs = props => props.fieldPairs;- fieldPairsSelector = createSelector(- this.columnPairs,- this.fieldPairs,- (columnPairs, fieldPairs) =>- columnPairs- ? fieldPairs.map(fp => ({- name: fp.defaultName,- type: 'point',- pair: fp.pair- }))- : null- );+ columnPairs = props => props.columnPairs;+ fieldPairs = props => props.fieldPairs;+ fieldPairsSelector = createSelector(+ this.columnPairs,+ this.fieldPairs,+ (columnPairs, fieldPairs) =>+ columnPairs+ ? fieldPairs.map(fp => ({+ name: fp.defaultName,+ type: 'point',+ pair: fp.pair+ }))+ : null+ );- _updateColumn(key, value) {- const {columnPairs, assignColumnPairs, assignColumn} = this.props;+ _updateColumn(key, value) {+ const {columnPairs, assignColumnPairs, assignColumn} = this.props;- const columns =- value && value.pair && columnPairs- ? assignColumnPairs(key, value.pair)- : assignColumn(key, value);+ const columns =+ value && value.pair && columnPairs+ ? assignColumnPairs(key, value.pair)+ : assignColumn(key, value);- this.props.updateLayerConfig({columns});- }+ this.props.updateLayerConfig({columns});+ }- render() {- const {columns, columnLabels, fields} = this.props;+ render() {+ const {columns, columnLabels, fields} = this.props;- const fieldPairs = this.fieldPairsSelector(this.props);+ const fieldPairs = this.fieldPairsSelector(this.props);- return (- <div>- <SidePanelSection>- <div className="layer-config__column">- <TopRow>- <PanelLabel>- <FormattedMessage id={'columns.title'} />- </PanelLabel>- <PanelLabel>- <FormattedMessage id="layer.required" />- </PanelLabel>- </TopRow>- {Object.keys(columns).map(key => (- <ColumnSelector- column={columns[key]}- label={(columnLabels && columnLabels[key]) || key}- key={key}- allFields={fields}- fieldPairs={fieldPairs}- onSelect={val => this._updateColumn(key, val)}- />- ))}- </div>- </SidePanelSection>- </div>- );+ return (+ <div>+ <SidePanelSection>+ <div className="layer-config__column">+ <TopRow>+ <PanelLabel>+ <FormattedMessage id={'columns.title'} />+ </PanelLabel>+ <PanelLabel>+ <FormattedMessage id="layer.required" />+ </PanelLabel>+ </TopRow>+ {Object.keys(columns).map(key => (+ <ColumnSelector+ column={columns[key]}+ label={(columnLabels && columnLabels[key]) || key}+ key={key}+ allFields={fields}+ fieldPairs={fieldPairs}+ onSelect={val => this._updateColumn(key, val)}+ />+ ))}+ </div>+ </SidePanelSection>+ </div>+ );+ }}+ return LayerColumnConfig;+}+ColumnSelectorFactory.deps = [FieldSelectorFactory];+function ColumnSelectorFactory(FieldSelector) {+ const ColumnSelector = ({column, label, allFields, onSelect, fieldPairs}) => (+ <ColumnRow className="layer-config__column__selector">+ <ColumnName className="layer-config__column__name">+ <PanelLabel>+ <FormattedMessage id={`columns.${label}`} />+ </PanelLabel>+ {!column.optional ? <PanelLabel>{` *`}</PanelLabel> : null}+ </ColumnName>+ <ColumnSelect className="layer-config__column__select">+ <FieldSelector+ suggested={fieldPairs}+ error={!column.optional && !column.value}+ fields={allFields}+ value={column.value}+ erasable={Boolean(column.optional)}+ onSelect={onSelect}+ />+ </ColumnSelect>+ </ColumnRow>+ );+ return ColumnSelector;}const ColumnRow = styled.div`@@ -111,29 +138,10 @@ const ColumnRow = styled.div``;const ColumnName = styled.div`- width: 30%;+ width: 25%;`;const ColumnSelect = styled.div`- width: 70%;+ width: 75%;`;-const ColumnSelector = ({column, label, allFields, onSelect, fieldPairs}) => (- <ColumnRow className="layer-config__column__selector">- <ColumnName className="layer-config__column__name">- <PanelLabel>- <FormattedMessage id={`columns.${label}`} />- </PanelLabel>- {!column.optional ? <PanelLabel>{` *`}</PanelLabel> : null}- </ColumnName>- <ColumnSelect className="layer-config__column__select">- <FieldSelector- suggested={fieldPairs}- error={!column.optional && !column.value}- fields={allFields}- value={column.value}- erasable={Boolean(column.optional)}- onSelect={onSelect}- />- </ColumnSelect>- </ColumnRow>-);+export default LayerColumnConfigFactory;diff --git a/src/components/side-panel/layer-panel/layer-config-group.js b/src/components/side-panel/layer-panel/layer-config-group.jsindex a042320c2..cb919482d 100644--- a/src/components/side-panel/layer-panel/layer-config-group.js+++ b/src/components/side-panel/layer-panel/layer-config-group.js@@ -51,8 +51,8 @@ export const ConfigGroupCollapsibleHeader = styled.div.attrs({`;export const StyledLayerConfigGroup = styled.div`- padding-left: 18px;- margin-bottom: 12px;+ padding-left: ${props => props.theme.layerConfigGroupPaddingLeft}px;+ margin-bottom: ${props => props.theme.layerConfigGroupMarginBottom}px;&.disabled {opacity: 0.3;diff --git a/src/components/side-panel/layer-panel/layer-configurator.js b/src/components/side-panel/layer-panel/layer-configurator.jsindex 98113b05d..c4186f685 100644--- a/src/components/side-panel/layer-panel/layer-configurator.js+++ b/src/components/side-panel/layer-panel/layer-configurator.js@@ -28,7 +28,7 @@ import {Button, Input, PanelLabel, SidePanelSection} from 'components/common/styimport ItemSelector from 'components/common/item-selector/item-selector';import VisConfigByFieldSelectorFactory from './vis-config-by-field-selector';-import LayerColumnConfig from './layer-column-config';+import LayerColumnConfigFactory from './layer-column-config';import LayerTypeSelector from './layer-type-selector';import DimensionScaleSelector from './dimension-scale-selector';import ColorSelector from './color-selector';@@ -47,7 +47,7 @@ const StyledLayerConfigurator = styled.div.attrs({})`position: relative;margin-top: ${props => props.theme.layerConfiguratorMargin};- padding-top: ${props => props.theme.layerConfiguratorPadding};+ padding: ${props => props.theme.layerConfiguratorPadding};border-left: ${props => props.theme.layerConfiguratorBorder} dashed${props => props.theme.layerConfiguratorBorderColor};`;@@ -86,7 +86,8 @@ LayerConfiguratorFactory.deps = [VisConfigSliderFactory,TextLabelPanelFactory,LayerConfigGroupFactory,- ChannelByValueSelectorFactory+ ChannelByValueSelectorFactory,+ LayerColumnConfigFactory];export default function LayerConfiguratorFactory(@@ -94,7 +95,8 @@ export default function LayerConfiguratorFactory(VisConfigSlider,TextLabelPanel,LayerConfigGroup,- ChannelByValueSelector+ ChannelByValueSelector,+ LayerColumnConfig) {class LayerConfigurator extends Component {static propTypes = {diff --git a/src/components/side-panel/layer-panel/layer-panel-header.js b/src/components/side-panel/layer-panel/layer-panel-header.jsindex 81a9492b0..3a12f5796 100644--- a/src/components/side-panel/layer-panel/layer-panel-header.js+++ b/src/components/side-panel/layer-panel/layer-panel-header.js@@ -53,6 +53,7 @@ export const defaultProps = {};const StyledLayerPanelHeader = styled(StyledPanelHeader)`+ height: ${props => props.theme.layerPanelHeaderHeight}px;.layer__remove-layer {opacity: 0;}diff --git a/src/components/side-panel/layer-panel/layer-type-selector.js b/src/components/side-panel/layer-panel/layer-type-selector.jsindex a29bd03d3..aff5971b4 100644--- a/src/components/side-panel/layer-panel/layer-type-selector.js+++ b/src/components/side-panel/layer-panel/layer-type-selector.js@@ -83,7 +83,7 @@ const StyledListItem = styled.div`text-transform: capitalize;font-size: 12px;text-align: center;- color: ${props => props.theme.labelColor};+ color: ${props => props.theme.selectColor};}`;diff --git a/src/components/side-panel/layer-panel/text-label-panel.js b/src/components/side-panel/layer-panel/text-label-panel.jsindex 2a9fbe5da..1ae170a8e 100644--- a/src/components/side-panel/layer-panel/text-label-panel.js+++ b/src/components/side-panel/layer-panel/text-label-panel.js@@ -31,7 +31,6 @@ import {} from 'components/common/styled-components';import {Add} from 'components/common/icons';import ColorSelector from './color-selector';-import FieldSelector from 'components/common/field-selector';import ItemSelector from 'components/common/item-selector/item-selector';import LayerConfigGroupFactory, {ConfigGroupCollapsibleContent,@@ -40,10 +39,10 @@ import LayerConfigGroupFactory, {import RangeSliderFactory from 'components/common/range-slider';import {LAYER_TEXT_CONFIGS} from 'layers/layer-factory';+import FieldSelectorFactory from '../../common/field-selector';-TextLabelPanelFactory.deps = [RangeSliderFactory, LayerConfigGroupFactory];--export default function TextLabelPanelFactory(RangeSlider, LayerConfigGroup) {+TextLabelPanelFactory.deps = [RangeSliderFactory, LayerConfigGroupFactory, FieldSelectorFactory];+function TextLabelPanelFactory(RangeSlider, LayerConfigGroup, FieldSelector) {class TextLabelPanel extends Component {static propTypes = {fields: PropTypes.arrayOf(PropTypes.object),@@ -143,3 +142,5 @@ export default function TextLabelPanelFactory(RangeSlider, LayerConfigGroup) {return TextLabelPanel;}++export default TextLabelPanelFactory;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.jsindex 0d11f6acc..74413367d 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@@ -23,13 +23,13 @@ import PropTypes from 'prop-types';import {FormattedMessage, injectIntl} from 'react-intl';import {PanelLabel, PanelLabelWrapper, SidePanelSection} from 'components/common/styled-components';-import FieldSelector from 'components/common/field-selector';import InfoHelperFacotry from 'components/common/info-helper';import DimensionScaleSelector from './dimension-scale-selector';import {camelize} from 'utils/utils';+import FieldSelectorFactory from '../../common/field-selector';-VisConfigByFieldSelectorFacotry.deps = [InfoHelperFacotry];-export default function VisConfigByFieldSelectorFacotry(InfoHelper) {+VisConfigByFieldSelectorFactory.deps = [InfoHelperFacotry, FieldSelectorFactory];+function VisConfigByFieldSelectorFactory(InfoHelper, FieldSelector) {class VisConfigByFieldSelector extends Component {static propTypes = {channel: PropTypes.string.isRequired,@@ -111,6 +111,7 @@ export default function VisConfigByFieldSelectorFacotry(InfoHelper) {);}}-return injectIntl(VisConfigByFieldSelector);}++export default VisConfigByFieldSelectorFactory;diff --git a/src/components/side-panel/panel-header-action.js b/src/components/side-panel/panel-header-action.jsindex 3cbeaa052..08215a7de 100644--- a/src/components/side-panel/panel-header-action.js+++ b/src/components/side-panel/panel-header-action.js@@ -34,7 +34,8 @@ const HeaderActionWrapper = styled.div`:hover {cursor: pointer;- color: ${props => (props.hoverColor ? props.theme[props.hoverColor] : props.theme.textColorHl)};+ color: ${props =>+ props.hoverColor ? props.theme[props.hoverColor] : props.theme.panelHeaderIconHover};}&.disabled {diff --git a/src/components/side-panel/panel-toggle.js b/src/components/side-panel/panel-toggle.jsindex 0f0ec6920..5c5f7b698 100644--- a/src/components/side-panel/panel-toggle.js+++ b/src/components/side-panel/panel-toggle.js@@ -46,13 +46,14 @@ const PanelTab = styled.div.attrs({align-items: flex-end;border-bottom-style: solid;border-bottom-width: 2px;- border-bottom-color: ${props => (props.active ? props.theme.subtextColorActive : 'transparent')};+ border-bottom-color: ${props =>+ props.active ? props.theme.panelToggleBorderColor : 'transparent'};color: ${props => (props.active ? props.theme.subtextColorActive : props.theme.subtextColor)};display: flex;justify-content: center;- margin-right: 12px;- padding-bottom: 6px;- width: 30px;+ margin-right: ${props => props.theme.panelToggleMarginRight}px;+ padding-bottom: ${props => props.theme.panelToggleBottomPadding}px;+ width: ${props => props.theme.panelTabWidth};:hover {cursor: pointer;diff --git a/src/constants/default-settings.js b/src/constants/default-settings.jsindex f24243422..a1745f328 100644--- a/src/constants/default-settings.js+++ b/src/constants/default-settings.js@@ -378,12 +378,6 @@ const BLUE3 = '0, 172, 237';const GREEN = '106, 160, 56';const RED = '237, 88, 106';-export const HIGHLIGH_COLOR_3D = [255, 255, 255, 60];--export const FIELD_COLORS = {- default: RED-};-export const FILED_TYPE_DISPLAY = {[ALL_FIELD_TYPES.boolean]: {label: 'bool',@@ -420,6 +414,10 @@ export const FILED_TYPE_DISPLAY = {}};+export const FIELD_COLORS = {+ default: RED+};+export const HIGHLIGH_COLOR_3D = [255, 255, 255, 60];export const CHANNEL_SCALES = keyMirror({color: null,radius: null,diff --git a/src/styles/base.js b/src/styles/base.jsindex e557944ca..b26d63b93 100644--- a/src/styles/base.js+++ b/src/styles/base.js@@ -47,6 +47,8 @@ export const titleColorLT = '#29323C';export const subtextColor = '#6A7485';export const subtextColorLT = '#A0A7B4';export const subtextColorActive = '#FFFFFF';+export const panelToggleBorderColor = '#FFFFFF';+export const panelTabWidth = '30px';export const titleTextColor = '#FFFFFF';export const textColorHl = '#F0F0F0';@@ -58,24 +60,31 @@ export const errorColor = '#F9042C';export const logoColor = activeColor;// Button+export const btnFontFamily = fontFamily;export const primaryBtnBgd = '#0F9668';export const primaryBtnActBgd = '#13B17B';export const primaryBtnColor = '#FFFFFF';export const primaryBtnActColor = '#FFFFFF';export const primaryBtnBgdHover = '#13B17B';export const primaryBtnRadius = '2px';+export const primaryBtnFontSizeDefault = '11px';+export const primaryBtnFontSizeSmall = '10px';+export const primaryBtnFontSizeLarge = '14px';+export const primaryBtnBorder = '0';export const secondaryBtnBgd = '#6A7485';export const secondaryBtnActBgd = '#A0A7B4';export const secondaryBtnColor = '#FFFFFF';export const secondaryBtnActColor = '#FFFFFF';export const secondaryBtnBgdHover = '#A0A7B4';+export const secondaryBtnBorder = '0';export const linkBtnBgd = 'transparent';export const linkBtnActBgd = linkBtnBgd;export const linkBtnColor = '#A0A7B4';export const linkBtnActColor = '#F1F1F1';export const linkBtnActBgdHover = linkBtnBgd;+export const linkBtnBorder = '0';export const negativeBtnBgd = errorColor;export const negativeBtnActBgd = '#FF193E';@@ -86,9 +95,20 @@ export const negativeBtnActColor = '#FFFFFF';export const floatingBtnBgd = '#29323C';export const floatingBtnActBgd = '#3A4552';export const floatingBtnBgdHover = '#3A4552';+export const floatingBtnBorder = '0';+export const floatingBtnBorderHover = '0';export const floatingBtnColor = subtextColor;export const floatingBtnActColor = subtextColorActive;+export const selectionBtnBgd = 'transparent';+export const selectionBtnActBgd = 'transparent';+export const selectionBtnColor = '#D3D8E0';+export const selectionBtnActColor = '#0F9668';+export const selectionBtnBgdHover = '#0F9668';+export const selectionBtnBorder = '1';+export const selectionBtnBorderColor = '#D3D8E0';+export const selectionBtnBorderActColor = '#0F9668';+// Inputexport const inputBoxHeight = '34px';export const inputBoxHeightSmall = '24px';@@ -109,13 +129,15 @@ export const inputColor = '#A0A7B4';export const inputBorderRadius = '1px';export const inputPlaceholderColor = '#6A7485';export const inputPlaceholderFontWeight = 400;-+export const inputBoxShadow = 'none';+export const inputBoxShadowActive = 'none';export const secondaryInputBgd = '#242730';export const secondaryInputBgdHover = '#3A414C';export const secondaryInputBgdActive = '#3A414C';export const secondaryInputColor = '#A0A7B4';export const secondaryInputBorderColor = '#242730';export const secondaryInputBorderActiveColor = '#D3D8E0';+export const dropdownSelectHeight = 30;// Selectexport const selectColor = inputColor;@@ -139,7 +161,11 @@ export const selectBorder = 0;export const dropdownListHighlightBg = '#6A7485';export const dropdownListHighlightBgLT = '#F8F8F9';export const dropdownListShadow = '0 6px 12px 0 rgba(0,0,0,0.16)';-export const dropdownListBgd = '#3A414C';+export const dropdownListBgd = '#29323C';+export const toolbarItemBgdHover = '#3A4552';+export const toolbarItemIconHover = textColorHl;+export const toolbarItemBorderHover = 'transparent';+export const toolbarItemBorderRaddius = '0px';export const dropdownListBgdLT = '#FFFFFF';export const dropdownListBorderTop = '#242730';export const dropdownListBorderTopLT = '#D3D8E0';@@ -178,6 +204,9 @@ export const checkboxBoxBgdChecked = primaryBtnBgd;// Side Panelexport const sidePanelHeaderBg = '#29323C';export const sidePanelHeaderBorder = 'transparent';+export const layerConfigGroupMarginBottom = 12;+export const layerConfigGroupPaddingLeft = 18;+export const sidePanelInnerPadding = 16;export const sidePanelBorder = 0;export const sidePanelBorderColor = 'transparent';@@ -188,17 +217,23 @@ export const sideBarCloseBtnBgd = secondaryBtnBgd;export const sideBarCloseBtnColor = '#29323C';export const sideBarCloseBtnBgdHover = secondaryBtnActBgd;export const sidePanelTitleFontsize = '20px';+export const sidePanelTitleLineHeight = '1.71429';export const panelBackground = '#29323C';+export const panelContentBackground = '#292E36';export const panelBackgroundHover = '#3A4552';export const panelHeaderBorderRadius = '0px';-export const panelActiveBg = '#3A4552';-export const panelActiveBgLT = '#6A7485';+export const chickletBgd = '#3A4552';+export const chickletBgdLT = '#6A7485';export const panelHeaderIcon = '#6A7485';export const panelHeaderIconActive = '#A0A7B4';+export const panelHeaderIconHover = textColorHl;export const panelHeaderHeight = 48;+export const layerPanelHeaderHeight = 48;export const panelBoxShadow = '0 6px 12px 0 rgba(0,0,0,0.16)';export const panelBorderRadius = '2px';export const panelBackgroundLT = '#F8F8F9';+export const panelToggleMarginRight = 12;+export const panelToggleBottomPadding = 6;export const panelBorderColor = '#3A414C';export const panelBorder = `1px solid ${borderColor}`;@@ -206,8 +241,10 @@ export const panelBorderLT = `1px solid ${borderColorLT}`;export const mapPanelBackgroundColor = '#242730';export const mapPanelHeaderBackgroundColor = '#29323C';-export const tooltipBg = '#F8F8F9';-export const tooltipColor = '#333334';+export const tooltipBg = '#3A414C';+export const tooltipColor = textColorHl;+export const tooltipBoxShadow = boxShadow;+export const tooltipFontSize = '10px';export const layerTypeIconSizeL = 50;export const layerTypeIconPdL = 12;@@ -226,7 +263,7 @@ export const bottomWidgetPaddingTop = 20;export const bottomWidgetPaddingRight = 20;export const bottomWidgetPaddingBottom = 30;export const bottomWidgetPaddingLeft = 20;-+export const bottomWidgetBgd = '#29323C';// Modalexport const modalTitleColor = '#3A414C';export const modalTitleFontSize = '24px';@@ -258,10 +295,17 @@ export const sliderBarHeight = 4;export const sliderHandleHeight = 12;export const sliderHandleWidth = 12;export const sliderHandleColor = '#D3D8E0';+export const sliderHandleTextColor = sliderHandleColor;++export const sliderBorderRadius = '0';+export const sliderHandleHoverColor = '#FFFFFF';+export const sliderHandleAfterContent = '';export const sliderHandleShadow = '0 2px 4px 0 rgba(0,0,0,0.40)';export const sliderInputHeight = 24;export const sliderInputWidth = 56;+export const sliderInputFontSize = '10px';+export const sliderInputPadding = '4px 6px';export const sliderMarginTopIsTime = -12;export const sliderMarginTop = 12;@@ -323,6 +367,9 @@ const progressBarTrackColor = '#E8E8E8';export const actionPanelWidth = 110;export const actionPanelHeight = 32;+// Styled Token+export const fieldTokenRightMargin = 4;+export const textTruncate = {maxWidth: '100%',overflow: 'hidden',@@ -335,6 +382,7 @@ export const textTruncate = {export const layerConfigGroupLabelBorderLeft = '2px';export const layerConfigGroupLabelMargin = '-12px';export const layerConfigGroupLabelPadding = '10px';+export const layerConfigGroupColor = 'transparent';// layerConfigGroupLabel labelexport const layerConfigGroupLabelLabelMargin = '0';@@ -348,7 +396,7 @@ export const styledConfigGroupHeaderBorder = '2px';export const layerConfiguratorBorder = '0';export const layerConfiguratorBorderColor = '';export const layerConfiguratorMargin = '12px';-export const layerConfiguratorPadding = '0';+export const layerConfiguratorPadding = '12px 0 8px 0';// This breakpoints are used for responsive designexport const breakPoints = {palm: 588,@@ -400,6 +448,7 @@ const input = css`word-wrap: normal;pointer-events: ${props => (props.disabled ? 'none' : 'all')};opacity: ${props => (props.disabled ? 0.5 : 1)};+ box-shadow: ${props => props.theme.inputBoxShadow};:hover {cursor: ${props => (props.type === 'number' || props.type === 'text' ? 'text' : 'pointer')};@@ -415,6 +464,7 @@ const input = css`&.active {background-color: ${props => props.theme.inputBgdActive};border-color: ${props => props.theme.inputBorderActiveColor};+ box-shadow: ${props => props.theme.inputBoxShadowActive};}::placeholder {@@ -685,6 +735,7 @@ const dropdownScrollBar = css`const dropdownListAnchor = css`color: ${props => props.theme.selectColor};padding-left: 3px;+ font-size: ${props => props.theme.selectFontSize};`;const dropdownListSize = css`@@ -932,6 +983,10 @@ export const theme = {dropdownListHighlightBg,dropdownListHighlightBgLT,dropdownListBgd,+ toolbarItemBgdHover,+ toolbarItemBorderHover,+ toolbarItemIconHover,+ toolbarItemBorderRaddius,dropdownListBgdLT,dropdownListBorderTop,dropdownListBorderTopLT,@@ -979,6 +1034,8 @@ export const theme = {inputFontWeight,inputPlaceholderColor,inputPlaceholderFontWeight,+ inputBoxShadow,+ inputBoxShadowActive,secondaryInputBgd,secondaryInputBgdHover,@@ -986,6 +1043,7 @@ export const theme = {secondaryInputColor,secondaryInputBorderColor,secondaryInputBorderActiveColor,+ dropdownSelectHeight,// SwitchswitchWidth,@@ -1017,17 +1075,24 @@ export const theme = {checkboxBoxBgdChecked,// Button+ btnFontFamily,primaryBtnBgd,primaryBtnActBgd,primaryBtnColor,primaryBtnActColor,primaryBtnBgdHover,primaryBtnRadius,+ primaryBtnFontSizeDefault,+ primaryBtnFontSizeSmall,+ primaryBtnFontSizeLarge,+ primaryBtnBorder,+secondaryBtnBgd,secondaryBtnActBgd,secondaryBtnBgdHover,secondaryBtnColor,secondaryBtnActColor,+ secondaryBtnBorder,negativeBtnBgd,negativeBtnActBgd,@@ -1040,13 +1105,25 @@ export const theme = {linkBtnColor,linkBtnActColor,linkBtnActBgdHover,+ linkBtnBorder,floatingBtnBgd,floatingBtnActBgd,floatingBtnBgdHover,+ floatingBtnBorder,+ floatingBtnBorderHover,floatingBtnColor,floatingBtnActColor,+ selectionBtnBgd,+ selectionBtnActBgd,+ selectionBtnColor,+ selectionBtnActColor,+ selectionBtnBgdHover,+ selectionBtnBorder,+ selectionBtnBorderColor,+ selectionBtnBorderActColor,+// ModalmodalTitleColor,modalTitleFontSize,@@ -1079,14 +1156,23 @@ export const theme = {sidePanelScrollBarWidth,sidePanelScrollBarHeight,sidePanelTitleFontsize,+ sidePanelTitleLineHeight,panelHeaderBorderRadius,sidePanelBorder,sidePanelBorderColor,++ layerConfigGroupLabelLabelFontSize,+ layerConfigGroupMarginBottom,+ layerConfigGroupPaddingLeft,+// Side Panel Panel- panelActiveBg,+ chickletBgd,panelBackground,+ panelContentBackground,panelBackgroundHover,panelBackgroundLT,+ panelToggleMarginRight,+ panelToggleBottomPadding,panelBoxShadow,panelBorderRadius,panelBorder,@@ -1094,7 +1180,9 @@ export const theme = {panelBorderLT,panelHeaderIcon,panelHeaderIconActive,+ panelHeaderIconHover,panelHeaderHeight,+ layerPanelHeaderHeight,panelDropdownScrollBar,layerTypeIconSizeL,@@ -1113,10 +1201,14 @@ export const theme = {subtextColor,subtextColorLT,subtextColorActive,+ panelToggleBorderColor,+ panelTabWidth,textTruncate,titleColorLT,tooltipBg,tooltipColor,+ tooltipBoxShadow,+ tooltipFontSize,logoColor,// Sidepanel divider@@ -1132,6 +1224,7 @@ export const theme = {bottomWidgetPaddingRight,bottomWidgetPaddingBottom,bottomWidgetPaddingLeft,+ bottomWidgetBgd,// SlidersliderBarColor,@@ -1142,7 +1235,10 @@ export const theme = {sliderHandleHeight,sliderHandleWidth,sliderHandleColor,+ sliderHandleTextColor,+ sliderBorderRadius,sliderHandleHoverColor,+ sliderHandleAfterContent,sliderHandleShadow,sliderInputHeight,sliderInputWidth,@@ -1208,10 +1304,10 @@ export const theme = {layerConfigGroupLabelBorderLeft,layerConfigGroupLabelMargin,layerConfigGroupLabelPadding,+ layerConfigGroupColor,// layerConfigGroupLabel labellayerConfigGroupLabelLabelMargin,- layerConfigGroupLabelLabelFontSize,// StyledConfigGroupHeaderstyledConfigGroupHeaderBorder,@@ -1220,7 +1316,10 @@ export const theme = {layerConfiguratorBorder,layerConfiguratorBorderColor,layerConfiguratorMargin,- layerConfiguratorPadding+ layerConfiguratorPadding,++ // Styled token+ fieldTokenRightMargin};export const themeLT = {@@ -1237,6 +1336,7 @@ export const themeLT = {tooltipBg: '#1869B5',tooltipColor: '#FFFFFF',dropdownListBgd: '#FFFFFF',+ toolbarItemBgdHover: '#F7F7F7',textColorHl: activeColorLT,inputBgd: '#F7F7F7',@@ -1244,11 +1344,14 @@ export const themeLT = {inputBgdActive: '#FFFFFF',dropdownListHighlightBg: '#F0F0F0',-+ toolbarItemIconHover: activeColorLT,panelBackground: '#F7F7F7',+ panelContentBackground: '#F7F7F7',+ bottomWidgetBgd: '#F7F7F7',panelBackgroundHover: '#F7F7F7',panelBorderColor: '#D3D8E0',-+ panelHeaderIconActive: '#000000',+ panelHeaderIconHover: '#000000',sideBarCloseBtnBgd: '#F7F7F7',sideBarCloseBtnColor: textColorLT,sideBarCloseBtnBgdHover: '#F7F7F7',@@ -1260,7 +1363,7 @@ export const themeLT = {secondaryInputBorderColor: 'none',secondaryInputColor: '#545454',- panelActiveBg: '#F7F7F7',+ chickletBgd: '#F7F7F7',mapPanelBackgroundColor: '#FFFFFF',mapPanelHeaderBackgroundColor: '#F7F7F7',@@ -1303,16 +1406,22 @@ export const themeBS = {...theme,activeColor: '#E2E2E2',dropdownListBgd: '#FFFFFF',+ toolbarItemBgdHover: '#F7F7F7',dropdownListBorderTop: 'none',dropdownListHighlightBg: '#F6F6F6',+ toolbarItemIconHover: '#000000',inputBgd: '#E2E2E2',inputBgdActive: '#E2E2E2',inputBgdHover: 'inherit',inputBorderActiveColor: '#000000',inputColor: '#000000',- panelActiveBg: '#E2E2E2',+ chickletBgd: '#E2E2E2',panelBackground: '#FFFFFF',panelBackgroundHover: '#EEEEEE',+ panelContentBackground: '#FFFFFF',+ bottomWidgetBgd: '#F7F7F7',+ panelHeaderIconActive: '#000000',+ panelHeaderIconHover: '#000000',panelBorderColor: '#E2E2E2',primaryBtnBgd: '#E2E2E2',primaryBtnBgdHover: '#333333',diff --git a/test/browser/components/modals/data-table-modal-test.js b/test/browser/components/modals/data-table-modal-test.jsindex f38aca946..0e05327f0 100644--- a/test/browser/components/modals/data-table-modal-test.js+++ b/test/browser/components/modals/data-table-modal-test.js@@ -23,26 +23,27 @@ import test from 'tape-catch';import global from 'global';import sinon from 'sinon';import flatten from 'lodash.flattendeep';-import {mount} from 'enzyme';import {mountWithTheme} from 'test/helpers/component-utils';import CloneDeep from 'lodash.clonedeep';import * as VisStateActions from 'actions/vis-state-actions';import visStateReducer from 'reducers/vis-state';-import FieldToken from 'components/common/field-token';+import FieldTokenFactory from 'components/common/field-token';import {VertThreeDots, ArrowUp} from 'components/common/icons';import DataTableModalFactory, {DatasetTabs,DatasetModalTab} from 'components/modals/data-table-modal';-import {DataTable} from 'components/common/data-table';+import DataTableFactory from 'components/common/data-table';import OptionDropdown from 'components/common/data-table/option-dropdown';-import {testFields, testAllData} from 'test/fixtures/test-csv-data';import {geoStyleFields, geoStyleRows} from 'test/fixtures/geojson';import {StateWFiles, testCsvDataId, testGeoJsonDataId} from 'test/helpers/mock-state';+import {appInjector} from '../../../../src/components/container';-const DataTableModal = DataTableModalFactory(DataTable);+const DataTableModal = appInjector.get(DataTableModalFactory);+const DataTable = appInjector.get(DataTableFactory);+const FieldToken = appInjector.get(FieldTokenFactory);const expectedCellSizeCache = {'gps_data.utc_timestamp': {row: 145, header: 150},@@ -261,14 +262,14 @@ test('Components -> DataTableModal -> render DataTable: csv 1', t => {theme: {}};- const wrapper2 = mount(<DataTable {...enriched} />);- const componentInstance = wrapper2.instance();+ const wrapper2 = mountWithTheme(<DataTable {...enriched} />);+ const componentInstance = wrapper2.find('DataTable').instance();const result = componentInstance.getCellSizeCache();t.deepEqual(result, expectedExpandedCellSize, 'should calculate correct cell expansion');// manully setting the state and update the component- wrapper2.setState(result);+ componentInstance.setState(result);wrapper2.update();t.equal(@@ -386,11 +387,11 @@ test('Components -> DataTableModal -> render DataTable: sort and pin', t => {theme: {}};- const wrapper2 = mount(<DataTable {...enriched} />);- const componentInstance = wrapper2.instance();+ const wrapper2 = mountWithTheme(<DataTable {...enriched} />);+ const componentInstance = wrapper2.find('DataTable').instance();const result = componentInstance.getCellSizeCache();// manully setting the state and update the component- wrapper2.setState(result);+ componentInstance.setState(result);wrapper2.update();const expectedHeaders = [@@ -537,12 +538,13 @@ test('Components -> DataTableModal.render: csv 2', t => {},ghost: 334};- const wrapper2 = mount(<DataTable {...enriched} />);- const componentInstance = wrapper2.instance();+ const wrapper2 = mountWithTheme(<DataTable {...enriched} />);+ const componentInstance = wrapper2.find('DataTable').instance();+const result = componentInstance.getCellSizeCache();t.deepEqual(result, expectedExpandedCellSizeGeo, 'should calculate correct cell expansion');- wrapper2.setState(result);+ componentInstance.setState(result);wrapper2.update();t.equal(wrapper2.find('.header-cell').length, 7, `should render 7 header cells`);diff --git a/test/browser/components/tooltip-config-test.js b/test/browser/components/tooltip-config-test.jsindex dcd65a842..518d90c78 100644--- a/test/browser/components/tooltip-config-test.js+++ b/test/browser/components/tooltip-config-test.js@@ -26,7 +26,7 @@ import uniq from 'lodash.uniq';import {IntlWrapper, mountWithTheme} from 'test/helpers/component-utils';import TooltipConfigFactory from 'components/side-panel/interaction-panel/tooltip-config';import DatasetTagFactory from 'components/side-panel/common/dataset-tag';-import FieldSelector from 'components/common/field-selector';+import FieldSelectorFactory from 'components/common/field-selector';import ChickletedInput from 'components/common/item-selector/chickleted-input';import {ChickletButton} from 'components/common/item-selector/chickleted-input';import DropdownList from 'components/common/item-selector/dropdown-list';@@ -64,6 +64,7 @@ test('TooltipConfig - render', t => {const datasets = StateWFiles.visState.datasets;const tooltipConfig = StateWFiles.visState.interactionConfig.tooltip.config;+ const FieldSelector = appInjector.get(FieldSelectorFactory);const onChange = sinon.spy();let wrapper;