@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.
- package/Tab/Tab.js +9 -13
- package/Tab/TabList.js +14 -32
- package/Tab/TabPanel.js +21 -58
- package/Tab/TabTab.js +20 -40
- package/Tab/index.js +2 -10
- package/Tab/subComponent/TabContext.js +2 -5
- package/animate/Collapse.js +26 -53
- package/animate/Loader.js +21 -26
- package/animate/NumberCounter.js +22 -44
- package/animate/PulseRing.js +9 -21
- package/animate/Spinner.js +2 -10
- package/animate/index.js +5 -11
- package/assets/css/autocomplete.css +16 -16
- package/assets/css/font.css +4 -4
- package/assets/css/global.css +3 -3
- package/assets/css/normalize.css +386 -386
- package/backdrop/BaseBackdrop.js +2 -9
- package/backdrop/LoadingBackdrop.js +2 -9
- package/backdrop/ModalBackdrop.js +2 -9
- package/backdrop/index.js +3 -7
- package/badge/Badge.js +2 -11
- package/badge/BadgeDot.js +2 -10
- package/badge/BadgeFill.js +15 -20
- package/badge/BadgeWithText.js +6 -13
- package/badge/index.js +4 -9
- package/billing/BarChart.js +10 -17
- package/billing/Grid.js +11 -15
- package/billing/Header2.js +6 -9
- package/billing/Header3.js +9 -16
- package/billing/Paragraph.js +8 -14
- package/billing/ParagraphGroup.js +6 -9
- package/billing/ParagraphText.js +7 -12
- package/billing/Section.js +13 -23
- package/billing/SectionBody.js +5 -8
- package/billing/SectionHeader.js +7 -12
- package/breadcrumb/Breadcrumb.js +11 -21
- package/breadcrumb/index.js +1 -3
- package/button/Button.js +41 -38
- package/button/ButtonGroup.js +21 -18
- package/button/IconButton.js +29 -29
- package/button/ScrollToTopButton.js +12 -39
- package/button/index.js +4 -9
- package/callout/Callout.js +13 -26
- package/callout/index.js +1 -3
- package/chart/BarChart.js +28 -53
- package/chart/DoughnutChart.js +23 -62
- package/chart/LineChart.js +33 -55
- package/chart/SingleBarChart.js +11 -17
- package/chart/index.js +5 -12
- package/chart/utils/customTooltip.js +26 -43
- package/chart/utils/htmlLegendPlugin.js +24 -30
- package/chart/utils/index.js +3 -7
- package/chart/utils/padEmptyChartBar.js +24 -22
- package/container/FlexContainer.js +9 -12
- package/container/index.js +1 -3
- package/cropper/Cropper.js +21 -34
- package/cropper/CropperModalHandler.js +15 -21
- package/cropper/index.js +2 -5
- package/cropper/subComponent/CropImageModal.js +23 -58
- package/datetimePicker/DatePicker.js +103 -217
- package/datetimePicker/DatePickerV2.js +116 -221
- package/datetimePicker/DatetimePicker.js +27 -48
- package/datetimePicker/DatetimePickerV2.js +115 -231
- package/datetimePicker/TimeInput.js +9 -22
- package/datetimePicker/TimePicker.js +94 -151
- package/datetimePicker/TimePickerStyle.js +14 -0
- package/datetimePicker/accordion/Month.js +70 -90
- package/datetimePicker/accordion/Year.js +91 -135
- package/datetimePicker/hooks/index.js +3 -7
- package/datetimePicker/hooks/useChangeNumber.js +14 -27
- package/datetimePicker/hooks/useDecrease.js +19 -35
- package/datetimePicker/hooks/useIncrease.js +19 -35
- package/datetimePicker/index.js +13 -13
- package/datetimePicker/provider/constant.js +2 -3
- package/datetimePicker/subComponent/Accordion.js +108 -158
- package/datetimePicker/subComponent/CustomTimeInput.js +18 -48
- package/datetimePicker/subComponent/DateTimePickerContext.js +2 -5
- package/datetimePicker/utils/GMTDate.js +3 -7
- package/datetimePicker/utils/pad.js +2 -6
- package/datetimePicker/utils/toUTC0.js +3 -6
- package/descriptionList/DescriptionDetail.js +5 -10
- package/descriptionList/DescriptionList.js +5 -10
- package/descriptionList/DescriptionTerm.js +2 -9
- package/descriptionList/index.js +3 -7
- package/divider/Divider.js +9 -12
- package/divider/index.js +1 -3
- package/dropdown/Dropdown.js +28 -65
- package/dropdown/DropdownButtonOption.js +2 -9
- package/dropdown/DropdownContent.js +33 -64
- package/dropdown/DropdownDivOption.js +2 -9
- package/dropdown/DropdownItem.js +10 -16
- package/dropdown/DropdownLinkOption.js +2 -9
- package/dropdown/DropdownToggle.js +18 -38
- package/dropdown/index.js +6 -17
- package/dropdown/subComponent/DropdownContext.js +2 -5
- package/dropzone/FileDropzone.js +148 -302
- package/dropzone/ImageDropzone.js +96 -171
- package/dropzone/index.js +2 -5
- package/dropzone/subComponent/Message.js +7 -14
- package/figure/IconFigure.js +9 -16
- package/figure/ImageFigure.js +11 -17
- package/figure/index.js +2 -5
- package/file/HiddenFileInput.js +5 -14
- package/file/index.js +1 -3
- package/form/Checkbox.js +34 -43
- package/form/FormItem.js +2 -9
- package/form/Input.js +13 -15
- package/form/Label.js +10 -13
- package/form/MutedText.js +5 -10
- package/form/RadioButton.js +20 -32
- package/form/Searchbox.js +21 -65
- package/form/Slider.js +14 -0
- package/form/SwitchButton.js +34 -39
- package/form/Textarea.js +2 -11
- package/form/index.js +9 -19
- package/grid/Column.js +17 -17
- package/grid/Grid.js +13 -14
- package/grid/index.js +2 -5
- package/heading/Heading1.js +5 -10
- package/heading/Heading2.js +9 -12
- package/heading/Heading3.js +21 -18
- package/heading/index.js +3 -7
- package/helmet/Helmet.js +6 -9
- package/helmet/index.js +2 -5
- package/iconbox/ApplicationIconBox.js +25 -31
- package/iconbox/IconBox.js +11 -24
- package/iconbox/IconBoxV2.js +14 -26
- package/iconbox/index.js +3 -7
- package/iconbox/subComponent/IconBoxFigure.js +25 -20
- package/iconbox/subComponent/IconBoxImage.js +15 -18
- package/image/ImageFluid.js +2 -10
- package/image/UploadImage.js +65 -113
- package/image/index.js +2 -5
- package/index.js +44 -130
- package/jsoneditor/JsonEditor.js +10 -32
- package/jsoneditor/index.js +1 -3
- package/keyframe/Pulse.js +2 -7
- package/keyframe/Spin.js +2 -7
- package/link/LinkSpan.js +22 -35
- package/link/index.js +1 -3
- package/map/GoogleMap.js +122 -175
- package/map/GoogleReverseGeolocation.js +79 -186
- package/map/LeafletMap.js +78 -132
- package/map/LeafletReverseGeolocation.js +49 -121
- package/map/index.js +4 -9
- package/map/subComponent/BasicLeafletMap.js +8 -14
- package/map/subComponent/GoogleMapContainer.js +5 -10
- package/map/subComponent/GoogleMapPopup.js +66 -123
- package/map/subComponent/GoogleMapWrapper.js +13 -32
- package/map/subComponent/GoogleMarkerSpiderfier.js +14 -24
- package/map/subComponent/LeafletDrawControl.js +47 -84
- package/map/subComponent/LeafletMapContainer.js +5 -10
- package/map/subComponent/MapSearchBoxControl.js +24 -70
- package/modal/StateModal.js +41 -100
- package/modal/TitleModal.js +89 -190
- package/modal/index.js +2 -5
- package/package.json +1 -1
- package/paginate/Paginate.js +40 -54
- package/paginate/index.js +1 -3
- package/popover/Popover.js +39 -87
- package/popover/index.js +1 -3
- package/qrcode/QRCode.js +10 -23
- package/qrcode/QRCodeContainter.js +8 -16
- package/qrcode/index.js +2 -5
- package/ribbon/Ribbon.js +4 -15
- package/ribbon/index.js +1 -3
- package/section/Section.js +57 -39
- package/section/SectionBody.js +15 -22
- package/section/SectionHeader.js +27 -27
- package/section/SectionToolbar.js +2 -9
- package/section/SectionToolbarItem.js +2 -9
- package/section/index.js +5 -11
- package/select/InputSelect.js +103 -215
- package/select/Select.js +204 -362
- package/select/index.js +2 -5
- package/select/subComponent/ListBox.js +9 -12
- package/select/subComponent/Option.js +8 -16
- package/select/subComponent/OptionGroup.js +2 -9
- package/select/subComponent/Options.js +5 -11
- package/select/subComponent/SearchBox.js +9 -29
- package/select/subComponent/SelectedMultiple.js +8 -16
- package/select/subComponent/SelectedSingle.js +2 -9
- package/styles/GlobalStyle.js +169 -91
- package/styles/config/breakpoint.style.js +2 -3
- package/styles/config/header.style.js +2 -3
- package/styles/config/sidebar.style.js +2 -3
- package/styles/index.js +2 -5
- package/styles/mixin/backgroundColor.js +17 -14
- package/styles/mixin/borderColor.js +17 -14
- package/styles/mixin/color.js +17 -14
- package/styles/mixin/colorOnBackground.js +17 -14
- package/styles/mixin/inputPlaceholder.js +3 -9
- package/styles/mixin/media.js +3 -11
- package/styles/mixin/rounded.js +13 -12
- package/styles/mixin/scrollbar.js +7 -13
- package/styles/theme/dark.theme.js +20 -20
- package/styles/theme/light.theme.js +20 -20
- package/styles/theme/white.theme.js +20 -20
- package/styles/themes.js +2 -8
- package/table/GridTable.js +105 -143
- package/table/ImageBox.js +8 -18
- package/table/PermissionTable.js +25 -25
- package/table/Table.js +137 -153
- package/table/__mock__/columns.js +2 -3
- package/table/__mock__/data.js +2 -3
- package/table/hooks/index.js +2 -5
- package/table/hooks/useCalculateDataRange.js +9 -36
- package/table/hooks/useGenerateSort.js +6 -17
- package/table/index.js +4 -9
- package/table/subComponent/BaseTableHeadCell.js +15 -21
- package/table/subComponent/GridTableFooter.js +5 -10
- package/table/subComponent/GridTableHeadCell.js +5 -10
- package/table/subComponent/Resizer.js +17 -44
- package/table/subComponent/TableFooter.js +5 -10
- package/table/subComponent/TableFooterInfo.js +2 -9
- package/table/subComponent/TableFooterPager.js +5 -12
- package/table/subComponent/TableHeadCell.js +2 -9
- package/table/subComponent/TableSort.js +13 -19
- package/tagify/TagifyStyle.js +14 -0
- package/tagify/Tags.js +15 -37
- package/tagify/index.js +8 -3
- package/text/Paragraph.js +25 -20
- package/text/index.js +1 -3
- package/timeline/Timeline.js +28 -37
- package/timeline/index.js +1 -3
- package/toast/CustomToastContainer.js +2 -9
- package/toast/MessageContainer.js +9 -18
- package/toast/index.js +3 -8
- package/toast/show.js +18 -28
- package/tooltip/Tooltip.js +48 -97
- package/tooltip/index.js +1 -3
- package/wizard/Wizard.js +63 -133
- package/wizard/index.js +1 -3
package/modal/TitleModal.js
CHANGED
|
@@ -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
|
|
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
|
-
|
|
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
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
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
|
-
|
|
49
|
+
_reactDom.default.render( /*#__PURE__*/(0, _jsxRuntime.jsx)(ModalContent, {
|
|
50
|
+
...props,
|
|
130
51
|
onClose: handleClose,
|
|
131
52
|
methods: methods
|
|
132
|
-
})
|
|
53
|
+
}), Container);
|
|
133
54
|
};
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
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:
|
|
74
|
+
onClick: () => {
|
|
160
75
|
handleDismiss(true);
|
|
161
76
|
},
|
|
162
|
-
onMouseDown:
|
|
77
|
+
onMouseDown: event => {
|
|
163
78
|
setClickTarget(event.target);
|
|
164
79
|
},
|
|
165
80
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Container, {
|
|
166
81
|
size: size,
|
|
167
|
-
onMouseDown:
|
|
82
|
+
onMouseDown: event => {
|
|
168
83
|
setClickTarget(event.target);
|
|
169
84
|
},
|
|
170
85
|
children: child
|
|
171
86
|
})
|
|
172
87
|
});
|
|
173
88
|
};
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
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
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
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
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
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
|
|
216
|
-
return window.removeEventListener('resize', recalculateHeight);
|
|
217
|
-
};
|
|
126
|
+
return () => window.removeEventListener('resize', recalculateHeight);
|
|
218
127
|
}, []);
|
|
219
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Body,
|
|
220
|
-
ref: bodyRef
|
|
221
|
-
|
|
128
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Body, {
|
|
129
|
+
ref: bodyRef,
|
|
130
|
+
...props,
|
|
222
131
|
children: children
|
|
223
|
-
})
|
|
132
|
+
});
|
|
224
133
|
};
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
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
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
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 "])),
|
|
252
|
-
|
|
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 "])),
|
|
268
|
-
|
|
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
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
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
|
|
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
|
|
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
|
|
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
package/paginate/Paginate.js
CHANGED
|
@@ -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
|
|
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
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
currentPage
|
|
36
|
-
totalCount
|
|
37
|
-
siblingCount
|
|
38
|
-
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(
|
|
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:
|
|
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
|
-
|
|
90
|
-
|
|
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
|
-
|
|
95
|
-
|
|
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
|
-
},
|
|
98
|
-
|
|
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
|
-
},
|
|
101
|
-
|
|
102
|
-
|
|
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
|
|
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
|
|
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 }; }
|