@octostar/map-component 0.5.0 → 0.6.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/README.md CHANGED
@@ -99,6 +99,7 @@ Host requirements:
99
99
  - maplibre-gl 6 needs WebGL2. A browser without it shows no map.
100
100
  - maplibre's worker is inlined in this package and starts from a `blob:` URL, so a Content-Security-Policy needs `worker-src blob:`.
101
101
  - Don't override or dedupe `maplibre-gl` in the host: the inlined worker must match the exact version this package pins, and a mismatch logs an error and breaks rendering. Take maplibre fixes by upgrading this package.
102
+ - `antd` 6.1 or later is a peer dependency: the host installs it, and the component renders through the host's `ConfigProvider` (class prefix, theme, CSS variables) and `App` (confirm dialogs, toasts). It never bundles an antd of its own, so a host needs no override to keep a single antd instance.
102
103
 
103
104
  ## Main Components
104
105
 
package/dist/index.mjs CHANGED
@@ -7,15 +7,14 @@ import * as turf from "@turf/turf";
7
7
  import { distance as distance$1, point } from "@turf/turf";
8
8
  import * as THREE from "three";
9
9
  import proj4 from "proj4";
10
- import { Button, Modal, Input, App, message, Tooltip, Dropdown, Divider, Popover, Switch, Slider, Tag, Select, Segmented, Collapse, ColorPicker, Tabs, Card, Table, DatePicker } from "antd";
10
+ import { Button, Modal, Input, App, message, ConfigProvider, Tooltip, Dropdown, Divider, Popover, Switch, Slider, Tag, Select, Segmented, DatePicker, Collapse, ColorPicker, Tabs, Card, Table } from "antd";
11
11
  import { clsx } from "clsx";
12
12
  import { twMerge } from "tailwind-merge";
13
13
  import { MousePointer2, Square, Hexagon, Circle, MoreVertical, ChevronDown, Filter, X, Move, Ruler, Search, Scan, Pencil, Database, MapPin, Minus, Pentagon, Type, MoveRight, Undo2, Redo2, Trash2, Navigation, Loader2, Map as Map$1, Satellite, FolderOpen, Upload, Download, MoreHorizontal, Focus, Box, Layers, Plus, ChevronRight, Eye, EyeOff, Lock, Smile, Package, Copy, FolderInput, Save, Calendar, Palette, Blend, RefreshCw, ExternalLink, Info, ChevronLeft, SkipBack, Pause, Play, Clock, AlertTriangle, TestTube, Users, GripVertical, Plane, FileJson, Check, Phone, Car, AlertCircle } from "lucide-react";
14
14
  import { createPortal } from "react-dom";
15
- import { format } from "date-fns";
15
+ import dayjs from "dayjs";
16
16
  import { createStore, useStore } from "zustand";
17
17
  import Flatbush from "flatbush";
18
- import dayjs from "dayjs";
19
18
  import * as toGeoJSON from "@mapbox/togeojson";
