@cashub/ui 0.4.2 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Tab/Tab.js +28 -0
- package/Tab/TabContext.js +12 -0
- package/Tab/TabList.js +47 -0
- package/Tab/TabPanel.js +85 -0
- package/Tab/TabTab.js +63 -0
- package/Tab/index.js +24 -0
- package/animate/Collapse.js +1 -1
- package/animate/NumberCounter.js +1 -1
- package/assets/font/helvetica/Helvetica.ttf +0 -0
- package/assets/font/nanumGothic/NanumGothic-Bold.ttf +0 -0
- package/assets/font/nanumGothic/NanumGothic-ExtraBold.ttf +0 -0
- package/assets/font/nanumGothic/NanumGothic-Regular.ttf +0 -0
- package/assets/icons/app-management.png +0 -0
- package/assets/icons/burger.png +0 -0
- package/assets/icons/map_icon1.png +0 -0
- package/assets/icons/map_icon4.png +0 -0
- package/assets/images/bg-chart-circle.png +0 -0
- package/assets/images/bg-chart-triangle.png +0 -0
- package/assets/images/cashub-logo-only.png +0 -0
- package/assets/images/logo-cashub.png +0 -0
- package/assets/images/map.png +0 -0
- package/assets/images/qrcode.png +0 -0
- package/backdrop/index.js +31 -0
- package/badge/BadgeFill.js +3 -3
- package/billing/BarChart.js +58 -0
- package/billing/Grid.js +49 -0
- package/billing/Header2.js +28 -0
- package/billing/Header3.js +44 -0
- package/billing/Paragraph.js +39 -0
- package/billing/ParagraphGroup.js +25 -0
- package/billing/ParagraphText.js +31 -0
- package/billing/Section.js +60 -0
- package/billing/SectionBody.js +20 -0
- package/billing/SectionHeader.js +31 -0
- package/billing/__stories__/BarChart.stories.js_bak +46 -0
- package/billing/__stories__/Grid.stories.js_bak +57 -0
- package/billing/__stories__/Header2.stories.js_bak +62 -0
- package/billing/__stories__/Header3.stories.js_bak +69 -0
- package/billing/__stories__/Paragraph.stories.js_bak +84 -0
- package/billing/__stories__/ParagraphGroup.stories.js_bak +68 -0
- package/billing/__stories__/ParagraphText.stories.js_bak +64 -0
- package/billing/__stories__/Section.stories.js_bak +115 -0
- package/billing/__stories__/SectionBody.stories.js_bak +62 -0
- package/billing/__stories__/SectionHeader.stories.js-bak +68 -0
- package/breadcrumb/Breadcrumb.js +11 -6
- package/button/IconButton.js +1 -1
- package/callout/Callout.js +36 -0
- package/callout/index.js +15 -0
- package/chart/BarChart.js +130 -0
- package/chart/DoughnutChart.js +59 -0
- package/chart/LineChart.js +121 -0
- package/chart/SingleBarChart.js +31 -0
- package/chart/index.js +39 -0
- package/container/FlexContainer.js +25 -0
- package/container/index.js +15 -0
- package/cropper/Cropper.js +1 -1
- package/datetimePicker/Accordion.js +342 -0
- package/datetimePicker/CustomTimeInput.js +77 -0
- package/datetimePicker/DatePicker.js +413 -0
- package/datetimePicker/DatePickerV2.js +456 -0
- package/datetimePicker/DateTimePickerContext.js +12 -0
- package/datetimePicker/DatetimePicker.js +80 -0
- package/datetimePicker/DatetimePickerV2.js +478 -0
- package/datetimePicker/TimeInput.js +37 -0
- package/datetimePicker/TimePicker.js +324 -0
- package/datetimePicker/accordion/Month.js +190 -0
- package/datetimePicker/accordion/Year.js +247 -0
- package/datetimePicker/hooks/index.js +31 -0
- package/datetimePicker/hooks/useChangeNumber.js +55 -0
- package/datetimePicker/hooks/useDecrease.js +54 -0
- package/datetimePicker/hooks/useIncrease.js +54 -0
- package/datetimePicker/index.js +47 -0
- package/datetimePicker/provider/constant.js +44 -0
- package/datetimePicker/utils/GMTDate.js +23 -0
- package/datetimePicker/utils/pad.js +17 -0
- package/descriptionList/DescriptionDetail.js +22 -0
- package/descriptionList/DescriptionList.js +22 -0
- package/descriptionList/DescriptionTerm.js +19 -0
- package/descriptionList/index.js +31 -0
- package/divider/Divider.js +25 -0
- package/divider/index.js +15 -0
- package/dropdown/Dropdown.js +92 -0
- package/dropdown/DropdownButtonOption.js +19 -0
- package/dropdown/DropdownContent.js +94 -0
- package/dropdown/DropdownContext.js +12 -0
- package/dropdown/DropdownDivOption.js +19 -0
- package/dropdown/DropdownItem.js +32 -0
- package/dropdown/DropdownLinkOption.js +20 -0
- package/dropdown/DropdownToggle.js +58 -0
- package/dropdown/index.js +53 -0
- package/dropzone/FileDropzone.js +24 -24
- package/dropzone/ImageDropzone.js +33 -33
- package/form/Label.js +1 -1
- package/form/Searchbox.js +4 -4
- package/geolocation/MapInteractor.js +41 -0
- package/geolocation/MapSearchBoxControl.js +100 -0
- package/geolocation/ReverseGeolocation.js +160 -0
- package/geolocation/index.js +23 -0
- package/grid/Column.js +33 -0
- package/grid/Grid.js +28 -0
- package/grid/index.js +23 -0
- package/heading/Heading1.js +22 -0
- package/heading/Heading2.js +25 -0
- package/heading/Heading3.js +7 -4
- package/heading/index.js +31 -0
- package/icon/IconFigure.js +36 -0
- package/icon/index.js +15 -0
- package/iconbox/ApplicationIconBox.js +51 -0
- package/iconbox/IconBox.js +56 -0
- package/iconbox/IconBoxFigure.js +37 -0
- package/iconbox/IconBoxImage.js +32 -0
- package/iconbox/IconBoxV2.js +42 -0
- package/iconbox/index.js +31 -0
- package/image/UploadImage.js +2 -2
- package/index.js +377 -0
- package/jsoneditor/JsonEditor.js +53 -0
- package/jsoneditor/index.js +15 -0
- package/layout/Backdrop.js +25 -0
- package/layout/Container.js +34 -0
- package/layout/Footer.js +32 -0
- package/layout/Logo.js +34 -0
- package/layout/MenuIcon.js +43 -0
- package/link/LinkSpan.js +57 -0
- package/link/index.js +15 -0
- package/map/CustomLeafletMapContainer.js +23 -0
- package/map/LeafletMap.js +224 -0
- package/map/index.js +23 -0
- package/modal/StateModal.js +2 -2
- package/modal/TitleModal.js +4 -4
- package/module/geolocation/api.js +51 -0
- package/module/message/index.js +59 -0
- package/package.json +16 -1
- package/paginate/Paginate.js +110 -0
- package/paginate/index.js +15 -0
- package/popover/Popover.js +122 -0
- package/popover/index.js +15 -0
- package/qrcode/QRCode.js +57 -0
- package/qrcode/QRCodeContainter.js +34 -0
- package/qrcode/index.js +23 -0
- package/ribbon/Ribbon.js +28 -0
- package/ribbon/index.js +15 -0
- package/section/Section.js +67 -0
- package/section/SectionBody.js +38 -0
- package/section/SectionHeader.js +42 -0
- package/section/SectionToolbar.js +22 -0
- package/section/index.js +50 -0
- package/select/ListBox.js +26 -0
- package/select/Option.js +28 -0
- package/select/OptionGroup.js +20 -0
- package/select/Options.js +25 -0
- package/select/SearchBox.js +52 -0
- package/select/Select.js +630 -0
- package/select/SelectedMultiple.js +34 -0
- package/select/SelectedSingle.js +20 -0
- package/select/index.js +15 -0
- package/services/api/index.js +73 -0
- package/styles/header.style.js +11 -0
- package/styles/sidebar.style.js +18 -0
- package/styles/theme/dark.theme.js +95 -0
- package/styles/theme/index.js +16 -0
- package/table/ImageBox.js +39 -0
- package/table/Logo.js +40 -0
- package/table/PermissionTable.js +42 -0
- package/table/Table.js +377 -0
- package/table/TableFooter.js +19 -0
- package/table/TableFooterInfo.js +19 -0
- package/table/TableFooterPager.js +19 -0
- package/table/TableHeadCell.js +39 -0
- package/table/TableSort.js +34 -0
- package/table/hooks/index.js +31 -0
- package/table/hooks/useLimitChange.js +34 -0
- package/table/hooks/usePageChange.js +33 -0
- package/table/hooks/useSortChange.js +35 -0
- package/table/index.js +31 -0
- package/tagify/Tags.js +55 -0
- package/tagify/index.js +15 -0
- package/text/Paragraph.js +37 -0
- package/text/index.js +15 -0
- package/timeline/Timeline.js +51 -0
- package/timeline/index.js +15 -0
- package/toast/CustomToastContainer.js +20 -0
- package/toast/index.js +23 -0
- package/tooltip/Tooltip.js +154 -0
- package/tooltip/index.js +15 -0
- package/utils/array/generateRange.js +19 -0
- package/utils/chart/customTooltip.js +89 -0
- package/utils/chart/padEmptyChartBar.js +48 -0
- package/utils/dataURLtoFile.js +23 -6
- package/utils/format/datetimeFormat.js +70 -0
- package/utils/format/formatDate.js +46 -0
- package/utils/format/formatSize.js +1 -1
- package/utils/getBase64.js +2 -5
- package/utils/hooks/useCustomPopper.js +49 -0
- package/utils/hooks/useForkRef.js +28 -0
- package/utils/hooks/usePagination.js +86 -0
- package/utils/image/resize.js +7 -7
- package/utils/react/setRef.js +17 -0
- package/utils/regex/check.js +13 -0
- package/wizard/Wizard.js +210 -0
- package/wizard/index.js +15 -0
|
@@ -79,31 +79,31 @@ var ImageDropzone = function ImageDropzone(_ref) {
|
|
|
79
79
|
inputRef.current.click();
|
|
80
80
|
};
|
|
81
81
|
|
|
82
|
-
var handleDragEnter = function handleDragEnter(
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
var handleDragEnter = function handleDragEnter(event) {
|
|
83
|
+
event.preventDefault();
|
|
84
|
+
event.stopPropagation();
|
|
85
85
|
if (files.length < maxFiles) setDragging(true);
|
|
86
86
|
};
|
|
87
87
|
|
|
88
|
-
var handleDragOver = function handleDragOver(
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
var handleDragOver = function handleDragOver(event) {
|
|
89
|
+
event.preventDefault();
|
|
90
|
+
event.stopPropagation();
|
|
91
91
|
if (files.length < maxFiles) setDragging(true);
|
|
92
92
|
};
|
|
93
93
|
|
|
94
|
-
var handleDragLeave = function handleDragLeave(
|
|
95
|
-
|
|
96
|
-
|
|
94
|
+
var handleDragLeave = function handleDragLeave(event) {
|
|
95
|
+
event.preventDefault();
|
|
96
|
+
event.stopPropagation();
|
|
97
97
|
if (files.length < maxFiles) setDragging(false);
|
|
98
98
|
};
|
|
99
99
|
|
|
100
|
-
var handleDrop = function handleDrop(
|
|
101
|
-
|
|
102
|
-
|
|
100
|
+
var handleDrop = function handleDrop(event) {
|
|
101
|
+
event.preventDefault();
|
|
102
|
+
event.stopPropagation();
|
|
103
103
|
|
|
104
104
|
if (files.length < maxFiles) {
|
|
105
105
|
setDragging(false);
|
|
106
|
-
var dataTransfer =
|
|
106
|
+
var dataTransfer = event.dataTransfer;
|
|
107
107
|
|
|
108
108
|
var _dataTransfer$files = _toArray(dataTransfer.files),
|
|
109
109
|
newFiles = _dataTransfer$files.slice(0);
|
|
@@ -112,8 +112,8 @@ var ImageDropzone = function ImageDropzone(_ref) {
|
|
|
112
112
|
newFiles.splice(maxFiles - files.length);
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
for (var
|
|
116
|
-
newFiles[
|
|
115
|
+
for (var index = 0; index < newFiles.length; index += 1) {
|
|
116
|
+
newFiles[index].url = URL.createObjectURL(newFiles[index]);
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
setFiles([].concat(_toConsumableArray(files), _toConsumableArray(newFiles)));
|
|
@@ -126,16 +126,16 @@ var ImageDropzone = function ImageDropzone(_ref) {
|
|
|
126
126
|
newFiles.splice(maxFiles - files.length);
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
for (var
|
|
130
|
-
newFiles[
|
|
129
|
+
for (var index = 0; index < newFiles.length; index += 1) {
|
|
130
|
+
newFiles[index].url = URL.createObjectURL(newFiles[index]);
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
setFiles([].concat(_toConsumableArray(files), _toConsumableArray(newFiles)));
|
|
134
134
|
setAddedFiles(newFiles);
|
|
135
135
|
}, [files, maxFiles]);
|
|
136
|
-
var handleRemoveFile = (0, _react.useCallback)(function (
|
|
137
|
-
if (
|
|
138
|
-
|
|
136
|
+
var handleRemoveFile = (0, _react.useCallback)(function (event, index) {
|
|
137
|
+
if (event) {
|
|
138
|
+
event.stopPropagation();
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
var newFiles = _toConsumableArray(files);
|
|
@@ -144,22 +144,22 @@ var ImageDropzone = function ImageDropzone(_ref) {
|
|
|
144
144
|
setFiles(newFiles);
|
|
145
145
|
if (onRemovedFile) onRemovedFile(index);
|
|
146
146
|
}, [files, onRemovedFile]);
|
|
147
|
-
var handleChangeFile = (0, _react.useCallback)(function (
|
|
148
|
-
var files =
|
|
147
|
+
var handleChangeFile = (0, _react.useCallback)(function (event) {
|
|
148
|
+
var files = event.target.files;
|
|
149
149
|
var newFiles = [];
|
|
150
150
|
|
|
151
|
-
for (var
|
|
152
|
-
newFiles.push(files[
|
|
151
|
+
for (var index = 0; index < files.length; index += 1) {
|
|
152
|
+
newFiles.push(files[index]);
|
|
153
153
|
}
|
|
154
154
|
|
|
155
155
|
handleAddFiles(newFiles);
|
|
156
156
|
inputRef.current.value = '';
|
|
157
157
|
}, [handleAddFiles]);
|
|
158
|
-
var handleCrop = (0, _react.useCallback)(function (
|
|
159
|
-
|
|
158
|
+
var handleCrop = (0, _react.useCallback)(function (event, index, file) {
|
|
159
|
+
event.stopPropagation();
|
|
160
160
|
cropper.handler({
|
|
161
|
-
src: file.url,
|
|
162
161
|
file: file,
|
|
162
|
+
src: file.url,
|
|
163
163
|
width: 180,
|
|
164
164
|
height: 320,
|
|
165
165
|
onCrop: function onCrop(croppedSrc) {
|
|
@@ -179,21 +179,21 @@ var ImageDropzone = function ImageDropzone(_ref) {
|
|
|
179
179
|
var previewItem = function previewItem() {
|
|
180
180
|
return files.map(function (file, index) {
|
|
181
181
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Image, {
|
|
182
|
-
onClick: function onClick(
|
|
183
|
-
|
|
182
|
+
onClick: function onClick(event) {
|
|
183
|
+
event.stopPropagation();
|
|
184
184
|
},
|
|
185
185
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(ButtonGroup, {
|
|
186
186
|
children: [cropper && /*#__PURE__*/(0, _jsxRuntime.jsx)(Button, {
|
|
187
187
|
title: "Crop",
|
|
188
|
-
onClick: function onClick(
|
|
189
|
-
return handleCrop(
|
|
188
|
+
onClick: function onClick(event) {
|
|
189
|
+
return handleCrop(event, index, file);
|
|
190
190
|
},
|
|
191
191
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_md.MdCrop, {})
|
|
192
192
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(Button, {
|
|
193
193
|
danger: true,
|
|
194
194
|
title: "Remove",
|
|
195
|
-
onClick: function onClick(
|
|
196
|
-
return handleRemoveFile(
|
|
195
|
+
onClick: function onClick(event) {
|
|
196
|
+
return handleRemoveFile(event, index);
|
|
197
197
|
},
|
|
198
198
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_fi.FiX, {})
|
|
199
199
|
})]
|
package/form/Label.js
CHANGED
|
@@ -18,7 +18,7 @@ var Label = _styledComponents.default.label(_templateObject || (_templateObject
|
|
|
18
18
|
return required && "&:after {\n content: ' *';\n color: var(--color-danger);\n }\n ";
|
|
19
19
|
}, function (_ref2) {
|
|
20
20
|
var inline = _ref2.inline;
|
|
21
|
-
return inline &&
|
|
21
|
+
return inline && 'display: inline; margin-bottom: 0;';
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
var _default = Label;
|
package/form/Searchbox.js
CHANGED
|
@@ -62,8 +62,8 @@ var Searchbox = function Searchbox(_ref) {
|
|
|
62
62
|
if (onSearch) onSearch(keyword);
|
|
63
63
|
};
|
|
64
64
|
|
|
65
|
-
var handleKeyup = function handleKeyup(
|
|
66
|
-
if (
|
|
65
|
+
var handleKeyup = function handleKeyup(event) {
|
|
66
|
+
if (event.keyCode === 108 || event.keyCode === 13) {
|
|
67
67
|
handleSearch(keyword);
|
|
68
68
|
}
|
|
69
69
|
};
|
|
@@ -85,8 +85,8 @@ var Searchbox = function Searchbox(_ref) {
|
|
|
85
85
|
placeholder: "Search",
|
|
86
86
|
autocomplete: "false",
|
|
87
87
|
value: keyword,
|
|
88
|
-
onChange: function onChange(
|
|
89
|
-
return setKeyword(
|
|
88
|
+
onChange: function onChange(event) {
|
|
89
|
+
return setKeyword(event.target.value);
|
|
90
90
|
},
|
|
91
91
|
onKeyUp: handleKeyup,
|
|
92
92
|
autoFocus: autoFocus
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
|
|
10
|
+
var _leaflet = _interopRequireDefault(require("leaflet"));
|
|
11
|
+
|
|
12
|
+
var _reactLeaflet = require("react-leaflet");
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
|
|
16
|
+
var MapInteractor = function MapInteractor(_ref) {
|
|
17
|
+
var changeLatlng = _ref.changeLatlng;
|
|
18
|
+
var map = (0, _reactLeaflet.useMapEvents)({
|
|
19
|
+
click: function click(event) {
|
|
20
|
+
var _event$latlng = event.latlng,
|
|
21
|
+
lat = _event$latlng.lat,
|
|
22
|
+
lng = _event$latlng.lng;
|
|
23
|
+
changeLatlng({
|
|
24
|
+
lat: lat.toString(),
|
|
25
|
+
lng: lng.toString()
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
(0, _react.useEffect)(function () {
|
|
30
|
+
var bounds = _leaflet.default.latLngBounds([[90, 180], [-90, -180]]);
|
|
31
|
+
|
|
32
|
+
var wantedZoom = map.getBoundsZoom(bounds, true);
|
|
33
|
+
var center = bounds.getCenter();
|
|
34
|
+
map.setView(center);
|
|
35
|
+
map.setZoom(wantedZoom);
|
|
36
|
+
}, [map]);
|
|
37
|
+
return null;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
var _default = MapInteractor;
|
|
41
|
+
exports.default = _default;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = require("react");
|
|
11
|
+
|
|
12
|
+
var _leaflet = _interopRequireDefault(require("leaflet"));
|
|
13
|
+
|
|
14
|
+
var _reactLeaflet = require("react-leaflet");
|
|
15
|
+
|
|
16
|
+
var _Searchbox = _interopRequireDefault(require("../form/Searchbox"));
|
|
17
|
+
|
|
18
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
+
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
+
|
|
22
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
23
|
+
|
|
24
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
25
|
+
|
|
26
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
27
|
+
|
|
28
|
+
var MapSearchBoxControl = function MapSearchBoxControl(_ref) {
|
|
29
|
+
var changeLatlng = _ref.changeLatlng,
|
|
30
|
+
onSearch = _ref.onSearch,
|
|
31
|
+
onError = _ref.onError;
|
|
32
|
+
var map = (0, _reactLeaflet.useMap)();
|
|
33
|
+
var barRef = (0, _react.useRef)(null);
|
|
34
|
+
|
|
35
|
+
var handleError = function handleError(errorCode) {
|
|
36
|
+
if (onError) {
|
|
37
|
+
onError(errorCode);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
var handleSearch = /*#__PURE__*/function () {
|
|
42
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(address) {
|
|
43
|
+
var latlng;
|
|
44
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
45
|
+
while (1) {
|
|
46
|
+
switch (_context.prev = _context.next) {
|
|
47
|
+
case 0:
|
|
48
|
+
_context.prev = 0;
|
|
49
|
+
_context.next = 3;
|
|
50
|
+
return onSearch(address);
|
|
51
|
+
|
|
52
|
+
case 3:
|
|
53
|
+
latlng = _context.sent;
|
|
54
|
+
|
|
55
|
+
if (latlng) {
|
|
56
|
+
map.flyTo(latlng, 15);
|
|
57
|
+
changeLatlng(latlng);
|
|
58
|
+
} else {
|
|
59
|
+
handleError('NO_RESULT');
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
_context.next = 10;
|
|
63
|
+
break;
|
|
64
|
+
|
|
65
|
+
case 7:
|
|
66
|
+
_context.prev = 7;
|
|
67
|
+
_context.t0 = _context["catch"](0);
|
|
68
|
+
handleError(_context.t0.message);
|
|
69
|
+
|
|
70
|
+
case 10:
|
|
71
|
+
case "end":
|
|
72
|
+
return _context.stop();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}, _callee, null, [[0, 7]]);
|
|
76
|
+
}));
|
|
77
|
+
|
|
78
|
+
return function handleSearch(_x) {
|
|
79
|
+
return _ref2.apply(this, arguments);
|
|
80
|
+
};
|
|
81
|
+
}();
|
|
82
|
+
|
|
83
|
+
(0, _react.useEffect)(function () {
|
|
84
|
+
_leaflet.default.DomEvent.disableClickPropagation(barRef.current);
|
|
85
|
+
}, []);
|
|
86
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
87
|
+
className: "leaflet-top leaflet-right",
|
|
88
|
+
ref: barRef,
|
|
89
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
90
|
+
className: "leaflet-control leaflet-bar",
|
|
91
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Searchbox.default, {
|
|
92
|
+
onSearch: handleSearch,
|
|
93
|
+
autoFocus: true
|
|
94
|
+
})
|
|
95
|
+
})
|
|
96
|
+
});
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
var _default = MapSearchBoxControl;
|
|
100
|
+
exports.default = _default;
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = require("react");
|
|
11
|
+
|
|
12
|
+
var _leaflet = _interopRequireDefault(require("leaflet"));
|
|
13
|
+
|
|
14
|
+
var _reactLeaflet = require("react-leaflet");
|
|
15
|
+
|
|
16
|
+
var _CustomLeafletMapContainer = _interopRequireDefault(require("../map/CustomLeafletMapContainer"));
|
|
17
|
+
|
|
18
|
+
var _MapInteractor = _interopRequireDefault(require("./MapInteractor"));
|
|
19
|
+
|
|
20
|
+
var _MapSearchBoxControl = _interopRequireDefault(require("./MapSearchBoxControl"));
|
|
21
|
+
|
|
22
|
+
var _map_icon = _interopRequireDefault(require("../assets/icons/map_icon4.png"));
|
|
23
|
+
|
|
24
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
25
|
+
|
|
26
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
|
+
|
|
28
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
29
|
+
|
|
30
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
31
|
+
|
|
32
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
33
|
+
|
|
34
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
35
|
+
|
|
36
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
37
|
+
|
|
38
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
39
|
+
|
|
40
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
41
|
+
|
|
42
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
43
|
+
|
|
44
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
45
|
+
|
|
46
|
+
var ReverseGeolocation = function ReverseGeolocation(_ref) {
|
|
47
|
+
var children = _ref.children,
|
|
48
|
+
defaultLatlng = _ref.defaultLatlng,
|
|
49
|
+
changeLatlng = _ref.changeLatlng,
|
|
50
|
+
onChoose = _ref.onChoose,
|
|
51
|
+
onSearch = _ref.onSearch,
|
|
52
|
+
onError = _ref.onError;
|
|
53
|
+
|
|
54
|
+
var _useState = (0, _react.useState)(defaultLatlng),
|
|
55
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
56
|
+
markerLatLng = _useState2[0],
|
|
57
|
+
setMarkerLatLng = _useState2[1];
|
|
58
|
+
|
|
59
|
+
var Icon = (0, _react.useMemo)(function () {
|
|
60
|
+
return _leaflet.default.icon({
|
|
61
|
+
iconUrl: _map_icon.default,
|
|
62
|
+
iconSize: [40, 50]
|
|
63
|
+
});
|
|
64
|
+
}, []);
|
|
65
|
+
|
|
66
|
+
var handleChangeLatlng = function handleChangeLatlng(latlng) {
|
|
67
|
+
setMarkerLatLng(latlng);
|
|
68
|
+
changeLatlng(latlng);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
var confirmChooseLocation = /*#__PURE__*/function () {
|
|
72
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(callback) {
|
|
73
|
+
var address;
|
|
74
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
75
|
+
while (1) {
|
|
76
|
+
switch (_context.prev = _context.next) {
|
|
77
|
+
case 0:
|
|
78
|
+
if (!(markerLatLng.lat && markerLatLng.lng)) {
|
|
79
|
+
_context.next = 13;
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
_context.prev = 1;
|
|
84
|
+
_context.next = 4;
|
|
85
|
+
return onChoose(markerLatLng);
|
|
86
|
+
|
|
87
|
+
case 4:
|
|
88
|
+
address = _context.sent;
|
|
89
|
+
|
|
90
|
+
if (address) {
|
|
91
|
+
callback({
|
|
92
|
+
address: address
|
|
93
|
+
});
|
|
94
|
+
} else {
|
|
95
|
+
callback({
|
|
96
|
+
error: 'ReverseGeo'
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
_context.next = 11;
|
|
101
|
+
break;
|
|
102
|
+
|
|
103
|
+
case 8:
|
|
104
|
+
_context.prev = 8;
|
|
105
|
+
_context.t0 = _context["catch"](1);
|
|
106
|
+
callback(_context.t0);
|
|
107
|
+
|
|
108
|
+
case 11:
|
|
109
|
+
_context.next = 14;
|
|
110
|
+
break;
|
|
111
|
+
|
|
112
|
+
case 13:
|
|
113
|
+
callback({
|
|
114
|
+
error: 'PleaseChooseLocation'
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
case 14:
|
|
118
|
+
case "end":
|
|
119
|
+
return _context.stop();
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}, _callee, null, [[1, 8]]);
|
|
123
|
+
}));
|
|
124
|
+
|
|
125
|
+
return function confirmChooseLocation(_x) {
|
|
126
|
+
return _ref2.apply(this, arguments);
|
|
127
|
+
};
|
|
128
|
+
}();
|
|
129
|
+
|
|
130
|
+
var Map = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_CustomLeafletMapContainer.default, {
|
|
131
|
+
height: 500,
|
|
132
|
+
center: [1, 1],
|
|
133
|
+
zoom: 10,
|
|
134
|
+
scrollWheelZoom: true,
|
|
135
|
+
maxBounds: [[-90, -180], [90, 180]],
|
|
136
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactLeaflet.TileLayer, {
|
|
137
|
+
attribution: "Map data \xA9 <a href=\"https://www.openstreetmap.org/\">OpenStreetMap</a> contributors",
|
|
138
|
+
url: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
|
|
139
|
+
minZoom: 3,
|
|
140
|
+
maxZoom: 20,
|
|
141
|
+
noWrap: true,
|
|
142
|
+
bounds: [[-90, -180], [90, 180]]
|
|
143
|
+
}), markerLatLng.lat && markerLatLng.lng && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactLeaflet.Marker, {
|
|
144
|
+
position: [markerLatLng.lat, markerLatLng.lng],
|
|
145
|
+
icon: Icon
|
|
146
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_MapInteractor.default, {
|
|
147
|
+
changeLatlng: handleChangeLatlng
|
|
148
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_MapSearchBoxControl.default, {
|
|
149
|
+
changeLatlng: handleChangeLatlng,
|
|
150
|
+
onSearch: onSearch,
|
|
151
|
+
onError: onError
|
|
152
|
+
})]
|
|
153
|
+
});
|
|
154
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
155
|
+
children: children(Map, confirmChooseLocation)
|
|
156
|
+
});
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
var _default = ReverseGeolocation;
|
|
160
|
+
exports.default = _default;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "MapInteractor", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _MapInteractor.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "ReverseGeolocation", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _ReverseGeolocation.default;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
var _MapInteractor = _interopRequireDefault(require("./MapInteractor"));
|
|
20
|
+
|
|
21
|
+
var _ReverseGeolocation = _interopRequireDefault(require("./ReverseGeolocation"));
|
|
22
|
+
|
|
23
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
package/grid/Column.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
9
|
+
|
|
10
|
+
var _media = _interopRequireDefault(require("../styles/mixin/media"));
|
|
11
|
+
|
|
12
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
|
|
16
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
17
|
+
|
|
18
|
+
var Column = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding: 0 calc(var(--spacing) / 2);\n grid-column-end: span ", ";\n\n ", "\n\n ", "\n\n ", "\n"])), function (_ref) {
|
|
19
|
+
var desktop = _ref.desktop;
|
|
20
|
+
return desktop;
|
|
21
|
+
}, function (_ref2) {
|
|
22
|
+
var laptop = _ref2.laptop;
|
|
23
|
+
return laptop && _media.default.laptop(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n grid-column-end: span ", ";\n "])), laptop);
|
|
24
|
+
}, function (_ref3) {
|
|
25
|
+
var tablet = _ref3.tablet;
|
|
26
|
+
return tablet && _media.default.tablet(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n grid-column-end: span ", ";\n "])), tablet);
|
|
27
|
+
}, function (_ref4) {
|
|
28
|
+
var mobile = _ref4.mobile;
|
|
29
|
+
return mobile && _media.default.mobile(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n grid-column-end: span ", ";\n "])), mobile);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
var _default = Column;
|
|
33
|
+
exports.default = _default;
|
package/grid/Grid.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
9
|
+
|
|
10
|
+
var _templateObject;
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
|
|
14
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
15
|
+
|
|
16
|
+
var Grid = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: grid;\n grid-template-columns: repeat(", ", minmax(0, 1fr));\n margin: 0 calc(var(--spacing) * -1 / 2);\n\n > * {\n grid-column-end: span ", ";\n }\n\n ", "\n"])), function (_ref) {
|
|
17
|
+
var columns = _ref.columns;
|
|
18
|
+
return columns;
|
|
19
|
+
}, function (_ref2) {
|
|
20
|
+
var columns = _ref2.columns;
|
|
21
|
+
return columns;
|
|
22
|
+
}, function (_ref3) {
|
|
23
|
+
var alignCenter = _ref3.alignCenter;
|
|
24
|
+
return alignCenter && 'align-items: center;';
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
var _default = Grid;
|
|
28
|
+
exports.default = _default;
|
package/grid/index.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "Column", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _Column.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "Grid", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _Grid.default;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
var _Grid = _interopRequireDefault(require("./Grid"));
|
|
20
|
+
|
|
21
|
+
var _Column = _interopRequireDefault(require("./Column"));
|
|
22
|
+
|
|
23
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
9
|
+
|
|
10
|
+
var _templateObject;
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
|
|
14
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
15
|
+
|
|
16
|
+
var Heading1 = _styledComponents.default.h1(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n font-size: var(--font-h1);\n word-break: break-word;\n white-space: pre;\n\n ", "\n"])), function (_ref) {
|
|
17
|
+
var center = _ref.center;
|
|
18
|
+
return center && 'text-align: center;';
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
var _default = Heading1;
|
|
22
|
+
exports.default = _default;
|