higlass 1.11.11 → 1.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/README.md +19 -10
  2. package/app/scripts/{AddTrackDialog.js → AddTrackDialog.jsx} +27 -26
  3. package/app/scripts/{AddTrackPositionMenu.js → AddTrackPositionMenu.jsx} +18 -15
  4. package/app/scripts/{Autocomplete.js → Autocomplete.jsx} +1 -0
  5. package/app/scripts/{Button.js → Button.jsx} +7 -6
  6. package/app/scripts/CenterTiledPlot.jsx +7 -0
  7. package/app/scripts/{CenterTrack.js → CenterTrack.jsx} +42 -41
  8. package/app/scripts/ChromosomeGrid.js +8 -16
  9. package/app/scripts/CloseTrackMenu.jsx +27 -0
  10. package/app/scripts/CombinedTrack.js +16 -1
  11. package/app/scripts/{ConfigTrackMenu.js → ConfigTrackMenu.jsx} +12 -12
  12. package/app/scripts/{ConfigViewMenu.js → ConfigViewMenu.jsx} +35 -36
  13. package/app/scripts/{ConfigureSeriesMenu.js → ConfigureSeriesMenu.jsx} +2 -2
  14. package/app/scripts/{ContextMenuContainer.js → ContextMenuContainer.jsx} +5 -7
  15. package/app/scripts/ContextMenuItem.jsx +37 -0
  16. package/app/scripts/Cross.jsx +9 -0
  17. package/app/scripts/CustomTrackDialog.jsx +38 -0
  18. package/app/scripts/DataFetcher.js +6 -6
  19. package/app/scripts/{Dialog.js → Dialog.jsx} +40 -31
  20. package/app/scripts/{DragListeningDiv.js → DragListeningDiv.jsx} +10 -12
  21. package/app/scripts/{DraggableDiv.js → DraggableDiv.jsx} +25 -24
  22. package/app/scripts/{ExportLinkDialog.js → ExportLinkDialog.jsx} +2 -2
  23. package/app/scripts/{GalleryTracks.js → GalleryTracks.jsx} +10 -9
  24. package/app/scripts/{GenomePositionSearchBox.js → GenomePositionSearchBox.jsx} +23 -21
  25. package/app/scripts/HeatmapTiledPixiTrack.js +18 -30
  26. package/app/scripts/{HiGlassComponent.js → HiGlassComponent.jsx} +213 -86
  27. package/app/scripts/HorizontalChromosomeLabels.js +3 -6
  28. package/app/scripts/HorizontalHeatmapTrack.js +2 -6
  29. package/app/scripts/HorizontalRule.js +2 -0
  30. package/app/scripts/{HorizontalTiledPlot.js → HorizontalTiledPlot.jsx} +20 -19
  31. package/app/scripts/LeftTrackModifier.js +8 -0
  32. package/app/scripts/{Modal.js → Modal.jsx} +14 -9
  33. package/app/scripts/{NestedContextMenu.js → NestedContextMenu.jsx} +6 -7
  34. package/app/scripts/OSMTilesTrack.js +2 -6
  35. package/app/scripts/OverlayTrack.js +2 -0
  36. package/app/scripts/{PopupMenu.js → PopupMenu.jsx} +1 -1
  37. package/app/scripts/SearchField.js +5 -3
  38. package/app/scripts/{SeriesListItems.js → SeriesListItems.jsx} +6 -6
  39. package/app/scripts/{SeriesListMenu.js → SeriesListMenu.jsx} +29 -32
  40. package/app/scripts/Tiled1DPixiTrack.js +2 -5
  41. package/app/scripts/TiledPixiTrack.js +3 -1
  42. package/app/scripts/{TiledPlot.js → TiledPlot.jsx} +45 -17
  43. package/app/scripts/{TilesetFinder.js → TilesetFinder.jsx} +7 -7
  44. package/app/scripts/Track.js +17 -1
  45. package/app/scripts/{TrackControl.js → TrackControl.jsx} +44 -50
  46. package/app/scripts/{TrackRenderer.js → TrackRenderer.jsx} +44 -38
  47. package/app/scripts/VerticalRule.js +1 -0
  48. package/app/scripts/{VerticalTiledPlot.js → VerticalTiledPlot.jsx} +27 -18
  49. package/app/scripts/{ViewConfigEditor.js → ViewConfigEditor.jsx} +66 -58
  50. package/app/scripts/{ViewContextMenu.js → ViewContextMenu.jsx} +13 -13
  51. package/app/scripts/{ViewHeader.js → ViewHeader.jsx} +24 -23
  52. package/app/scripts/ViewportTracker2D.js +1 -2
  53. package/app/scripts/ViewportTrackerHorizontal.js +1 -2
  54. package/app/scripts/ViewportTrackerVertical.js +1 -2
  55. package/app/scripts/api.js +17 -10
  56. package/app/scripts/configs/available-for-plugins.js +4 -3
  57. package/app/scripts/configs/index.js +1 -47
  58. package/app/scripts/configs/positions-by-datatype.js +2 -0
  59. package/app/scripts/configs/primitives.js +47 -0
  60. package/app/scripts/configs/tracks-info.js +2 -2
  61. package/app/scripts/d3-context-menu.js +1 -0
  62. package/app/scripts/data-fetchers/get-data-fetcher.js +7 -2
  63. package/app/scripts/{hglib.js → hglib.jsx} +1 -1
  64. package/app/scripts/{icons.js → icons.jsx} +24 -13
  65. package/app/scripts/mixwith.js +2 -0
  66. package/app/scripts/services/tile-proxy.js +1 -5
  67. package/app/scripts/utils/abs-to-chr.js +1 -1
  68. package/app/scripts/utils/dec-to-hex-str.js +1 -1
  69. package/app/scripts/utils/dict-items.js +0 -1
  70. package/app/scripts/utils/dict-keys.js +0 -1
  71. package/app/scripts/utils/dict-values.js +0 -1
  72. package/app/scripts/utils/index.js +1 -0
  73. package/app/scripts/utils/range-query-2d.js +4 -1
  74. package/app/scripts/utils/selected-items-to-size.js +2 -3
  75. package/app/scripts/utils/{test-helpers.js → test-helpers.jsx} +32 -10
  76. package/app/scripts/utils/timeout.js +4 -1
  77. package/app/scripts/utils/value-to-color.js +14 -17
  78. package/app/scripts/worker.js +8 -4
  79. package/app/styles/GenomePositionSearchBox.module.scss +13 -15
  80. package/app/styles/HiGlass.scss +5 -5
  81. package/app/styles/TilesetFinder.css +94 -74
  82. package/app/styles/TrackControl.module.scss +17 -20
  83. package/app/styles/TrackOptions.css +23 -24
  84. package/app/styles/ViewHeader.module.scss +18 -18
  85. package/dist/hglib.css +1724 -1
  86. package/dist/hglib.js +80473 -154092
  87. package/dist/hglib.min.js +382 -2
  88. package/dist/index.html +251 -250
  89. package/package.json +57 -117
  90. package/CHANGELOG.md +0 -1415
  91. package/app/index.html +0 -273
  92. package/app/scripts/CenterTiledPlot.js +0 -5
  93. package/app/scripts/CloseTrackMenu.js +0 -25
  94. package/app/scripts/ContextMenuItem.js +0 -35
  95. package/app/scripts/Cross.js +0 -7
  96. package/app/scripts/factories/index.js +0 -1
  97. /package/app/scripts/{FixedTrack.js → FixedTrack.jsx} +0 -0
  98. /package/app/scripts/{HeatmapOptions.js → HeatmapOptions.jsx} +0 -0
  99. /package/app/scripts/{HiGlassTrackComponent.js → HiGlassTrackComponent.jsx} +0 -0
  100. /package/app/scripts/{HorizontalItem.js → HorizontalItem.jsx} +0 -0
  101. /package/app/scripts/{HorizontalTrack.js → HorizontalTrack.jsx} +0 -0
  102. /package/app/scripts/{ListWrapper.js → ListWrapper.jsx} +0 -0
  103. /package/app/scripts/{MoveableTrack.js → MoveableTrack.jsx} +0 -0
  104. /package/app/scripts/{PlotTypeChooser.js → PlotTypeChooser.jsx} +0 -0
  105. /package/app/scripts/{SeriesListSubmenuMixin.js → SeriesListSubmenuMixin.jsx} +0 -0
  106. /package/app/scripts/{SketchInlinePicker.js → SketchInlinePicker.jsx} +0 -0
  107. /package/app/scripts/{SortableList.js → SortableList.jsx} +0 -0
  108. /package/app/scripts/{TrackArea.js → TrackArea.jsx} +0 -0
  109. /package/app/scripts/{VerticalItem.js → VerticalItem.jsx} +0 -0
  110. /package/app/scripts/{VerticalTrack.js → VerticalTrack.jsx} +0 -0
  111. /package/app/scripts/hocs/{with-modal.js → with-modal.jsx} +0 -0
  112. /package/app/scripts/hocs/{with-pub-sub.js → with-pub-sub.jsx} +0 -0
  113. /package/app/scripts/hocs/{with-theme.js → with-theme.jsx} +0 -0
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import clsx from 'clsx';
2
3
  import { mix } from './mixwith';
