@pingux/astro 2.97.0 → 2.98.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/lib/cjs/components/ListView/ListView.js +15 -2
  2. package/lib/cjs/components/ListView/ListView.stories.d.ts +1 -0
  3. package/lib/cjs/components/ListView/ListView.stories.js +157 -33
  4. package/lib/cjs/components/ListView/ListView.test.js +171 -77
  5. package/lib/cjs/components/Radio/Radio.d.ts +12 -0
  6. package/lib/cjs/components/Radio/Radio.js +2 -1
  7. package/lib/cjs/components/Radio/Radio.styles.d.ts +53 -0
  8. package/lib/cjs/components/Radio/Radio.styles.js +4 -2
  9. package/lib/cjs/components/Radio/index.d.ts +1 -0
  10. package/lib/cjs/components/RadioField/RadioField.d.ts +12 -0
  11. package/lib/cjs/components/RadioField/RadioField.js +6 -57
  12. package/lib/cjs/components/RadioField/RadioField.test.d.ts +1 -0
  13. package/lib/cjs/components/RadioField/RadioField.test.js +7 -4
  14. package/lib/cjs/components/RadioField/index.d.ts +2 -0
  15. package/lib/cjs/components/RadioGroupField/RadioGroupField.d.ts +4 -0
  16. package/lib/cjs/components/RadioGroupField/RadioGroupField.js +2 -47
  17. package/lib/cjs/components/RadioGroupField/RadioGroupField.stories.d.ts +42 -0
  18. package/lib/cjs/components/RadioGroupField/RadioGroupField.stories.js +7 -0
  19. package/lib/cjs/components/RadioGroupField/RadioGroupField.test.d.ts +1 -0
  20. package/lib/cjs/components/RadioGroupField/RadioGroupField.test.js +4 -4
  21. package/lib/cjs/components/RadioGroupField/index.d.ts +1 -0
  22. package/lib/cjs/hooks/useLoadPrev/index.d.ts +1 -0
  23. package/lib/cjs/hooks/useLoadPrev/index.js +14 -0
  24. package/lib/cjs/hooks/useLoadPrev/useLoadPrev.d.ts +2 -0
  25. package/lib/cjs/hooks/useLoadPrev/useLoadPrev.js +35 -0
  26. package/lib/cjs/hooks/useLoadPrev/useLoadPrev.test.d.ts +1 -0
  27. package/lib/cjs/hooks/useLoadPrev/useLoadPrev.test.js +87 -0
  28. package/lib/cjs/types/listView.d.ts +1 -0
  29. package/lib/cjs/types/radio.d.ts +3 -0
  30. package/lib/cjs/types/radio.js +6 -0
  31. package/lib/cjs/types/radioField.d.ts +42 -0
  32. package/lib/cjs/types/radioField.js +6 -0
  33. package/lib/cjs/types/radioGroupField.d.ts +15 -0
  34. package/lib/cjs/types/radioGroupField.js +6 -0
  35. package/lib/cjs/utils/designUtils/figmaLinks.d.ts +3 -0
  36. package/lib/cjs/utils/designUtils/figmaLinks.js +3 -0
  37. package/lib/cjs/utils/devUtils/constants/loadingStates.js +2 -1
  38. package/lib/components/ListView/ListView.js +15 -2
  39. package/lib/components/ListView/ListView.stories.js +125 -2
  40. package/lib/components/ListView/ListView.test.js +168 -77
  41. package/lib/components/Radio/Radio.js +1 -2
  42. package/lib/components/Radio/Radio.styles.js +4 -2
  43. package/lib/components/RadioField/RadioField.js +8 -59
  44. package/lib/components/RadioField/RadioField.test.js +7 -4
  45. package/lib/components/RadioGroupField/RadioGroupField.js +0 -47
  46. package/lib/components/RadioGroupField/RadioGroupField.stories.js +7 -0
  47. package/lib/components/RadioGroupField/RadioGroupField.test.js +4 -4
  48. package/lib/hooks/useLoadPrev/index.js +1 -0
  49. package/lib/hooks/useLoadPrev/useLoadPrev.js +27 -0
  50. package/lib/hooks/useLoadPrev/useLoadPrev.test.js +78 -0
  51. package/lib/types/radio.js +1 -0
  52. package/lib/types/radioField.js +1 -0
  53. package/lib/types/radioGroupField.js +1 -0
  54. package/lib/utils/designUtils/figmaLinks.js +3 -0
  55. package/lib/utils/devUtils/constants/loadingStates.js +2 -1
  56. package/package.json +1 -1
