@cashub/ui 0.21.0 → 0.22.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 (230) hide show
  1. package/Tab/Tab.js +9 -13
  2. package/Tab/TabList.js +14 -32
  3. package/Tab/TabPanel.js +21 -58
  4. package/Tab/TabTab.js +20 -40
  5. package/Tab/index.js +2 -10
  6. package/Tab/subComponent/TabContext.js +2 -5
  7. package/animate/Collapse.js +26 -53
  8. package/animate/Loader.js +21 -26
  9. package/animate/NumberCounter.js +22 -44
  10. package/animate/PulseRing.js +9 -21
  11. package/animate/Spinner.js +2 -10
  12. package/animate/index.js +5 -11
  13. package/backdrop/BaseBackdrop.js +2 -9
  14. package/backdrop/LoadingBackdrop.js +2 -9
  15. package/backdrop/ModalBackdrop.js +2 -9
  16. package/backdrop/index.js +3 -7
  17. package/badge/Badge.js +2 -11
  18. package/badge/BadgeDot.js +2 -10
  19. package/badge/BadgeFill.js +15 -20
  20. package/badge/BadgeWithText.js +6 -13
  21. package/badge/index.js +4 -9
  22. package/billing/BarChart.js +10 -17
  23. package/billing/Grid.js +11 -15
  24. package/billing/Header2.js +6 -9
  25. package/billing/Header3.js +9 -16
  26. package/billing/Paragraph.js +8 -14
  27. package/billing/ParagraphGroup.js +6 -9
  28. package/billing/ParagraphText.js +7 -12
  29. package/billing/Section.js +13 -23
  30. package/billing/SectionBody.js +5 -8
  31. package/billing/SectionHeader.js +7 -12
  32. package/breadcrumb/Breadcrumb.js +11 -21
  33. package/breadcrumb/index.js +1 -3
  34. package/button/Button.js +41 -38
  35. package/button/ButtonGroup.js +21 -18
  36. package/button/IconButton.js +29 -29
  37. package/button/ScrollToTopButton.js +12 -39
  38. package/button/index.js +4 -9
  39. package/callout/Callout.js +13 -26
  40. package/callout/index.js +1 -3
  41. package/chart/BarChart.js +28 -53
  42. package/chart/DoughnutChart.js +23 -62
  43. package/chart/LineChart.js +33 -55
  44. package/chart/SingleBarChart.js +11 -17
  45. package/chart/index.js +5 -12
  46. package/chart/utils/customTooltip.js +26 -43
  47. package/chart/utils/htmlLegendPlugin.js +24 -30
  48. package/chart/utils/index.js +3 -7
  49. package/chart/utils/padEmptyChartBar.js +24 -22
  50. package/container/FlexContainer.js +14 -12
  51. package/container/index.js +1 -3
  52. package/cropper/Cropper.js +21 -34
  53. package/cropper/CropperModalHandler.js +15 -21
  54. package/cropper/index.js +2 -5
  55. package/cropper/subComponent/CropImageModal.js +23 -58
  56. package/datetimePicker/DatePicker.js +103 -217
  57. package/datetimePicker/DatePickerV2.js +116 -221
  58. package/datetimePicker/DatetimePicker.js +27 -48
  59. package/datetimePicker/DatetimePickerV2.js +115 -231
  60. package/datetimePicker/TimeInput.js +9 -22
  61. package/datetimePicker/TimePicker.js +94 -151
  62. package/datetimePicker/TimePickerStyle.js +2 -9
  63. package/datetimePicker/accordion/Month.js +70 -90
  64. package/datetimePicker/accordion/Year.js +91 -135
  65. package/datetimePicker/hooks/index.js +3 -7
  66. package/datetimePicker/hooks/useChangeNumber.js +14 -27
  67. package/datetimePicker/hooks/useDecrease.js +19 -35
  68. package/datetimePicker/hooks/useIncrease.js +19 -35
  69. package/datetimePicker/index.js +7 -15
  70. package/datetimePicker/provider/constant.js +2 -3
  71. package/datetimePicker/subComponent/Accordion.js +108 -158
  72. package/datetimePicker/subComponent/CustomTimeInput.js +18 -48
  73. package/datetimePicker/subComponent/DateTimePickerContext.js +2 -5
  74. package/datetimePicker/utils/GMTDate.js +3 -7
  75. package/datetimePicker/utils/pad.js +2 -6
  76. package/datetimePicker/utils/toUTC0.js +3 -6
  77. package/descriptionList/DescriptionDetail.js +5 -10
  78. package/descriptionList/DescriptionList.js +5 -10
  79. package/descriptionList/DescriptionTerm.js +2 -9
  80. package/descriptionList/index.js +3 -7
  81. package/divider/Divider.js +9 -12
  82. package/divider/index.js +1 -3
  83. package/dropdown/Dropdown.js +28 -65
  84. package/dropdown/DropdownButtonOption.js +2 -9
  85. package/dropdown/DropdownContent.js +33 -64
  86. package/dropdown/DropdownDivOption.js +2 -9
  87. package/dropdown/DropdownItem.js +10 -16
  88. package/dropdown/DropdownLinkOption.js +2 -9
  89. package/dropdown/DropdownToggle.js +18 -38
  90. package/dropdown/index.js +6 -17
  91. package/dropdown/subComponent/DropdownContext.js +2 -5
  92. package/dropzone/FileDropzone.js +148 -302
  93. package/dropzone/ImageDropzone.js +96 -171
  94. package/dropzone/index.js +2 -5
  95. package/dropzone/subComponent/Message.js +7 -14
  96. package/figure/IconFigure.js +9 -16
  97. package/figure/ImageFigure.js +11 -17
  98. package/figure/index.js +2 -5
  99. package/file/HiddenFileInput.js +5 -14
  100. package/file/index.js +1 -3
  101. package/form/Checkbox.js +34 -43
  102. package/form/FormItem.js +2 -9
  103. package/form/Input.js +18 -15
  104. package/form/Label.js +20 -13
  105. package/form/MutedText.js +5 -10
  106. package/form/RadioButton.js +20 -32
  107. package/form/Searchbox.js +21 -65
  108. package/form/Slider.js +25 -0
  109. package/form/SwitchButton.js +34 -39
  110. package/form/Textarea.js +2 -11
  111. package/form/TreeView.js +64 -0
  112. package/form/index.js +16 -19
  113. package/grid/Column.js +17 -17
  114. package/grid/Grid.js +13 -14
  115. package/grid/index.js +2 -5
  116. package/heading/Heading1.js +5 -10
  117. package/heading/Heading2.js +9 -12
  118. package/heading/Heading3.js +21 -18
  119. package/heading/index.js +3 -7
  120. package/helmet/Helmet.js +6 -9
  121. package/helmet/index.js +2 -5
  122. package/iconbox/ApplicationIconBox.js +25 -31
  123. package/iconbox/IconBox.js +11 -24
  124. package/iconbox/IconBoxV2.js +14 -26
  125. package/iconbox/index.js +3 -7
  126. package/iconbox/subComponent/IconBoxFigure.js +25 -20
  127. package/iconbox/subComponent/IconBoxImage.js +15 -18
  128. package/image/ImageFluid.js +2 -10
  129. package/image/UploadImage.js +65 -113
  130. package/image/index.js +2 -5
  131. package/index.js +44 -130
  132. package/jsoneditor/JsonEditor.js +10 -32
  133. package/jsoneditor/index.js +1 -3
  134. package/keyframe/Pulse.js +2 -7
  135. package/keyframe/Spin.js +2 -7
  136. package/link/LinkSpan.js +22 -35
  137. package/link/index.js +1 -3
  138. package/map/GoogleMap.js +122 -175
  139. package/map/GoogleReverseGeolocation.js +79 -186
  140. package/map/LeafletMap.js +78 -132
  141. package/map/LeafletReverseGeolocation.js +49 -121
  142. package/map/index.js +4 -9
  143. package/map/subComponent/BasicLeafletMap.js +8 -14
  144. package/map/subComponent/GoogleMapContainer.js +5 -10
  145. package/map/subComponent/GoogleMapPopup.js +66 -123
  146. package/map/subComponent/GoogleMapWrapper.js +13 -32
  147. package/map/subComponent/GoogleMarkerSpiderfier.js +14 -24
  148. package/map/subComponent/LeafletDrawControl.js +47 -84
  149. package/map/subComponent/LeafletMapContainer.js +5 -10
  150. package/map/subComponent/MapSearchBoxControl.js +24 -70
  151. package/modal/StateModal.js +41 -100
  152. package/modal/TitleModal.js +89 -190
  153. package/modal/index.js +2 -5
  154. package/package.json +1 -1
  155. package/paginate/Paginate.js +40 -54
  156. package/paginate/index.js +1 -3
  157. package/popover/Popover.js +39 -87
  158. package/popover/index.js +1 -3
  159. package/qrcode/QRCode.js +10 -23
  160. package/qrcode/QRCodeContainter.js +8 -16
  161. package/qrcode/index.js +2 -5
  162. package/ribbon/Ribbon.js +4 -15
  163. package/ribbon/index.js +1 -3
  164. package/section/Section.js +57 -39
  165. package/section/SectionBody.js +15 -22
  166. package/section/SectionHeader.js +27 -27
  167. package/section/SectionToolbar.js +2 -9
  168. package/section/SectionToolbarItem.js +2 -9
  169. package/section/index.js +5 -11
  170. package/select/InputSelect.js +103 -215
  171. package/select/Select.js +204 -362
  172. package/select/index.js +2 -5
  173. package/select/subComponent/ListBox.js +9 -12
  174. package/select/subComponent/Option.js +8 -16
  175. package/select/subComponent/OptionGroup.js +2 -9
  176. package/select/subComponent/Options.js +5 -11
  177. package/select/subComponent/SearchBox.js +9 -29
  178. package/select/subComponent/SelectedMultiple.js +8 -16
  179. package/select/subComponent/SelectedSingle.js +2 -9
  180. package/styles/GlobalStyle.js +169 -91
  181. package/styles/config/breakpoint.style.js +2 -3
  182. package/styles/config/header.style.js +2 -3
  183. package/styles/config/sidebar.style.js +2 -3
  184. package/styles/index.js +2 -5
  185. package/styles/mixin/backgroundColor.js +17 -14
  186. package/styles/mixin/borderColor.js +17 -14
  187. package/styles/mixin/color.js +17 -14
  188. package/styles/mixin/colorOnBackground.js +17 -14
  189. package/styles/mixin/inputPlaceholder.js +3 -9
  190. package/styles/mixin/media.js +3 -11
  191. package/styles/mixin/rounded.js +13 -12
  192. package/styles/mixin/scrollbar.js +7 -13
  193. package/styles/theme/dark.theme.js +20 -20
  194. package/styles/theme/light.theme.js +20 -20
  195. package/styles/theme/white.theme.js +20 -20
  196. package/styles/themes.js +2 -8
  197. package/table/GridTable.js +105 -143
  198. package/table/ImageBox.js +8 -18
  199. package/table/PermissionTable.js +25 -25
  200. package/table/Table.js +137 -153
  201. package/table/__mock__/columns.js +2 -3
  202. package/table/__mock__/data.js +2 -3
  203. package/table/hooks/index.js +2 -5
  204. package/table/hooks/useCalculateDataRange.js +9 -36
  205. package/table/hooks/useGenerateSort.js +6 -17
  206. package/table/index.js +4 -9
  207. package/table/subComponent/BaseTableHeadCell.js +15 -21
  208. package/table/subComponent/GridTableFooter.js +5 -10
  209. package/table/subComponent/GridTableHeadCell.js +5 -10
  210. package/table/subComponent/Resizer.js +17 -44
  211. package/table/subComponent/TableFooter.js +5 -10
  212. package/table/subComponent/TableFooterInfo.js +2 -9
  213. package/table/subComponent/TableFooterPager.js +5 -12
  214. package/table/subComponent/TableHeadCell.js +2 -9
  215. package/table/subComponent/TableSort.js +13 -19
  216. package/tagify/TagifyStyle.js +2 -9
  217. package/tagify/Tags.js +15 -37
  218. package/tagify/index.js +2 -5
  219. package/text/Paragraph.js +25 -20
  220. package/text/index.js +1 -3
  221. package/timeline/Timeline.js +28 -37
  222. package/timeline/index.js +1 -3
  223. package/toast/CustomToastContainer.js +2 -9
  224. package/toast/MessageContainer.js +9 -18
  225. package/toast/index.js +3 -8
  226. package/toast/show.js +18 -28
  227. package/tooltip/Tooltip.js +48 -97
  228. package/tooltip/index.js +1 -3
  229. package/wizard/Wizard.js +63 -133
  230. package/wizard/index.js +1 -3
