@cashub/ui 0.20.0 → 0.21.1

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 (233) 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/assets/css/autocomplete.css +16 -16
  14. package/assets/css/font.css +4 -4
  15. package/assets/css/global.css +3 -3
  16. package/assets/css/normalize.css +386 -386
  17. package/backdrop/BaseBackdrop.js +2 -9
  18. package/backdrop/LoadingBackdrop.js +2 -9
  19. package/backdrop/ModalBackdrop.js +2 -9
  20. package/backdrop/index.js +3 -7
  21. package/badge/Badge.js +2 -11
  22. package/badge/BadgeDot.js +2 -10
  23. package/badge/BadgeFill.js +15 -20
  24. package/badge/BadgeWithText.js +6 -13
  25. package/badge/index.js +4 -9
  26. package/billing/BarChart.js +10 -17
  27. package/billing/Grid.js +11 -15
  28. package/billing/Header2.js +6 -9
  29. package/billing/Header3.js +9 -16
  30. package/billing/Paragraph.js +8 -14
  31. package/billing/ParagraphGroup.js +6 -9
  32. package/billing/ParagraphText.js +7 -12
  33. package/billing/Section.js +13 -23
  34. package/billing/SectionBody.js +5 -8
  35. package/billing/SectionHeader.js +7 -12
  36. package/breadcrumb/Breadcrumb.js +11 -21
  37. package/breadcrumb/index.js +1 -3
  38. package/button/Button.js +41 -38
  39. package/button/ButtonGroup.js +21 -18
  40. package/button/IconButton.js +29 -29
  41. package/button/ScrollToTopButton.js +12 -39
  42. package/button/index.js +4 -9
  43. package/callout/Callout.js +13 -26
  44. package/callout/index.js +1 -3
  45. package/chart/BarChart.js +28 -53
  46. package/chart/DoughnutChart.js +23 -62
  47. package/chart/LineChart.js +33 -55
  48. package/chart/SingleBarChart.js +11 -17
  49. package/chart/index.js +5 -12
  50. package/chart/utils/customTooltip.js +26 -43
  51. package/chart/utils/htmlLegendPlugin.js +24 -30
  52. package/chart/utils/index.js +3 -7
  53. package/chart/utils/padEmptyChartBar.js +24 -22
  54. package/container/FlexContainer.js +9 -12
  55. package/container/index.js +1 -3
  56. package/cropper/Cropper.js +21 -34
  57. package/cropper/CropperModalHandler.js +15 -21
  58. package/cropper/index.js +2 -5
  59. package/cropper/subComponent/CropImageModal.js +23 -58
  60. package/datetimePicker/DatePicker.js +103 -217
  61. package/datetimePicker/DatePickerV2.js +116 -221
  62. package/datetimePicker/DatetimePicker.js +27 -48
  63. package/datetimePicker/DatetimePickerV2.js +115 -231
  64. package/datetimePicker/TimeInput.js +9 -22
  65. package/datetimePicker/TimePicker.js +94 -151
  66. package/datetimePicker/TimePickerStyle.js +14 -0
  67. package/datetimePicker/accordion/Month.js +70 -90
  68. package/datetimePicker/accordion/Year.js +91 -135
  69. package/datetimePicker/hooks/index.js +3 -7
  70. package/datetimePicker/hooks/useChangeNumber.js +14 -27
  71. package/datetimePicker/hooks/useDecrease.js +19 -35
  72. package/datetimePicker/hooks/useIncrease.js +19 -35
  73. package/datetimePicker/index.js +13 -13
  74. package/datetimePicker/provider/constant.js +2 -3
  75. package/datetimePicker/subComponent/Accordion.js +108 -158
  76. package/datetimePicker/subComponent/CustomTimeInput.js +18 -48
  77. package/datetimePicker/subComponent/DateTimePickerContext.js +2 -5
  78. package/datetimePicker/utils/GMTDate.js +3 -7
  79. package/datetimePicker/utils/pad.js +2 -6
  80. package/datetimePicker/utils/toUTC0.js +3 -6
  81. package/descriptionList/DescriptionDetail.js +5 -10
  82. package/descriptionList/DescriptionList.js +5 -10
  83. package/descriptionList/DescriptionTerm.js +2 -9
  84. package/descriptionList/index.js +3 -7
  85. package/divider/Divider.js +9 -12
  86. package/divider/index.js +1 -3
  87. package/dropdown/Dropdown.js +28 -65
  88. package/dropdown/DropdownButtonOption.js +2 -9
  89. package/dropdown/DropdownContent.js +33 -64
  90. package/dropdown/DropdownDivOption.js +2 -9
  91. package/dropdown/DropdownItem.js +10 -16
  92. package/dropdown/DropdownLinkOption.js +2 -9
  93. package/dropdown/DropdownToggle.js +18 -38
  94. package/dropdown/index.js +6 -17
  95. package/dropdown/subComponent/DropdownContext.js +2 -5
  96. package/dropzone/FileDropzone.js +148 -302
  97. package/dropzone/ImageDropzone.js +96 -171
  98. package/dropzone/index.js +2 -5
  99. package/dropzone/subComponent/Message.js +7 -14
  100. package/figure/IconFigure.js +9 -16
  101. package/figure/ImageFigure.js +11 -17
  102. package/figure/index.js +2 -5
  103. package/file/HiddenFileInput.js +5 -14
  104. package/file/index.js +1 -3
  105. package/form/Checkbox.js +34 -43
  106. package/form/FormItem.js +2 -9
  107. package/form/Input.js +13 -15
  108. package/form/Label.js +10 -13
  109. package/form/MutedText.js +5 -10
  110. package/form/RadioButton.js +20 -32
  111. package/form/Searchbox.js +21 -65
  112. package/form/Slider.js +14 -0
  113. package/form/SwitchButton.js +34 -39
  114. package/form/Textarea.js +2 -11
  115. package/form/index.js +9 -19
  116. package/grid/Column.js +17 -17
  117. package/grid/Grid.js +13 -14
  118. package/grid/index.js +2 -5
  119. package/heading/Heading1.js +5 -10
  120. package/heading/Heading2.js +9 -12
  121. package/heading/Heading3.js +21 -18
  122. package/heading/index.js +3 -7
  123. package/helmet/Helmet.js +6 -9
  124. package/helmet/index.js +2 -5
  125. package/iconbox/ApplicationIconBox.js +25 -31
  126. package/iconbox/IconBox.js +11 -24
  127. package/iconbox/IconBoxV2.js +14 -26
  128. package/iconbox/index.js +3 -7
  129. package/iconbox/subComponent/IconBoxFigure.js +25 -20
  130. package/iconbox/subComponent/IconBoxImage.js +15 -18
  131. package/image/ImageFluid.js +2 -10
  132. package/image/UploadImage.js +65 -113
  133. package/image/index.js +2 -5
  134. package/index.js +44 -130
  135. package/jsoneditor/JsonEditor.js +10 -32
  136. package/jsoneditor/index.js +1 -3
  137. package/keyframe/Pulse.js +2 -7
  138. package/keyframe/Spin.js +2 -7
  139. package/link/LinkSpan.js +22 -35
  140. package/link/index.js +1 -3
  141. package/map/GoogleMap.js +122 -175
  142. package/map/GoogleReverseGeolocation.js +79 -186
  143. package/map/LeafletMap.js +78 -132
  144. package/map/LeafletReverseGeolocation.js +49 -121
  145. package/map/index.js +4 -9
  146. package/map/subComponent/BasicLeafletMap.js +8 -14
  147. package/map/subComponent/GoogleMapContainer.js +5 -10
  148. package/map/subComponent/GoogleMapPopup.js +66 -123
  149. package/map/subComponent/GoogleMapWrapper.js +13 -32
  150. package/map/subComponent/GoogleMarkerSpiderfier.js +14 -24
  151. package/map/subComponent/LeafletDrawControl.js +47 -84
  152. package/map/subComponent/LeafletMapContainer.js +5 -10
  153. package/map/subComponent/MapSearchBoxControl.js +24 -70
  154. package/modal/StateModal.js +41 -100
  155. package/modal/TitleModal.js +89 -190
  156. package/modal/index.js +2 -5
  157. package/package.json +1 -1
  158. package/paginate/Paginate.js +40 -54
  159. package/paginate/index.js +1 -3
  160. package/popover/Popover.js +39 -87
  161. package/popover/index.js +1 -3
  162. package/qrcode/QRCode.js +10 -23
  163. package/qrcode/QRCodeContainter.js +8 -16
  164. package/qrcode/index.js +2 -5
  165. package/ribbon/Ribbon.js +4 -15
  166. package/ribbon/index.js +1 -3
  167. package/section/Section.js +57 -39
  168. package/section/SectionBody.js +15 -22
  169. package/section/SectionHeader.js +27 -27
  170. package/section/SectionToolbar.js +2 -9
  171. package/section/SectionToolbarItem.js +2 -9
  172. package/section/index.js +5 -11
  173. package/select/InputSelect.js +103 -215
  174. package/select/Select.js +204 -362
  175. package/select/index.js +2 -5
  176. package/select/subComponent/ListBox.js +9 -12
  177. package/select/subComponent/Option.js +8 -16
  178. package/select/subComponent/OptionGroup.js +2 -9
  179. package/select/subComponent/Options.js +5 -11
  180. package/select/subComponent/SearchBox.js +9 -29
  181. package/select/subComponent/SelectedMultiple.js +8 -16
  182. package/select/subComponent/SelectedSingle.js +2 -9
  183. package/styles/GlobalStyle.js +169 -91
  184. package/styles/config/breakpoint.style.js +2 -3
  185. package/styles/config/header.style.js +2 -3
  186. package/styles/config/sidebar.style.js +2 -3
  187. package/styles/index.js +2 -5
  188. package/styles/mixin/backgroundColor.js +17 -14
  189. package/styles/mixin/borderColor.js +17 -14
  190. package/styles/mixin/color.js +17 -14
  191. package/styles/mixin/colorOnBackground.js +17 -14
  192. package/styles/mixin/inputPlaceholder.js +3 -9
  193. package/styles/mixin/media.js +3 -11
  194. package/styles/mixin/rounded.js +13 -12
  195. package/styles/mixin/scrollbar.js +7 -13
  196. package/styles/theme/dark.theme.js +20 -20
  197. package/styles/theme/light.theme.js +20 -20
  198. package/styles/theme/white.theme.js +20 -20
  199. package/styles/themes.js +2 -8
  200. package/table/GridTable.js +105 -143
  201. package/table/ImageBox.js +8 -18
  202. package/table/PermissionTable.js +25 -25
  203. package/table/Table.js +137 -153
  204. package/table/__mock__/columns.js +2 -3
  205. package/table/__mock__/data.js +2 -3
  206. package/table/hooks/index.js +2 -5
  207. package/table/hooks/useCalculateDataRange.js +9 -36
  208. package/table/hooks/useGenerateSort.js +6 -17
  209. package/table/index.js +4 -9
  210. package/table/subComponent/BaseTableHeadCell.js +15 -21
  211. package/table/subComponent/GridTableFooter.js +5 -10
  212. package/table/subComponent/GridTableHeadCell.js +5 -10
  213. package/table/subComponent/Resizer.js +17 -44
  214. package/table/subComponent/TableFooter.js +5 -10
  215. package/table/subComponent/TableFooterInfo.js +2 -9
  216. package/table/subComponent/TableFooterPager.js +5 -12
  217. package/table/subComponent/TableHeadCell.js +2 -9
  218. package/table/subComponent/TableSort.js +13 -19
  219. package/tagify/TagifyStyle.js +14 -0
  220. package/tagify/Tags.js +15 -37
  221. package/tagify/index.js +8 -3
  222. package/text/Paragraph.js +25 -20
  223. package/text/index.js +1 -3
  224. package/timeline/Timeline.js +28 -37
  225. package/timeline/index.js +1 -3
  226. package/toast/CustomToastContainer.js +2 -9
  227. package/toast/MessageContainer.js +9 -18
  228. package/toast/index.js +3 -8
  229. package/toast/show.js +18 -28
  230. package/tooltip/Tooltip.js +48 -97
  231. package/tooltip/index.js +1 -3
  232. package/wizard/Wizard.js +63 -133
  233. package/wizard/index.js +1 -3