3
4
 
4
5
  import ContextMenuContainer from './ContextMenuContainer';
@@ -10,7 +11,7 @@ import { getSeriesItems } from './SeriesListItems';
10
11
  import { THEME_DARK } from './configs';
11
12
 
12
13
  // Styles
13
- import '../styles/ContextMenu.module.scss';
14
+ import classes from '../styles/ContextMenu.module.scss';
14
15
 
15
16
  class ConfigTrackMenu extends mix(ContextMenuContainer).with(
16
17
  SeriesListSubmenuMixin,
@@ -30,20 +31,19 @@ class ConfigTrackMenu extends mix(ContextMenuContainer).with(
30
31
  }
31
32
 
32
33
  render() {
33
- let styleNames = 'context-menu';
34
- if (this.props.theme === THEME_DARK) styleNames += ' context-menu-dark';
35
-
36
34
  return (
37
35
  <div
38
36
  ref={(c) => {
39
37
  this.div = c;
40
38
  }}
39
+ className={clsx(classes['context-menu'], {
40
+ [classes['context-menu-dark']]: this.props.theme === THEME_DARK,
41
+ })}
41
42
  data-menu-type="ConfigTrackMenu"
42
43
  style={{
43
44
  left: this.state.left,
44
45
  top: this.state.top,
45
46
  }}
46
- styleName={styleNames}
47
47
  >
48
48
  {getSeriesItems(
49
49
  this.props.tracks,
@@ -52,14 +52,14 @@ class ConfigTrackMenu extends mix(ContextMenuContainer).with(
52
52
  null,
53
53
  )}
54
54
 
55
- <hr styleName="context-menu-hr" />
55
+ <hr className={classes['context-menu-hr']} />
56
56
 
57
57
  <ContextMenuItem
58
58
  contextMenu={this}
59
59
  onClick={() => this.props.onLockValueScale(this.props.tracks[0].uid)}
60
60
  onMouseEnter={(e) => this.handleOtherMouseEnter(e)}
61
61
  >
62
- {'Lock Value Scale With'}
62
+ Lock Value Scale With
63
63
  </ContextMenuItem>
64
64
 
65
65
  <ContextMenuItem
@@ -69,23 +69,23 @@ class ConfigTrackMenu extends mix(ContextMenuContainer).with(
69
69
  }
70
70
  onMouseEnter={(e) => this.handleOtherMouseEnter(e)}
71
71
  >
72
- {'Unlock Value Scale'}
72
+ Unlock Value Scale
73
73
  </ContextMenuItem>
74
74
 
75
- <hr styleName="context-menu-hr" />
75
+ <hr className={classes['context-menu-hr']} />
76
76
 
77
77
  <ContextMenuItem
78
78
  contextMenu={this}
79
79
  onClick={() => this.props.onAddSeries(this.props.tracks[0].uid)}
80
80
  onMouseEnter={(e) => this.handleOtherMouseEnter(e)}
81
81
  >
82
- {'Add Series'}
82
+ Add Series
83
83
  </ContextMenuItem>
84
84
 
85
85
  <ContextMenuItem
86
86
  onClick={() => this.props.onCloseTrack(this.props.tracks[0].uid)}
87
87
  >
88
- {'Close Track'}
88
+ Close Track
89
89
  </ContextMenuItem>
90
90
 
91
91
  <ContextMenuItem
@@ -96,7 +96,7 @@ class ConfigTrackMenu extends mix(ContextMenuContainer).with(
96
96
  );
97
97
  }}
98
98
  >
99
- {'Replace Track'}
99
+ Replace Track
100
100
  </ContextMenuItem>
101
101
 
102
102
  {this.getSubmenu()}
@@ -1,12 +1,13 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
+ import clsx from 'clsx';
3
4
 
4
5
  import ContextMenuContainer from './ContextMenuContainer';
5
6
  import ContextMenuItem from './ContextMenuItem';
6
7
  import NestedContextMenu from './NestedContextMenu';
7
8
 
8
9
  // Styles
9
- import '../styles/ContextMenu.module.scss';
10
+ import classes from '../styles/ContextMenu.module.scss';
10
11
 
11
12
  import { OPTIONS_INFO, THEME_DARK } from './configs';
12
13
 
@@ -55,9 +56,8 @@ class ConfigViewMenu extends ContextMenuContainer {
55
56
  this.props.onOptionsChanged(newOptions);
56
57
  };
57
58
 
58
- menuItems[optionType].children[
59
- inlineOptionKey
60
- ] = optionSelectorSettings;
59
+ menuItems[optionType].children[inlineOptionKey] =
60
+ optionSelectorSettings;
61
61
  }
62
62
  }
