@pingux/astro 2.140.0-alpha.0 → 2.140.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/api/users.js +22 -0
- package/lib/cjs/api/users.d.ts +2 -0
- package/lib/cjs/api/users.js +32 -0
- package/lib/cjs/components/ComboBoxField/ComboBoxField.stories.js +117 -91
- package/lib/cjs/components/DataTable/DataTable.stories.js +114 -67
- package/lib/cjs/components/LinkSelectField/LinkSelectField.stories.js +73 -47
- package/lib/cjs/components/MultivaluesField/MultivaluesField.stories.js +141 -119
- package/lib/cjs/components/SelectField/SelectField.stories.js +78 -51
- package/lib/cjs/components/Tab/Tab.js +9 -3
- package/lib/cjs/components/TabPicker/TabPicker.js +2 -1
- package/lib/cjs/components/Tabs/Tabs.js +22 -8
- package/lib/cjs/components/Tabs/Tabs.stories.d.ts +1 -0
- package/lib/cjs/components/Tabs/Tabs.stories.js +41 -2
- package/lib/cjs/components/Tabs/Tabs.style.d.ts +55 -4
- package/lib/cjs/components/Tabs/Tabs.style.js +59 -7
- package/lib/cjs/mocks/browser.d.ts +1 -0
- package/lib/cjs/mocks/browser.js +11 -0
- package/lib/cjs/mocks/constants/index.d.ts +3 -0
- package/lib/cjs/mocks/constants/index.js +13 -0
- package/lib/cjs/mocks/handlers/users.d.ts +1 -0
- package/lib/cjs/mocks/handlers/users.js +107 -0
- package/lib/cjs/mocks/handlers.d.ts +1 -0
- package/lib/cjs/mocks/handlers.js +13 -0
- package/lib/cjs/mocks/responses/users.d.ts +14 -0
- package/lib/cjs/mocks/responses/users.js +3572 -0
- package/lib/cjs/mocks/types/users.d.ts +73 -0
- package/lib/cjs/mocks/types/users.js +6 -0
- package/lib/cjs/styles/themes/next-gen/convertedComponentList.d.ts +1 -0
- package/lib/cjs/styles/themes/next-gen/convertedComponentList.js +2 -1
- package/lib/cjs/styles/themes/next-gen/next-gen.d.ts +3 -1
- package/lib/cjs/styles/themes/next-gen/variants/tabs.d.ts +3 -1
- package/lib/cjs/styles/themes/next-gen/variants/tabs.js +3 -1
- package/lib/cjs/styles/themes/next-gen/variants/variants.d.ts +3 -1
- package/lib/cjs/types/dataTable.d.ts +5 -4
- package/lib/cjs/types/item.d.ts +1 -0
- package/lib/cjs/types/tab.d.ts +1 -0
- package/lib/cjs/types/tabs.d.ts +3 -1
- package/lib/components/ComboBoxField/ComboBoxField.stories.js +118 -91
- package/lib/components/DataTable/DataTable.stories.js +114 -67
- package/lib/components/LinkSelectField/LinkSelectField.stories.js +73 -46
- package/lib/components/MultivaluesField/MultivaluesField.stories.js +140 -119
- package/lib/components/SelectField/SelectField.stories.js +78 -50
- package/lib/components/Tab/Tab.js +9 -3
- package/lib/components/TabPicker/TabPicker.js +2 -1
- package/lib/components/Tabs/Tabs.js +23 -9
- package/lib/components/Tabs/Tabs.stories.js +38 -0
- package/lib/components/Tabs/Tabs.style.js +57 -6
- package/lib/mocks/browser.js +3 -0
- package/lib/mocks/constants/index.js +3 -0
- package/lib/mocks/handlers/users.js +97 -0
- package/lib/mocks/handlers.js +4 -0
- package/lib/mocks/responses/users.js +3564 -0
- package/lib/mocks/types/users.js +1 -0
- package/lib/styles/themes/next-gen/convertedComponentList.js +2 -1
- package/lib/styles/themes/next-gen/variants/tabs.js +3 -1
- package/package.json +7 -1
@@ -1,6 +1,5 @@
|
|
1
1
|
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
2
2
|
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
|
3
|
-
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
4
3
|
import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor";
|
5
4
|
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
6
5
|
import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
|
@@ -17,17 +16,22 @@ import _asyncToGenerator from "@babel/runtime-corejs3/helpers/esm/asyncToGenerat
|
|
17
16
|
import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
18
17
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
19
18
|
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
20
|
-
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 _context19; _forEachInstanceProperty(_context19 = ["next", "throw", "return"]).call(_context19, 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 _context20; 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(_context20 = this.tryEntries).call(_context20, 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; }
|
19
|
+
import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
|
20
|
+
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
21
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
21
22
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
22
23
|
import _fillInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/fill";
|
23
|
-
import _setTimeout from "@babel/runtime-corejs3/core-js-stable/set-timeout";
|
24
24
|
import _Promise from "@babel/runtime-corejs3/core-js-stable/promise";
|
25
|
-
import
|
25
|
+
import _setTimeout from "@babel/runtime-corejs3/core-js-stable/set-timeout";
|
26
|
+
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 _context16; _forEachInstanceProperty(_context16 = ["next", "throw", "return"]).call(_context16, 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 _context17; 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(_context17 = this.tryEntries).call(_context17, 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; }
|
26
27
|
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; }
|
27
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var
|
28
|
-
import React, { useEffect, useState } from 'react';
|
28
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context14, _context15; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context14 = ownKeys(Object(source), !0)).call(_context14, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context15 = ownKeys(Object(source))).call(_context15, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
29
|
+
import React, { useCallback, useEffect, useState } from 'react';
|
30
|
+
import { useFilter } from '@react-aria/i18n';
|
29
31
|
import DocsLayout from '../../../.storybook/storybookDocsLayout';
|
32
|
+
import { getAllUsers } from '../../api/users';
|
30
33
|
import { Box, Icon, Item, MultivaluesField, OverlayProvider, Section } from '../../index';
|
34
|
+
import { LIMIT } from '../../mocks/constants';
|
31
35
|
import loadingStates from '../../utils/devUtils/constants/loadingStates';
|
32
36
|
import { ariaAttributeBaseArgTypes } from '../../utils/docUtils/ariaAttributes';
|
33
37
|
import { inputFieldAttributeBaseArgTypes } from '../../utils/docUtils/fieldAttributes';
|
@@ -635,6 +639,8 @@ export var Condensed = function Condensed(args) {
|
|
635
639
|
, {
|
636
640
|
style: setOverlayStyle(direction, isOpen, '25%', '25%', '75%')
|
637
641
|
}, ___EmotionJSX(MultivaluesField, _extends({
|
642
|
+
defaultSelectedKeys: ['Option 5', 'Option 7'],
|
643
|
+
disabledKeys: ['Option 6'],
|
638
644
|
items: checkboxItems
|
639
645
|
}, args, {
|
640
646
|
mode: "condensed",
|
@@ -648,81 +654,92 @@ export var Condensed = function Condensed(args) {
|
|
648
654
|
}));
|
649
655
|
};
|
650
656
|
export var CondensedAsyncLoading = function CondensedAsyncLoading(args) {
|
651
|
-
var _context, _context2;
|
652
657
|
var direction = args.direction;
|
653
|
-
var
|
654
|
-
key: 'string',
|
655
|
-
name: 'string'
|
656
|
-
})).call(_context, function (_, index) {
|
657
|
-
return {
|
658
|
-
name: "name: ".concat(index),
|
659
|
-
key: "name: ".concat(index),
|
660
|
-
id: index
|
661
|
-
};
|
662
|
-
});
|
663
|
-
var _useState25 = useState(10),
|
658
|
+
var _useState25 = useState(false),
|
664
659
|
_useState26 = _slicedToArray(_useState25, 2),
|
665
|
-
|
666
|
-
|
667
|
-
var _useState27 = useState(
|
660
|
+
isOpen = _useState26[0],
|
661
|
+
setIsOpen = _useState26[1];
|
662
|
+
var _useState27 = useState([]),
|
668
663
|
_useState28 = _slicedToArray(_useState27, 2),
|
669
664
|
listItems = _useState28[0],
|
670
665
|
setListItems = _useState28[1];
|
671
|
-
var _useState29 = useState(
|
666
|
+
var _useState29 = useState(loadingStates.LOADING),
|
672
667
|
_useState30 = _slicedToArray(_useState29, 2),
|
673
|
-
|
674
|
-
|
675
|
-
var _useState31 = useState(
|
668
|
+
loadingState = _useState30[0],
|
669
|
+
setLoadingState = _useState30[1];
|
670
|
+
var _useState31 = useState(0),
|
676
671
|
_useState32 = _slicedToArray(_useState31, 2),
|
677
|
-
|
678
|
-
|
679
|
-
var
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
var _context3, _context4, _context5;
|
693
|
-
var newItems;
|
694
|
-
return _regeneratorRuntime().wrap(function _callee$(_context6) {
|
695
|
-
while (1) switch (_context6.prev = _context6.next) {
|
672
|
+
dataSize = _useState32[0],
|
673
|
+
setDataSize = _useState32[1];
|
674
|
+
var _useState33 = useState(LIMIT),
|
675
|
+
_useState34 = _slicedToArray(_useState33, 2),
|
676
|
+
limit = _useState34[0],
|
677
|
+
setLimit = _useState34[1];
|
678
|
+
var _useState35 = useState(''),
|
679
|
+
_useState36 = _slicedToArray(_useState35, 2),
|
680
|
+
filterString = _useState36[0],
|
681
|
+
setFilterString = _useState36[1];
|
682
|
+
var fetchData = useCallback( /*#__PURE__*/function () {
|
683
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(currentLimit) {
|
684
|
+
var response, json;
|
685
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
686
|
+
while (1) switch (_context.prev = _context.next) {
|
696
687
|
case 0:
|
697
|
-
|
698
|
-
|
699
|
-
return
|
700
|
-
return _setTimeout(resolve, 5000);
|
701
|
-
});
|
688
|
+
_context.prev = 0;
|
689
|
+
_context.next = 3;
|
690
|
+
return getAllUsers(currentLimit);
|
702
691
|
case 3:
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
});
|
713
|
-
setMaxNum(maxNum + 10);
|
714
|
-
setListItems(_concatInstanceProperty(_context5 = []).call(_context5, listItems, newItems));
|
692
|
+
response = _context.sent;
|
693
|
+
_context.next = 6;
|
694
|
+
return response.json();
|
695
|
+
case 6:
|
696
|
+
json = _context.sent;
|
697
|
+
if (response.ok) {
|
698
|
+
setListItems(json.body._embedded.users || []);
|
699
|
+
setDataSize(json.body.count);
|
700
|
+
}
|
715
701
|
setLoadingState(loadingStates.IDLE);
|
716
|
-
|
702
|
+
_context.next = 15;
|
703
|
+
break;
|
704
|
+
case 11:
|
705
|
+
_context.prev = 11;
|
706
|
+
_context.t0 = _context["catch"](0);
|
707
|
+
console.error('Fetch error:', _context.t0);
|
708
|
+
setLoadingState(loadingStates.ERROR);
|
709
|
+
case 15:
|
717
710
|
case "end":
|
718
|
-
return
|
711
|
+
return _context.stop();
|
719
712
|
}
|
720
|
-
}, _callee);
|
713
|
+
}, _callee, null, [[0, 11]]);
|
721
714
|
}));
|
722
|
-
return function
|
715
|
+
return function (_x) {
|
723
716
|
return _ref.apply(this, arguments);
|
724
717
|
};
|
725
|
-
}();
|
718
|
+
}(), []);
|
719
|
+
var handleLoadMore = function handleLoadMore() {
|
720
|
+
if (loadingState !== loadingStates.IDLE || limit >= dataSize) return;
|
721
|
+
setLoadingState(loadingStates.LOADING_MORE);
|
722
|
+
setLimit(function (prevLimit) {
|
723
|
+
return prevLimit + LIMIT;
|
724
|
+
});
|
725
|
+
};
|
726
|
+
useEffect(function () {
|
727
|
+
fetchData(limit);
|
728
|
+
}, [fetchData, limit]);
|
729
|
+
var onOpenChange = function onOpenChange() {
|
730
|
+
setIsOpen(true);
|
731
|
+
};
|
732
|
+
var _useFilter = useFilter({
|
733
|
+
sensitivity: 'base'
|
734
|
+
}),
|
735
|
+
contains = _useFilter.contains;
|
736
|
+
var filter = function filter(nodes) {
|
737
|
+
var nodeArr = _Array$from(nodes);
|
738
|
+
if (!filterString) return nodeArr;
|
739
|
+
return _filterInstanceProperty(nodeArr).call(nodeArr, function (item) {
|
740
|
+
return contains(item.props.name, filterString);
|
741
|
+
});
|
742
|
+
};
|
726
743
|
return ___EmotionJSX(OverlayProvider
|
727
744
|
// note: spacing for demo purpose only so that the select list renders in the right place
|
728
745
|
, {
|
@@ -733,20 +750,24 @@ export var CondensedAsyncLoading = function CondensedAsyncLoading(args) {
|
|
733
750
|
mode: "condensed",
|
734
751
|
onOpenChange: onOpenChange,
|
735
752
|
loadingState: loadingState,
|
736
|
-
onLoadMore:
|
753
|
+
onLoadMore: handleLoadMore,
|
754
|
+
filter: filter,
|
755
|
+
onInputChange: setFilterString
|
737
756
|
}), function (item) {
|
757
|
+
var _context2, _context3;
|
738
758
|
return ___EmotionJSX(Item, {
|
739
|
-
key: item.
|
740
|
-
"data-id": item.
|
741
|
-
"aria-label": item.
|
742
|
-
|
759
|
+
key: item.id,
|
760
|
+
"data-id": item.id,
|
761
|
+
"aria-label": item.username,
|
762
|
+
name: _concatInstanceProperty(_context2 = "".concat(item.name.given, " ")).call(_context2, item.name.family)
|
763
|
+
}, _concatInstanceProperty(_context3 = "".concat(item.name.given, " ")).call(_context3, item.name.family));
|
743
764
|
}));
|
744
765
|
};
|
745
766
|
export var CondensedWithSection = function CondensedWithSection(args) {
|
746
|
-
var
|
747
|
-
|
748
|
-
isOpen =
|
749
|
-
setIsOpen =
|
767
|
+
var _useState37 = useState(false),
|
768
|
+
_useState38 = _slicedToArray(_useState37, 2),
|
769
|
+
isOpen = _useState38[0],
|
770
|
+
setIsOpen = _useState38[1];
|
750
771
|
var direction = args.direction;
|
751
772
|
var onOpenChange = function onOpenChange() {
|
752
773
|
setIsOpen(true);
|
@@ -773,14 +794,14 @@ export var CondensedWithSection = function CondensedWithSection(args) {
|
|
773
794
|
}));
|
774
795
|
};
|
775
796
|
export var CondensedWithCustomText = function CondensedWithCustomText(args) {
|
776
|
-
var
|
777
|
-
|
778
|
-
isOpen =
|
779
|
-
setIsOpen =
|
780
|
-
var
|
781
|
-
|
782
|
-
selectedKeys =
|
783
|
-
setSelectedKeys =
|
797
|
+
var _useState39 = useState(false),
|
798
|
+
_useState40 = _slicedToArray(_useState39, 2),
|
799
|
+
isOpen = _useState40[0],
|
800
|
+
setIsOpen = _useState40[1];
|
801
|
+
var _useState41 = useState([]),
|
802
|
+
_useState42 = _slicedToArray(_useState41, 2),
|
803
|
+
selectedKeys = _useState42[0],
|
804
|
+
setSelectedKeys = _useState42[1];
|
784
805
|
var direction = args.direction;
|
785
806
|
var onOpenChange = function onOpenChange() {
|
786
807
|
setIsOpen(true);
|
@@ -811,57 +832,57 @@ export var CondensedWithCustomText = function CondensedWithCustomText(args) {
|
|
811
832
|
}));
|
812
833
|
};
|
813
834
|
export var OnLoadPrev = function OnLoadPrev() {
|
814
|
-
var
|
815
|
-
var initialItems = _mapInstanceProperty(
|
835
|
+
var _context4, _context5;
|
836
|
+
var initialItems = _mapInstanceProperty(_context4 = _fillInstanceProperty(_context5 = new Array(10)).call(_context5, {
|
816
837
|
key: 'string',
|
817
838
|
name: 'string'
|
818
|
-
})).call(
|
839
|
+
})).call(_context4, function (_, index) {
|
819
840
|
return {
|
820
841
|
name: "name: ".concat(index),
|
821
842
|
key: "name: ".concat(index),
|
822
843
|
id: index
|
823
844
|
};
|
824
845
|
});
|
825
|
-
var
|
826
|
-
_useState40 = _slicedToArray(_useState39, 2),
|
827
|
-
minNum = _useState40[0],
|
828
|
-
setMinNum = _useState40[1];
|
829
|
-
var _useState41 = useState(10),
|
830
|
-
_useState42 = _slicedToArray(_useState41, 2),
|
831
|
-
maxNum = _useState42[0],
|
832
|
-
setMaxNum = _useState42[1];
|
833
|
-
var _useState43 = useState(initialItems),
|
846
|
+
var _useState43 = useState(0),
|
834
847
|
_useState44 = _slicedToArray(_useState43, 2),
|
835
|
-
|
836
|
-
|
837
|
-
var _useState45 = useState(
|
848
|
+
minNum = _useState44[0],
|
849
|
+
setMinNum = _useState44[1];
|
850
|
+
var _useState45 = useState(10),
|
838
851
|
_useState46 = _slicedToArray(_useState45, 2),
|
839
|
-
|
840
|
-
|
841
|
-
var _useState47 = useState(
|
852
|
+
maxNum = _useState46[0],
|
853
|
+
setMaxNum = _useState46[1];
|
854
|
+
var _useState47 = useState(initialItems),
|
842
855
|
_useState48 = _slicedToArray(_useState47, 2),
|
843
|
-
|
844
|
-
|
856
|
+
listItems = _useState48[0],
|
857
|
+
setListItems = _useState48[1];
|
858
|
+
var _useState49 = useState(false),
|
859
|
+
_useState50 = _slicedToArray(_useState49, 2),
|
860
|
+
isOpen = _useState50[0],
|
861
|
+
setIsOpen = _useState50[1];
|
862
|
+
var _useState51 = useState(loadingStates.IDLE),
|
863
|
+
_useState52 = _slicedToArray(_useState51, 2),
|
864
|
+
loadingState = _useState52[0],
|
865
|
+
setLoadingState = _useState52[1];
|
845
866
|
var onOpenChange = function onOpenChange() {
|
846
867
|
setIsOpen(true);
|
847
868
|
};
|
848
869
|
var onLoadMore = /*#__PURE__*/function () {
|
849
870
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
850
|
-
var
|
871
|
+
var _context6, _context7, _context8;
|
851
872
|
var newItems;
|
852
|
-
return _regeneratorRuntime().wrap(function _callee2$(
|
853
|
-
while (1) switch (
|
873
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context9) {
|
874
|
+
while (1) switch (_context9.prev = _context9.next) {
|
854
875
|
case 0:
|
855
876
|
setLoadingState(loadingStates.LOADING_MORE);
|
856
|
-
|
877
|
+
_context9.next = 3;
|
857
878
|
return new _Promise(function (resolve) {
|
858
879
|
return _setTimeout(resolve, 3000);
|
859
880
|
});
|
860
881
|
case 3:
|
861
|
-
newItems = _mapInstanceProperty(
|
882
|
+
newItems = _mapInstanceProperty(_context6 = _fillInstanceProperty(_context7 = new Array(10)).call(_context7, {
|
862
883
|
key: 'string',
|
863
884
|
name: 'string'
|
864
|
-
})).call(
|
885
|
+
})).call(_context6, function (_, index) {
|
865
886
|
return {
|
866
887
|
name: "name: ".concat(maxNum + index),
|
867
888
|
key: "name: ".concat(maxNum + index),
|
@@ -869,11 +890,11 @@ export var OnLoadPrev = function OnLoadPrev() {
|
|
869
890
|
};
|
870
891
|
});
|
871
892
|
setMaxNum(maxNum + 10);
|
872
|
-
setListItems(_concatInstanceProperty(
|
893
|
+
setListItems(_concatInstanceProperty(_context8 = []).call(_context8, listItems, newItems));
|
873
894
|
setLoadingState(loadingStates.IDLE);
|
874
895
|
case 7:
|
875
896
|
case "end":
|
876
|
-
return
|
897
|
+
return _context9.stop();
|
877
898
|
}
|
878
899
|
}, _callee2);
|
879
900
|
}));
|
@@ -883,21 +904,21 @@ export var OnLoadPrev = function OnLoadPrev() {
|
|
883
904
|
}();
|
884
905
|
var onLoadPrev = /*#__PURE__*/function () {
|
885
906
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
886
|
-
var
|
907
|
+
var _context10, _context11, _context12;
|
887
908
|
var newItems;
|
888
|
-
return _regeneratorRuntime().wrap(function _callee3$(
|
889
|
-
while (1) switch (
|
909
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context13) {
|
910
|
+
while (1) switch (_context13.prev = _context13.next) {
|
890
911
|
case 0:
|
891
912
|
setLoadingState(loadingStates.LOADING_MORE_PREPEND);
|
892
|
-
|
913
|
+
_context13.next = 3;
|
893
914
|
return new _Promise(function (resolve) {
|
894
915
|
return _setTimeout(resolve, 3000);
|
895
916
|
});
|
896
917
|
case 3:
|
897
|
-
newItems = _mapInstanceProperty(
|
918
|
+
newItems = _mapInstanceProperty(_context10 = _fillInstanceProperty(_context11 = new Array(10)).call(_context11, {
|
898
919
|
key: 'string',
|
899
920
|
name: 'string'
|
900
|
-
})).call(
|
921
|
+
})).call(_context10, function (_, index) {
|
901
922
|
return {
|
902
923
|
name: "name: ".concat(minNum - (index + 1)),
|
903
924
|
key: "name: ".concat(minNum - (index + 1)),
|
@@ -905,11 +926,11 @@ export var OnLoadPrev = function OnLoadPrev() {
|
|
905
926
|
};
|
906
927
|
});
|
907
928
|
setMinNum(minNum - 10);
|
908
|
-
setListItems(_concatInstanceProperty(
|
929
|
+
setListItems(_concatInstanceProperty(_context12 = []).call(_context12, newItems, listItems));
|
909
930
|
setLoadingState(loadingStates.IDLE);
|
910
931
|
case 7:
|
911
932
|
case "end":
|
912
|
-
return
|
933
|
+
return _context13.stop();
|
913
934
|
}
|
914
935
|
}, _callee3);
|
915
936
|
}));
|
@@ -10,6 +10,7 @@ import _Symbol from "@babel/runtime-corejs3/core-js-stable/symbol";
|
|
10
10
|
import _Object$create from "@babel/runtime-corejs3/core-js-stable/object/create";
|
11
11
|
import _Object$getPrototypeOf from "@babel/runtime-corejs3/core-js-stable/object/get-prototype-of";
|
12
12
|
import _Object$setPrototypeOf from "@babel/runtime-corejs3/core-js-stable/object/set-prototype-of";
|
13
|
+
import _Promise from "@babel/runtime-corejs3/core-js-stable/promise";
|
13
14
|
import _reverseInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/reverse";
|
14
15
|
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
|
15
16
|
import _typeof from "@babel/runtime-corejs3/helpers/esm/typeof";
|
@@ -22,16 +23,15 @@ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyri
|
|
22
23
|
import _Object$values from "@babel/runtime-corejs3/core-js-stable/object/values";
|
23
24
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
24
25
|
import _fillInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/fill";
|
25
|
-
import _Promise from "@babel/runtime-corejs3/core-js-stable/promise";
|
26
|
-
import _setTimeout from "@babel/runtime-corejs3/core-js-stable/set-timeout";
|
27
26
|
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; }
|
28
27
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context4, _context5; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context4 = ownKeys(Object(source), !0)).call(_context4, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context5 = ownKeys(Object(source))).call(_context5, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
29
|
-
import React, { useState } from 'react';
|
28
|
+
import React, { useCallback, useEffect, useState } from 'react';
|
30
29
|
import { OverlayProvider } from 'react-aria';
|
31
|
-
import { useAsyncList } from 'react-stately';
|
32
30
|
import CalendarRangeIcon from '@pingux/mdi-react/CalendarRangeIcon';
|
33
31
|
import DocsLayout from '../../../.storybook/storybookDocsLayout';
|
32
|
+
import { getAllUsers } from '../../api/users';
|
34
33
|
import { Icon, Item, Section, SelectField } from '../../index';
|
34
|
+
import { LIMIT } from '../../mocks/constants';
|
35
35
|
import { modes as labelModes } from '../../utils/devUtils/constants/labelModes';
|
36
36
|
import { ariaAttributeBaseArgTypes } from '../../utils/docUtils/ariaAttributes';
|
37
37
|
import { inputFieldAttributeBaseArgTypes } from '../../utils/docUtils/fieldAttributes';
|
@@ -379,51 +379,79 @@ DynamicItems.parameters = {
|
|
379
379
|
}
|
380
380
|
};
|
381
381
|
export var AsyncLoading = function AsyncLoading() {
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
382
|
+
var _useState5 = useState([]),
|
383
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
384
|
+
data = _useState6[0],
|
385
|
+
setData = _useState6[1];
|
386
|
+
var _useState7 = useState(LIMIT),
|
387
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
388
|
+
limit = _useState8[0],
|
389
|
+
setLimit = _useState8[1];
|
390
|
+
var _useState9 = useState(0),
|
391
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
392
|
+
dataSize = _useState10[0],
|
393
|
+
setDataSize = _useState10[1];
|
394
|
+
var _useState11 = useState(true),
|
395
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
396
|
+
loading = _useState12[0],
|
397
|
+
setLoading = _useState12[1];
|
398
|
+
var fetchData = useCallback( /*#__PURE__*/function () {
|
399
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(currentLimit) {
|
400
|
+
var response, json;
|
401
|
+
return _regeneratorRuntime().wrap(function _callee$(_context3) {
|
402
|
+
while (1) switch (_context3.prev = _context3.next) {
|
403
|
+
case 0:
|
404
|
+
_context3.prev = 0;
|
405
|
+
_context3.next = 3;
|
406
|
+
return getAllUsers(currentLimit);
|
407
|
+
case 3:
|
408
|
+
response = _context3.sent;
|
409
|
+
_context3.next = 6;
|
410
|
+
return response.json();
|
411
|
+
case 6:
|
412
|
+
json = _context3.sent;
|
413
|
+
if (response.ok) {
|
414
|
+
setData(json.body._embedded.users || []);
|
415
|
+
setDataSize(json.body.count);
|
416
|
+
}
|
417
|
+
setLoading(false);
|
418
|
+
_context3.next = 15;
|
419
|
+
break;
|
420
|
+
case 11:
|
421
|
+
_context3.prev = 11;
|
422
|
+
_context3.t0 = _context3["catch"](0);
|
423
|
+
console.error('Fetch error:', _context3.t0);
|
424
|
+
setLoading(false);
|
425
|
+
case 15:
|
426
|
+
case "end":
|
427
|
+
return _context3.stop();
|
428
|
+
}
|
429
|
+
}, _callee, null, [[0, 11]]);
|
430
|
+
}));
|
431
|
+
return function (_x) {
|
432
|
+
return _ref.apply(this, arguments);
|
433
|
+
};
|
434
|
+
}(), []);
|
435
|
+
var handleLoadMore = function handleLoadMore() {
|
436
|
+
if (limit >= dataSize) return;
|
437
|
+
setLoading(true);
|
438
|
+
setLimit(function (prevLimit) {
|
439
|
+
return prevLimit + LIMIT;
|
440
|
+
});
|
441
|
+
};
|
442
|
+
useEffect(function () {
|
443
|
+
fetchData(limit);
|
444
|
+
}, [fetchData, limit]);
|
418
445
|
return ___EmotionJSX(OverlayProvider, null, ___EmotionJSX(SelectField, {
|
419
|
-
label: "Pick a
|
420
|
-
items:
|
421
|
-
isLoading:
|
422
|
-
onLoadMore:
|
446
|
+
label: "Pick a User",
|
447
|
+
items: data,
|
448
|
+
isLoading: loading,
|
449
|
+
onLoadMore: handleLoadMore
|
423
450
|
}, function (item) {
|
451
|
+
var user = item;
|
424
452
|
return ___EmotionJSX(Item, {
|
425
|
-
key:
|
426
|
-
},
|
453
|
+
key: user.id
|
454
|
+
}, user.name.given);
|
427
455
|
}));
|
428
456
|
};
|
429
457
|
export var WithoutStatusIndicator = function WithoutStatusIndicator(args) {
|
@@ -454,10 +482,10 @@ export var WithHelpHint = function WithHelpHint(args) {
|
|
454
482
|
}, "Yellow")));
|
455
483
|
};
|
456
484
|
export var WithClearButton = function WithClearButton(args) {
|
457
|
-
var
|
458
|
-
|
459
|
-
selectedKey =
|
460
|
-
setSelectedKey =
|
485
|
+
var _useState13 = useState('red'),
|
486
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
487
|
+
selectedKey = _useState14[0],
|
488
|
+
setSelectedKey = _useState14[1];
|
461
489
|
return ___EmotionJSX(OverlayProvider, null, ___EmotionJSX(SelectField, _extends({}, args, {
|
462
490
|
width: "100%",
|
463
491
|
label: "What's your favorite color?",
|