@@ -12,6 +12,8 @@ import {UnconnectedColorPicker} from './ColorPicker';
1212import { UnconnectedTextEditor } from './TextEditor' ;
1313import { UnconnectedVisibilitySelect } from './VisibilitySelect' ;
1414import { connectToContainer , getAllAxes , getAxisTitle , axisIdToAxisName } from 'lib' ;
15+ import PropTypes from 'prop-types' ;
16+ import Text from './Text' ;
1517
1618export const AxisAnchorDropdown = connectToContainer ( UnconnectedDropdown , {
1719 modifyPlotProps : ( props , context , plotProps ) => {
@@ -574,8 +576,14 @@ export const HoverInfo = connectToContainer(UnconnectedFlaglist, {
574576 } else if ( container . lat || container . lon ) {
575577 options = [ { label : _ ( 'Longitude' ) , value : 'lon' } , { label : _ ( 'Latitude' ) , value : 'lat' } ] ;
576578 }
577- } else if ( container . type === 'scattermapbox' ) {
579+ } else if ( container . type === 'scattermapbox' || container . type === 'densitymapbox' ) {
578580 options = [ { label : _ ( 'Longitude' ) , value : 'lon' } , { label : _ ( 'Latitude' ) , value : 'lat' } ] ;
581+ } else if ( container . type === 'densitymapbox' ) {
582+ options = [
583+ { label : _ ( 'Longitude' ) , value : 'lon' } ,
584+ { label : _ ( 'Latitude' ) , value : 'lat' } ,
585+ { label : _ ( 'Z' ) , value : 'z' } ,
586+ ] ;
579587 } else if ( container . type === 'scatterternary' ) {
580588 options = [
581589 { label : _ ( 'A' ) , value : 'a' } ,
@@ -655,6 +663,54 @@ export const FillDropdown = connectToContainer(UnconnectedDropdown, {
655663 } ,
656664} ) ;
657665
666+ export const MapboxSourceArray = connectToContainer ( Text , {
667+ modifyPlotProps : ( props , context , plotProps ) => {
668+ const { fullValue, updatePlot} = plotProps ;
669+ if ( plotProps . fullValue && plotProps . fullValue . length > 0 ) {
670+ plotProps . fullValue = fullValue [ 0 ] ;
671+ }
672+
673+ plotProps . updatePlot = v => {
674+ if ( v . length ) {
675+ updatePlot ( [ v ] ) ;
676+ } else {
677+ updatePlot ( [ ] ) ;
678+ }
679+ } ;
680+ } ,
681+ } ) ;
682+
683+ export const MapboxStyleDropdown = connectToContainer ( UnconnectedDropdown , {
684+ modifyPlotProps : ( props , context , plotProps ) => {
685+ const { mapBoxAccess, localize : _ } = context ;
686+
687+ plotProps . options = ( ! mapBoxAccess
688+ ? [ ]
689+ : [
690+ { label : _ ( 'Mapbox Basic' ) , value : 'basic' } ,
691+ { label : _ ( 'Mapbox Outdoors' ) , value : 'outdoors' } ,
692+ { label : _ ( 'Mapbox Light' ) , value : 'light' } ,
693+ { label : _ ( 'Mapbox Dark' ) , value : 'dark' } ,
694+ { label : _ ( 'Mapbox Satellite' ) , value : 'satellite' } ,
695+ { label : _ ( 'Mapbox Satellite with Streets' ) , value : 'satellite-streets' } ,
696+ ]
697+ ) . concat ( [
698+ { label : _ ( 'No tiles (white background)' ) , value : 'white-bg' } ,
699+ { label : _ ( 'Open Street Map' ) , value : 'open-street-map' } ,
700+ { label : _ ( 'Carto Positron' ) , value : 'carto-positron' } ,
701+ { label : _ ( 'Carto Dark Matter' ) , value : 'carto-darkmatter' } ,
702+ { label : _ ( 'Stamen Terrain' ) , value : 'stamen-terrain' } ,
703+ { label : _ ( 'Stamen Toner' ) , value : 'stamen-toner' } ,
704+ { label : _ ( 'Stamen Watercolor' ) , value : 'stamen-watercolor' } ,
705+ ] ) ;
706+ plotProps . clearable = false ;
707+ } ,
708+ } ) ;
709+ MapboxStyleDropdown . contextTypes = {
710+ mapBoxAccess : PropTypes . bool ,
711+ ...MapboxStyleDropdown . contextTypes ,
712+ } ;
713+
658714export const HoveronDropdown = connectToContainer ( UnconnectedDropdown , {
659715 modifyPlotProps : ( props , context , plotProps ) => {
660716 const { localize : _ } = context ;
0 commit comments