@onepercentio/one-ui 0.20.4 → 0.20.5
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/.babelrc +6 -0
- package/.prod.babelrc +8 -2
- package/dist/components/AdaptiveButton/AdaptiveButton.js +2 -2
- package/dist/components/AdaptiveContainer/AdaptiveContainer.js +26 -26
- package/dist/components/AdaptiveDialog/AdaptiveDialog.js +9 -9
- package/dist/components/AdaptiveSidebar/AdaptiveSidebar.js +14 -14
- package/dist/components/AnchoredTooltip/AnchoredTooltip.js +30 -30
- package/dist/components/AnimatedEntrance/AnimatedEntrance.js +27 -40
- package/dist/components/AsyncWrapper/AsyncWrapper.js +2 -2
- package/dist/components/Avatar/Avatar.js +4 -4
- package/dist/components/BucketFill/BucketFill.js +9 -9
- package/dist/components/Button/Button.js +4 -4
- package/dist/components/Card/Card.js +1 -1
- package/dist/components/Chart/Chart.view.js +34 -34
- package/dist/components/CheckBox/CheckBox.js +3 -3
- package/dist/components/Collapsable/Collapsable.js +18 -18
- package/dist/components/Countdown/Countdown.js +16 -16
- package/dist/components/Divider/Divider.js +1 -1
- package/dist/components/EmailInput/EmailInput.js +4 -4
- package/dist/components/FadeIn/FadeIn.js +9 -9
- package/dist/components/FileInput/FileInput.js +6 -6
- package/dist/components/FileInput/View/BigFactory/BigFactory.js +1 -1
- package/dist/components/FileInput/View/Compact/Compact.js +6 -6
- package/dist/components/FlowController/FlowController.js +4 -4
- package/dist/components/Form/Form.js +17 -28
- package/dist/components/Freeze/Freeze.js +1 -1
- package/dist/components/HSForms/HSForms.js +9 -11
- package/dist/components/Header/Header.js +7 -7
- package/dist/components/HeaderCloseBtn/HeaderCloseBtn.js +1 -1
- package/dist/components/InfinityScroll/InfinityScroll.js +25 -25
- package/dist/components/Input/Input.js +13 -13
- package/dist/components/InstantCounter/InstantCounter.js +9 -9
- package/dist/components/LavaLamp/LavaLamp.data.js +25 -25
- package/dist/components/LavaLamp/LavaLamp.js +7 -7
- package/dist/components/LavaLamp/v2/LavaLamp.js +29 -45
- package/dist/components/LinkToId/LinkToId.js +7 -7
- package/dist/components/Loader/Loader.js +2 -2
- package/dist/components/LoaderDotsIndicator/LoaderDotsIndicator.js +6 -6
- package/dist/components/LoopableVideo/LoopableVideo.js +4 -4
- package/dist/components/MainGrid/MainGrid.js +2 -2
- package/dist/components/MutableHamburgerButton/MutableHamburgerButton.js +2 -2
- package/dist/components/Notification/Notification.js +1 -1
- package/dist/components/OrderableList/OrderableList.js +113 -138
- package/dist/components/PaginationIndicator/PaginationIndicator.js +50 -50
- package/dist/components/Parallax/Parallax.js +39 -39
- package/dist/components/Parallax/math/helpers.js +18 -19
- package/dist/components/PasswordInput/PasswordInput.js +10 -10
- package/dist/components/PingPongText/PingPongText.js +15 -15
- package/dist/components/PixelatedScan/PixelatedScan.js +19 -19
- package/dist/components/Portal/Portal.js +10 -10
- package/dist/components/ProgressBar/ProgressBar.js +6 -6
- package/dist/components/ProgressTexts/ProgressTexts.js +3 -3
- package/dist/components/Radio/Radio.js +3 -3
- package/dist/components/SectionContainer/SectionContainer.js +1 -1
- package/dist/components/Select/Select.js +13 -13
- package/dist/components/Skeleton/Skeleton.js +1 -1
- package/dist/components/Spacing/Spacing.js +1 -1
- package/dist/components/StaticScroller/StaticScroller.js +12 -12
- package/dist/components/Switch/Switch.js +2 -2
- package/dist/components/Table/Table.js +11 -11
- package/dist/components/Tabs/Tabs.js +3 -3
- package/dist/components/Text/Text.js +5 -5
- package/dist/components/Transition/MasksFactory/DiagonalReveal.js +5 -5
- package/dist/components/Transition/MasksFactory/DiagonalSquareToBalls.js +17 -17
- package/dist/components/Transition/MasksFactory/PhysicsSquares.js +13 -13
- package/dist/components/Transition/MasksFactory/SquareToBalls.js +9 -9
- package/dist/components/Transition/MasksFactory/utils.js +8 -8
- package/dist/components/Transition/Transition.js +49 -49
- package/dist/components/UncontrolledTransition/UncontrolledTransition.js +7 -7
- package/dist/components/WalletConnectionWrapper/WalletConnectionWrapper.js +44 -82
- package/dist/components/utilitary/ScrollAndFocusLock/ScrollAndFocusLock.js +6 -6
- package/dist/context/AsyncProcess.js +19 -42
- package/dist/context/CustomBrowserRouter.js +6 -6
- package/dist/context/OneUIProvider.js +15 -15
- package/dist/hooks/logs/useDependencyChangeDetection.js +2 -5
- package/dist/hooks/persistence/useLocalStorage.js +7 -7
- package/dist/hooks/shims/ObjectWatchShim.js +1 -15
- package/dist/hooks/ui/useAdaptiveImage.js +6 -6
- package/dist/hooks/ui/useBreakpoint.js +5 -5
- package/dist/hooks/ui/useCustomScrollbar.js +2 -2
- package/dist/hooks/ui/useMouseHover.js +4 -4
- package/dist/hooks/ui/usePaginationControls.js +34 -34
- package/dist/hooks/ui/useSnapToViewport.js +3 -3
- package/dist/hooks/ui/useTilt.js +38 -38
- package/dist/hooks/ui/useZoomable.js +20 -20
- package/dist/hooks/useAsyncControl.js +21 -38
- package/dist/hooks/useContainedRepositioning.js +22 -22
- package/dist/hooks/useCustomHistory.js +2 -2
- package/dist/hooks/useElementFit.js +6 -6
- package/dist/hooks/useFirestoreWatch.js +26 -39
- package/dist/hooks/useForm.js +8 -8
- package/dist/hooks/useFreeze.js +1 -1
- package/dist/hooks/useHero.js +82 -90
- package/dist/hooks/useIntersection.js +3 -3
- package/dist/hooks/useMergeRefs.js +3 -7
- package/dist/hooks/useObserve.js +5 -5
- package/dist/hooks/usePagination.js +39 -59
- package/dist/hooks/usePooledOperation.js +8 -22
- package/dist/hooks/usePooling.js +17 -33
- package/dist/hooks/useRebound.js +5 -5
- package/dist/hooks/useShortIntl.js +13 -13
- package/dist/hooks/utility/useEvents.js +5 -5
- package/dist/hooks/utility/useModule.js +3 -3
- package/dist/hooks/utility/useQuery.js +1 -1
- package/dist/models/DebugLogger.js +2 -2
- package/dist/models/GenericContract.js +1 -1
- package/dist/storybookUtils/index.js +1 -1
- package/dist/utility.d.js +3 -3
- package/dist/utils/blockchain.js +29 -102
- package/dist/utils/flatten.js +3 -3
- package/dist/utils/html.utils.js +1 -1
- package/package.json +1 -1
|
@@ -17,7 +17,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
17
17
|
* Shows the file submission input in a more compact form
|
|
18
18
|
**/
|
|
19
19
|
function Compact(_ref) {
|
|
20
|
-
|
|
20
|
+
let states = _ref.states,
|
|
21
21
|
file = _ref.file,
|
|
22
22
|
footer = _ref.footer,
|
|
23
23
|
inputEl = _ref.inputEl,
|
|
@@ -25,15 +25,15 @@ function Compact(_ref) {
|
|
|
25
25
|
progress = _ref.progress,
|
|
26
26
|
className = _ref.className,
|
|
27
27
|
disabled = _ref.disabled;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
const state = states[file ? "fileProvided" : "waitingFile"];
|
|
29
|
+
const statusClass = progress !== undefined && progress < 100 ? "loading" : file ? "completed" : "waiting";
|
|
30
|
+
const progressDashArray = (0, _react.useMemo)(function () {
|
|
31
31
|
if (progress !== undefined) {
|
|
32
|
-
|
|
32
|
+
const strokePercent = progress * 300 / 100;
|
|
33
33
|
return "".concat(strokePercent, "% ").concat(300 - strokePercent, "%");
|
|
34
34
|
}
|
|
35
35
|
}, [progress]);
|
|
36
|
-
|
|
36
|
+
const polylines = (0, _react.useMemo)(function () {
|
|
37
37
|
switch (statusClass) {
|
|
38
38
|
case "completed":
|
|
39
39
|
return ["rotate(45, 23, 23.5)", "14 23.9, 23 23.9, 32 23.9", "23 14.8 23 33"];
|
|
@@ -15,7 +15,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
15
15
|
* Container for a flow, managing the go back and close controller
|
|
16
16
|
**/
|
|
17
17
|
function FlowController(_ref) {
|
|
18
|
-
|
|
18
|
+
let children = _ref.children,
|
|
19
19
|
buttons = _ref.buttons,
|
|
20
20
|
step = _ref.step,
|
|
21
21
|
onClose = _ref.onClose,
|
|
@@ -29,8 +29,8 @@ function FlowController(_ref) {
|
|
|
29
29
|
function _handleBackPress() {
|
|
30
30
|
if (isAtFirstStep) onClose && onClose();else if (onBack) onBack();
|
|
31
31
|
}
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
const isAtFirstStep = step === firstStep;
|
|
33
|
+
const shouldDisplayHeaderButton = isAtFirstStep && onClose || !isAtFirstStep && onBack;
|
|
34
34
|
return /*#__PURE__*/_react.default.createElement(Wrapper, {
|
|
35
35
|
onClick: function onClick(e) {
|
|
36
36
|
return e.stopPropagation();
|
|
@@ -57,7 +57,7 @@ function FlowController(_ref) {
|
|
|
57
57
|
})));
|
|
58
58
|
}
|
|
59
59
|
function HeadingImage(_ref2) {
|
|
60
|
-
|
|
60
|
+
let src = _ref2.src;
|
|
61
61
|
return /*#__PURE__*/_react.default.createElement("img", {
|
|
62
62
|
src: src,
|
|
63
63
|
className: _FlowControllerModule.default.headingImg
|
|
@@ -14,7 +14,6 @@ var _AdaptiveButton = _interopRequireDefault(require("../AdaptiveButton"));
|
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
15
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
16
16
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
|
-
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) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; 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" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, 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 keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
18
17
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
19
18
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
20
19
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -30,22 +29,22 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
|
|
|
30
29
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
31
30
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
32
31
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
33
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
34
|
-
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0)
|
|
32
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
33
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
35
34
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
36
35
|
function AdvancedAction(_ref) {
|
|
37
|
-
|
|
36
|
+
let config = _ref.config,
|
|
38
37
|
submited = _ref.submited,
|
|
39
38
|
submitting = _ref.submitting,
|
|
40
39
|
isValid = _ref.isValid,
|
|
41
40
|
onClick = _ref.onClick,
|
|
42
41
|
btnProps = _ref.btnProps;
|
|
43
|
-
|
|
42
|
+
const _ref2 = submited === false ? ["error"].concat(_toConsumableArray(config.error)) : submited === true ? ["success"].concat(_toConsumableArray(config.success)) : submitting ? ["loading"].concat(_toConsumableArray(config.loading)) : ["default"].concat(_toConsumableArray(config.label)),
|
|
44
43
|
_ref3 = _slicedToArray(_ref2, 3),
|
|
45
44
|
key = _ref3[0],
|
|
46
45
|
Element = _ref3[1],
|
|
47
46
|
className = _ref3[2];
|
|
48
|
-
|
|
47
|
+
const salt = (0, _react.useMemo)(function () {
|
|
49
48
|
return Date.now();
|
|
50
49
|
}, [key]);
|
|
51
50
|
return /*#__PURE__*/_react.default.createElement(_AdaptiveButton.default, _extends({
|
|
@@ -58,18 +57,18 @@ function AdvancedAction(_ref) {
|
|
|
58
57
|
}));
|
|
59
58
|
}
|
|
60
59
|
function FirebaseForm(_ref4, ref) {
|
|
61
|
-
|
|
60
|
+
let submitting = _ref4.submitting,
|
|
62
61
|
onSubmit = _ref4.onSubmit,
|
|
63
62
|
submited = _ref4.submited,
|
|
64
63
|
config = _ref4.config,
|
|
65
64
|
submitBtn = _ref4.submitBtn,
|
|
66
65
|
_ref4$btnProps = _ref4.btnProps,
|
|
67
66
|
btnProps = _ref4$btnProps === void 0 ? {} : _ref4$btnProps;
|
|
68
|
-
|
|
67
|
+
const _useState = (0, _react.useState)({}),
|
|
69
68
|
_useState2 = _slicedToArray(_useState, 2),
|
|
70
69
|
form = _useState2[0],
|
|
71
70
|
setform = _useState2[1];
|
|
72
|
-
|
|
71
|
+
const isValid = (0, _react.useMemo)(function () {
|
|
73
72
|
return !Object.keys(config).some(function (a) {
|
|
74
73
|
return typeof config[a].validator(form[a], form) === "string";
|
|
75
74
|
});
|
|
@@ -78,19 +77,9 @@ function FirebaseForm(_ref4, ref) {
|
|
|
78
77
|
return _sendContact.apply(this, arguments);
|
|
79
78
|
}
|
|
80
79
|
function _sendContact() {
|
|
81
|
-
_sendContact = _asyncToGenerator(
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
switch (_context.prev = _context.next) {
|
|
85
|
-
case 0:
|
|
86
|
-
onSubmit(_form);
|
|
87
|
-
case 1:
|
|
88
|
-
case "end":
|
|
89
|
-
return _context.stop();
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}, _callee);
|
|
93
|
-
}));
|
|
80
|
+
_sendContact = _asyncToGenerator(function* (_form) {
|
|
81
|
+
onSubmit(_form);
|
|
82
|
+
});
|
|
94
83
|
return _sendContact.apply(this, arguments);
|
|
95
84
|
}
|
|
96
85
|
(0, _react.useImperativeHandle)(ref, function () {
|
|
@@ -101,14 +90,14 @@ function FirebaseForm(_ref4, ref) {
|
|
|
101
90
|
};
|
|
102
91
|
}, [ref]);
|
|
103
92
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, Object.keys(config).map(function (c) {
|
|
104
|
-
|
|
105
|
-
|
|
93
|
+
const fieldConfig = config[c];
|
|
94
|
+
const invalidMessage = fieldConfig.validator(form[c], form);
|
|
106
95
|
switch (fieldConfig.type) {
|
|
107
96
|
case "select":
|
|
108
97
|
return null;
|
|
109
98
|
case "text":
|
|
110
99
|
case "number":
|
|
111
|
-
|
|
100
|
+
const isNumber = fieldConfig.type === "number";
|
|
112
101
|
return /*#__PURE__*/_react.default.createElement(_Input.default, _extends({}, fieldConfig.inputProps, {
|
|
113
102
|
key: c,
|
|
114
103
|
name: c,
|
|
@@ -117,8 +106,8 @@ function FirebaseForm(_ref4, ref) {
|
|
|
117
106
|
value: !isNumber ? form[c] || "" : undefined,
|
|
118
107
|
hideError: "onfocus",
|
|
119
108
|
onChange: function onChange(_ref5) {
|
|
120
|
-
|
|
121
|
-
|
|
109
|
+
let value = _ref5.target.value;
|
|
110
|
+
let _value = isNumber ? Number(value) : value;
|
|
122
111
|
if (isNumber && Number.isNaN(_value)) {
|
|
123
112
|
_value = undefined;
|
|
124
113
|
}
|
|
@@ -147,7 +136,7 @@ function FirebaseForm(_ref4, ref) {
|
|
|
147
136
|
placeholder: config[c].placeholder,
|
|
148
137
|
value: form[c] || "",
|
|
149
138
|
onChange: function onChange(_ref6) {
|
|
150
|
-
|
|
139
|
+
let value = _ref6.target.value;
|
|
151
140
|
return setform(_objectSpread(_objectSpread({}, form), {}, _defineProperty({}, c, value)));
|
|
152
141
|
},
|
|
153
142
|
multiline: fieldConfig.lines
|
|
@@ -10,6 +10,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
10
10
|
* Use this component when you would like to freeze some child when this child can assume undefined in the next 'frame'
|
|
11
11
|
**/
|
|
12
12
|
function Freeze(_ref) {
|
|
13
|
-
|
|
13
|
+
let children = _ref.children;
|
|
14
14
|
return (0, _useFreeze.default)(children);
|
|
15
15
|
}
|
|
@@ -1,29 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.default = HSForms;
|
|
7
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
9
9
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
10
10
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
11
11
|
function HSForms(_ref) {
|
|
12
|
-
|
|
12
|
+
let region = _ref.region,
|
|
13
13
|
partialId = _ref.partialId,
|
|
14
14
|
formId = _ref.formId,
|
|
15
15
|
className = _ref.className,
|
|
16
16
|
onFormReady = _ref.onFormReady,
|
|
17
17
|
onFormSubmitted = _ref.onFormSubmitted;
|
|
18
18
|
if (window.PRERENDER) return null;
|
|
19
|
-
|
|
19
|
+
const container = (0, _react.useRef)(null);
|
|
20
20
|
(0, _react.useEffect)(function () {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
var idx = "onLoad".concat(funcId);
|
|
26
|
-
var idx2 = "onSubmit".concat(funcId);
|
|
21
|
+
import("jquery").then(function (jqueryModule) {
|
|
22
|
+
const funcId = String(Math.round(Math.random() * 999999));
|
|
23
|
+
const idx = "onLoad".concat(funcId);
|
|
24
|
+
const idx2 = "onSubmit".concat(funcId);
|
|
27
25
|
window[idx] = function (form) {
|
|
28
26
|
if (onFormReady) onFormReady(container.current, form);
|
|
29
27
|
};
|
|
@@ -31,12 +29,12 @@ function HSForms(_ref) {
|
|
|
31
29
|
if (onFormSubmitted) onFormSubmitted();
|
|
32
30
|
};
|
|
33
31
|
window.jQuery = jqueryModule.default;
|
|
34
|
-
|
|
32
|
+
const script = document.createElement("script");
|
|
35
33
|
script.setAttribute("src", "https://js.hsforms.net/forms/v2.js");
|
|
36
34
|
script.setAttribute("type", "text/javascript");
|
|
37
35
|
script.setAttribute("charset", "utf-8");
|
|
38
36
|
script.onload = function () {
|
|
39
|
-
|
|
37
|
+
const createFormScript = document.createElement("script");
|
|
40
38
|
createFormScript.setAttribute("type", "text/javascript");
|
|
41
39
|
createFormScript.innerHTML = "hbspt.forms.create({\n region: \"".concat(region, "\",\n portalId: \"").concat(partialId, "\",\n formId: \"").concat(formId, "\",\n submitButtonClass: '#',\n css: ' ',\n cssClass: '#',\n onFormReady: ").concat(idx, ",\n onFormSubmit: ").concat(idx2, ",\n formInstanceId: ").concat(funcId, "\n });");
|
|
42
40
|
container.current.appendChild(createFormScript);
|
|
@@ -18,20 +18,20 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
18
18
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
19
19
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
20
20
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
21
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
22
|
-
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0)
|
|
21
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
22
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
23
23
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
24
24
|
/**
|
|
25
25
|
* A generic header implementation
|
|
26
26
|
**/
|
|
27
27
|
function Header(props) {
|
|
28
|
-
|
|
28
|
+
const user = props.user,
|
|
29
29
|
moreOptions = props.moreOptions;
|
|
30
|
-
|
|
30
|
+
const _useState = (0, _react.useState)(false),
|
|
31
31
|
_useState2 = _slicedToArray(_useState, 2),
|
|
32
32
|
showMoreOptions = _useState2[0],
|
|
33
33
|
setShowMoreOptions = _useState2[1];
|
|
34
|
-
|
|
34
|
+
const _useOneUIContext$comp = (0, _OneUIProvider.useOneUIContext)().component.header,
|
|
35
35
|
_useOneUIContext$comp2 = _useOneUIContext$comp.LogoImage,
|
|
36
36
|
LogoImage = _useOneUIContext$comp2 === void 0 ? function () {
|
|
37
37
|
return null;
|
|
@@ -42,7 +42,7 @@ function Header(props) {
|
|
|
42
42
|
} : _useOneUIContext$comp3;
|
|
43
43
|
(0, _react.useEffect)(function () {
|
|
44
44
|
if (showMoreOptions) {
|
|
45
|
-
|
|
45
|
+
const close = function close() {
|
|
46
46
|
return setShowMoreOptions(false);
|
|
47
47
|
};
|
|
48
48
|
window.addEventListener("click", close);
|
|
@@ -89,7 +89,7 @@ function Header(props) {
|
|
|
89
89
|
}) : null));
|
|
90
90
|
}
|
|
91
91
|
function Controls(_ref) {
|
|
92
|
-
|
|
92
|
+
let options = _ref.options,
|
|
93
93
|
children = _ref.children,
|
|
94
94
|
mode = _ref.mode;
|
|
95
95
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, options.map(function (option, i) {
|
|
@@ -11,7 +11,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
11
11
|
* A simple close button implemented with pure HTML and CSS
|
|
12
12
|
**/
|
|
13
13
|
function HeaderButton(_ref) {
|
|
14
|
-
|
|
14
|
+
let mode = _ref.mode,
|
|
15
15
|
hidden = _ref.hidden,
|
|
16
16
|
onClick = _ref.onClick;
|
|
17
17
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -14,7 +14,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
14
14
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
15
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
16
16
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
17
|
-
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0)
|
|
17
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
18
18
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
19
19
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
20
20
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
@@ -27,7 +27,7 @@ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread n
|
|
|
27
27
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
28
28
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
29
29
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
30
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
30
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
31
31
|
function shouldIncrementPage(howMuchTheParentScrolled, prevSectionPosition, nextSectionPosition) {
|
|
32
32
|
if (howMuchTheParentScrolled === nextSectionPosition) return 1;else if (howMuchTheParentScrolled === prevSectionPosition) return -1;else return 0;
|
|
33
33
|
}
|
|
@@ -38,12 +38,12 @@ function keys(currPage) {
|
|
|
38
38
|
}
|
|
39
39
|
function getItemsFactory(pageSize, items, isCountTheSameOrLowerThanPage) {
|
|
40
40
|
return function getItems(page, offset) {
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
let _pageSize = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : pageSize;
|
|
42
|
+
let from = page * _pageSize + offset;
|
|
43
43
|
if (from < 0) from = items.length + from;
|
|
44
44
|
if (from > items.length) from = from - items.length;
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
const to = from + _pageSize;
|
|
46
|
+
const slicedItems = items.slice(from, to);
|
|
47
47
|
if (slicedItems.length < _pageSize && !isCountTheSameOrLowerThanPage) {
|
|
48
48
|
slicedItems.push.apply(slicedItems, _toConsumableArray(getItems(0, 0, _pageSize - slicedItems.length)));
|
|
49
49
|
}
|
|
@@ -59,39 +59,39 @@ function getItemsFactory(pageSize, items, isCountTheSameOrLowerThanPage) {
|
|
|
59
59
|
* Manages a set of divs that allows the effect of inifinite scrolling between pages
|
|
60
60
|
**/
|
|
61
61
|
function InfinityScroll(_ref, ref) {
|
|
62
|
-
|
|
62
|
+
let items = _ref.items,
|
|
63
63
|
pageSize = _ref.pageSize,
|
|
64
64
|
_ref$initialPage = _ref.initialPage,
|
|
65
65
|
initialPage = _ref$initialPage === void 0 ? 0 : _ref$initialPage,
|
|
66
66
|
pageClass = _ref.pageClass,
|
|
67
67
|
_ref$className = _ref.className,
|
|
68
68
|
className = _ref$className === void 0 ? "" : _ref$className;
|
|
69
|
-
|
|
69
|
+
const _useState = (0, _react.useState)({
|
|
70
70
|
page: initialPage,
|
|
71
71
|
offset: 0
|
|
72
72
|
}),
|
|
73
73
|
_useState2 = _slicedToArray(_useState, 2),
|
|
74
74
|
currPage = _useState2[0],
|
|
75
75
|
setCurrPage = _useState2[1];
|
|
76
|
-
|
|
76
|
+
const parentDiv = (0, _react.useMemo)(function () {
|
|
77
77
|
return ref || /*#__PURE__*/(0, _react.createRef)();
|
|
78
78
|
}, [ref]);
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
79
|
+
const prevDiv = (0, _react.useRef)(null);
|
|
80
|
+
const currDiv = (0, _react.useRef)(null);
|
|
81
|
+
const nextDiv = (0, _react.useRef)(null);
|
|
82
|
+
const isCountTheSameOrLowerThanPage = items.length <= pageSize;
|
|
83
|
+
const getItems = (0, _react.useMemo)(function () {
|
|
84
84
|
return getItemsFactory(pageSize, items, isCountTheSameOrLowerThanPage);
|
|
85
85
|
}, [pageSize, items, isCountTheSameOrLowerThanPage]);
|
|
86
86
|
(0, _react.useLayoutEffect)(function () {
|
|
87
87
|
if (isCountTheSameOrLowerThanPage || window.PRERENDER) return;
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
const viewportWidth = parentDiv.current.clientWidth;
|
|
89
|
+
const centerScroll = parentDiv.current.scrollWidth / 2;
|
|
90
90
|
parentDiv.current.scrollTo({
|
|
91
91
|
left: centerScroll - viewportWidth / 2
|
|
92
92
|
});
|
|
93
93
|
}, [isCountTheSameOrLowerThanPage, currPage.page, currPage.offset, items]);
|
|
94
|
-
|
|
94
|
+
const _keys = keys(currPage.page),
|
|
95
95
|
_keys2 = _slicedToArray(_keys, 3),
|
|
96
96
|
beforeKey = _keys2[0],
|
|
97
97
|
currKey = _keys2[1],
|
|
@@ -100,20 +100,20 @@ function InfinityScroll(_ref, ref) {
|
|
|
100
100
|
ref: parentDiv,
|
|
101
101
|
className: "".concat(_InfinityScrollModule.default.container, " ").concat(className),
|
|
102
102
|
onScroll: !isCountTheSameOrLowerThanPage ? function () {
|
|
103
|
-
|
|
103
|
+
const pageToIncrement = shouldIncrementPage(Math.round(parentDiv.current.scrollLeft), prevDiv.current.offsetLeft, nextDiv.current.offsetLeft);
|
|
104
104
|
if (pageToIncrement) {
|
|
105
105
|
setCurrPage(function (prev) {
|
|
106
|
-
|
|
107
|
-
|
|
106
|
+
let nextPage = prev.page + pageToIncrement;
|
|
107
|
+
let offset = prev.offset;
|
|
108
108
|
if (nextPage < 0) {
|
|
109
109
|
nextPage = Math.round(items.length / pageSize) - 1;
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
110
|
+
const finalIndex = (nextPage + 1) * pageSize + offset;
|
|
111
|
+
const maxIndex = items.length;
|
|
112
|
+
const remainingItems = maxIndex + offset - finalIndex;
|
|
113
113
|
offset += remainingItems;
|
|
114
114
|
if (offset === -(items.length - 1)) offset = 1;
|
|
115
115
|
}
|
|
116
|
-
|
|
116
|
+
let nextIndex = nextPage * pageSize + offset;
|
|
117
117
|
if (nextIndex > items.length) {
|
|
118
118
|
offset = nextIndex - items.length;
|
|
119
119
|
nextPage = 0;
|
|
@@ -141,7 +141,7 @@ function InfinityScroll(_ref, ref) {
|
|
|
141
141
|
}
|
|
142
142
|
var _default = /*#__PURE__*/(0, _react.forwardRef)(InfinityScroll);
|
|
143
143
|
exports.default = _default;
|
|
144
|
-
|
|
144
|
+
let InfinityDataTestId = /*#__PURE__*/function (InfinityDataTestId) {
|
|
145
145
|
InfinityDataTestId["PREV_PAGE"] = "infinity-prev";
|
|
146
146
|
InfinityDataTestId["CURR_PAGE"] = "infinity-curr";
|
|
147
147
|
InfinityDataTestId["NEXT_PAGE"] = "infinity-next";
|
|
@@ -9,7 +9,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
9
9
|
var _OneUIProvider = require("../../context/OneUIProvider");
|
|
10
10
|
var _Text = _interopRequireDefault(require("../Text"));
|
|
11
11
|
var _InputModule = _interopRequireDefault(require("./Input.module.scss"));
|
|
12
|
-
|
|
12
|
+
const _excluded = ["error", "placeholder", "hideError", "icon", "Icon", "autoFocus", "disclaimer", "multiline", "decoration", "border", "containerProps", "className"];
|
|
13
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
14
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
15
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -17,8 +17,8 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
17
17
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
18
18
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
19
19
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
20
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
21
|
-
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0)
|
|
20
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
21
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
22
22
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
23
23
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
24
24
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
@@ -26,7 +26,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
26
26
|
* A transparent input with some prebuilt states common to the application
|
|
27
27
|
**/
|
|
28
28
|
function Input(_ref, ref) {
|
|
29
|
-
|
|
29
|
+
let error = _ref.error,
|
|
30
30
|
_ref$placeholder = _ref.placeholder,
|
|
31
31
|
placeholder = _ref$placeholder === void 0 ? " " : _ref$placeholder,
|
|
32
32
|
hideError = _ref.hideError,
|
|
@@ -41,23 +41,23 @@ function Input(_ref, ref) {
|
|
|
41
41
|
containerProps = _ref.containerProps,
|
|
42
42
|
localClassName = _ref.className,
|
|
43
43
|
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
const className = (0, _OneUIProvider.useOneUIConfig)("component.input.className");
|
|
45
|
+
const globalBorder = (0, _OneUIProvider.useOneUIConfig)("component.input.border");
|
|
46
|
+
const _useState = (0, _react.useState)(false),
|
|
47
47
|
_useState2 = _slicedToArray(_useState, 2),
|
|
48
48
|
focused = _useState2[0],
|
|
49
49
|
setFocused = _useState2[1];
|
|
50
|
-
|
|
50
|
+
const inputRef = (0, _react.useRef)(null);
|
|
51
51
|
(0, _react.useImperativeHandle)(ref, function () {
|
|
52
52
|
return inputRef.current;
|
|
53
53
|
}, []);
|
|
54
|
-
|
|
54
|
+
const shouldShowError = (0, _react.useMemo)(function () {
|
|
55
55
|
if (hideError === "onfocus") return !focused;
|
|
56
56
|
return !!error;
|
|
57
57
|
}, [focused, error, hideError]);
|
|
58
58
|
(0, _react.useEffect)(function () {
|
|
59
59
|
if (autoFocus) {
|
|
60
|
-
|
|
60
|
+
const t = setTimeout(function () {
|
|
61
61
|
inputRef.current.focus();
|
|
62
62
|
}, 500);
|
|
63
63
|
return function () {
|
|
@@ -65,8 +65,8 @@ function Input(_ref, ref) {
|
|
|
65
65
|
};
|
|
66
66
|
}
|
|
67
67
|
}, [autoFocus]);
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
const Component = multiline ? "textarea" : "input";
|
|
69
|
+
const withBorder = (0, _react.useMemo)(function () {
|
|
70
70
|
if (propBorder !== undefined) return propBorder;
|
|
71
71
|
return globalBorder;
|
|
72
72
|
}, [propBorder, globalBorder]);
|
|
@@ -101,7 +101,7 @@ function Input(_ref, ref) {
|
|
|
101
101
|
className: _InputModule.default.icon
|
|
102
102
|
}, icon)));
|
|
103
103
|
}
|
|
104
|
-
|
|
104
|
+
let InputTestIds = /*#__PURE__*/function (InputTestIds) {
|
|
105
105
|
InputTestIds["DISCLAIMER"] = "disclaimer";
|
|
106
106
|
InputTestIds["ERROR"] = "error";
|
|
107
107
|
return InputTestIds;
|
|
@@ -12,14 +12,14 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
12
12
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
13
13
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
14
14
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
15
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
16
|
-
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0)
|
|
15
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
16
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
17
17
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
18
18
|
/**
|
|
19
19
|
* Increments the numbers from 0 to X
|
|
20
20
|
**/
|
|
21
21
|
function InstantCounter(_ref, ref) {
|
|
22
|
-
|
|
22
|
+
let _ref$from = _ref.from,
|
|
23
23
|
from = _ref$from === void 0 ? 0 : _ref$from,
|
|
24
24
|
to = _ref.to,
|
|
25
25
|
_ref$framesPerSecond = _ref.framesPerSecond,
|
|
@@ -29,13 +29,13 @@ function InstantCounter(_ref, ref) {
|
|
|
29
29
|
formatOptions = _ref$formatOptions === void 0 ? {} : _ref$formatOptions,
|
|
30
30
|
_ref$autoStart = _ref.autoStart,
|
|
31
31
|
autoStart = _ref$autoStart === void 0 ? true : _ref$autoStart;
|
|
32
|
-
|
|
32
|
+
const _useState = (0, _react.useState)(autoStart),
|
|
33
33
|
_useState2 = _slicedToArray(_useState, 2),
|
|
34
34
|
started = _useState2[0],
|
|
35
35
|
setStarted = _useState2[1];
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
const initialValue = (0, _react.useRef)(from);
|
|
37
|
+
const spanRef = (0, _react.useRef)(null);
|
|
38
|
+
const _useIntl = (0, _reactIntl.useIntl)(),
|
|
39
39
|
formatNumber = _useIntl.formatNumber;
|
|
40
40
|
(0, _react.useImperativeHandle)(ref, function () {
|
|
41
41
|
return {
|
|
@@ -46,9 +46,9 @@ function InstantCounter(_ref, ref) {
|
|
|
46
46
|
}, []);
|
|
47
47
|
(0, _react.useEffect)(function () {
|
|
48
48
|
if (started) {
|
|
49
|
-
|
|
49
|
+
const incrementBy = (to - initialValue.current) / (framesPerSecond * durationInSeconds);
|
|
50
50
|
spanRef.current.innerHTML = formatNumber(initialValue.current, formatOptions);
|
|
51
|
-
|
|
51
|
+
const intervalId = setInterval(function () {
|
|
52
52
|
initialValue.current += incrementBy;
|
|
53
53
|
spanRef.current.innerHTML = formatNumber(initialValue.current, formatOptions);
|
|
54
54
|
if (Math.round(initialValue.current) === Math.round(to)) {
|