utopia-ui 3.0.0-alpha.53 → 3.0.0-alpha.55

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
@@ -673,7 +673,6 @@ function AddButton(_a) {
673
673
  var setSelectNewItemPosition = _a.setSelectNewItemPosition;
674
674
  var layers = useLayers();
675
675
  var hasUserPermission = useHasUserPermission();
676
- useAuth().user;
677
676
  var canAddItems = function () {
678
677
  var canAdd = false;
679
678
  layers.map(function (layer) {
@@ -2241,7 +2240,8 @@ var SearchControl = function (_a) {
2241
2240
  var resetFilterTags = useResetFilterTags();
2242
2241
  var filterTags = useFilterTags();
2243
2242
  useMapEvents({
2244
- popupopen: function () {
2243
+ popupopen: function (e) {
2244
+ console.log(e);
2245
2245
  setPopupOpen(true);
2246
2246
  },
2247
2247
  popupclose: function () {
@@ -2279,18 +2279,19 @@ var SearchControl = function (_a) {
2279
2279
  }));
2280
2280
  setTagsResults(tags.filter(function (tag) { var _a; return (_a = tag.id) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(value.toLowerCase()); }));
2281
2281
  }, 500, [value]);
2282
+ var hide = function () { return __awaiter(void 0, void 0, void 0, function () {
2283
+ return __generator(this, function (_a) {
2284
+ setTimeout(function () {
2285
+ setHideSuggestions(true);
2286
+ }, 200);
2287
+ return [2 /*return*/];
2288
+ });
2289
+ }); };
2282
2290
  var searchInput = useRef(null);
2283
2291
  return (React.createElement(React.Fragment, null, !(windowDimensions.height < 500 && popupOpen) &&
2284
2292
  React.createElement("div", { className: 'tw-w-[calc(100vw-2rem)] tw-max-w-[22rem] ' },
2285
2293
  React.createElement("div", { className: 'flex tw-flex-row' },
2286
- React.createElement("input", { type: "text", placeholder: "search ...", autoComplete: "off", value: value, className: "tw-input tw-input-bordered tw-w-full tw-shadow-xl tw-rounded-lg tw-mr-2", ref: searchInput, onChange: function (e) { return setValue(e.target.value); }, onFocus: function () { return setHideSuggestions(false); }, onBlur: function () { return __awaiter(void 0, void 0, void 0, function () {
2287
- return __generator(this, function (_a) {
2288
- setTimeout(function () {
2289
- setHideSuggestions(true);
2290
- }, 200);
2291
- return [2 /*return*/];
2292
- });
2293
- }); } }),
2294
+ React.createElement("input", { type: "text", placeholder: "search ...", autoComplete: "off", value: value, className: "tw-input tw-input-bordered tw-w-full tw-shadow-xl tw-rounded-lg tw-mr-2", ref: searchInput, onChange: function (e) { return setValue(e.target.value); }, onFocus: function () { return setHideSuggestions(false); }, onBlur: function () { return hide(); } }),
2294
2295
  React.createElement(LocateControl, null)),
2295
2296
  value.length > 0 && React.createElement("button", { className: "tw-btn tw-btn-sm tw-btn-circle tw-absolute tw-right-16 tw-top-2", onClick: function () { return setValue(""); } }, "\u2715"),
2296
2297
  hideSuggestions || Array.from(geoResults).length == 0 && itemsResults.length == 0 && tagsResults.length == 0 && !isGeoCoordinate(value) || value.length == 0 ? "" :
@@ -2310,10 +2311,12 @@ var SearchControl = function (_a) {
2310
2311
  if (filterTags.length > 0) {
2311
2312
  marker !== null && window.history.pushState({}, "", "/".concat(item.layer.name, "/").concat(item.id));
2312
2313
  resetFilterTags();
2314
+ hide();
2313
2315
  }
2314
2316
  else {
2315
2317
  marker !== null && ((_b = clusterRef === null || clusterRef === void 0 ? void 0 : clusterRef.current) === null || _b === void 0 ? void 0 : _b.zoomToShowLayer(marker, function () {
2316
2318
  marker === null || marker === void 0 ? void 0 : marker.openPopup();
2319
+ hide();
2317
2320
  }));
2318
2321
  }
2319
2322
  } },
@@ -2333,6 +2336,7 @@ var SearchControl = function (_a) {
2333
2336
  map.fitBounds(new LatLngBounds(new LatLng(geo.properties.extent[1], geo.properties.extent[0]), new LatLng(geo.properties.extent[3], geo.properties.extent[2])));
2334
2337
  else
2335
2338
  map.setView(new LatLng(geo.geometry.coordinates[1], geo.geometry.coordinates[0]), 15, { duration: 1 });
2339
+ hide();
2336
2340
  } },
2337
2341
  React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: "1.5", stroke: "currentColor", className: "tw-text-current tw-mr-2 tw-mt-0 tw-w-4" },
2338
2342
  React.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z" })),