20
19
  function detectSourceCRS(geojson) {
21
20
  var _a, _b;
@@ -2789,18 +2788,13 @@ function stripInternalPropertiesFromFeature(feature, keep) {
2789
2788
  const ToastContext = createContext(null);
2790
2789
  function useToast() {
2791
2790
  const externalToast = useContext(ToastContext);
2791
+ const { message: message$1 } = App.useApp();
2792
2792
  if (externalToast) {
2793
2793
  return { toast: externalToast };
2794
2794
  }
2795
- let message$1 = null;
2796
- try {
2797
- const app = App.useApp();
2798
- message$1 = app.message;
2799
- } catch {
2800
- }
2801
2795
  const toast = ({ title, description, variant }) => {
2802
2796
  const content = description ? `${title ? title + ": " : ""}${description}` : title;
2803
- const msg = message$1 ?? message;
2797
+ const msg = typeof message$1.success === "function" ? message$1 : message;
2804
2798
  if (variant === "destructive") {
2805
2799
  msg.error(content);
2806
2800
  } else {
@@ -2809,6 +2803,19 @@ function useToast() {
2809
2803
  };
2810
2804
  return { toast };
2811
2805
  }
2806
+ const POPUP_COMPONENTS = ["dropdown", "select-dropdown", "modal-root", "popover", "tooltip", "slider", "color-picker"];
2807
+ function useAntdPopupSelector() {
2808
+ const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);
2809
+ return useMemo(() => POPUP_COMPONENTS.map((c) => `.${getPrefixCls(c)}`).join(", "), [getPrefixCls]);
2810
+ }
2811
+ function useConfirm() {
2812
+ const { modal } = App.useApp();
2813
+ const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);
2814
+ return useMemo(() => {
2815
+ const confirm = typeof modal.confirm === "function" ? modal.confirm : Modal.confirm;
2816
+ return (props) => confirm({ prefixCls: getPrefixCls("modal"), ...props });
2817
+ }, [modal, getPrefixCls]);
2818
+ }
2812
2819
  const DEFAULT_ENDPOINTS = {
2813
2820
  streetsStyle: "https://basemaps.cartocdn.com/gl/voyager-gl-style/style.json",
2814
2821
  darkStyle: "https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json",
@@ -3035,6 +3042,8 @@ function DrawingToolbar({
3035
3042
  showUndoRedo = false
3036
3043
  }) {
3037
3044
  const { toast } = useToast();
3045
+ const confirm = useConfirm();
3046
+ const antdPopupSelector = useAntdPopupSelector();
3038
3047
  const [goToLat, setGoToLat] = useState("");
3039
3048
  const [goToLng, setGoToLng] = useState("");
3040
3049
  const [goToAddress, setGoToAddress] = useState("");
@@ -3062,14 +3071,14 @@ function DrawingToolbar({
3062
3071
  if (!featureSearchOpen) return;
3063
3072
  const handlePointerDown = (e) => {
3064
3073
  const target = e.target;
3065
- if (target.closest('[data-testid="toolbar-drawing"]') || target.closest('[data-testid="search-panel"]') || target.closest(".ant-dropdown, .ant5-dropdown, .ant-select-dropdown, .ant5-select-dropdown, .ant-modal-root, .ant5-modal-root, .ant-popover, .ant5-popover, .ant-tooltip, .ant5-tooltip")) {
3074
+ if (target.closest('[data-testid="toolbar-drawing"]') || target.closest('[data-testid="search-panel"]') || target.closest(antdPopupSelector)) {
3066
3075
  return;
3067
3076
  }
3068
3077
  setFeatureSearchOpen(false);
3069
3078
  };
3070
3079
  document.addEventListener("pointerdown", handlePointerDown);
3071
3080
  return () => document.removeEventListener("pointerdown", handlePointerDown);
3072
- }, [featureSearchOpen]);
3081
+ }, [featureSearchOpen, antdPopupSelector]);
3073
3082
  const getFeatureLabel = (f) => {
3074
3083
  var _a;
3075
3084
  const p = f.properties || {};
@@ -3204,7 +3213,7 @@ function DrawingToolbar({
3204
3213
  }
3205
3214
  };
3206
3215
  const handleClearAll = () => {
3207
- Modal.confirm({
3216
+ confirm({
3208
3217
  title: "Clear all features?",
3209
3218
  content: `This will remove all ${featureCount} feature${featureCount !== 1 ? "s" : ""} from the map. This action cannot be undone.`,
3210
3219
  okText: "Clear all",
@@ -4122,7 +4131,7 @@ function ColorPickerPopover({ value, onChange, testId }) {
4122
4131
  content: popoverContent,
4123
4132
  trigger: "click",
4124
4133
  placement: "bottomLeft",
4125
- overlayClassName: "z-[10001]",
4134
+ classNames: { root: "z-[10001]" },
4126
4135
  children: /* @__PURE__ */ jsx(
4127
4136
  Button,
4128
4137
  {
@@ -4313,6 +4322,7 @@ function LayersPanel({
4313
4322
  layerBadgeProvider,
4314
4323
  featureCountProvider
4315
4324
  }) {
4325
+ const confirm = useConfirm();
4316
4326
  const [editingLayerId, setEditingLayerId] = useState(null);
4317
4327
  const [editingName, setEditingName] = useState("");
4318
4328
  const [expandedLayers, setExpandedLayers] = useState(/* @__PURE__ */ new Set());
@@ -4392,7 +4402,7 @@ function LayersPanel({
4392
4402
  });
4393
4403
  }, [selectedFeatureIds, onMoveFeatureToLayer]);
4394
4404
  const handleDeleteLayer = useCallback((layer) => {
4395
- Modal.confirm({
4405
+ confirm({
4396
4406
  title: `Delete layer "${layer.name}"?`,
4397
4407
  content: "This will delete the layer and all its features.",
4398
4408
  okText: "Delete",
@@ -4400,7 +4410,7 @@ function LayersPanel({
4400
4410
  cancelText: "Cancel",
4401
4411
  onOk: () => onRemoveLayer(layer.id)
4402
4412
  });
4403
- }, [onRemoveLayer]);
4413
+ }, [confirm, onRemoveLayer]);
4404
4414
  const renderLayerItem = (layer) => {
4405
4415
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba, _ca, _da, _ea, _fa;
4406
4416
  const customCount = featureCountProvider == null ? void 0 : featureCountProvider(layer.id);
@@ -5474,6 +5484,121 @@ function LayersPanel({
5474
5484
  }
5475
5485
  );
5476
5486
  }
5487
+ var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
5488
+ function getDefaultExportFromCjs(x) {
5489
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
5490
+ }
5491
+ var localeData$1 = { exports: {} };
5492
+ (function(module, exports$1) {
5493
+ !(function(n, e) {
5494
+ module.exports = e();
5495
+ })(commonjsGlobal, (function() {
5496
+ return function(n, e, t) {
5497
+ var r = e.prototype, o = function(n2) {
5498
+ return n2 && (n2.indexOf ? n2 : n2.s);
5499
+ }, u = function(n2, e2, t2, r2, u2) {
5500
+ var i2 = n2.name ? n2 : n2.$locale(), a2 = o(i2[e2]), s2 = o(i2[t2]), f = a2 || s2.map((function(n3) {
5501
+ return n3.slice(0, r2);
5502
+ }));
5503
+ if (!u2) return f;
5504
+ var d = i2.weekStart;
5505
+ return f.map((function(n3, e3) {
5506
+ return f[(e3 + (d || 0)) % 7];
5507
+ }));
5508
+ }, i = function() {
5509
+ return t.Ls[t.locale()];
5510
+ }, a = function(n2, e2) {
5511
+ return n2.formats[e2] || (function(n3) {
5512
+ return n3.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, (function(n4, e3, t2) {
5513
+ return e3 || t2.slice(1);
5514
+ }));
5515
+ })(n2.formats[e2.toUpperCase()]);
5516
+ }, s = function() {
5517
+ var n2 = this;
5518
+ return { months: function(e2) {
5519
+ return e2 ? e2.format("MMMM") : u(n2, "months");
5520
+ }, monthsShort: function(e2) {
5521
+ return e2 ? e2.format("MMM") : u(n2, "monthsShort", "months", 3);
5522
+ }, firstDayOfWeek: function() {
5523
+ return n2.$locale().weekStart || 0;
5524
+ }, weekdays: function(e2) {
5525
+ return e2 ? e2.format("dddd") : u(n2, "weekdays");
5526
+ }, weekdaysMin: function(e2) {
5527
+ return e2 ? e2.format("dd") : u(n2, "weekdaysMin", "weekdays", 2);
5528
+ }, weekdaysShort: function(e2) {
5529
+ return e2 ? e2.format("ddd") : u(n2, "weekdaysShort", "weekdays", 3);
5530
+ }, longDateFormat: function(e2) {
5531
+ return a(n2.$locale(), e2);
5532
+ }, meridiem: this.$locale().meridiem, ordinal: this.$locale().ordinal };
5533
+ };
5534
+ r.localeData = function() {
5535
+ return s.bind(this)();
5536
+ }, t.localeData = function() {
5537
+ var n2 = i();
5538
+ return { firstDayOfWeek: function() {
5539
+ return n2.weekStart || 0;
5540
+ }, weekdays: function() {
5541
+ return t.weekdays();
5542
+ }, weekdaysShort: function() {
5543
+ return t.weekdaysShort();
5544
+ }, weekdaysMin: function() {
5545
+ return t.weekdaysMin();
5546
+ }, months: function() {
5547
+ return t.months();
5548
+ }, monthsShort: function() {
5549
+ return t.monthsShort();
5550
+ }, longDateFormat: function(e2) {
5551
+ return a(n2, e2);
5552
+ }, meridiem: n2.meridiem, ordinal: n2.ordinal };
5553
+ }, t.months = function() {
5554
+ return u(i(), "months");
5555
+ }, t.monthsShort = function() {
5556
+ return u(i(), "monthsShort", "months", 3);
5557
+ }, t.weekdays = function(n2) {
5558
+ return u(i(), "weekdays", null, null, n2);
5559
+ }, t.weekdaysShort = function(n2) {
5560
+ return u(i(), "weekdaysShort", "weekdays", 3, n2);
5561
+ }, t.weekdaysMin = function(n2) {
5562
+ return u(i(), "weekdaysMin", "weekdays", 2, n2);
5563
+ };
5564
+ };
5565
+ }));
5566
+ })(localeData$1);
5567
+ var localeDataExports = localeData$1.exports;
5568
+ const localeData = /* @__PURE__ */ getDefaultExportFromCjs(localeDataExports);
5569
+ var weekday$1 = { exports: {} };
5570
+ (function(module, exports$1) {
5571
+ !(function(e, t) {
5572
+ module.exports = t();
5573
+ })(commonjsGlobal, (function() {
5574
+ return function(e, t) {
5575
+ t.prototype.weekday = function(e2) {
5576
+ var t2 = this.$locale().weekStart || 0, i = this.$W, n = (i < t2 ? i + 7 : i) - t2;
5577
+ return this.$utils().u(e2) ? n : this.subtract(n, "day").add(e2, "day");
5578
+ };
5579
+ };
5580
+ }));
5581
+ })(weekday$1);
5582
+ var weekdayExports = weekday$1.exports;
5583
+ const weekday = /* @__PURE__ */ getDefaultExportFromCjs(weekdayExports);
5584
+ dayjs.extend(weekday);
5585
+ dayjs.extend(localeData);
5586
+ function FeatureDatePicker({ value, onChange, disabled, "data-testid": testId }) {
5587
+ const date = useMemo(() => value ? dayjs(value) : null, [value]);
5588
+ return /* @__PURE__ */ jsx(
5589
+ DatePicker,
5590
+ {
5591
+ showTime: true,
5592
+ format: "YYYY-MM-DD HH:mm",
5593
+ size: "small",
5594
+ value: date,
5595
+ onChange: (picked) => onChange(picked ? picked.startOf("minute").toISOString() : ""),
5596
+ disabled,
5597
+ className: "!h-6 flex-1",
5598
+ "data-testid": testId
5599
+ }
5600
+ );
5601
+ }
5477
5602
  function deepClone(value) {
5478
5603
  try {
5479
5604
  return structuredClone(value);
@@ -5846,6 +5971,7 @@ function parseRecordFields(feature) {
5846
5971
  return [];
5847
5972
  }
5848
5973
  }
5974
+ const FLUSH_COLLAPSE = { header: "!px-0 !py-1", body: "!px-0 !py-1" };
5849
5975
  function RecordFieldsSection({ feature }) {
5850
5976
  const fields = parseRecordFields(feature);
5851
5977
  if (fields.length === 0) return null;
@@ -5855,7 +5981,7 @@ function RecordFieldsSection({ feature }) {
5855
5981
  size: "small",
5856
5982
  defaultActiveKey: [],
5857
5983
  ghost: true,
5858
- className: "[&_.ant-collapse-header]:!px-0 [&_.ant-collapse-header]:!py-1 [&_.ant-collapse-content-box]:!px-0 [&_.ant-collapse-content-box]:!py-1",
5984
+ classNames: FLUSH_COLLAPSE,
5859
5985
  items: [{
5860
5986
  key: "record-fields",
5861
5987
  label: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
@@ -6112,8 +6238,8 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
6112
6238
  ...feature.properties,
6113
6239
  name: name || void 0,
6114
6240
  description: description || void 0,
6115
- startDate: startDate || void 0,
6116
- endDate: endDate || void 0,
6241
+ startDate: ((overrides == null ? void 0 : overrides.startDate) ?? startDate) || void 0,
6242
+ endDate: ((overrides == null ? void 0 : overrides.endDate) ?? endDate) || void 0,
6117
6243
  "stroke": (overrides == null ? void 0 : overrides.strokeColor) ?? strokeColor,
6118
6244
  "stroke-width": (overrides == null ? void 0 : overrides.strokeWidth) ?? strokeWidth,
6119
6245
  "stroke-opacity": (overrides == null ? void 0 : overrides.strokeOpacity) ?? strokeOpacity,
@@ -6460,7 +6586,7 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
6460
6586
  size: "small",
6461
6587
  defaultActiveKey: startDate || endDate ? ["temporal"] : [],
6462
6588
  ghost: true,
6463
- className: "[&_.ant-collapse-header]:!px-0 [&_.ant-collapse-header]:!py-1 [&_.ant-collapse-content-box]:!px-0 [&_.ant-collapse-content-box]:!py-1",
6589
+ classNames: FLUSH_COLLAPSE,
6464
6590
  items: [{
6465
6591
  key: "temporal",
6466
6592
  label: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
@@ -6476,75 +6602,31 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
6476
6602
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
6477
6603
  /* @__PURE__ */ jsx("label", { className: "text-[13px] text-muted-foreground w-8 shrink-0", children: "Start" }),
6478
6604
  /* @__PURE__ */ jsx(
6479
- "input",
6605
+ FeatureDatePicker,
6480
6606
  {
6481
- type: "datetime-local",
6482
- value: startDate ? format(new Date(startDate), "yyyy-MM-dd'T'HH:mm") : "",
6483
- onChange: (e) => {
6484
- const val = e.target.value;
6485
- if (val) {
6486
- const newDate = new Date(val).toISOString();
6487
- setStartDate(newDate);
6488
- setTimeout(() => handleSave(), 0);
6489
- } else {
6490
- setStartDate("");
6491
- setTimeout(() => handleSave(), 0);
6492
- }
6607
+ value: startDate,
6608
+ onChange: (iso) => {
6609
+ setStartDate(iso);
6610
+ handleSave({ startDate: iso });
6493
6611
  },
6494
- className: "flex-1 h-6 text-[13px] px-2 rounded-md border border-input bg-background",
6495
6612
  disabled: !isEditMode,
6496
6613
  "data-testid": "input-feature-start-date"
6497
6614
  }
6498
- ),
6499
- startDate && isEditMode && /* @__PURE__ */ jsx(
6500
- Button,
6501
- {
6502
- type: "text",
6503
- icon: /* @__PURE__ */ jsx(X, { className: "w-3 h-3" }),
6504
- onClick: () => {
6505
- setStartDate("");
6506
- setTimeout(() => handleSave(), 0);
6507
- },
6508
- className: "!w-6 !h-6 !min-w-0 !p-0 shrink-0",
6509
- "data-testid": "button-clear-start-date"
6510
- }
6511
6615
  )
6512
6616
  ] }),
6513
6617
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
6514
6618
  /* @__PURE__ */ jsx("label", { className: "text-[13px] text-muted-foreground w-8 shrink-0", children: "End" }),
6515
6619
  /* @__PURE__ */ jsx(
6516
- "input",
6620
+ FeatureDatePicker,
6517
6621
  {
6518
- type: "datetime-local",
6519
- value: endDate ? format(new Date(endDate), "yyyy-MM-dd'T'HH:mm") : "",
6520
- onChange: (e) => {
6521
- const val = e.target.value;
6522
- if (val) {
6523
- const newDate = new Date(val).toISOString();
6524
- setEndDate(newDate);
6525
- setTimeout(() => handleSave(), 0);
6526
- } else {
6527
- setEndDate("");
6528
- setTimeout(() => handleSave(), 0);
6529
- }
6622
+ value: endDate,
6623
+ onChange: (iso) => {
6624
+ setEndDate(iso);
6625
+ handleSave({ endDate: iso });
6530
6626
  },
6531
- className: "flex-1 h-6 text-[13px] px-2 rounded-md border border-input bg-background",
6532
6627
  disabled: !isEditMode,
6533
6628
  "data-testid": "input-feature-end-date"
6534
6629
  }
6535
- ),
6536
- endDate && isEditMode && /* @__PURE__ */ jsx(
6537
- Button,
6538
- {
6539
- type: "text",
6540
- icon: /* @__PURE__ */ jsx(X, { className: "w-3 h-3" }),
6541
- onClick: () => {
6542
- setEndDate("");
6543
- setTimeout(() => handleSave(), 0);
6544
- },
6545
- className: "!w-6 !h-6 !min-w-0 !p-0 shrink-0",
6546
- "data-testid": "button-clear-end-date"
6547
- }
6548
6630
  )
6549
6631
  ] })
6550
6632
  ] })
@@ -7019,7 +7101,7 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
7019
7101
  size: "small",
7020
7102
  defaultActiveKey: ["inline-entity-card"],
7021
7103
  ghost: true,
7022
- className: "[&_.ant-collapse-header]:!px-0 [&_.ant-collapse-header]:!py-1 [&_.ant-collapse-content-box]:!px-0 [&_.ant-collapse-content-box]:!py-1",
7104
+ classNames: FLUSH_COLLAPSE,
7023
7105
  items: [{
7024
7106
  key: "inline-entity-card",
7025
7107
  label: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
@@ -7179,7 +7261,8 @@ function PropertiesPanel({ selectedFeatures, onUpdateProperties, onUpdateGeometr
7179
7261
  onChange: handleTabChange,
7180
7262
  onTabClick: handleTabClick,
7181
7263
  size: "small",
7182
- className: "flex-1 min-h-0 flex flex-col [&_.ant-tabs-nav]:px-2 [&_.ant-tabs-nav]:mb-0 [&_.ant-tabs-nav]:shrink-0 [&_.ant-tabs-content-holder]:flex-1 [&_.ant-tabs-content-holder]:min-h-0 [&_.ant-tabs-content-holder]:flex [&_.ant-tabs-content-holder]:flex-col [&_.ant-tabs-content]:flex-1 [&_.ant-tabs-content]:min-h-0 [&_.ant-tabs-content]:flex [&_.ant-tabs-content]:flex-col [&_.ant-tabs-tabpane-active]:flex-1 [&_.ant-tabs-tabpane-active]:min-h-0 [&_.ant-tabs-tabpane-active]:flex [&_.ant-tabs-tabpane-active]:flex-col",
7264
+ className: "flex-1 min-h-0 flex flex-col tabs-fill-column",
7265
+ classNames: { header: "!px-2 !mb-0 shrink-0" },
7183
7266
  items: [
7184
7267
  {
7185
7268
  key: "cards",
@@ -13237,18 +13320,19 @@ const MapEditorCanvas = forwardRef(function MapEditorCanvas2({
13237
13320
  const handleToggleLayers = useCallback(() => {
13238
13321
  setShowLayers((prev) => !prev);
13239
13322
  }, []);
13323
+ const antdPopupSelector = useAntdPopupSelector();
13240
13324
  useEffect(() => {
13241
13325
  if (!showLayers) return;
13242
13326
  const handlePointerDown = (e) => {
13243
13327
  const target = e.target;
13244
- if (target.closest('[data-testid="panel-layers"]') || target.closest('[data-testid="button-toggle-layers"]') || target.closest(".ant-dropdown, .ant5-dropdown, .ant-select-dropdown, .ant5-select-dropdown, .ant-modal-root, .ant5-modal-root, .ant-popover, .ant5-popover, .ant-tooltip, .ant5-tooltip, .ant-slider, .ant5-slider, .ant-color-picker, .ant5-color-picker")) {
13328
+ if (target.closest('[data-testid="panel-layers"]') || target.closest('[data-testid="button-toggle-layers"]') || target.closest(antdPopupSelector)) {
13245
13329
  return;
13246
13330
  }
13247
13331
  setShowLayers(false);
13248
13332
  };
13249
13333
  document.addEventListener("pointerdown", handlePointerDown);
13250
13334
  return () => document.removeEventListener("pointerdown", handlePointerDown);
13251
- }, [showLayers]);
13335
+ }, [showLayers, antdPopupSelector]);
13252
13336
  useEffect(() => {
13253
13337
  if (!isMapLoaded || !enableKeyboardShortcuts || !mapContainer.current) return;
13254
13338
  const container = mapContainer.current;