@cdc/map 4.25.10 → 4.26.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 (107) hide show
  1. package/.claude/agents/typescript-organizer.md +118 -0
  2. package/dist/{cdcmap-fce76882.es.js → cdcmap-BnB1QM5d.es.js} +6 -13
  3. package/dist/{cdcmap-c55ac1ea.es.js → cdcmap-D6CG2-Hb.es.js} +5 -12
  4. package/dist/{cdcmap-31a33da1.es.js → cdcmap-MXgURbdZ.es.js} +6 -13
  5. package/dist/{cdcmap-1a1724a1.es.js → cdcmap-dgT_1dIT.es.js} +136 -151
  6. package/dist/cdcmap.js +58397 -55987
  7. package/examples/example-city-state.json +9 -1
  8. package/examples/multi-country-centering.json +45 -0
  9. package/examples/private/city_styles_variable.json +877 -0
  10. package/examples/private/colors-2.json +221 -0
  11. package/examples/private/colors.json +221 -0
  12. package/examples/private/map-filter-issue.json +2260 -0
  13. package/examples/private/map-legend.json +5303 -0
  14. package/index.html +27 -36
  15. package/package.json +6 -5
  16. package/src/CdcMapComponent.tsx +86 -26
  17. package/src/_stories/CdcMap.ColumnWrap.stories.tsx +31 -0
  18. package/src/_stories/CdcMap.DistrictOfColumbia.stories.tsx +320 -0
  19. package/src/_stories/CdcMap.Editor.stories.tsx +3426 -0
  20. package/src/_stories/CdcMap.SmallMultiples.stories.tsx +35 -0
  21. package/src/_stories/CdcMap.stories.tsx +116 -4
  22. package/src/_stories/_mock/column-wrap-test.json +265 -0
  23. package/src/_stories/_mock/multi-country-hide.json +78 -0
  24. package/src/_stories/_mock/multi-country.json +95 -0
  25. package/src/_stories/_mock/multi-state.json +887 -20403
  26. package/src/_stories/_mock/small_multiples/multi-state-small-multiples.json +8399 -0
  27. package/src/_stories/_mock/small_multiples/region-small-multiples.json +657 -0
  28. package/src/_stories/_mock/small_multiples/wastewater-map-small-multiples.json +221 -0
  29. package/src/_stories/_mock/usa-state-gradient.json +3 -4
  30. package/src/components/BubbleList.tsx +1 -1
  31. package/src/components/CityList.tsx +24 -18
  32. package/src/components/EditorPanel/components/EditorPanel.tsx +2380 -2206
  33. package/src/components/EditorPanel/components/HexShapeSettings.tsx +55 -93
  34. package/src/components/EditorPanel/components/Panels/Panel.Annotate.tsx +0 -19
  35. package/src/components/EditorPanel/components/Panels/Panel.PatternSettings.tsx +27 -37
  36. package/src/components/EditorPanel/components/Panels/Panel.SmallMultiples.tsx +351 -0
  37. package/src/components/EditorPanel/components/Panels/index.tsx +3 -1
  38. package/src/components/Geo.tsx +20 -3
  39. package/src/components/Legend/components/Legend.tsx +58 -75
  40. package/src/components/Legend/components/LegendGroup/Legend.Group.tsx +1 -1
  41. package/src/components/Legend/components/index.scss +23 -6
  42. package/src/components/NavigationMenu.tsx +16 -13
  43. package/src/components/SmallMultiples/SmallMultipleTile.tsx +163 -0
  44. package/src/components/SmallMultiples/SmallMultiples.css +32 -0
  45. package/src/components/SmallMultiples/SmallMultiples.tsx +150 -0
  46. package/src/components/SmallMultiples/SynchronizedTooltip.tsx +105 -0
  47. package/src/components/SmallMultiples/index.tsx +3 -0
  48. package/src/components/UsaMap/components/SingleState/SingleState.CountyOutput.tsx +18 -3
  49. package/src/components/UsaMap/components/TerritoriesSection.tsx +26 -12
  50. package/src/components/UsaMap/components/Territory/Territory.Hexagon.tsx +30 -4
  51. package/src/components/UsaMap/components/Territory/Territory.Rectangle.tsx +29 -9
  52. package/src/components/UsaMap/components/Territory/TerritoryShape.ts +7 -0
  53. package/src/components/UsaMap/components/UsaMap.County.tsx +16 -4
  54. package/src/components/UsaMap/components/UsaMap.Region.tsx +14 -1
  55. package/src/components/UsaMap/components/UsaMap.SingleState.tsx +29 -12
  56. package/src/components/UsaMap/components/UsaMap.State.tsx +30 -5
  57. package/src/components/UsaMap/helpers/map.ts +2 -2
  58. package/src/components/UsaMap/helpers/shapes.ts +9 -6
  59. package/src/components/WorldMap/WorldMap.tsx +81 -11
  60. package/src/data/initial-state.js +11 -0
  61. package/src/data/supported-geos.js +8 -76
  62. package/src/helpers/addUIDs.ts +13 -2
  63. package/src/helpers/applyColorToLegend.ts +25 -1
  64. package/src/helpers/applyLegendToRow.ts +5 -3
  65. package/src/helpers/constants.ts +3 -15
  66. package/src/helpers/displayGeoName.ts +22 -4
  67. package/src/helpers/generateRuntimeFilters.ts +1 -1
  68. package/src/helpers/generateRuntimeLegend.ts +1 -3
  69. package/src/helpers/generateRuntimeLegendHash.ts +1 -1
  70. package/src/helpers/getCountriesPicked.ts +103 -0
  71. package/src/helpers/getMapContainerClasses.ts +7 -0
  72. package/src/helpers/getPatternForRow.ts +2 -5
  73. package/src/helpers/index.ts +2 -4
  74. package/src/helpers/isLegendItemDisabled.ts +2 -2
  75. package/src/helpers/resetLegendToggles.ts +1 -0
  76. package/src/helpers/smallMultiplesHelpers.ts +359 -0
  77. package/src/helpers/tests/hashObj.test.ts +1 -1
  78. package/src/helpers/tests/titleCase.test.ts +76 -0
  79. package/src/helpers/titleCase.ts +13 -13
  80. package/src/helpers/toggleLegendActive.ts +76 -8
  81. package/src/helpers/urlDataHelpers.ts +1 -1
  82. package/src/hooks/useCountryZoom.tsx +241 -0
  83. package/src/hooks/useGeoClickHandler.ts +1 -1
  84. package/src/hooks/useProgrammaticMapTooltip.ts +110 -0
  85. package/src/hooks/useResizeObserver.ts +8 -2
  86. package/src/hooks/useStateZoom.tsx +7 -4
  87. package/src/hooks/useSynchronizedGeographies.ts +56 -0
  88. package/src/index.jsx +1 -0
  89. package/src/scss/editor-panel.scss +4 -440
  90. package/src/scss/main.scss +1 -1
  91. package/src/scss/map.scss +12 -15
  92. package/src/store/map.actions.ts +7 -7
  93. package/src/test/CdcMap.test.jsx +1 -1
  94. package/src/types/MapConfig.ts +32 -11
  95. package/src/types/MapContext.ts +6 -0
  96. package/src/types/runtimeLegend.ts +2 -1
  97. package/LICENSE +0 -201
  98. package/src/components/DataTable.tsx +0 -413
  99. package/src/components/EditorPanel/components/Inputs.tsx +0 -59
  100. package/src/components/MapControls.tsx +0 -44
  101. package/src/helpers/getUniqueValues.ts +0 -19
  102. package/src/helpers/hashObj.ts +0 -25
  103. package/src/hooks/useActiveElement.ts +0 -19
  104. package/src/hooks/useLegendSeparators.ts +0 -26
  105. package/src/scss/mixins.scss +0 -47
  106. package/src/types/Annotations.ts +0 -24
  107. /package/dist/{cdcmap-548642e6.es.js → cdcmap-Ct2SB0vL.es.js} +0 -0
