@m4l/gclick 0.30.0-beta-pkg-787-ajustes-mf-51.0 → 0.31.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/components/AddressLocation/AddressLocation.d.ts +4 -0
- package/components/AddressLocation/AddressLocation.d.ts.map +1 -1
- package/components/AddressLocation/AddressLocation.js +73 -41
- package/components/AddressLocation/AddressLocation.styles.d.ts.map +1 -1
- package/components/AddressLocation/AddressLocation.styles.js +8 -6
- package/components/AddressLocation/constants.d.ts +5 -0
- package/components/AddressLocation/constants.d.ts.map +1 -1
- package/components/AddressLocation/constants.js +3 -2
- package/components/AddressLocation/contexts/AddressLocationPinDragContext.d.ts +12 -0
- package/components/AddressLocation/contexts/AddressLocationPinDragContext.d.ts.map +1 -0
- package/components/AddressLocation/contexts/AddressLocationPinDragContext.js +13 -0
- package/components/AddressLocation/hooks/useAddressLocationMap.d.ts +8 -2
- package/components/AddressLocation/hooks/useAddressLocationMap.d.ts.map +1 -1
- package/components/AddressLocation/hooks/useAddressLocationMap.js +32 -28
- package/components/AddressLocation/hooks/useAddressLocationPinDrag.d.ts +10 -0
- package/components/AddressLocation/hooks/useAddressLocationPinDrag.d.ts.map +1 -0
- package/components/AddressLocation/hooks/useAddressLocationPinDrag.js +63 -0
- package/components/AddressLocation/hooks/useAddressLocationSearch.d.ts +1 -1
- package/components/AddressLocation/hooks/useAddressLocationSearch.d.ts.map +1 -1
- package/components/AddressLocation/hooks/useAddressLocationSearch.js +25 -19
- package/components/AddressLocation/hooks/useAddressLocationState.d.ts +1 -1
- package/components/AddressLocation/hooks/useAddressLocationState.d.ts.map +1 -1
- package/components/AddressLocation/hooks/useAddressLocationState.js +12 -10
- package/components/AddressLocation/subcomponents/AddressLocationPinRender.d.ts +1 -0
- package/components/AddressLocation/subcomponents/AddressLocationPinRender.d.ts.map +1 -1
- package/components/AddressLocation/subcomponents/AddressLocationPinRender.js +42 -24
- package/components/AddressLocation/types.d.ts +63 -3
- package/components/AddressLocation/types.d.ts.map +1 -1
- package/components/maps/components/GpsMap/subcomponents/TileLayers/TileLayers.d.ts +1 -1
- package/components/maps/components/GpsMap/subcomponents/TileLayers/TileLayers.d.ts.map +1 -1
- package/components/maps/components/GpsMap/subcomponents/TileLayers/TileLayers.js +14 -19
- package/components/maps/components/GpsMap/subcomponents/TileLayers/hooks/useMapThemeMode.d.ts +9 -0
- package/components/maps/components/GpsMap/subcomponents/TileLayers/hooks/useMapThemeMode.d.ts.map +1 -0
- package/components/maps/components/GpsMap/subcomponents/TileLayers/hooks/useMapThemeMode.js +19 -0
- package/helpers/resolveDeviceIcon/resolveDeviceIcon.js +12 -12
- package/package.json +1 -1
- package/_virtual/react-dom-server-legacy.browser.development.js +0 -4
- package/_virtual/react-dom-server-legacy.browser.production.js +0 -4
- package/_virtual/react-dom-server.browser.development.js +0 -4
- package/_virtual/react-dom-server.browser.production.js +0 -4
- package/_virtual/server.browser.js +0 -5
- package/_virtual/server.browser2.js +0 -4
|
@@ -3,6 +3,10 @@ import { AddressLocationProps } from './types';
|
|
|
3
3
|
* Compound component combining async address search with an embedded GpsMap.
|
|
4
4
|
* Manages its own isolated MapProvider — consumers do not need to provide one.
|
|
5
5
|
* The map is fully configurable via mapProps (all GpsMap props except style).
|
|
6
|
+
* With reverseEndPoint the pin is draggable: on drop, a single reverse-geocoding request
|
|
7
|
+
* resolves the address under the pin and it becomes the value.
|
|
8
|
+
* The Google Maps key comes from the environment context by default; a consumer can
|
|
9
|
+
* override it through mapProviderConfig.googleMapsApiKey.
|
|
6
10
|
*/
|
|
7
11
|
export declare function AddressLocation({ mapProviderConfig, storeId: storeIdProp, ...innerProps }: AddressLocationProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
8
12
|
//# sourceMappingURL=AddressLocation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddressLocation.d.ts","sourceRoot":"","sources":["../../../../../../packages/gclick/src/components/AddressLocation/AddressLocation.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AddressLocation.d.ts","sourceRoot":"","sources":["../../../../../../packages/gclick/src/components/AddressLocation/AddressLocation.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAEV,oBAAoB,EAGrB,MAAM,SAAS,CAAC;AA6FjB;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,EAC9B,iBAAiB,EACjB,OAAO,EAAE,WAAW,EACpB,GAAG,UAAU,EACd,EAAE,oBAAoB,oDAiBtB"}
|
|
@@ -1,68 +1,100 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
1
|
+
import { jsx as e, jsxs as T } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { useRef as K, useMemo as b } from "react";
|
|
3
|
+
import { useEnvironment as x } from "@m4l/core";
|
|
4
|
+
import { AutocompleteAsync as E, Icon as V } from "@m4l/components";
|
|
5
|
+
import { TravelMapOutlined as C, TravelLocationOutlined as H } from "@m4l/icons";
|
|
6
|
+
import { GpsMap as j } from "../maps/components/GpsMap/GpsMap.js";
|
|
7
|
+
import { MapProvider as G } from "../maps/components/GpsMap/contexts/MapContext/MapContext.js";
|
|
8
|
+
import { useAddressLocationState as O } from "./hooks/useAddressLocationState.js";
|
|
9
|
+
import { useAddressLocationSearch as w } from "./hooks/useAddressLocationSearch.js";
|
|
10
|
+
import { useAddressLocationPinDrag as F } from "./hooks/useAddressLocationPinDrag.js";
|
|
11
|
+
import { AddressLocationPinDragContext as P } from "./contexts/AddressLocationPinDragContext.js";
|
|
12
|
+
import { AddressLocationRootStyled as W, AddressLocationMapToggleStyled as Z, AddressLocationMapWrapperStyled as $ } from "./slots/AddressLocationSlots.js";
|
|
13
|
+
function k({
|
|
11
14
|
mapHeight: o,
|
|
12
|
-
defaultMapVisible:
|
|
13
|
-
mapProps:
|
|
14
|
-
value:
|
|
15
|
-
onChange:
|
|
16
|
-
disabled:
|
|
17
|
-
detailEndPoint:
|
|
18
|
-
|
|
15
|
+
defaultMapVisible: s = !1,
|
|
16
|
+
mapProps: a,
|
|
17
|
+
value: r,
|
|
18
|
+
onChange: t,
|
|
19
|
+
disabled: n,
|
|
20
|
+
detailEndPoint: A,
|
|
21
|
+
reverseEndPoint: u,
|
|
22
|
+
reverseParms: M,
|
|
23
|
+
...d
|
|
19
24
|
}) {
|
|
20
|
-
const {
|
|
21
|
-
|
|
25
|
+
const { responseToCamelCase: l, isRemote: p } = d, {
|
|
26
|
+
draggable: m,
|
|
27
|
+
isDraggingRef: h,
|
|
28
|
+
centerKeepZoomRef: L,
|
|
29
|
+
onDragStart: c,
|
|
30
|
+
onDragEnd: g
|
|
31
|
+
} = F({
|
|
32
|
+
reverseEndPoint: u,
|
|
33
|
+
reverseParms: M,
|
|
34
|
+
onChange: t,
|
|
35
|
+
disabled: n,
|
|
36
|
+
responseToCamelCase: l,
|
|
37
|
+
isRemote: p
|
|
38
|
+
}), { isMapVisible: i, setIsMapVisible: S, mapCenter: v, mapHeightResolved: y } = O({
|
|
39
|
+
value: r,
|
|
40
|
+
defaultMapVisible: s,
|
|
41
|
+
mapHeight: o,
|
|
42
|
+
isDraggingRef: h,
|
|
43
|
+
centerKeepZoomRef: L
|
|
44
|
+
}), { handleChange: D } = w({
|
|
45
|
+
onChange: t,
|
|
46
|
+
detailEndPoint: A,
|
|
47
|
+
responseToCamelCase: l,
|
|
48
|
+
isRemote: p
|
|
49
|
+
}), f = { isMapVisible: i, mapHeight: y }, I = b(
|
|
50
|
+
() => ({ draggable: m, onDragStart: c, onDragEnd: g }),
|
|
51
|
+
[m, c, g]
|
|
52
|
+
);
|
|
53
|
+
return /* @__PURE__ */ T(W, { children: [
|
|
22
54
|
/* @__PURE__ */ e(
|
|
23
|
-
|
|
55
|
+
E,
|
|
24
56
|
{
|
|
25
57
|
resultField: "data.items",
|
|
26
|
-
startAdornment: /* @__PURE__ */ e(
|
|
27
|
-
value:
|
|
28
|
-
disabled:
|
|
29
|
-
onChange:
|
|
58
|
+
startAdornment: /* @__PURE__ */ e(V, { src: /* @__PURE__ */ e(H, {}) }),
|
|
59
|
+
value: r ?? null,
|
|
60
|
+
disabled: n,
|
|
61
|
+
onChange: D,
|
|
30
62
|
endAdornment: /* @__PURE__ */ e(
|
|
31
|
-
|
|
63
|
+
Z,
|
|
32
64
|
{
|
|
33
|
-
ownerState:
|
|
34
|
-
isToggled:
|
|
35
|
-
onToggle: () =>
|
|
36
|
-
disabled:
|
|
37
|
-
icon: /* @__PURE__ */ e(
|
|
65
|
+
ownerState: f,
|
|
66
|
+
isToggled: i,
|
|
67
|
+
onToggle: () => S((R) => !R),
|
|
68
|
+
disabled: n,
|
|
69
|
+
icon: /* @__PURE__ */ e(C, {}),
|
|
38
70
|
"aria-label": "toggle map"
|
|
39
71
|
}
|
|
40
72
|
),
|
|
41
|
-
...
|
|
73
|
+
...d
|
|
42
74
|
}
|
|
43
75
|
),
|
|
44
|
-
|
|
76
|
+
i && /* @__PURE__ */ e($, { ownerState: f, children: /* @__PURE__ */ e(P.Provider, { value: I, children: /* @__PURE__ */ e(j, { center: v, ...a }) }) })
|
|
45
77
|
] });
|
|
46
78
|
}
|
|
47
|
-
function
|
|
79
|
+
function re({
|
|
48
80
|
mapProviderConfig: o,
|
|
49
|
-
storeId:
|
|
50
|
-
...
|
|
81
|
+
storeId: s,
|
|
82
|
+
...a
|
|
51
83
|
}) {
|
|
52
|
-
const t =
|
|
84
|
+
const { googleMapsApiKey: r } = x(), t = K(
|
|
53
85
|
`address-location-${Math.random().toString(36).slice(2, 9)}`
|
|
54
86
|
).current;
|
|
55
87
|
return /* @__PURE__ */ e(
|
|
56
|
-
|
|
88
|
+
G,
|
|
57
89
|
{
|
|
58
|
-
storeId:
|
|
59
|
-
googleMapsApiKey: o?.googleMapsApiKey,
|
|
90
|
+
storeId: s ?? t,
|
|
91
|
+
googleMapsApiKey: o?.googleMapsApiKey ?? r,
|
|
60
92
|
googleMapVersion: o?.googleMapVersion,
|
|
61
93
|
storeDevtoolsEnabled: o?.storeDevtoolsEnabled ?? !1,
|
|
62
|
-
children: /* @__PURE__ */ e(
|
|
94
|
+
children: /* @__PURE__ */ e(k, { ...a })
|
|
63
95
|
}
|
|
64
96
|
);
|
|
65
97
|
}
|
|
66
98
|
export {
|
|
67
|
-
|
|
99
|
+
re as AddressLocation
|
|
68
100
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddressLocation.styles.d.ts","sourceRoot":"","sources":["../../../../../../packages/gclick/src/components/AddressLocation/AddressLocation.styles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAGrD;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,
|
|
1
|
+
{"version":3,"file":"AddressLocation.styles.d.ts","sourceRoot":"","sources":["../../../../../../packages/gclick/src/components/AddressLocation/AddressLocation.styles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAGrD;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,qBAgCnC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { MIN_MAP_HEIGHT as t, DEFAULT_MAP_HEIGHT as
|
|
2
|
-
const
|
|
1
|
+
import { MIN_MAP_HEIGHT as t, DEFAULT_MAP_HEIGHT as a } from "./constants.js";
|
|
2
|
+
const r = {
|
|
3
3
|
/** Root flex container for the AddressLocation compound component. */
|
|
4
4
|
root: () => ({
|
|
5
5
|
display: "flex",
|
|
@@ -19,17 +19,19 @@ const a = {
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
}),
|
|
22
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* Map panel wrapper — applies the radius and dynamic height. It has no border by design:
|
|
24
|
+
* a fixed light border (from the original Figma) looked like a bright ring in dark mode.
|
|
25
|
+
*/
|
|
23
26
|
mapWrapper: ({ ownerState: i }) => ({
|
|
24
|
-
border: "2px solid #f1f5f9",
|
|
25
27
|
borderRadius: 12,
|
|
26
28
|
overflow: "hidden",
|
|
27
29
|
width: "100%",
|
|
28
30
|
flexShrink: 0,
|
|
29
|
-
height: i?.mapHeight ??
|
|
31
|
+
height: i?.mapHeight ?? a,
|
|
30
32
|
minHeight: t
|
|
31
33
|
})
|
|
32
34
|
};
|
|
33
35
|
export {
|
|
34
|
-
|
|
36
|
+
r as addressLocationStyles
|
|
35
37
|
};
|
|
@@ -8,6 +8,11 @@ export declare const ADDRESS_LOCATION_SEARCH_LIMIT = 5;
|
|
|
8
8
|
export declare const ADDRESS_LOCATION_PIN_LAYER_ID = "address-location-pin";
|
|
9
9
|
/** Default zoom level applied when the map centers on a selected address. */
|
|
10
10
|
export declare const ADDRESS_LOCATION_DEFAULT_ZOOM = 16;
|
|
11
|
+
/**
|
|
12
|
+
* Stable feature id for the address pin. The id never follows the selected item so the
|
|
13
|
+
* Leaflet Marker stays mounted across value changes — a remount mid-drag would cut the drag.
|
|
14
|
+
*/
|
|
15
|
+
export declare const ADDRESS_LOCATION_PIN_FEATURE_ID = "address-location-pin-feature";
|
|
11
16
|
/** MUI component key for theming and slot identification. */
|
|
12
17
|
export declare const ADDRESS_LOCATION_KEY_COMPONENT: "M4LAddressLocation";
|
|
13
18
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../../packages/gclick/src/components/AddressLocation/constants.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAChG,eAAO,MAAM,cAAc,MAAM,CAAC;AAElC,uFAAuF;AACvF,eAAO,MAAM,kBAAkB,MAAM,CAAC;AAEtC,0DAA0D;AAC1D,eAAO,MAAM,6BAA6B,IAAI,CAAC;AAE/C,8EAA8E;AAC9E,eAAO,MAAM,6BAA6B,yBAAyB,CAAC;AAEpE,6EAA6E;AAC7E,eAAO,MAAM,6BAA6B,KAAK,CAAC;AAEhD,6DAA6D;AAC7D,eAAO,MAAM,8BAA8B,EAAG,oBAA6B,CAAC"}
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../../packages/gclick/src/components/AddressLocation/constants.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAChG,eAAO,MAAM,cAAc,MAAM,CAAC;AAElC,uFAAuF;AACvF,eAAO,MAAM,kBAAkB,MAAM,CAAC;AAEtC,0DAA0D;AAC1D,eAAO,MAAM,6BAA6B,IAAI,CAAC;AAE/C,8EAA8E;AAC9E,eAAO,MAAM,6BAA6B,yBAAyB,CAAC;AAEpE,6EAA6E;AAC7E,eAAO,MAAM,6BAA6B,KAAK,CAAC;AAEhD;;;GAGG;AACH,eAAO,MAAM,+BAA+B,iCAAiC,CAAC;AAE9E,6DAA6D;AAC7D,eAAO,MAAM,8BAA8B,EAAG,oBAA6B,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
const _ = 250, A = 325, o = "address-location-pin", E = 16,
|
|
1
|
+
const _ = 250, A = 325, o = "address-location-pin", E = 16, s = "address-location-pin-feature", D = "M4LAddressLocation";
|
|
2
2
|
export {
|
|
3
3
|
E as ADDRESS_LOCATION_DEFAULT_ZOOM,
|
|
4
|
-
|
|
4
|
+
D as ADDRESS_LOCATION_KEY_COMPONENT,
|
|
5
|
+
s as ADDRESS_LOCATION_PIN_FEATURE_ID,
|
|
5
6
|
o as ADDRESS_LOCATION_PIN_LAYER_ID,
|
|
6
7
|
A as DEFAULT_MAP_HEIGHT,
|
|
7
8
|
_ as MIN_MAP_HEIGHT
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AddressLocationPinDragHandlers } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Default handlers: pin not draggable and no-op callbacks, so AddressLocationPinRender
|
|
4
|
+
* keeps working when rendered without a provider (e.g. isolated unit tests).
|
|
5
|
+
*/
|
|
6
|
+
export declare const ADDRESS_LOCATION_PIN_DRAG_DEFAULT: AddressLocationPinDragHandlers;
|
|
7
|
+
/**
|
|
8
|
+
* Carries the pin drag handlers from AddressLocation down to the pin marker.
|
|
9
|
+
* The marker is rendered by the map store (renderFeature), so it cannot receive props directly.
|
|
10
|
+
*/
|
|
11
|
+
export declare const AddressLocationPinDragContext: import('react').Context<AddressLocationPinDragHandlers>;
|
|
12
|
+
//# sourceMappingURL=AddressLocationPinDragContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AddressLocationPinDragContext.d.ts","sourceRoot":"","sources":["../../../../../../../packages/gclick/src/components/AddressLocation/contexts/AddressLocationPinDragContext.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,UAAU,CAAC;AAE/D;;;GAGG;AACH,eAAO,MAAM,iCAAiC,EAAE,8BAI/C,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,6BAA6B,yDAEzC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createContext as o } from "react";
|
|
2
|
+
const r = {
|
|
3
|
+
draggable: !1,
|
|
4
|
+
onDragStart: () => {
|
|
5
|
+
},
|
|
6
|
+
onDragEnd: () => Promise.resolve(!0)
|
|
7
|
+
}, e = o(
|
|
8
|
+
r
|
|
9
|
+
);
|
|
10
|
+
export {
|
|
11
|
+
r as ADDRESS_LOCATION_PIN_DRAG_DEFAULT,
|
|
12
|
+
e as AddressLocationPinDragContext
|
|
13
|
+
};
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { AddressLocationDragFlags } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Manages the address pin layer inside GpsMap and centers the map on every value change.
|
|
4
|
+
* While the pin is being dragged the store is left untouched (Leaflet owns the marker
|
|
5
|
+
* position); a value change that comes from a drop recenters on the pin keeping the
|
|
6
|
+
* current zoom, while a selection also applies the default zoom.
|
|
7
|
+
*/
|
|
8
|
+
export declare function useAddressLocationMap(selectedItem: unknown | null | undefined, { isDraggingRef, centerKeepZoomRef }?: AddressLocationDragFlags): void;
|
|
3
9
|
//# sourceMappingURL=useAddressLocationMap.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAddressLocationMap.d.ts","sourceRoot":"","sources":["../../../../../../../packages/gclick/src/components/AddressLocation/hooks/useAddressLocationMap.ts"],"names":[],"mappings":"AAUA,
|
|
1
|
+
{"version":3,"file":"useAddressLocationMap.d.ts","sourceRoot":"","sources":["../../../../../../../packages/gclick/src/components/AddressLocation/hooks/useAddressLocationMap.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAEzD;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,YAAY,EAAE,OAAO,GAAG,IAAI,GAAG,SAAS,EACxC,EAAE,aAAa,EAAE,iBAAiB,EAAE,GAAE,wBAA6B,QAiFpE"}
|
|
@@ -1,49 +1,53 @@
|
|
|
1
|
-
import { useRef as
|
|
2
|
-
import { useModuleDictionary as
|
|
3
|
-
import { useMapStore as
|
|
4
|
-
import { AddressLocationPinRender as
|
|
5
|
-
import { ADDRESS_LOCATION_PIN_LAYER_ID as
|
|
6
|
-
import { ADDRESS_LOCATION_DICCTIONARY as
|
|
7
|
-
function
|
|
8
|
-
const e =
|
|
9
|
-
c.current =
|
|
10
|
-
layerId:
|
|
1
|
+
import { useRef as A, useEffect as m } from "react";
|
|
2
|
+
import { useModuleDictionary as L } from "@m4l/core";
|
|
3
|
+
import { useMapStore as d } from "../../maps/components/GpsMap/hooks/useMapStore/index.js";
|
|
4
|
+
import { AddressLocationPinRender as p } from "../subcomponents/AddressLocationPinRender.js";
|
|
5
|
+
import { ADDRESS_LOCATION_PIN_LAYER_ID as o, ADDRESS_LOCATION_PIN_FEATURE_ID as _, ADDRESS_LOCATION_DEFAULT_ZOOM as D } from "../constants.js";
|
|
6
|
+
import { ADDRESS_LOCATION_DICCTIONARY as y } from "../dictionary.js";
|
|
7
|
+
function R(a, { isDraggingRef: s, centerKeepZoomRef: r } = {}) {
|
|
8
|
+
const e = d((i) => i.mapActions), { getLabel: u } = L(), n = A(!1), c = A(u);
|
|
9
|
+
c.current = u, m(() => (n.current || (e.addLayer({
|
|
10
|
+
layerId: o,
|
|
11
11
|
// Layer title shown in the GpsMap Layers panel, resolved from the dictionary.
|
|
12
|
-
name: c.current(
|
|
12
|
+
name: c.current(y.LABEL_PIN_LAYER),
|
|
13
13
|
autoFocus: !1,
|
|
14
|
-
renderFeature:
|
|
15
|
-
}),
|
|
16
|
-
e.removeLayer(
|
|
17
|
-
}), [e]),
|
|
18
|
-
if (
|
|
19
|
-
|
|
14
|
+
renderFeature: p
|
|
15
|
+
}), n.current = !0), () => {
|
|
16
|
+
e.removeLayer(o), n.current = !1;
|
|
17
|
+
}), [e]), m(() => {
|
|
18
|
+
if (s?.current)
|
|
19
|
+
return;
|
|
20
|
+
const i = r?.current ?? !1;
|
|
21
|
+
if (r && (r.current = !1), !a) {
|
|
22
|
+
e.setDataLayer(o, {
|
|
20
23
|
object: { type: "FeatureCollection", features: [] }
|
|
21
24
|
});
|
|
22
25
|
return;
|
|
23
26
|
}
|
|
24
|
-
const
|
|
25
|
-
if (!
|
|
27
|
+
const t = a;
|
|
28
|
+
if (!t.coordinates)
|
|
26
29
|
return;
|
|
27
|
-
const { lat:
|
|
28
|
-
e.setDataLayer(
|
|
30
|
+
const { lat: f, lng: l } = t.coordinates;
|
|
31
|
+
e.setDataLayer(o, {
|
|
29
32
|
object: {
|
|
30
33
|
type: "FeatureCollection",
|
|
31
34
|
features: [
|
|
32
35
|
{
|
|
33
36
|
type: "Feature",
|
|
34
|
-
id:
|
|
37
|
+
// Stable id: the item id is kept in properties so the Marker is never remounted.
|
|
38
|
+
id: _,
|
|
35
39
|
// GeoJSON uses [longitude, latitude] order
|
|
36
|
-
geometry: { type: "Point", coordinates: [
|
|
37
|
-
properties: { label:
|
|
40
|
+
geometry: { type: "Point", coordinates: [l, f] },
|
|
41
|
+
properties: { label: t.label, itemId: t.id }
|
|
38
42
|
}
|
|
39
43
|
]
|
|
40
44
|
}
|
|
41
45
|
}), e.moveToPoint(
|
|
42
|
-
{ lat:
|
|
43
|
-
{ zoom:
|
|
46
|
+
{ lat: f, lng: l },
|
|
47
|
+
i ? {} : { zoom: D }
|
|
44
48
|
);
|
|
45
|
-
}, [
|
|
49
|
+
}, [a, e, s, r]);
|
|
46
50
|
}
|
|
47
51
|
export {
|
|
48
|
-
|
|
52
|
+
R as useAddressLocationMap
|
|
49
53
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { UseAddressLocationPinDragProps, UseAddressLocationPinDragReturn } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Owns the pin drag lifecycle: a single reverse-geocoding request when the pin is dropped.
|
|
4
|
+
* Nothing is requested while the pin moves (the developer chose one request per drop to
|
|
5
|
+
* keep backend traffic minimal). The value handed to onChange is always the backend
|
|
6
|
+
* location as-is — the frontend never builds or adjusts coordinates.
|
|
7
|
+
* Must be called inside MapProvider.
|
|
8
|
+
*/
|
|
9
|
+
export declare function useAddressLocationPinDrag({ reverseEndPoint, reverseParms, onChange, disabled, responseToCamelCase, isRemote, }: UseAddressLocationPinDragProps): UseAddressLocationPinDragReturn;
|
|
10
|
+
//# sourceMappingURL=useAddressLocationPinDrag.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAddressLocationPinDrag.d.ts","sourceRoot":"","sources":["../../../../../../../packages/gclick/src/components/AddressLocation/hooks/useAddressLocationPinDrag.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEV,8BAA8B,EAC9B,+BAA+B,EAChC,MAAM,UAAU,CAAC;AAOlB;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,EACxC,eAAe,EACf,YAAY,EACZ,QAAQ,EACR,QAAQ,EACR,mBAAmB,EACnB,QAAe,GAChB,EAAE,8BAA8B,GAAG,+BAA+B,CAyGlE"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { useRef as n, useCallback as u, useEffect as k } from "react";
|
|
2
|
+
import { useNetwork as h } from "@m4l/core";
|
|
3
|
+
function x({
|
|
4
|
+
reverseEndPoint: e,
|
|
5
|
+
reverseParms: a,
|
|
6
|
+
onChange: l,
|
|
7
|
+
disabled: d,
|
|
8
|
+
responseToCamelCase: s,
|
|
9
|
+
isRemote: f = !0
|
|
10
|
+
}) {
|
|
11
|
+
const { networkOperation: i } = h(), c = n(!1), g = n(!1), b = n(l);
|
|
12
|
+
b.current = l;
|
|
13
|
+
const p = n(a);
|
|
14
|
+
p.current = a;
|
|
15
|
+
const t = n(null), m = !!e && !d, R = u(
|
|
16
|
+
async (o) => {
|
|
17
|
+
if (!e)
|
|
18
|
+
return null;
|
|
19
|
+
t.current?.abort();
|
|
20
|
+
const r = new AbortController();
|
|
21
|
+
t.current = r;
|
|
22
|
+
try {
|
|
23
|
+
const D = await i({
|
|
24
|
+
method: "GET",
|
|
25
|
+
endPoint: e,
|
|
26
|
+
isRemote: f,
|
|
27
|
+
responseToCamelCase: s,
|
|
28
|
+
parms: { lat: o.lat, lng: o.lng, ...p.current },
|
|
29
|
+
signal: r.signal
|
|
30
|
+
});
|
|
31
|
+
return r.signal.aborted ? null : D.data?.location ?? null;
|
|
32
|
+
} catch {
|
|
33
|
+
return null;
|
|
34
|
+
} finally {
|
|
35
|
+
t.current === r && (t.current = null);
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
[i, e, f, s]
|
|
39
|
+
), w = u(() => {
|
|
40
|
+
c.current = !0;
|
|
41
|
+
}, []), y = u(
|
|
42
|
+
async (o) => {
|
|
43
|
+
const r = await R(o);
|
|
44
|
+
return c.current = !1, r ? (g.current = !0, b.current?.(r), !0) : !1;
|
|
45
|
+
},
|
|
46
|
+
[R]
|
|
47
|
+
);
|
|
48
|
+
return k(
|
|
49
|
+
() => () => {
|
|
50
|
+
t.current?.abort();
|
|
51
|
+
},
|
|
52
|
+
[]
|
|
53
|
+
), {
|
|
54
|
+
draggable: m,
|
|
55
|
+
isDraggingRef: c,
|
|
56
|
+
centerKeepZoomRef: g,
|
|
57
|
+
onDragStart: w,
|
|
58
|
+
onDragEnd: y
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
export {
|
|
62
|
+
x as useAddressLocationPinDrag
|
|
63
|
+
};
|
|
@@ -4,7 +4,7 @@ import { UseAddressLocationSearchProps } from '../types';
|
|
|
4
4
|
* When detailEndPoint is provided, requests location detail (coordinates) via useNetwork before calling onChange.
|
|
5
5
|
* Must be called inside MapProvider.
|
|
6
6
|
*/
|
|
7
|
-
export declare function useAddressLocationSearch({ onChange, detailEndPoint }: UseAddressLocationSearchProps): {
|
|
7
|
+
export declare function useAddressLocationSearch({ onChange, detailEndPoint, responseToCamelCase, isRemote, }: UseAddressLocationSearchProps): {
|
|
8
8
|
handleChange: (_event: unknown, newValue: unknown | unknown[] | null) => Promise<void>;
|
|
9
9
|
};
|
|
10
10
|
//# sourceMappingURL=useAddressLocationSearch.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAddressLocationSearch.d.ts","sourceRoot":"","sources":["../../../../../../../packages/gclick/src/components/AddressLocation/hooks/useAddressLocationSearch.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,UAAU,CAAC;AAE9D;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,
|
|
1
|
+
{"version":3,"file":"useAddressLocationSearch.d.ts","sourceRoot":"","sources":["../../../../../../../packages/gclick/src/components/AddressLocation/hooks/useAddressLocationSearch.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,UAAU,CAAC;AAE9D;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,EACvC,QAAQ,EACR,cAAc,EACd,mBAAmB,EACnB,QAAe,GAChB,EAAE,6BAA6B;2BAKb,OAAO,YAAY,OAAO,GAAG,OAAO,EAAE,GAAG,IAAI;EAiC/D"}
|
|
@@ -1,33 +1,39 @@
|
|
|
1
|
-
import { useCallback as
|
|
2
|
-
import { useNetwork as
|
|
3
|
-
function
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { useCallback as u } from "react";
|
|
2
|
+
import { useNetwork as d } from "@m4l/core";
|
|
3
|
+
function h({
|
|
4
|
+
onChange: t,
|
|
5
|
+
detailEndPoint: o,
|
|
6
|
+
responseToCamelCase: c,
|
|
7
|
+
isRemote: e = !0
|
|
8
|
+
}) {
|
|
9
|
+
const { networkOperation: n } = d();
|
|
10
|
+
return { handleChange: u(
|
|
11
|
+
async (m, s) => {
|
|
12
|
+
const r = Array.isArray(s) ? null : s;
|
|
13
|
+
if (!r || !o) {
|
|
14
|
+
t?.(r);
|
|
10
15
|
return;
|
|
11
16
|
}
|
|
12
|
-
const
|
|
13
|
-
if (!
|
|
14
|
-
|
|
17
|
+
const a = r.id;
|
|
18
|
+
if (!a) {
|
|
19
|
+
t?.(r);
|
|
15
20
|
return;
|
|
16
21
|
}
|
|
17
22
|
try {
|
|
18
|
-
const
|
|
23
|
+
const i = await n({
|
|
19
24
|
method: "GET",
|
|
20
|
-
endPoint: `${
|
|
21
|
-
isRemote:
|
|
25
|
+
endPoint: `${o}/${encodeURIComponent(a)}`,
|
|
26
|
+
isRemote: e,
|
|
27
|
+
responseToCamelCase: c
|
|
22
28
|
});
|
|
23
|
-
|
|
29
|
+
t?.(i.data?.location ?? r);
|
|
24
30
|
} catch {
|
|
25
|
-
|
|
31
|
+
t?.(r);
|
|
26
32
|
}
|
|
27
33
|
},
|
|
28
|
-
[
|
|
34
|
+
[t, o, n, e, c]
|
|
29
35
|
) };
|
|
30
36
|
}
|
|
31
37
|
export {
|
|
32
|
-
|
|
38
|
+
h as useAddressLocationSearch
|
|
33
39
|
};
|
|
@@ -4,5 +4,5 @@ import { UseAddressLocationStateProps, UseAddressLocationStateReturn } from '../
|
|
|
4
4
|
* Also wires the pin layer lifecycle via useAddressLocationMap.
|
|
5
5
|
* Must be called inside MapProvider.
|
|
6
6
|
*/
|
|
7
|
-
export declare function useAddressLocationState({ value, defaultMapVisible, mapHeight, }: UseAddressLocationStateProps): UseAddressLocationStateReturn;
|
|
7
|
+
export declare function useAddressLocationState({ value, defaultMapVisible, mapHeight, isDraggingRef, centerKeepZoomRef, }: UseAddressLocationStateProps): UseAddressLocationStateReturn;
|
|
8
8
|
//# sourceMappingURL=useAddressLocationState.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAddressLocationState.d.ts","sourceRoot":"","sources":["../../../../../../../packages/gclick/src/components/AddressLocation/hooks/useAddressLocationState.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,4BAA4B,EAC5B,6BAA6B,EAC9B,MAAM,UAAU,CAAC;AAElB;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,EACtC,KAAK,EACL,iBAAyB,EACzB,SAAS,
|
|
1
|
+
{"version":3,"file":"useAddressLocationState.d.ts","sourceRoot":"","sources":["../../../../../../../packages/gclick/src/components/AddressLocation/hooks/useAddressLocationState.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,4BAA4B,EAC5B,6BAA6B,EAC9B,MAAM,UAAU,CAAC;AAElB;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,EACtC,KAAK,EACL,iBAAyB,EACzB,SAAS,EACT,aAAa,EACb,iBAAiB,GAClB,EAAE,4BAA4B,GAAG,6BAA6B,CAa9D"}
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
import { DEFAULT_MAP_HEIGHT as
|
|
3
|
-
import { useAddressLocationMap as
|
|
4
|
-
function
|
|
1
|
+
import { useState as m } from "react";
|
|
2
|
+
import { DEFAULT_MAP_HEIGHT as p, MIN_MAP_HEIGHT as l } from "../constants.js";
|
|
3
|
+
import { useAddressLocationMap as M } from "./useAddressLocationMap.js";
|
|
4
|
+
function u({
|
|
5
5
|
value: t,
|
|
6
6
|
defaultMapVisible: e = !1,
|
|
7
|
-
mapHeight: s
|
|
7
|
+
mapHeight: s,
|
|
8
|
+
isDraggingRef: i,
|
|
9
|
+
centerKeepZoomRef: a
|
|
8
10
|
}) {
|
|
9
|
-
const [
|
|
10
|
-
|
|
11
|
-
const o = t,
|
|
12
|
-
return { isMapVisible:
|
|
11
|
+
const [n, r] = m(e);
|
|
12
|
+
M(t, { isDraggingRef: i, centerKeepZoomRef: a });
|
|
13
|
+
const o = t, d = o?.coordinates?.lat !== void 0 && o?.coordinates?.lng !== void 0 ? [o.coordinates.lat, o.coordinates.lng] : void 0, c = Math.max(s ?? p, l);
|
|
14
|
+
return { isMapVisible: n, setIsMapVisible: r, mapCenter: d, mapHeightResolved: c };
|
|
13
15
|
}
|
|
14
16
|
export {
|
|
15
|
-
|
|
17
|
+
u as useAddressLocationState
|
|
16
18
|
};
|
|
@@ -2,6 +2,7 @@ import { ComponentRenderPropFeature } from '../../maps/components/GpsMap/context
|
|
|
2
2
|
/**
|
|
3
3
|
* Renders the selected address pin inside GpsMap using a custom drop-pin SVG marker.
|
|
4
4
|
* Used as renderFeature for the ADDRESS_LOCATION_PIN_LAYER_ID layer.
|
|
5
|
+
* When the drag context enables it, the pin is draggable and reports drag events.
|
|
5
6
|
*/
|
|
6
7
|
export declare const AddressLocationPinRender: ComponentRenderPropFeature;
|
|
7
8
|
//# sourceMappingURL=AddressLocationPinRender.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddressLocationPinRender.d.ts","sourceRoot":"","sources":["../../../../../../../packages/gclick/src/components/AddressLocation/subcomponents/AddressLocationPinRender.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AddressLocationPinRender.d.ts","sourceRoot":"","sources":["../../../../../../../packages/gclick/src/components/AddressLocation/subcomponents/AddressLocationPinRender.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EACV,0BAA0B,EAE3B,MAAM,kDAAkD,CAAC;AAU1D;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,EAAE,0BAuFtC,CAAC"}
|
|
@@ -1,30 +1,48 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { jsx as v } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { useContext as j, useRef as A, useMemo as p } from "react";
|
|
3
|
+
import { Marker as h } from "react-leaflet";
|
|
4
|
+
import { shallow as x } from "zustand/shallow";
|
|
5
|
+
import { useMapStore as C } from "../../maps/components/GpsMap/hooks/useMapStore/index.js";
|
|
6
|
+
import { useAddressLocationMarkerIcon as M } from "../hooks/useAddressLocationMarkerIcon.js";
|
|
7
|
+
import { AddressLocationPinDragContext as P } from "../contexts/AddressLocationPinDragContext.js";
|
|
8
|
+
function k(n) {
|
|
9
|
+
const { lat: s, lng: a } = n.target.getLatLng();
|
|
10
|
+
return { lat: s, lng: a };
|
|
11
|
+
}
|
|
12
|
+
const N = ({
|
|
13
|
+
id: n,
|
|
14
|
+
layerId: s
|
|
9
15
|
}) => {
|
|
10
|
-
const
|
|
11
|
-
const o =
|
|
12
|
-
return o && o.object.type === "FeatureCollection" ? o.object.features.find((
|
|
13
|
-
},
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
const a = C((t) => {
|
|
17
|
+
const o = t.hashLayers[s]?.geoJsonObject;
|
|
18
|
+
return o && o.object.type === "FeatureCollection" ? o.object.features.find((f) => f.id === n) ?? null : null;
|
|
19
|
+
}, x), L = M(), { draggable: y, onDragStart: u, onDragEnd: d } = j(P), e = A(null), b = p(
|
|
20
|
+
() => ({
|
|
21
|
+
/** Remembers where the drag began and notifies the drag hook. */
|
|
22
|
+
dragstart: (t) => {
|
|
23
|
+
e.current = t.target.getLatLng(), u();
|
|
24
|
+
},
|
|
25
|
+
/** Reports the drop position; snaps the marker back when the drop is rejected. */
|
|
26
|
+
dragend: async (t) => {
|
|
27
|
+
const o = t.target;
|
|
28
|
+
!await d(k(t)) && e.current && o.setLatLng(e.current), e.current = null;
|
|
29
|
+
}
|
|
30
|
+
}),
|
|
31
|
+
[u, d]
|
|
32
|
+
), l = a?.geometry, r = l?.type === "Point" ? l.coordinates : void 0, g = Array.isArray(r) && Number.isFinite(r[0]) && Number.isFinite(r[1]), i = g ? r[0] : void 0, c = g ? r[1] : void 0, m = p(
|
|
33
|
+
() => c !== void 0 && i !== void 0 ? [c, i] : null,
|
|
34
|
+
[c, i]
|
|
35
|
+
);
|
|
36
|
+
return m ? /* @__PURE__ */ v(
|
|
37
|
+
h,
|
|
22
38
|
{
|
|
23
|
-
position:
|
|
24
|
-
icon:
|
|
39
|
+
position: m,
|
|
40
|
+
icon: L,
|
|
41
|
+
draggable: y,
|
|
42
|
+
eventHandlers: b
|
|
25
43
|
}
|
|
26
|
-
);
|
|
44
|
+
) : null;
|
|
27
45
|
};
|
|
28
46
|
export {
|
|
29
|
-
|
|
47
|
+
N as AddressLocationPinRender
|
|
30
48
|
};
|
|
@@ -8,7 +8,10 @@ import { AddressLocationSlots } from './slots/AddressLocationEnum';
|
|
|
8
8
|
* Separated to keep map infrastructure config distinct from UX config.
|
|
9
9
|
*/
|
|
10
10
|
export interface AddressLocationMapProviderConfig {
|
|
11
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* Google Maps API key override. When omitted, the key from the environment context
|
|
13
|
+
* (useEnvironment().googleMapsApiKey) is used, so consumers normally do not set it.
|
|
14
|
+
*/
|
|
12
15
|
googleMapsApiKey?: string;
|
|
13
16
|
/** Google Maps API version. Defaults to 'weekly'. */
|
|
14
17
|
googleMapVersion?: string;
|
|
@@ -53,15 +56,72 @@ export interface AddressLocationProps<T = unknown> extends Omit<AutocompleteAsyn
|
|
|
53
56
|
storeId?: string;
|
|
54
57
|
/** Endpoint to fetch location detail (coordinates) after the user selects a suggestion. */
|
|
55
58
|
detailEndPoint?: string;
|
|
59
|
+
/**
|
|
60
|
+
* Reverse-geocoding endpoint (coordinates → location). When provided, the map pin becomes
|
|
61
|
+
* draggable: nothing is requested while it moves; on drop, a single request resolves the
|
|
62
|
+
* address and onChange receives the location returned by the backend. Without it the pin
|
|
63
|
+
* stays static.
|
|
64
|
+
*/
|
|
65
|
+
reverseEndPoint?: string;
|
|
66
|
+
/** Extra query params sent with every reverse request (e.g. geocoder, lang). Consumer-owned. */
|
|
67
|
+
reverseParms?: Record<string, string | number>;
|
|
56
68
|
}
|
|
57
69
|
/** Props for the inner layout component — all AddressLocation props except mapProviderConfig and storeId. */
|
|
58
70
|
export type AddressLocationInnerProps = Omit<AddressLocationProps, 'mapProviderConfig' | 'storeId'>;
|
|
71
|
+
/** Geographic point as used by the pin drag flow. */
|
|
72
|
+
export interface AddressLocationLatLng {
|
|
73
|
+
lat: number;
|
|
74
|
+
lng: number;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Drag flags shared between the drag hook and the map hook.
|
|
78
|
+
* Refs (not state) so reading them inside effects never triggers re-renders.
|
|
79
|
+
*/
|
|
80
|
+
export interface AddressLocationDragFlags {
|
|
81
|
+
/** True from dragstart until the drop's reverse request settles — the store must not touch the pin. */
|
|
82
|
+
isDraggingRef?: React.MutableRefObject<boolean>;
|
|
83
|
+
/**
|
|
84
|
+
* Set once when a value change comes from a drop, so the map recenters on the pin
|
|
85
|
+
* keeping the current zoom instead of jumping to the selection zoom.
|
|
86
|
+
*/
|
|
87
|
+
centerKeepZoomRef?: React.MutableRefObject<boolean>;
|
|
88
|
+
}
|
|
59
89
|
/** Input props for useAddressLocationState. */
|
|
60
|
-
export interface UseAddressLocationStateProps {
|
|
90
|
+
export interface UseAddressLocationStateProps extends AddressLocationDragFlags {
|
|
61
91
|
value?: unknown | null;
|
|
62
92
|
defaultMapVisible?: boolean;
|
|
63
93
|
mapHeight?: number;
|
|
64
94
|
}
|
|
95
|
+
/** Handlers the pin marker uses to report drag events (provided through context). */
|
|
96
|
+
export interface AddressLocationPinDragHandlers {
|
|
97
|
+
/** Whether the pin can be dragged at all. */
|
|
98
|
+
draggable: boolean;
|
|
99
|
+
/** Called when the user starts dragging the pin. */
|
|
100
|
+
onDragStart: () => void;
|
|
101
|
+
/** Called when the pin is dropped. Resolves false when the marker must snap back. */
|
|
102
|
+
onDragEnd: (latLng: AddressLocationLatLng) => Promise<boolean>;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Network options shared by the detail and reverse requests. They mirror the same-named
|
|
106
|
+
* AutocompleteAsync props so every request of the component targets the backend the same
|
|
107
|
+
* way (host selection and response casing) as the search itself.
|
|
108
|
+
*/
|
|
109
|
+
export interface AddressLocationRequestOptions {
|
|
110
|
+
/** Convert the response keys to camelCase, as AutocompleteAsync does for the search. */
|
|
111
|
+
responseToCamelCase?: boolean;
|
|
112
|
+
/** Use the remote API host (default true), as AutocompleteAsync does for the search. */
|
|
113
|
+
isRemote?: boolean;
|
|
114
|
+
}
|
|
115
|
+
/** Input props for useAddressLocationPinDrag. */
|
|
116
|
+
export interface UseAddressLocationPinDragProps extends AddressLocationRequestOptions {
|
|
117
|
+
reverseEndPoint?: string;
|
|
118
|
+
reverseParms?: Record<string, string | number>;
|
|
119
|
+
onChange?: AddressLocationProps['onChange'];
|
|
120
|
+
disabled?: boolean;
|
|
121
|
+
}
|
|
122
|
+
/** Return value of useAddressLocationPinDrag. */
|
|
123
|
+
export interface UseAddressLocationPinDragReturn extends AddressLocationPinDragHandlers, Required<AddressLocationDragFlags> {
|
|
124
|
+
}
|
|
65
125
|
/** Return value of useAddressLocationState. */
|
|
66
126
|
export interface UseAddressLocationStateReturn {
|
|
67
127
|
isMapVisible: boolean;
|
|
@@ -72,7 +132,7 @@ export interface UseAddressLocationStateReturn {
|
|
|
72
132
|
mapHeightResolved: number;
|
|
73
133
|
}
|
|
74
134
|
/** Input props for useAddressLocationSearch. */
|
|
75
|
-
export interface UseAddressLocationSearchProps {
|
|
135
|
+
export interface UseAddressLocationSearchProps extends AddressLocationRequestOptions {
|
|
76
136
|
onChange?: AddressLocationProps['onChange'];
|
|
77
137
|
detailEndPoint?: string;
|
|
78
138
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../packages/gclick/src/components/AddressLocation/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,KAAK,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACtF,OAAO,EAAE,8BAA8B,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAGnE;;;GAGG;AACH,MAAM,WAAW,gCAAgC;IAC/C
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../packages/gclick/src/components/AddressLocation/types.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MapProps } from '../../types';
|
|
2
2
|
/**
|
|
3
|
-
* Render the base-map source
|
|
3
|
+
* Render the selected base-map source with the live theme and tile reserve preference.
|
|
4
4
|
*/
|
|
5
5
|
export declare function TileLayers({ tileReserveFactor, }: Pick<MapProps, 'tileReserveFactor'>): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
6
6
|
//# sourceMappingURL=TileLayers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TileLayers.d.ts","sourceRoot":"","sources":["../../../../../../../../../../packages/gclick/src/components/maps/components/GpsMap/subcomponents/TileLayers/TileLayers.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TileLayers.d.ts","sourceRoot":"","sources":["../../../../../../../../../../packages/gclick/src/components/maps/components/GpsMap/subcomponents/TileLayers/TileLayers.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C;;GAEG;AACH,wBAAgB,UAAU,CAAC,EACzB,iBAA+C,GAChD,EAAE,IAAI,CAAC,QAAQ,EAAE,mBAAmB,CAAC,oDA8BrC"}
|
|
@@ -1,39 +1,34 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import { useMap as
|
|
4
|
-
import {
|
|
5
|
-
import { KEY_LOCAL_STORAGE_THEME_SETTINGS as E, defaultThemeSettings as T } from "@m4l/graphics";
|
|
1
|
+
import { jsxs as m, jsx as o } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import n, { useEffect as a } from "react";
|
|
3
|
+
import { useMap as p } from "react-leaflet";
|
|
4
|
+
import { useMapThemeMode as f } from "./hooks/useMapThemeMode.js";
|
|
6
5
|
import { DEFAULT_TILE_RESERVE_FACTOR as c } from "../../external/tileReserve/constants.js";
|
|
7
6
|
import { TileLayerOthers as l } from "./subcomponents/TileLayerOthers/TileLayerOthers.js";
|
|
8
7
|
import { TileLayerGoogle as u } from "./subcomponents/TileLayerGoogle/TileLayerGoogle.js";
|
|
9
|
-
function
|
|
10
|
-
tileReserveFactor:
|
|
8
|
+
function g({
|
|
9
|
+
tileReserveFactor: t = c
|
|
11
10
|
}) {
|
|
12
|
-
const e =
|
|
13
|
-
E,
|
|
14
|
-
T,
|
|
15
|
-
{ useBroadcastChannel: !0 }
|
|
16
|
-
);
|
|
11
|
+
const e = p(), i = f();
|
|
17
12
|
return a(() => {
|
|
18
13
|
const s = () => {
|
|
19
14
|
e.invalidateSize();
|
|
20
|
-
}, r = new ResizeObserver((
|
|
15
|
+
}, r = new ResizeObserver((T) => {
|
|
21
16
|
s();
|
|
22
17
|
});
|
|
23
18
|
return r.observe(e.getContainer()), () => {
|
|
24
19
|
r.unobserve(e.getContainer());
|
|
25
20
|
};
|
|
26
|
-
}, [e]), /* @__PURE__ */ n
|
|
27
|
-
/* @__PURE__ */
|
|
28
|
-
/* @__PURE__ */
|
|
21
|
+
}, [e]), /* @__PURE__ */ m(n.Fragment, { children: [
|
|
22
|
+
/* @__PURE__ */ o(l, {}),
|
|
23
|
+
/* @__PURE__ */ o(
|
|
29
24
|
u,
|
|
30
25
|
{
|
|
31
|
-
mode: i
|
|
32
|
-
tileReserveFactor:
|
|
26
|
+
mode: i,
|
|
27
|
+
tileReserveFactor: t
|
|
33
28
|
}
|
|
34
29
|
)
|
|
35
30
|
] });
|
|
36
31
|
}
|
|
37
32
|
export {
|
|
38
|
-
|
|
33
|
+
g as TileLayers
|
|
39
34
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ThemeUserMode } from '@m4l/styles';
|
|
2
|
+
/**
|
|
3
|
+
* Resolves the theme mode (light/dark) the map tiles must follow.
|
|
4
|
+
* Prefers the live theme settings store when a ThemeSettingsProvider is mounted — this is
|
|
5
|
+
* what the Storybook toolbar and the host settings panel update — and falls back to the
|
|
6
|
+
* persisted localStorage value, which is the only signal available outside that provider.
|
|
7
|
+
*/
|
|
8
|
+
export declare function useMapThemeMode(): ThemeUserMode;
|
|
9
|
+
//# sourceMappingURL=useMapThemeMode.d.ts.map
|
package/components/maps/components/GpsMap/subcomponents/TileLayers/hooks/useMapThemeMode.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMapThemeMode.d.ts","sourceRoot":"","sources":["../../../../../../../../../../../packages/gclick/src/components/maps/components/GpsMap/subcomponents/TileLayers/hooks/useMapThemeMode.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAKjD;;;;;GAKG;AACH,wBAAgB,eAAe,IAAI,aAAa,CAe/C"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useContext as o, useSyncExternalStore as s } from "react";
|
|
2
|
+
import { useLocalStorageWithListener as r } from "@m4l/core";
|
|
3
|
+
import { ThemeSettingsContext as n, KEY_LOCAL_STORAGE_THEME_SETTINGS as m, defaultThemeSettings as i } from "@m4l/graphics";
|
|
4
|
+
const S = () => () => {
|
|
5
|
+
};
|
|
6
|
+
function T() {
|
|
7
|
+
const e = o(n), [t] = r(
|
|
8
|
+
m,
|
|
9
|
+
i,
|
|
10
|
+
{ useBroadcastChannel: !0 }
|
|
11
|
+
);
|
|
12
|
+
return s(
|
|
13
|
+
e ? e.subscribe : S,
|
|
14
|
+
() => e?.getState().themeUserSettings.themeMode
|
|
15
|
+
) ?? t.themeMode;
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
T as useMapThemeMode
|
|
19
|
+
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { createElement as
|
|
2
|
-
import {
|
|
3
|
-
import { getIconNameById as
|
|
4
|
-
import { Image as
|
|
1
|
+
import { createElement as i } from "react";
|
|
2
|
+
import { renderToStaticMarkup as m } from "react-dom/server";
|
|
3
|
+
import { getIconNameById as I } from "@m4l/icons/svg-registry";
|
|
4
|
+
import { Image as s } from "@m4l/components";
|
|
5
5
|
import { DEVICE_ICON_SIZE as C, DEVICE_BACKEND_ICON_PREFIX as n, DEVICE_ICON_ID_PREFIX as a, DEVICE_ICON_VARIANT_SUFFIX as E } from "./constants.js";
|
|
6
6
|
import { DEVICE_FALLBACK_ICON_COMPONENT as p, getDeviceIconComponentByName as _ } from "./deviceIconComponents.js";
|
|
7
7
|
const c = /* @__PURE__ */ new WeakMap();
|
|
8
8
|
function f(t) {
|
|
9
9
|
const e = t.startsWith(n) ? t.slice(n.length) : t;
|
|
10
10
|
return _(
|
|
11
|
-
|
|
11
|
+
I(
|
|
12
12
|
`${a}${e}${E}`
|
|
13
13
|
)
|
|
14
14
|
);
|
|
@@ -18,16 +18,16 @@ function l(t) {
|
|
|
18
18
|
return (e ? f(e) : void 0) ?? p;
|
|
19
19
|
}
|
|
20
20
|
function u(t) {
|
|
21
|
-
const e = l(t),
|
|
22
|
-
if (
|
|
23
|
-
return
|
|
24
|
-
const
|
|
25
|
-
i
|
|
21
|
+
const e = l(t), o = c.get(e);
|
|
22
|
+
if (o)
|
|
23
|
+
return o;
|
|
24
|
+
const r = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(
|
|
25
|
+
m(i(e))
|
|
26
26
|
)}`;
|
|
27
|
-
return c.set(e,
|
|
27
|
+
return c.set(e, r), r;
|
|
28
28
|
}
|
|
29
29
|
function d(t, e = C) {
|
|
30
|
-
return s
|
|
30
|
+
return i(s, {
|
|
31
31
|
src: u(t),
|
|
32
32
|
width: e,
|
|
33
33
|
height: e,
|
package/package.json
CHANGED