@cdc/map 4.25.3 → 4.25.6
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.
- package/.idea/map.iml +12 -0
- package/.idea/modules.xml +8 -0
- package/.idea/vcs.xml +6 -0
- package/dist/cdcmap.js +31254 -32242
- package/examples/hex-colors.json +3 -3
- package/examples/m2.json +32904 -0
- package/examples/private/test.json +470 -1457
- package/examples/private/{mmr.json → wastewatermap.json} +86 -115
- package/index.html +36 -63
- package/package.json +7 -19
- package/src/CdcMap.tsx +56 -1552
- package/src/CdcMapComponent.tsx +608 -0
- package/src/_stories/CdcMap.Legend.Gradient.stories.tsx +10 -0
- package/src/_stories/CdcMap.Legend.stories.tsx +67 -0
- package/src/_stories/CdcMap.Table.stories.tsx +19 -0
- package/src/_stories/CdcMap.stories.tsx +12 -1
- package/src/_stories/UsaMap.NoData.stories.tsx +4 -4
- package/src/_stories/_mock/default-patterns.json +8 -5
- package/src/_stories/_mock/legend-bins.json +428 -0
- package/{examples/private/default-patterns.json → src/_stories/_mock/legends/legend-tests.json} +36 -131
- package/src/cdcMapComponent.styles.css +9 -0
- package/src/components/Annotation/Annotation.Draggable.tsx +27 -26
- package/src/components/Annotation/AnnotationDropdown.tsx +5 -6
- package/src/components/BubbleList.tsx +135 -49
- package/src/components/CityList.tsx +89 -87
- package/src/components/DataTable.tsx +8 -8
- package/src/components/EditorPanel/components/EditorPanel.tsx +823 -885
- package/src/components/EditorPanel/components/Error.tsx +9 -2
- package/src/components/EditorPanel/components/HexShapeSettings.tsx +127 -141
- package/src/components/EditorPanel/components/Panels/Panel.Annotate.tsx +55 -86
- package/src/components/EditorPanel/components/Panels/Panel.PatternSettings.tsx +89 -75
- package/src/components/EditorPanel/components/editorPanel.styles.css +95 -0
- package/src/components/Geo.tsx +9 -1
- package/src/components/GoogleMap/components/GoogleMap.tsx +1 -1
- package/src/components/Legend/components/Legend.tsx +92 -87
- package/src/components/Legend/components/LegendGroup/Legend.Group.tsx +128 -0
- package/src/components/Legend/components/LegendGroup/legend.group.css +27 -0
- package/src/components/Legend/components/LegendItem.Hex.tsx +4 -1
- package/src/components/Legend/components/index.scss +74 -17
- package/src/components/Modal.tsx +17 -7
- package/src/components/NavigationMenu.tsx +11 -9
- package/src/components/UsaMap/components/SingleState/SingleState.CountyOutput.tsx +12 -8
- package/src/components/UsaMap/components/SingleState/SingleState.StateOutput.tsx +4 -4
- package/src/components/UsaMap/components/TerritoriesSection.tsx +33 -10
- package/src/components/UsaMap/components/Territory/Territory.Hexagon.tsx +12 -10
- package/src/components/UsaMap/components/Territory/Territory.Rectangle.tsx +12 -14
- package/src/components/UsaMap/components/Territory/TerritoryShape.ts +2 -1
- package/src/components/UsaMap/components/UsaMap.County.tsx +138 -96
- package/src/components/UsaMap/components/UsaMap.Region.styles.css +72 -0
- package/src/components/UsaMap/components/UsaMap.Region.tsx +56 -103
- package/src/components/UsaMap/components/UsaMap.SingleState.styles.css +10 -0
- package/src/components/UsaMap/components/UsaMap.SingleState.tsx +65 -74
- package/src/components/UsaMap/components/UsaMap.State.tsx +112 -91
- package/src/components/UsaMap/helpers/map.ts +1 -1
- package/src/components/UsaMap/helpers/shapes.ts +20 -7
- package/src/components/WorldMap/WorldMap.tsx +64 -118
- package/src/components/WorldMap/worldMap.styles.css +28 -0
- package/src/components/ZoomControls.tsx +15 -13
- package/src/components/zoomControls.styles.css +53 -0
- package/src/context.ts +17 -9
- package/src/data/initial-state.js +5 -2
- package/src/helpers/addUIDs.ts +150 -0
- package/src/helpers/applyColorToLegend.ts +39 -64
- package/src/helpers/applyLegendToRow.ts +51 -0
- package/src/helpers/colorDistributions.ts +12 -0
- package/src/helpers/constants.ts +44 -0
- package/src/helpers/displayGeoName.ts +9 -2
- package/src/helpers/formatLegendLocation.ts +3 -2
- package/src/helpers/generateColorsArray.ts +2 -1
- package/src/helpers/generateRuntimeData.ts +78 -0
- package/src/helpers/generateRuntimeFilters.ts +63 -0
- package/src/helpers/generateRuntimeLegend.ts +566 -0
- package/src/helpers/generateRuntimeLegendHash.ts +16 -15
- package/src/helpers/getColumnNames.ts +19 -0
- package/src/helpers/getMapContainerClasses.ts +23 -0
- package/src/helpers/getStatePicked.ts +8 -0
- package/src/helpers/handleMapTabbing.ts +31 -0
- package/src/helpers/hashObj.ts +1 -1
- package/src/helpers/index.ts +22 -0
- package/src/helpers/navigationHandler.ts +3 -3
- package/src/helpers/resetLegendToggles.ts +13 -0
- package/src/helpers/setBinNumbers.ts +5 -0
- package/src/helpers/sortSpecialClassesLast.ts +7 -0
- package/src/helpers/tests/getColumnNames.test.ts +52 -0
- package/src/helpers/titleCase.ts +1 -1
- package/src/helpers/toggleLegendActive.ts +25 -0
- package/src/hooks/useApplyTooltipsToGeo.tsx +51 -0
- package/src/hooks/useColumnsRequiredChecker.ts +51 -0
- package/src/hooks/useGeoClickHandler.ts +45 -0
- package/src/hooks/useLegendSeparators.ts +26 -0
- package/src/hooks/useMapLayers.tsx +34 -60
- package/src/hooks/useModal.ts +22 -0
- package/src/hooks/useResizeObserver.ts +4 -5
- package/src/hooks/useStateZoom.tsx +52 -75
- package/src/hooks/useTooltip.ts +2 -3
- package/src/index.jsx +3 -9
- package/src/scss/editor-panel.scss +3 -99
- package/src/scss/main.scss +1 -19
- package/src/scss/map.scss +15 -220
- package/src/store/map.actions.ts +46 -0
- package/src/store/map.reducer.ts +96 -0
- package/src/types/Annotations.ts +24 -0
- package/src/types/MapConfig.ts +23 -3
- package/src/types/MapContext.ts +36 -35
- package/src/types/Modal.ts +1 -0
- package/src/types/RuntimeData.ts +3 -0
- package/examples/private/DEV-9644.json +0 -184
- package/examples/private/DEV-9989.json +0 -229
- package/examples/private/ardi.json +0 -180
- package/examples/private/colors 2.json +0 -416
- package/examples/private/colors.json +0 -416
- package/examples/private/colors.json.zip +0 -0
- package/examples/private/customColors.json +0 -45348
- package/examples/test.json +0 -183
- package/src/helpers/closeModal.ts +0 -9
- package/src/scss/btn.scss +0 -69
- package/src/scss/filters.scss +0 -27
- package/src/scss/variables.scss +0 -1
- /package/src/hooks/{useActiveElement.js → useActiveElement.ts} +0 -0
package/{examples/private/default-patterns.json → src/_stories/_mock/legends/legend-tests.json}
RENAMED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
{
|
|
2
|
-
"annotations": [],
|
|
3
2
|
"general": {
|
|
4
3
|
"title": "Example Data Map with Cities",
|
|
5
4
|
"subtext": "*: Lorem ipsum; NA: Lorem ipsum.",
|
|
@@ -20,7 +19,7 @@
|
|
|
20
19
|
"displayStateLabels": false,
|
|
21
20
|
"fullBorder": false,
|
|
22
21
|
"palette": {
|
|
23
|
-
"isReversed":
|
|
22
|
+
"isReversed": false
|
|
24
23
|
},
|
|
25
24
|
"allowMapZoom": true,
|
|
26
25
|
"hideGeoColumnInTooltip": false,
|
|
@@ -30,15 +29,10 @@
|
|
|
30
29
|
"stateName": "Alabama"
|
|
31
30
|
},
|
|
32
31
|
"showDownloadImgButton": false,
|
|
33
|
-
"showDownloadPdfButton": false
|
|
34
|
-
"territoriesAlwaysShow": false,
|
|
35
|
-
"geoLabelOverride": "",
|
|
36
|
-
"convertFipsCodes": true,
|
|
37
|
-
"noStateFoundMessage": "Map Unavailable",
|
|
38
|
-
"annotationDropdownText": "Annotations"
|
|
32
|
+
"showDownloadPdfButton": false
|
|
39
33
|
},
|
|
40
34
|
"type": "map",
|
|
41
|
-
"color": "
|
|
35
|
+
"color": "yelloworangered",
|
|
42
36
|
"columns": {
|
|
43
37
|
"geo": {
|
|
44
38
|
"dataTable": true,
|
|
@@ -52,8 +46,7 @@
|
|
|
52
46
|
"name": "Rate",
|
|
53
47
|
"prefix": "",
|
|
54
48
|
"suffix": "",
|
|
55
|
-
"tooltip": false
|
|
56
|
-
"roundToPlace": 0
|
|
49
|
+
"tooltip": false
|
|
57
50
|
},
|
|
58
51
|
"navigate": {
|
|
59
52
|
"dataTable": false,
|
|
@@ -101,49 +94,47 @@
|
|
|
101
94
|
"singleColumn": false,
|
|
102
95
|
"dynamicDescription": false,
|
|
103
96
|
"descriptions": {},
|
|
104
|
-
"singleRow": false
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
"
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
97
|
+
"singleRow": false
|
|
98
|
+
},
|
|
99
|
+
"map": {
|
|
100
|
+
"layers": [
|
|
101
|
+
{
|
|
102
|
+
"name": "Layer One",
|
|
103
|
+
"url": "./examples/testing-layer.json",
|
|
104
|
+
"namespace": "cove",
|
|
105
|
+
"fill": "blue",
|
|
106
|
+
"stroke": "orange",
|
|
107
|
+
"strokeWidth": "5"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"name": "Layer Two",
|
|
111
|
+
"url": "./examples/testing-layer-2.json",
|
|
112
|
+
"namespace": "cove",
|
|
113
|
+
"fill": "blue",
|
|
114
|
+
"stroke": "orange",
|
|
115
|
+
"strokeWidth": "5"
|
|
116
|
+
}
|
|
117
|
+
]
|
|
112
118
|
},
|
|
113
119
|
"filters": [],
|
|
114
|
-
"
|
|
115
|
-
"
|
|
116
|
-
"
|
|
117
|
-
"wrapColumns": false,
|
|
118
|
-
"label": "Data Table",
|
|
119
|
-
"expanded": true,
|
|
120
|
-
"limitHeight": false,
|
|
121
|
-
"height": "",
|
|
122
|
-
"caption": "",
|
|
123
|
-
"showFullGeoNameInCSV": false,
|
|
124
|
-
"forceDisplay": true,
|
|
125
|
-
"download": true,
|
|
126
|
-
"indexLabel": "",
|
|
127
|
-
"showDownloadLinkBelow": true
|
|
120
|
+
"dataTable": {
|
|
121
|
+
"title": "Data Table",
|
|
122
|
+
"forceDisplay": true
|
|
128
123
|
},
|
|
129
124
|
"tooltips": {
|
|
130
125
|
"appearanceType": "hover",
|
|
131
126
|
"linkLabel": "Learn More",
|
|
132
|
-
"capitalizeLabels": true
|
|
133
|
-
"opacity": 90
|
|
127
|
+
"capitalizeLabels": true
|
|
134
128
|
},
|
|
135
129
|
"runtime": {
|
|
136
|
-
"editorErrorMessage":
|
|
130
|
+
"editorErrorMessage": []
|
|
137
131
|
},
|
|
138
132
|
"visual": {
|
|
139
133
|
"cityStyle": "pin",
|
|
140
134
|
"minBubbleSize": 1,
|
|
141
135
|
"maxBubbleSize": 20,
|
|
142
136
|
"extraBubbleBorder": false,
|
|
143
|
-
"showBubbleZeros": false
|
|
144
|
-
"geoCodeCircleSize": 2,
|
|
145
|
-
"cityStyleLabel": "",
|
|
146
|
-
"additionalCityStyles": []
|
|
137
|
+
"showBubbleZeros": false
|
|
147
138
|
},
|
|
148
139
|
"mapPosition": {
|
|
149
140
|
"coordinates": [
|
|
@@ -152,42 +143,6 @@
|
|
|
152
143
|
],
|
|
153
144
|
"zoom": 1
|
|
154
145
|
},
|
|
155
|
-
"map": {
|
|
156
|
-
"layers": [],
|
|
157
|
-
"patterns": [
|
|
158
|
-
{
|
|
159
|
-
"dataKey": "Location",
|
|
160
|
-
"pattern": "circles",
|
|
161
|
-
"contrastCheck": true,
|
|
162
|
-
"dataValue": "School",
|
|
163
|
-
"color": "red"
|
|
164
|
-
}
|
|
165
|
-
]
|
|
166
|
-
},
|
|
167
|
-
"hexMap": {
|
|
168
|
-
"type": "",
|
|
169
|
-
"shapeGroups": [
|
|
170
|
-
{
|
|
171
|
-
"legendTitle": "",
|
|
172
|
-
"legendDescription": "",
|
|
173
|
-
"items": [
|
|
174
|
-
{
|
|
175
|
-
"key": "",
|
|
176
|
-
"shape": "Arrow Up",
|
|
177
|
-
"column": "",
|
|
178
|
-
"operator": "=",
|
|
179
|
-
"value": ""
|
|
180
|
-
}
|
|
181
|
-
]
|
|
182
|
-
}
|
|
183
|
-
]
|
|
184
|
-
},
|
|
185
|
-
"filterBehavior": "Filter Change",
|
|
186
|
-
"filterIntro": "",
|
|
187
|
-
"dataTable": {
|
|
188
|
-
"title": "Data Table",
|
|
189
|
-
"forceDisplay": true
|
|
190
|
-
},
|
|
191
146
|
"sharing": {
|
|
192
147
|
"enabled": false,
|
|
193
148
|
"dataHost": "wcms-wp.cdc.gov",
|
|
@@ -197,25 +152,13 @@
|
|
|
197
152
|
"data": [
|
|
198
153
|
{
|
|
199
154
|
"STATE": "AL",
|
|
200
|
-
"Rate":
|
|
201
|
-
"Location": "Home",
|
|
202
|
-
"URL": "https://www.cdc.gov/"
|
|
203
|
-
},
|
|
204
|
-
{
|
|
205
|
-
"STATE": "Great Plains Tribal Leaders Health Board",
|
|
206
|
-
"Rate": 1000,
|
|
207
|
-
"Location": "Home",
|
|
208
|
-
"URL": "https://www.cdc.gov/"
|
|
209
|
-
},
|
|
210
|
-
{
|
|
211
|
-
"STATE": "Montana American Indian Women’s Health Coalition",
|
|
212
|
-
"Rate": 1000,
|
|
155
|
+
"Rate": 10,
|
|
213
156
|
"Location": "Home",
|
|
214
157
|
"URL": "https://www.cdc.gov/"
|
|
215
158
|
},
|
|
216
159
|
{
|
|
217
160
|
"STATE": "AK",
|
|
218
|
-
"Rate":
|
|
161
|
+
"Rate": 12,
|
|
219
162
|
"Location": "Vehicle",
|
|
220
163
|
"URL": "https://www.cdc.gov/"
|
|
221
164
|
},
|
|
@@ -573,42 +516,6 @@
|
|
|
573
516
|
"Location": "Vehicle",
|
|
574
517
|
"URL": "https://www.cdc.gov/"
|
|
575
518
|
},
|
|
576
|
-
{
|
|
577
|
-
"STATE": "Grand Rapids, MICHIGAN",
|
|
578
|
-
"Rate": 14,
|
|
579
|
-
"Location": "Vehicle",
|
|
580
|
-
"URL": "https://www.cdc.gov/"
|
|
581
|
-
},
|
|
582
|
-
{
|
|
583
|
-
"STATE": "Salem, OReGON",
|
|
584
|
-
"Rate": 14,
|
|
585
|
-
"Location": "Vehicle",
|
|
586
|
-
"URL": "https://www.cdc.gov/"
|
|
587
|
-
},
|
|
588
|
-
{
|
|
589
|
-
"STATE": "Round Rock, TEXAS",
|
|
590
|
-
"Rate": 14,
|
|
591
|
-
"Location": "Vehicle",
|
|
592
|
-
"URL": "https://www.cdc.gov/"
|
|
593
|
-
},
|
|
594
|
-
{
|
|
595
|
-
"STATE": "PROVO, UT",
|
|
596
|
-
"Rate": 14,
|
|
597
|
-
"Location": "Vehicle",
|
|
598
|
-
"URL": "https://www.cdc.gov/"
|
|
599
|
-
},
|
|
600
|
-
{
|
|
601
|
-
"STATE": "SALUDA, VIRGINIA",
|
|
602
|
-
"Rate": 14,
|
|
603
|
-
"Location": "Vehicle",
|
|
604
|
-
"URL": "https://www.cdc.gov/"
|
|
605
|
-
},
|
|
606
|
-
{
|
|
607
|
-
"STATE": "ELLENSBURG, WA",
|
|
608
|
-
"Rate": 14,
|
|
609
|
-
"Location": "Vehicle",
|
|
610
|
-
"URL": "https://www.cdc.gov/"
|
|
611
|
-
},
|
|
612
519
|
{
|
|
613
520
|
"STATE": "Atlanta",
|
|
614
521
|
"Rate": 12,
|
|
@@ -724,7 +631,7 @@
|
|
|
724
631
|
"URL": "https://www.cdc.gov/"
|
|
725
632
|
},
|
|
726
633
|
{
|
|
727
|
-
"STATE": "Great Plains Tribal
|
|
634
|
+
"STATE": "Great Plains Tribal Chairmen's Health Board",
|
|
728
635
|
"Rate": 18,
|
|
729
636
|
"Location": "Vehicle",
|
|
730
637
|
"URL": "https://www.cdc.gov/"
|
|
@@ -861,7 +768,5 @@
|
|
|
861
768
|
"Location": "Vehicle",
|
|
862
769
|
"URL": "https://www.cdc.gov/"
|
|
863
770
|
}
|
|
864
|
-
]
|
|
865
|
-
|
|
866
|
-
"version": "4.24.11"
|
|
867
|
-
}
|
|
771
|
+
]
|
|
772
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useContext, useState
|
|
1
|
+
import React, { useContext, useState } from 'react'
|
|
2
2
|
|
|
3
3
|
// visx
|
|
4
4
|
import { HtmlLabel, CircleSubject, EditableAnnotation, Connector, Annotation as VisxAnnotation } from '@visx/annotation'
|
|
@@ -10,53 +10,56 @@ import './Annotation.Draggable.styles.css'
|
|
|
10
10
|
import ConfigContext from '../../context'
|
|
11
11
|
import { MapContext } from '../../types/MapContext'
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
type AnnotationsProps = {
|
|
14
|
+
onDragStateChange: (state: boolean) => void
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const Annotations: React.FC<AnnotationsProps> = ({ onDragStateChange }) => {
|
|
14
18
|
const [draggingItems, setDraggingItems] = useState([])
|
|
15
19
|
const {
|
|
16
|
-
|
|
17
|
-
|
|
20
|
+
config,
|
|
21
|
+
setConfig,
|
|
18
22
|
isDraggingAnnotation,
|
|
19
23
|
isEditor,
|
|
20
24
|
dimensions
|
|
21
25
|
} = useContext<MapContext>(ConfigContext)
|
|
22
26
|
const [width, height] = dimensions
|
|
23
27
|
const { annotations } = config
|
|
24
|
-
const prevDimensions = useRef(dimensions)
|
|
25
28
|
const AnnotationComponent = isEditor ? EditableAnnotation : VisxAnnotation
|
|
26
29
|
|
|
27
30
|
return (
|
|
28
31
|
annotations &&
|
|
29
32
|
annotations.map((annotation, index) => {
|
|
33
|
+
const { marker, x, y, dx, dy, edit, connectionType } = annotation
|
|
34
|
+
|
|
30
35
|
return (
|
|
31
36
|
<>
|
|
32
37
|
<Drag
|
|
33
38
|
key={`annotation--${index}`}
|
|
34
39
|
width={width}
|
|
35
40
|
height={height}
|
|
36
|
-
x={
|
|
37
|
-
y={
|
|
41
|
+
x={x}
|
|
42
|
+
y={y} // subject y
|
|
38
43
|
onDragStart={() => {
|
|
39
44
|
setDraggingItems(raise(annotations, index))
|
|
40
45
|
}}
|
|
41
46
|
>
|
|
42
|
-
{({ dragStart, dragEnd, dragMove
|
|
47
|
+
{({ dragStart, dragEnd, dragMove }) => {
|
|
43
48
|
return (
|
|
44
49
|
<>
|
|
45
50
|
<AnnotationComponent
|
|
46
|
-
dx={
|
|
47
|
-
dy={
|
|
48
|
-
x={
|
|
49
|
-
y={
|
|
50
|
-
canEditLabel={
|
|
51
|
-
canEditSubject={
|
|
51
|
+
dx={dx} // label position
|
|
52
|
+
dy={dy} // label position
|
|
53
|
+
x={x}
|
|
54
|
+
y={y}
|
|
55
|
+
canEditLabel={edit.label || false}
|
|
56
|
+
canEditSubject={edit.subject || false}
|
|
52
57
|
labelDragHandleProps={{ r: 15, stroke: isDraggingAnnotation ? 'red' : 'var(--primary)' }}
|
|
53
58
|
subjectDragHandleProps={{ r: 15, stroke: isDraggingAnnotation ? 'red' : 'var(--primary)' }}
|
|
54
59
|
onDragEnd={props => {
|
|
55
60
|
onDragStateChange(false)
|
|
56
61
|
const updatedAnnotations = annotations.map((annotation, idx) => {
|
|
57
62
|
if (idx === index) {
|
|
58
|
-
const nearestDatum = annotation
|
|
59
|
-
|
|
60
63
|
return {
|
|
61
64
|
...annotation,
|
|
62
65
|
x: props.x,
|
|
@@ -68,7 +71,7 @@ const Annotations = ({ xScale, yScale, xMax, svgRef, onDragStateChange }) => {
|
|
|
68
71
|
return annotation
|
|
69
72
|
})
|
|
70
73
|
|
|
71
|
-
|
|
74
|
+
setConfig({
|
|
72
75
|
...config,
|
|
73
76
|
annotations: updatedAnnotations
|
|
74
77
|
})
|
|
@@ -95,7 +98,7 @@ const Annotations = ({ xScale, yScale, xMax, svgRef, onDragStateChange }) => {
|
|
|
95
98
|
}}
|
|
96
99
|
role='presentation'
|
|
97
100
|
// ! IMPORTANT: Workaround for 508
|
|
98
|
-
// - HTML needs to be set from the editor and we need a wrapper with the tabIndex
|
|
101
|
+
// - HTML needs to be set from the editor, and we need a wrapper with the tabIndex
|
|
99
102
|
// - TabIndex is only supposed to be used on interactive elements. This is a workaround.
|
|
100
103
|
// eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
|
|
101
104
|
tabIndex={0}
|
|
@@ -104,24 +107,22 @@ const Annotations = ({ xScale, yScale, xMax, svgRef, onDragStateChange }) => {
|
|
|
104
107
|
/>
|
|
105
108
|
</HtmlLabel>
|
|
106
109
|
|
|
107
|
-
{
|
|
110
|
+
{connectionType === 'line' && (
|
|
108
111
|
<Connector type='line' pathProps={{ markerStart: 'url(#marker-start)' }} />
|
|
109
112
|
)}
|
|
110
113
|
|
|
111
|
-
{
|
|
114
|
+
{connectionType === 'elbow' && (
|
|
112
115
|
<Connector type='elbow' pathProps={{ markerStart: 'url(#marker-start)' }} />
|
|
113
116
|
)}
|
|
114
117
|
|
|
115
118
|
{/* MARKERS */}
|
|
116
|
-
{
|
|
117
|
-
|
|
118
|
-
)}
|
|
119
|
-
{annotation.marker === 'arrow' && (
|
|
119
|
+
{marker === 'circle' && <CircleSubject className='circle-subject' stroke={'black'} radius={8} />}
|
|
120
|
+
{marker === 'arrow' && (
|
|
120
121
|
<MarkerArrow
|
|
121
122
|
fill='black'
|
|
122
123
|
id='marker-start'
|
|
123
|
-
x={
|
|
124
|
-
y={
|
|
124
|
+
x={x}
|
|
125
|
+
y={dy}
|
|
125
126
|
stroke='#333'
|
|
126
127
|
markerWidth={10}
|
|
127
128
|
size={10}
|
|
@@ -2,16 +2,15 @@ import React, { useContext, useState } from 'react'
|
|
|
2
2
|
import ConfigContext from '../../context'
|
|
3
3
|
import './AnnotationDropdown.styles.css'
|
|
4
4
|
import Icon from '@cdc/core/components/ui/Icon'
|
|
5
|
-
import {
|
|
5
|
+
import { APP_FONT_SIZE } from '@cdc/core/helpers/constants'
|
|
6
6
|
import AnnotationList from './AnnotationList'
|
|
7
|
+
import { MapContext } from '../../types/MapContext'
|
|
7
8
|
|
|
8
9
|
const AnnotationDropdown = () => {
|
|
9
|
-
const {
|
|
10
|
+
const { config, currentViewport: viewport } = useContext<MapContext>(ConfigContext)
|
|
10
11
|
const [expanded, setExpanded] = useState(false)
|
|
11
12
|
|
|
12
|
-
const titleFontSize = ['sm', 'xs', 'xxs'].includes(viewport) ? '13px' : `${
|
|
13
|
-
|
|
14
|
-
const annotations = config?.annotations || []
|
|
13
|
+
const titleFontSize = ['sm', 'xs', 'xxs'].includes(viewport) ? '13px' : `${APP_FONT_SIZE}px`
|
|
15
14
|
|
|
16
15
|
const limitHeight = {
|
|
17
16
|
maxHeight: config.table.limitHeight && `${config.table.height}px`,
|
|
@@ -49,7 +48,7 @@ const AnnotationDropdown = () => {
|
|
|
49
48
|
}}
|
|
50
49
|
tabIndex={0}
|
|
51
50
|
onKeyDown={e => {
|
|
52
|
-
if (e.
|
|
51
|
+
if (e.key === 'Enter') {
|
|
53
52
|
setExpanded(!expanded)
|
|
54
53
|
}
|
|
55
54
|
}}
|