@carto/ps-react-maps 1.3.0 → 1.3.1-alpha.0

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/index.cjs CHANGED
@@ -24,4 +24,4 @@ Check the top-level render call using <`+n+">.")}return r}}function je(e,r){{if(
24
24
  *
25
25
  * This source code is licensed under the MIT license found in the
26
26
  * LICENSE file in the root directory of this source tree.
27
- */var Ae;function Or(){if(Ae)return $;Ae=1;var t=C,s=Symbol.for("react.element"),d=Symbol.for("react.fragment"),_=Object.prototype.hasOwnProperty,o=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,y={key:!0,ref:!0,__self:!0,__source:!0};function l(E,u,g){var R,T={},x=null,p=null;g!==void 0&&(x=""+g),u.key!==void 0&&(x=""+u.key),u.ref!==void 0&&(p=u.ref);for(R in u)_.call(u,R)&&!y.hasOwnProperty(R)&&(T[R]=u[R]);if(E&&E.defaultProps)for(R in u=E.defaultProps,u)T[R]===void 0&&(T[R]=u[R]);return{$$typeof:s,type:E,key:x,ref:p,props:T,_owner:o.current}}return $.Fragment=d,$.jsx=l,$.jsxs=l,$}process.env.NODE_ENV==="production"?ie.exports=Or():ie.exports=xr();var oe=ie.exports;function Pr({children:t,maps:s,externalSync:d}){const[_,o]=C.useReducer(Ue,{...N.state,maps:s.reduce((p,v)=>(p[v.id]=v,p),N.state.maps)}),y=C.useRef(s.reduce((p,v)=>(p[v.id]={instanceRef:{current:null},overlayRef:{current:null}},p),{})),l=C.useCallback((p,v,D)=>{s[0].id===p&&d?.({type:v,payload:D})},[d,s]),E=C.useCallback((p,v)=>{o({type:M.SetViewState,payload:{id:v,viewState:p}}),l(v,M.SetViewState,p)},[o,l]),u=C.useCallback(({height:p,width:v},D)=>{o({type:M.SetResize,payload:{id:D,height:p,width:v}}),l(D,M.SetResize,{height:p,width:v})},[o,l]),g=C.useCallback((p,v)=>{o({type:M.SetBasemap,payload:{id:v,basemap:p}})},[o]),R=C.useCallback((p,v)=>{o({type:M.SetZoom,payload:{id:v,zoom:p}})},[o]),T=C.useCallback((p,v)=>{o({type:M.SetLoaded,payload:{id:v,value:p}})},[o]),x=C.useRef({setViewState:E,setBasemap:g,setResize:u,setZoom:R,setLoaded:T});return oe.jsx(ue.Provider,{value:x.current,children:oe.jsx(Ne.Provider,{value:y,children:oe.jsx(se.Provider,{value:_,children:t})})})}const Ye={NUMBER:{style:"decimal",maximumFractionDigits:1,minimumFractionDigits:0,notation:"compact",compactDisplay:"short"},CURRENCY:{style:"currency",currency:"USD",maximumFractionDigits:2,minimumFractionDigits:2,notation:"compact",compactDisplay:"short"},DATE:{year:"numeric",month:"2-digit",day:"2-digit"}};function $e(t,s,d){return Intl.NumberFormat(s,d).format(t)}function jr(t,s,d={}){return $e(t,s,{...Ye.NUMBER,...d})}function kr(t,s,d={}){return $e(t,s,{...Ye.CURRENCY,...d})}var k=(t=>(t.CURRENCY="CURRENCY",t.DEFAULT="DEFAULT",t.NUMBER="NUMBER",t))(k||{});const Ie={[k.CURRENCY]:{type:k.CURRENCY,format:(t,s)=>kr(t,s)},[k.NUMBER]:{type:k.NUMBER,format:(t,s)=>jr(t,s)},[k.DEFAULT]:{type:k.DEFAULT,format:t=>t.toLocaleString()}};function Dr({properties:t,formatters:s={},includeColumns:d=Object.keys(t),locale:_="en-US",showColumnName:o=!0,title:y,getColumnName:l=Lr,getFieldHtml:E=Mr,getTitle:u=Fr,getValue:g=Ar}){const R=y?u(y):"",x=d.reduce((p,v)=>{const D=s[v],W=t[v],F=g(W,_,D),S=o?l(v):"";return p+E(S,F)},"");return R+x}function Fr(t){return`<h3 style="margin: 0"><strong>${t}</strong></h3></br>`}function Mr(t,s){return`${t}${s}</br>`}function Ar(t,s,d){try{return Ir(d)(t,s)}catch{return t}}function Ir(t){return typeof t=="function"?t:(t&&Ie[t]||Ie[k.DEFAULT]).format}function Lr(t){return`<strong>${t}</strong>: `}exports.CartoBasemapURL=Sr;exports.CartoBasemapsNames=Le;exports.FormatterTypes=k;exports.GMapsBasemap=J;exports.INITIAL_STATE=N;exports.MapActionsContext=ue;exports.MapContext=se;exports.MapProvider=Pr;exports.objectToHtml=Dr;exports.reducer=Ue;exports.useMap=Ve;exports.useMapActions=Be;exports.useMapActionsByID=wr;exports.useMapByID=Cr;exports.useMapRefences=ce;exports.useMapReferencesByID=Tr;
27
+ */var Ae;function Or(){if(Ae)return $;Ae=1;var t=C,s=Symbol.for("react.element"),d=Symbol.for("react.fragment"),_=Object.prototype.hasOwnProperty,o=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,y={key:!0,ref:!0,__self:!0,__source:!0};function l(E,u,g){var R,T={},x=null,p=null;g!==void 0&&(x=""+g),u.key!==void 0&&(x=""+u.key),u.ref!==void 0&&(p=u.ref);for(R in u)_.call(u,R)&&!y.hasOwnProperty(R)&&(T[R]=u[R]);if(E&&E.defaultProps)for(R in u=E.defaultProps,u)T[R]===void 0&&(T[R]=u[R]);return{$$typeof:s,type:E,key:x,ref:p,props:T,_owner:o.current}}return $.Fragment=d,$.jsx=l,$.jsxs=l,$}process.env.NODE_ENV==="production"?ie.exports=Or():ie.exports=xr();var oe=ie.exports;function Pr({children:t,maps:s,externalSync:d}){const[_,o]=C.useReducer(Ue,{...N.state,maps:s.reduce((p,v)=>(p[v.id]={...v,isLoaded:!1},p),N.state.maps)}),y=C.useRef(s.reduce((p,v)=>(p[v.id]={instanceRef:{current:null},overlayRef:{current:null}},p),{})),l=C.useCallback((p,v,D)=>{s[0].id===p&&d?.({type:v,payload:D})},[d,s]),E=C.useCallback((p,v)=>{o({type:M.SetViewState,payload:{id:v,viewState:p}}),l(v,M.SetViewState,p)},[o,l]),u=C.useCallback(({height:p,width:v},D)=>{o({type:M.SetResize,payload:{id:D,height:p,width:v}}),l(D,M.SetResize,{height:p,width:v})},[o,l]),g=C.useCallback((p,v)=>{o({type:M.SetBasemap,payload:{id:v,basemap:p}})},[o]),R=C.useCallback((p,v)=>{o({type:M.SetZoom,payload:{id:v,zoom:p}})},[o]),T=C.useCallback((p,v)=>{o({type:M.SetLoaded,payload:{id:v,value:p}})},[o]),x=C.useRef({setViewState:E,setBasemap:g,setResize:u,setZoom:R,setLoaded:T});return oe.jsx(ue.Provider,{value:x.current,children:oe.jsx(Ne.Provider,{value:y,children:oe.jsx(se.Provider,{value:_,children:t})})})}const Ye={NUMBER:{style:"decimal",maximumFractionDigits:1,minimumFractionDigits:0,notation:"compact",compactDisplay:"short"},CURRENCY:{style:"currency",currency:"USD",maximumFractionDigits:2,minimumFractionDigits:2,notation:"compact",compactDisplay:"short"},DATE:{year:"numeric",month:"2-digit",day:"2-digit"}};function $e(t,s,d){return Intl.NumberFormat(s,d).format(t)}function jr(t,s,d={}){return $e(t,s,{...Ye.NUMBER,...d})}function kr(t,s,d={}){return $e(t,s,{...Ye.CURRENCY,...d})}var k=(t=>(t.CURRENCY="CURRENCY",t.DEFAULT="DEFAULT",t.NUMBER="NUMBER",t))(k||{});const Ie={[k.CURRENCY]:{type:k.CURRENCY,format:(t,s)=>kr(t,s)},[k.NUMBER]:{type:k.NUMBER,format:(t,s)=>jr(t,s)},[k.DEFAULT]:{type:k.DEFAULT,format:t=>t.toLocaleString()}};function Dr({properties:t,formatters:s={},includeColumns:d=Object.keys(t),locale:_="en-US",showColumnName:o=!0,title:y,getColumnName:l=Lr,getFieldHtml:E=Mr,getTitle:u=Fr,getValue:g=Ar}){const R=y?u(y):"",x=d.reduce((p,v)=>{const D=s[v],W=t[v],F=g(W,_,D),S=o?l(v):"";return p+E(S,F)},"");return R+x}function Fr(t){return`<h3 style="margin: 0"><strong>${t}</strong></h3></br>`}function Mr(t,s){return`${t}${s}</br>`}function Ar(t,s,d){try{return Ir(d)(t,s)}catch{return t}}function Ir(t){return typeof t=="function"?t:(t&&Ie[t]||Ie[k.DEFAULT]).format}function Lr(t){return`<strong>${t}</strong>: `}exports.CartoBasemapURL=Sr;exports.CartoBasemapsNames=Le;exports.FormatterTypes=k;exports.GMapsBasemap=J;exports.INITIAL_STATE=N;exports.MapActionsContext=ue;exports.MapContext=se;exports.MapProvider=Pr;exports.objectToHtml=Dr;exports.reducer=Ue;exports.useMap=Ve;exports.useMapActions=Be;exports.useMapActionsByID=wr;exports.useMapByID=Cr;exports.useMapRefences=ce;exports.useMapReferencesByID=Tr;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import Le, { createContext as se, useContext as ue, useReducer as Sr, useRef as Fe, useCallback as L } from "react";
1
+ import Ie, { createContext as se, useContext as ue, useReducer as Sr, useRef as Fe, useCallback as I } from "react";
2
2
  var oe = /* @__PURE__ */ ((t) => (t.Roadmap = "roadmap", t.Satellite = "satellite", t.Hybrid = "hybrid", t))(oe || {}), wr = /* @__PURE__ */ ((t) => (t.DarkMatter = "dark-matter", t.Positron = "positron", t.Voyager = "voyager", t))(wr || {});
3
3
  const Nr = {
4
4
  positron: "https://basemaps.cartocdn.com/gl/positron-gl-style/style.json",
@@ -154,7 +154,7 @@ var ie = { exports: {} }, Y = {};
154
154
  var Ae;
155
155
  function xr() {
156
156
  return Ae || (Ae = 1, process.env.NODE_ENV !== "production" && function() {
157
- var t = Le, s = Symbol.for("react.element"), d = Symbol.for("react.portal"), _ = Symbol.for("react.fragment"), o = Symbol.for("react.strict_mode"), g = Symbol.for("react.profiler"), l = Symbol.for("react.provider"), b = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), R = Symbol.for("react.suspense"), y = Symbol.for("react.suspense_list"), w = Symbol.for("react.memo"), C = Symbol.for("react.lazy"), v = Symbol.for("react.offscreen"), p = Symbol.iterator, j = "@@iterator";
157
+ var t = Ie, s = Symbol.for("react.element"), d = Symbol.for("react.portal"), _ = Symbol.for("react.fragment"), o = Symbol.for("react.strict_mode"), g = Symbol.for("react.profiler"), l = Symbol.for("react.provider"), b = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), R = Symbol.for("react.suspense"), y = Symbol.for("react.suspense_list"), w = Symbol.for("react.memo"), C = Symbol.for("react.lazy"), v = Symbol.for("react.offscreen"), p = Symbol.iterator, j = "@@iterator";
158
158
  function W(e) {
159
159
  if (e === null || typeof e != "object")
160
160
  return null;
@@ -392,7 +392,7 @@ function xr() {
392
392
  } finally {
393
393
  X = !1, G.current = m, Qe(), Error.prepareStackTrace = f;
394
394
  }
395
- var I = e ? e.displayName || e.name : "", ke = I ? z(I) : "";
395
+ var M = e ? e.displayName || e.name : "", ke = M ? z(M) : "";
396
396
  return typeof e == "function" && Z.set(e, ke), ke;
397
397
  }
398
398
  function rr(e, r, n) {
@@ -581,7 +581,7 @@ function xr() {
581
581
  }
582
582
  }
583
583
  var re = D.ReactCurrentOwner, Ce = D.ReactDebugCurrentFrame;
584
- function M(e) {
584
+ function L(e) {
585
585
  if (e) {
586
586
  var r = e._owner, n = q(e.type, e._source, r ? r.type : null);
587
587
  Ce.setExtraStackFrame(n);
@@ -639,7 +639,7 @@ Check the top-level render call using <` + n + ">.");
639
639
  return;
