@codacy/ui-components 0.64.15 → 0.64.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (224) hide show
  1. package/lib/Avatar/Avatar.js +25 -19
  2. package/lib/Avatar/Avatar.types.js +5 -1
  3. package/lib/Avatar/gravatar.js +17 -13
  4. package/lib/Avatar/index.js +16 -1
  5. package/lib/Banner/Banner.js +45 -32
  6. package/lib/Banner/Banner.styles.d.ts +11 -12
  7. package/lib/Banner/Banner.styles.js +26 -15
  8. package/lib/Banner/Banner.types.js +5 -1
  9. package/lib/Banner/index.js +27 -2
  10. package/lib/Button/Button.js +54 -51
  11. package/lib/Button/index.js +27 -2
  12. package/lib/Button/styles.d.ts +16 -12
  13. package/lib/Button/styles.js +58 -44
  14. package/lib/Button/types.js +5 -1
  15. package/lib/Checkbox/Checkbox.js +63 -54
  16. package/lib/Checkbox/CheckboxFilterList.js +46 -32
  17. package/lib/Checkbox/index.js +38 -3
  18. package/lib/Checkbox/styles.d.ts +25 -22
  19. package/lib/Checkbox/styles.js +52 -37
  20. package/lib/Checkbox/types.js +5 -1
  21. package/lib/CloseButton/index.js +27 -16
  22. package/lib/Divider/Divider.js +23 -13
  23. package/lib/Divider/Divider.styles.d.ts +16 -19
  24. package/lib/Divider/Divider.styles.js +24 -11
  25. package/lib/Divider/Divider.types.js +5 -1
  26. package/lib/Divider/index.js +16 -1
  27. package/lib/Dropdown/Content/DropdownInput.js +20 -8
  28. package/lib/Dropdown/Content/DropdownItem.js +29 -21
  29. package/lib/Dropdown/Content/DropdownSeparator.js +19 -7
  30. package/lib/Dropdown/Content/index.js +38 -3
  31. package/lib/Dropdown/Dropdown.js +89 -85
  32. package/lib/Dropdown/Dropdown.styles.d.ts +37 -34
  33. package/lib/Dropdown/Dropdown.styles.js +62 -43
  34. package/lib/Dropdown/Dropdown.types.js +5 -1
  35. package/lib/Dropdown/Triggers/DropdownButtonTrigger.js +30 -20
  36. package/lib/Dropdown/Triggers/DropdownLinkTrigger.js +29 -19
  37. package/lib/Dropdown/Triggers/InputTrigger.js +18 -10
  38. package/lib/Dropdown/Triggers/SelectTrigger.js +19 -12
  39. package/lib/Dropdown/Triggers/hooks.js +18 -14
  40. package/lib/Dropdown/Triggers/index.js +60 -5
  41. package/lib/Dropdown/Triggers/types.js +5 -1
  42. package/lib/Dropdown/index.js +49 -4
  43. package/lib/Flexbox/Flexbox.d.ts +31 -17
  44. package/lib/Flexbox/Flexbox.js +36 -16
  45. package/lib/Flexbox/index.js +16 -1
  46. package/lib/Group/Group.js +17 -8
  47. package/lib/Group/Group.styles.d.ts +8 -10
  48. package/lib/Group/Group.styles.js +17 -7
  49. package/lib/Group/Group.types.js +5 -1
  50. package/lib/Group/index.js +16 -1
  51. package/lib/Icon/Icon.js +24 -14
  52. package/lib/Icon/Icon.styles.d.ts +9 -11
  53. package/lib/Icon/Icon.styles.js +39 -44
  54. package/lib/Icon/Icon.types.js +5 -1
  55. package/lib/Icon/index.js +16 -1
  56. package/lib/IconAndText/IconAndText.js +33 -21
  57. package/lib/IconAndText/IconAndText.styles.d.ts +8 -10
  58. package/lib/IconAndText/IconAndText.styles.js +20 -10
  59. package/lib/IconAndText/IconAndText.types.js +5 -1
  60. package/lib/IconAndText/index.js +16 -1
  61. package/lib/Icons/Chevrons.js +53 -41
  62. package/lib/Icons/CodacyIcon.js +17 -8
  63. package/lib/Icons/Messages.js +54 -35
  64. package/lib/Icons/Search.js +16 -7
  65. package/lib/Icons/Severities.js +117 -106
  66. package/lib/Icons/Sorting.js +23 -13
  67. package/lib/Icons/Spinner.js +19 -10
  68. package/lib/Icons/Symbols.js +73 -58
  69. package/lib/Icons/index.js +93 -8
  70. package/lib/Img/Img.js +44 -37
  71. package/lib/Img/Img.styles.d.ts +12 -11
  72. package/lib/Img/Img.styles.js +37 -32
  73. package/lib/Img/Img.types.js +5 -1
  74. package/lib/Img/index.js +16 -1
  75. package/lib/InlineMessage/InlineMessage.js +47 -34
  76. package/lib/InlineMessage/index.js +16 -1
  77. package/lib/InlineMessage/types.js +5 -1
  78. package/lib/Input/Input.js +148 -126
  79. package/lib/Input/hooks.js +149 -178
  80. package/lib/Input/index.js +27 -2
  81. package/lib/Input/styles.d.ts +55 -104
  82. package/lib/Input/styles.js +85 -54
  83. package/lib/Input/types.js +5 -1
  84. package/lib/Labeled/Labeled.js +34 -22
  85. package/lib/Labeled/index.js +16 -1
  86. package/lib/Labeled/styles.d.ts +16 -12
  87. package/lib/Labeled/styles.js +27 -11
  88. package/lib/Labeled/types.js +5 -1
  89. package/lib/LeftMenu/LeftMenu.js +20 -11
  90. package/lib/LeftMenu/LeftMenu.styles.d.ts +8 -10
  91. package/lib/LeftMenu/LeftMenu.styles.js +20 -10
  92. package/lib/LeftMenu/LeftMenu.types.js +5 -1
  93. package/lib/LeftMenu/index.js +16 -1
  94. package/lib/Link/Link.js +43 -33
  95. package/lib/Link/Link.styles.d.ts +4 -1
  96. package/lib/Link/Link.styles.js +21 -11
  97. package/lib/Link/Link.types.js +5 -1
  98. package/lib/Link/index.js +38 -3
  99. package/lib/Message/Message.js +32 -24
  100. package/lib/Message/Message.styles.d.ts +8 -10
  101. package/lib/Message/Message.styles.js +17 -7
  102. package/lib/Message/Message.types.js +5 -1
  103. package/lib/Message/index.js +16 -1
  104. package/lib/Modal/ConfirmationModal.js +65 -39
  105. package/lib/Modal/Modal.js +120 -107
  106. package/lib/Modal/index.js +27 -2
  107. package/lib/Modal/styles.d.ts +44 -61
  108. package/lib/Modal/styles.js +97 -85
  109. package/lib/Modal/types.d.ts +1 -0
  110. package/lib/Modal/types.js +5 -1
  111. package/lib/MoreInfo/MoreInfo.js +45 -39
  112. package/lib/MoreInfo/index.js +16 -1
  113. package/lib/MoreInfo/types.js +5 -1
  114. package/lib/Panel/Panel.js +18 -9
  115. package/lib/Panel/Panel.styles.d.ts +8 -11
  116. package/lib/Panel/Panel.styles.js +15 -5
  117. package/lib/Panel/Panel.types.js +5 -1
  118. package/lib/Panel/index.js +27 -2
  119. package/lib/PillLabel/PillLabel.js +28 -21
  120. package/lib/PillLabel/PillLabel.styles.d.ts +8 -10
  121. package/lib/PillLabel/PillLabel.styles.js +25 -16
  122. package/lib/PillLabel/PillLabel.types.js +5 -1
  123. package/lib/PillLabel/index.js +16 -1
  124. package/lib/Popup/Popup.js +55 -45
  125. package/lib/Popup/index.js +16 -1
  126. package/lib/Popup/styles.d.ts +12 -11
  127. package/lib/Popup/styles.js +21 -8
  128. package/lib/Popup/types.js +5 -1
  129. package/lib/ProgressBar/ProgressBar.js +30 -20
  130. package/lib/ProgressBar/index.js +27 -2
  131. package/lib/ProgressBar/styles.d.ts +24 -28
  132. package/lib/ProgressBar/styles.js +30 -14
  133. package/lib/ProgressBar/types.js +5 -1
  134. package/lib/Radio/Radio.js +53 -48
  135. package/lib/Radio/index.js +16 -1
  136. package/lib/Radio/styles.d.ts +25 -22
  137. package/lib/Radio/styles.js +49 -30
  138. package/lib/Radio/types.js +5 -1
  139. package/lib/ScrollableContent/ScrollableContent.js +35 -24
  140. package/lib/ScrollableContent/ScrollableContent.styles.d.ts +9 -11
  141. package/lib/ScrollableContent/ScrollableContent.styles.js +23 -13
  142. package/lib/ScrollableContent/ScrollableContent.types.js +5 -1
  143. package/lib/ScrollableContent/index.js +27 -2
  144. package/lib/ScrollableContent/useScrollContainer.js +29 -24
  145. package/lib/Select/Select.js +31 -20
  146. package/lib/Select/index.js +16 -1
  147. package/lib/Select/types.js +5 -1
  148. package/lib/Skeleton/Skeleton.js +30 -25
  149. package/lib/Skeleton/Skeleton.styles.d.ts +8 -10
  150. package/lib/Skeleton/Skeleton.styles.js +21 -14
  151. package/lib/Skeleton/Skeleton.types.js +5 -1
  152. package/lib/Skeleton/index.js +20 -2
  153. package/lib/Stepper/Stepper.js +49 -40
  154. package/lib/Stepper/Stepper.styles.d.ts +24 -29
  155. package/lib/Stepper/Stepper.styles.js +35 -19
  156. package/lib/Stepper/Stepper.types.js +5 -1
  157. package/lib/Stepper/index.js +16 -1
  158. package/lib/Switcher/Switcher.js +32 -23
  159. package/lib/Switcher/Switcher.styles.d.ts +13 -13
  160. package/lib/Switcher/Switcher.styles.js +27 -15
  161. package/lib/Switcher/Switcher.types.js +5 -1
  162. package/lib/Switcher/index.js +16 -1
  163. package/lib/Tab/Tab.js +31 -23
  164. package/lib/Tab/Tab.styles.d.ts +13 -12
  165. package/lib/Tab/Tab.styles.js +30 -21
  166. package/lib/Tab/Tab.types.js +5 -1
  167. package/lib/Tab/index.js +16 -1
  168. package/lib/Table/NewSelectableTable.js +77 -56
  169. package/lib/Table/SelectableTable.js +138 -118
  170. package/lib/Table/Table.js +126 -111
  171. package/lib/Table/Table.styles.d.ts +32 -16
  172. package/lib/Table/Table.styles.js +79 -59
  173. package/lib/Table/Table.types.js +5 -1
  174. package/lib/Table/index.js +27 -2
  175. package/lib/TagsInput/TagsInput.js +44 -33
  176. package/lib/TagsInput/index.js +16 -1
  177. package/lib/TagsInput/style.d.ts +16 -19
  178. package/lib/TagsInput/style.js +22 -9
  179. package/lib/TagsInput/types.js +5 -1
  180. package/lib/Textarea/Textarea.js +75 -58
  181. package/lib/Textarea/Textarea.styles.d.ts +28 -22
  182. package/lib/Textarea/Textarea.styles.js +55 -32
  183. package/lib/Textarea/Textarea.types.js +5 -1
  184. package/lib/Textarea/index.js +16 -1
  185. package/lib/ThemeProvider/ThemeProvider.d.ts +5 -2
  186. package/lib/ThemeProvider/ThemeProvider.js +48 -30
  187. package/lib/ThemeProvider/index.js +16 -1
  188. package/lib/Toast/Toast.js +56 -53
  189. package/lib/Toast/index.js +16 -1
  190. package/lib/Toast/styles.d.ts +4 -2
  191. package/lib/Toast/styles.js +13 -3
  192. package/lib/Toast/types.js +5 -1
  193. package/lib/Toggle/Toggle.js +59 -50
  194. package/lib/Toggle/index.js +16 -1
  195. package/lib/Toggle/styles.d.ts +21 -14
  196. package/lib/Toggle/styles.js +51 -34
  197. package/lib/Toggle/types.js +5 -1
  198. package/lib/Tooltip/Tooltip.js +100 -102
  199. package/lib/Tooltip/index.js +16 -1
  200. package/lib/Tooltip/styles.d.ts +14 -8
  201. package/lib/Tooltip/styles.js +33 -25
  202. package/lib/Tooltip/types.js +5 -1
  203. package/lib/Typography/Typography.js +96 -85
  204. package/lib/Typography/Typography.styles.d.ts +48 -54
  205. package/lib/Typography/Typography.styles.js +70 -45
  206. package/lib/Typography/Typography.types.js +5 -1
  207. package/lib/Typography/index.js +38 -3
  208. package/lib/emotion.d.js +3 -0
  209. package/lib/hooks/index.js +38 -3
  210. package/lib/hooks/useForwardedRef.js +11 -6
  211. package/lib/hooks/useInfiniteScroll.js +24 -20
  212. package/lib/hooks/useStatefulRef.js +18 -14
  213. package/lib/index.js +489 -44
  214. package/lib/system-props/color.js +8 -2
  215. package/lib/system-props/index.js +27 -2
  216. package/lib/system-props/types.js +5 -1
  217. package/lib/theme/ColorSchemes/codacy.js +11 -4
  218. package/lib/theme/ColorSchemes/pulse.js +17 -9
  219. package/lib/theme/index.js +38 -3
  220. package/lib/theme/theme.js +42 -69
  221. package/lib/types.js +5 -1
  222. package/lib/utils/hash.js +8 -6
  223. package/lib/utils/reactNodeToText.js +13 -14
  224. package/package.json +32 -32
