@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.
Files changed (200) hide show
  1. package/Tab/Tab.js +28 -0
  2. package/Tab/TabContext.js +12 -0
  3. package/Tab/TabList.js +47 -0
  4. package/Tab/TabPanel.js +85 -0
  5. package/Tab/TabTab.js +63 -0
  6. package/Tab/index.js +24 -0
  7. package/animate/Collapse.js +1 -1
  8. package/animate/NumberCounter.js +1 -1
  9. package/assets/font/helvetica/Helvetica.ttf +0 -0
  10. package/assets/font/nanumGothic/NanumGothic-Bold.ttf +0 -0
  11. package/assets/font/nanumGothic/NanumGothic-ExtraBold.ttf +0 -0
  12. package/assets/font/nanumGothic/NanumGothic-Regular.ttf +0 -0
  13. package/assets/icons/app-management.png +0 -0
  14. package/assets/icons/burger.png +0 -0
  15. package/assets/icons/map_icon1.png +0 -0
  16. package/assets/icons/map_icon4.png +0 -0
  17. package/assets/images/bg-chart-circle.png +0 -0
  18. package/assets/images/bg-chart-triangle.png +0 -0
  19. package/assets/images/cashub-logo-only.png +0 -0
  20. package/assets/images/logo-cashub.png +0 -0
  21. package/assets/images/map.png +0 -0
  22. package/assets/images/qrcode.png +0 -0
  23. package/backdrop/index.js +31 -0
  24. package/badge/BadgeFill.js +3 -3
  25. package/billing/BarChart.js +58 -0
  26. package/billing/Grid.js +49 -0
  27. package/billing/Header2.js +28 -0
  28. package/billing/Header3.js +44 -0
  29. package/billing/Paragraph.js +39 -0
  30. package/billing/ParagraphGroup.js +25 -0
  31. package/billing/ParagraphText.js +31 -0
  32. package/billing/Section.js +60 -0
  33. package/billing/SectionBody.js +20 -0
  34. package/billing/SectionHeader.js +31 -0
  35. package/billing/__stories__/BarChart.stories.js_bak +46 -0
  36. package/billing/__stories__/Grid.stories.js_bak +57 -0
  37. package/billing/__stories__/Header2.stories.js_bak +62 -0
  38. package/billing/__stories__/Header3.stories.js_bak +69 -0
  39. package/billing/__stories__/Paragraph.stories.js_bak +84 -0
  40. package/billing/__stories__/ParagraphGroup.stories.js_bak +68 -0
  41. package/billing/__stories__/ParagraphText.stories.js_bak +64 -0
  42. package/billing/__stories__/Section.stories.js_bak +115 -0
  43. package/billing/__stories__/SectionBody.stories.js_bak +62 -0
  44. package/billing/__stories__/SectionHeader.stories.js-bak +68 -0
  45. package/breadcrumb/Breadcrumb.js +11 -6
  46. package/button/IconButton.js +1 -1
  47. package/callout/Callout.js +36 -0
  48. package/callout/index.js +15 -0
  49. package/chart/BarChart.js +130 -0
  50. package/chart/DoughnutChart.js +59 -0
  51. package/chart/LineChart.js +121 -0
  52. package/chart/SingleBarChart.js +31 -0
  53. package/chart/index.js +39 -0
  54. package/container/FlexContainer.js +25 -0
  55. package/container/index.js +15 -0
  56. package/cropper/Cropper.js +1 -1
  57. package/datetimePicker/Accordion.js +342 -0
  58. package/datetimePicker/CustomTimeInput.js +77 -0
  59. package/datetimePicker/DatePicker.js +413 -0
  60. package/datetimePicker/DatePickerV2.js +456 -0
  61. package/datetimePicker/DateTimePickerContext.js +12 -0
  62. package/datetimePicker/DatetimePicker.js +80 -0
  63. package/datetimePicker/DatetimePickerV2.js +478 -0
  64. package/datetimePicker/TimeInput.js +37 -0
  65. package/datetimePicker/TimePicker.js +324 -0
  66. package/datetimePicker/accordion/Month.js +190 -0
  67. package/datetimePicker/accordion/Year.js +247 -0
  68. package/datetimePicker/hooks/index.js +31 -0
  69. package/datetimePicker/hooks/useChangeNumber.js +55 -0
  70. package/datetimePicker/hooks/useDecrease.js +54 -0
  71. package/datetimePicker/hooks/useIncrease.js +54 -0
  72. package/datetimePicker/index.js +47 -0
  73. package/datetimePicker/provider/constant.js +44 -0
  74. package/datetimePicker/utils/GMTDate.js +23 -0
  75. package/datetimePicker/utils/pad.js +17 -0
  76. package/descriptionList/DescriptionDetail.js +22 -0
  77. package/descriptionList/DescriptionList.js +22 -0
  78. package/descriptionList/DescriptionTerm.js +19 -0
  79. package/descriptionList/index.js +31 -0
  80. package/divider/Divider.js +25 -0
  81. package/divider/index.js +15 -0
  82. package/dropdown/Dropdown.js +92 -0
  83. package/dropdown/DropdownButtonOption.js +19 -0
  84. package/dropdown/DropdownContent.js +94 -0
  85. package/dropdown/DropdownContext.js +12 -0
  86. package/dropdown/DropdownDivOption.js +19 -0
  87. package/dropdown/DropdownItem.js +32 -0
  88. package/dropdown/DropdownLinkOption.js +20 -0
  89. package/dropdown/DropdownToggle.js +58 -0
  90. package/dropdown/index.js +53 -0
  91. package/dropzone/FileDropzone.js +24 -24
  92. package/dropzone/ImageDropzone.js +33 -33
  93. package/form/Label.js +1 -1
  94. package/form/Searchbox.js +4 -4
  95. package/geolocation/MapInteractor.js +41 -0
  96. package/geolocation/MapSearchBoxControl.js +100 -0
  97. package/geolocation/ReverseGeolocation.js +160 -0
  98. package/geolocation/index.js +23 -0
  99. package/grid/Column.js +33 -0
  100. package/grid/Grid.js +28 -0
  101. package/grid/index.js +23 -0
  102. package/heading/Heading1.js +22 -0
  103. package/heading/Heading2.js +25 -0
  104. package/heading/Heading3.js +7 -4
  105. package/heading/index.js +31 -0
  106. package/icon/IconFigure.js +36 -0
  107. package/icon/index.js +15 -0
  108. package/iconbox/ApplicationIconBox.js +51 -0
  109. package/iconbox/IconBox.js +56 -0
  110. package/iconbox/IconBoxFigure.js +37 -0
  111. package/iconbox/IconBoxImage.js +32 -0
  112. package/iconbox/IconBoxV2.js +42 -0
  113. package/iconbox/index.js +31 -0
  114. package/image/UploadImage.js +2 -2
  115. package/index.js +377 -0
  116. package/jsoneditor/JsonEditor.js +53 -0
  117. package/jsoneditor/index.js +15 -0
  118. package/layout/Backdrop.js +25 -0
  119. package/layout/Container.js +34 -0
  120. package/layout/Footer.js +32 -0
  121. package/layout/Logo.js +34 -0
  122. package/layout/MenuIcon.js +43 -0
  123. package/link/LinkSpan.js +57 -0
  124. package/link/index.js +15 -0
  125. package/map/CustomLeafletMapContainer.js +23 -0
  126. package/map/LeafletMap.js +224 -0
  127. package/map/index.js +23 -0
  128. package/modal/StateModal.js +2 -2
  129. package/modal/TitleModal.js +4 -4
  130. package/module/geolocation/api.js +51 -0
  131. package/module/message/index.js +59 -0
  132. package/package.json +16 -1
  133. package/paginate/Paginate.js +110 -0
  134. package/paginate/index.js +15 -0
  135. package/popover/Popover.js +122 -0
  136. package/popover/index.js +15 -0
  137. package/qrcode/QRCode.js +57 -0
  138. package/qrcode/QRCodeContainter.js +34 -0
  139. package/qrcode/index.js +23 -0
  140. package/ribbon/Ribbon.js +28 -0
  141. package/ribbon/index.js +15 -0
  142. package/section/Section.js +67 -0
  143. package/section/SectionBody.js +38 -0
  144. package/section/SectionHeader.js +42 -0
  145. package/section/SectionToolbar.js +22 -0
  146. package/section/index.js +50 -0
  147. package/select/ListBox.js +26 -0
  148. package/select/Option.js +28 -0
  149. package/select/OptionGroup.js +20 -0
  150. package/select/Options.js +25 -0
  151. package/select/SearchBox.js +52 -0
  152. package/select/Select.js +630 -0
  153. package/select/SelectedMultiple.js +34 -0
  154. package/select/SelectedSingle.js +20 -0
  155. package/select/index.js +15 -0
  156. package/services/api/index.js +73 -0
  157. package/styles/header.style.js +11 -0
  158. package/styles/sidebar.style.js +18 -0
  159. package/styles/theme/dark.theme.js +95 -0
  160. package/styles/theme/index.js +16 -0
  161. package/table/ImageBox.js +39 -0
  162. package/table/Logo.js +40 -0
  163. package/table/PermissionTable.js +42 -0
  164. package/table/Table.js +377 -0
  165. package/table/TableFooter.js +19 -0
  166. package/table/TableFooterInfo.js +19 -0
  167. package/table/TableFooterPager.js +19 -0
  168. package/table/TableHeadCell.js +39 -0
  169. package/table/TableSort.js +34 -0
  170. package/table/hooks/index.js +31 -0
  171. package/table/hooks/useLimitChange.js +34 -0
  172. package/table/hooks/usePageChange.js +33 -0
  173. package/table/hooks/useSortChange.js +35 -0
  174. package/table/index.js +31 -0
  175. package/tagify/Tags.js +55 -0
  176. package/tagify/index.js +15 -0
  177. package/text/Paragraph.js +37 -0
  178. package/text/index.js +15 -0
  179. package/timeline/Timeline.js +51 -0
  180. package/timeline/index.js +15 -0
  181. package/toast/CustomToastContainer.js +20 -0
  182. package/toast/index.js +23 -0
  183. package/tooltip/Tooltip.js +154 -0
  184. package/tooltip/index.js +15 -0
  185. package/utils/array/generateRange.js +19 -0
  186. package/utils/chart/customTooltip.js +89 -0
  187. package/utils/chart/padEmptyChartBar.js +48 -0
  188. package/utils/dataURLtoFile.js +23 -6
  189. package/utils/format/datetimeFormat.js +70 -0
  190. package/utils/format/formatDate.js +46 -0
  191. package/utils/format/formatSize.js +1 -1
  192. package/utils/getBase64.js +2 -5
  193. package/utils/hooks/useCustomPopper.js +49 -0
  194. package/utils/hooks/useForkRef.js +28 -0
  195. package/utils/hooks/usePagination.js +86 -0
  196. package/utils/image/resize.js +7 -7
  197. package/utils/react/setRef.js +17 -0
  198. package/utils/regex/check.js +13 -0
  199. package/wizard/Wizard.js +210 -0
  200. 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(e) {
83
- e.preventDefault();
84
- e.stopPropagation();
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(e) {
89
- e.preventDefault();
90
- e.stopPropagation();
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(e) {
95
- e.preventDefault();
96
- e.stopPropagation();
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(e) {
101
- e.preventDefault();
102
- e.stopPropagation();
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 = e.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 i = 0; i < newFiles.length; i++) {
116
- newFiles[i].url = URL.createObjectURL(newFiles[i]);
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 i = 0; i < newFiles.length; i++) {
130
- newFiles[i].url = URL.createObjectURL(newFiles[i]);
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 (e, index) {
137
- if (e) {
138
- e.stopPropagation();
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 (e) {
148
- var files = e.target.files;
147
+ var handleChangeFile = (0, _react.useCallback)(function (event) {
148
+ var files = event.target.files;
149
149
  var newFiles = [];
150
150
 
151
- for (var i = 0; i < files.length; i++) {
152
- newFiles.push(files[i]);
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 (e, index, file) {
159
- e.stopPropagation();
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(e) {
183
- e.stopPropagation();
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(e) {
189
- return handleCrop(e, index, file);
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(e) {
196
- return handleRemoveFile(e, index);
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 && "display: inline; margin-bottom: 0;";
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(e) {
66
- if (e.keyCode === 108 || e.keyCode === 13) {
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(e) {
89
- return setKeyword(e.target.value);
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;