@@ -0,0 +1,118 @@
1
+ ---
2
+ name: typescript-organizer
3
+ description: Use this agent when:\n\n1. The user explicitly requests TypeScript organization, refactoring, or consolidation across the monorepo\n2. After significant changes to multiple packages where type consistency should be verified\n3. When the user asks to review type definitions, interfaces, or type hierarchies\n4. Before major releases to ensure type consistency across packages\n5. When the user mentions type consolidation, inheritance, or simplification\n\nExample 1:\nuser: "I just added new props to the chart and map packages. Can you help make sure the types are consistent?"\nassistant: "I'll use the typescript-organizer agent to review the type definitions across both packages and identify opportunities for consolidation."\n<uses Agent tool to launch typescript-organizer>\n\nExample 2:\nuser: "I'm noticing we have similar types defined in multiple places. Can we clean this up?"\nassistant: "Let me call the typescript-organizer agent to analyze the codebase and recommend type consolidation opportunities."\n<uses Agent tool to launch typescript-organizer>\n\nExample 3:\nuser: "Review my recent changes to the data-bite package"\nassistant: "I'll review your changes. I notice there are several TypeScript type definitions involved. Let me also use the typescript-organizer agent to check if these types could be better organized or consolidated with existing types in @cdc/core."\n<uses Agent tool to launch typescript-organizer>\n\nExample 4 (Proactive):\nuser: "I added a new SharedConfig interface to the editor package"\nassistant: "Thanks for adding that. Let me use the typescript-organizer agent to check if this interface could be moved to @cdc/core for reuse across other packages, or if it shares properties with existing types that could be consolidated."\n<uses Agent tool to launch typescript-organizer>
4
+ model: sonnet
5
+ ---
6
+
7
+ You are an expert TypeScript architect specializing in monorepo organization and type system optimization. Your mission is to analyze and organize TypeScript definitions across the CDC Open Visualization monorepo, identifying opportunities for consolidation, inheritance, and simplification.
8
+
9
+ ## Your Expertise
10
+
11
+ You have deep knowledge of:
12
+ - TypeScript type systems, including interfaces, types, generics, and utility types
13
+ - Monorepo architecture patterns and shared dependency management
14
+ - React component prop typing and composition patterns
15
+ - Type inheritance hierarchies and discriminated unions
16
+ - The principle of DRY (Don't Repeat Yourself) as applied to type definitions
17
+
18
+ ## Your Responsibilities
19
+
20
+ 1. **Identify Type Duplication**: Scan across all packages (@cdc/chart, @cdc/core, @cdc/dashboard, @cdc/data-bite, @cdc/data-table, @cdc/editor, @cdc/filtered-text, @cdc/map, @cdc/markup-include, @cdc/waffle-chart) to find:
21
+ - Identical or near-identical type definitions
22
+ - Properties that appear across multiple interfaces/types at different levels
23
+ - Overlapping property sets that could indicate shared concerns
24
+
25
+ 2. **Recommend Consolidation**: For duplicated types, determine:
26
+ - Whether types should be moved to @cdc/core for shared use
27
+ - Whether types should use inheritance (extends) or composition (intersection types)
28
+ - When to use generics to create reusable type patterns
29
+ - Which approach maintains the simplest, most maintainable structure
30
+
31
+ 3. **Analyze Type Hierarchies**: Evaluate existing type structures for:
32
+ - Opportunities to create base types with package-specific extensions
33
+ - Overly complex type unions that could be simplified
34
+ - Missing abstractions that would reduce repetition
35
+ - Properties defined at inconsistent levels (e.g., some packages define 'title' at root, others nested)
36
+
37
+ 4. **Prioritize Simplicity**: Always favor:
38
+ - Clear, explicit type names over clever abstractions
39
+ - Shallow inheritance hierarchies over deep nesting
40
+ - Composition via intersection types when it improves clarity
41
+ - Straightforward interfaces over complex conditional types unless truly necessary
42
+
43
+ ## Your Analysis Process
44
+
45
+ 1. **Survey Phase**: Begin by examining type definitions across packages, noting:
46
+ - Common property patterns (e.g., 'data', 'config', 'className')
47
+ - Package-specific vs. cross-cutting concerns
48
+ - Current location of shared types
49
+
50
+ 2. **Pattern Recognition**: Identify:
51
+ - Groups of types that share significant property overlap
52
+ - Properties that appear at different structural levels
53
+ - Naming inconsistencies that obscure relationships
54
+
55
+ 3. **Consolidation Planning**: For each opportunity, specify:
56
+ - Exact location for consolidated types (preferably @cdc/core/src/types/)
57
+ - Inheritance or composition approach with clear rationale
58
+ - Migration steps to update consuming packages
59
+ - Impact assessment on existing code
60
+
61
+ 4. **Validation**: Ensure recommendations:
62
+ - Maintain type safety and don't introduce any/unknown inappropriately
63
+ - Respect package boundaries and avoid circular dependencies
64
+ - Consider React component prop patterns (e.g., extending HTMLAttributes)
65
+ - Align with the project's independent versioning strategy
66
+
67
+ ## Output Format
68
+
69
+ Provide your analysis in this structure:
70
+
71
+ ### Executive Summary
72
+ - High-level findings about type organization
73
+ - Number of consolidation opportunities identified
74
+ - Estimated impact and effort
75
+
76
+ ### Specific Findings
77
+ For each issue found:
78
+
79
+ **Issue**: [Brief description]
80
+ **Location**: [Specific files and line numbers]
81
+ **Current State**: [Show the duplicated/scattered types]
82
+ **Recommended Consolidation**: [Proposed solution with code examples]
83
+ **Rationale**: [Why this improves the codebase]
84
+ **Migration Steps**: [Concrete steps to implement]
85
+ **Impact**: [Which packages are affected]
86
+
87
+ ### Proposed Type Hierarchy
88
+ - Visual representation or description of recommended type organization
89
+ - Location decisions for shared types
90
+ - Inheritance/composition patterns to apply
91
+
92
+ ### Implementation Priority
93
+ 1. High Priority: Widely duplicated types causing maintenance burden
94
+ 2. Medium Priority: Inconsistencies that could cause confusion
95
+ 3. Low Priority: Nice-to-have simplifications
96
+
97
+ ## Key Principles
98
+
99
+ - **Shared types belong in @cdc/core**: Any type used by 2+ packages should be centralized
100
+ - **Use extends for true IS-A relationships**: E.g., ChartConfig extends BaseConfig when chart config truly is a specialized base config
101
+ - **Use intersection types (&) for combining concerns**: E.g., type Props = BaseProps & ThemeProps & DataProps
102
+ - **Avoid premature abstraction**: Don't consolidate types that just happen to look similar today but serve different purposes
103
+ - **Preserve type safety**: Never sacrifice type precision for consolidation
104
+ - **Document design decisions**: Explain non-obvious type relationships with JSDoc comments
105
+
106
+ ## Quality Checks
107
+
108
+ Before finalizing recommendations:
109
+ - Verify no circular dependencies are introduced
110
+ - Confirm all consolidated types are properly exported from @cdc/core
111
+ - Ensure package.json dependencies are correctly updated
112
+ - Check that generics are constrained appropriately
113
+ - Validate that React component prop types maintain proper variance
114
+
115
+ When you encounter ambiguity or need more context about type usage, proactively ask specific questions about:
116
+ - The intended relationship between similar types
117
+ - Future evolution plans for type structures
118
+ - Performance or bundle size concerns with type organization
@@ -1,4 +1,4 @@
1
- const o = "Topology", e = [
1
+ const o = [
2
2
  [
3
3
  [
4
4
  381613,
@@ -359835,7 +359835,7 @@ const o = "Topology", e = [
359835
359835
  4
359836
359836
  ]
359837
359837
  ]
359838
- ], r = {
359838
+ ], e = {
359839
359839
  scale: [
359840
359840
  19541440750834335e-20,
359841
359841
  13610231396060925e-20
@@ -359844,7 +359844,7 @@ const o = "Topology", e = [
359844
359844
  -135.94188728451547,
359845
359845
  24.236087
359846
359846
  ]
359847
- }, s = {
359847
+ }, r = {
359848
359848
  regions: {
359849
359849
  type: "GeometryCollection",
359850
359850
  geometries: [
@@ -361520,16 +361520,9 @@ const o = "Topology", e = [
361520
361520
  }
361521
361521
  ]
361522
361522
  }
361523
- }, t = {
361524
- type: o,
361525
- arcs: e,
361526
- transform: r,
361527
- objects: s
361528
361523
  };
361529
361524
  export {
361530
- e as arcs,
361531
- t as default,
361532
- s as objects,
361533
- r as transform,
361534
- o as type
361525
+ o as arcs,
361526
+ r as objects,
361527
+ e as transform
361535
361528
  };
@@ -1,4 +1,4 @@
1
- const o = "Topology", s = [
1
+ const o = [
2
2
  [
3
3
  [
4
4
  19832,
@@ -37842,7 +37842,7 @@ const o = "Topology", s = [
37842
37842
  -178.19451843993753,
37843
37843
  18.963909185849403
37844
37844
  ]
37845
- }, r = {
37845
+ }, s = {
37846
37846
  states: {
37847
37847
  type: "GeometryCollection",
37848
37848
  geometries: [
@@ -39369,16 +39369,9 @@ const o = "Topology", s = [
39369
39369
  }
39370
39370
  ]
39371
39371
  }
39372
- }, p = {
39373
- type: o,
39374
- arcs: s,
39375
- transform: e,
39376
- objects: r
39377
39372
  };
39378
39373
  export {
39379
- s as arcs,
39380
- p as default,
39381
- r as objects,
39382
- e as transform,
39383
- o as type
39374
+ o as arcs,
39375
+ s as objects,
39376
+ e as transform
39384
39377
  };
@@ -1,4 +1,4 @@
1
- const e = "Topology", a = [
1
+ const e = [
2
2
  [
3
3
  [
4
4
  819,
@@ -34591,7 +34591,7 @@ const e = "Topology", a = [
34591
34591
  -75
34592
34592
  ]
34593
34593
  ]
34594
- ], p = {
34594
+ ], a = {
34595
34595
  scale: [
34596
34596
  0.013996889580093316,
34597
34597
  0.00821422737479012
@@ -34600,7 +34600,7 @@ const e = "Topology", a = [
34600
34600
  -179.99999999990004,
34601
34601
  -84.71367427324907
34602
34602
  ]
34603
- }, t = {
34603
+ }, p = {
34604
34604
  countries: {
34605
34605
  type: "GeometryCollection",
34606
34606
  geometries: [
@@ -39186,16 +39186,9 @@ const e = "Topology", a = [
39186
39186
  }
39187
39187
  ]
39188
39188
  }
39189
- }, s = {
39190
- type: e,
39191
- arcs: a,
39192
- transform: p,
39193
- objects: t
39194
39189
  };
39195
39190
  export {
39196
- a as arcs,
39197
- s as default,
39198
- t as objects,
39199
- p as transform,
39200
- e as type
39191
+ e as arcs,
39192
+ p as objects,
39193
+ a as transform
39201
39194
  };