640
640
  xe[n] = !0;
641
641
  var a = "";
642
- e && e._owner && e._owner !== re.current && (a = " It was passed a child from " + x(e._owner.type) + "."), M(e), S('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', n, a), M(null);
642
+ e && e._owner && e._owner !== re.current && (a = " It was passed a child from " + x(e._owner.type) + "."), L(e), S('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', n, a), L(null);
643
643
  }
644
644
  }
645
645
  function je(e, r) {
@@ -691,11 +691,11 @@ Check the top-level render call using <` + n + ">.");
691
691
  for (var r = Object.keys(e.props), n = 0; n < r.length; n++) {
692
692
  var a = r[n];
693
693
  if (a !== "children" && a !== "key") {
694
- M(e), S("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", a), M(null);
694
+ L(e), S("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", a), L(null);
695
695
  break;
696
696
  }
697
697
  }
698
- e.ref !== null && (M(e), S("Invalid attribute `ref` supplied to `React.Fragment`."), M(null));
698
+ e.ref !== null && (L(e), S("Invalid attribute `ref` supplied to `React.Fragment`."), L(null));
699
699
  }
700
700
  }
701
701
  function De(e, r, n, a, f, m) {
@@ -717,8 +717,8 @@ Check the top-level render call using <` + n + ">.");
717
717
  if (O !== void 0)