@@ -1,180 +1,96 @@
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 _reactDom = _interopRequireWildcard(require("react-dom"));
13
-
14
9
  var _styledComponents = _interopRequireDefault(require("styled-components"));
15
-
16
10
  var _md = require("react-icons/md");
17
-
18
11
  var _utils = require("@cashub/utils");
19
-
20
12
  var _media = _interopRequireDefault(require("../styles/mixin/media"));
21
-
22
13
  var _scrollbar = _interopRequireDefault(require("../styles/mixin/scrollbar"));
23
-
24
14
  var _Heading = _interopRequireDefault(require("../heading/Heading3"));
25
-
26
15
  var _ModalBackdrop = _interopRequireDefault(require("../backdrop/ModalBackdrop"));
27
-
28
16
  var _jsxRuntime = require("react/jsx-runtime");
29
-
30
17
  var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
31
-
32
- var _excluded = ["children"];
33
-
34
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
35
-
36
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
37
-
38
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
39
-
19
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
20
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
40
21
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
41
-
42
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
43
-
44
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
45
-
46
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
47
-
48
- 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."); }
49
-
50
- 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); }
51
-
52
- 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; }
53
-
54
- 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; }
55
-
56
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
57
-
58
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
59
-
60
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
61
-
62
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
63
-
64
- 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; }
65
-
66
- 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); } }
67
-
68
- 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); }); }; }
69
-
70
- var TitleModal = function TitleModal(props) {
71
- var rootElement = (0, _utils.appendElementTo)('TitleModalContainer');
72
- var Container = document.createElement('div');
22
+ const TitleModal = props => {
23
+ const rootElement = (0, _utils.appendElementTo)('TitleModalContainer');
24
+ const Container = document.createElement('div');
73
25
  rootElement.appendChild(Container);
26
+ const handleClose = async function () {
27
+ let dismiss = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
28
+ if (props.onBeforeClose) {
29
+ // expect a promise
30
+ // resolve indicate want to close modal
31
+ // reject indicate do not close modal
32
+ try {
33
+ await props.onBeforeClose(dismiss);
34
+ } catch (error) {
35
+ return;
36
+ }
37
+ }
74
38
 
75
- var handleClose = /*#__PURE__*/function () {
76
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
77
- var dismiss,
78
- _args = arguments;
79
- return _regeneratorRuntime().wrap(function _callee$(_context) {
80
- while (1) {
81
- switch (_context.prev = _context.next) {
82
- case 0:
83
- dismiss = _args.length > 0 && _args[0] !== undefined ? _args[0] : false;
84
-
85
- if (!props.onBeforeClose) {
86
- _context.next = 10;
87
- break;
88
- }
89
-
90
- _context.prev = 2;
91
- _context.next = 5;
92
- return props.onBeforeClose(dismiss);
93
-
94
- case 5:
95
- _context.next = 10;
96
- break;
97
-
98
- case 7:
99
- _context.prev = 7;
100
- _context.t0 = _context["catch"](2);
101
- return _context.abrupt("return");
102
-
103
- case 10:
104
- // unmount component and clear event handler and state before remove container
105
- (0, _reactDom.unmountComponentAtNode)(Container);
106
- Container.remove();
107
-
108
- if (props.onClose) {
109
- props.onClose(dismiss);
110
- }
111
-
112
- case 13:
113
- case "end":
114
- return _context.stop();
115
- }
116
- }
117
- }, _callee, null, [[2, 7]]);
118
- }));
119
-
120
- return function handleClose() {
121
- return _ref.apply(this, arguments);
122
- };
123
- }();
124
-
125
- var methods = {
39
+ // unmount component and clear event handler and state before remove container
40
+ (0, _reactDom.unmountComponentAtNode)(Container);
41
+ Container.remove();
42
+ if (props.onClose) {
43
+ props.onClose(dismiss);
44
+ }
45
+ };
46
+ const methods = {
126
47
  close: handleClose
127
48
  };