@@ -1,17 +1,30 @@
1
- import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
2
- import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
4
-
5
- function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
6
-
7
- import { useState, useCallback, useEffect, useRef } from 'react';
8
- export function useInput(initialValue) {
9
- var _useState = useState(initialValue),
10
- _useState2 = _slicedToArray(_useState, 2),
11
- value = _useState2[0],
12
- setValue = _useState2[1];
13
-
14
- var onChange = useCallback(function (e) {
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.useAsyncValidatedInput = void 0;
8
+ exports.useDebounce = useDebounce;
9
+ exports.useEmailInput = void 0;
10
+ exports.useInput = useInput;
11
+ exports.useNumberInput = useNumberInput;
12
+ exports.useRegexInput = void 0;
13
+ exports.useRequiredInput = useRequiredInput;
14
+ exports.useTagsInput = useTagsInput;
15
+ exports.useTextarea = useTextarea;
16
+ exports.useValidatedInput = exports.useUrlInput = void 0;
17
+ var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/regeneratorRuntime"));
18
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/asyncToGenerator"));
19
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
20
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
21
+ var _react = require("react");
22
+ function useInput(initialValue) {
23
+ var _useState = (0, _react.useState)(initialValue),
24
+ _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
25
+ value = _useState2[0],
26
+ setValue = _useState2[1];
27
+ var onChange = (0, _react.useCallback)(function (e) {
15
28
  return setValue(e.currentTarget.value);
16
29
  }, []);
17
30
  return {
@@ -24,13 +37,12 @@ export function useInput(initialValue) {
24
37
  }
25
38
  };
26
39
  }
27
- export function useNumberInput(initialValue, min, max) {
28
- var _useState3 = useState(initialValue),
29
- _useState4 = _slicedToArray(_useState3, 2),
30
- value = _useState4[0],
31
- setValue = _useState4[1];
32
-
33
- var onChange = useCallback(function (e) {
40
+ function useNumberInput(initialValue, min, max) {
41
+ var _useState3 = (0, _react.useState)(initialValue),
42
+ _useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
43
+ value = _useState4[0],
44
+ setValue = _useState4[1];
45
+ var onChange = (0, _react.useCallback)(function (e) {
34
46
  setValue(e.currentTarget.value === '' ? null : Number(e.currentTarget.value));
35
47
  }, []);
36
48
  var hasValue = value !== null && value !== undefined;
@@ -50,19 +62,16 @@ export function useNumberInput(initialValue, min, max) {
50
62
  hasError: hasError
51
63
  };
52
64
  }
53
- export function useRequiredInput(initialValue, requiredMessage) {
65
+ function useRequiredInput(initialValue, requiredMessage) {
54
66
  var inputProps = useInput(initialValue);
55
-
56
- var _useState5 = useState(null),
57
- _useState6 = _slicedToArray(_useState5, 2),
58
- valid = _useState6[0],
59
- setValid = _useState6[1];
60
-
67
+ var _useState5 = (0, _react.useState)(null),
68
+ _useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
69
+ valid = _useState6[0],
70
+ setValid = _useState6[1];
61
71
  function handleBlur() {
62
72
  setValid(!!inputProps.value && inputProps.value.trim() !== '');
63
73
  }
64
-
65
- return _objectSpread(_objectSpread({}, inputProps), {}, {
74
+ return (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, inputProps), {}, {
66
75
  onBlur: handleBlur,
67
76
  onClear: function onClear() {
68
77
  inputProps.setValue('');
@@ -73,45 +82,40 @@ export function useRequiredInput(initialValue, requiredMessage) {
73
82
  errorMessage: !valid ? requiredMessage || 'Please, enter a value' : undefined
74
83
  });
75
84
  }
76
- export function useTextarea(initialValue) {
77
- var _useState7 = useState(initialValue),
78
- _useState8 = _slicedToArray(_useState7, 2),
79
- value = _useState8[0],
80
- setValue = _useState8[1];
81
-
85
+ function useTextarea(initialValue) {
86
+ var _useState7 = (0, _react.useState)(initialValue),
87
+ _useState8 = (0, _slicedToArray2["default"])(_useState7, 2),
88
+ value = _useState8[0],
89
+ setValue = _useState8[1];
82
90
  function handleChange(e) {
83
91
  setValue(e.currentTarget.value);
84
92
  }
85
-
86
93
  return {
87
94
  value: value,
88
95
  setValue: setValue,
89
96
  onChange: handleChange
90
97
  };
91
98
  }
92
- export function useTagsInput(initialValue) {
93
- var _useState9 = useState(initialValue),
94
- _useState10 = _slicedToArray(_useState9, 2),
95
- tags = _useState10[0],
96
- setTags = _useState10[1];
97
-
99
+ function useTagsInput(initialValue) {
100
+ var _useState9 = (0, _react.useState)(initialValue),
101
+ _useState10 = (0, _slicedToArray2["default"])(_useState9, 2),
102
+ tags = _useState10[0],
103
+ setTags = _useState10[1];
98
104
  function handleChange(value) {
99
105
  setTags(value);
100
106
  }
101
-
102
107
  return {
103
108
  tags: tags,
104
109
  setTags: setTags,
105
110
  onChange: handleChange
106
111
  };
107
112
  }
108
- export function useDebounce(value, delay) {
109
- var _useState11 = useState(value),
110
- _useState12 = _slicedToArray(_useState11, 2),
111
- debouncedValue = _useState12[0],
112
- setDebouncedValue = _useState12[1];
113
-
114
- useEffect(function () {
113
+ function useDebounce(value, delay) {
114
+ var _useState11 = (0, _react.useState)(value),
115
+ _useState12 = (0, _slicedToArray2["default"])(_useState11, 2),
116
+ debouncedValue = _useState12[0],
117
+ setDebouncedValue = _useState12[1];
118
+ (0, _react.useEffect)(function () {
115
119
  var handler = setTimeout(function () {
116
120
  setDebouncedValue(value);
117
121
  }, delay);
@@ -121,35 +125,28 @@ export function useDebounce(value, delay) {
121
125
  }, [value, delay]);
122
126
  return debouncedValue;
123
127
  }
124
-
125
128
  function generateInputValidator(validations, inputType, hideSuccess) {
126
129
  return function (initialValue, isRequired) {
127
- var didMountRef = useRef(false);
128
-
129
- var _useState13 = useState(initialValue),
130
- _useState14 = _slicedToArray(_useState13, 2),
131
- value = _useState14[0],
132
- setValue = _useState14[1];
133
-
134
- var _useState15 = useState(null),
135
- _useState16 = _slicedToArray(_useState15, 2),
136
- valid = _useState16[0],
137
- setValid = _useState16[1];
138
-
139
- var _useState17 = useState(),
140
- _useState18 = _slicedToArray(_useState17, 2),
141
- errorMessage = _useState18[0],
142
- setErrorMessage = _useState18[1];
143
-
130
+ var didMountRef = (0, _react.useRef)(false);
131
+ var _useState13 = (0, _react.useState)(initialValue),
132
+ _useState14 = (0, _slicedToArray2["default"])(_useState13, 2),
133
+ value = _useState14[0],
134
+ setValue = _useState14[1];
135
+ var _useState15 = (0, _react.useState)(null),
136
+ _useState16 = (0, _slicedToArray2["default"])(_useState15, 2),
137
+ valid = _useState16[0],
138
+ setValid = _useState16[1];
139
+ var _useState17 = (0, _react.useState)(),
140
+ _useState18 = (0, _slicedToArray2["default"])(_useState17, 2),
141
+ errorMessage = _useState18[0],
142
+ setErrorMessage = _useState18[1];
144
143
  var debouncedValue = useDebounce(value, 500);
145
- var handleChange = useCallback(function (e) {
144
+ var handleChange = (0, _react.useCallback)(function (e) {
146
145
  setValue(e.currentTarget.value || '');
147
146
  }, []);
148
-
149
147
  var doValidation = function doValidation() {
150
148
  if (didMountRef.current) {
151
149
  var val = debouncedValue || '';
152
-
153
150
  if (!val) {
154
151
  setValid(isRequired ? false : null);
155
152
  } else {
@@ -164,8 +161,7 @@ function generateInputValidator(validations, inputType, hideSuccess) {
164
161
  didMountRef.current = true;
165
162
  }
166
163
  };
167
-
168
- useEffect(doValidation, [debouncedValue]);
164
+ (0, _react.useEffect)(doValidation, [debouncedValue]);
169
165
  return {
170
166
  value: value,
171
167
  setValue: setValue,
@@ -185,121 +181,98 @@ function generateInputValidator(validations, inputType, hideSuccess) {
185
181
  };
186
182
  };
187
183
  }
188
-
189
184
  function generateAsyncInputValidator(validations, inputType, hideSuccess) {
190
185
  return function (initialValue, isRequired) {
191
- var didMountRef = useRef(false);
192
-
193
- var _useState19 = useState(initialValue),
194
- _useState20 = _slicedToArray(_useState19, 2),
195
- value = _useState20[0],
196
- setValue = _useState20[1];
197
-
198
- var _useState21 = useState(null),
199
- _useState22 = _slicedToArray(_useState21, 2),
200
- valid = _useState22[0],
201
- setValid = _useState22[1];
202
-
203
- var _useState23 = useState(),
204
- _useState24 = _slicedToArray(_useState23, 2),
205
- isLoading = _useState24[0],
206
- setIsLoading = _useState24[1];
207
-
208
- var _useState25 = useState(),
209
- _useState26 = _slicedToArray(_useState25, 2),
210
- errorMessage = _useState26[0],
211
- setErrorMessage = _useState26[1];
212
-
186
+ var didMountRef = (0, _react.useRef)(false);
187
+ var _useState19 = (0, _react.useState)(initialValue),
188
+ _useState20 = (0, _slicedToArray2["default"])(_useState19, 2),
189
+ value = _useState20[0],
190
+ setValue = _useState20[1];
191
+ var _useState21 = (0, _react.useState)(null),
192
+ _useState22 = (0, _slicedToArray2["default"])(_useState21, 2),
193
+ valid = _useState22[0],
194
+ setValid = _useState22[1];
195
+ var _useState23 = (0, _react.useState)(),
196
+ _useState24 = (0, _slicedToArray2["default"])(_useState23, 2),
197
+ isLoading = _useState24[0],
198
+ setIsLoading = _useState24[1];
199
+ var _useState25 = (0, _react.useState)(),
200
+ _useState26 = (0, _slicedToArray2["default"])(_useState25, 2),
201
+ errorMessage = _useState26[0],
202
+ setErrorMessage = _useState26[1];
213
203
  var debouncedValue = useDebounce(value, 500);
214
-
215
204
  var doValidation = /*#__PURE__*/function () {
216
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
205
+ var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee() {
217
206
  var val, _validationFailed, index, validationFailed, isValid;
218
-
219
- return _regeneratorRuntime().wrap(function _callee$(_context) {
220
- while (1) {
221
- switch (_context.prev = _context.next) {
222
- case 0:
223
- if (!didMountRef.current) {
224
- _context.next = 28;
225
- break;
226
- }
227
-
228
- val = debouncedValue || '';
229
-
230
- if (val) {
231
- _context.next = 7;
232
- break;
233
- }
234
-
235
- setValid(isRequired ? false : null);
236
- setIsLoading(false);
237
- _context.next = 26;
207
+ return (0, _regeneratorRuntime2["default"])().wrap(function _callee$(_context) {
208
+ while (1) switch (_context.prev = _context.next) {
209
+ case 0:
210
+ if (!didMountRef.current) {
211
+ _context.next = 28;
238
212
  break;
239
-
240
- case 7:
241
- setIsLoading(true);
242
- _context.prev = 8;
243
- index = 0;
244
-
245
- case 10:
246
- _context.next = 12;
247
- return validations[index].callback(val);
248
-
249
- case 12:
250
- isValid = _context.sent;
251
- if (isValid) index++;else validationFailed = validations[index];
252
-
253
- case 14:
254
- if (index < validations.length && !validationFailed) {
255
- _context.next = 10;
256
- break;
257
- }
258
-
259
- case 15:
260
- setValid(!validationFailed);
261
- setErrorMessage((_validationFailed = validationFailed) === null || _validationFailed === void 0 ? void 0 : _validationFailed.errorMessage);
262
- _context.next = 23;
213
+ }
214
+ val = debouncedValue || '';
215
+ if (val) {
216
+ _context.next = 7;
263
217
  break;
264
-
265
- case 19:
266
- _context.prev = 19;
267
- _context.t0 = _context["catch"](8);
268
- setValid(false);
269
- setErrorMessage(_context.t0.message);
270
-
271
- case 23:
272
- _context.prev = 23;
273
- setIsLoading(false);
274
- return _context.finish(23);
275
-
276
- case 26:
277
- _context.next = 29;
218
+ }
219
+ setValid(isRequired ? false : null);
220
+ setIsLoading(false);
221
+ _context.next = 26;
222
+ break;
223
+ case 7:
224
+ setIsLoading(true);
225
+ _context.prev = 8;
226
+ index = 0;
227
+ case 10:
228
+ _context.next = 12;
229
+ return validations[index].callback(val);
230
+ case 12:
231
+ isValid = _context.sent;
232
+ if (isValid) index++;else validationFailed = validations[index];
233
+ case 14:
234
+ if (index < validations.length && !validationFailed) {
235
+ _context.next = 10;
278
236
  break;
279
-
280
- case 28:
281
- didMountRef.current = true;
282
-
283
- case 29:
284
- case "end":
285
- return _context.stop();
286
- }
237
+ }
238
+ case 15:
239
+ setValid(!validationFailed);
240
+ setErrorMessage((_validationFailed = validationFailed) === null || _validationFailed === void 0 ? void 0 : _validationFailed.errorMessage);
241
+ _context.next = 23;
242
+ break;
243
+ case 19:
244
+ _context.prev = 19;
245
+ _context.t0 = _context["catch"](8);
246
+ setValid(false);
247
+ setErrorMessage(_context.t0.message);
248
+ case 23:
249
+ _context.prev = 23;
250
+ setIsLoading(false);
251
+ return _context.finish(23);
252
+ case 26:
253
+ _context.next = 29;
254
+ break;
255
+ case 28:
256
+ didMountRef.current = true;
257
+ case 29:
258
+ case "end":
259
+ return _context.stop();
287
260
  }
288
261
  }, _callee, null, [[8, 19, 23, 26]]);
289
262
  }));
290
-
291
263
  return function doValidation() {
292
264
  return _ref2.apply(this, arguments);
293
265
  };
294
266
  }();
295
-
296
- useEffect(function () {
297
- doValidation(); // eslint-disable-next-line react-hooks/exhaustive-deps
267
+ (0, _react.useEffect)(function () {
268
+ doValidation();
269
+ // eslint-disable-next-line react-hooks/exhaustive-deps
298
270
  }, [debouncedValue]);
299
- var handleChange = useCallback(function (e) {
271
+ var handleChange = (0, _react.useCallback)(function (e) {
300
272
  var value = e.currentTarget.value || '';
301
273
  setValue(value);
302
- if (!isLoading) setIsLoading(true); // eslint-disable-next-line react-hooks/exhaustive-deps
274
+ if (!isLoading) setIsLoading(true);
275
+ // eslint-disable-next-line react-hooks/exhaustive-deps
303
276
  }, []);
304
277
  return {
305
278
  value: value,
@@ -321,7 +294,6 @@ function generateAsyncInputValidator(validations, inputType, hideSuccess) {
321
294
  };
322
295
  };
323
296
  }
324
-
325
297
  function generateRegexInputValidator(regex, errorMessage, inputType) {
326
298
  return generateInputValidator([{
327
299
  callback: function callback(value) {
@@ -330,15 +302,14 @@ function generateRegexInputValidator(regex, errorMessage, inputType) {
330
302
  errorMessage: errorMessage
331
303
  }], inputType);
332
304
  }
333
-
334
- export var useEmailInput = generateRegexInputValidator(/^([a-zA-Z0-9_\-.]+)@([a-zA-Z0-9_\-.]+)\.([a-zA-Z]{2,5})$/, 'Insert a valid email address', 'email');
335
- export var useUrlInput = generateRegexInputValidator(/((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=+$,\w]+@)?[A-Za-z0-9.-]+|(?:www\.|[-;:&=+$,\w]+@)[A-Za-z0-9.-]+)((?:\/[+~%/.\w\-_]*)?\??(?:[-+=&;%@.\w_]*)#?(?:[.!/\\\w]*))?)/, 'Insert a valid URL', 'url');
336
- export var useRegexInput = function useRegexInput(regex, errorMessage, inputType) {
305
+ var useEmailInput = exports.useEmailInput = generateRegexInputValidator(/^([a-zA-Z0-9_\-.]+)@([a-zA-Z0-9_\-.]+)\.([a-zA-Z]{2,5})$/, 'Insert a valid email address', 'email');
306
+ var useUrlInput = exports.useUrlInput = generateRegexInputValidator(/((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=+$,\w]+@)?[A-Za-z0-9.-]+|(?:www\.|[-;:&=+$,\w]+@)[A-Za-z0-9.-]+)((?:\/[+~%/.\w\-_]*)?\??(?:[-+=&;%@.\w_]*)#?(?:[.!/\\\w]*))?)/, 'Insert a valid URL', 'url');
307
+ var useRegexInput = exports.useRegexInput = function useRegexInput(regex, errorMessage, inputType) {
337
308
  return generateRegexInputValidator(regex, errorMessage, inputType);
338
309
  };
339
- export var useValidatedInput = function useValidatedInput(validations, inputType, hideSuccess) {
310
+ var useValidatedInput = exports.useValidatedInput = function useValidatedInput(validations, inputType, hideSuccess) {
340
311
  return generateInputValidator(validations, inputType, hideSuccess);
341
312
  };
342
- export var useAsyncValidatedInput = function useAsyncValidatedInput(validations, inputType, hideSuccess) {
313
+ var useAsyncValidatedInput = exports.useAsyncValidatedInput = function useAsyncValidatedInput(validations, inputType, hideSuccess) {
343
314
  return generateAsyncInputValidator(validations, inputType, hideSuccess);
344
315
  };
@@ -1,2 +1,27 @@
1
- export * from './Input';
2
- export * from './hooks';
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _Input = require("./Input");
7
+ Object.keys(_Input).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _Input[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function get() {
13
+ return _Input[key];
14
+ }
15
+ });
16
+ });
17
+ var _hooks = require("./hooks");
18
+ Object.keys(_hooks).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _hooks[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function get() {
24
+ return _hooks[key];
25
+ }
26
+ });
27
+ });