linear-react-components-ui 0.4.77-beta.26 → 0.4.77-beta.28
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/.eslintrc.json +3 -76
- package/.husky/pre-commit +4 -0
- package/.vscode/settings.json +2 -2
- package/jest.config.js +3 -3
- package/lib/alerts/AlertContainer.js +19 -14
- package/lib/alerts/AlertProvider.js +9 -4
- package/lib/alerts/BaseAlert.js +8 -5
- package/lib/alerts/Message.js +40 -31
- package/lib/alerts/alert.spec.js +55 -32
- package/lib/alerts/helpers.js +5 -2
- package/lib/alerts/withAlert.js +2 -2
- package/lib/assets/styles/commons.scss +10 -0
- package/lib/assets/styles/dropdown.scss +36 -2
- package/lib/assets/styles/effects.scss +11 -0
- package/lib/assets/styles/list.scss +8 -0
- package/lib/assets/styles/table.scss +2 -7
- package/lib/avatar/avatar.spec.js +74 -42
- package/lib/avatar/index.js +58 -13
- package/lib/badge/badge.spec.js +52 -30
- package/lib/badge/index.js +22 -6
- package/lib/buttons/ActivateButton.js +3 -3
- package/lib/buttons/AddButton.js +1 -1
- package/lib/buttons/Button.js +11 -19
- package/lib/buttons/ButtonGroups.js +5 -0
- package/lib/buttons/CancelButton.js +3 -16
- package/lib/buttons/DangerButton.js +19 -14
- package/lib/buttons/DefaultButton.js +127 -65
- package/lib/buttons/DestroyButton.js +3 -12
- package/lib/buttons/EditButton.js +3 -3
- package/lib/buttons/InactivateButton.js +3 -3
- package/lib/buttons/InfoButton.js +19 -14
- package/lib/buttons/PrimaryButton.js +19 -14
- package/lib/buttons/RestoreButton.js +3 -3
- package/lib/buttons/SaveButton.js +2 -15
- package/lib/buttons/SpinnerLoading.js +41 -41
- package/lib/buttons/SuccessButton.js +18 -13
- package/lib/buttons/WarningButton.js +18 -13
- package/lib/buttons/button_container/index.js +18 -5
- package/lib/buttons/buttons.spec.js +210 -136
- package/lib/buttons/index.js +28 -28
- package/lib/buttons/split_button/index.js +30 -13
- package/lib/calendar/DangerCalendar.js +2 -11
- package/lib/calendar/InfoCalendar.js +2 -11
- package/lib/calendar/PrimaryCalendar.js +2 -11
- package/lib/calendar/SuccessCalendar.js +2 -11
- package/lib/calendar/WarningCalendar.js +2 -11
- package/lib/calendar/base/Day.js +8 -2
- package/lib/calendar/base/Month.js +5 -0
- package/lib/calendar/base/Week.js +6 -0
- package/lib/calendar/base/helpers.js +9 -9
- package/lib/calendar/base/index.js +36 -33
- package/lib/calendar/calendar.spec.js +63 -32
- package/lib/calendar/index.js +10 -10
- package/lib/checkbox/Label.js +12 -2
- package/lib/checkbox/checkbox.spec.js +78 -37
- package/lib/checkbox/index.js +79 -42
- package/lib/dialog/Alert.js +8 -3
- package/lib/dialog/Custom.js +25 -17
- package/lib/dialog/Error.js +6 -1
- package/lib/dialog/Information.js +6 -1
- package/lib/dialog/Question.js +17 -6
- package/lib/dialog/Warning.js +6 -1
- package/lib/dialog/base/Content.js +9 -0
- package/lib/dialog/base/Footer.js +8 -2
- package/lib/dialog/base/Header.js +22 -8
- package/lib/dialog/base/index.js +28 -6
- package/lib/dialog/dialog.spec.js +153 -79
- package/lib/dialog/form/index.js +32 -22
- package/lib/dialog/index.js +6 -6
- package/lib/drawer/Content.js +10 -1
- package/lib/drawer/Drawer.js +50 -29
- package/lib/drawer/Drawer.spec.js +95 -52
- package/lib/drawer/Header.js +31 -12
- package/lib/drawer/helpers.js +1 -1
- package/lib/drawer/index.js +4 -4
- package/lib/dropdown/Popup.js +16 -32
- package/lib/dropdown/dropdown.spec.js +58 -34
- package/lib/dropdown/helper.js +2 -2
- package/lib/dropdown/withDropdown.js +43 -18
- package/lib/fieldset/fieldset.spec.js +123 -77
- package/lib/fieldset/index.js +43 -12
- package/lib/form/Field.js +41 -14
- package/lib/form/FieldArray.js +50 -20
- package/lib/form/FieldNumber.js +44 -12
- package/lib/form/FieldPeriod.js +41 -19
- package/lib/form/form.spec.js +90 -48
- package/lib/form/helpers.js +16 -10
- package/lib/form/index.js +92 -57
- package/lib/form/withFieldHOC.js +120 -40
- package/lib/form/withFormSecurity.js +38 -17
- package/lib/gridlayout/GridCol.js +18 -3
- package/lib/gridlayout/GridRow.js +24 -4
- package/lib/gridlayout/gridLayout.spec.js +70 -43
- package/lib/icons/helper.js +571 -560
- package/lib/icons/icons.spec.js +36 -20
- package/lib/icons/index.js +40 -23
- package/lib/index.js +12 -12
- package/lib/inputs/base/InputTextBase.js +149 -40
- package/lib/inputs/base/base.spec.js +289 -174
- package/lib/inputs/base/helpers.js +4 -4
- package/lib/inputs/color/color_input.spec.js +67 -33
- package/lib/inputs/color/index.js +29 -31
- package/lib/inputs/date/Dialog.js +8 -1
- package/lib/inputs/date/Dropdown.js +70 -18
- package/lib/inputs/date/date.spec.js +156 -75
- package/lib/inputs/date/helpers.js +1 -1
- package/lib/inputs/date/index.js +411 -255
- package/lib/inputs/inputHOC.js +96 -44
- package/lib/inputs/mask/BaseMask.js +45 -16
- package/lib/inputs/mask/Cnpj.js +19 -12
- package/lib/inputs/mask/Cpf.js +22 -14
- package/lib/inputs/mask/Phone.js +9 -1
- package/lib/inputs/mask/ZipCode.js +1 -1
- package/lib/inputs/mask/helpers.js +36 -21
- package/lib/inputs/mask/imaskHOC.js +255 -186
- package/lib/inputs/mask/index.js +4 -4
- package/lib/inputs/mask/input_mask.spec.js +290 -177
- package/lib/inputs/multiSelect/ActionButtons.js +14 -2
- package/lib/inputs/multiSelect/Dropdown.js +70 -43
- package/lib/inputs/multiSelect/index.js +80 -64
- package/lib/inputs/number/BaseNumber.js +62 -27
- package/lib/inputs/number/Currency.js +14 -4
- package/lib/inputs/number/format_number.js +1 -1
- package/lib/inputs/number/index.js +15 -9
- package/lib/inputs/number/numberfield.spec.js +83 -42
- package/lib/inputs/period/Dialog.js +8 -1
- package/lib/inputs/period/Dropdown.js +70 -16
- package/lib/inputs/period/PeriodList.js +19 -6
- package/lib/inputs/period/helper.js +71 -30
- package/lib/inputs/period/index.js +160 -112
- package/lib/inputs/search/index.js +261 -129
- package/lib/inputs/search/search_input.spec.js +86 -46
- package/lib/inputs/select/ActionButtons.js +20 -14
- package/lib/inputs/select/Dropdown.js +63 -30
- package/lib/inputs/select/helper.js +16 -18
- package/lib/inputs/select/index.js +13 -14
- package/lib/inputs/select/multiple/Selecteds.js +13 -5
- package/lib/inputs/select/multiple/index.js +414 -289
- package/lib/inputs/select/select.spec.js +182 -127
- package/lib/inputs/select/simple/index.js +462 -305
- package/lib/inputs/select/types.d.ts +4 -0
- package/lib/inputs/text/index.js +0 -1
- package/lib/inputs/text/textfield.spec.js +83 -42
- package/lib/inputs/textarea/index.js +15 -5
- package/lib/inputs/textarea/textarea.spec.js +27 -14
- package/lib/internals/constants.js +1 -1
- package/lib/internals/withTooltip.js +34 -26
- package/lib/labelMessages/index.js +45 -27
- package/lib/labelMessages/labelMessages.spec.js +61 -28
- package/lib/labels/DangerLabel.js +4 -13
- package/lib/labels/DefaultLabel.js +57 -25
- package/lib/labels/InfoLabel.js +4 -13
- package/lib/labels/PrimaryLabel.js +4 -13
- package/lib/labels/SuccessLabel.js +4 -13
- package/lib/labels/WarningLabel.js +4 -13
- package/lib/labels/index.js +10 -10
- package/lib/labels/label.spec.js +68 -41
- package/lib/labels/label_container/index.js +12 -2
- package/lib/list/Header.js +13 -0
- package/lib/list/Item.js +65 -27
- package/lib/list/helpers.js +2 -2
- package/lib/list/index.js +51 -31
- package/lib/list/list.spec.js +358 -211
- package/lib/menus/float/MenuItem.js +42 -10
- package/lib/menus/float/SubMenuContainer.js +95 -0
- package/lib/menus/float/float-menu.spec.js +61 -27
- package/lib/menus/float/helpers.js +1 -1
- package/lib/menus/float/index.js +39 -9
- package/lib/menus/sidenav/ExpandMenu.js +13 -1
- package/lib/menus/sidenav/MenuLink.js +14 -0
- package/lib/menus/sidenav/NavMenuGroup.js +12 -1
- package/lib/menus/sidenav/NavMenuItem.js +45 -19
- package/lib/menus/sidenav/NavSubMenuItem.js +15 -4
- package/lib/menus/sidenav/helpers.js +3 -3
- package/lib/menus/sidenav/index.js +60 -30
- package/lib/menus/sidenav/popup_menu_search/EmptyList.js +11 -2
- package/lib/menus/sidenav/popup_menu_search/index.js +11 -14
- package/lib/menus/sidenav/sidenav.spec.js +78 -29
- package/lib/panel/Content.js +18 -6
- package/lib/panel/DangerPanel.js +1 -1
- package/lib/panel/Default.js +45 -18
- package/lib/panel/Header.js +29 -7
- package/lib/panel/InfoPanel.js +1 -1
- package/lib/panel/PrimaryPanel.js +1 -1
- package/lib/panel/SuccessPanel.js +1 -1
- package/lib/panel/ToolBar.js +5 -0
- package/lib/panel/WarningPanel.js +1 -1
- package/lib/panel/helpers.js +3 -7
- package/lib/panel/index.js +14 -14
- package/lib/panel/panel.spec.js +106 -69
- package/lib/permissionValidations.js +12 -14
- package/lib/popover/PopoverText.js +5 -0
- package/lib/popover/PopoverTitle.js +5 -0
- package/lib/popover/index.js +40 -26
- package/lib/popover/popover.spec.js +70 -40
- package/lib/progress/Bar.js +47 -37
- package/lib/progress/index.js +18 -8
- package/lib/progress/progress.spec.js +48 -32
- package/lib/radio/index.js +46 -22
- package/lib/radio/radio.spec.js +68 -41
- package/lib/skeleton/SkeletonContainer.js +13 -0
- package/lib/skeleton/index.js +26 -7
- package/lib/spinner/SpinnerLoading.js +12 -4
- package/lib/spinner/index.js +29 -24
- package/lib/spinner/spinner.spec.js +65 -43
- package/lib/split/Split.js +62 -45
- package/lib/split/SplitSide.js +21 -1
- package/lib/split/helpers.js +1 -1
- package/lib/split/split.spec.js +76 -51
- package/lib/table/Body.js +16 -9
- package/lib/table/Header.js +19 -40
- package/lib/table/HeaderColumn.js +20 -6
- package/lib/table/Row.js +28 -7
- package/lib/table/RowColumn.js +30 -12
- package/lib/table/helpers.js +3 -3
- package/lib/table/index.js +53 -15
- package/lib/table/table.spec.js +149 -94
- package/lib/tabs/DropdownItems.js +53 -39
- package/lib/tabs/Menu.js +20 -16
- package/lib/tabs/MenuItems.js +39 -25
- package/lib/tabs/Panel.js +51 -18
- package/lib/tabs/index.js +75 -81
- package/lib/tabs/tabHelpers.js +8 -10
- package/lib/tabs/tabs.spec.js +158 -95
- package/lib/toolbar/ButtonBar.js +13 -32
- package/lib/toolbar/LabelBar.js +18 -31
- package/lib/toolbar/ToolBarGroup.js +12 -6
- package/lib/toolbar/helpers.js +1 -1
- package/lib/toolbar/index.js +33 -25
- package/lib/toolbar/toolbar.spec.js +182 -134
- package/lib/tooltip/index.js +34 -25
- package/lib/tooltip/tooltip.spec.js +51 -24
- package/lib/treeview/Header.js +12 -0
- package/lib/treeview/Node.js +387 -261
- package/lib/treeview/constants.js +2 -1
- package/lib/treeview/index.js +548 -363
- package/lib/treeview/treeview.spec.js +86 -49
- package/lib/treeview_old/Node.js +6 -6
- package/lib/uitour/helpers.js +1 -1
- package/lib/uitour/index.js +32 -15
- package/lib/uitour/uitour.spec.js +77 -55
- package/package.json +16 -40
- package/.husky/pre-push +0 -4
- package/babel.config.json +0 -11
- package/dist/main.js +0 -14
- package/lib/assets/styles/treetable.scss +0 -100
- package/lib/treetable/Body.js +0 -46
- package/lib/treetable/Header.js +0 -27
- package/lib/treetable/Row.js +0 -261
- package/lib/treetable/helpers.js +0 -41
- package/lib/treetable/index.js +0 -24
- package/lib/treetable/types.d.js +0 -5
- package/tsconfig.json +0 -32
- package/tsup.config.ts +0 -10
|
@@ -1,16 +1,23 @@
|
|
|
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
3
|
var _react = require("@testing-library/react");
|
|
4
|
+
|
|
5
5
|
var _react2 = _interopRequireDefault(require("react"));
|
|
6
|
+
|
|
6
7
|
require("@testing-library/jest-dom");
|
|
8
|
+
|
|
7
9
|
require("babel-polyfill");
|
|
10
|
+
|
|
8
11
|
var _ = _interopRequireDefault(require("."));
|
|
12
|
+
|
|
9
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
-
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; }
|
|
14
|
+
|
|
11
15
|
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); } }
|
|
16
|
+
|
|
12
17
|
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); }); }; }
|
|
13
|
-
|
|
18
|
+
|
|
19
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
20
|
+
|
|
14
21
|
var dataMock = {
|
|
15
22
|
id: 1,
|
|
16
23
|
titulo: 'SG Linear',
|
|
@@ -38,8 +45,7 @@ var dataMock = {
|
|
|
38
45
|
codigo: 'Editar',
|
|
39
46
|
itens: [{
|
|
40
47
|
titulo: 'Editar permissão ERP',
|
|
41
|
-
codigo: 'Editar permissão ERP'
|
|
42
|
-
itens: []
|
|
48
|
+
codigo: 'Editar permissão ERP'
|
|
43
49
|
}]
|
|
44
50
|
}]
|
|
45
51
|
}]
|
|
@@ -55,11 +61,11 @@ var dataMock = {
|
|
|
55
61
|
itens: [{
|
|
56
62
|
id: 5,
|
|
57
63
|
titulo: 'Empresas',
|
|
58
|
-
codigo: 'empresas'
|
|
59
|
-
itens: []
|
|
64
|
+
codigo: 'empresas'
|
|
60
65
|
}]
|
|
61
66
|
}]
|
|
62
67
|
};
|
|
68
|
+
|
|
63
69
|
var treeviewRenderMock = function treeviewRenderMock(props) {
|
|
64
70
|
return /*#__PURE__*/_react2.default.createElement(_.default, _extends({
|
|
65
71
|
data: dataMock,
|
|
@@ -68,38 +74,47 @@ var treeviewRenderMock = function treeviewRenderMock(props) {
|
|
|
68
74
|
parentPropName: "0"
|
|
69
75
|
}, props));
|
|
70
76
|
};
|
|
77
|
+
|
|
71
78
|
describe('Treeview', function () {
|
|
72
79
|
describe('Default', function () {
|
|
73
80
|
it('should render', function () {
|
|
74
81
|
var _render = (0, _react.render)(treeviewRenderMock()),
|
|
75
|
-
|
|
82
|
+
container = _render.container;
|
|
83
|
+
|
|
76
84
|
expect(container.firstChild).toBeTruthy();
|
|
77
85
|
});
|
|
78
86
|
it('should have start node visible', function () {
|
|
79
87
|
var _render2 = (0, _react.render)(treeviewRenderMock()),
|
|
80
|
-
|
|
88
|
+
queryByText = _render2.queryByText;
|
|
89
|
+
|
|
81
90
|
expect(queryByText(dataMock.titulo)).toBeTruthy();
|
|
82
91
|
});
|
|
83
92
|
it('should not have second node visible', function () {
|
|
84
93
|
var _render3 = (0, _react.render)(treeviewRenderMock()),
|
|
85
|
-
|
|
94
|
+
queryByText = _render3.queryByText;
|
|
95
|
+
|
|
86
96
|
expect(queryByText(dataMock.itens[0].titulo)).not.toBeTruthy();
|
|
87
97
|
});
|
|
88
|
-
it('should open on click', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
98
|
+
it('should open on click', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
89
99
|
var _render4, container, queryByText;
|
|
90
|
-
|
|
100
|
+
|
|
101
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
91
102
|
while (1) {
|
|
92
103
|
switch (_context.prev = _context.next) {
|
|
93
104
|
case 0:
|
|
94
105
|
_render4 = (0, _react.render)(treeviewRenderMock()), container = _render4.container, queryByText = _render4.queryByText;
|
|
106
|
+
|
|
95
107
|
_react.fireEvent.click(container.querySelector('.treeviewitem .opencloseicon'));
|
|
108
|
+
|
|
96
109
|
_context.next = 4;
|
|
97
110
|
return (0, _react.waitFor)(function () {
|
|
98
111
|
return queryByText(dataMock.itens[0].titulo);
|
|
99
112
|
});
|
|
113
|
+
|
|
100
114
|
case 4:
|
|
101
115
|
expect(queryByText(dataMock.itens[0].titulo)).toBeTruthy();
|
|
102
116
|
expect(queryByText(dataMock.itens[1].titulo)).toBeTruthy();
|
|
117
|
+
|
|
103
118
|
case 6:
|
|
104
119
|
case "end":
|
|
105
120
|
return _context.stop();
|
|
@@ -107,42 +122,54 @@ describe('Treeview', function () {
|
|
|
107
122
|
}
|
|
108
123
|
}, _callee);
|
|
109
124
|
})));
|
|
110
|
-
it('should open all layers', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
125
|
+
it('should open all layers', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
|
|
111
126
|
var _render5, container, queryByText;
|
|
112
|
-
|
|
127
|
+
|
|
128
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
113
129
|
while (1) {
|
|
114
130
|
switch (_context2.prev = _context2.next) {
|
|
115
131
|
case 0:
|
|
116
132
|
_render5 = (0, _react.render)(treeviewRenderMock()), container = _render5.container, queryByText = _render5.queryByText;
|
|
133
|
+
|
|
117
134
|
_react.fireEvent.click(container.querySelector('.treeviewitem .opencloseicon'));
|
|
135
|
+
|
|
118
136
|
_context2.next = 4;
|
|
119
137
|
return (0, _react.waitFor)(function () {
|
|
120
138
|
return queryByText(dataMock.itens[0].titulo);
|
|
121
139
|
});
|
|
140
|
+
|
|
122
141
|
case 4:
|
|
123
142
|
_react.fireEvent.click(container.querySelectorAll('.treeviewitem .opencloseicon')[1]);
|
|
143
|
+
|
|
124
144
|
_context2.next = 7;
|
|
125
145
|
return (0, _react.waitFor)(function () {
|
|
126
146
|
return queryByText(dataMock.itens[0].itens[0].titulo);
|
|
127
147
|
});
|
|
148
|
+
|
|
128
149
|
case 7:
|
|
129
150
|
_react.fireEvent.click(container.querySelectorAll('.treeviewitem .opencloseicon')[2]);
|
|
151
|
+
|
|
130
152
|
_context2.next = 10;
|
|
131
153
|
return (0, _react.waitFor)(function () {
|
|
132
154
|
return queryByText(dataMock.itens[0].itens[0].itens[0].titulo);
|
|
133
155
|
});
|
|
156
|
+
|
|
134
157
|
case 10:
|
|
135
158
|
_react.fireEvent.click(container.querySelectorAll('.treeviewitem .opencloseicon')[3]);
|
|
159
|
+
|
|
136
160
|
_context2.next = 13;
|
|
137
161
|
return (0, _react.waitFor)(function () {
|
|
138
162
|
return queryByText(dataMock.itens[0].itens[0].itens[0].itens[0].titulo);
|
|
139
163
|
});
|
|
164
|
+
|
|
140
165
|
case 13:
|
|
141
166
|
_react.fireEvent.click(container.querySelectorAll('.treeviewitem .opencloseicon')[4]);
|
|
167
|
+
|
|
142
168
|
_context2.next = 16;
|
|
143
169
|
return (0, _react.waitFor)(function () {
|
|
144
170
|
return queryByText(dataMock.itens[1].itens[0].titulo);
|
|
145
171
|
});
|
|
172
|
+
|
|
146
173
|
case 16:
|
|
147
174
|
expect(queryByText(dataMock.itens[0].titulo)).toBeTruthy();
|
|
148
175
|
expect(queryByText(dataMock.itens[0].itens[0].titulo)).toBeTruthy();
|
|
@@ -150,6 +177,7 @@ describe('Treeview', function () {
|
|
|
150
177
|
expect(queryByText(dataMock.itens[0].itens[0].itens[0].itens[0].titulo)).toBeTruthy();
|
|
151
178
|
expect(queryByText(dataMock.itens[1].titulo)).toBeTruthy();
|
|
152
179
|
expect(queryByText(dataMock.itens[1].itens[0].titulo)).toBeTruthy();
|
|
180
|
+
|
|
153
181
|
case 22:
|
|
154
182
|
case "end":
|
|
155
183
|
return _context2.stop();
|
|
@@ -159,44 +187,51 @@ describe('Treeview', function () {
|
|
|
159
187
|
})));
|
|
160
188
|
it('should render checkbox', function () {
|
|
161
189
|
var _render6 = (0, _react.render)(treeviewRenderMock({
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
190
|
+
showCheckBox: true
|
|
191
|
+
})),
|
|
192
|
+
container = _render6.container;
|
|
193
|
+
|
|
165
194
|
expect(container.querySelector('.checkbox-component')).toBeTruthy();
|
|
166
195
|
});
|
|
167
196
|
it('should call onSelectedIdsChange callback', function () {
|
|
168
197
|
var mockCallback = jest.fn(function (x) {
|
|
169
198
|
return x;
|
|
170
199
|
});
|
|
200
|
+
|
|
171
201
|
var _render7 = (0, _react.render)(treeviewRenderMock({
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
202
|
+
showCheckBox: true,
|
|
203
|
+
onSelectedIdsChange: mockCallback
|
|
204
|
+
})),
|
|
205
|
+
container = _render7.container;
|
|
206
|
+
|
|
176
207
|
_react.fireEvent.click(container.querySelector('.checkbox-component'));
|
|
208
|
+
|
|
177
209
|
expect(mockCallback.mock.calls.length).toBe(1);
|
|
178
210
|
expect(mockCallback.mock.calls[0][0]).toStrictEqual([1]);
|
|
179
211
|
});
|
|
180
212
|
it('should control checkbox by selectedIds', function () {
|
|
181
213
|
var _render8 = (0, _react.render)(treeviewRenderMock({
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
214
|
+
showCheckBox: true,
|
|
215
|
+
selectedIds: [1]
|
|
216
|
+
})),
|
|
217
|
+
container = _render8.container;
|
|
218
|
+
|
|
186
219
|
expect(container.querySelector('.checkbox-component input[type=checkbox]')).toBeChecked();
|
|
187
220
|
});
|
|
188
221
|
it('should start checkbox unchecked', function () {
|
|
189
222
|
var _render9 = (0, _react.render)(treeviewRenderMock({
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
223
|
+
showCheckBox: true
|
|
224
|
+
})),
|
|
225
|
+
container = _render9.container;
|
|
226
|
+
|
|
193
227
|
expect(container.querySelector('.checkbox-component input[type=checkbox]')).not.toBeChecked();
|
|
194
228
|
});
|
|
195
229
|
it('should start nodes open', function () {
|
|
196
230
|
var _render10 = (0, _react.render)(treeviewRenderMock({
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
231
|
+
startNodesOpened: true
|
|
232
|
+
})),
|
|
233
|
+
queryByText = _render10.queryByText;
|
|
234
|
+
|
|
200
235
|
expect(queryByText(dataMock.itens[0].titulo)).toBeTruthy();
|
|
201
236
|
expect(queryByText(dataMock.itens[0].itens[0].titulo)).toBeTruthy();
|
|
202
237
|
expect(queryByText(dataMock.itens[0].itens[0].itens[0].titulo)).toBeTruthy();
|
|
@@ -206,36 +241,38 @@ describe('Treeview', function () {
|
|
|
206
241
|
});
|
|
207
242
|
it('should apply customClass', function () {
|
|
208
243
|
var _render11 = (0, _react.render)(treeviewRenderMock({
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
244
|
+
customClass: 'customClass'
|
|
245
|
+
})),
|
|
246
|
+
container = _render11.container;
|
|
247
|
+
|
|
212
248
|
expect(container.firstChild).toHaveClass('customClass');
|
|
213
249
|
});
|
|
214
250
|
it('should apply style', function () {
|
|
215
251
|
var _render12 = (0, _react.render)(treeviewRenderMock({
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
252
|
+
styleForContainer: {
|
|
253
|
+
backgroundColor: '#000'
|
|
254
|
+
}
|
|
255
|
+
})),
|
|
256
|
+
container = _render12.container;
|
|
257
|
+
|
|
221
258
|
expect(container.querySelector('ul')).toHaveStyle('background-color: #000');
|
|
222
259
|
});
|
|
223
260
|
it('should apply idsInLoading', function () {
|
|
224
|
-
var _container$querySelec;
|
|
225
261
|
var _render13 = (0, _react.render)(treeviewRenderMock({
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
262
|
+
idsInLoading: [1]
|
|
263
|
+
})),
|
|
264
|
+
container = _render13.container;
|
|
265
|
+
|
|
266
|
+
var li = container.querySelector('li').firstChild;
|
|
230
267
|
expect(li.firstChild).toHaveClass('spinnerloading');
|
|
231
268
|
});
|
|
232
269
|
it('should apply selectedNodeId', function () {
|
|
233
|
-
var _container$querySelec2;
|
|
234
270
|
var _render14 = (0, _react.render)(treeviewRenderMock({
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
271
|
+
selectedNodeId: 1
|
|
272
|
+
})),
|
|
273
|
+
container = _render14.container;
|
|
274
|
+
|
|
275
|
+
var filhosLi = container.querySelector('li').children;
|
|
239
276
|
expect(filhosLi[1]).toHaveStyle('background-color: rgb(209, 209, 209)');
|
|
240
277
|
});
|
|
241
278
|
});
|
package/lib/treeview_old/Node.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof";
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
@@ -27,21 +27,21 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
|
|
|
27
27
|
|
|
28
28
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
29
29
|
|
|
30
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps);
|
|
30
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
31
31
|
|
|
32
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
|
|
32
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
33
33
|
|
|
34
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf
|
|
34
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
35
35
|
|
|
36
36
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
37
37
|
|
|
38
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; }
|
|
38
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
39
39
|
|
|
40
40
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
41
41
|
|
|
42
42
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
43
43
|
|
|
44
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf
|
|
44
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
45
45
|
|
|
46
46
|
var TreeNode = /*#__PURE__*/function (_Component) {
|
|
47
47
|
_inherits(TreeNode, _Component);
|
package/lib/uitour/helpers.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.STEP_POSITIONS = exports.
|
|
6
|
+
exports.STEP_POSITIONS = exports.ARROW_HEIGHT = exports.ARROW_WIDTH = void 0;
|
|
7
7
|
var ARROW_WIDTH = 26;
|
|
8
8
|
exports.ARROW_WIDTH = ARROW_WIDTH;
|
|
9
9
|
var ARROW_HEIGHT = 20;
|
package/lib/uitour/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof";
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
@@ -9,17 +9,21 @@ exports.default = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
|
|
12
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
+
|
|
12
14
|
var _buttons = _interopRequireWildcard(require("../buttons"));
|
|
13
15
|
|
|
14
16
|
require("../assets/styles/uitour.scss");
|
|
15
17
|
|
|
16
18
|
var _helpers = require("./helpers");
|
|
17
19
|
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
+
|
|
18
22
|
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); }
|
|
19
23
|
|
|
20
24
|
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; }
|
|
21
25
|
|
|
22
|
-
function _extends() { _extends = Object.assign
|
|
26
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
23
27
|
|
|
24
28
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
25
29
|
|
|
@@ -29,7 +33,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
29
33
|
|
|
30
34
|
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; }
|
|
31
35
|
|
|
32
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr
|
|
36
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr && (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; }
|
|
33
37
|
|
|
34
38
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
35
39
|
|
|
@@ -38,12 +42,9 @@ var UiTour = function UiTour(props) {
|
|
|
38
42
|
nextButtonLabel = props.nextButtonLabel,
|
|
39
43
|
backButtonLabel = props.backButtonLabel,
|
|
40
44
|
finishButtonLabel = props.finishButtonLabel,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
showBackButton = _props$showBackButton === void 0 ? true : _props$showBackButton,
|
|
45
|
-
_props$visible = props.visible,
|
|
46
|
-
visible = _props$visible === void 0 ? true : _props$visible,
|
|
45
|
+
showCloseButton = props.showCloseButton,
|
|
46
|
+
showBackButton = props.showBackButton,
|
|
47
|
+
visible = props.visible,
|
|
47
48
|
onFinish = props.onFinish;
|
|
48
49
|
|
|
49
50
|
var _useState = (0, _react.useState)(undefined),
|
|
@@ -81,13 +82,13 @@ var UiTour = function UiTour(props) {
|
|
|
81
82
|
stepPosition = _useState14[0],
|
|
82
83
|
setStepPosition = _useState14[1];
|
|
83
84
|
|
|
84
|
-
var stepRef = (0, _react.useRef)(
|
|
85
|
-
var descriptionRef = (0, _react.useRef)(
|
|
85
|
+
var stepRef = (0, _react.useRef)();
|
|
86
|
+
var descriptionRef = (0, _react.useRef)();
|
|
86
87
|
|
|
87
88
|
var handleNextStep = function handleNextStep() {
|
|
88
89
|
if (hasNextStep) {
|
|
89
90
|
var currentStepIndex = data.findIndex(function (item) {
|
|
90
|
-
return item.id ===
|
|
91
|
+
return item.id === currentStep.id;
|
|
91
92
|
});
|
|
92
93
|
var nextStep = data[currentStepIndex + 1];
|
|
93
94
|
var nextStepIndex = data.findIndex(function (item) {
|
|
@@ -106,7 +107,7 @@ var UiTour = function UiTour(props) {
|
|
|
106
107
|
var handleBackStep = function handleBackStep() {
|
|
107
108
|
if (hasBackStep) {
|
|
108
109
|
var currentStepIndex = data.findIndex(function (item) {
|
|
109
|
-
return item.id ===
|
|
110
|
+
return item.id === currentStep.id;
|
|
110
111
|
});
|
|
111
112
|
var backStep = data[currentStepIndex - 1];
|
|
112
113
|
var backStepIndex = data.findIndex(function (item) {
|
|
@@ -132,7 +133,7 @@ var UiTour = function UiTour(props) {
|
|
|
132
133
|
var stepRect = stepRef.current.getBoundingClientRect();
|
|
133
134
|
var windowWidth = window.innerWidth;
|
|
134
135
|
|
|
135
|
-
if (stepRect.right >= windowWidth ||
|
|
136
|
+
if (stepRect.right >= windowWidth || currentStep.position === _helpers.STEP_POSITIONS.right) {
|
|
136
137
|
setStepPosition(_helpers.STEP_POSITIONS.right);
|
|
137
138
|
setStepDimensions({
|
|
138
139
|
top: target.top - _helpers.ARROW_HEIGHT,
|
|
@@ -208,7 +209,7 @@ var UiTour = function UiTour(props) {
|
|
|
208
209
|
key: currentStep.id,
|
|
209
210
|
style: _extends({}, stepDimensions)
|
|
210
211
|
}, showCloseButton && /*#__PURE__*/_react.default.createElement("div", {
|
|
211
|
-
className: "
|
|
212
|
+
className: "close-button"
|
|
212
213
|
}, /*#__PURE__*/_react.default.createElement(_buttons.default, {
|
|
213
214
|
iconName: "cancel2",
|
|
214
215
|
iconAlign: "center",
|
|
@@ -250,5 +251,21 @@ var UiTour = function UiTour(props) {
|
|
|
250
251
|
}))));
|
|
251
252
|
};
|
|
252
253
|
|
|
254
|
+
UiTour.propTypes = {
|
|
255
|
+
data: _propTypes.default.arrayOf(_propTypes.default.object).isRequired,
|
|
256
|
+
nextButtonLabel: _propTypes.default.string.isRequired,
|
|
257
|
+
backButtonLabel: _propTypes.default.string.isRequired,
|
|
258
|
+
finishButtonLabel: _propTypes.default.string.isRequired,
|
|
259
|
+
showCloseButton: _propTypes.default.bool,
|
|
260
|
+
showBackButton: _propTypes.default.bool,
|
|
261
|
+
visible: _propTypes.default.bool,
|
|
262
|
+
onFinish: _propTypes.default.func
|
|
263
|
+
};
|
|
264
|
+
UiTour.defaultProps = {
|
|
265
|
+
showCloseButton: true,
|
|
266
|
+
showBackButton: true,
|
|
267
|
+
visible: true,
|
|
268
|
+
onFinish: undefined
|
|
269
|
+
};
|
|
253
270
|
var _default = UiTour;
|
|
254
271
|
exports.default = _default;
|