128
-
129
- _reactDom.default.render( /*#__PURE__*/(0, _jsxRuntime.jsx)(ModalContent, _objectSpread(_objectSpread({}, props), {}, {
49
+ _reactDom.default.render( /*#__PURE__*/(0, _jsxRuntime.jsx)(ModalContent, {
50
+ ...props,
130
51
  onClose: handleClose,
131
52
  methods: methods
132
- })), Container);
53
+ }), Container);
133
54
  };
134
-
135
- var ModalContent = function ModalContent(_ref2) {
136
- var children = _ref2.children,
137
- onClose = _ref2.onClose,
138
- methods = _ref2.methods,
139
- size = _ref2.size;
140
- var refWrapper = (0, _react.useRef)(null);
141
-
142
- var _useState = (0, _react.useState)(null),
143
- _useState2 = _slicedToArray(_useState, 2),
144
- clickTarget = _useState2[0],
145
- setClickTarget = _useState2[1];
146
-
147
- var child = (0, _react.useMemo)(function () {
55
+ const ModalContent = _ref => {
56
+ let {
57
+ children,
58
+ onClose,
59
+ methods,
60
+ size
61
+ } = _ref;
62
+ const refWrapper = (0, _react.useRef)(null);
63
+ const [clickTarget, setClickTarget] = (0, _react.useState)(null);
64
+ const child = (0, _react.useMemo)(() => {
148
65
  return (0, _utils.isReactComponent)(children) ? /*#__PURE__*/(0, _react.cloneElement)(children, methods) : children;
149
66
  }, [children, methods]);
150
-
151
- var handleDismiss = function handleDismiss(dismiss) {
67
+ const handleDismiss = dismiss => {
152
68
  if (clickTarget === refWrapper.current) {
153
69
  onClose(dismiss);
154
70
  }
155
71
  };
156
-
157
72
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(Wrapper, {
158
73
  ref: refWrapper,
159
- onClick: function onClick() {
74
+ onClick: () => {
160
75
  handleDismiss(true);
161
76
  },
162
- onMouseDown: function onMouseDown(event) {
77
+ onMouseDown: event => {
163
78
  setClickTarget(event.target);
164
79
  },
165
80
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Container, {
166
81
  size: size,
167
- onMouseDown: function onMouseDown(event) {
82
+ onMouseDown: event => {
168
83
  setClickTarget(event.target);
169
84
  },
170
85
  children: child
171
86
  })
172
87
  });
173
88
  };
174
-
175
- var ModalHeader = function ModalHeader(_ref3) {
176
- var handleClose = _ref3.handleClose,
177
- children = _ref3.children;
89
+ const ModalHeader = _ref2 => {
90
+ let {
91
+ handleClose,
92
+ children
93
+ } = _ref2;
178
94
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Header, {
179
95
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_md.MdClose, {
180
96
  onClick: handleClose
@@ -183,115 +99,98 @@ var ModalHeader = function ModalHeader(_ref3) {
183
99
  })]
184
100
  });
185
101
  };
186
-
187
- var ModalBody = function ModalBody(_ref4) {
188
- var children = _ref4.children,
189
- props = _objectWithoutProperties(_ref4, _excluded);
190
-
191
- var bodyRef = (0, _react.useRef)(null);
192
-
193
- var recalculateHeight = function recalculateHeight() {
102
+ const ModalBody = _ref3 => {
103
+ let {
104
+ children,
105
+ ...props
106
+ } = _ref3;
107
+ const bodyRef = (0, _react.useRef)(null);
108
+ const recalculateHeight = () => {
194
109
  // body element not render yet
195
110
  if (!bodyRef.current) return;
196
- var ModalBodyElement = bodyRef.current;
197
- var ModalHeaderElement = ModalBodyElement.previousSibling;
198
- var ModalFooterElement = ModalBodyElement.nextSibling;
199
- var needSubtractHeight = 0;
200
-
111
+ const ModalBodyElement = bodyRef.current;
112
+ const ModalHeaderElement = ModalBodyElement.previousSibling;
113
+ const ModalFooterElement = ModalBodyElement.nextSibling;
114
+ let needSubtractHeight = 0;
201
115
  if (ModalHeaderElement) {
202
116
  needSubtractHeight += ModalHeaderElement.offsetHeight;
203
117
  }
204
-
205
118
  if (ModalFooterElement) {
206
119
  needSubtractHeight += ModalFooterElement.offsetHeight;
207
120
  }
208
-
209
121
  ModalBodyElement.style.maxHeight = "calc(90vh - ".concat(needSubtractHeight, "px)");
210
122
  };
211
-
212
- (0, _react.useEffect)(function () {
123
+ (0, _react.useEffect)(() => {
213
124
  recalculateHeight();
214
125
  window.addEventListener('resize', recalculateHeight);
215
- return function () {
216
- return window.removeEventListener('resize', recalculateHeight);
217
- };
126
+ return () => window.removeEventListener('resize', recalculateHeight);
218
127
  }, []);
219
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(Body, _objectSpread(_objectSpread({
220
- ref: bodyRef
221
- }, props), {}, {
128
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(Body, {
129
+ ref: bodyRef,
130
+ ...props,
222
131
  children: children
223
- }));
132
+ });
224
133
  };
225
-
226
- var ModalFooter = function ModalFooter(_ref5) {
227
- var children = _ref5.children;
134
+ const ModalFooter = _ref4 => {
135
+ let {
136
+ children
137
+ } = _ref4;
228
138
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(Footer, {
229
139
  children: children
230
140
  });
231
141
  };
232
-
233
- var Wrapper = (0, _styledComponents.default)(_ModalBackdrop.default)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n z-index: 80;\n"])));
234
-
235
- var Container = _styledComponents.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n border-radius: var(--border-radius);\n background: var(--color-background2);\n box-shadow: var(--box-shadow);\n border: var(--border-width) solid var(--border-color);\n width: 100%;\n\n ", "\n\n ", "\n\n ", "\n"])), function (_ref6) {
236
- var size = _ref6.size;
237
-
142
+ const Wrapper = (0, _styledComponents.default)(_ModalBackdrop.default)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n z-index: 80;\n"])));
143
+ const Container = _styledComponents.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n border-radius: var(--border-radius);\n background: var(--color-background2);\n box-shadow: var(--box-shadow);\n border: var(--border-width) solid var(--border-color);\n width: 100%;\n\n ", "\n\n ", "\n\n ", "\n"])), _ref5 => {
144
+ let {
145
+ size
146
+ } = _ref5;
238
147
  switch (size) {
239
148
  case 'large':
240
149
  return 'max-width: 75%;';
241
-
242
150
  case 'normal':
243
151
  return 'max-width: 50%;';
244
-
245
152
  case 'small':
246
153
  return 'max-width: 30%;';
247
-
248
154
  default:
249
155
  break;
250
156
  }
251
- }, _media.default.tablet(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n ", "\n "])), function (_ref7) {
252
- var size = _ref7.size;
253
-
157
+ }, _media.default.tablet(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n ", "\n "])), _ref6 => {
158
+ let {
159
+ size
160
+ } = _ref6;
254
161
  switch (size) {
255
162
  case 'large':
256
163
  return 'max-width: 90%;';
257
-
258
164
  case 'normal':
259
165
  return 'max-width: 75%;';
260
-
261
166
  case 'small':
262
167
  return 'max-width: 50%;';
263
-
264
168
  default:
265
169
  break;
266
170
  }
267
- }), _media.default.mobile(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n ", "\n "])), function (_ref8) {
268
- var size = _ref8.size;
269
-
171
+ }), _media.default.mobile(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n ", "\n "])), _ref7 => {
172
+ let {
173
+ size
174
+ } = _ref7;
270
175
  switch (size) {
271
176
  case 'normal':
272
177
  return 'max-width: 90%;';
273
-
274
178
  case 'small':
275
179
  return 'max-width: 70%;';
276
-
277
180
  default:
278
181
  break;
279
182
  }
280
183
  }));
281
-
282
- var Header = _styledComponents.default.div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n padding: var(--spacing-s) 56px var(--spacing-s) var(--spacing-s);\n border-bottom: var(--border-width) solid var(--border-color);\n min-height: 64px;\n color: var(--font-on-background);\n\n > svg {\n position: absolute;\n top: 24px;\n right: calc(12px + var(--spacing));\n color: var(--font-on-mute);\n font-size: var(--font-body1);\n cursor: pointer;\n }\n"])));
283
-
284
- var Body = _styledComponents.default.div(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n padding: var(--spacing);\n overflow-y: auto;\n overflow-x: hidden;\n\n ", "\n\n ", "\n"])), _scrollbar.default, function (_ref9) {
285
- var noPaddingBottom = _ref9.noPaddingBottom;
184
+ const Header = _styledComponents.default.div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n padding: var(--spacing-s) 56px var(--spacing-s) var(--spacing-s);\n border-bottom: var(--border-width) solid var(--border-color);\n min-height: 64px;\n color: var(--font-on-background);\n\n > svg {\n position: absolute;\n top: 24px;\n right: calc(12px + var(--spacing));\n color: var(--font-on-mute);\n font-size: var(--font-body1);\n cursor: pointer;\n }\n"])));
185
+ const Body = _styledComponents.default.div(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n padding: var(--spacing);\n overflow-y: auto;\n overflow-x: hidden;\n\n ", "\n\n ", "\n"])), _scrollbar.default, _ref8 => {
186
+ let {
187
+ noPaddingBottom
188
+ } = _ref8;
286
189
  return noPaddingBottom && 'padding-bottom: 0;';
287
190
  });
288
-
289
- var Footer = _styledComponents.default.div(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n display: flex;\n justify-content: flex-end;\n padding: 0 var(--spacing);\n border-top: var(--border-width) solid var(--border-color);\n height: 64px;\n line-height: 64px;\n"])));
290
-
291
- var _default = Object.assign(TitleModal, {
191
+ const Footer = _styledComponents.default.div(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n display: flex;\n justify-content: flex-end;\n padding: 0 var(--spacing);\n border-top: var(--border-width) solid var(--border-color);\n height: 64px;\n line-height: 64px;\n"])));
192
+ var _default = exports.default = Object.assign(TitleModal, {
292
193
  Header: ModalHeader,
293
194
  Body: ModalBody,
294
195
  Footer: ModalFooter
295
- });
296
-
297
- exports.default = _default;
196
+ });
package/modal/index.js CHANGED
@@ -5,19 +5,16 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  Object.defineProperty(exports, "StateModal", {
7
7
  enumerable: true,
8
- get: function get() {
8
+ get: function () {
9
9
  return _StateModal.default;
10
10
  }
11
11
  });
12
12
  Object.defineProperty(exports, "TitleModal", {
13
13
  enumerable: true,
14
- get: function get() {
14
+ get: function () {
15
15
  return _TitleModal.default;
16
16
  }
17
17
  });
18
-
19
18
  var _StateModal = _interopRequireDefault(require("./StateModal"));
20
-
21
19
  var _TitleModal = _interopRequireDefault(require("./TitleModal"));
22
-
23
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cashub/ui",
3
- "version": "0.20.0",
3
+ "version": "0.21.1",
4
4
  "private": false,
5
5
  "author": "CASHUB Team",
6
6
  "description": "CASHUB UI components library",
@@ -1,58 +1,44 @@
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 _styledComponents = _interopRequireWildcard(require("styled-components"));
11
-
12
8
  var _fa = require("react-icons/fa");
13
-
14
9
  var _hooks = require("@cashub/hooks");
15
-
16
10
  var _jsxRuntime = require("react/jsx-runtime");
17
-
18
11
  var _templateObject, _templateObject2, _templateObject3, _templateObject4;
19
-
20
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
21
-
22
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
23
-
12
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
13
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
24
14
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
25
-
26
- var Paginate = function Paginate(props) {
27
- var currentPage = props.currentPage,
28
- totalCount = props.totalCount,
29
- pageSize = props.pageSize,
30
- _props$siblingCount = props.siblingCount,
31
- siblingCount = _props$siblingCount === void 0 ? 1 : _props$siblingCount,
32
- onPageChange = props.onPageChange,
33
- alignRight = props.alignRight;
34
- var paginationRange = (0, _hooks.usePagination)({
35
- currentPage: currentPage,
36
- totalCount: totalCount,
37
- siblingCount: siblingCount,
38
- pageSize: pageSize
15
+ const Paginate = props => {
16
+ const {
17
+ currentPage,
18
+ totalCount,
19
+ pageSize,
20
+ siblingCount = 1,
21
+ onPageChange,
22
+ alignRight
23
+ } = props;
24
+ const paginationRange = (0, _hooks.usePagination)({
25
+ currentPage,
26
+ totalCount,
27
+ siblingCount,
28
+ pageSize
39
29
  });
40
-
41
- var onNext = function onNext() {
30
+ const onNext = () => {
42
31
  if (currentPage === lastPage) return;
43
32
  onPageChange(currentPage + 1);
44
33
  };
45
-
46
- var onPrevious = function onPrevious() {
34
+ const onPrevious = () => {
47
35
  if (currentPage === 1) return;
48
36
  onPageChange(currentPage - 1);
49
37
  };
50
-
51
38
  if (currentPage === 0 || paginationRange.length < 1) {
52
39
  return null;
53
40
  }
54
-
55
- var lastPage = paginationRange[paginationRange.length - 1];
41
+ const lastPage = paginationRange[paginationRange.length - 1];
56
42
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Container, {
57
43
  alignRight: alignRight,
58
44
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Link, {
@@ -61,19 +47,16 @@ var Paginate = function Paginate(props) {
61
47
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Icon, {
62
48
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_fa.FaAngleLeft, {})
63
49
  })
64
- }), paginationRange.map(function (pageNumber, index) {
50
+ }), paginationRange.map((pageNumber, index) => {
65
51
  if (pageNumber === _hooks.DOTS) {
66
52
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(Link, {
67
53
  className: "paginationDots",
68
54
  children: "\u2026"
69
55
  }, index);
70
56
  }
71
-
72
57
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(Link, {
73
58
  active: pageNumber === currentPage,
74
- onClick: function onClick() {
75
- return onPageChange(pageNumber);
76
- },
59
+ onClick: () => onPageChange(pageNumber),
77
60
  children: pageNumber
78
61
  }, index);
79
62
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(Link, {
@@ -85,25 +68,28 @@ var Paginate = function Paginate(props) {
85
68
  })]
86
69
  });
87
70
  };
88
-
89
- var Container = _styledComponents.default.ul(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n text-align: center;\n\n ", ";\n"])), function (_ref) {
90
- var alignRight = _ref.alignRight;
71
+ const Container = _styledComponents.default.ul(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n text-align: center;\n\n ", ";\n"])), _ref => {
72
+ let {
73
+ alignRight
74
+ } = _ref;
91
75
  return alignRight && 'justify-content: flex-end';
92
76
  });
93
-
94
- var Link = _styledComponents.default.li(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n width: 36px;\n line-height: 37px;\n font-size: var(--font-body1);\n color: var(--font-on-background);\n border-radius: var(--border-radius-round);\n cursor: pointer;\n transition: 0.3s;\n\n &:not(:last-child) {\n margin-right: var(--spacing-xs);\n }\n\n ", ";\n\n ", "\n\n &:hover {\n ", "\n }\n\n &.paginationDots {\n cursor: default;\n }\n"])), function (_ref2) {
95
- var disabled = _ref2.disabled;
77
+ const Link = _styledComponents.default.li(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n width: 36px;\n line-height: 37px;\n font-size: var(--font-body1);\n color: var(--font-on-background);\n border-radius: var(--border-radius-round);\n cursor: pointer;\n transition: 0.3s;\n\n &:not(:last-child) {\n margin-right: var(--spacing-xs);\n }\n\n ", ";\n\n ", "\n\n &:hover {\n ", "\n }\n\n &.paginationDots {\n cursor: default;\n }\n"])), _ref2 => {
78
+ let {
79
+ disabled
80
+ } = _ref2;
96
81
  return disabled && (0, _styledComponents.css)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n opacity: 0.5;\n cursor: no-drop;\n "])));
97
- }, function (_ref3) {
98
- var active = _ref3.active;
82
+ }, _ref3 => {
83
+ let {
84
+ active
85
+ } = _ref3;
99
86
  return active && "\n background-color: var(--color-primary);\n color: var(--font-on-primary);\n ";
100
- }, function (_ref4) {
101
- var disabled = _ref4.disabled,
102
- className = _ref4.className;
87
+ }, _ref4 => {
88
+ let {
89
+ disabled,
90
+ className
91
+ } = _ref4;
103
92
  return !disabled && !className && "\n background-color: var(--color-primary);\n color: var(--font-on-primary);\n ";
104
93
  });
105
-
106
- var Icon = _styledComponents.default.span(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n font-size: var(--font-body1);\n display: flex;\n justify-content: center;\n align-items: center;\n height: 100%;\n"])));
107
-
108
- var _default = Paginate;
109
- exports.default = _default;
94
+ const Icon = _styledComponents.default.span(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n font-size: var(--font-body1);\n display: flex;\n justify-content: center;\n align-items: center;\n height: 100%;\n"])));
95
+ var _default = exports.default = Paginate;
package/paginate/index.js CHANGED
@@ -5,11 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  Object.defineProperty(exports, "Paginate", {
7
7
  enumerable: true,
8
- get: function get() {
8
+ get: function () {
9
9
  return _Paginate.default;
10
10
  }
11
11
  });
12
-
13
12
  var _Paginate = _interopRequireDefault(require("./Paginate"));
14
-
15
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }