@banyan_cloud/roots 1.0.69 → 1.0.70

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.js CHANGED
@@ -109232,6 +109232,10 @@ var BaseMap = function BaseMap(props) {
109232
109232
  _useState2 = _slicedToArray(_useState, 2),
109233
109233
  map = _useState2[0],
109234
109234
  setMap = _useState2[1];
109235
+ var _useState3 = useState(null),
109236
+ _useState4 = _slicedToArray(_useState3, 2),
109237
+ activeInfoWindow = _useState4[0],
109238
+ setActiveInfoWindow = _useState4[1];
109235
109239
  useEffect(function () {
109236
109240
  if (ref.current && !map) {
109237
109241
  setMap(new window.google.maps.Map(ref.current, {
@@ -109302,7 +109306,9 @@ var BaseMap = function BaseMap(props) {
109302
109306
  children: [/*#__PURE__*/jsx("div", {
109303
109307
  ref: ref,
109304
109308
  style: style
109305
- }), Children.map(children, function (child, index) {
109309
+ }), Children.toArray(children).filter(function (child) {
109310
+ return /*#__PURE__*/isValidElement(child);
109311
+ }).map(function (child, index) {
109306
109312
  if (index === 0) {
109307
109313
  markersRef.current = [];
109308
109314
  }
@@ -109313,7 +109319,10 @@ var BaseMap = function BaseMap(props) {
109313
109319
  // set the map prop on the child component
109314
109320
  return /*#__PURE__*/cloneElement(child, {
109315
109321
  map: map,
109316
- ref: childRef
109322
+ ref: childRef,
109323
+ index: index,
109324
+ activeInfoWindow: activeInfoWindow,
109325
+ setActiveInfoWindow: setActiveInfoWindow
109317
109326
  });
109318
109327
  }
109319
109328
  return null;
@@ -109351,11 +109360,14 @@ Map$1.defaultProps = {
109351
109360
  libraries: undefined
109352
109361
  };
109353
109362
 
109354
- var _excluded = ["children"];
109363
+ var _excluded = ["children", "activeInfoWindow", "setActiveInfoWindow", "index"];
109355
109364
 
109356
109365
  // eslint-disable-next-line prefer-arrow-callback
109357
109366
  var Marker = /*#__PURE__*/forwardRef(function Marker(_ref, ref) {
109358
109367
  var children = _ref.children,
109368
+ activeInfoWindow = _ref.activeInfoWindow,
109369
+ setActiveInfoWindow = _ref.setActiveInfoWindow,
109370
+ index = _ref.index,
109359
109371
  options = _objectWithoutProperties$1(_ref, _excluded);
109360
109372
  var _useState = useState(),
109361
109373
  _useState2 = _slicedToArray(_useState, 2),
@@ -109384,6 +109396,7 @@ var Marker = /*#__PURE__*/forwardRef(function Marker(_ref, ref) {
109384
109396
  if (marker && Children.count(children) === 1 && infoWindowRef !== null && infoWindowRef !== void 0 && infoWindowRef.current) {
109385
109397
  var infoWindow = infoWindowRef === null || infoWindowRef === void 0 ? void 0 : infoWindowRef.current;
109386
109398
  marker.addListener('click', function () {
109399
+ setActiveInfoWindow(index);
109387
109400
  infoWindow.open({
109388
109401
  anchor: marker,
109389
109402
  map: options.map
@@ -109396,6 +109409,12 @@ var Marker = /*#__PURE__*/forwardRef(function Marker(_ref, ref) {
109396
109409
  marker.setOptions(options);
109397
109410
  }
109398
109411
  }, [marker, options]);
109412
+ useEffect(function () {
109413
+ if (activeInfoWindow == null || activeInfoWindow !== index) {
109414
+ var infoWindow = infoWindowRef === null || infoWindowRef === void 0 ? void 0 : infoWindowRef.current;
109415
+ infoWindow.close();
109416
+ }
109417
+ }, [activeInfoWindow]);
109399
109418
  if (Children.count(children) === 1) {
109400
109419
  var _Children$toArray;
109401
109420
  var child = (_Children$toArray = Children.toArray(children)) === null || _Children$toArray === void 0 ? void 0 : _Children$toArray[0];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@banyan_cloud/roots",
3
- "version": "1.0.69",
3
+ "version": "1.0.70",
4
4
  "description": "Design System Library which drives the Banyan Cloud products",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",