tempest-react-sdk 0.18.0 → 0.19.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.
- package/bin/tempest.mjs +445 -35
- package/dist/AC-Brw7ZrEs.cjs +2 -0
- package/dist/AC-Brw7ZrEs.cjs.map +1 -0
- package/dist/AC-DLl3Z4oj.js +12 -0
- package/dist/AC-DLl3Z4oj.js.map +1 -0
- package/dist/AL-DPGoZjht.cjs +2 -0
- package/dist/AL-DPGoZjht.cjs.map +1 -0
- package/dist/AL-gswGaWlj.js +12 -0
- package/dist/AL-gswGaWlj.js.map +1 -0
- package/dist/AM-QN1eL4Tn.js +12 -0
- package/dist/AM-QN1eL4Tn.js.map +1 -0
- package/dist/AM-VqNWvsI-.cjs +2 -0
- package/dist/AM-VqNWvsI-.cjs.map +1 -0
- package/dist/AP-CPvBa_FK.cjs +2 -0
- package/dist/AP-CPvBa_FK.cjs.map +1 -0
- package/dist/AP-CRAbh1js.js +12 -0
- package/dist/AP-CRAbh1js.js.map +1 -0
- package/dist/BA-CKy_HnnV.js +12 -0
- package/dist/BA-CKy_HnnV.js.map +1 -0
- package/dist/BA-DoMQ6slK.cjs +2 -0
- package/dist/BA-DoMQ6slK.cjs.map +1 -0
- package/dist/CE-Ca-XMDFW.js +12 -0
- package/dist/CE-Ca-XMDFW.js.map +1 -0
- package/dist/CE-as-pGPQa.cjs +2 -0
- package/dist/CE-as-pGPQa.cjs.map +1 -0
- package/dist/DF-8kzFoovF.js +12 -0
- package/dist/DF-8kzFoovF.js.map +1 -0
- package/dist/DF-Wr8WNxSX.cjs +2 -0
- package/dist/DF-Wr8WNxSX.cjs.map +1 -0
- package/dist/ES-B4uWNG6s.js +12 -0
- package/dist/ES-B4uWNG6s.js.map +1 -0
- package/dist/ES-wKVjD_TM.cjs +2 -0
- package/dist/ES-wKVjD_TM.cjs.map +1 -0
- package/dist/GO-D4m4rOqy.cjs +2 -0
- package/dist/GO-D4m4rOqy.cjs.map +1 -0
- package/dist/GO-DuaAgIfo.js +12 -0
- package/dist/GO-DuaAgIfo.js.map +1 -0
- package/dist/MA-BmaUZZKe.cjs +2 -0
- package/dist/MA-BmaUZZKe.cjs.map +1 -0
- package/dist/MA-wOyPxG_M.js +12 -0
- package/dist/MA-wOyPxG_M.js.map +1 -0
- package/dist/MG-BYsqJd-S.js +12 -0
- package/dist/MG-BYsqJd-S.js.map +1 -0
- package/dist/MG-BchdfJXp.cjs +2 -0
- package/dist/MG-BchdfJXp.cjs.map +1 -0
- package/dist/MS-DZkgtN_7.js +12 -0
- package/dist/MS-DZkgtN_7.js.map +1 -0
- package/dist/MS-Dz9lDw37.cjs +2 -0
- package/dist/MS-Dz9lDw37.cjs.map +1 -0
- package/dist/MT-BkVchoah.cjs +2 -0
- package/dist/MT-BkVchoah.cjs.map +1 -0
- package/dist/MT-GmMwFWw2.js +12 -0
- package/dist/MT-GmMwFWw2.js.map +1 -0
- package/dist/PA-C2FpT6Ew.cjs +2 -0
- package/dist/PA-C2FpT6Ew.cjs.map +1 -0
- package/dist/PA-DgyDzDFi.js +12 -0
- package/dist/PA-DgyDzDFi.js.map +1 -0
- package/dist/PB-BGkzbQup.cjs +2 -0
- package/dist/PB-BGkzbQup.cjs.map +1 -0
- package/dist/PB-D-6NE6KM.js +12 -0
- package/dist/PB-D-6NE6KM.js.map +1 -0
- package/dist/PE-D8V7gWY-.cjs +2 -0
- package/dist/PE-D8V7gWY-.cjs.map +1 -0
- package/dist/PE-vqm-t7Nh.js +12 -0
- package/dist/PE-vqm-t7Nh.js.map +1 -0
- package/dist/PI-CILuGJlW.js +12 -0
- package/dist/PI-CILuGJlW.js.map +1 -0
- package/dist/PI-dJYCbXQM.cjs +2 -0
- package/dist/PI-dJYCbXQM.cjs.map +1 -0
- package/dist/PR-DN8AV__r.js +12 -0
- package/dist/PR-DN8AV__r.js.map +1 -0
- package/dist/PR-P17oBdNH.cjs +2 -0
- package/dist/PR-P17oBdNH.cjs.map +1 -0
- package/dist/RJ-Bccz05Em.js +12 -0
- package/dist/RJ-Bccz05Em.js.map +1 -0
- package/dist/RJ-Budqx7QP.cjs +2 -0
- package/dist/RJ-Budqx7QP.cjs.map +1 -0
- package/dist/RN-DLcJBxo3.cjs +2 -0
- package/dist/RN-DLcJBxo3.cjs.map +1 -0
- package/dist/RN-DTqFP-Nm.js +12 -0
- package/dist/RN-DTqFP-Nm.js.map +1 -0
- package/dist/RO-BCC54UTU.js +12 -0
- package/dist/RO-BCC54UTU.js.map +1 -0
- package/dist/RO-B_IDyci4.cjs +2 -0
- package/dist/RO-B_IDyci4.cjs.map +1 -0
- package/dist/RR-CDGUEyla.cjs +2 -0
- package/dist/RR-CDGUEyla.cjs.map +1 -0
- package/dist/RR-OCnI_XpU.js +12 -0
- package/dist/RR-OCnI_XpU.js.map +1 -0
- package/dist/RS-DiBeY_u5.cjs +2 -0
- package/dist/RS-DiBeY_u5.cjs.map +1 -0
- package/dist/RS-Dy7gBbbH.js +12 -0
- package/dist/RS-Dy7gBbbH.js.map +1 -0
- package/dist/SC-CEMoj8g2.cjs +2 -0
- package/dist/SC-CEMoj8g2.cjs.map +1 -0
- package/dist/SC-trCqQDXz.js +12 -0
- package/dist/SC-trCqQDXz.js.map +1 -0
- package/dist/SE-DAfFbZcK.cjs +2 -0
- package/dist/SE-DAfFbZcK.cjs.map +1 -0
- package/dist/SE-DBdfSrGk.js +12 -0
- package/dist/SE-DBdfSrGk.js.map +1 -0
- package/dist/SP-Cse4d68i.cjs +2 -0
- package/dist/SP-Cse4d68i.cjs.map +1 -0
- package/dist/SP-qPZjJDOT.js +12 -0
- package/dist/SP-qPZjJDOT.js.map +1 -0
- package/dist/TO-CZtMDVug.js +12 -0
- package/dist/TO-CZtMDVug.js.map +1 -0
- package/dist/TO-Dwi5zIyF.cjs +2 -0
- package/dist/TO-Dwi5zIyF.cjs.map +1 -0
- package/dist/br-centroids--O7-1KXz.cjs +2 -0
- package/dist/br-centroids--O7-1KXz.cjs.map +1 -0
- package/dist/br-centroids-IHN7PIzD.js +10 -0
- package/dist/br-centroids-IHN7PIzD.js.map +1 -0
- package/dist/br-geo-BYynYOwK.cjs +2 -0
- package/dist/br-geo-BYynYOwK.cjs.map +1 -0
- package/dist/br-geo-DFRuvjuU.js +8 -0
- package/dist/br-geo-DFRuvjuU.js.map +1 -0
- package/dist/br.cjs +1 -1
- package/dist/br.cjs.map +1 -1
- package/dist/br.d.ts +334 -6
- package/dist/br.js +769 -368
- package/dist/br.js.map +1 -1
- package/dist/projection-CILVBdpd.cjs +2 -0
- package/dist/projection-CILVBdpd.cjs.map +1 -0
- package/dist/projection-Wnqr_svy.js +215 -0
- package/dist/projection-Wnqr_svy.js.map +1 -0
- package/dist/styles.css +1 -1
- package/dist/tempest-react-sdk.cjs +3 -3
- package/dist/tempest-react-sdk.cjs.map +1 -1
- package/dist/tempest-react-sdk.d.ts +21 -1
- package/dist/tempest-react-sdk.js +2735 -2792
- package/dist/tempest-react-sdk.js.map +1 -1
- package/package.json +2 -1
- package/dist/AC-BQUmmKrw.cjs +0 -2
- package/dist/AC-BQUmmKrw.cjs.map +0 -1
- package/dist/AC-DOvYXax1.js +0 -12
- package/dist/AC-DOvYXax1.js.map +0 -1
- package/dist/AL-DH1wKIxj.js +0 -12
- package/dist/AL-DH1wKIxj.js.map +0 -1
- package/dist/AL-oN2X02DP.cjs +0 -2
- package/dist/AL-oN2X02DP.cjs.map +0 -1
- package/dist/AM-Cn_JOc_u.cjs +0 -2
- package/dist/AM-Cn_JOc_u.cjs.map +0 -1
- package/dist/AM-D-l4ioxq.js +0 -12
- package/dist/AM-D-l4ioxq.js.map +0 -1
- package/dist/AP-B8H3590m.cjs +0 -2
- package/dist/AP-B8H3590m.cjs.map +0 -1
- package/dist/AP-pl_IXUrz.js +0 -12
- package/dist/AP-pl_IXUrz.js.map +0 -1
- package/dist/BA-DsPuESbp.cjs +0 -2
- package/dist/BA-DsPuESbp.cjs.map +0 -1
- package/dist/BA-HvFNaSvC.js +0 -12
- package/dist/BA-HvFNaSvC.js.map +0 -1
- package/dist/CE-BhzlM8v8.cjs +0 -2
- package/dist/CE-BhzlM8v8.cjs.map +0 -1
- package/dist/CE-C4VCDB2_.js +0 -12
- package/dist/CE-C4VCDB2_.js.map +0 -1
- package/dist/DF-CdR_I7qu.cjs +0 -2
- package/dist/DF-CdR_I7qu.cjs.map +0 -1
- package/dist/DF-DCepvNQG.js +0 -12
- package/dist/DF-DCepvNQG.js.map +0 -1
- package/dist/ES-BNECOgN8.js +0 -12
- package/dist/ES-BNECOgN8.js.map +0 -1
- package/dist/ES-CzZdWdcw.cjs +0 -2
- package/dist/ES-CzZdWdcw.cjs.map +0 -1
- package/dist/GO-CTgkFwbh.js +0 -12
- package/dist/GO-CTgkFwbh.js.map +0 -1
- package/dist/GO-VqQUIkMG.cjs +0 -2
- package/dist/GO-VqQUIkMG.cjs.map +0 -1
- package/dist/MA-CwpNlEs4.cjs +0 -2
- package/dist/MA-CwpNlEs4.cjs.map +0 -1
- package/dist/MA-DC3zmbpX.js +0 -12
- package/dist/MA-DC3zmbpX.js.map +0 -1
- package/dist/MG-DLTyPn6U.js +0 -12
- package/dist/MG-DLTyPn6U.js.map +0 -1
- package/dist/MG-P3ePmTdM.cjs +0 -2
- package/dist/MG-P3ePmTdM.cjs.map +0 -1
- package/dist/MS-Crc916be.js +0 -12
- package/dist/MS-Crc916be.js.map +0 -1
- package/dist/MS-MikLSXO-.cjs +0 -2
- package/dist/MS-MikLSXO-.cjs.map +0 -1
- package/dist/MT-BzUTgqTr.cjs +0 -2
- package/dist/MT-BzUTgqTr.cjs.map +0 -1
- package/dist/MT-DEqs4lmz.js +0 -12
- package/dist/MT-DEqs4lmz.js.map +0 -1
- package/dist/PA-BmFg98qS.cjs +0 -2
- package/dist/PA-BmFg98qS.cjs.map +0 -1
- package/dist/PA-DCJkLLiT.js +0 -12
- package/dist/PA-DCJkLLiT.js.map +0 -1
- package/dist/PB-_6qWqUQe.js +0 -12
- package/dist/PB-_6qWqUQe.js.map +0 -1
- package/dist/PB-cCwnP4jh.cjs +0 -2
- package/dist/PB-cCwnP4jh.cjs.map +0 -1
- package/dist/PE-BCeDGzmC.cjs +0 -2
- package/dist/PE-BCeDGzmC.cjs.map +0 -1
- package/dist/PE-DhAJD50w.js +0 -12
- package/dist/PE-DhAJD50w.js.map +0 -1
- package/dist/PI-8mJVmMWn.cjs +0 -2
- package/dist/PI-8mJVmMWn.cjs.map +0 -1
- package/dist/PI-BBpuVgnF.js +0 -12
- package/dist/PI-BBpuVgnF.js.map +0 -1
- package/dist/PR-Ck8PsNQr.cjs +0 -2
- package/dist/PR-Ck8PsNQr.cjs.map +0 -1
- package/dist/PR-DIU_pEzX.js +0 -12
- package/dist/PR-DIU_pEzX.js.map +0 -1
- package/dist/RJ-BM_31L8v.js +0 -12
- package/dist/RJ-BM_31L8v.js.map +0 -1
- package/dist/RJ-RO2nzm45.cjs +0 -2
- package/dist/RJ-RO2nzm45.cjs.map +0 -1
- package/dist/RN-CGDsj5y7.cjs +0 -2
- package/dist/RN-CGDsj5y7.cjs.map +0 -1
- package/dist/RN-Cb6kQMBf.js +0 -12
- package/dist/RN-Cb6kQMBf.js.map +0 -1
- package/dist/RO-DQlMmLkh.js +0 -12
- package/dist/RO-DQlMmLkh.js.map +0 -1
- package/dist/RO-bBzN2q3e.cjs +0 -2
- package/dist/RO-bBzN2q3e.cjs.map +0 -1
- package/dist/RR-27xmMYjp.cjs +0 -2
- package/dist/RR-27xmMYjp.cjs.map +0 -1
- package/dist/RR-DT5Iz7pA.js +0 -12
- package/dist/RR-DT5Iz7pA.js.map +0 -1
- package/dist/RS-Ax08xnx2.cjs +0 -2
- package/dist/RS-Ax08xnx2.cjs.map +0 -1
- package/dist/RS-Be6-eibq.js +0 -12
- package/dist/RS-Be6-eibq.js.map +0 -1
- package/dist/SC-CR4B6n9K.js +0 -12
- package/dist/SC-CR4B6n9K.js.map +0 -1
- package/dist/SC-D7CvUmBl.cjs +0 -2
- package/dist/SC-D7CvUmBl.cjs.map +0 -1
- package/dist/SE-DYnzRCQV.js +0 -12
- package/dist/SE-DYnzRCQV.js.map +0 -1
- package/dist/SE-fXsuEuvK.cjs +0 -2
- package/dist/SE-fXsuEuvK.cjs.map +0 -1
- package/dist/SP-Cks7QGPk.cjs +0 -2
- package/dist/SP-Cks7QGPk.cjs.map +0 -1
- package/dist/SP-D7R54yvO.js +0 -12
- package/dist/SP-D7R54yvO.js.map +0 -1
- package/dist/TO-CWXJNpx2.js +0 -12
- package/dist/TO-CWXJNpx2.js.map +0 -1
- package/dist/TO-DyvJcNhT.cjs +0 -2
- package/dist/TO-DyvJcNhT.cjs.map +0 -1
- package/dist/br-geo-Q_VQpVMX.js +0 -8
- package/dist/br-geo-Q_VQpVMX.js.map +0 -1
- package/dist/br-geo-rADqOFQL.cjs +0 -2
- package/dist/br-geo-rADqOFQL.cjs.map +0 -1
- package/dist/projection-C2VXUKZJ.js +0 -124
- package/dist/projection-C2VXUKZJ.js.map +0 -1
- package/dist/projection-CkMNK7HA.cjs +0 -2
- package/dist/projection-CkMNK7HA.cjs.map +0 -1
package/dist/br.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ import { ReactNode } from 'react';
|
|
|
20
20
|
* // Choropleth by a metric per state
|
|
21
21
|
* <BrazilMap values={{ SP: 120, RJ: 90, MG: 60 }} />
|
|
22
22
|
*/
|
|
23
|
-
export declare function BrazilMap({ selected, onSelect, values, minColor, maxColor, height, padding, showLabels, label, loadingContent, showTooltip, renderTooltip, className, style, ...rest }: BrazilMapProps): JSX.Element;
|
|
23
|
+
export declare function BrazilMap({ selected, onSelect, values, minColor, maxColor, colorScale, colorByRegion, height, padding, showLabels, label, loadingContent, showTooltip, renderTooltip, markers, onMarkerClick, zoomable, className, style, ...rest }: BrazilMapProps): JSX.Element;
|
|
24
24
|
|
|
25
25
|
export declare interface BrazilMapProps extends Omit<HTMLAttributes<HTMLDivElement>, "onSelect"> {
|
|
26
26
|
/** Currently selected UF(s) — highlighted. Accepts one or many. */
|
|
@@ -33,10 +33,20 @@ export declare interface BrazilMapProps extends Omit<HTMLAttributes<HTMLDivEleme
|
|
|
33
33
|
* use the base surface color.
|
|
34
34
|
*/
|
|
35
35
|
values?: Partial<Record<UF, number>>;
|
|
36
|
-
/** Choropleth low-end color. Default: a light primary tint. */
|
|
36
|
+
/** Choropleth low-end color (2-color linear ramp). Default: a light primary tint. */
|
|
37
37
|
minColor?: string;
|
|
38
|
-
/** Choropleth high-end color. Default: the primary token. */
|
|
38
|
+
/** Choropleth high-end color (2-color linear ramp). Default: the primary token. */
|
|
39
39
|
maxColor?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Custom value→color scale (e.g. from `sequentialScale`/`quantizeScale`).
|
|
42
|
+
* Takes precedence over `minColor`/`maxColor`. Pair with a `<MapLegend>`.
|
|
43
|
+
*/
|
|
44
|
+
colorScale?: ColorScale;
|
|
45
|
+
/**
|
|
46
|
+
* Tint each state by its macro-region (categorical). Overrides
|
|
47
|
+
* `values`/`colorScale`. Pair with `<MapLegend items={regionLegendItems()} />`.
|
|
48
|
+
*/
|
|
49
|
+
colorByRegion?: boolean;
|
|
40
50
|
/** Viewport height in pixels. Default: `440`. */
|
|
41
51
|
height?: number;
|
|
42
52
|
/** Inner padding in pixels. Default: `12`. */
|
|
@@ -51,6 +61,12 @@ export declare interface BrazilMapProps extends Omit<HTMLAttributes<HTMLDivEleme
|
|
|
51
61
|
showTooltip?: boolean;
|
|
52
62
|
/** Override the default tooltip content. */
|
|
53
63
|
renderTooltip?: (data: BrazilMapTooltipData) => ReactNode;
|
|
64
|
+
/** Point markers to overlay on the map (e.g. capitals, stores). */
|
|
65
|
+
markers?: readonly GeoMarker[];
|
|
66
|
+
/** Fired when a marker is clicked. */
|
|
67
|
+
onMarkerClick?: (marker: GeoMarker, index: number) => void;
|
|
68
|
+
/** Enable wheel-zoom + drag-pan (double-click resets). Default: `false`. */
|
|
69
|
+
zoomable?: boolean;
|
|
54
70
|
}
|
|
55
71
|
|
|
56
72
|
/** Data passed to a {@link BrazilMapProps.renderTooltip} callback. */
|
|
@@ -127,7 +143,7 @@ export declare interface BrazilStateCitySelectProps {
|
|
|
127
143
|
* // Choropleth of a metric by municipality name
|
|
128
144
|
* <BrazilStateMap uf="RJ" values={{ "Rio de Janeiro": 100, Niterói: 40 }} />
|
|
129
145
|
*/
|
|
130
|
-
export declare function BrazilStateMap({ uf, selected, onSelect, values, minColor, maxColor, height, padding, showLabels, label, loadingContent, showTooltip, renderTooltip, className, style, ...rest }: BrazilStateMapProps): JSX.Element;
|
|
146
|
+
export declare function BrazilStateMap({ uf, selected, onSelect, values, minColor, maxColor, colorScale, height, padding, showLabels, label, loadingContent, showTooltip, renderTooltip, markers, onMarkerClick, zoomable, className, style, ...rest }: BrazilStateMapProps): JSX.Element;
|
|
131
147
|
|
|
132
148
|
export declare interface BrazilStateMapProps extends Omit<HTMLAttributes<HTMLDivElement>, "onSelect"> {
|
|
133
149
|
/** Federative unit to draw (required). */
|
|
@@ -141,10 +157,15 @@ export declare interface BrazilStateMapProps extends Omit<HTMLAttributes<HTMLDiv
|
|
|
141
157
|
* municipality is tinted between `minColor` and `maxColor`.
|
|
142
158
|
*/
|
|
143
159
|
values?: Record<string, number>;
|
|
144
|
-
/** Choropleth low-end color. Default: a light primary tint. */
|
|
160
|
+
/** Choropleth low-end color (2-color linear ramp). Default: a light primary tint. */
|
|
145
161
|
minColor?: string;
|
|
146
|
-
/** Choropleth high-end color. Default: the primary token. */
|
|
162
|
+
/** Choropleth high-end color (2-color linear ramp). Default: the primary token. */
|
|
147
163
|
maxColor?: string;
|
|
164
|
+
/**
|
|
165
|
+
* Custom value→color scale (from `sequentialScale`/`quantizeScale`). Takes
|
|
166
|
+
* precedence over `minColor`/`maxColor`. Pair with a `<MapLegend>`.
|
|
167
|
+
*/
|
|
168
|
+
colorScale?: ColorScale;
|
|
148
169
|
/** Viewport height in pixels. Default: `440`. */
|
|
149
170
|
height?: number;
|
|
150
171
|
/** Inner padding in pixels. Default: `12`. */
|
|
@@ -162,6 +183,12 @@ export declare interface BrazilStateMapProps extends Omit<HTMLAttributes<HTMLDiv
|
|
|
162
183
|
showTooltip?: boolean;
|
|
163
184
|
/** Override the default tooltip content. */
|
|
164
185
|
renderTooltip?: (data: BrazilStateMapTooltipData) => ReactNode;
|
|
186
|
+
/** Point markers to overlay on the state (e.g. addresses, POIs). */
|
|
187
|
+
markers?: readonly GeoMarker[];
|
|
188
|
+
/** Fired when a marker is clicked. */
|
|
189
|
+
onMarkerClick?: (marker: GeoMarker, index: number) => void;
|
|
190
|
+
/** Enable wheel-zoom + drag-pan (double-click resets). Default: `false`. */
|
|
191
|
+
zoomable?: boolean;
|
|
165
192
|
}
|
|
166
193
|
|
|
167
194
|
/** Data passed to a {@link BrazilStateMapProps.renderTooltip} callback. */
|
|
@@ -180,6 +207,8 @@ export declare interface BrUfFeature {
|
|
|
180
207
|
uf: UF;
|
|
181
208
|
name: string;
|
|
182
209
|
region: BrRegion;
|
|
210
|
+
/** Representative point `[longitude, latitude]` (area-weighted centroid). */
|
|
211
|
+
centroid: [number, number];
|
|
183
212
|
};
|
|
184
213
|
geometry: BrUfGeometry;
|
|
185
214
|
}
|
|
@@ -212,15 +241,84 @@ export declare function citiesByUf(uf: string): string[];
|
|
|
212
241
|
/** `{ value, label }` options for every city in a UF (value === label). */
|
|
213
242
|
export declare function cityChoices(uf: string): Choice[];
|
|
214
243
|
|
|
244
|
+
/** Maps a numeric value to a CSS color string. */
|
|
245
|
+
export declare type ColorScale = (value: number) => string;
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* WGS84 geographic coordinate. Mirrors the `Coordinate` schema from
|
|
249
|
+
* `tempest-fastapi-sdk` (`geo/schemas.py`) — `latitude` in `[-90, 90]`,
|
|
250
|
+
* `longitude` in `[-180, 180]`, serialized snake_case on the wire.
|
|
251
|
+
*/
|
|
252
|
+
declare interface Coordinate {
|
|
253
|
+
/** WGS84 latitude in degrees, `[-90, 90]`. E.g. `-23.5505`. */
|
|
254
|
+
latitude: number;
|
|
255
|
+
/** WGS84 longitude in degrees, `[-180, 180]`. E.g. `-46.6333`. */
|
|
256
|
+
longitude: number;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/** Diverging palette (red ↔ neutral ↔ blue), for signed metrics. */
|
|
260
|
+
export declare const DIVERGING_RDBU: readonly ["#b2182b", "#ef8a62", "#fddbc7", "#d1e5f0", "#67a9cf", "#2166ac"];
|
|
261
|
+
|
|
262
|
+
/** A ready-to-use mapping from coordinates to viewport pixels. */
|
|
263
|
+
declare interface FittedProjection {
|
|
264
|
+
/** Project a coordinate to a pixel inside the viewport. */
|
|
265
|
+
project: (coord: Coordinate) => PixelPoint;
|
|
266
|
+
/** Uniform scale (unit-plane → pixels) actually used, after aspect fit. */
|
|
267
|
+
scale: number;
|
|
268
|
+
/** Viewport width in pixels. */
|
|
269
|
+
width: number;
|
|
270
|
+
/** Viewport height in pixels. */
|
|
271
|
+
height: number;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* Forward-geocode a municipality by name (accent-insensitive), optionally scoped
|
|
276
|
+
* to a UF. Returns every exact-name match — the same name can occur in several
|
|
277
|
+
* states (e.g. "Bonito").
|
|
278
|
+
*
|
|
279
|
+
* @param name - Municipality name.
|
|
280
|
+
* @param uf - Optional UF to restrict the search.
|
|
281
|
+
* @returns Matching municipalities (empty array when none match).
|
|
282
|
+
*/
|
|
283
|
+
export declare function geocodeMunicipality(name: string, uf?: UF): Promise<MunicipalityCentroid[]>;
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* A pin plotted on a map: a {@link Coordinate} plus optional presentation and
|
|
287
|
+
* an identity used for click callbacks. Shared by `TrajectoryMap` and the
|
|
288
|
+
* Brazil maps' `markers` prop.
|
|
289
|
+
*/
|
|
290
|
+
export declare interface GeoMarker extends Coordinate {
|
|
291
|
+
/** Stable identity (returned by click handlers). Falls back to the index. */
|
|
292
|
+
id?: string;
|
|
293
|
+
/** Tooltip / accessible label for the pin. */
|
|
294
|
+
label?: string;
|
|
295
|
+
/** Fill color. Defaults to the primary token. */
|
|
296
|
+
color?: string;
|
|
297
|
+
/** Radius in pixels. Default: 6. */
|
|
298
|
+
radius?: number;
|
|
299
|
+
}
|
|
300
|
+
|
|
215
301
|
/** Look up a single state by acronym (case-insensitive). Returns `null` if unknown. */
|
|
216
302
|
export declare function getState(uf: string): BrazilState | null;
|
|
217
303
|
|
|
304
|
+
/**
|
|
305
|
+
* Interpolate a palette at `t ∈ [0, 1]`, blending between the two nearest
|
|
306
|
+
* stops. `t <= 0` → first color, `t >= 1` → last.
|
|
307
|
+
*/
|
|
308
|
+
export declare function interpolatePalette(palette: readonly string[], t: number): string;
|
|
309
|
+
|
|
218
310
|
/** True when `city` exists within `uf` (both case-insensitive). */
|
|
219
311
|
export declare function isValidCity(uf: string, city: string): boolean;
|
|
220
312
|
|
|
221
313
|
/** True when `value` is one of the 27 valid acronyms (case-insensitive). */
|
|
222
314
|
export declare function isValidUf(value: string): boolean;
|
|
223
315
|
|
|
316
|
+
/** A discrete legend entry. */
|
|
317
|
+
export declare interface LegendItem {
|
|
318
|
+
color: string;
|
|
319
|
+
label: ReactNode;
|
|
320
|
+
}
|
|
321
|
+
|
|
224
322
|
/** All 27 federative units, sorted by name. */
|
|
225
323
|
export declare function listStates(): readonly BrazilState[];
|
|
226
324
|
|
|
@@ -244,6 +342,62 @@ export declare function loadBrUfGeoJson(): Promise<BrUfFeatureCollection>;
|
|
|
244
342
|
*/
|
|
245
343
|
export declare function loadStateMunicipalities(uf: UF): Promise<StateMunicipalities | null>;
|
|
246
344
|
|
|
345
|
+
/**
|
|
346
|
+
* Legend for a choropleth map. Renders a **continuous gradient** (with
|
|
347
|
+
* min/mid/max ticks) from `min`/`max`/`palette`, or **discrete swatches** when
|
|
348
|
+
* `items` is given. Pair it with a `BrazilMap`/`BrazilStateMap` `colorScale`.
|
|
349
|
+
*
|
|
350
|
+
* @example
|
|
351
|
+
* // Continuous, matching a sequentialScale(0, 100)
|
|
352
|
+
* <MapLegend title="Vendas" min={0} max={100} palette={SEQUENTIAL_BLUES} />
|
|
353
|
+
*
|
|
354
|
+
* @example
|
|
355
|
+
* // Discrete buckets
|
|
356
|
+
* <MapLegend
|
|
357
|
+
* title="Faixa"
|
|
358
|
+
* items={[
|
|
359
|
+
* { color: "#c6dbef", label: "< 10" },
|
|
360
|
+
* { color: "#6baed6", label: "10–50" },
|
|
361
|
+
* { color: "#08519c", label: "> 50" },
|
|
362
|
+
* ]}
|
|
363
|
+
* />
|
|
364
|
+
*/
|
|
365
|
+
export declare function MapLegend({ title, items, min, max, palette, format, className, ...rest }: MapLegendProps): JSX.Element;
|
|
366
|
+
|
|
367
|
+
export declare interface MapLegendProps extends Omit<HTMLAttributes<HTMLDivElement>, "title"> {
|
|
368
|
+
/** Legend heading. */
|
|
369
|
+
title?: ReactNode;
|
|
370
|
+
/**
|
|
371
|
+
* Discrete entries (swatch + label). When provided the legend renders in
|
|
372
|
+
* "steps" mode; otherwise it renders a continuous gradient from `min`/`max`.
|
|
373
|
+
*/
|
|
374
|
+
items?: readonly LegendItem[];
|
|
375
|
+
/** Continuous mode: low end of the domain. */
|
|
376
|
+
min?: number;
|
|
377
|
+
/** Continuous mode: high end of the domain. */
|
|
378
|
+
max?: number;
|
|
379
|
+
/** Continuous mode: palette (light → dark). Default: sequential blues. */
|
|
380
|
+
palette?: readonly string[];
|
|
381
|
+
/** Continuous mode: format the min/mid/max tick labels. */
|
|
382
|
+
format?: (value: number) => string;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
/**
|
|
386
|
+
* SVG overlay of point markers, projected with the host map's projection so
|
|
387
|
+
* they align with its shapes. Each marker carries a native `<title>` (its
|
|
388
|
+
* `label`) and is clickable when `onMarkerClick` is set.
|
|
389
|
+
*/
|
|
390
|
+
export declare function MapMarkers({ projection, markers, onMarkerClick }: MapMarkersProps): JSX.Element;
|
|
391
|
+
|
|
392
|
+
export declare interface MapMarkersProps {
|
|
393
|
+
/** Projection used by the host map (markers must share it to line up). */
|
|
394
|
+
projection: FittedProjection;
|
|
395
|
+
/** Pins to plot. */
|
|
396
|
+
markers: readonly GeoMarker[];
|
|
397
|
+
/** Fired when a marker is clicked. */
|
|
398
|
+
onMarkerClick?: (marker: GeoMarker, index: number) => void;
|
|
399
|
+
}
|
|
400
|
+
|
|
247
401
|
/** A municipality identified for selection callbacks. */
|
|
248
402
|
export declare interface Municipality {
|
|
249
403
|
/** 7-digit IBGE code. */
|
|
@@ -252,6 +406,26 @@ export declare interface Municipality {
|
|
|
252
406
|
name: string;
|
|
253
407
|
}
|
|
254
408
|
|
|
409
|
+
/** A municipality with its representative coordinate (IBGE centroid). */
|
|
410
|
+
export declare interface MunicipalityCentroid {
|
|
411
|
+
/** 7-digit IBGE code. */
|
|
412
|
+
id: string;
|
|
413
|
+
/** Municipality name. */
|
|
414
|
+
name: string;
|
|
415
|
+
/** Federative unit. */
|
|
416
|
+
uf: UF;
|
|
417
|
+
latitude: number;
|
|
418
|
+
longitude: number;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
/**
|
|
422
|
+
* Centroid of a municipality by IBGE code.
|
|
423
|
+
*
|
|
424
|
+
* @param id - 7-digit IBGE code.
|
|
425
|
+
* @returns The municipality centroid, or `null` if unknown.
|
|
426
|
+
*/
|
|
427
|
+
export declare function municipalityCentroid(id: string): Promise<MunicipalityCentroid | null>;
|
|
428
|
+
|
|
255
429
|
/** One municipality feature within a state. */
|
|
256
430
|
export declare interface MunicipalityFeature {
|
|
257
431
|
type: "Feature";
|
|
@@ -260,19 +434,163 @@ export declare interface MunicipalityFeature {
|
|
|
260
434
|
id: string;
|
|
261
435
|
/** Municipality name. */
|
|
262
436
|
name: string;
|
|
437
|
+
/** Representative point `[longitude, latitude]` (area-weighted centroid). */
|
|
438
|
+
centroid: [number, number];
|
|
263
439
|
};
|
|
264
440
|
geometry: BrUfGeometry;
|
|
265
441
|
}
|
|
266
442
|
|
|
443
|
+
/**
|
|
444
|
+
* Debounced municipality autocomplete backed by the offline
|
|
445
|
+
* {@link searchMunicipalities} index — no network. Type a partial name, pick a
|
|
446
|
+
* result, and `onSelect` fires with its `{ id, name, uf, latitude, longitude }`.
|
|
447
|
+
* Wire `onSelect` to a `BrazilStateMap` `selected` to highlight it on the map.
|
|
448
|
+
*
|
|
449
|
+
* @example
|
|
450
|
+
* const [uf, setUf] = useState<UF>("SP");
|
|
451
|
+
* const [city, setCity] = useState<string | null>(null);
|
|
452
|
+
* <MunicipalitySearch uf={uf} onSelect={(m) => setCity(m.name)} />
|
|
453
|
+
* <BrazilStateMap uf={uf} selected={city} />
|
|
454
|
+
*/
|
|
455
|
+
export declare function MunicipalitySearch({ uf, onSelect, label, placeholder, limit, debounceMs, disabled, }: MunicipalitySearchProps): ReactElement;
|
|
456
|
+
|
|
457
|
+
export declare interface MunicipalitySearchProps {
|
|
458
|
+
/** Restrict the search to a single UF. */
|
|
459
|
+
uf?: UF;
|
|
460
|
+
/** Fired when a municipality is picked from the results. */
|
|
461
|
+
onSelect: (municipality: MunicipalityCentroid) => void;
|
|
462
|
+
/** Field label. */
|
|
463
|
+
label?: string;
|
|
464
|
+
/** Input placeholder. Default: `"Buscar município…"`. */
|
|
465
|
+
placeholder?: string;
|
|
466
|
+
/** Max results shown. Default: `8`. */
|
|
467
|
+
limit?: number;
|
|
468
|
+
/** Debounce in ms before searching. Default: `250`. */
|
|
469
|
+
debounceMs?: number;
|
|
470
|
+
/** Disable the field. */
|
|
471
|
+
disabled?: boolean;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
/** {@link MunicipalityCentroid} plus the distance from the query point. */
|
|
475
|
+
export declare interface NearestMunicipality extends MunicipalityCentroid {
|
|
476
|
+
/** Great-circle distance from the query coordinate, in kilometers. */
|
|
477
|
+
distanceKm: number;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
/**
|
|
481
|
+
* Nearest Brazilian municipality to a coordinate by **centroid distance** —
|
|
482
|
+
* fast and geometry-free (only the small centroid index loads). Approximate:
|
|
483
|
+
* near borders or inside large municipalities a neighbor's centroid can be
|
|
484
|
+
* closer. For an exact containing municipality use {@link reverseGeocode}.
|
|
485
|
+
*
|
|
486
|
+
* @param coord - Query coordinate.
|
|
487
|
+
* @returns The nearest municipality with `distanceKm`, or `null` if the index
|
|
488
|
+
* is somehow empty.
|
|
489
|
+
*
|
|
490
|
+
* @example
|
|
491
|
+
* const near = await nearestMunicipality({ latitude: -23.55, longitude: -46.63 });
|
|
492
|
+
* // { id, name, uf: "SP", …, distanceKm }
|
|
493
|
+
*/
|
|
494
|
+
export declare function nearestMunicipality(coord: Coordinate): Promise<NearestMunicipality | null>;
|
|
495
|
+
|
|
267
496
|
/**
|
|
268
497
|
* Normalize an acronym to canonical uppercase form, or `null` if it is not a
|
|
269
498
|
* valid UF. `"sp"` → `"SP"`, `"xx"` → `null`.
|
|
270
499
|
*/
|
|
271
500
|
export declare function normalizeUf(value: string): UF | null;
|
|
272
501
|
|
|
502
|
+
/** A pixel coordinate inside the plotting viewport. */
|
|
503
|
+
declare interface PixelPoint {
|
|
504
|
+
x: number;
|
|
505
|
+
y: number;
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
/**
|
|
509
|
+
* Discrete scale: split `[min, max]` into `palette.length` equal buckets and
|
|
510
|
+
* return the bucket's color (a classic choropleth "quantize" scale).
|
|
511
|
+
*/
|
|
512
|
+
export declare function quantizeScale(min: number, max: number, palette?: readonly string[]): ColorScale;
|
|
513
|
+
|
|
514
|
+
/**
|
|
515
|
+
* Categorical, distinguishable colors for the five IBGE macro-regions
|
|
516
|
+
* (Tableau-10 family). Swap for your brand palette if needed.
|
|
517
|
+
*/
|
|
518
|
+
export declare const REGION_COLORS: Record<BrRegion, string>;
|
|
519
|
+
|
|
520
|
+
/** Legend entries (swatch + region name) for a region-colored map. */
|
|
521
|
+
export declare function regionLegendItems(): LegendItem[];
|
|
522
|
+
|
|
523
|
+
/**
|
|
524
|
+
* Exact reverse-geocode: the municipality whose (simplified) boundary
|
|
525
|
+
* **contains** the coordinate, via point-in-polygon. Loads one state's geometry
|
|
526
|
+
* chunk — pass `uf` when you know it to skip the centroid lookup that picks the
|
|
527
|
+
* candidate state. Boundaries are simplified (~2 km), so points within ~1-2 km
|
|
528
|
+
* of a border may resolve to the neighbor; offshore points return `null`.
|
|
529
|
+
*
|
|
530
|
+
* @param coord - Query coordinate.
|
|
531
|
+
* @param options - `uf` to force the state searched.
|
|
532
|
+
* @returns The containing municipality, or `null` (falls back to the nearest
|
|
533
|
+
* centroid municipality when the point is inside no polygon of the state).
|
|
534
|
+
*
|
|
535
|
+
* @example
|
|
536
|
+
* const here = await reverseGeocode({ latitude: -23.5505, longitude: -46.6333 });
|
|
537
|
+
* // { id: "3550308", name: "São Paulo", uf: "SP" }
|
|
538
|
+
*/
|
|
539
|
+
export declare function reverseGeocode(coord: Coordinate, options?: {
|
|
540
|
+
uf?: UF;
|
|
541
|
+
}): Promise<ReverseGeocodeResult | null>;
|
|
542
|
+
|
|
543
|
+
/** A municipality identified by point-in-polygon (see {@link reverseGeocode}). */
|
|
544
|
+
export declare interface ReverseGeocodeResult {
|
|
545
|
+
id: string;
|
|
546
|
+
name: string;
|
|
547
|
+
uf: UF;
|
|
548
|
+
}
|
|
549
|
+
|
|
273
550
|
/** A ring of `[longitude, latitude]` pairs. */
|
|
274
551
|
export declare type Ring = [number, number][];
|
|
275
552
|
|
|
553
|
+
/**
|
|
554
|
+
* Substring search over municipality names (accent-insensitive), for
|
|
555
|
+
* autocomplete. Ranked prefix-first, then alphabetically.
|
|
556
|
+
*
|
|
557
|
+
* @param query - Partial name.
|
|
558
|
+
* @param options - `uf` to scope, `limit` (default 20).
|
|
559
|
+
* @returns Ranked matches.
|
|
560
|
+
*/
|
|
561
|
+
export declare function searchMunicipalities(query: string, options?: {
|
|
562
|
+
uf?: UF;
|
|
563
|
+
limit?: number;
|
|
564
|
+
}): Promise<MunicipalityCentroid[]>;
|
|
565
|
+
|
|
566
|
+
/**
|
|
567
|
+
* Sequential, colorblind-safe palettes (ColorBrewer / Viridis families, public
|
|
568
|
+
* domain). Ordered light → dark. Swap for your brand ramp if needed — any
|
|
569
|
+
* ordered list of hex colors works with the scale builders below.
|
|
570
|
+
*/
|
|
571
|
+
export declare const SEQUENTIAL_BLUES: readonly ["#eff3ff", "#c6dbef", "#9ecae1", "#6baed6", "#3182bd", "#08519c"];
|
|
572
|
+
|
|
573
|
+
export declare const SEQUENTIAL_GREENS: readonly ["#edf8e9", "#c7e9c0", "#a1d99b", "#74c476", "#31a354", "#006d2c"];
|
|
574
|
+
|
|
575
|
+
export declare const SEQUENTIAL_VIRIDIS: readonly ["#440154", "#414487", "#2a788e", "#22a884", "#7ad151", "#fde725"];
|
|
576
|
+
|
|
577
|
+
/**
|
|
578
|
+
* Continuous scale: linearly interpolate `palette` across `[min, max]`.
|
|
579
|
+
*
|
|
580
|
+
* @example
|
|
581
|
+
* const color = sequentialScale(0, 100, SEQUENTIAL_BLUES);
|
|
582
|
+
* <BrazilMap values={data} colorScale={color} />;
|
|
583
|
+
*/
|
|
584
|
+
export declare function sequentialScale(min: number, max: number, palette?: readonly string[]): ColorScale;
|
|
585
|
+
|
|
586
|
+
/**
|
|
587
|
+
* Centroid of a federative unit.
|
|
588
|
+
*
|
|
589
|
+
* @param uf - Federative unit acronym.
|
|
590
|
+
* @returns The state centroid, or `null` if unknown.
|
|
591
|
+
*/
|
|
592
|
+
export declare function stateCentroid(uf: UF): Promise<Coordinate | null>;
|
|
593
|
+
|
|
276
594
|
/** Municipality boundaries for a single federative unit. */
|
|
277
595
|
export declare interface StateMunicipalities {
|
|
278
596
|
type: "FeatureCollection";
|
|
@@ -284,6 +602,16 @@ export declare interface StateMunicipalities {
|
|
|
284
602
|
/** States belonging to a macro-region. */
|
|
285
603
|
export declare function statesByRegion(region: BrRegion): readonly BrazilState[];
|
|
286
604
|
|
|
605
|
+
/**
|
|
606
|
+
* Threshold scale: `palette[i]` applies to values in
|
|
607
|
+
* `[thresholds[i-1], thresholds[i])`. `palette` must have
|
|
608
|
+
* `thresholds.length + 1` entries.
|
|
609
|
+
*
|
|
610
|
+
* @example
|
|
611
|
+
* const color = thresholdScale([10, 50, 100], SEQUENTIAL_GREENS.slice(0, 4));
|
|
612
|
+
*/
|
|
613
|
+
export declare function thresholdScale(thresholds: readonly number[], palette: readonly string[]): ColorScale;
|
|
614
|
+
|
|
287
615
|
/** The 27 Brazilian federative units (26 states + Federal District). */
|
|
288
616
|
export declare type UF = "AC" | "AL" | "AP" | "AM" | "BA" | "CE" | "DF" | "ES" | "GO" | "MA" | "MT" | "MS" | "MG" | "PA" | "PB" | "PR" | "PE" | "PI" | "RJ" | "RN" | "RS" | "RO" | "RR" | "SC" | "SP" | "SE" | "TO";
|
|
289
617
|
|