@nobak/design-system 1.0.0

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 (304) hide show
  1. package/LICENSE +73 -0
  2. package/README.md +142 -0
  3. package/lib/assets/icons.js +67 -0
  4. package/lib/components/AccountOverview/AccountOverview.js +122 -0
  5. package/lib/components/AdminPanel.js +58 -0
  6. package/lib/components/AssetExchange/AssetExchange.js +189 -0
  7. package/lib/components/AuthenticationFlow.js +216 -0
  8. package/lib/components/ConversationInterface/ConversationInterface.js +232 -0
  9. package/lib/components/DevFooter.js +38 -0
  10. package/lib/components/DevMenu.js +35 -0
  11. package/lib/components/DevSidebar.js +28 -0
  12. package/lib/components/DigitalDisplay.js +83 -0
  13. package/lib/components/Footer.js +45 -0
  14. package/lib/components/HeroContainer.js +10 -0
  15. package/lib/components/IntentRecognition/IntentRecognition.js +174 -0
  16. package/lib/components/Logo.js +259 -0
  17. package/lib/components/MenuBar.js +56 -0
  18. package/lib/components/NetworkSettings.js +223 -0
  19. package/lib/components/RecoverySetup/RecoverySetup.js +354 -0
  20. package/lib/components/RisingSun.js +122 -0
  21. package/lib/components/Symbol.js +226 -0
  22. package/lib/components/TransactionComposer/TransactionComposer.js +258 -0
  23. package/lib/components/TransactionConfirmation.js +184 -0
  24. package/lib/components/WalletMenu.js +33 -0
  25. package/lib/components/console/code/CodeBlock.js +150 -0
  26. package/lib/components/console/code/index.js +9 -0
  27. package/lib/components/console/data/DataTable.js +245 -0
  28. package/lib/components/console/data/MetricCard.js +79 -0
  29. package/lib/components/console/data/index.js +11 -0
  30. package/lib/components/console/documentation/index.js +10 -0
  31. package/lib/components/console/forms/APIKeyGenerator.js +261 -0
  32. package/lib/components/console/forms/SearchBar.js +210 -0
  33. package/lib/components/console/forms/index.js +10 -0
  34. package/lib/components/console/index.js +29 -0
  35. package/lib/components/console/layout/ConsoleCard.js +82 -0
  36. package/lib/components/console/layout/ConsoleLayout.js +86 -0
  37. package/lib/components/console/layout/index.js +10 -0
  38. package/lib/components/console/monitoring/StatusIndicator.js +128 -0
  39. package/lib/components/console/monitoring/index.js +9 -0
  40. package/lib/components/console/navigation/DevFooter.js +38 -0
  41. package/lib/components/console/navigation/DevMenu.js +35 -0
  42. package/lib/components/console/navigation/DevSidebar.js +28 -0
  43. package/lib/components/console/navigation/index.js +11 -0
  44. package/lib/components/console/settings/index.js +10 -0
  45. package/lib/components/index.js +12 -0
  46. package/lib/design/ColorPicker.stories.js +9 -0
  47. package/lib/design/HSLTool-V1.js +345 -0
  48. package/lib/design/HSLTool-V2.js +475 -0
  49. package/lib/design/HSLTool-V3.js +543 -0
  50. package/lib/design/HSLTool-V4.js +1139 -0
  51. package/lib/design/HSLTool.js +374 -0
  52. package/lib/design/OKLCHColorPicker.stories.js +24 -0
  53. package/lib/design/OKLCHTool.js +1014 -0
  54. package/lib/index.js +4 -0
  55. package/lib/shared/components/Avatar/Avatar.js +18 -0
  56. package/lib/shared/components/Avatar/index.js +1 -0
  57. package/lib/shared/components/Badge/Badge.js +34 -0
  58. package/lib/shared/components/Badge/index.js +1 -0
  59. package/lib/shared/components/Breadcrumb/Breadcrumb.js +13 -0
  60. package/lib/shared/components/Breadcrumb/index.js +1 -0
  61. package/lib/shared/components/Button/Button.js +184 -0
  62. package/lib/shared/components/Button/index.js +1 -0
  63. package/lib/shared/components/Calendar/Calendar.js +155 -0
  64. package/lib/shared/components/Calendar/CalendarDay.js +251 -0
  65. package/lib/shared/components/Calendar/CalendarHeader.js +88 -0
  66. package/lib/shared/components/Calendar/CalendarMonth.js +106 -0
  67. package/lib/shared/components/Calendar/CalendarWeek.js +267 -0
  68. package/lib/shared/components/Calendar/constants.js +73 -0
  69. package/lib/shared/components/Calendar/index.js +3 -0
  70. package/lib/shared/components/Calendar/types.d.js +0 -0
  71. package/lib/shared/components/Cartel/Cartel.js +44 -0
  72. package/lib/shared/components/Cartel/index.js +1 -0
  73. package/lib/shared/components/Cell/Cell.js +105 -0
  74. package/lib/shared/components/Cell/index.js +1 -0
  75. package/lib/shared/components/Checkbox/Checkbox.js +27 -0
  76. package/lib/shared/components/Checkbox/index.js +1 -0
  77. package/lib/shared/components/Clock/Clock.js +6 -0
  78. package/lib/shared/components/Clock/index.js +1 -0
  79. package/lib/shared/components/ColorChecker/ColorChecker.js +89 -0
  80. package/lib/shared/components/ColorChecker/index.js +2 -0
  81. package/lib/shared/components/ColorChecker/utils.js +159 -0
  82. package/lib/shared/components/Command/Command.js +95 -0
  83. package/lib/shared/components/Command/index.js +1 -0
  84. package/lib/shared/components/Container/Container.js +18 -0
  85. package/lib/shared/components/Container/index.js +1 -0
  86. package/lib/shared/components/Cover/Cover.js +17 -0
  87. package/lib/shared/components/Cover/index.js +1 -0
  88. package/lib/shared/components/DatePicker/DatePicker.js +52 -0
  89. package/lib/shared/components/DatePicker/components/Calendar.js +125 -0
  90. package/lib/shared/components/DatePicker/components/CalendarDay.js +23 -0
  91. package/lib/shared/components/DatePicker/components/DateWrapper.js +15 -0
  92. package/lib/shared/components/DatePicker/components/index.js +2 -0
  93. package/lib/shared/components/DatePicker/index.js +1 -0
  94. package/lib/shared/components/DateTime/DateTime.js +51 -0
  95. package/lib/shared/components/DateTime/index.js +1 -0
  96. package/lib/shared/components/Debug/Debug.js +12 -0
  97. package/lib/shared/components/Debug/index.js +1 -0
  98. package/lib/shared/components/Disclosure/Disclosure.js +31 -0
  99. package/lib/shared/components/Disclosure/index.js +1 -0
  100. package/lib/shared/components/Dropdown/Dropdown.js +91 -0
  101. package/lib/shared/components/Dropdown/index.js +1 -0
  102. package/lib/shared/components/EmptyState/EmptyState.js +40 -0
  103. package/lib/shared/components/EmptyState/index.js +1 -0
  104. package/lib/shared/components/Form/Form.js +41 -0
  105. package/lib/shared/components/Form/components/DynamicForm.js +66 -0
  106. package/lib/shared/components/Form/components/StepperForm.js +266 -0
  107. package/lib/shared/components/Form/components/index.js +2 -0
  108. package/lib/shared/components/Form/context/Form.js +164 -0
  109. package/lib/shared/components/Form/context/index.js +1 -0
  110. package/lib/shared/components/Form/index.js +1 -0
  111. package/lib/shared/components/Form/types.d.js +1 -0
  112. package/lib/shared/components/Form/utils/index.js +31 -0
  113. package/lib/shared/components/GroupItems/GroupItems.js +17 -0
  114. package/lib/shared/components/GroupItems/index.js +1 -0
  115. package/lib/shared/components/Header/Header.js +26 -0
  116. package/lib/shared/components/Header/index.js +1 -0
  117. package/lib/shared/components/Heading/Heading.js +5 -0
  118. package/lib/shared/components/Heading/index.js +1 -0
  119. package/lib/shared/components/Icon/Icon.js +28 -0
  120. package/lib/shared/components/Icon/index.js +1 -0
  121. package/lib/shared/components/Identicons/Identicons.js +6 -0
  122. package/lib/shared/components/Identicons/index.d.js +0 -0
  123. package/lib/shared/components/Identicons/index.js +1 -0
  124. package/lib/shared/components/Image/Image.js +22 -0
  125. package/lib/shared/components/Image/index.js +1 -0
  126. package/lib/shared/components/Input/Input.js +201 -0
  127. package/lib/shared/components/Input/components/CheckBoxInput.js +81 -0
  128. package/lib/shared/components/Input/components/DateInput.js +89 -0
  129. package/lib/shared/components/Input/components/DefaultInput.js +102 -0
  130. package/lib/shared/components/Input/components/FileReaderInput.js +88 -0
  131. package/lib/shared/components/Input/components/NumberInput.js +141 -0
  132. package/lib/shared/components/Input/components/PickerInput.js +122 -0
  133. package/lib/shared/components/Input/components/RCInput.js +112 -0
  134. package/lib/shared/components/Input/components/Radiobox/RadioboxBasic.js +56 -0
  135. package/lib/shared/components/Input/components/Radiobox/RadioboxCard.js +27 -0
  136. package/lib/shared/components/Input/components/Radiobox/RadioboxFull.js +44 -0
  137. package/lib/shared/components/Input/components/Radiobox/index.js +3 -0
  138. package/lib/shared/components/Input/components/RadioboxInput.js +102 -0
  139. package/lib/shared/components/Input/components/SelectInput.js +70 -0
  140. package/lib/shared/components/Input/components/TextAreaInput.js +67 -0
  141. package/lib/shared/components/Input/components/TextInput.js +139 -0
  142. package/lib/shared/components/Input/components/TimeInput.js +37 -0
  143. package/lib/shared/components/Input/components/UploadFileInput.js +123 -0
  144. package/lib/shared/components/Input/components/index.js +13 -0
  145. package/lib/shared/components/Input/components/types.d.js +0 -0
  146. package/lib/shared/components/Input/index.js +1 -0
  147. package/lib/shared/components/Input/types.d.js +0 -0
  148. package/lib/shared/components/Layout/Layout.js +13 -0
  149. package/lib/shared/components/Layout/index.js +1 -0
  150. package/lib/shared/components/List/List.js +30 -0
  151. package/lib/shared/components/List/index.js +1 -0
  152. package/lib/shared/components/Loader/Loader.js +27 -0
  153. package/lib/shared/components/Loader/index.js +1 -0
  154. package/lib/shared/components/Modal/Modal.js +102 -0
  155. package/lib/shared/components/Modal/index.js +1 -0
  156. package/lib/shared/components/Notification/Notification.js +39 -0
  157. package/lib/shared/components/Notification/index.js +1 -0
  158. package/lib/shared/components/Person/Person.js +81 -0
  159. package/lib/shared/components/Person/index.js +1 -0
  160. package/lib/shared/components/Popover/Popover.js +39 -0
  161. package/lib/shared/components/Popover/index.js +1 -0
  162. package/lib/shared/components/QRCode/QRCode.js +329 -0
  163. package/lib/shared/components/QRCode/index.js +1 -0
  164. package/lib/shared/components/RadioGroup/RadioGroup.js +35 -0
  165. package/lib/shared/components/RadioGroup/components/DefaultGroup.js +71 -0
  166. package/lib/shared/components/RadioGroup/components/VerticalGroup.js +83 -0
  167. package/lib/shared/components/RadioGroup/components/index.js +2 -0
  168. package/lib/shared/components/RadioGroup/index.js +1 -0
  169. package/lib/shared/components/Search/Search.js +12 -0
  170. package/lib/shared/components/Search/index.js +1 -0
  171. package/lib/shared/components/Select/Select.js +90 -0
  172. package/lib/shared/components/Select/index.js +1 -0
  173. package/lib/shared/components/Sidebar/Sidebar.js +42 -0
  174. package/lib/shared/components/Sidebar/index.js +1 -0
  175. package/lib/shared/components/SlideOver/SlideOver.js +81 -0
  176. package/lib/shared/components/SlideOver/index.js +1 -0
  177. package/lib/shared/components/Slider/Slider.js +80 -0
  178. package/lib/shared/components/Slider/index.js +1 -0
  179. package/lib/shared/components/Stepper/Stepper.js +32 -0
  180. package/lib/shared/components/Stepper/index.js +1 -0
  181. package/lib/shared/components/Steps/Steps.js +53 -0
  182. package/lib/shared/components/Steps/index.js +1 -0
  183. package/lib/shared/components/Switch/Switch.js +26 -0
  184. package/lib/shared/components/Switch/index.js +1 -0
  185. package/lib/shared/components/Tab/Tab.js +59 -0
  186. package/lib/shared/components/Tab/index.js +1 -0
  187. package/lib/shared/components/Table/Table.js +47 -0
  188. package/lib/shared/components/Table/index.js +1 -0
  189. package/lib/shared/components/Text/Text.js +11 -0
  190. package/lib/shared/components/Text/index.js +1 -0
  191. package/lib/shared/components/TextList/TextList.js +15 -0
  192. package/lib/shared/components/TextList/index.js +1 -0
  193. package/lib/shared/components/TimePicker/TimePicker.js +161 -0
  194. package/lib/shared/components/TimePicker/index.js +1 -0
  195. package/lib/shared/components/Tooltip/Tooltip.js +13 -0
  196. package/lib/shared/components/Tooltip/index.js +1 -0
  197. package/lib/shared/components/Uploader/Uploader.js +63 -0
  198. package/lib/shared/components/Uploader/index.js +1 -0
  199. package/lib/shared/components/Video/Video.js +20 -0
  200. package/lib/shared/components/Video/index.js +1 -0
  201. package/lib/shared/components/index.d.js +0 -0
  202. package/lib/shared/components/index.js +50 -0
  203. package/lib/shared/elements/Color/ColorPallet.js +20 -0
  204. package/lib/shared/elements/Color/index.js +1 -0
  205. package/lib/shared/elements/Text.js +37 -0
  206. package/lib/shared/elements/index.js +1 -0
  207. package/lib/shared/helpers/FakeLink.js +8 -0
  208. package/lib/shared/helpers/constants.js +359 -0
  209. package/lib/shared/helpers/index.js +2 -0
  210. package/lib/shared/helpers/isEqual.js +56 -0
  211. package/lib/shared/index.d.js +0 -0
  212. package/lib/shared/index.js +1 -0
  213. package/lib/shared/stories/components/Avatar.stories.js +17 -0
  214. package/lib/shared/stories/components/Badge.stories.dev.js +37 -0
  215. package/lib/shared/stories/components/Button.stories.js +553 -0
  216. package/lib/shared/stories/components/Calendar.stories.js +62 -0
  217. package/lib/shared/stories/components/Cartel.stories.js +32 -0
  218. package/lib/shared/stories/components/Checkbox.stories.js +15 -0
  219. package/lib/shared/stories/components/ColorChecker.stories.dev.js +16 -0
  220. package/lib/shared/stories/components/DateTime.stories.js +27 -0
  221. package/lib/shared/stories/components/Disclosure.stories.js +30 -0
  222. package/lib/shared/stories/components/Dropdown.stories.js +39 -0
  223. package/lib/shared/stories/components/Form/Default.stories.js +201 -0
  224. package/lib/shared/stories/components/Form/DummyForm.stories.js +48 -0
  225. package/lib/shared/stories/components/Form/DynamicForm.stories.js +155 -0
  226. package/lib/shared/stories/components/Form/StepperForm.stories.js +138 -0
  227. package/lib/shared/stories/components/Form/ValidateForm.stories.js +70 -0
  228. package/lib/shared/stories/components/Form/Validation.stories.js +184 -0
  229. package/lib/shared/stories/components/GroupItems.stories.js +23 -0
  230. package/lib/shared/stories/components/Header.stories.js +29 -0
  231. package/lib/shared/stories/components/Heading.stories.js +27 -0
  232. package/lib/shared/stories/components/Icon.stories.js +22 -0
  233. package/lib/shared/stories/components/Image.stories.js +23 -0
  234. package/lib/shared/stories/components/Input/Checkbox.stories.js +45 -0
  235. package/lib/shared/stories/components/Input/DatePicker.stories.js +23 -0
  236. package/lib/shared/stories/components/Input/Defaut.stories.js +24 -0
  237. package/lib/shared/stories/components/Input/Number.stories.js +24 -0
  238. package/lib/shared/stories/components/Input/RCI.stories.js +59 -0
  239. package/lib/shared/stories/components/Input/Radiobox.stories.dev.js +28 -0
  240. package/lib/shared/stories/components/Input/Select.stories.dev.js +27 -0
  241. package/lib/shared/stories/components/Input/SelectMultiple.stories.dev.js +510 -0
  242. package/lib/shared/stories/components/Input/Textarea.stories.js +24 -0
  243. package/lib/shared/stories/components/List.stories.js +34 -0
  244. package/lib/shared/stories/components/Loader.stories.js +15 -0
  245. package/lib/shared/stories/components/Modal.stories.js +50 -0
  246. package/lib/shared/stories/components/Notification.stories.js +22 -0
  247. package/lib/shared/stories/components/Person.stories.js +41 -0
  248. package/lib/shared/stories/components/Picker.stories.js +15 -0
  249. package/lib/shared/stories/components/Popover.stories.js +36 -0
  250. package/lib/shared/stories/components/QRCode.stories.js +20 -0
  251. package/lib/shared/stories/components/RadioGroup.stories.js +56 -0
  252. package/lib/shared/stories/components/Select.stories.js +50 -0
  253. package/lib/shared/stories/components/Sidebar.stories.js +35 -0
  254. package/lib/shared/stories/components/Slider.stories.dev.js +48 -0
  255. package/lib/shared/stories/components/Stepper/Stepper.stories.js +38 -0
  256. package/lib/shared/stories/components/Steps.stories.js +15 -0
  257. package/lib/shared/stories/components/Switch.stories.js +15 -0
  258. package/lib/shared/stories/components/Tab.stories.js +15 -0
  259. package/lib/shared/stories/components/Table.stories.js +95 -0
  260. package/lib/shared/stories/components/TextList.stories.js +23 -0
  261. package/lib/shared/stories/components/Tooltip.stories.dev.js +40 -0
  262. package/lib/shared/stories/elements/Color.stories.js +269 -0
  263. package/lib/shared/stories/elements/Text.stories.js +45 -0
  264. package/lib/shared/types/index.js +1 -0
  265. package/lib/stories/Foundation/BrandIdentity.prod.stories.js +510 -0
  266. package/lib/stories/Foundation/Logo.stories.js +19 -0
  267. package/lib/stories/Foundation/RisingSun.stories.js +16 -0
  268. package/lib/stories/Foundation/Shadows.stories.js +601 -0
  269. package/lib/stories/Foundation/Symbol.stories.js +18 -0
  270. package/lib/stories/HeroContainer.stories.js +18 -0
  271. package/lib/styles/accessibilityTokens.js +72 -0
  272. package/lib/styles/borderWidth.js +10 -0
  273. package/lib/styles/colors.js +303 -0
  274. package/lib/styles/elevation.js +240 -0
  275. package/lib/styles/icons.js +218 -0
  276. package/lib/styles/index.js +29 -0
  277. package/lib/styles/motion.js +668 -0
  278. package/lib/styles/opacity.js +10 -0
  279. package/lib/styles/radius.js +11 -0
  280. package/lib/styles/sizing.js +35 -0
  281. package/lib/styles/space.js +24 -0
  282. package/lib/styles/theme/darkTheme.js +471 -0
  283. package/lib/styles/theme/index.js +44 -0
  284. package/lib/styles/theme/lightTheme.js +480 -0
  285. package/lib/styles/theme/themeTypes.js +1 -0
  286. package/lib/styles/theme/themeUtils.js +63 -0
  287. package/lib/styles/typography-advanced.js +510 -0
  288. package/lib/styles/typography.js +1419 -0
  289. package/lib/styles/zIndex.js +19 -0
  290. package/lib/tokens/borders.js +161 -0
  291. package/lib/tokens/colors.js +426 -0
  292. package/lib/tokens/components.js +499 -0
  293. package/lib/tokens/index.js +84 -0
  294. package/lib/tokens/lighting.js +384 -0
  295. package/lib/tokens/motion.js +284 -0
  296. package/lib/tokens/semantic.js +367 -0
  297. package/lib/tokens/shadows.js +114 -0
  298. package/lib/tokens/spacing.js +189 -0
  299. package/lib/tokens/typography.js +268 -0
  300. package/package.json +176 -0
  301. package/styles/generated-tokens.css +677 -0
  302. package/styles/index.css +2 -0
  303. package/styles/main.css +610 -0
  304. package/tailwind.config.js +64 -0
