@cdc/map 4.25.6 → 4.25.7-2
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/dist/cdcmap.js +42899 -22312
- package/examples/private/m.json +427 -0
- package/index.html +9 -0
- package/package.json +3 -3
- package/src/CdcMap.tsx +5 -0
- package/src/CdcMapComponent.tsx +31 -4
- package/src/components/EditorPanel/components/EditorPanel.tsx +52 -51
- package/src/components/Legend/components/Legend.tsx +36 -35
- package/src/helpers/generateRuntimeLegend.ts +1 -1
- package/src/scss/main.scss +1 -1
- package/examples/m2.json +0 -32904
|
@@ -135,6 +135,7 @@ const Legend = forwardRef<HTMLDivElement, LegendProps>((props, ref) => {
|
|
|
135
135
|
}
|
|
136
136
|
}}
|
|
137
137
|
tabIndex={0}
|
|
138
|
+
role='button'
|
|
138
139
|
>
|
|
139
140
|
<LegendShape shape={config.legend.style === 'boxes' ? 'square' : 'circle'} fill={item.color} />
|
|
140
141
|
<span>{item.label}</span>
|
|
@@ -313,41 +314,41 @@ const Legend = forwardRef<HTMLDivElement, LegendProps>((props, ref) => {
|
|
|
313
314
|
|
|
314
315
|
{((config.visual.additionalCityStyles && config.visual.additionalCityStyles.some(c => c.label)) ||
|
|
315
316
|
config.visual.cityStyleLabel) && (
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
317
|
+
<>
|
|
318
|
+
<hr />
|
|
319
|
+
<div className={legendClasses.div.join(' ') || ''}>
|
|
320
|
+
{config.visual.cityStyleLabel && (
|
|
321
|
+
<div>
|
|
322
|
+
<svg>
|
|
323
|
+
<Group
|
|
324
|
+
top={
|
|
325
|
+
config.visual.cityStyle === 'pin' ? 19 : config.visual.cityStyle === 'triangle' ? 13 : 11
|
|
326
|
+
}
|
|
327
|
+
left={10}
|
|
328
|
+
>
|
|
329
|
+
{cityStyleShapes[config.visual.cityStyle.toLowerCase()]}
|
|
330
|
+
</Group>
|
|
331
|
+
</svg>
|
|
332
|
+
<p>{config.visual.cityStyleLabel}</p>
|
|
333
|
+
</div>
|
|
334
|
+
)}
|
|
335
|
+
|
|
336
|
+
{config.visual.additionalCityStyles.map(
|
|
337
|
+
({ shape, label }) =>
|
|
338
|
+
label && (
|
|
339
|
+
<div>
|
|
340
|
+
<svg>
|
|
341
|
+
<Group top={shape === 'Pin' ? 19 : shape === 'Triangle' ? 13 : 11} left={10}>
|
|
342
|
+
{cityStyleShapes[shape.toLowerCase()]}
|
|
343
|
+
</Group>
|
|
344
|
+
</svg>
|
|
345
|
+
<p>{label}</p>
|
|
346
|
+
</div>
|
|
347
|
+
)
|
|
348
|
+
)}
|
|
349
|
+
</div>
|
|
350
|
+
</>
|
|
351
|
+
)}
|
|
351
352
|
{runtimeLegend.disabledAmt > 0 && (
|
|
352
353
|
<Button className={legendClasses.showAllButton.join(' ')} onClick={handleReset}>
|
|
353
354
|
Show All
|
|
@@ -462,7 +462,7 @@ export const generateRuntimeLegend = (
|
|
|
462
462
|
if (!assigned) {
|
|
463
463
|
console.warn('Value not assigned to any range:', number, 'assigning to closest range')
|
|
464
464
|
let closestIndex = 0
|
|
465
|
-
let minDistance = Math.abs(number - (
|
|
465
|
+
let minDistance = Math.abs(number - (result.items[0].min + result.items[0].max) / 2)
|
|
466
466
|
|
|
467
467
|
for (let i = 1; i < result.items.length; i++) {
|
|
468
468
|
const midpoint = (result.items[i].min + result.items[i].max) / 2
|