718
718
  if (a)
719
719
  if (Q(O)) {
720
- for (var I = 0; I < O.length; I++)
721
- je(O[I], e);
720
+ for (var M = 0; M < O.length; M++)
721
+ je(O[M], e);
722
722
  Object.freeze && Object.freeze(O);
723
723
  } else
724
724
  S("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
@@ -748,12 +748,12 @@ var $ = {};
748
748
  * This source code is licensed under the MIT license found in the
749
749
  * LICENSE file in the root directory of this source tree.
750
750
  */
751
- var Me;
751
+ var Le;
752
752
  function Pr() {
753
- if (Me)
753
+ if (Le)
754
754
  return $;
755
- Me = 1;
756
- var t = Le, s = Symbol.for("react.element"), d = Symbol.for("react.fragment"), _ = Object.prototype.hasOwnProperty, o = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, g = { key: !0, ref: !0, __self: !0, __source: !0 };
755
+ Le = 1;
756
+ var t = Ie, s = Symbol.for("react.element"), d = Symbol.for("react.fragment"), _ = Object.prototype.hasOwnProperty, o = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, g = { key: !0, ref: !0, __self: !0, __source: !0 };
757
757
  function l(b, u, R) {
758
758
  var y, w = {}, C = null, v = null;
759
759
  R !== void 0 && (C = "" + R), u.key !== void 0 && (C = "" + u.key), u.ref !== void 0 && (v = u.ref);
@@ -775,7 +775,10 @@ function $r({
775
775
  }) {
776
776
  const [_, o] = Sr(Tr, {
777
777
  ...B.state,
778
- maps: s.reduce((v, p) => (v[p.id] = p, v), B.state.maps)
778
+ maps: s.reduce((v, p) => (v[p.id] = {
779
+ ...p,
780
+ isLoaded: !1
781
+ }, v), B.state.maps)
779
782
  }), g = Fe(
780
783
  s.reduce((v, p) => (v[p.id] = {
781
784
  instanceRef: {
@@ -785,7 +788,7 @@ function $r({
785
788
  current: null
786
789
  }
787
790
  }, v), {})
788
- ), l = L(
791
+ ), l = I(
789
792
  (v, p, j) => {
790
793
  s[0].id === v && d?.({
791
794
  type: p,
@@ -793,7 +796,7 @@ function $r({
793
796
  });
794
797
  },
795
798
  [d, s]
796
- ), b = L(
799
+ ), b = I(
797
800
  (v, p) => {
798
801
  o({
799
802
  type: k.SetViewState,
@@ -804,7 +807,7 @@ function $r({
804
807
  }), l(p, k.SetViewState, v);
805
808
  },
806
809
  [o, l]
807
- ), u = L(
810
+ ), u = I(
808
811
  ({ height: v, width: p }, j) => {
809
812
  o({
810
813
  type: k.SetResize,
@@ -816,7 +819,7 @@ function $r({
816
819
  }), l(j, k.SetResize, { height: v, width: p });
817
820
  },
818
821
  [o, l]
819
- ), R = L(
822
+ ), R = I(
820
823
  (v, p) => {
821
824
  o({
822
825
  type: k.SetBasemap,
@@ -827,7 +830,7 @@ function $r({
827
830
  });
828
831
  },
829
832
  [o]
830
- ), y = L(
833
+ ), y = I(
831
834
  (v, p) => {
832
835
  o({
833
836
  type: k.SetZoom,
@@ -838,7 +841,7 @@ function $r({
838
841
  });
839
842
  },
840
843
  [o]
841
- ), w = L(
844
+ ), w = I(
842
845
  (v, p) => {
843
846
  o({
844
847
  type: k.SetLoaded,
@@ -890,7 +893,7 @@ function Dr(t, s, d = {}) {
890
893
  return Be(t, s, { ...$e.CURRENCY, ...d });
891
894
  }
892
895
  var F = /* @__PURE__ */ ((t) => (t.CURRENCY = "CURRENCY", t.DEFAULT = "DEFAULT", t.NUMBER = "NUMBER", t))(F || {});
893
- const Ie = {
896
+ const Me = {
894
897
  [F.CURRENCY]: {
895
898
  type: F.CURRENCY,
896
899
  format: (t, s) => Dr(t, s)
@@ -911,7 +914,7 @@ function Br({
911
914
  locale: _ = "en-US",
912
915
  showColumnName: o = !0,
913
916
  title: g,
914
- getColumnName: l = Ir,
917
+ getColumnName: l = Mr,
915
918
  getFieldHtml: b = Fr,
916
919
  getTitle: u = kr,
917
920
  getValue: R = Ar
@@ -930,15 +933,15 @@ function Fr(t, s) {
930
933
  }
931
934
  function Ar(t, s, d) {
932
935
  try {
933
- return Mr(d)(t, s);
936
+ return Lr(d)(t, s);
934
937
  } catch {
935
938
  return t;
936
939
  }
937
940
  }
938
- function Mr(t) {
939
- return typeof t == "function" ? t : (t && Ie[t] || Ie[F.DEFAULT]).format;
941
+ function Lr(t) {
942
+ return typeof t == "function" ? t : (t && Me[t] || Me[F.DEFAULT]).format;
940
943
  }
941
- function Ir(t) {
944
+ function Mr(t) {
942
945
  return `<strong>${t}</strong>: `;
943
946
  }
944
947
  export {
@@ -12,7 +12,7 @@ export type MapProviderMapProps = {
12
12
  id: MapsProps['id'];
13
13
  basemap: MapsProps['basemap'];
14
14
  viewState: MapsProps['viewState'];
15
- isLoaded: boolean;
15
+ isLoaded?: boolean;
16
16
  };
17
17
  /**
18
18
  * Props for the MapProvider component.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carto/ps-react-maps",
3
- "version": "1.3.0",
3
+ "version": "1.3.1-alpha.0",
4
4
  "description": "CARTO's Professional Service React Maps library",
5
5
  "files": [
6
6
  "dist"
@@ -30,7 +30,7 @@
30
30
  },
31
31
  "dependencies": {},
32
32
  "devDependencies": {
33
- "@carto/react-basemaps": "2.3.5",
33
+ "@carto/react-basemaps": "2.3.6",
34
34
  "@deck.gl/core": "8.9.33",
35
35
  "@deck.gl/google-maps": "8.9.33",
36
36
  "@deck.gl/react": "8.9.33",