@@ -0,0 +1,139 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return r; }; var t, r = {}, e = Object.prototype, n = e.hasOwnProperty, o = "function" == typeof Symbol ? Symbol : {}, i = o.iterator || "@@iterator", a = o.asyncIterator || "@@asyncIterator", u = o.toStringTag || "@@toStringTag"; function c(t, r, e, n) { return Object.defineProperty(t, r, { value: e, enumerable: !n, configurable: !n, writable: !n }); } try { c({}, ""); } catch (t) { c = function c(t, r, e) { return t[r] = e; }; } function h(r, e, n, o) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype); return c(a, "_invoke", function (r, e, n) { var o = 1; return function (i, a) { if (3 === o) throw Error("Generator is already running"); if (4 === o) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var u = n.delegate; if (u) { var c = d(u, n); if (c) { if (c === f) continue; return c; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (1 === o) throw o = 4, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = 3; var h = s(r, e, n); if ("normal" === h.type) { if (o = n.done ? 4 : 2, h.arg === f) continue; return { value: h.arg, done: n.done }; } "throw" === h.type && (o = 4, n.method = "throw", n.arg = h.arg); } }; }(r, n, new Context(o || [])), !0), a; } function s(t, r, e) { try { return { type: "normal", arg: t.call(r, e) }; } catch (t) { return { type: "throw", arg: t }; } } r.wrap = h; var f = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var l = {}; c(l, i, function () { return this; }); var p = Object.getPrototypeOf, y = p && p(p(x([]))); y && y !== e && n.call(y, i) && (l = y); var v = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(l); function g(t) { ["next", "throw", "return"].forEach(function (r) { c(t, r, function (t) { return this._invoke(r, t); }); }); } function AsyncIterator(t, r) { function e(o, i, a, u) { var c = s(t[o], t, i); if ("throw" !== c.type) { var h = c.arg, f = h.value; return f && "object" == _typeof(f) && n.call(f, "__await") ? r.resolve(f.__await).then(function (t) { e("next", t, a, u); }, function (t) { e("throw", t, a, u); }) : r.resolve(f).then(function (t) { h.value = t, a(h); }, function (t) { return e("throw", t, a, u); }); } u(c.arg); } var o; c(this, "_invoke", function (t, n) { function i() { return new r(function (r, o) { e(t, n, r, o); }); } return o = o ? o.then(i, i) : i(); }, !0); } function d(r, e) { var n = e.method, o = r.i[n]; if (o === t) return e.delegate = null, "throw" === n && r.i["return"] && (e.method = "return", e.arg = t, d(r, e), "throw" === e.method) || "return" !== n && (e.method = "throw", e.arg = new TypeError("The iterator does not provide a '" + n + "' method")), f; var i = s(o, r.i, e.arg); if ("throw" === i.type) return e.method = "throw", e.arg = i.arg, e.delegate = null, f; var a = i.arg; return a ? a.done ? (e[r.r] = a.value, e.next = r.n, "return" !== e.method && (e.method = "next", e.arg = t), e.delegate = null, f) : a : (e.method = "throw", e.arg = new TypeError("iterator result is not an object"), e.delegate = null, f); } function w(t) { this.tryEntries.push(t); } function m(r) { var e = r[4] || {}; e.type = "normal", e.arg = t, r[4] = e; } function Context(t) { this.tryEntries = [[-1]], t.forEach(w, this), this.reset(!0); } function x(r) { if (null != r) { var e = r[i]; if (e) return e.call(r); if ("function" == typeof r.next) return r; if (!isNaN(r.length)) { var o = -1, a = function e() { for (; ++o < r.length;) if (n.call(r, o)) return e.value = r[o], e.done = !1, e; return e.value = t, e.done = !0, e; }; return a.next = a; } } throw new TypeError(_typeof(r) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, c(v, "constructor", GeneratorFunctionPrototype), c(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = c(GeneratorFunctionPrototype, u, "GeneratorFunction"), r.isGeneratorFunction = function (t) { var r = "function" == typeof t && t.constructor; return !!r && (r === GeneratorFunction || "GeneratorFunction" === (r.displayName || r.name)); }, r.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, c(t, u, "GeneratorFunction")), t.prototype = Object.create(v), t; }, r.awrap = function (t) { return { __await: t }; }, g(AsyncIterator.prototype), c(AsyncIterator.prototype, a, function () { return this; }), r.AsyncIterator = AsyncIterator, r.async = function (t, e, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(h(t, e, n, o), i); return r.isGeneratorFunction(e) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, g(v), c(v, u, "Generator"), c(v, i, function () { return this; }), c(v, "toString", function () { return "[object Generator]"; }), r.keys = function (t) { var r = Object(t), e = []; for (var n in r) e.unshift(n); return function t() { for (; e.length;) if ((n = e.pop()) in r) return t.value = n, t.done = !1, t; return t.done = !0, t; }; }, r.values = x, Context.prototype = { constructor: Context, reset: function reset(r) { if (this.prev = this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(m), !r) for (var e in this) "t" === e.charAt(0) && n.call(this, e) && !isNaN(+e.slice(1)) && (this[e] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0][4]; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(r) { if (this.done) throw r; var e = this; function n(t) { a.type = "throw", a.arg = r, e.next = t; } for (var o = e.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i[4], u = this.prev, c = i[1], h = i[2]; if (-1 === i[0]) return n("end"), !1; if (!c && !h) throw Error("try statement without catch or finally"); if (null != i[0] && i[0] <= u) { if (u < c) return this.method = "next", this.arg = t, n(c), !0; if (u < h) return n(h), !1; } } }, abrupt: function abrupt(t, r) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var n = this.tryEntries[e]; if (n[0] > -1 && n[0] <= this.prev && this.prev < n[2]) { var o = n; break; } } o && ("break" === t || "continue" === t) && o[0] <= r && r <= o[2] && (o = null); var i = o ? o[4] : {}; return i.type = t, i.arg = r, o ? (this.method = "next", this.next = o[2], f) : this.complete(i); }, complete: function complete(t, r) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && r && (this.next = r), f; }, finish: function finish(t) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var e = this.tryEntries[r]; if (e[2] === t) return this.complete(e[4], e[3]), m(e), f; } }, "catch": function _catch(t) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var e = this.tryEntries[r]; if (e[0] === t) { var n = e[4]; if ("throw" === n.type) { var o = n.arg; m(e); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(r, e, n) { return this.delegate = { i: x(r), r: e, n: n }, "next" === this.method && (this.arg = t), f; } }, r; }
3
+ function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
4
+ function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
5
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
6
+ 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."); }
7
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
8
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
9
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
10
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
11
+ import { useForm } from "../../Form/context/Form";
12
+ import * as React from 'react';
13
+ import clsx from 'clsx';
14
+ // import { CheckIcon, XIcon } from '@heroicons/react/solid';
15
+ import { Icon } from "../..";
16
+ export var TextInput = function TextInput(_ref) {
17
+ var config = _ref.config;
18
+ var id = config.id,
19
+ label = config.label,
20
+ autoComplete = config.autoComplete,
21
+ type = config.type,
22
+ hidden = config.hidden,
23
+ icon = config.icon,
24
+ placeholder = config.placeholder,
25
+ afterChange = config.afterChange,
26
+ validation = config.validation,
27
+ defaultValue = config.defaultValue,
28
+ maxLength = config.maxLength,
29
+ disabled = config.disabled,
30
+ required = config.required,
31
+ mRef = config.mRef;
32
+ var _React$useState = React.useState('EMPTY'),
33
+ _React$useState2 = _slicedToArray(_React$useState, 2),
34
+ status = _React$useState2[0],
35
+ setStatus = _React$useState2[1];
36
+ var _useForm = useForm(),
37
+ updateForm = _useForm.updateForm;
38
+ var _React$useState3 = React.useState(defaultValue),
39
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
40
+ value = _React$useState4[0],
41
+ setValue = _React$useState4[1];
42
+
43
+ // const updateStatus = async (value: 'VALID' | 'ERROR') => {
44
+ // setStatus(value)
45
+ // }
46
+
47
+ var validate = /*#__PURE__*/function () {
48
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(event) {
49
+ var e;
50
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
51
+ while (1) switch (_context.prev = _context.next) {
52
+ case 0:
53
+ console.log('validate', event);
54
+ setValue(event);
55
+ updateForm();
56
+ if (!validation) {
57
+ _context.next = 8;
58
+ break;
59
+ }
60
+ _context.next = 6;
61
+ return validation === null || validation === void 0 ? void 0 : validation.fn(event);
62
+ case 6:
63
+ e = _context.sent;
64
+ if (e.valid === true) {
65
+ setStatus('VALID');
66
+ afterChange({
67
+ id: id,
68
+ value: event,
69
+ type: type,
70
+ label: label,
71
+ status: 'VALID',
72
+ message: e.message
73
+ });
74
+ } else if (e.valid === false) {
75
+ setStatus('ERROR');
76
+ afterChange({
77
+ id: id,
78
+ value: event,
79
+ type: type,
80
+ label: label,
81
+ status: 'ERROR',
82
+ message: e.message
83
+ });
84
+ }
85
+ case 8:
86
+ case "end":
87
+ return _context.stop();
88
+ }
89
+ }, _callee);
90
+ }));
91
+ return function validate(_x) {
92
+ return _ref2.apply(this, arguments);
93
+ };
94
+ }();
95
+ var inputStyle = clsx("shadow-sm focus:ring-primary-1000 focus:border-primary-1000 block w-full sm:text-sm border border-neutral-1800 rounded-md text-neutral-1600 bg-neutral-200", status === 'VALID' && 'border-green-400 focus:ring-green-500 focus:border-green-500', status === 'ERROR' && 'border-red-400 focus:ring-red-500 focus:border-red-500', !!icon && 'pl-10');
96
+ var iconStyle = clsx('absolute inset-y-0 right-0 pr-3 flex items-center text-neutral-600', status === 'VALID' && 'text-green-400', status === 'ERROR' && 'text-red-400');
97
+ var iconStatus = function iconStatus(status) {
98
+ switch (status) {
99
+ case 'VALID':
100
+ return /*#__PURE__*/React.createElement("div", null);
101
+ case 'ERROR':
102
+ return /*#__PURE__*/React.createElement("div", null);
103
+ default:
104
+ return /*#__PURE__*/React.createElement("div", {
105
+ className: "origin-center animate-spin"
106
+ }, /*#__PURE__*/React.createElement(Icon, {
107
+ name: "spinner"
108
+ }));
109
+ }
110
+ };
111
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", {
112
+ htmlFor: id,
113
+ className: !hidden ? "block text-sm font-medium text-neutral-1900" : 'hidden'
114
+ }, label), /*#__PURE__*/React.createElement("div", {
115
+ className: "mt-1 relative"
116
+ }, /*#__PURE__*/React.createElement("input", {
117
+ disabled: disabled,
118
+ type: !hidden ? 'text' : 'hidden',
119
+ name: id,
120
+ id: id,
121
+ ref: mRef,
122
+ readOnly: hidden,
123
+ value: value,
124
+ maxLength: maxLength,
125
+ autoComplete: autoComplete,
126
+ onChange: function onChange(e) {
127
+ return validate(e.target.value);
128
+ },
129
+ className: inputStyle,
130
+ placeholder: placeholder,
131
+ required: required
132
+ }), !!icon && !hidden && /*#__PURE__*/React.createElement("div", {
133
+ className: "absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none text-neutral-100"
134
+ }, /*#__PURE__*/React.createElement(Icon, {
135
+ name: icon
136
+ })), status !== 'EMPTY' && !hidden && /*#__PURE__*/React.createElement("div", {
137
+ className: iconStyle
138
+ }, iconStatus(status)))));
139
+ };
@@ -0,0 +1,37 @@
1
+ import * as React from 'react';
2
+ export var TimeInput = function TimeInput(_ref) {
3
+ var config = _ref.config;
4
+ var id = config.id,
5
+ label = config.label,
6
+ type = config.type,
7
+ autoComplete = config.autoComplete,
8
+ hidden = config.hidden,
9
+ placeholder = config.placeholder,
10
+ defaultValue = config.defaultValue,
11
+ required = config.required,
12
+ mRef = config.mRef;
13
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", {
14
+ htmlFor: id,
15
+ className: !hidden ? "block text-sm font-medium text-neutral-800" : 'hidden'
16
+ }, label), /*#__PURE__*/React.createElement("div", {
17
+ className: "mt-1"
18
+ }, /*#__PURE__*/React.createElement("input", {
19
+ type: !hidden ? type : 'hidden',
20
+ name: id
21
+ // name="hh%3Amm"
22
+ ,
23
+ id: id,
24
+ ref: mRef
25
+ // step="5"
26
+ ,
27
+ onChange: function onChange() {
28
+ return console.log('Changing...');
29
+ },
30
+ readOnly: hidden,
31
+ autoComplete: autoComplete,
32
+ className: "shadow-sm focus:ring-blue-500 focus:border-blue-500 block w-full sm:text-sm border border-neutral-200 rounded-md text-neutral-800 bg-neutral-100",
33
+ placeholder: placeholder,
34
+ defaultValue: defaultValue,
35
+ required: required
36
+ }))));
37
+ };
@@ -0,0 +1,123 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return r; }; var t, r = {}, e = Object.prototype, n = e.hasOwnProperty, o = "function" == typeof Symbol ? Symbol : {}, i = o.iterator || "@@iterator", a = o.asyncIterator || "@@asyncIterator", u = o.toStringTag || "@@toStringTag"; function c(t, r, e, n) { return Object.defineProperty(t, r, { value: e, enumerable: !n, configurable: !n, writable: !n }); } try { c({}, ""); } catch (t) { c = function c(t, r, e) { return t[r] = e; }; } function h(r, e, n, o) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype); return c(a, "_invoke", function (r, e, n) { var o = 1; return function (i, a) { if (3 === o) throw Error("Generator is already running"); if (4 === o) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var u = n.delegate; if (u) { var c = d(u, n); if (c) { if (c === f) continue; return c; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (1 === o) throw o = 4, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = 3; var h = s(r, e, n); if ("normal" === h.type) { if (o = n.done ? 4 : 2, h.arg === f) continue; return { value: h.arg, done: n.done }; } "throw" === h.type && (o = 4, n.method = "throw", n.arg = h.arg); } }; }(r, n, new Context(o || [])), !0), a; } function s(t, r, e) { try { return { type: "normal", arg: t.call(r, e) }; } catch (t) { return { type: "throw", arg: t }; } } r.wrap = h; var f = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var l = {}; c(l, i, function () { return this; }); var p = Object.getPrototypeOf, y = p && p(p(x([]))); y && y !== e && n.call(y, i) && (l = y); var v = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(l); function g(t) { ["next", "throw", "return"].forEach(function (r) { c(t, r, function (t) { return this._invoke(r, t); }); }); } function AsyncIterator(t, r) { function e(o, i, a, u) { var c = s(t[o], t, i); if ("throw" !== c.type) { var h = c.arg, f = h.value; return f && "object" == _typeof(f) && n.call(f, "__await") ? r.resolve(f.__await).then(function (t) { e("next", t, a, u); }, function (t) { e("throw", t, a, u); }) : r.resolve(f).then(function (t) { h.value = t, a(h); }, function (t) { return e("throw", t, a, u); }); } u(c.arg); } var o; c(this, "_invoke", function (t, n) { function i() { return new r(function (r, o) { e(t, n, r, o); }); } return o = o ? o.then(i, i) : i(); }, !0); } function d(r, e) { var n = e.method, o = r.i[n]; if (o === t) return e.delegate = null, "throw" === n && r.i["return"] && (e.method = "return", e.arg = t, d(r, e), "throw" === e.method) || "return" !== n && (e.method = "throw", e.arg = new TypeError("The iterator does not provide a '" + n + "' method")), f; var i = s(o, r.i, e.arg); if ("throw" === i.type) return e.method = "throw", e.arg = i.arg, e.delegate = null, f; var a = i.arg; return a ? a.done ? (e[r.r] = a.value, e.next = r.n, "return" !== e.method && (e.method = "next", e.arg = t), e.delegate = null, f) : a : (e.method = "throw", e.arg = new TypeError("iterator result is not an object"), e.delegate = null, f); } function w(t) { this.tryEntries.push(t); } function m(r) { var e = r[4] || {}; e.type = "normal", e.arg = t, r[4] = e; } function Context(t) { this.tryEntries = [[-1]], t.forEach(w, this), this.reset(!0); } function x(r) { if (null != r) { var e = r[i]; if (e) return e.call(r); if ("function" == typeof r.next) return r; if (!isNaN(r.length)) { var o = -1, a = function e() { for (; ++o < r.length;) if (n.call(r, o)) return e.value = r[o], e.done = !1, e; return e.value = t, e.done = !0, e; }; return a.next = a; } } throw new TypeError(_typeof(r) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, c(v, "constructor", GeneratorFunctionPrototype), c(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = c(GeneratorFunctionPrototype, u, "GeneratorFunction"), r.isGeneratorFunction = function (t) { var r = "function" == typeof t && t.constructor; return !!r && (r === GeneratorFunction || "GeneratorFunction" === (r.displayName || r.name)); }, r.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, c(t, u, "GeneratorFunction")), t.prototype = Object.create(v), t; }, r.awrap = function (t) { return { __await: t }; }, g(AsyncIterator.prototype), c(AsyncIterator.prototype, a, function () { return this; }), r.AsyncIterator = AsyncIterator, r.async = function (t, e, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(h(t, e, n, o), i); return r.isGeneratorFunction(e) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, g(v), c(v, u, "Generator"), c(v, i, function () { return this; }), c(v, "toString", function () { return "[object Generator]"; }), r.keys = function (t) { var r = Object(t), e = []; for (var n in r) e.unshift(n); return function t() { for (; e.length;) if ((n = e.pop()) in r) return t.value = n, t.done = !1, t; return t.done = !0, t; }; }, r.values = x, Context.prototype = { constructor: Context, reset: function reset(r) { if (this.prev = this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(m), !r) for (var e in this) "t" === e.charAt(0) && n.call(this, e) && !isNaN(+e.slice(1)) && (this[e] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0][4]; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(r) { if (this.done) throw r; var e = this; function n(t) { a.type = "throw", a.arg = r, e.next = t; } for (var o = e.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i[4], u = this.prev, c = i[1], h = i[2]; if (-1 === i[0]) return n("end"), !1; if (!c && !h) throw Error("try statement without catch or finally"); if (null != i[0] && i[0] <= u) { if (u < c) return this.method = "next", this.arg = t, n(c), !0; if (u < h) return n(h), !1; } } }, abrupt: function abrupt(t, r) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var n = this.tryEntries[e]; if (n[0] > -1 && n[0] <= this.prev && this.prev < n[2]) { var o = n; break; } } o && ("break" === t || "continue" === t) && o[0] <= r && r <= o[2] && (o = null); var i = o ? o[4] : {}; return i.type = t, i.arg = r, o ? (this.method = "next", this.next = o[2], f) : this.complete(i); }, complete: function complete(t, r) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && r && (this.next = r), f; }, finish: function finish(t) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var e = this.tryEntries[r]; if (e[2] === t) return this.complete(e[4], e[3]), m(e), f; } }, "catch": function _catch(t) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var e = this.tryEntries[r]; if (e[0] === t) { var n = e[4]; if ("throw" === n.type) { var o = n.arg; m(e); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(r, e, n) { return this.delegate = { i: x(r), r: e, n: n }, "next" === this.method && (this.arg = t), f; } }, r; }
3
+ function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
4
+ function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
5
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
6
+ 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."); }
7
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
8
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
9
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
10
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
11
+ import React from 'react';
12
+ import { Button } from "../..";
13
+ export var UploadFileInput = function UploadFileInput(_ref) {
14
+ var uploadFile = _ref.uploadFile,
15
+ config = _ref.config;
16
+ var id = config.id,
17
+ label = config.label,
18
+ autoComplete = config.autoComplete,
19
+ hidden = config.hidden,
20
+ icon = config.icon,
21
+ debug = config.debug,
22
+ placeholder = config.placeholder,
23
+ afterChange = config.afterChange,
24
+ validation = config.validation,
25
+ defaultValue = config.defaultValue,
26
+ maxLength = config.maxLength,
27
+ required = config.required,
28
+ mRef = config.mRef;
29
+ var _React$useState = React.useState(undefined),
30
+ _React$useState2 = _slicedToArray(_React$useState, 2),
31
+ data = _React$useState2[0],
32
+ setData = _React$useState2[1];
33
+ var handleChange = function handleChange(data) {
34
+ setData(data);
35
+ };
36
+ // Refactor all this methods, remember this is only for visual purpose
37
+ // const [file, setFile] = React.useState<FileData | null>(null);
38
+
39
+ // const { run: upload } = uploadFile();
40
+
41
+ // const handleUpload = async () => {
42
+ // await upload()
43
+ // .then(({ data }: any) => {
44
+ // console.log(data);
45
+ // })
46
+ // .catch((error: any) => {
47
+ // console.log(error);
48
+ // });
49
+ // };
50
+
51
+ // React.useEffect(() => {
52
+ // if (!!file) {
53
+ // console.log(file);
54
+ // }
55
+ // // console.log('running');
56
+ // // handleUpload();
57
+ // }, [file]);
58
+
59
+ var onChange = /*#__PURE__*/function () {
60
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(e) {
61
+ var data;
62
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
63
+ while (1) switch (_context.prev = _context.next) {
64
+ case 0:
65
+ _context.next = 2;
66
+ return uploadFile(e);
67
+ case 2:
68
+ data = _context.sent;
69
+ console.log('uploaded data', data);
70
+ setData(data);
71
+ // console.log('DATAAAA', data)
72
+ // console.log('ONCHANGE')
73
+ // const formData = new FormData();
74
+ // console.log(formData);
75
+ // const file = formData.append('file', e.target.files[0]);
76
+ // console.log(formData);
77
+ // console.log(file);
78
+ // // setFile({ file: formData });
79
+ case 5:
80
+ case "end":
81
+ return _context.stop();
82
+ }
83
+ }, _callee);
84
+ }));
85
+ return function onChange(_x) {
86
+ return _ref2.apply(this, arguments);
87
+ };
88
+ }();
89
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("label", {
90
+ className: "block text-sm font-medium text-neutral-800"
91
+ }, label), /*#__PURE__*/React.createElement("input", {
92
+ type: "text",
93
+ value: data !== null && data !== void 0 && data.value ? data === null || data === void 0 ? void 0 : data.value : undefined,
94
+ hidden: debug ? !debug : true,
95
+ readOnly: true,
96
+ autoComplete: "off",
97
+ name: id,
98
+ id: id,
99
+ ref: mRef
100
+ }), /*#__PURE__*/React.createElement("div", {
101
+ className: "mt-1 flex justify-center px-6 pt-5 pb-6 border-2 border-gray-300 border-dashed rounded-md"
102
+ }, /*#__PURE__*/React.createElement("div", {
103
+ className: "space-y-1 text-center"
104
+ }, /*#__PURE__*/React.createElement("svg", {
105
+ className: "mx-auto h-12 w-12 text-gray-400",
106
+ stroke: "currentColor",
107
+ fill: "none",
108
+ viewBox: "0 0 48 48",
109
+ "aria-hidden": "true"
110
+ }, /*#__PURE__*/React.createElement("path", {
111
+ d: "M28 8H12a4 4 0 00-4 4v20m32-12v8m0 0v8a4 4 0 01-4 4H12a4 4 0 01-4-4v-4m32-4l-3.172-3.172a4 4 0 00-5.656 0L28 28M8 32l9.172-9.172a4 4 0 015.656 0L28 28m0 0l4 4m4-24h8m-4-4v8m-12 4h.02",
112
+ strokeWidth: 2,
113
+ strokeLinecap: "round",
114
+ strokeLinejoin: "round"
115
+ })), /*#__PURE__*/React.createElement("div", {
116
+ className: "flex text-sm text-gray-600"
117
+ }, /*#__PURE__*/React.createElement(Button, {
118
+ type: "upload",
119
+ text: "Upload a file",
120
+ startUpload: onChange,
121
+ disabled: !!data && true
122
+ })))));
123
+ };
@@ -0,0 +1,13 @@
1
+ export { CheckBoxInput } from "./CheckBoxInput";
2
+ export { UploadFileInput } from "./UploadFileInput";
3
+ export { TextInput } from "./TextInput";
4
+ export { SelectInput } from "./SelectInput";
5
+ export { TextAreaInput } from "./TextAreaInput";
6
+ export { DefaultInput } from "./DefaultInput";
7
+ export { RadioboxInput } from "./RadioboxInput";
8
+ export { NumberInput } from "./NumberInput";
9
+ export { TimeInput } from "./TimeInput";
10
+ export { PickerInput } from "./PickerInput";
11
+ export { RCInput } from "./RCInput";
12
+ export { FileReaderInput } from "./FileReaderInput";
13
+ export { DateInput } from "./DateInput";
@@ -0,0 +1 @@
1
+ export { Input } from "./Input";
File without changes
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import clsx from 'clsx';
3
+ export var Layout = function Layout(_ref) {
4
+ var children = _ref.children,
5
+ _ref$variant = _ref.variant,
6
+ variant = _ref$variant === void 0 ? 'small' : _ref$variant,
7
+ _ref$customCss = _ref.customCss,
8
+ customCss = _ref$customCss === void 0 ? '' : _ref$customCss;
9
+ var style = clsx(variant === 'tiny' && 'sm:max-w-sm', variant === 'small' && 'sm:max-w-screen-sm', variant === 'large' && 'sm:max-w-screen-lg', variant === 'full' && 'sm:max-w-screen-2xl', "max-w-screen-sm w-full mx-auto ".concat(customCss));
10
+ return /*#__PURE__*/React.createElement("div", {
11
+ className: style
12
+ }, children);
13
+ };
@@ -0,0 +1 @@
1
+ export { Layout } from "./Layout";
@@ -0,0 +1,30 @@
1
+ import React from 'react';
2
+ import { Cell } from "../Cell";
3
+ export var List = function List(_ref) {
4
+ var data = _ref.data,
5
+ component = _ref.component,
6
+ _ref$background = _ref.background,
7
+ background = _ref$background === void 0 ? 'default' : _ref$background;
8
+ return /*#__PURE__*/React.createElement("div", {
9
+ className: "text-p2-medium text-neutral-800 shadow sm:rounded-[20px] ".concat(background === 'default' ? 'bg-neutral-100' : 'bg-neutral-150', " overflow-hidden")
10
+ }, /*#__PURE__*/React.createElement("ul", {
11
+ role: "list",
12
+ className: "divide-y divide-neutral-50"
13
+ }, data.map(function (row, key) {
14
+ return /*#__PURE__*/React.createElement("li", {
15
+ key: key,
16
+ className: ""
17
+ }, /*#__PURE__*/React.createElement("div", {
18
+ className: "flex items-center justify-between last:pr-[16px]"
19
+ }, row.map(function (item, key) {
20
+ return /*#__PURE__*/React.createElement("div", {
21
+ key: key,
22
+ className: ""
23
+ }, /*#__PURE__*/React.createElement(Cell, {
24
+ value: item.value,
25
+ type: item.type,
26
+ component: component
27
+ }));
28
+ })));
29
+ })));
30
+ };
@@ -0,0 +1 @@
1
+ export { List } from "./List";
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+ export var Loader = function Loader() {
3
+ var isBrowser = typeof window !== "undefined";
4
+ var lottieContainer = React.useRef(null);
5
+ ;
6
+ React.useEffect(function () {
7
+ if (!!isBrowser) {
8
+ var w = window;
9
+ console.log('w.bodymovin', w.bodymovin);
10
+ if (w.bodymovin) {
11
+ w.bodymovin.loadAnimation({
12
+ container: lottieContainer.current,
13
+ renderer: 'svg',
14
+ loop: true,
15
+ autoplay: true,
16
+ path: 'https://assets10.lottiefiles.com/packages/lf20_phmllabo.json'
17
+ });
18
+ }
19
+ }
20
+ }, []);
21
+ return /*#__PURE__*/React.createElement("div", {
22
+ className: "flex justify-center mb-[20px]"
23
+ }, /*#__PURE__*/React.createElement("div", {
24
+ ref: lottieContainer,
25
+ className: "w-[200px] h-[200px]"
26
+ }));
27
+ };
@@ -0,0 +1 @@
1
+ export { Loader } from "./Loader";
@@ -0,0 +1,102 @@
1
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
2
+ 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."); }
3
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
4
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
5
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
7
+ import { Dialog, Transition } from '@headlessui/react';
8
+ import React, { Fragment } from 'react';
9
+ import clsx from 'clsx';
10
+ // import { XIcon, ArrowsExpandIcon } from '@heroicons/react/outline';
11
+
12
+ export var Modal = function Modal(_ref) {
13
+ var children = _ref.children,
14
+ initialState = _ref.initialState,
15
+ _ref$padding = _ref.padding,
16
+ padding = _ref$padding === void 0 ? 'small' : _ref$padding,
17
+ _ref$size = _ref.size,
18
+ size = _ref$size === void 0 ? 'small' : _ref$size,
19
+ _ref$align = _ref.align,
20
+ align = _ref$align === void 0 ? 'center' : _ref$align,
21
+ _ref$overlay = _ref.overlay,
22
+ overlay = _ref$overlay === void 0 ? false : _ref$overlay,
23
+ _ref$showBar = _ref.showBar,
24
+ showBar = _ref$showBar === void 0 ? false : _ref$showBar,
25
+ _ref$overflow = _ref.overflow,
26
+ overflow = _ref$overflow === void 0 ? false : _ref$overflow,
27
+ closeModal = _ref.closeModal,
28
+ _ref$closable = _ref.closable,
29
+ closable = _ref$closable === void 0 ? true : _ref$closable,
30
+ theme = _ref.theme;
31
+ var cancelButtonRef = React.useRef(null);
32
+ var _React$useState = React.useState(false),
33
+ _React$useState2 = _slicedToArray(_React$useState, 2),
34
+ expanded = _React$useState2[0],
35
+ setExpanded = _React$useState2[1];
36
+ var modalStyle = clsx("".concat(theme, " inline-block"), size === 'small' && 'w-full max-w-md', size === 'medium' && 'w-full max-w-2xl', size === 'large' && 'w-full max-w-4xl', size === 'fit' && 'w-fit', align === 'right' && 'mr-[20px]', expanded && 'max-w-full h-screen', !expanded && 'rounded-[20px] p-[4px]', "text-left align-middle transition-all transform shadow-xl");
37
+ var containerStyle = clsx(padding === 'small' && 'p-2', padding === 'medium' && 'p-4', padding === 'large' && 'p-[40px]');
38
+ var barStyle = clsx(!expanded && 'rounded-tl-[16px] rounded-tr-[16px]', 'bg-neutral-100 w-full h-8 flex p-2');
39
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Transition.Root, {
40
+ show: initialState,
41
+ as: Fragment
42
+ }, /*#__PURE__*/React.createElement(Dialog, {
43
+ as: "div",
44
+ "auto-reopen": "true",
45
+ className: "fixed inset-0 z-10 overflow-y-auto",
46
+ initialFocus: cancelButtonRef,
47
+ onClose: closable ? closeModal : function () {
48
+ return closable;
49
+ }
50
+ }, /*#__PURE__*/React.createElement("div", {
51
+ className: "block items-end justify-end min-h-screen ".concat(align === 'center' ? 'text-center' : 'text-right')
52
+ }, /*#__PURE__*/React.createElement(Transition.Child, {
53
+ as: Fragment,
54
+ enter: "ease-out duration-300",
55
+ enterFrom: "opacity-0",
56
+ enterTo: "opacity-100",
57
+ leave: "ease-in duration-200",
58
+ leaveFrom: "opacity-100",
59
+ leaveTo: "opacity-0"
60
+ }, /*#__PURE__*/React.createElement("div", {
61
+ className: "fixed inset-0 transition-opacity bg-gray-500 bg-opacity-75"
62
+ })), /*#__PURE__*/React.createElement("span", {
63
+ className: "inline-block h-screen align-middle",
64
+ "aria-hidden": "true"
65
+ }), /*#__PURE__*/React.createElement(Transition.Child, {
66
+ as: Fragment,
67
+ enter: "ease-out duration-300",
68
+ enterFrom: "opacity-0 translate-y-40",
69
+ enterTo: "opacity-100 translate-y-0",
70
+ leave: "ease-in duration-200",
71
+ leaveFrom: "opacity-100 translate-y-0",
72
+ leaveTo: "opacity-0 -translate-y-40"
73
+ }, /*#__PURE__*/React.createElement(Dialog.Panel, {
74
+ className: modalStyle
75
+ }, /*#__PURE__*/React.createElement("div", {
76
+ className: "bg-neutral-100 ".concat(!expanded ? 'rounded-[16px]' : 'h-full', " ").concat(!!overflow ? 'overflow-hidden' : '')
77
+ }, showBar && /*#__PURE__*/React.createElement("div", {
78
+ className: barStyle
79
+ }, /*#__PURE__*/React.createElement("div", {
80
+ className: "flex justify-between items-center"
81
+ }, /*#__PURE__*/React.createElement("div", {
82
+ className: "flex justify-start"
83
+ }, /*#__PURE__*/React.createElement("button", {
84
+ type: "button",
85
+ className: "bg-red-400 text-red-400 rounded-full p-1 hover:text-red-100 hover:bg-red-500 focus:outline-none",
86
+ onClick: closeModal
87
+ }, /*#__PURE__*/React.createElement("span", {
88
+ className: "sr-only"
89
+ }, "Close")), /*#__PURE__*/React.createElement("button", {
90
+ type: "button",
91
+ className: "ml-2 bg-green-400 text-green-400 rounded-full p-1 hover:text-green-100 hover:bg-green-500 focus:outline-none",
92
+ onClick: function onClick() {
93
+ return setExpanded(!expanded);
94
+ }
95
+ }, /*#__PURE__*/React.createElement("span", {
96
+ className: "sr-only"
97
+ }, "Close"))))), /*#__PURE__*/React.createElement("div", {
98
+ className: containerStyle
99
+ }, /*#__PURE__*/React.createElement("div", {
100
+ className: padding === 'none' ? '' : 'mt-4'
101
+ }, children)))))))));
102
+ };
@@ -0,0 +1 @@
1
+ export { Modal } from "./Modal";
@@ -0,0 +1,39 @@
1
+ /* This example requires Tailwind CSS v2.0+ */
2
+ import React, { Fragment } from 'react';
3
+ import { Transition } from '@headlessui/react';
4
+ // import { CheckCircleIcon } from '@heroicons/react/outline';
5
+ // import { XIcon } from '@heroicons/react/solid';
6
+
7
+ export var Notification = function Notification(_ref) {
8
+ var content = _ref.content,
9
+ initialState = _ref.initialState,
10
+ closeNotification = _ref.closeNotification;
11
+ var title = content.title;
12
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
13
+ "aria-live": "assertive",
14
+ className: "fixed bottom-0 w-full items-end px-4 py-6 pointer-events-none sm:p-6 sm:items-start"
15
+ }, /*#__PURE__*/React.createElement("div", {
16
+ className: "w-full flex flex-col items-center space-y-4 drop-shadow"
17
+ }, /*#__PURE__*/React.createElement(Transition, {
18
+ show: initialState,
19
+ as: Fragment,
20
+ enter: "transform ease-out duration-300 transition",
21
+ enterFrom: "translate-y-2 opacity-0 sm:translate-y-0 sm:translate-x-2",
22
+ enterTo: "translate-y-0 opacity-100 sm:translate-x-0",
23
+ leave: "transition ease-in duration-100",
24
+ leaveFrom: "opacity-100",
25
+ leaveTo: "opacity-0"
26
+ }, /*#__PURE__*/React.createElement("div", {
27
+ className: "transition-opacity duration-500 max-w-[400px] w-full bg-neutral-100 shadow-lg rounded-[20px] pointer-events-auto ring-1 ring-black ring-opacity-5 overflow-hidden"
28
+ }, /*#__PURE__*/React.createElement("div", {
29
+ className: "p-[20px]"
30
+ }, /*#__PURE__*/React.createElement("div", {
31
+ className: "flex items-start"
32
+ }, /*#__PURE__*/React.createElement("div", {
33
+ className: "flex-shrink-0"
34
+ }), /*#__PURE__*/React.createElement("div", {
35
+ className: "ml-3 w-0 flex-1 pt-0.5"
36
+ }, /*#__PURE__*/React.createElement("p", {
37
+ className: "mt-1 text-p1-medium text-center text-neutral-1800"
38
+ }, title)))))))));
39
+ };
@@ -0,0 +1 @@
1
+ export { Notification } from "./Notification";