@@ -1,128 +1,56 @@
1
1
  "use strict";
2
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
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
8
6
  exports.default = void 0;
9
-
10
7
  var _react = require("react");
11
-
12
8
  var _styledComponents = _interopRequireDefault(require("styled-components"));
13
-
14
9
  var _GoogleMapWrapper = _interopRequireDefault(require("./subComponent/GoogleMapWrapper"));
15
-
16
10
  var _GoogleMapContainer = _interopRequireDefault(require("./subComponent/GoogleMapContainer"));
17
-
18
11
  var _Searchbox = _interopRequireDefault(require("../form/Searchbox"));
19
-
20
12
  var _map_icon = _interopRequireDefault(require("../assets/icons/map_icon4.png"));
21
-
22
13
  var _jsxRuntime = require("react/jsx-runtime");
23
-
24
14
  var _templateObject;
25
-
26
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
-
28
16
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
29
-
30
- 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; }
31
-
32
- 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); } }
33
-
34
- 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); }); }; }
35
-
36
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
37
-
38
- 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."); }
39
-
40
- 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); }
41
-
42
- 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; }
43
-
44
- 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; }
45
-
46
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
47
-
48
- var GoogleReverseGeolocation = function GoogleReverseGeolocation(_ref) {
49
- var apiKey = _ref.apiKey,
50
- children = _ref.children,
51
- defaultLatlng = _ref.defaultLatlng,
52
- changeLatlng = _ref.changeLatlng,
53
- onChoose = _ref.onChoose,
54
- onSearch = _ref.onSearch,
55
- onError = _ref.onError;
56
-
57
- var _useState = (0, _react.useState)(defaultLatlng),
58
- _useState2 = _slicedToArray(_useState, 2),
59
- markerLatLng = _useState2[0],
60
- setMarkerLatLng = _useState2[1];
61
-
62
- var handleChangeLatlng = function handleChangeLatlng(latlng) {
17
+ const GoogleReverseGeolocation = _ref => {
18
+ let {
19
+ apiKey,
20
+ children,
21
+ defaultLatlng,
22
+ changeLatlng,
23
+ onChoose,
24
+ onSearch,
25
+ onError
26
+ } = _ref;
27
+ const [markerLatLng, setMarkerLatLng] = (0, _react.useState)(defaultLatlng);
28
+ const handleChangeLatlng = latlng => {
63
29
  setMarkerLatLng(latlng);
64
30
  changeLatlng(latlng);
65
31
  };
66
-
67
- var confirmChooseLocation = /*#__PURE__*/function () {
68
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(callback) {
69
- var address;
70
- return _regeneratorRuntime().wrap(function _callee$(_context) {
71
- while (1) {
72
- switch (_context.prev = _context.next) {
73
- case 0:
74
- if (!(markerLatLng.lat && markerLatLng.lng)) {
75
- _context.next = 13;
76
- break;
77
- }
78
-
79
- _context.prev = 1;
80
- _context.next = 4;
81
- return onChoose(markerLatLng);
82
-
83
- case 4:
84
- address = _context.sent;
85
-
86
- if (address) {
87
- callback({
88
- address: address
89
- });
90
- } else {
91
- callback({
92
- error: 'ReverseGeo'
93
- });
94
- }
95
-
96
- _context.next = 11;
97
- break;
98
-
99
- case 8:
100
- _context.prev = 8;
101
- _context.t0 = _context["catch"](1);
102
- callback(_context.t0);
103
-
104
- case 11:
105
- _context.next = 14;
106
- break;
107
-
108
- case 13:
109
- callback({
110
- error: 'PleaseChooseLocation'
111
- });
112
-
113
- case 14:
114
- case "end":
115
- return _context.stop();
116
- }
32
+ const confirmChooseLocation = async callback => {
33
+ if (markerLatLng.lat && markerLatLng.lng) {
34
+ try {
35
+ const address = await onChoose(markerLatLng);
36
+ if (address) {
37
+ callback({
38
+ address
39
+ });
40
+ } else {
41
+ callback({
42
+ error: 'ReverseGeo'
43
+ });
117
44
  }
118
- }, _callee, null, [[1, 8]]);
119
- }));
120
-
121
- return function confirmChooseLocation(_x) {
122
- return _ref2.apply(this, arguments);
123
- };
124
- }();
125
-
45
+ } catch (error) {
46
+ callback(error);
47
+ }
48
+ } else {
49
+ callback({
50
+ error: 'PleaseChooseLocation'
51
+ });
52
+ }
53
+ };
126
54
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
127
55
  children: children( /*#__PURE__*/(0, _jsxRuntime.jsx)(_GoogleMapWrapper.default, {
128
56
  apiKey: apiKey,
@@ -136,24 +64,20 @@ var GoogleReverseGeolocation = function GoogleReverseGeolocation(_ref) {
136
64
  }), confirmChooseLocation)
137
65
  });
138
66
  };