@@ -16,12 +16,15 @@ import _Object$defineProperties from "@babel/runtime-corejs3/core-js-stable/obje
16
16
  import _typeof from "@babel/runtime-corejs3/helpers/esm/typeof";
17
17
  import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
18
18
  import _asyncToGenerator from "@babel/runtime-corejs3/helpers/esm/asyncToGenerator";
19
+ import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
19
20
  import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
20
21
  function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
21
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context15, _context16; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context15 = ownKeys(Object(source), !0)).call(_context15, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context16 = ownKeys(Object(source))).call(_context16, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
22
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context19, _context20; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context19 = ownKeys(Object(source), !0)).call(_context19, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context20 = ownKeys(Object(source))).call(_context20, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
23
+ 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 _context17; _forEachInstanceProperty(_context17 = ["next", "throw", "return"]).call(_context17, 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 _context18; 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(_context18 = this.tryEntries).call(_context18, 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
+ import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
25
+ import _fillInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/fill";
22
26
  import _Set from "@babel/runtime-corejs3/core-js-stable/set";
23
- 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 _context13; _forEachInstanceProperty(_context13 = ["next", "throw", "return"]).call(_context13, 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 _context14; 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(_context14 = this.tryEntries).call(_context14, 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
- import React from 'react';
27
+ import React, { useState } from 'react';
25
28
  import { FocusScope } from 'react-aria';
26
29
  import { Item } from 'react-stately';
27
30
  import userEvent from '@testing-library/user-event';
@@ -57,6 +60,8 @@ var preventDefault = jest.fn();
57
60
  var focusNext = jest.fn();
58
61
  var focusPrevious = jest.fn();
59
62
  var setIsFocusEscaped = jest.fn();
63
+ var onLoadMoreFunc = jest.fn();
64
+ var onLoadPrevFunc = jest.fn();
60
65
  var testEvent = {
61
66
  stopPropagation: stopPropagation,
62
67
  preventDefault: preventDefault
@@ -149,6 +154,69 @@ var getComponentWithCheckbox = function getComponentWithCheckbox() {
149
154
  }));
150
155
  })));
151
156
  };
157
+ var ComponentOnPrevLoad = function ComponentOnPrevLoad() {
158
+ var _context, _context2;
159
+ var initialItems = _mapInstanceProperty(_context = _fillInstanceProperty(_context2 = new Array(10)).call(_context2, {
160
+ key: 'string',
161
+ name: 'string'
162
+ })).call(_context, function (_item, index) {
163
+ return {
164
+ name: "name: ".concat(index),
165
+ key: "name: ".concat(index),
166
+ id: index
167
+ };
168
+ });
169
+ var _useState = useState(initialItems),
170
+ _useState2 = _slicedToArray(_useState, 2),
171
+ listItems = _useState2[0],
172
+ setListItems = _useState2[1];
173
+ var onLoadMore = /*#__PURE__*/function () {
174
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
175
+ return _regeneratorRuntime().wrap(function _callee$(_context3) {
176
+ while (1) switch (_context3.prev = _context3.next) {
177
+ case 0:
178
+ onLoadMoreFunc();
179
+ case 1:
180
+ case "end":
181
+ return _context3.stop();
182
+ }
183
+ }, _callee);
184
+ }));
185
+ return function onLoadMore() {
186
+ return _ref5.apply(this, arguments);
187
+ };
188
+ }();
189
+ var onLoadPrev = /*#__PURE__*/function () {
190
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
191
+ return _regeneratorRuntime().wrap(function _callee2$(_context4) {
192
+ while (1) switch (_context4.prev = _context4.next) {
193
+ case 0:
194
+ onLoadPrevFunc();
195
+ case 1:
196
+ case "end":
197
+ return _context4.stop();
198
+ }
199
+ }, _callee2);
200
+ }));
201
+ return function onLoadPrev() {
202
+ return _ref6.apply(this, arguments);
203
+ };
204
+ }();
205
+ return ___EmotionJSX(ListView, _extends({}, defaultProps, {
206
+ items: listItems,
207
+ onLoadMore: onLoadMore,
208
+ onLoadPrev: onLoadPrev
209
+ }), function (item) {
210
+ return ___EmotionJSX(Item, {
211
+ key: item.key,
212
+ textValue: item.name,
213
+ "data-id": item.key
214
+ }, ___EmotionJSX("h1", {
215
+ key: item.key,
216
+ "data-testid": item.name
217
+ }, item.name));
218
+ });
219
+ };
152
220
 
