@m4l/gclick 0.30.0-beta-pkg-787-ajustes-mf-51.0 → 0.30.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/GpsMap.d.ts +3 -2
- package/components/maps/components/GpsMap/GpsMap.d.ts.map +1 -1
- package/components/maps/components/GpsMap/GpsMap.js +24 -26
- package/components/maps/components/GpsMap/external/googleMutant/googleMutant.js +109 -133
- package/components/maps/components/GpsMap/subcomponents/TileLayers/TileLayers.d.ts +2 -3
- package/components/maps/components/GpsMap/subcomponents/TileLayers/TileLayers.d.ts.map +1 -1
- package/components/maps/components/GpsMap/subcomponents/TileLayers/TileLayers.js +16 -30
- 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/components/maps/components/GpsMap/subcomponents/TileLayers/subcomponents/TileLayerGoogle/TileLayerGoogle.d.ts +1 -2
- package/components/maps/components/GpsMap/subcomponents/TileLayers/subcomponents/TileLayerGoogle/TileLayerGoogle.d.ts.map +1 -1
- package/components/maps/components/GpsMap/subcomponents/TileLayers/subcomponents/TileLayerGoogle/TileLayerGoogle.js +41 -51
- package/components/maps/components/GpsMap/types.d.ts +33 -35
- package/components/maps/components/GpsMap/types.d.ts.map +1 -1
- package/helpers/resolveDeviceIcon/resolveDeviceIcon.js +12 -12
- package/index.d.ts +1 -1
- 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
- package/components/maps/components/GpsMap/external/tileReserve/ReservedTileLayer.d.ts +0 -14
- package/components/maps/components/GpsMap/external/tileReserve/ReservedTileLayer.d.ts.map +0 -1
- package/components/maps/components/GpsMap/external/tileReserve/ReservedTileLayer.js +0 -24
- package/components/maps/components/GpsMap/external/tileReserve/constants.d.ts +0 -5
- package/components/maps/components/GpsMap/external/tileReserve/constants.d.ts.map +0 -1
- package/components/maps/components/GpsMap/external/tileReserve/constants.js +0 -5
- package/components/maps/components/GpsMap/external/tileReserve/tileReserve.d.ts +0 -10
- package/components/maps/components/GpsMap/external/tileReserve/tileReserve.d.ts.map +0 -1
- package/components/maps/components/GpsMap/external/tileReserve/tileReserve.js +0 -36
- package/components/maps/components/GpsMap/external/tileReserve/types.d.ts +0 -23
- package/components/maps/components/GpsMap/external/tileReserve/types.d.ts.map +0 -1
|
@@ -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"}
|