139
-
140
- var Map = function Map(_ref3) {
141
- var height = _ref3.height,
142
- zoom = _ref3.zoom,
143
- markerLatLng = _ref3.markerLatLng,
144
- handleChangeLatlng = _ref3.handleChangeLatlng,
145
- onSearch = _ref3.onSearch,
146
- onError = _ref3.onError;
147
- var ref = (0, _react.useRef)(null);
148
-
149
- var _useState3 = (0, _react.useState)(),
150
- _useState4 = _slicedToArray(_useState3, 2),
151
- map = _useState4[0],
152
- setMap = _useState4[1];
153
-
154
- var options = (0, _react.useMemo)(function () {
67
+ const Map = _ref2 => {
68
+ let {
69
+ height,
70
+ zoom,
71
+ markerLatLng,
72
+ handleChangeLatlng,
73
+ onSearch,
74
+ onError
75
+ } = _ref2;
76
+ const ref = (0, _react.useRef)(null);
77
+ const [map, setMap] = (0, _react.useState)();
78
+ const options = (0, _react.useMemo)(() => {
155
79
  return {
156
- zoom: zoom,
80
+ zoom,
157
81
  center: {
158
82
  lat: 1,
159
83
  lng: 1
@@ -180,77 +104,49 @@ var Map = function Map(_ref3) {
180
104
  }
181
105
  };
182
106
  }, [zoom]);
183
-
184
- var handleError = function handleError(errorCode) {
107
+ const handleError = errorCode => {
185
108
  if (onError) {
186
109
  onError(errorCode);
187
110
  }
188
111
  };
112
+ const handleSearch = async address => {
113
+ try {
114
+ const latlng = await onSearch(address);
115
+ if (latlng) {
116
+ map.setZoom(15);
117
+ map.panTo(latlng);
118
+ handleChangeLatlng(latlng);
119
+ } else {
120
+ handleError('NO_RESULT');
121
+ }
122
+ } catch (error) {
123
+ handleError(error.message);
124
+ }
125
+ };
189
126
 
190
- var handleSearch = /*#__PURE__*/function () {
191
- var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(address) {
192
- var latlng;
193
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
194
- while (1) {
195
- switch (_context2.prev = _context2.next) {
196
- case 0:
197
- _context2.prev = 0;
198
- _context2.next = 3;
199
- return onSearch(address);
200
-
201
- case 3:
202
- latlng = _context2.sent;
203
-
204
- if (latlng) {
205
- map.setZoom(15);
206
- map.panTo(latlng);
207
- handleChangeLatlng(latlng);
208
- } else {
209
- handleError('NO_RESULT');
210
- }
211
-
212
- _context2.next = 10;
213
- break;
214
-
215
- case 7:
216
- _context2.prev = 7;
217
- _context2.t0 = _context2["catch"](0);
218
- handleError(_context2.t0.message);
219
-
220
- case 10:
221
- case "end":
222
- return _context2.stop();
223
- }
224
- }
225
- }, _callee2, null, [[0, 7]]);
226
- }));
227
-
228
- return function handleSearch(_x2) {
229
- return _ref4.apply(this, arguments);
230
- };
231
- }(); // setup map
232
-
233
-
234
- (0, _react.useEffect)(function () {
127
+ // setup map
128
+ (0, _react.useEffect)(() => {
235
129
  if (map) {
236
130
  map.setOptions(options);
237
131
  }
238
- }, [map, options]); // click to choose location
132
+ }, [map, options]);
239
133
 
240
- (0, _react.useEffect)(function () {
134
+ // click to choose location
135
+ (0, _react.useEffect)(() => {
241
136
  if (map) {
242
- map.addListener('click', function (event) {
137
+ map.addListener('click', event => {
243
138
  handleChangeLatlng(event.latLng.toJSON());
244
139
  });
245
- return function () {
140
+ return () => {
246
141
  window.google.maps.event.clearListeners(map, 'click');
247
142
  };
248
143
  }
249
- }, [map, handleChangeLatlng]); // render marker cluster
144
+ }, [map, handleChangeLatlng]);
250
145
 
251
- (0, _react.useEffect)(function () {
146
+ // render marker cluster
147
+ (0, _react.useEffect)(() => {
252
148
  if (map && markerLatLng.lat && markerLatLng.lng) {
253
- var marker = new window.google.maps.Marker({
149
+ const marker = new window.google.maps.Marker({
254
150
  icon: {
255
151
  url: _map_icon.default,
256
152
  scaledSize: new window.google.maps.Size(40, 50)
@@ -258,12 +154,12 @@ var Map = function Map(_ref3) {
258
154
  position: markerLatLng
259
155
  });
260
156
  marker.setMap(map);
261
- return function () {
157
+ return () => {
262
158
  marker.setMap(null);
263
159
  };
264
160
  }
265
161
  }, [map, markerLatLng]);
266
- (0, _react.useEffect)(function () {
162
+ (0, _react.useEffect)(() => {
267
163
  if (ref.current && !map) {
268
164
  setMap(new window.google.maps.Map(ref.current, {}));
269
165
  }
@@ -281,15 +177,15 @@ var Map = function Map(_ref3) {
281
177
  ref: ref,
282
178
  height: height,
283
179
  tabIndex: "0",
284
- onClick: function onClick(event) {
180
+ onClick: event => {
285
181
  event.target.focus();
286
182
  },
287
- onFocus: function onFocus() {
183
+ onFocus: () => {
288
184
  map.setOptions({
289
185
  scrollwheel: true
290
186
  });
291
187
  },
292
- onBlur: function onBlur() {
188
+ onBlur: () => {
293
189
  map.setOptions({
294
190
  scrollwheel: false
295
191
  });
@@ -297,8 +193,5 @@ var Map = function Map(_ref3) {
297
193
  })]
298
194
  });
299
195
  };
300
-
301
- var MapSearchBoxControl = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: absolute;\n top: var(--spacing-s);\n right: var(--spacing-s);\n z-index: 1;\n"])));
302
-
303
- var _default = GoogleReverseGeolocation;
304
- exports.default = _default;
196
+ const MapSearchBoxControl = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: absolute;\n top: var(--spacing-s);\n right: var(--spacing-s);\n z-index: 1;\n"])));
197
+ var _default = exports.default = GoogleReverseGeolocation;