153
221
  // Needs to be added to each components test file
154
222
  universalComponentTests({
@@ -172,10 +240,10 @@ test('renders listview component', function () {
172
240
  var listView = screen.getByTestId(testId);
173
241
  expect(listView).toBeInTheDocument();
174
242
  });
175
- test('navigating the list using the keyboard causes the isSelected and isFocused state to change', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
243
+ test('navigating the list using the keyboard causes the isSelected and isFocused state to change', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
176
244
  var listView, options, updatedOption;
177
- return _regeneratorRuntime().wrap(function _callee$(_context) {
178
- while (1) switch (_context.prev = _context.next) {
245
+ return _regeneratorRuntime().wrap(function _callee3$(_context5) {
246
+ while (1) switch (_context5.prev = _context5.next) {
179
247
  case 0:
180
248
  getComponent();
181
249
  listView = screen.getByTestId(testId); // Open the list arrow down to the second option,
@@ -189,21 +257,21 @@ test('navigating the list using the keyboard causes the isSelected and isFocused
189
257
  userEvent.type(listView, '{enter}', {
190
258
  skipClick: true
191
259
  });
192
- _context.next = 9;
260
+ _context5.next = 9;
193
261
  return screen.findAllByRole('gridcell');
194
262
  case 9:
195
- updatedOption = _context.sent;
263
+ updatedOption = _context5.sent;
196
264
  expect(updatedOption[1]).toHaveClass('is-selected');
197
265
  case 11:
198
266
  case "end":
199
- return _context.stop();
267
+ return _context5.stop();
200
268
  }
201
- }, _callee);
269
+ }, _callee3);
202
270
  })));
203
- test('navigating to a disabled key will not apply the isFocused class', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
271
+ test('navigating to a disabled key will not apply the isFocused class', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
204
272
  var listView, options;
205
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
206
- while (1) switch (_context2.prev = _context2.next) {
273
+ return _regeneratorRuntime().wrap(function _callee4$(_context6) {
274
+ while (1) switch (_context6.prev = _context6.next) {
207
275
  case 0:
208
276
  getComponent({
209
277
  disabledKeys: ['Kangaroo']
@@ -218,14 +286,14 @@ test('navigating to a disabled key will not apply the isFocused class', /*#__PUR
218
286
  expect(options[1]).not.toHaveClass('is-focused');
219
287
  case 6:
220
288
  case "end":
221
- return _context2.stop();
289
+ return _context6.stop();
222
290
  }
223
- }, _callee2);
291
+ }, _callee4);
224
292
  })));
225
- test('navigating to a disabled key will not apply the isFocused class', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
293
+ test('navigating to a disabled key will not apply the isFocused class', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
226
294
  var listView, options;
227
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
228
- while (1) switch (_context3.prev = _context3.next) {
295
+ return _regeneratorRuntime().wrap(function _callee5$(_context7) {
296
+ while (1) switch (_context7.prev = _context7.next) {
229
297
  case 0:
230
298
  getComponent({
231
299
  selectionMode: 'expansion',
@@ -241,33 +309,33 @@ test('navigating to a disabled key will not apply the isFocused class', /*#__PUR
241
309
  expect(options[1]).not.toHaveClass('is-focused');
242
310
  case 6:
243
311
  case "end":
244
- return _context3.stop();
312
+ return _context7.stop();
245
313
  }
246
- }, _callee3);
314
+ }, _callee5);
247
315
  })));
248
- test('clicking an item on the list selects the item', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
316
+ test('clicking an item on the list selects the item', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
249
317
  var options, updatedOption;
250
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
251
- while (1) switch (_context4.prev = _context4.next) {
318
+ return _regeneratorRuntime().wrap(function _callee6$(_context8) {
319
+ while (1) switch (_context8.prev = _context8.next) {
252
320
  case 0:
253
321
  getComponent();
254
322
  options = screen.getByTestId(items[1].name);
255
323
  userEvent.click(options);
256
- _context4.next = 5;
324
+ _context8.next = 5;
257
325
  return screen.findAllByRole('gridcell');
258
326
  case 5:
259
- updatedOption = _context4.sent;
327
+ updatedOption = _context8.sent;
260
328
  expect(updatedOption[1]).toHaveClass('is-selected');
261
329
  case 7:
262
330
  case "end":
263
- return _context4.stop();
331
+ return _context8.stop();
264
332
  }
265
- }, _callee4);
333
+ }, _callee6);
266
334
  })));
267
- test('clicking an item fires "onSelectionChange" handler and returns Set with keys of items', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
335
+ test('clicking an item fires "onSelectionChange" handler and returns Set with keys of items', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
268
336
  var expectedResult, onSelectionChange, option1, selectedItems;
269
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
270
- while (1) switch (_context5.prev = _context5.next) {
337
+ return _regeneratorRuntime().wrap(function _callee7$(_context9) {
338
+ while (1) switch (_context9.prev = _context9.next) {
271
339
  case 0:
272
340
  expectedResult = new _Set();
273
341
  expectedResult.add(items[1].key);
@@ -282,9 +350,9 @@ test('clicking an item fires "onSelectionChange" handler and returns Set with ke
282
350
  expect(_.isEqual(expectedResult, selectedItems)).toBeTruthy();
283
351
  case 9:
284
352
  case "end":
285
- return _context5.stop();
353
+ return _context9.stop();
286
354
  }
287
- }, _callee5);
355
+ }, _callee7);
288
356
  })));
289
357
  test('renders loader, if a loader component is passed in, and state is loading', function () {
290
358
  getComponent({
@@ -293,6 +361,13 @@ test('renders loader, if a loader component is passed in, and state is loading',
293
361
  var loader = screen.getByRole('alert');
294
362
  expect(loader).toBeInTheDocument();
295
363
  });
364
+ test('renders top loader, if a loader component is passed in, and state is loading', function () {
365
+ getComponent({
366
+ loadingState: loadingStates.LOADING
367
+ });
368
+ var loader = screen.getByRole('alert');
369
+ expect(loader).toBeInTheDocument();
370
+ });
296
371
  test('renders loader, if a loader component is passed in, and state is loading', function () {
297
372
  getComponent({
298
373
  loadingState: loadingStates.LOADING
@@ -329,31 +404,31 @@ test('Item accepts a data-id and the data-id can be found in the DOM', function
329
404
  expect(options).toHaveLength(items.length);
330
405
  expect(options[0]).toHaveAttribute('data-id', items[0].name);
331
406
  });
332
- test('selectionMode "none" disallows to select item', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
407
+ test('selectionMode "none" disallows to select item', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
333
408
  var option1, updatedOption;
334
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
335
- while (1) switch (_context6.prev = _context6.next) {
409
+ return _regeneratorRuntime().wrap(function _callee8$(_context10) {
410
+ while (1) switch (_context10.prev = _context10.next) {
336
411
  case 0:
337
412
  getComponent({
338
413
  selectionMode: 'none'
339
414
  });
340
415
  option1 = screen.getByTestId(items[1].name);
341
416
  userEvent.click(option1);
342
- _context6.next = 5;
417
+ _context10.next = 5;
343
418
  return screen.findAllByRole('gridcell');
344
419
  case 5:
345
- updatedOption = _context6.sent;
420
+ updatedOption = _context10.sent;
346
421
  expect(updatedOption[1]).not.toHaveClass('is-selected');
347
422
  case 7:
348
423
  case "end":
349
- return _context6.stop();
424
+ return _context10.stop();
350
425
  }
351
- }, _callee6);
426
+ }, _callee8);
352
427
  })));
353
- test('selectionMode "multiple" allows to select more than one item', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
428
+ test('selectionMode "multiple" allows to select more than one item', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
354
429
  var option1, option2, updatedOption;
355
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
356
- while (1) switch (_context7.prev = _context7.next) {
430
+ return _regeneratorRuntime().wrap(function _callee9$(_context11) {
431
+ while (1) switch (_context11.prev = _context11.next) {
357
432
  case 0:
358
433
  getComponent({
359
434
  selectionMode: 'multiple'
@@ -362,22 +437,22 @@ test('selectionMode "multiple" allows to select more than one item', /*#__PURE__
362
437
  userEvent.click(option1);
363
438
  option2 = screen.getByTestId(items[2].name);
364
439
  userEvent.click(option2);
365
- _context7.next = 7;
440
+ _context11.next = 7;
366
441
  return screen.findAllByRole('gridcell');
367
442
  case 7:
368
- updatedOption = _context7.sent;
443
+ updatedOption = _context11.sent;
369
444
  expect(updatedOption[1]).toHaveClass('is-selected');
370
445
  expect(updatedOption[2]).toHaveClass('is-selected');
371
446
  case 10:
372
447
  case "end":
373
- return _context7.stop();
448
+ return _context11.stop();
374
449
  }
375
- }, _callee7);
450
+ }, _callee9);
376
451
  })));
377
- test('when user navigates with tab and arrows keys, onFocus is called and the is-focused class is applied', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
452
+ test('when user navigates with tab and arrows keys, onFocus is called and the is-focused class is applied', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
378
453
  var onFocus, listView, options;
379
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
380
- while (1) switch (_context8.prev = _context8.next) {
454
+ return _regeneratorRuntime().wrap(function _callee10$(_context12) {
455
+ while (1) switch (_context12.prev = _context12.next) {
381
456
  case 0:
382
457
  onFocus = jest.fn();
383
458
  getComponent({
@@ -394,9 +469,9 @@ test('when user navigates with tab and arrows keys, onFocus is called and the is
394
469
  expect(onFocus).toHaveBeenCalled();
395
470
  case 9:
396
471
  case "end":
397
- return _context8.stop();
472
+ return _context12.stop();
398
473
  }
399
- }, _callee8);
474
+ }, _callee10);
400
475
  })));
401
476
  test('list view not receive focus when click on checkbox', function () {
402
477
  getComponentWithCheckbox();
@@ -424,10 +499,10 @@ test('list view reset hover on item when scroll', function () {
424
499
  userEvent.hover(listItem[1]);
425
500
  expect(listItem[0]).not.toHaveClass('is-hovered');
426
501
  });
427
- test('list view expandable reset hover on item when scroll', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
502
+ test('list view expandable reset hover on item when scroll', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
428
503
  var listItem, listRow;
429
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
430
- while (1) switch (_context9.prev = _context9.next) {
504
+ return _regeneratorRuntime().wrap(function _callee11$(_context13) {
505
+ while (1) switch (_context13.prev = _context13.next) {
431
506
  case 0:
432
507
  getComponentExpandable({
433
508
  selectionMode: 'expansion'
@@ -441,9 +516,9 @@ test('list view expandable reset hover on item when scroll', /*#__PURE__*/_async
441
516
  expect(listItem[0]).not.toHaveClass('is-hovered');
442
517
  case 7:
443
518
  case "end":
444
- return _context9.stop();
519
+ return _context13.stop();
445
520
  }
446
- }, _callee9);
521
+ }, _callee11);
447
522
  })));
448
523
  test('list view item should not receive focus when selectionMode is "none"', function () {
449
524
  var onFocus = jest.fn();
@@ -466,10 +541,10 @@ test('list view item should receive focus when selectionMode is default or a val
466
541
  expect(onFocus).toHaveBeenCalled();
467
542
  expect(options[0]).toHaveClass('is-focused');
468
543
  });
469
- test('selectionMode "expanded" cells render expandable list items, and can be expanded, and collapsed', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
544
+ test('selectionMode "expanded" cells render expandable list items, and can be expanded, and collapsed', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
470
545
  var options, updatedOptions, updatedOptions1;
471
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
472
- while (1) switch (_context10.prev = _context10.next) {
546
+ return _regeneratorRuntime().wrap(function _callee12$(_context14) {
547
+ while (1) switch (_context14.prev = _context14.next) {
473
548
  case 0:
474
549
  getComponent({
475
550
  selectionMode: 'expansion'
@@ -477,27 +552,27 @@ test('selectionMode "expanded" cells render expandable list items, and can be ex
477
552
  options = screen.getAllByRole('gridcell');
478
553
  expect(options[0]).toHaveAttribute('aria-expanded', 'false');
479
554
  userEvent.click(options[0]);
480
- _context10.next = 6;
555
+ _context14.next = 6;
481
556
  return screen.findAllByRole('gridcell');
482
557
  case 6:
483
- updatedOptions = _context10.sent;
558
+ updatedOptions = _context14.sent;
484
559
  expect(updatedOptions[0]).toHaveAttribute('aria-expanded', 'true');
485
560
  userEvent.click(options[0]);
486
- _context10.next = 11;
561
+ _context14.next = 11;
487
562
  return screen.findAllByRole('gridcell');
488
563
  case 11:
489
- updatedOptions1 = _context10.sent;
564
+ updatedOptions1 = _context14.sent;
490
565
  expect(updatedOptions1[0]).toHaveAttribute('aria-expanded', 'false');
491
566
  case 13:
492
567
  case "end":
493
- return _context10.stop();
568
+ return _context14.stop();
494
569
  }
495
- }, _callee10);
570
+ }, _callee12);
496
571
  })));
497
- test('should navigate to expandable listitems with keyboard ', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
572
+ test('should navigate to expandable listitems with keyboard ', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
498
573
  var option, row, focusContainer, button;
499
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
500
- while (1) switch (_context11.prev = _context11.next) {
574
+ return _regeneratorRuntime().wrap(function _callee13$(_context15) {
575
+ while (1) switch (_context15.prev = _context15.next) {
501
576
  case 0:
502
577
  getComponentExpandable({
503
578
  selectionMode: 'expansion'
@@ -528,24 +603,24 @@ test('should navigate to expandable listitems with keyboard ', /*#__PURE__*/_asy
528
603
  userEvent.type(focusContainer, '{enter}', {
529
604
  skipClick: true
530
605
  });
531
- _context11.next = 15;
606
+ _context15.next = 15;
532
607
  return screen.findByRole('button');
533
608
  case 15:
534
- button = _context11.sent;
609
+ button = _context15.sent;
535
610
  expect(button).toHaveClass('is-focused');
536
611
  userEvent.type(row, '{esc}', {
537
612
  skipClick: true
538
613
  });
539
614
  case 18:
540
615
  case "end":
541
- return _context11.stop();
616
+ return _context15.stop();
542
617
  }
543
- }, _callee11);
618
+ }, _callee13);
544
619
  })));
545
- test('should navigate to expandable container ', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
620
+ test('should navigate to expandable container ', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
546
621
  var option;
547
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
548
- while (1) switch (_context12.prev = _context12.next) {
622
+ return _regeneratorRuntime().wrap(function _callee14$(_context16) {
623
+ while (1) switch (_context16.prev = _context16.next) {
549
624
  case 0:
550
625
  getComponentExpandable({
551
626
  selectionMode: 'expansion'
@@ -590,9 +665,9 @@ test('should navigate to expandable container ', /*#__PURE__*/_asyncToGenerator(
590
665
  });
591
666
  case 17:
592
667
  case "end":
593
- return _context12.stop();
668
+ return _context16.stop();
594
669
  }
595
- }, _callee12);
670
+ }, _callee14);
596
671
  })));
597
672
  test('escape focus delegate turns on if enter is pressed', function () {
598
673
  escapeFocusDelegate(_objectSpread(_objectSpread({}, testEvent), {}, {
@@ -637,4 +712,20 @@ test('escape focus delegate calls correct functions if anything else is pressed'
637
712
  }), setIsFocusEscaped, focusManager, true);
638
713
  expect(focusNext).not.toHaveBeenCalled();
639
714
  expect(focusPrevious).not.toHaveBeenCalled();
715
+ });
716
+ test('escape focus delegate calls correct functions if anything else is pressed', function () {
717
+ render(___EmotionJSX(ComponentOnPrevLoad, null));
718
+ var listView = screen.getAllByRole('grid');
719
+ fireEvent.scroll(listView[0], {
720
+ target: {
721
+ scrollY: 450
722
+ }
723
+ });
724
+ expect(onLoadMoreFunc).toHaveBeenCalled();
725
+ fireEvent.scroll(listView[0], {
726
+ target: {
727
+ scrollY: 0
728
+ }
729
+ });
730
+ expect(onLoadPrevFunc).toHaveBeenCalled();
640
731
  });
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
2
2
  import React, { forwardRef } from 'react';
3
3
  import { Radio as ThemeUIRadio } from 'theme-ui';
4
-
4
+ import { jsx as ___EmotionJSX } from "@emotion/react";
5
5
  /**
6
6
  * Basic radio input wrapped in a label.
7
7
  * Built on top of the [Radio from Theme-UI](https://theme-ui.com/components/radio/) and uses the
@@ -10,7 +10,6 @@ import { Radio as ThemeUIRadio } from 'theme-ui';
10
10
  * **Note: Requires a label. It's recommended to use `RadioGroupField` with `RadioField` for a**
11
11
  * **solution.**
12
12
  */
13
- import { jsx as ___EmotionJSX } from "@emotion/react";
14
13
  var Radio = /*#__PURE__*/forwardRef(function (props, ref) {
15
14
  return ___EmotionJSX(ThemeUIRadio, _extends({
16
15
  ref: ref
@@ -14,14 +14,16 @@ var base = {
14
14
  bg: 'transparent',
15
15
  boxSizing: 'border-box'
16
16
  },
17
- 'input ~ &.is-focused': isSafari ? {
17
+ 'input ~ &.is-focused': /* istanbul ignore next */
18
+ isSafari ? {
18
19
  boxShadow: 'none',
19
20
  border: '1px solid',
20
21
  borderColor: 'focus',
21
22
  boxSizing: 'border-box',
22
23
  transform: 'scale(1.1)',
23
24
  transformOrigin: 'center'
24
- } : focusWithCroppedOutline
25
+ }
26
+ /* istanbul ignore next */ : focusWithCroppedOutline
25
27
  };
26
28
  var outerContainer = {
27
29
  '.is-horizontal &': {
@@ -10,18 +10,16 @@ import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
10
10
  import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
11
11
  function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
12
12
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
13
- import React, { createContext, forwardRef, useContext, useImperativeHandle, useRef } from 'react';
13
+ import React, { createContext, forwardRef, useContext } from 'react';
14
14
  import { useRadio } from 'react-aria';
15
- import PropTypes from 'prop-types';
16
- import { useField, usePropWarning } from '../../hooks';
17
- import { ariaAttributesBasePropTypes } from '../../utils/docUtils/ariaAttributes';
18
- import { statusPropTypes } from '../../utils/docUtils/statusProp';
15
+ import { useField, useLocalOrForwardRef, usePropWarning } from '../../hooks';
19
16
  import Box from '../Box';
20
17
  import FieldHelperText from '../FieldHelperText';
21
18
  import Label from '../Label';
22
19
  import Radio from '../Radio';
23
20
  import { jsx as ___EmotionJSX } from "@emotion/react";
24
- export var RadioContext = /*#__PURE__*/createContext();
21
+ var defaultValue = {};
22
+ export var RadioContext = /*#__PURE__*/createContext(defaultValue);
25
23
 
26
24
  /**
27
25
  * Combines a radio, label, and helper text for a complete, form-ready solution.
@@ -37,20 +35,17 @@ var RadioField = /*#__PURE__*/forwardRef(function (props, ref) {
37
35
  radioDisabled = props.isDisabled,
38
36
  label = props.label,
39
37
  status = props.status;
40
- var radioFieldRef = useRef();
41
38
  usePropWarning(props, 'disabled', 'isDisabled');
42
- /* istanbul ignore next */
43
- useImperativeHandle(ref, function () {
44
- return radioFieldRef.current;
45
- });
39
+ var radioFieldRef = useLocalOrForwardRef(ref);
46
40
  var state = useContext(RadioContext);
47
41
  var groupDisabled = state.isDisabled;
48
42
  var isDisabled = radioDisabled || groupDisabled;
49
43
  var _useRadio = useRadio(_objectSpread(_objectSpread({
50
44
  children: label,
51
- autoFocus: hasAutoFocus,
45
+ autoFocus: hasAutoFocus
46
+ }, props), {}, {
52
47
  isDisabled: isDisabled
53
- }, props), controlProps), state, radioFieldRef),
48
+ }, controlProps), state, radioFieldRef),
54
49
  inputProps = _useRadio.inputProps;
55
50
  var isChecked = inputProps.checked;
56
51
  var statusClasses = {
@@ -82,51 +77,5 @@ var RadioField = /*#__PURE__*/forwardRef(function (props, ref) {
82
77
  variant: "forms.radio.checkedContent"
83
78
  }, checkedContent));
84
79
  });
85
- RadioField.propTypes = _objectSpread(_objectSpread({
86
- /** Content to display when the radio is checked. */
87
- checkedContent: PropTypes.node,
88
- /** The rendered label for the field. */
89
- label: PropTypes.node,
90
- /** Whether the element should receive focus on render. */
91
- hasAutoFocus: PropTypes.bool,
92
- /** Text rendered below the input. */
93
- helperText: PropTypes.node,
94
- /** If present this prop will cause a help hint to render in the label of the field. */
95
- hintText: PropTypes.string,
96
- /** The element's unique identifier. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id). */
97
- id: PropTypes.string,
98
- /**
99
- * Whether the radio button is disabled or not. Shows that a selection exists, but is not
100
- * available in that circumstance.
101
- */
102
- isDisabled: PropTypes.bool,
103
- /** Whether the Radio can be interacted with but cannot have its selection state changed. */
104
- isReadOnly: PropTypes.bool,
105
- /** Whether the Radio is required. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/required). */
106
- isRequired: PropTypes.bool,
107
- /** The value of the input element, used when submitting an HTML form. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefvalue). */
108
- value: PropTypes.string,
109
- /** Handler that is called when the element receives focus. */
110
- onFocus: PropTypes.func,
111
- /** Handler that is called when the element loses focus. */
112
- onBlur: PropTypes.func,
113
- /** Handler that is called when the element's focus status changes. */
114
- onFocusChange: PropTypes.func,
115
- /** Handler that is called when a key is pressed. */
116
- onKeyDown: PropTypes.func,
117
- /** Handler that is called when a key is released. */
118
- onKeyUp: PropTypes.func,
119
- /** Defines a string value that labels the current element. */
120
- 'aria-label': PropTypes.string,
121
- /** Identifies the element (or elements) that labels the current element. */
122
- 'aria-labelledby': PropTypes.string,
123
- /** Identifies the element (or elements) that describes the object. */
124
- 'aria-describedby': PropTypes.string,
125
- /**
126
- * Identifies the element (or elements) that provide a detailed, extended description for the
127
- * object.
128
- */
129
- 'aria-details': PropTypes.string
130
- }, statusPropTypes), ariaAttributesBasePropTypes);
131
80
  RadioField.displayName = 'RadioField';
132
81
  export default RadioField;