@pingux/astro 2.21.0-alpha.0 → 2.21.0-alpha.2
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/lib/cjs/components/ImageUploadField/ImageUploadField.js +2 -0
- package/lib/cjs/components/ImageUploadField/ImageUploadField.stories.js +15 -2
- package/lib/cjs/components/ImageUploadField/ImageUploadField.test.js +35 -2
- package/lib/cjs/components/ImageUploadField/ImageUploadFieldBase.js +5 -3
- package/lib/cjs/components/NavBar/NavBar.js +18 -10
- package/lib/cjs/components/NavBar/NavBar.stories.js +40 -2
- package/lib/cjs/components/NavBar/NavBar.test.js +16 -2
- package/lib/cjs/components/NavBarSection/NavBarSection.js +3 -2
- package/lib/components/ImageUploadField/ImageUploadField.js +2 -0
- package/lib/components/ImageUploadField/ImageUploadField.stories.js +12 -0
- package/lib/components/ImageUploadField/ImageUploadField.test.js +35 -2
- package/lib/components/ImageUploadField/ImageUploadFieldBase.js +5 -3
- package/lib/components/NavBar/NavBar.js +19 -11
- package/lib/components/NavBar/NavBar.stories.js +37 -0
- package/lib/components/NavBar/NavBar.test.js +16 -2
- package/lib/components/NavBarSection/NavBarSection.js +3 -2
- package/package.json +1 -1
@@ -131,6 +131,8 @@ ImageUploadField.propTypes = _objectSpread(_objectSpread(_objectSpread({
|
|
131
131
|
* `(event: InputEvent) => void`
|
132
132
|
* */
|
133
133
|
onRemove: _propTypes["default"].func,
|
134
|
+
/** Props that will be passed to the Popover Menu. */
|
135
|
+
popoverMenuProps: _propTypes["default"].shape({}),
|
134
136
|
/** Define component height */
|
135
137
|
previewHeight: _propTypes["default"].number,
|
136
138
|
/** Define component height */
|
@@ -21,9 +21,10 @@ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequ
|
|
21
21
|
_Object$defineProperty(exports, "__esModule", {
|
22
22
|
value: true
|
23
23
|
});
|
24
|
-
exports["default"] = exports.ExistingImage = exports.ErrorOnUpload = exports.Default = exports.CustomItemText = exports.CustomDefaultImage = exports.ComponentAsDefaultImage = void 0;
|
24
|
+
exports["default"] = exports.ExistingImage = exports.ErrorOnUpload = exports.Default = exports.CustomizePopoverMenu = exports.CustomItemText = exports.CustomDefaultImage = exports.ComponentAsDefaultImage = void 0;
|
25
25
|
var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
|
26
26
|
var _setTimeout2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/set-timeout"));
|
27
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
27
28
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/asyncToGenerator"));
|
28
29
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/slicedToArray"));
|
29
30
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
@@ -323,4 +324,16 @@ var ErrorOnUpload = function ErrorOnUpload() {
|
|
323
324
|
}))
|
324
325
|
);
|
325
326
|
};
|
326
|
-
exports.ErrorOnUpload = ErrorOnUpload;
|
327
|
+
exports.ErrorOnUpload = ErrorOnUpload;
|
328
|
+
var CustomizePopoverMenu = function CustomizePopoverMenu(args) {
|
329
|
+
return (
|
330
|
+
// Application must be wrapped in an OverlayProvider so that it can be hidden from screen
|
331
|
+
// readers when an overlay opens.
|
332
|
+
(0, _react2.jsx)(_index.OverlayProvider, null, (0, _react2.jsx)(_index.ImageUploadField, (0, _extends2["default"])({}, args, {
|
333
|
+
popoverMenuProps: {
|
334
|
+
align: 'start'
|
335
|
+
}
|
336
|
+
})))
|
337
|
+
);
|
338
|
+
};
|
339
|
+
exports.CustomizePopoverMenu = CustomizePopoverMenu;
|
@@ -21,7 +21,7 @@ var _testAxe = _interopRequireDefault(require("../../utils/testUtils/testAxe"));
|
|
21
21
|
var _testWrapper = require("../../utils/testUtils/testWrapper");
|
22
22
|
var _ImageUploadField = _interopRequireDefault(require("./ImageUploadField"));
|
23
23
|
var _react3 = require("@emotion/react");
|
24
|
-
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, defineProperty = _Object$defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $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 defineProperty(generator, "_invoke", { value: makeInvokeMethod(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) { var _context7; _forEachInstanceProperty(_context7 = ["next", "throw", "return"]).call(_context7, 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; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(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); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), 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" }], _forEachInstanceProperty(tryLocsList).call(tryLocsList, 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, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), 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 (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return _reverseInstanceProperty(keys).call(keys), 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) { var _context8; if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, _forEachInstanceProperty(_context8 = this.tryEntries).call(_context8, resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+_sliceInstanceProperty(name).call(name, 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; }
|
24
|
+
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, defineProperty = _Object$defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $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 defineProperty(generator, "_invoke", { value: makeInvokeMethod(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) { var _context8; _forEachInstanceProperty(_context8 = ["next", "throw", "return"]).call(_context8, 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; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(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); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), 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" }], _forEachInstanceProperty(tryLocsList).call(tryLocsList, 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, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), 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 (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return _reverseInstanceProperty(keys).call(keys), 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) { var _context9; if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, _forEachInstanceProperty(_context9 = this.tryEntries).call(_context9, resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+_sliceInstanceProperty(name).call(name, 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; }
|
25
25
|
var imageUploadNoImagePreview = 'image-upload-no-image-preview';
|
26
26
|
jest.mock('../Image', function () {
|
27
27
|
return function (props) {
|
@@ -381,4 +381,37 @@ test('should render node element if passed as default image', function () {
|
|
381
381
|
var img = _testWrapper.screen.getByRole('img');
|
382
382
|
expect(img).toBeInstanceOf(HTMLImageElement);
|
383
383
|
expect(img).toBeInTheDocument();
|
384
|
-
});
|
384
|
+
});
|
385
|
+
test('should implement popover menu props', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
386
|
+
var imagePreview;
|
387
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
388
|
+
while (1) switch (_context7.prev = _context7.next) {
|
389
|
+
case 0:
|
390
|
+
getComponent({
|
391
|
+
popoverMenuProps: {
|
392
|
+
direction: 'right'
|
393
|
+
}
|
394
|
+
});
|
395
|
+
_react2.fireEvent.change(_testWrapper.screen.getByTestId('image-upload-input'), {
|
396
|
+
target: {
|
397
|
+
files: [file]
|
398
|
+
}
|
399
|
+
});
|
400
|
+
_context7.next = 4;
|
401
|
+
return _testWrapper.screen.findByTestId(imageUploadImagePreview);
|
402
|
+
case 4:
|
403
|
+
imagePreview = _context7.sent;
|
404
|
+
expect(imagePreview).toBeInTheDocument();
|
405
|
+
expect(imagePreview).toHaveAttribute('src');
|
406
|
+
|
407
|
+
// Click on the image preview button
|
408
|
+
_userEvent["default"].click(_testWrapper.screen.getByRole('button'));
|
409
|
+
expect(_testWrapper.screen.getByRole('presentation')).toBeInTheDocument();
|
410
|
+
expect(_testWrapper.screen.getByRole('presentation')).toBeVisible();
|
411
|
+
expect(_testWrapper.screen.getByRole('presentation')).toHaveAttribute('data-popover-placement', 'right');
|
412
|
+
case 11:
|
413
|
+
case "end":
|
414
|
+
return _context7.stop();
|
415
|
+
}
|
416
|
+
}, _callee7);
|
417
|
+
})));
|
@@ -40,6 +40,7 @@ var ImageUploadFieldBase = /*#__PURE__*/(0, _react.forwardRef)(function (props,
|
|
40
40
|
helperText = props.helperText,
|
41
41
|
isImageType = props.isImageType,
|
42
42
|
isMenuOpen = props.isMenuOpen,
|
43
|
+
popoverMenuProps = props.popoverMenuProps,
|
43
44
|
status = props.status;
|
44
45
|
var _useField = (0, _useField2["default"])(_objectSpread({}, (0, _omit["default"])(props, ['onRemove']))),
|
45
46
|
fieldContainerProps = _useField.fieldContainerProps,
|
@@ -58,10 +59,10 @@ var ImageUploadFieldBase = /*#__PURE__*/(0, _react.forwardRef)(function (props,
|
|
58
59
|
onClick: handleLabelClick,
|
59
60
|
ref: labelRef,
|
60
61
|
tabIndex: "-1"
|
61
|
-
})), (0, _react2.jsx)(_.PopoverMenu, {
|
62
|
+
})), (0, _react2.jsx)(_.PopoverMenu, (0, _extends2["default"])({
|
62
63
|
isOpen: isMenuOpen,
|
63
64
|
onOpenChange: handleOpenMenuChange
|
64
|
-
}, children), (0, _react2.jsx)(_.Box, fieldControlWrapperProps, (0, _react2.jsx)(_.Input, (0, _extends2["default"])({}, fieldControlInputProps, visuallyHiddenProps, {
|
65
|
+
}, popoverMenuProps), children), (0, _react2.jsx)(_.Box, fieldControlWrapperProps, (0, _react2.jsx)(_.Input, (0, _extends2["default"])({}, fieldControlInputProps, visuallyHiddenProps, {
|
65
66
|
accept: acceptableInputTypes,
|
66
67
|
"data-testid": "image-upload-input",
|
67
68
|
onChange: handleInputChange,
|
@@ -85,7 +86,8 @@ ImageUploadFieldBase.propTypes = _objectSpread({
|
|
85
86
|
handleOpenMenuChange: _propTypes["default"].func,
|
86
87
|
helperText: _propTypes["default"].node,
|
87
88
|
isImageType: _propTypes["default"].bool,
|
88
|
-
isMenuOpen: _propTypes["default"].bool
|
89
|
+
isMenuOpen: _propTypes["default"].bool,
|
90
|
+
popoverMenuProps: _propTypes["default"].shape({})
|
89
91
|
}, _statusProp.statusPropTypes);
|
90
92
|
ImageUploadFieldBase.displayName = 'ImageUploadFieldBase';
|
91
93
|
var _default = ImageUploadFieldBase;
|
@@ -23,11 +23,12 @@ var _useProgressiveState3 = _interopRequireDefault(require("../../hooks/useProgr
|
|
23
23
|
var _isIterable = require("../../utils/devUtils/props/isIterable");
|
24
24
|
var _Box = _interopRequireDefault(require("../Box/Box"));
|
25
25
|
var _react2 = require("@emotion/react");
|
26
|
-
var _excluded = ["defaultSelectedKey", "selectedKey", "setSelectedKey", "hasRestoreFocus", "defaultExpandedKeys", "children", "variant"];
|
26
|
+
var _excluded = ["isAuto\u0421ollapsible", "defaultSelectedKey", "selectedKey", "setSelectedKey", "hasRestoreFocus", "defaultExpandedKeys", "children", "variant"];
|
27
27
|
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); }
|
28
28
|
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; }
|
29
29
|
var NavBar = function NavBar(props) {
|
30
|
-
var
|
30
|
+
var isAutoСollapsible = props.isAutoСollapsible,
|
31
|
+
defaultSelectedKey = props.defaultSelectedKey,
|
31
32
|
selectedKeyProp = props.selectedKey,
|
32
33
|
setSelectedKeyProp = props.setSelectedKey,
|
33
34
|
hasRestoreFocus = props.hasRestoreFocus,
|
@@ -35,7 +36,8 @@ var NavBar = function NavBar(props) {
|
|
35
36
|
children = props.children,
|
36
37
|
variant = props.variant,
|
37
38
|
others = (0, _objectWithoutProperties2["default"])(props, _excluded);
|
38
|
-
var
|
39
|
+
var initialExpandedKeys = isAutoСollapsible && defaultExpandedKeys.length ? defaultExpandedKeys[0] : defaultExpandedKeys;
|
40
|
+
var _useState = (0, _react.useState)(initialExpandedKeys),
|
39
41
|
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
40
42
|
expandedKeys = _useState2[0],
|
41
43
|
setExpandedKeys = _useState2[1];
|
@@ -53,13 +55,16 @@ var NavBar = function NavBar(props) {
|
|
53
55
|
item: children,
|
54
56
|
key: children.key
|
55
57
|
}];
|
56
|
-
var contextValue = {
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
58
|
+
var contextValue = (0, _react.useMemo)(function () {
|
59
|
+
return {
|
60
|
+
isAutoСollapsible: isAutoСollapsible,
|
61
|
+
selectedKey: selectedKey,
|
62
|
+
setSelectedKey: setSelectedKeyProp || setSelectedKey,
|
63
|
+
expandedKeys: expandedKeys,
|
64
|
+
setExpandedKeys: setExpandedKeys,
|
65
|
+
navStyles: navStyles
|
66
|
+
};
|
67
|
+
}, [isAutoСollapsible, selectedKey, setSelectedKeyProp, setSelectedKey, expandedKeys, setExpandedKeys, navStyles]);
|
63
68
|
return (0, _react2.jsx)(_NavBarContext.NavBarContext.Provider, {
|
64
69
|
value: contextValue
|
65
70
|
}, (0, _react2.jsx)(_Box["default"], (0, _extends2["default"])({
|
@@ -100,6 +105,8 @@ var FocusableItem = function FocusableItem(props) {
|
|
100
105
|
return childWithFocusHandle;
|
101
106
|
};
|
102
107
|
NavBar.propTypes = {
|
108
|
+
/** Allows only one item to be expanded. */
|
109
|
+
isAutoСollapsible: _propTypes["default"].bool,
|
103
110
|
/** This applies a style to the entire nav tree. the options are default and popup. */
|
104
111
|
variant: _propTypes["default"].oneOf(['default', 'popupNav']),
|
105
112
|
/** Whether or not the focus will return to the previously focused element upon unmount. */
|
@@ -118,6 +125,7 @@ NavBar.propTypes = {
|
|
118
125
|
setSelectedKey: _propTypes["default"].func
|
119
126
|
};
|
120
127
|
NavBar.defaultProps = {
|
128
|
+
isAutoСollapsible: false,
|
121
129
|
defaultSelectedKey: '',
|
122
130
|
defaultExpandedKeys: [],
|
123
131
|
variant: 'default',
|
@@ -8,7 +8,7 @@ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequ
|
|
8
8
|
_Object$defineProperty(exports, "__esModule", {
|
9
9
|
value: true
|
10
10
|
});
|
11
|
-
exports["default"] = exports.Default = exports.Controlled = void 0;
|
11
|
+
exports["default"] = exports.Default = exports.Controlled = exports.AutoCollapse = void 0;
|
12
12
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/slicedToArray"));
|
13
13
|
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
14
14
|
var _react = _interopRequireWildcard(require("react"));
|
@@ -474,4 +474,42 @@ var Controlled = function Controlled() {
|
|
474
474
|
"data-id": "third-nav-bar-section"
|
475
475
|
})));
|
476
476
|
};
|
477
|
-
exports.Controlled = Controlled;
|
477
|
+
exports.Controlled = Controlled;
|
478
|
+
var AutoCollapse = function AutoCollapse() {
|
479
|
+
return (0, _react2.jsx)(_index.NavBar, {
|
480
|
+
isAutoСollapsible: true
|
481
|
+
}, (0, _react2.jsx)(_index.Box, {
|
482
|
+
padding: "md",
|
483
|
+
key: "top-logo-parent"
|
484
|
+
}, (0, _react2.jsx)(_index.Link, {
|
485
|
+
"aria-label": "home link",
|
486
|
+
href: "https://pingidentity.com",
|
487
|
+
target: "_blank"
|
488
|
+
}, logo)), (0, _react2.jsx)(_index.Separator, {
|
489
|
+
m: 0,
|
490
|
+
backgroundColor: "neutral.60"
|
491
|
+
}), (0, _react2.jsx)(_index.Box, {
|
492
|
+
variant: "navBar.sectionContainer",
|
493
|
+
paddingBottom: "xl",
|
494
|
+
key: "first-section-container"
|
495
|
+
}, (0, _react2.jsx)(_index.NavBarItem, {
|
496
|
+
"data-id": "nav-bar-item",
|
497
|
+
icon: _GlobeIcon["default"],
|
498
|
+
id: "Overview",
|
499
|
+
key: "Overview",
|
500
|
+
text: "Overview"
|
501
|
+
}), (0, _react2.jsx)(_index.NavBarSection, {
|
502
|
+
items: data,
|
503
|
+
"data-id": "nav-bar-section"
|
504
|
+
}), (0, _react2.jsx)(_index.NavBarSection, {
|
505
|
+
items: secondData,
|
506
|
+
hasSeparator: true,
|
507
|
+
title: "PingOne Services",
|
508
|
+
"data-id": "second-nav-bar-section"
|
509
|
+
}), (0, _react2.jsx)(_index.NavBarSection, {
|
510
|
+
items: thirdData,
|
511
|
+
hasSeparator: true,
|
512
|
+
"data-id": "third-nav-bar-section"
|
513
|
+
})));
|
514
|
+
};
|
515
|
+
exports.AutoCollapse = AutoCollapse;
|
@@ -49,12 +49,12 @@ var data = [{
|
|
49
49
|
icon: _ViewDashboardIcon["default"],
|
50
50
|
key: 'Dashboard',
|
51
51
|
heading: 'Dashboard',
|
52
|
-
children: ['Users', 'Group', 'Populations', 'Attributes', 'Roles']
|
52
|
+
children: ['Users', 'Group', 'Populations', 'Attributes', 'Roles', 'Dashboard Unique']
|
53
53
|
}, {
|
54
54
|
icon: _AccountMultipleIcon["default"],
|
55
55
|
key: 'Identities',
|
56
56
|
heading: 'Identities',
|
57
|
-
children: ['Users', 'Group', 'Populations', 'Attributes', 'Roles']
|
57
|
+
children: ['Users', 'Group', 'Populations', 'Attributes', 'Roles', 'Identities Unique']
|
58
58
|
}, {
|
59
59
|
icon: _TransitConnectionVariantIcon["default"],
|
60
60
|
key: 'Connections',
|
@@ -468,4 +468,18 @@ test('controlled version: items can be updated.', function () {
|
|
468
468
|
expect(thisitem).toBeInTheDocument();
|
469
469
|
_userEvent["default"].click(button);
|
470
470
|
expect(_testWrapper.screen.queryByTestId('Environment title that is so long, it wraps')).not.toBeInTheDocument();
|
471
|
+
});
|
472
|
+
test('expand only one item', function () {
|
473
|
+
getComponent({
|
474
|
+
isAutoСollapsible: true
|
475
|
+
});
|
476
|
+
expect(_testWrapper.screen.queryByText('Dashboard Unique')).not.toBeInTheDocument();
|
477
|
+
expect(_testWrapper.screen.queryByText('Identities Unique')).not.toBeInTheDocument();
|
478
|
+
var headerButtons = _testWrapper.screen.getAllByRole('button');
|
479
|
+
_userEvent["default"].click(headerButtons[1]);
|
480
|
+
expect(_testWrapper.screen.queryByText('Dashboard Unique')).toBeInTheDocument();
|
481
|
+
expect(_testWrapper.screen.queryByText('Identities Unique')).not.toBeInTheDocument();
|
482
|
+
_userEvent["default"].click(headerButtons[2]);
|
483
|
+
expect(_testWrapper.screen.queryByText('Dashboard Unique')).not.toBeInTheDocument();
|
484
|
+
expect(_testWrapper.screen.queryByText('Identities Unique')).toBeInTheDocument();
|
471
485
|
});
|
@@ -78,7 +78,8 @@ var SectionItem = function SectionItem(_ref2) {
|
|
78
78
|
children = item.children,
|
79
79
|
others = (0, _objectWithoutProperties2["default"])(item, _excluded2);
|
80
80
|
var navBarState = (0, _NavBarContext.useNavBarContext)();
|
81
|
-
var
|
81
|
+
var isAutoСollapsible = navBarState.isAutoСollapsible,
|
82
|
+
expandedKeys = navBarState.expandedKeys,
|
82
83
|
setExpandedKeys = navBarState.setExpandedKeys;
|
83
84
|
var isExpanded = (0, _includes["default"])(expandedKeys).call(expandedKeys, key);
|
84
85
|
var firstChildKey = children.length ? children[0].key : null;
|
@@ -87,7 +88,7 @@ var SectionItem = function SectionItem(_ref2) {
|
|
87
88
|
var newArray;
|
88
89
|
if (isOpen) {
|
89
90
|
var _context;
|
90
|
-
newArray = (0, _concat["default"])(_context = []).call(_context, expandedKeys, [key]);
|
91
|
+
newArray = isAutoСollapsible ? [key] : (0, _concat["default"])(_context = []).call(_context, expandedKeys, [key]);
|
91
92
|
} else {
|
92
93
|
newArray = (0, _filter["default"])(expandedKeys).call(expandedKeys, function (thiskey) {
|
93
94
|
return thiskey !== key;
|
@@ -120,6 +120,8 @@ ImageUploadField.propTypes = _objectSpread(_objectSpread(_objectSpread({
|
|
120
120
|
* `(event: InputEvent) => void`
|
121
121
|
* */
|
122
122
|
onRemove: PropTypes.func,
|
123
|
+
/** Props that will be passed to the Popover Menu. */
|
124
|
+
popoverMenuProps: PropTypes.shape({}),
|
123
125
|
/** Define component height */
|
124
126
|
previewHeight: PropTypes.number,
|
125
127
|
/** Define component height */
|
@@ -13,6 +13,7 @@ import _Object$setPrototypeOf from "@babel/runtime-corejs3/core-js-stable/object
|
|
13
13
|
import _reverseInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/reverse";
|
14
14
|
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
|
15
15
|
import _typeof from "@babel/runtime-corejs3/helpers/esm/typeof";
|
16
|
+
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
16
17
|
import _asyncToGenerator from "@babel/runtime-corejs3/helpers/esm/asyncToGenerator";
|
17
18
|
import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
18
19
|
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
@@ -305,4 +306,15 @@ export var ErrorOnUpload = function ErrorOnUpload() {
|
|
305
306
|
helperText: error
|
306
307
|
}))
|
307
308
|
);
|
309
|
+
};
|
310
|
+
export var CustomizePopoverMenu = function CustomizePopoverMenu(args) {
|
311
|
+
return (
|
312
|
+
// Application must be wrapped in an OverlayProvider so that it can be hidden from screen
|
313
|
+
// readers when an overlay opens.
|
314
|
+
___EmotionJSX(OverlayProvider, null, ___EmotionJSX(ImageUploadField, _extends({}, args, {
|
315
|
+
popoverMenuProps: {
|
316
|
+
align: 'start'
|
317
|
+
}
|
318
|
+
})))
|
319
|
+
);
|
308
320
|
};
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import _typeof from "@babel/runtime-corejs3/helpers/esm/typeof";
|
2
2
|
import _asyncToGenerator from "@babel/runtime-corejs3/helpers/esm/asyncToGenerator";
|
3
3
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
4
|
-
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, defineProperty = _Object$defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $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 defineProperty(generator, "_invoke", { value: makeInvokeMethod(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) { var _context7; _forEachInstanceProperty(_context7 = ["next", "throw", "return"]).call(_context7, 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; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(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); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), 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" }], _forEachInstanceProperty(tryLocsList).call(tryLocsList, 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, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), 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 (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return _reverseInstanceProperty(keys).call(keys), 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) { var _context8; if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, _forEachInstanceProperty(_context8 = this.tryEntries).call(_context8, resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+_sliceInstanceProperty(name).call(name, 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; }
|
4
|
+
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, defineProperty = _Object$defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $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 defineProperty(generator, "_invoke", { value: makeInvokeMethod(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) { var _context8; _forEachInstanceProperty(_context8 = ["next", "throw", "return"]).call(_context8, 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; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(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); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), 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" }], _forEachInstanceProperty(tryLocsList).call(tryLocsList, 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, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), 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 (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return _reverseInstanceProperty(keys).call(keys), 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) { var _context9; if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, _forEachInstanceProperty(_context9 = this.tryEntries).call(_context9, resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+_sliceInstanceProperty(name).call(name, 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; }
|
5
5
|
import _URL from "@babel/runtime-corejs3/core-js-stable/url";
|
6
6
|
import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
|
7
7
|
import _Symbol from "@babel/runtime-corejs3/core-js-stable/symbol";
|
@@ -378,4 +378,37 @@ test('should render node element if passed as default image', function () {
|
|
378
378
|
var img = screen.getByRole('img');
|
379
379
|
expect(img).toBeInstanceOf(HTMLImageElement);
|
380
380
|
expect(img).toBeInTheDocument();
|
381
|
-
});
|
381
|
+
});
|
382
|
+
test('should implement popover menu props', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
383
|
+
var imagePreview;
|
384
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
385
|
+
while (1) switch (_context7.prev = _context7.next) {
|
386
|
+
case 0:
|
387
|
+
getComponent({
|
388
|
+
popoverMenuProps: {
|
389
|
+
direction: 'right'
|
390
|
+
}
|
391
|
+
});
|
392
|
+
fireEvent.change(screen.getByTestId('image-upload-input'), {
|
393
|
+
target: {
|
394
|
+
files: [file]
|
395
|
+
}
|
396
|
+
});
|
397
|
+
_context7.next = 4;
|
398
|
+
return screen.findByTestId(imageUploadImagePreview);
|
399
|
+
case 4:
|
400
|
+
imagePreview = _context7.sent;
|
401
|
+
expect(imagePreview).toBeInTheDocument();
|
402
|
+
expect(imagePreview).toHaveAttribute('src');
|
403
|
+
|
404
|
+
// Click on the image preview button
|
405
|
+
userEvent.click(screen.getByRole('button'));
|
406
|
+
expect(screen.getByRole('presentation')).toBeInTheDocument();
|
407
|
+
expect(screen.getByRole('presentation')).toBeVisible();
|
408
|
+
expect(screen.getByRole('presentation')).toHaveAttribute('data-popover-placement', 'right');
|
409
|
+
case 11:
|
410
|
+
case "end":
|
411
|
+
return _context7.stop();
|
412
|
+
}
|
413
|
+
}, _callee7);
|
414
|
+
})));
|
@@ -29,6 +29,7 @@ var ImageUploadFieldBase = /*#__PURE__*/forwardRef(function (props, inputRef) {
|
|
29
29
|
helperText = props.helperText,
|
30
30
|
isImageType = props.isImageType,
|
31
31
|
isMenuOpen = props.isMenuOpen,
|
32
|
+
popoverMenuProps = props.popoverMenuProps,
|
32
33
|
status = props.status;
|
33
34
|
var _useField = useField(_objectSpread({}, omit(props, ['onRemove']))),
|
34
35
|
fieldContainerProps = _useField.fieldContainerProps,
|
@@ -47,10 +48,10 @@ var ImageUploadFieldBase = /*#__PURE__*/forwardRef(function (props, inputRef) {
|
|
47
48
|
onClick: handleLabelClick,
|
48
49
|
ref: labelRef,
|
49
50
|
tabIndex: "-1"
|
50
|
-
})), ___EmotionJSX(PopoverMenu, {
|
51
|
+
})), ___EmotionJSX(PopoverMenu, _extends({
|
51
52
|
isOpen: isMenuOpen,
|
52
53
|
onOpenChange: handleOpenMenuChange
|
53
|
-
}, children), ___EmotionJSX(Box, fieldControlWrapperProps, ___EmotionJSX(Input, _extends({}, fieldControlInputProps, visuallyHiddenProps, {
|
54
|
+
}, popoverMenuProps), children), ___EmotionJSX(Box, fieldControlWrapperProps, ___EmotionJSX(Input, _extends({}, fieldControlInputProps, visuallyHiddenProps, {
|
54
55
|
accept: acceptableInputTypes,
|
55
56
|
"data-testid": "image-upload-input",
|
56
57
|
onChange: handleInputChange,
|
@@ -74,7 +75,8 @@ ImageUploadFieldBase.propTypes = _objectSpread({
|
|
74
75
|
handleOpenMenuChange: PropTypes.func,
|
75
76
|
helperText: PropTypes.node,
|
76
77
|
isImageType: PropTypes.bool,
|
77
|
-
isMenuOpen: PropTypes.bool
|
78
|
+
isMenuOpen: PropTypes.bool,
|
79
|
+
popoverMenuProps: PropTypes.shape({})
|
78
80
|
}, statusPropTypes);
|
79
81
|
ImageUploadFieldBase.displayName = 'ImageUploadFieldBase';
|
80
82
|
export default ImageUploadFieldBase;
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
2
2
|
import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
3
3
|
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
4
|
-
var _excluded = ["defaultSelectedKey", "selectedKey", "setSelectedKey", "hasRestoreFocus", "defaultExpandedKeys", "children", "variant"];
|
4
|
+
var _excluded = ["isAuto\u0421ollapsible", "defaultSelectedKey", "selectedKey", "setSelectedKey", "hasRestoreFocus", "defaultExpandedKeys", "children", "variant"];
|
5
5
|
import _Array$isArray from "@babel/runtime-corejs3/core-js-stable/array/is-array";
|
6
6
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
7
|
-
import React, { useState } from 'react';
|
7
|
+
import React, { useMemo, useState } from 'react';
|
8
8
|
import { FocusScope, useFocusManager } from '@react-aria/focus';
|
9
9
|
import PropTypes from 'prop-types';
|
10
10
|
import { NavBarContext } from '../../context/NavBarContext';
|
@@ -14,7 +14,8 @@ import { isIterableProp } from '../../utils/devUtils/props/isIterable';
|
|
14
14
|
import Box from '../Box/Box';
|
15
15
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
16
16
|
var NavBar = function NavBar(props) {
|
17
|
-
var
|
17
|
+
var isAutoСollapsible = props.isAutoСollapsible,
|
18
|
+
defaultSelectedKey = props.defaultSelectedKey,
|
18
19
|
selectedKeyProp = props.selectedKey,
|
19
20
|
setSelectedKeyProp = props.setSelectedKey,
|
20
21
|
hasRestoreFocus = props.hasRestoreFocus,
|
@@ -22,7 +23,8 @@ var NavBar = function NavBar(props) {
|
|
22
23
|
children = props.children,
|
23
24
|
variant = props.variant,
|
24
25
|
others = _objectWithoutProperties(props, _excluded);
|
25
|
-
var
|
26
|
+
var initialExpandedKeys = isAutoСollapsible && defaultExpandedKeys.length ? defaultExpandedKeys[0] : defaultExpandedKeys;
|
27
|
+
var _useState = useState(initialExpandedKeys),
|
26
28
|
_useState2 = _slicedToArray(_useState, 2),
|
27
29
|
expandedKeys = _useState2[0],
|
28
30
|
setExpandedKeys = _useState2[1];
|
@@ -40,13 +42,16 @@ var NavBar = function NavBar(props) {
|
|
40
42
|
item: children,
|
41
43
|
key: children.key
|
42
44
|
}];
|
43
|
-
var contextValue = {
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
45
|
+
var contextValue = useMemo(function () {
|
46
|
+
return {
|
47
|
+
isAutoСollapsible: isAutoСollapsible,
|
48
|
+
selectedKey: selectedKey,
|
49
|
+
setSelectedKey: setSelectedKeyProp || setSelectedKey,
|
50
|
+
expandedKeys: expandedKeys,
|
51
|
+
setExpandedKeys: setExpandedKeys,
|
52
|
+
navStyles: navStyles
|
53
|
+
};
|
54
|
+
}, [isAutoСollapsible, selectedKey, setSelectedKeyProp, setSelectedKey, expandedKeys, setExpandedKeys, navStyles]);
|
50
55
|
return ___EmotionJSX(NavBarContext.Provider, {
|
51
56
|
value: contextValue
|
52
57
|
}, ___EmotionJSX(Box, _extends({
|
@@ -87,6 +92,8 @@ var FocusableItem = function FocusableItem(props) {
|
|
87
92
|
return childWithFocusHandle;
|
88
93
|
};
|
89
94
|
NavBar.propTypes = {
|
95
|
+
/** Allows only one item to be expanded. */
|
96
|
+
isAutoСollapsible: PropTypes.bool,
|
90
97
|
/** This applies a style to the entire nav tree. the options are default and popup. */
|
91
98
|
variant: PropTypes.oneOf(['default', 'popupNav']),
|
92
99
|
/** Whether or not the focus will return to the previously focused element upon unmount. */
|
@@ -105,6 +112,7 @@ NavBar.propTypes = {
|
|
105
112
|
setSelectedKey: PropTypes.func
|
106
113
|
};
|
107
114
|
NavBar.defaultProps = {
|
115
|
+
isAutoСollapsible: false,
|
108
116
|
defaultSelectedKey: '',
|
109
117
|
defaultExpandedKeys: [],
|
110
118
|
variant: 'default',
|
@@ -458,4 +458,41 @@ export var Controlled = function Controlled() {
|
|
458
458
|
items: customData,
|
459
459
|
"data-id": "third-nav-bar-section"
|
460
460
|
})));
|
461
|
+
};
|
462
|
+
export var AutoCollapse = function AutoCollapse() {
|
463
|
+
return ___EmotionJSX(NavBar, {
|
464
|
+
isAutoСollapsible: true
|
465
|
+
}, ___EmotionJSX(Box, {
|
466
|
+
padding: "md",
|
467
|
+
key: "top-logo-parent"
|
468
|
+
}, ___EmotionJSX(Link, {
|
469
|
+
"aria-label": "home link",
|
470
|
+
href: "https://pingidentity.com",
|
471
|
+
target: "_blank"
|
472
|
+
}, logo)), ___EmotionJSX(Separator, {
|
473
|
+
m: 0,
|
474
|
+
backgroundColor: "neutral.60"
|
475
|
+
}), ___EmotionJSX(Box, {
|
476
|
+
variant: "navBar.sectionContainer",
|
477
|
+
paddingBottom: "xl",
|
478
|
+
key: "first-section-container"
|
479
|
+
}, ___EmotionJSX(NavBarItem, {
|
480
|
+
"data-id": "nav-bar-item",
|
481
|
+
icon: GlobeIcon,
|
482
|
+
id: "Overview",
|
483
|
+
key: "Overview",
|
484
|
+
text: "Overview"
|
485
|
+
}), ___EmotionJSX(NavBarSection, {
|
486
|
+
items: data,
|
487
|
+
"data-id": "nav-bar-section"
|
488
|
+
}), ___EmotionJSX(NavBarSection, {
|
489
|
+
items: secondData,
|
490
|
+
hasSeparator: true,
|
491
|
+
title: "PingOne Services",
|
492
|
+
"data-id": "second-nav-bar-section"
|
493
|
+
}), ___EmotionJSX(NavBarSection, {
|
494
|
+
items: thirdData,
|
495
|
+
hasSeparator: true,
|
496
|
+
"data-id": "third-nav-bar-section"
|
497
|
+
})));
|
461
498
|
};
|
@@ -40,12 +40,12 @@ var data = [{
|
|
40
40
|
icon: ViewDashboard,
|
41
41
|
key: 'Dashboard',
|
42
42
|
heading: 'Dashboard',
|
43
|
-
children: ['Users', 'Group', 'Populations', 'Attributes', 'Roles']
|
43
|
+
children: ['Users', 'Group', 'Populations', 'Attributes', 'Roles', 'Dashboard Unique']
|
44
44
|
}, {
|
45
45
|
icon: AccountMultiple,
|
46
46
|
key: 'Identities',
|
47
47
|
heading: 'Identities',
|
48
|
-
children: ['Users', 'Group', 'Populations', 'Attributes', 'Roles']
|
48
|
+
children: ['Users', 'Group', 'Populations', 'Attributes', 'Roles', 'Identities Unique']
|
49
49
|
}, {
|
50
50
|
icon: TransitConnection,
|
51
51
|
key: 'Connections',
|
@@ -459,4 +459,18 @@ test('controlled version: items can be updated.', function () {
|
|
459
459
|
expect(thisitem).toBeInTheDocument();
|
460
460
|
userEvent.click(button);
|
461
461
|
expect(screen.queryByTestId('Environment title that is so long, it wraps')).not.toBeInTheDocument();
|
462
|
+
});
|
463
|
+
test('expand only one item', function () {
|
464
|
+
getComponent({
|
465
|
+
isAutoСollapsible: true
|
466
|
+
});
|
467
|
+
expect(screen.queryByText('Dashboard Unique')).not.toBeInTheDocument();
|
468
|
+
expect(screen.queryByText('Identities Unique')).not.toBeInTheDocument();
|
469
|
+
var headerButtons = screen.getAllByRole('button');
|
470
|
+
userEvent.click(headerButtons[1]);
|
471
|
+
expect(screen.queryByText('Dashboard Unique')).toBeInTheDocument();
|
472
|
+
expect(screen.queryByText('Identities Unique')).not.toBeInTheDocument();
|
473
|
+
userEvent.click(headerButtons[2]);
|
474
|
+
expect(screen.queryByText('Dashboard Unique')).not.toBeInTheDocument();
|
475
|
+
expect(screen.queryByText('Identities Unique')).toBeInTheDocument();
|
462
476
|
});
|
@@ -66,7 +66,8 @@ var SectionItem = function SectionItem(_ref2) {
|
|
66
66
|
children = item.children,
|
67
67
|
others = _objectWithoutProperties(item, _excluded2);
|
68
68
|
var navBarState = useNavBarContext();
|
69
|
-
var
|
69
|
+
var isAutoСollapsible = navBarState.isAutoСollapsible,
|
70
|
+
expandedKeys = navBarState.expandedKeys,
|
70
71
|
setExpandedKeys = navBarState.setExpandedKeys;
|
71
72
|
var isExpanded = _includesInstanceProperty(expandedKeys).call(expandedKeys, key);
|
72
73
|
var firstChildKey = children.length ? children[0].key : null;
|
@@ -75,7 +76,7 @@ var SectionItem = function SectionItem(_ref2) {
|
|
75
76
|
var newArray;
|
76
77
|
if (isOpen) {
|
77
78
|
var _context;
|
78
|
-
newArray = _concatInstanceProperty(_context = []).call(_context, expandedKeys, [key]);
|
79
|
+
newArray = isAutoСollapsible ? [key] : _concatInstanceProperty(_context = []).call(_context, expandedKeys, [key]);
|
79
80
|
} else {
|
80
81
|
newArray = _filterInstanceProperty(expandedKeys).call(expandedKeys, function (thiskey) {
|
81
82
|
return thiskey !== key;
|