pixelize-design-library 2.2.90 → 2.2.91
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -3
- package/package.json +1 -3
- package/dist/Components/Map/ShopMap.d.ts +0 -22
- package/dist/Components/Map/ShopMap.js +0 -205
package/dist/index.d.ts
CHANGED
|
@@ -59,6 +59,5 @@ import PaymentCard from "./Components/Card/PaymentCard/PaymentCard";
|
|
|
59
59
|
import ApexLineChart from "./Components/Apexcharts/ApexLineChart/ApexLineChart";
|
|
60
60
|
import Notification from "./Components/Notification/Notification";
|
|
61
61
|
import DatePicker from "./Components/DatePicker/ThemeDatePicker";
|
|
62
|
-
|
|
63
|
-
export { Accordian, AlertDialog, ApexBarChart, ApexPieChart, ApexPolarChart, ApexLineChart, Breadcrumbs, Button, ButtonGroupIcon, Card, Checkbox, ContactForm, DatePicker, Drawer, DrawerHeader, DrawerBody, DrawerFooter, Dropdown, Editor, FileUpload, FileUploader, FormWrapper, Header, HeaderActions, InputTextArea, InputSwitch, KanbanBoard, Loading, Modal, ModalHeader, ModalBody, ModalFooter, NavigationBar, Notification, NoteTextArea, MultiSelect, NumberInput, PaymentCard, PhoneNumberInput, PinInput, ProductCard, ProductDetails, ProfileCard, ProfileCardHeader, ProfileCardBody, ProfileCardFooter, ProfilePhotoViewer, ProgressBar, RadioButton, RadioButtonGroup, Reorder, Search, Select, SearchSelect, SelectSearch, SideBar, Slider, Skeletons, ShopMap, Switch, Table, TableToggle, Tag, TextInput, Timeline, Toaster, ToolTip, useToaster, VerifyEmailOtp, useCustomTheme, ThemesList, debounce, };
|
|
62
|
+
export { Accordian, AlertDialog, ApexBarChart, ApexPieChart, ApexPolarChart, ApexLineChart, Breadcrumbs, Button, ButtonGroupIcon, Card, Checkbox, ContactForm, DatePicker, Drawer, DrawerHeader, DrawerBody, DrawerFooter, Dropdown, Editor, FileUpload, FileUploader, FormWrapper, Header, HeaderActions, InputTextArea, InputSwitch, KanbanBoard, Loading, Modal, ModalHeader, ModalBody, ModalFooter, NavigationBar, Notification, NoteTextArea, MultiSelect, NumberInput, PaymentCard, PhoneNumberInput, PinInput, ProductCard, ProductDetails, ProfileCard, ProfileCardHeader, ProfileCardBody, ProfileCardFooter, ProfilePhotoViewer, ProgressBar, RadioButton, RadioButtonGroup, Reorder, Search, Select, SearchSelect, SelectSearch, SideBar, Slider, Skeletons, Switch, Table, TableToggle, Tag, TextInput, Timeline, Toaster, ToolTip, useToaster, VerifyEmailOtp, useCustomTheme, ThemesList, debounce, };
|
|
64
63
|
export default withTheme;
|
package/dist/index.js
CHANGED
|
@@ -28,7 +28,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
28
28
|
};
|
|
29
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
30
|
exports.RadioButtonGroup = exports.RadioButton = exports.ProgressBar = exports.ProfilePhotoViewer = exports.ProfileCardFooter = exports.ProfileCardBody = exports.ProfileCardHeader = exports.ProfileCard = exports.ProductDetails = exports.ProductCard = exports.PinInput = exports.PhoneNumberInput = exports.PaymentCard = exports.NumberInput = exports.MultiSelect = exports.NoteTextArea = exports.Notification = exports.NavigationBar = exports.ModalFooter = exports.ModalBody = exports.ModalHeader = exports.Modal = exports.Loading = exports.KanbanBoard = exports.InputSwitch = exports.InputTextArea = exports.HeaderActions = exports.Header = exports.FormWrapper = exports.FileUploader = exports.FileUpload = exports.Editor = exports.Dropdown = exports.DrawerFooter = exports.DrawerBody = exports.DrawerHeader = exports.Drawer = exports.DatePicker = exports.ContactForm = exports.Checkbox = exports.Card = exports.ButtonGroupIcon = exports.Button = exports.Breadcrumbs = exports.ApexLineChart = exports.ApexPolarChart = exports.ApexPieChart = exports.ApexBarChart = exports.AlertDialog = exports.Accordian = void 0;
|
|
31
|
-
exports.debounce = exports.ThemesList = exports.useCustomTheme = exports.VerifyEmailOtp = exports.useToaster = exports.ToolTip = exports.Toaster = exports.Timeline = exports.TextInput = exports.Tag = exports.TableToggle = exports.Table = exports.Switch = exports.
|
|
31
|
+
exports.debounce = exports.ThemesList = exports.useCustomTheme = exports.VerifyEmailOtp = exports.useToaster = exports.ToolTip = exports.Toaster = exports.Timeline = exports.TextInput = exports.Tag = exports.TableToggle = exports.Table = exports.Switch = exports.Skeletons = exports.Slider = exports.SideBar = exports.SelectSearch = exports.SearchSelect = exports.Select = exports.Search = exports.Reorder = void 0;
|
|
32
32
|
var Accordion_1 = __importDefault(require("./Components/Accordion/Accordion"));
|
|
33
33
|
exports.Accordian = Accordion_1.default;
|
|
34
34
|
var AlertDialog_1 = __importDefault(require("./Components/AlertDialog/AlertDialog"));
|
|
@@ -162,6 +162,4 @@ var Notification_1 = __importDefault(require("./Components/Notification/Notifica
|
|
|
162
162
|
exports.Notification = Notification_1.default;
|
|
163
163
|
var ThemeDatePicker_1 = __importDefault(require("./Components/DatePicker/ThemeDatePicker"));
|
|
164
164
|
exports.DatePicker = ThemeDatePicker_1.default;
|
|
165
|
-
var ShopMap_1 = __importDefault(require("./Components/Map/ShopMap"));
|
|
166
|
-
exports.ShopMap = ShopMap_1.default;
|
|
167
165
|
exports.default = withTheme_1.default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pixelize-design-library",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.91",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -10,8 +10,6 @@
|
|
|
10
10
|
"@hello-pangea/dnd": "^18.0.1",
|
|
11
11
|
"framer-motion": "^11.2.2",
|
|
12
12
|
"jodit-react": "^5.2.38",
|
|
13
|
-
"leaflet": "^1.9.4",
|
|
14
|
-
"leaflet-routing-machine": "^3.2.12",
|
|
15
13
|
"lucide-react": "^0.487.0",
|
|
16
14
|
"react": "^18.3.1",
|
|
17
15
|
"react-apexcharts": "^1.4.1",
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import "leaflet-routing-machine";
|
|
3
|
-
export type ShopLocation = {
|
|
4
|
-
id: string | number;
|
|
5
|
-
name: string;
|
|
6
|
-
lat: number;
|
|
7
|
-
lng: number;
|
|
8
|
-
address?: string;
|
|
9
|
-
};
|
|
10
|
-
export type ShopMapProps = {
|
|
11
|
-
shops: ShopLocation[];
|
|
12
|
-
selectedShopId?: string | number;
|
|
13
|
-
userLocation?: {
|
|
14
|
-
lat: number;
|
|
15
|
-
lng: number;
|
|
16
|
-
};
|
|
17
|
-
height?: string | number;
|
|
18
|
-
onSelectShop?: (shop: ShopLocation) => void;
|
|
19
|
-
navigateToShopId?: string | number;
|
|
20
|
-
};
|
|
21
|
-
declare const ShopMap: React.FC<ShopMapProps>;
|
|
22
|
-
export default ShopMap;
|
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
var react_1 = __importStar(require("react"));
|
|
30
|
-
var react_2 = require("@chakra-ui/react");
|
|
31
|
-
var leaflet_1 = __importDefault(require("leaflet"));
|
|
32
|
-
require("leaflet-routing-machine");
|
|
33
|
-
var tileUrl = "https://tile.openstreetmap.org/{z}/{x}/{y}.png";
|
|
34
|
-
function directionsUrl(dest, origin) {
|
|
35
|
-
var base = "https://www.google.com/maps/dir/?api=1";
|
|
36
|
-
var destination = "destination=".concat(dest.lat, ",").concat(dest.lng);
|
|
37
|
-
var o = origin ? "&origin=".concat(origin.lat, ",").concat(origin.lng) : "";
|
|
38
|
-
return "".concat(base, "&").concat(destination).concat(o);
|
|
39
|
-
}
|
|
40
|
-
var ShopMap = function (_a) {
|
|
41
|
-
var shops = _a.shops, selectedShopId = _a.selectedShopId, userLocation = _a.userLocation, _b = _a.height, height = _b === void 0 ? 360 : _b, onSelectShop = _a.onSelectShop, navigateToShopId = _a.navigateToShopId;
|
|
42
|
-
var mapElRef = (0, react_1.useRef)(null);
|
|
43
|
-
var mapRef = (0, react_1.useRef)(null);
|
|
44
|
-
var markersRef = (0, react_1.useRef)(new Map());
|
|
45
|
-
var routeLayerRef = (0, react_1.useRef)(null);
|
|
46
|
-
var routingControlRef = (0, react_1.useRef)(null);
|
|
47
|
-
var internalOriginRef = (0, react_1.useRef)(null);
|
|
48
|
-
var bounds = (0, react_1.useMemo)(function () {
|
|
49
|
-
var b = leaflet_1.default.latLngBounds([]);
|
|
50
|
-
shops.forEach(function (s) { return b.extend([s.lat, s.lng]); });
|
|
51
|
-
return b;
|
|
52
|
-
}, [shops]);
|
|
53
|
-
(0, react_1.useEffect)(function () {
|
|
54
|
-
if (!mapElRef.current)
|
|
55
|
-
return;
|
|
56
|
-
if (!mapRef.current) {
|
|
57
|
-
mapRef.current = leaflet_1.default.map(mapElRef.current);
|
|
58
|
-
leaflet_1.default.tileLayer(tileUrl, {
|
|
59
|
-
attribution: "© OpenStreetMap contributors",
|
|
60
|
-
}).addTo(mapRef.current);
|
|
61
|
-
}
|
|
62
|
-
markersRef.current.forEach(function (layer) {
|
|
63
|
-
if (mapRef.current && mapRef.current.hasLayer(layer))
|
|
64
|
-
mapRef.current.removeLayer(layer);
|
|
65
|
-
});
|
|
66
|
-
markersRef.current.clear();
|
|
67
|
-
shops.forEach(function (shop) {
|
|
68
|
-
var marker = leaflet_1.default.circleMarker([shop.lat, shop.lng], {
|
|
69
|
-
radius: 7,
|
|
70
|
-
color: "#2563eb",
|
|
71
|
-
weight: 2,
|
|
72
|
-
fillColor: "#60a5fa",
|
|
73
|
-
fillOpacity: 0.8,
|
|
74
|
-
});
|
|
75
|
-
var html = "<div style=\"min-width:220px;line-height:1.4\">".concat(shop.name).concat(shop.address ? "<br/><small>".concat(shop.address, "</small>") : "", "<br/><div style=\"display:flex;gap:8px;margin-top:6px\"><button data-id=\"").concat(shop.id, "\" data-action=\"navigate\" style=\"padding:6px 10px;border-radius:6px;background:#7c3aed;color:#fff;border:none;cursor:pointer\">Navigate</button><button data-id=\"").concat(shop.id, "\" data-action=\"gmaps\" style=\"padding:6px 10px;border-radius:6px;background:#9333ea;color:#fff;border:none;cursor:pointer\">Google Maps</button></div></div>");
|
|
76
|
-
marker.bindPopup(html, { autoPan: false });
|
|
77
|
-
marker.on("click", function () { return onSelectShop && onSelectShop(shop); });
|
|
78
|
-
marker.on("popupopen", function () {
|
|
79
|
-
var _a;
|
|
80
|
-
var el = (_a = marker.getPopup()) === null || _a === void 0 ? void 0 : _a.getElement();
|
|
81
|
-
if (!el)
|
|
82
|
-
return;
|
|
83
|
-
var navBtn = el.querySelector("button[data-id='".concat(shop.id, "'][data-action='navigate']"));
|
|
84
|
-
var gmapsBtn = el.querySelector("button[data-id='".concat(shop.id, "'][data-action='gmaps']"));
|
|
85
|
-
if (navBtn) {
|
|
86
|
-
navBtn.addEventListener("click", function () {
|
|
87
|
-
if (!mapRef.current)
|
|
88
|
-
return;
|
|
89
|
-
var proceed = function (origin) {
|
|
90
|
-
if (routingControlRef.current) {
|
|
91
|
-
mapRef.current.removeControl(routingControlRef.current);
|
|
92
|
-
routingControlRef.current = null;
|
|
93
|
-
}
|
|
94
|
-
var dest = leaflet_1.default.latLng(shop.lat, shop.lng);
|
|
95
|
-
var plan = leaflet_1.default.Routing.plan([origin, dest], {
|
|
96
|
-
draggableWaypoints: false,
|
|
97
|
-
addWaypoints: false,
|
|
98
|
-
createMarker: function (_i, wp) { return leaflet_1.default.marker(wp.latLng, { opacity: 0, interactive: false }); },
|
|
99
|
-
});
|
|
100
|
-
routingControlRef.current = leaflet_1.default.Routing.control({
|
|
101
|
-
plan: plan,
|
|
102
|
-
router: leaflet_1.default.Routing.osrmv1({ serviceUrl: "https://router.project-osrm.org/route/v1" }),
|
|
103
|
-
fitSelectedRoutes: true,
|
|
104
|
-
routeWhileDragging: false,
|
|
105
|
-
showAlternatives: false,
|
|
106
|
-
});
|
|
107
|
-
routingControlRef.current.addTo(mapRef.current);
|
|
108
|
-
};
|
|
109
|
-
var originSource = userLocation || internalOriginRef.current;
|
|
110
|
-
if (originSource) {
|
|
111
|
-
proceed(leaflet_1.default.latLng(originSource.lat, originSource.lng));
|
|
112
|
-
}
|
|
113
|
-
else if (navigator.geolocation) {
|
|
114
|
-
navigator.geolocation.getCurrentPosition(function (pos) {
|
|
115
|
-
internalOriginRef.current = { lat: pos.coords.latitude, lng: pos.coords.longitude };
|
|
116
|
-
proceed(leaflet_1.default.latLng(pos.coords.latitude, pos.coords.longitude));
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
if (gmapsBtn) {
|
|
122
|
-
gmapsBtn.addEventListener("click", function () {
|
|
123
|
-
var originSource = userLocation || internalOriginRef.current || undefined;
|
|
124
|
-
var link = directionsUrl({ lat: shop.lat, lng: shop.lng }, originSource ? { lat: originSource.lat, lng: originSource.lng } : undefined);
|
|
125
|
-
window.open(link, "_blank", "noopener");
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
marker.addTo(mapRef.current);
|
|
130
|
-
markersRef.current.set(shop.id, marker);
|
|
131
|
-
});
|
|
132
|
-
if (shops.length) {
|
|
133
|
-
mapRef.current.fitBounds(bounds.pad(0.2));
|
|
134
|
-
}
|
|
135
|
-
return function () {
|
|
136
|
-
if (routingControlRef.current && mapRef.current) {
|
|
137
|
-
mapRef.current.removeControl(routingControlRef.current);
|
|
138
|
-
}
|
|
139
|
-
routingControlRef.current = null;
|
|
140
|
-
if (routeLayerRef.current && mapRef.current && mapRef.current.hasLayer(routeLayerRef.current)) {
|
|
141
|
-
mapRef.current.removeLayer(routeLayerRef.current);
|
|
142
|
-
}
|
|
143
|
-
routeLayerRef.current = null;
|
|
144
|
-
markersRef.current.clear();
|
|
145
|
-
if (mapRef.current) {
|
|
146
|
-
mapRef.current.off();
|
|
147
|
-
mapRef.current.remove();
|
|
148
|
-
mapRef.current = null;
|
|
149
|
-
}
|
|
150
|
-
};
|
|
151
|
-
}, [shops, bounds, userLocation]);
|
|
152
|
-
(0, react_1.useEffect)(function () {
|
|
153
|
-
var _a, _b;
|
|
154
|
-
if (!selectedShopId || !mapRef.current)
|
|
155
|
-
return;
|
|
156
|
-
var layer = markersRef.current.get(selectedShopId);
|
|
157
|
-
if (!layer)
|
|
158
|
-
return;
|
|
159
|
-
(_b = (_a = layer).openPopup) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
160
|
-
}, [selectedShopId]);
|
|
161
|
-
(0, react_1.useEffect)(function () {
|
|
162
|
-
var _a, _b, _c, _d;
|
|
163
|
-
if (!navigateToShopId || !mapRef.current)
|
|
164
|
-
return;
|
|
165
|
-
var layer = markersRef.current.get(navigateToShopId);
|
|
166
|
-
if (!layer)
|
|
167
|
-
return;
|
|
168
|
-
var center = (_b = (_a = layer).getLatLng) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
169
|
-
if (!center)
|
|
170
|
-
return;
|
|
171
|
-
var build = function (origin) {
|
|
172
|
-
if (routingControlRef.current) {
|
|
173
|
-
mapRef.current.removeControl(routingControlRef.current);
|
|
174
|
-
routingControlRef.current = null;
|
|
175
|
-
}
|
|
176
|
-
var plan = leaflet_1.default.Routing.plan([origin, center], {
|
|
177
|
-
draggableWaypoints: false,
|
|
178
|
-
addWaypoints: false,
|
|
179
|
-
createMarker: function (_i, wp) { return leaflet_1.default.marker(wp.latLng, { opacity: 0, interactive: false }); },
|
|
180
|
-
});
|
|
181
|
-
routingControlRef.current = leaflet_1.default.Routing.control({
|
|
182
|
-
plan: plan,
|
|
183
|
-
router: leaflet_1.default.Routing.osrmv1({ serviceUrl: "https://router.project-osrm.org/route/v1" }),
|
|
184
|
-
fitSelectedRoutes: true,
|
|
185
|
-
routeWhileDragging: false,
|
|
186
|
-
showAlternatives: false,
|
|
187
|
-
});
|
|
188
|
-
routingControlRef.current.addTo(mapRef.current);
|
|
189
|
-
};
|
|
190
|
-
var originSrc = userLocation || internalOriginRef.current;
|
|
191
|
-
if (originSrc) {
|
|
192
|
-
build(leaflet_1.default.latLng(originSrc.lat, originSrc.lng));
|
|
193
|
-
}
|
|
194
|
-
else if (navigator.geolocation) {
|
|
195
|
-
navigator.geolocation.getCurrentPosition(function (pos) {
|
|
196
|
-
internalOriginRef.current = { lat: pos.coords.latitude, lng: pos.coords.longitude };
|
|
197
|
-
build(leaflet_1.default.latLng(pos.coords.latitude, pos.coords.longitude));
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
(_d = (_c = layer).openPopup) === null || _d === void 0 ? void 0 : _d.call(_c);
|
|
201
|
-
}, [navigateToShopId, userLocation]);
|
|
202
|
-
return react_1.default.createElement(react_2.Box, { w: "100%", h: height },
|
|
203
|
-
react_1.default.createElement("div", { ref: mapElRef, style: { width: "100%", height: "100%" } }));
|
|
204
|
-
};
|
|
205
|
-
exports.default = ShopMap;
|