63
63
  }
@@ -105,32 +105,31 @@ class ConfigViewMenu extends ContextMenuContainer {
105
105
  }
106
106
 
107
107
  render() {
108
- let styleNames = 'context-menu';
109
- if (this.props.theme === THEME_DARK) styleNames += ' context-menu-dark';
110
-
111
108
  return (
112
109
  <div
113
110
  ref={(c) => {
114
111
  this.div = c;
115
112
  }}
113
+ className={clsx(classes['context-menu'], {
114
+ [classes['context-menu-dark']]: this.props.theme === THEME_DARK,
115
+ })}
116
116
  data-menu-type="ConfigViewMenu"
117
117
  style={{
118
118
  left: this.state.left,
119
119
  top: this.state.top,
120
120
  }}
121
- styleName={styleNames}
122
121
  >
123
122
  <ContextMenuItem
124
123
  onClick={(e) => this.props.onTogglePositionSearchBox(e)}
125
124
  >
126
- {'Toggle position search box'}
125
+ Toggle position search box
127
126
  </ContextMenuItem>
128
127
 
129
128
  {
130
129
  // Fritz: This seems to have been forgotten. The on-click handler does
131
130
  // nothing so I comment this out
132
131
  //
133
- // <hr styleName="context-menu-hr" />
132
+ // <hr className={classes["context-menu-hr"]} />
134
133
  //
135
134
  // <ContextMenuItem
136
135
  // onClick={() => {}}
@@ -142,98 +141,98 @@ class ConfigViewMenu extends ContextMenuContainer {
142
141
  // onMouseLeave={e => this.handleMouseLeave(e)}
143
142
  // >
144
143
  // {'Options'}
145
- // <svg styleName="play-icon">
144
+ // <svg className={classes["play-icon"]}>
146
145
  // <use xlinkHref="#play" />
147
146
  // </svg>
148
147
  // </ContextMenuItem>
149
148
  }
150
149
 
151
- <hr styleName="context-menu-hr" />
150
+ <hr className={classes['context-menu-hr']} />
152
151
 
153
152
  <ContextMenuItem onClick={(e) => this.props.onZoomToData(e)}>
154
- {'Zoom to data extent'}
153
+ Zoom to data extent
155
154
  </ContextMenuItem>
156
155
 
157
156
  <ContextMenuItem onClick={(e) => this.props.onClearView(e)}>
158
- {'Clear View'}
157
+ Clear View
159
158
  </ContextMenuItem>
160
159
 
161
- <hr styleName="context-menu-hr" />
160
+ <hr className={classes['context-menu-hr']} />
162
161
 
163
162
  <ContextMenuItem onClick={(e) => this.props.onYankZoom(e)}>
164
- {'Take zoom from'}
163
+ Take zoom from
165
164
  </ContextMenuItem>
166
165
 
167
166
  <ContextMenuItem onClick={(e) => this.props.onYankLocation(e)}>
168
- {'Take location from'}
167
+ Take location from
169
168
  </ContextMenuItem>
170
169
 
171
170
  <ContextMenuItem onClick={(e) => this.props.onYankZoomAndLocation(e)}>
172
- {'Take zoom and location from'}
171
+ Take zoom and location from
173
172
  </ContextMenuItem>
174
173
 
175
- <hr styleName="context-menu-hr" />
174
+ <hr className={classes['context-menu-hr']} />
176
175
 
177
176
  <ContextMenuItem onClick={this.props.onLockZoom}>
178
- {'Lock zoom with'}
177
+ Lock zoom with
179
178
  </ContextMenuItem>
180
179
 
181
180
  <ContextMenuItem onClick={this.props.onLockLocation}>
182
- {'Lock location with'}
181
+ Lock location with
183
182
  </ContextMenuItem>
184
183
 
185
184
  <ContextMenuItem onClick={this.props.onLockZoomAndLocation}>
186
- {'Lock zoom and location with'}
185
+ Lock zoom and location with
187
186
  </ContextMenuItem>
188
187
 
189
- <hr styleName="context-menu-hr" />
188
+ <hr className={classes['context-menu-hr']} />
190
189
 
191
190
  <ContextMenuItem onClick={this.props.onTakeAndLockZoomAndLocation}>
192
- {'Take and lock zoom and location with'}
191
+ Take and lock zoom and location with
193
192
  </ContextMenuItem>
194
193
 
195
- <hr styleName="context-menu-hr" />
194
+ <hr className={classes['context-menu-hr']} />
196
195
 
197
196
  <ContextMenuItem onClick={(e) => this.props.onUnlockZoom(e)}>
198
- {'Unlock zoom'}
197
+ Unlock zoom
199
198
  </ContextMenuItem>
200
199
 
201
200
  <ContextMenuItem onClick={(e) => this.props.onUnlockLocation(e)}>
202
- {'Unlock location'}
201
+ Unlock location
203
202
  </ContextMenuItem>
204
203
 
205
204
  <ContextMenuItem onClick={(e) => this.props.onUnlockZoomAndLocation(e)}>
206
- {'Unlock zoom and location'}
205
+ Unlock zoom and location
207
206
  </ContextMenuItem>
208
207
 
209
- <hr styleName="context-menu-hr" />
208
+ <hr className={classes['context-menu-hr']} />
210
209
 
211
210
  <ContextMenuItem onClick={(e) => this.props.onProjectViewport(e)}>
212
- {'Show this viewport on'}
211
+ Show this viewport on
213
212
  </ContextMenuItem>
214
213
 
215
- <hr styleName="context-menu-hr" />
214
+ <hr className={classes['context-menu-hr']} />
216
215
 
217
216
  <ContextMenuItem onClick={(e) => this.props.onEditViewConfig(e)}>
218
217
  Edit view config
219
218
  </ContextMenuItem>
220
219
 
221
- <hr styleName="context-menu-hr" />
220
+ <hr className={classes['context-menu-hr']} />
222
221
 
223
222
  <ContextMenuItem onClick={() => this.props.onExportSVG()}>
224
- {'Export views as SVG'}
223
+ Export views as SVG
225
224
  </ContextMenuItem>
226
225
 
227
226
  <ContextMenuItem onClick={() => this.props.onExportPNG()}>
228
- {'Export views as PNG'}
227
+ Export views as PNG
229
228
  </ContextMenuItem>
230
229
 
231
230
  <ContextMenuItem onClick={() => this.props.onExportViewAsJSON()}>
232
- {'Export views as JSON'}
231
+ Export views as JSON
233
232
  </ContextMenuItem>
234
233
 
235
234
  <ContextMenuItem onClick={() => this.props.onExportViewAsLink()}>
236
- {'Export views as Link'}
235
+ Export views as Link
237
236
  </ContextMenuItem>
238
237
 
239
238
  {this.getSubmenu()}
@@ -3,7 +3,7 @@ import React from 'react';
3
3
  import ContextMenuContainer from './ContextMenuContainer';
4
4
 
5
5
  // Styles
6
- import '../styles/ContextMenu.module.scss';
6
+ import classes from '../styles/ContextMenu.module.scss';
7
7
 
8
8
  export default class ConfigureSeriesMenu extends ContextMenuContainer {
9
9
  render() {
@@ -12,12 +12,12 @@ export default class ConfigureSeriesMenu extends ContextMenuContainer {
12
12
  ref={(c) => {
13
13
  this.div = c;
14
14
  }}
15
+ className={classes['context-menu']}
15
16
  onMouseLeave={this.props.handleMouseLeave}
16
17
  style={{
17
18
  left: this.state.left,
18
19
  top: this.state.top,
19
20
  }}
20
- styleName="context-menu"
21
21
  />
22
22
  );
23
23
  }
@@ -1,11 +1,12 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React from 'react';
3
3
  import ReactDOM from 'react-dom';
4
+ import clsx from 'clsx';
4
5
 
5
6
  import { THEME_DARK } from './configs';
6
7
 
7
8
  // Styles
8
- import '../styles/ContextMenu.module.scss';
9
+ import classes from '../styles/ContextMenu.module.scss';
9
10
 
10
11
  // the size of the track controls
11
12
  // taken from ../styles/TrackControl.module.css
@@ -186,18 +187,15 @@ class ContextMenuContainer extends React.Component {
186
187
 
187
188
  const wholeStyle = Object.assign(stylePosition, otherStyle);
188
189
 
189
- let stylenames = 'context-menu';
190
-
191
- if (this.props.theme === THEME_DARK) stylenames += ' context-menu-dark';
192
-
193
190
  return (
194
191
  <div
195
192
  ref={(c) => {
196
193
  this.div = c;
197
194
  }}
198
- className="context-menu-item"
195
+ className={clsx('context-menu-item', classes['context-menu'], {
196
+ [classes['context-menu-dark']]: this.props.theme === THEME_DARK,
197
+ })}
199
198
  style={wholeStyle}
200
- styleName={stylenames}
201
199
  >
202
200
  {this.props.children}
203
201
  </div>
@@ -0,0 +1,37 @@
1
+ import PropTypes from 'prop-types';
2
+ import React from 'react';
3
+
4
+ // Styles
5
+ import classes from '../styles/ContextMenu.module.scss';
6
+
7
+ function ContextMenuItem(props) {
8
+ return (
9
+ <div
10
+ data-menu-item-for={
11
+ typeof props.children === 'string' ? props.children : null
12
+ }
13
+ className={classes['context-menu-item']}
14
+ onClick={(e) => props.onClick(e)}
15
+ onMouseEnter={(e) => props.onMouseEnter(e)}
16
+ onMouseLeave={(e) => props.onMouseLeave(e)}
17
+ role="button"
18
+ tabIndex={0}
19
+ >
20
+ <span className={classes['context-menu-span']}>{props.children}</span>
21
+ </div>
22
+ );
23
+ }
24
+
25
+ ContextMenuItem.defaultProps = {
26
+ onMouseEnter: () => undefined,
27
+ onMouseLeave: () => undefined,
28
+ };
29
+
30
+ ContextMenuItem.propTypes = {
31
+ children: PropTypes.node.isRequired,
32
+ onClick: PropTypes.func.isRequired,
33
+ onMouseEnter: PropTypes.func,
34
+ onMouseLeave: PropTypes.func,
35
+ };
36
+
37
+ export default ContextMenuItem;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+
3
+ import classes from '../styles/Cross.module.scss';
4
+
5
+ function Cross() {
6
+ return <div className={classes.cross} />;
7
+ }
8
+
9
+ export default Cross;
@@ -0,0 +1,38 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+
4
+ import Dialog from './Dialog';
5
+
6
+ // Styles
7
+ import '../styles/AddTrackDialog.module.scss';
8
+
9
+ class CustomTrackDialog extends React.PureComponent {
10
+ render() {
11
+ const childrenWithProp = [];
12
+ this.props.children.forEach((Child, i) => {
13
+ const key = `customTrackDialog_${i}`;
14
+ childrenWithProp.push(<Child key={key} {...this.props.bodyProps[i]} />);
15
+ });
16
+
17
+ return (
18
+ <Dialog
19
+ maxHeight={true}
20
+ okayOnly={true}
21
+ okayTitle="Close"
22
+ onCancel={this.props.onCancel}
23
+ onOkay={this.props.onCancel}
24
+ title={this.props.title}
25
+ >
26
+ {childrenWithProp}
27
+ </Dialog>
28
+ );
29
+ }
30
+ }
31
+
32
+ CustomTrackDialog.defaultProps = {};
33
+
34
+ CustomTrackDialog.propTypes = {
35
+ onCancel: PropTypes.func.isRequired,
36
+ };
37
+
38
+ export default CustomTrackDialog;
@@ -200,7 +200,7 @@ export default class DataFetcher {
200
200
  this.fetchHorizontalSection(receivedTiles, tileIds, true);
201
201
  } else if (!this.dataConfig.children && this.dataConfig.tilesetUid) {
202
202
  // no children, just return the fetched tiles as is
203
- const promise = new Promise((resolve) =>
203
+ const promise = new Promise((resolve) => {
204
204
  tileProxy.fetchTilesDebounced(
205
205
  {
206
206
  id: slugid.nice(),
@@ -211,8 +211,8 @@ export default class DataFetcher {
211
211
  },
212
212
  this.pubSub,
213
213
  true,
214
- ),
215
- );
214
+ );
215
+ });
216
216
 
217
217
  promise.then((returnedTiles) => {
218
218
  const tilesetUid = dictValues(returnedTiles)[0].tilesetUid;
@@ -387,7 +387,7 @@ export default class DataFetcher {
387
387
  }
388
388
 
389
389
  // actually fetch the new tileIds
390
- const promise = new Promise((resolve) =>
390
+ const promise = new Promise((resolve) => {
391
391
  tileProxy.fetchTilesDebounced(
392
392
  {
393
393
  id: slugid.nice(),
@@ -397,8 +397,8 @@ export default class DataFetcher {
397
397
  },
398
398
  this.pubSub,
399
399
  true,
400
- ),
401
- );
400
+ );
401
+ });
402
402
  promise.then((returnedTiles) => {
403
403
  // we've received some new tiles, but they're 2D
404
404
  // we need to extract the row corresponding to the data we need
@@ -1,14 +1,15 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
+ import clsx from 'clsx';
3
4
 
4
5
  import Button from './Button';
5
6
  import Cross from './Cross';
6
7
  import Modal from './Modal';
7
8
  import withModal from './hocs/with-modal';
8
9
 
9
- import '../styles/Dialog.module.scss';
10
+ import classes from '../styles/Dialog.module.scss';
10
11
 
11
- const Dialog = (props) => {
12
+ function Dialog(props) {
12
13
  const handleCancel = () => {
13
14
  props.modal.close();
14
15
  if (props.onCancel) props.onCancel();
@@ -21,38 +22,46 @@ const Dialog = (props) => {
21
22
 
22
23
  return (
23
24
  <Modal closeButton={false} hide={props.hide} maxHeight={props.maxHeight}>
24
- <header styleName="dialog-header">
25
- <h3>{props.title}</h3>
26
- <Button onClick={handleCancel}>
27
- <Cross />
28
- </Button>
29
- </header>
30
- {props.maxHeight ? (
31
- <main styleName={props.maxHeight ? 'dialog-main-max-height' : ''}>
32
- {props.children}
33
- </main>
34
- ) : (
35
- <main>{props.children}</main>
36
- )}
37
- <footer
38
- styleName={
39
- props.maxHeight ? 'dialog-footer-max-height' : 'dialog-footer'
40
- }
41
- >
42
- {props.okayOnly ? (
43
- <div />
44
- ) : (
45
- <Button onClick={handleCancel} shortcut={props.cancelShortcut}>
46
- {props.cancelTitle}
25
+ <>
26
+ <header className={classes['dialog-header']}>
27
+ <h3>{props.title}</h3>
28
+ <Button onClick={handleCancel}>
29
+ <Cross />
47
30
  </Button>
31
+ </header>
32
+ {props.maxHeight ? (
33
+ <main
34
+ className={clsx(
35
+ props.maxHeight && classes['dialog-main-max-height'],
36
+ )}
37
+ >
38
+ {props.children}
39
+ </main>
40
+ ) : (
41
+ <main>{props.children}</main>
48
42
  )}
49
- <Button onClick={handleOkay} shortcut={props.okayShortcut}>
50
- {props.okayTitle}
51
- </Button>
52
- </footer>
43
+ <footer
44
+ className={
45
+ classes[
46
+ props.maxHeight ? 'dialog-footer-max-height' : 'dialog-footer'
47
+ ]
48
+ }
49
+ >
50
+ {props.okayOnly ? (
51
+ <div />
52
+ ) : (
53
+ <Button onClick={handleCancel} shortcut={props.cancelShortcut}>
54
+ {props.cancelTitle}
55
+ </Button>
56
+ )}
57
+ <Button onClick={handleOkay} shortcut={props.okayShortcut}>
58
+ {props.okayTitle}
59
+ </Button>
60
+ </footer>
61
+ </>
53
62
  </Modal>
54
63
  );
55
- };
64
+ }
56
65
 
57
66
  Dialog.defaultProps = {
58
67
  cancelTitle: 'Cancel',
@@ -65,7 +74,7 @@ Dialog.defaultProps = {
65
74
  Dialog.propTypes = {
66
75
  cancelShortcut: PropTypes.string,
67
76
  cancelTitle: PropTypes.string,
68
- children: PropTypes.func.isRequired,
77
+ children: PropTypes.object,
69
78
  hide: PropTypes.bool,
70
79
  maxHeight: PropTypes.bool,
71
80
  modal: PropTypes.object.isRequired,
@@ -1,11 +1,12 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React from 'react';
3
3
  import slugid from 'slugid';
4
+ import clsx from 'clsx';
4
5
 
5
6
  import withPubSub from './hocs/with-pub-sub';
6
7
 
7
8
  // Styles
8
- import '../styles/DragListeningDiv.module.scss';
9
+ import classes from '../styles/DragListeningDiv.module.scss';
9
10
 
10
11
  class DragListeningDiv extends React.Component {
11
12
  constructor(props) {
@@ -26,11 +27,11 @@ class DragListeningDiv extends React.Component {
26
27
  background = 'blue';
27
28
  }
28
29
 
29
- const styleNames = this.props.enabled ? 'drag-listening-div-active' : '';
30
-
31
30
  return (
32
31
  <div
33
- className="DragListeningDiv"
32
+ className={clsx('DragListeningDiv', {
33
+ [classes['drag-listening-div-active']]: this.props.enabled,
34
+ })}
34
35
  onDragEnter={() => {
35
36
  this.setState({ dragOnTop: true });
36
37
  }}
@@ -55,14 +56,11 @@ class DragListeningDiv extends React.Component {
55
56
  this.props.onTrackDropped(newTrack);
56
57
  this.props.pubSub.publish('trackDropped', newTrack);
57
58
  }}
58
- style={Object.assign(
59
- {
60
- background,
61
- opacity: 0.6,
62
- },
63
- this.props.style,
64
- )}
65
- styleName={styleNames}
59
+ style={{
60
+ background,
61
+ opacity: 0.6,
62
+ ...this.props.style,
63
+ }}
66
64
  />
67
65
  );
68
66
  }