@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.
- package/LICENSE +73 -0
- package/README.md +142 -0
- package/lib/assets/icons.js +67 -0
- package/lib/components/AccountOverview/AccountOverview.js +122 -0
- package/lib/components/AdminPanel.js +58 -0
- package/lib/components/AssetExchange/AssetExchange.js +189 -0
- package/lib/components/AuthenticationFlow.js +216 -0
- package/lib/components/ConversationInterface/ConversationInterface.js +232 -0
- package/lib/components/DevFooter.js +38 -0
- package/lib/components/DevMenu.js +35 -0
- package/lib/components/DevSidebar.js +28 -0
- package/lib/components/DigitalDisplay.js +83 -0
- package/lib/components/Footer.js +45 -0
- package/lib/components/HeroContainer.js +10 -0
- package/lib/components/IntentRecognition/IntentRecognition.js +174 -0
- package/lib/components/Logo.js +259 -0
- package/lib/components/MenuBar.js +56 -0
- package/lib/components/NetworkSettings.js +223 -0
- package/lib/components/RecoverySetup/RecoverySetup.js +354 -0
- package/lib/components/RisingSun.js +122 -0
- package/lib/components/Symbol.js +226 -0
- package/lib/components/TransactionComposer/TransactionComposer.js +258 -0
- package/lib/components/TransactionConfirmation.js +184 -0
- package/lib/components/WalletMenu.js +33 -0
- package/lib/components/console/code/CodeBlock.js +150 -0
- package/lib/components/console/code/index.js +9 -0
- package/lib/components/console/data/DataTable.js +245 -0
- package/lib/components/console/data/MetricCard.js +79 -0
- package/lib/components/console/data/index.js +11 -0
- package/lib/components/console/documentation/index.js +10 -0
- package/lib/components/console/forms/APIKeyGenerator.js +261 -0
- package/lib/components/console/forms/SearchBar.js +210 -0
- package/lib/components/console/forms/index.js +10 -0
- package/lib/components/console/index.js +29 -0
- package/lib/components/console/layout/ConsoleCard.js +82 -0
- package/lib/components/console/layout/ConsoleLayout.js +86 -0
- package/lib/components/console/layout/index.js +10 -0
- package/lib/components/console/monitoring/StatusIndicator.js +128 -0
- package/lib/components/console/monitoring/index.js +9 -0
- package/lib/components/console/navigation/DevFooter.js +38 -0
- package/lib/components/console/navigation/DevMenu.js +35 -0
- package/lib/components/console/navigation/DevSidebar.js +28 -0
- package/lib/components/console/navigation/index.js +11 -0
- package/lib/components/console/settings/index.js +10 -0
- package/lib/components/index.js +12 -0
- package/lib/design/ColorPicker.stories.js +9 -0
- package/lib/design/HSLTool-V1.js +345 -0
- package/lib/design/HSLTool-V2.js +475 -0
- package/lib/design/HSLTool-V3.js +543 -0
- package/lib/design/HSLTool-V4.js +1139 -0
- package/lib/design/HSLTool.js +374 -0
- package/lib/design/OKLCHColorPicker.stories.js +24 -0
- package/lib/design/OKLCHTool.js +1014 -0
- package/lib/index.js +4 -0
- package/lib/shared/components/Avatar/Avatar.js +18 -0
- package/lib/shared/components/Avatar/index.js +1 -0
- package/lib/shared/components/Badge/Badge.js +34 -0
- package/lib/shared/components/Badge/index.js +1 -0
- package/lib/shared/components/Breadcrumb/Breadcrumb.js +13 -0
- package/lib/shared/components/Breadcrumb/index.js +1 -0
- package/lib/shared/components/Button/Button.js +184 -0
- package/lib/shared/components/Button/index.js +1 -0
- package/lib/shared/components/Calendar/Calendar.js +155 -0
- package/lib/shared/components/Calendar/CalendarDay.js +251 -0
- package/lib/shared/components/Calendar/CalendarHeader.js +88 -0
- package/lib/shared/components/Calendar/CalendarMonth.js +106 -0
- package/lib/shared/components/Calendar/CalendarWeek.js +267 -0
- package/lib/shared/components/Calendar/constants.js +73 -0
- package/lib/shared/components/Calendar/index.js +3 -0
- package/lib/shared/components/Calendar/types.d.js +0 -0
- package/lib/shared/components/Cartel/Cartel.js +44 -0
- package/lib/shared/components/Cartel/index.js +1 -0
- package/lib/shared/components/Cell/Cell.js +105 -0
- package/lib/shared/components/Cell/index.js +1 -0
- package/lib/shared/components/Checkbox/Checkbox.js +27 -0
- package/lib/shared/components/Checkbox/index.js +1 -0
- package/lib/shared/components/Clock/Clock.js +6 -0
- package/lib/shared/components/Clock/index.js +1 -0
- package/lib/shared/components/ColorChecker/ColorChecker.js +89 -0
- package/lib/shared/components/ColorChecker/index.js +2 -0
- package/lib/shared/components/ColorChecker/utils.js +159 -0
- package/lib/shared/components/Command/Command.js +95 -0
- package/lib/shared/components/Command/index.js +1 -0
- package/lib/shared/components/Container/Container.js +18 -0
- package/lib/shared/components/Container/index.js +1 -0
- package/lib/shared/components/Cover/Cover.js +17 -0
- package/lib/shared/components/Cover/index.js +1 -0
- package/lib/shared/components/DatePicker/DatePicker.js +52 -0
- package/lib/shared/components/DatePicker/components/Calendar.js +125 -0
- package/lib/shared/components/DatePicker/components/CalendarDay.js +23 -0
- package/lib/shared/components/DatePicker/components/DateWrapper.js +15 -0
- package/lib/shared/components/DatePicker/components/index.js +2 -0
- package/lib/shared/components/DatePicker/index.js +1 -0
- package/lib/shared/components/DateTime/DateTime.js +51 -0
- package/lib/shared/components/DateTime/index.js +1 -0
- package/lib/shared/components/Debug/Debug.js +12 -0
- package/lib/shared/components/Debug/index.js +1 -0
- package/lib/shared/components/Disclosure/Disclosure.js +31 -0
- package/lib/shared/components/Disclosure/index.js +1 -0
- package/lib/shared/components/Dropdown/Dropdown.js +91 -0
- package/lib/shared/components/Dropdown/index.js +1 -0
- package/lib/shared/components/EmptyState/EmptyState.js +40 -0
- package/lib/shared/components/EmptyState/index.js +1 -0
- package/lib/shared/components/Form/Form.js +41 -0
- package/lib/shared/components/Form/components/DynamicForm.js +66 -0
- package/lib/shared/components/Form/components/StepperForm.js +266 -0
- package/lib/shared/components/Form/components/index.js +2 -0
- package/lib/shared/components/Form/context/Form.js +164 -0
- package/lib/shared/components/Form/context/index.js +1 -0
- package/lib/shared/components/Form/index.js +1 -0
- package/lib/shared/components/Form/types.d.js +1 -0
- package/lib/shared/components/Form/utils/index.js +31 -0
- package/lib/shared/components/GroupItems/GroupItems.js +17 -0
- package/lib/shared/components/GroupItems/index.js +1 -0
- package/lib/shared/components/Header/Header.js +26 -0
- package/lib/shared/components/Header/index.js +1 -0
- package/lib/shared/components/Heading/Heading.js +5 -0
- package/lib/shared/components/Heading/index.js +1 -0
- package/lib/shared/components/Icon/Icon.js +28 -0
- package/lib/shared/components/Icon/index.js +1 -0
- package/lib/shared/components/Identicons/Identicons.js +6 -0
- package/lib/shared/components/Identicons/index.d.js +0 -0
- package/lib/shared/components/Identicons/index.js +1 -0
- package/lib/shared/components/Image/Image.js +22 -0
- package/lib/shared/components/Image/index.js +1 -0
- package/lib/shared/components/Input/Input.js +201 -0
- package/lib/shared/components/Input/components/CheckBoxInput.js +81 -0
- package/lib/shared/components/Input/components/DateInput.js +89 -0
- package/lib/shared/components/Input/components/DefaultInput.js +102 -0
- package/lib/shared/components/Input/components/FileReaderInput.js +88 -0
- package/lib/shared/components/Input/components/NumberInput.js +141 -0
- package/lib/shared/components/Input/components/PickerInput.js +122 -0
- package/lib/shared/components/Input/components/RCInput.js +112 -0
- package/lib/shared/components/Input/components/Radiobox/RadioboxBasic.js +56 -0
- package/lib/shared/components/Input/components/Radiobox/RadioboxCard.js +27 -0
- package/lib/shared/components/Input/components/Radiobox/RadioboxFull.js +44 -0
- package/lib/shared/components/Input/components/Radiobox/index.js +3 -0
- package/lib/shared/components/Input/components/RadioboxInput.js +102 -0
- package/lib/shared/components/Input/components/SelectInput.js +70 -0
- package/lib/shared/components/Input/components/TextAreaInput.js +67 -0
- package/lib/shared/components/Input/components/TextInput.js +139 -0
- package/lib/shared/components/Input/components/TimeInput.js +37 -0
- package/lib/shared/components/Input/components/UploadFileInput.js +123 -0
- package/lib/shared/components/Input/components/index.js +13 -0
- package/lib/shared/components/Input/components/types.d.js +0 -0
- package/lib/shared/components/Input/index.js +1 -0
- package/lib/shared/components/Input/types.d.js +0 -0
- package/lib/shared/components/Layout/Layout.js +13 -0
- package/lib/shared/components/Layout/index.js +1 -0
- package/lib/shared/components/List/List.js +30 -0
- package/lib/shared/components/List/index.js +1 -0
- package/lib/shared/components/Loader/Loader.js +27 -0
- package/lib/shared/components/Loader/index.js +1 -0
- package/lib/shared/components/Modal/Modal.js +102 -0
- package/lib/shared/components/Modal/index.js +1 -0
- package/lib/shared/components/Notification/Notification.js +39 -0
- package/lib/shared/components/Notification/index.js +1 -0
- package/lib/shared/components/Person/Person.js +81 -0
- package/lib/shared/components/Person/index.js +1 -0
- package/lib/shared/components/Popover/Popover.js +39 -0
- package/lib/shared/components/Popover/index.js +1 -0
- package/lib/shared/components/QRCode/QRCode.js +329 -0
- package/lib/shared/components/QRCode/index.js +1 -0
- package/lib/shared/components/RadioGroup/RadioGroup.js +35 -0
- package/lib/shared/components/RadioGroup/components/DefaultGroup.js +71 -0
- package/lib/shared/components/RadioGroup/components/VerticalGroup.js +83 -0
- package/lib/shared/components/RadioGroup/components/index.js +2 -0
- package/lib/shared/components/RadioGroup/index.js +1 -0
- package/lib/shared/components/Search/Search.js +12 -0
- package/lib/shared/components/Search/index.js +1 -0
- package/lib/shared/components/Select/Select.js +90 -0
- package/lib/shared/components/Select/index.js +1 -0
- package/lib/shared/components/Sidebar/Sidebar.js +42 -0
- package/lib/shared/components/Sidebar/index.js +1 -0
- package/lib/shared/components/SlideOver/SlideOver.js +81 -0
- package/lib/shared/components/SlideOver/index.js +1 -0
- package/lib/shared/components/Slider/Slider.js +80 -0
- package/lib/shared/components/Slider/index.js +1 -0
- package/lib/shared/components/Stepper/Stepper.js +32 -0
- package/lib/shared/components/Stepper/index.js +1 -0
- package/lib/shared/components/Steps/Steps.js +53 -0
- package/lib/shared/components/Steps/index.js +1 -0
- package/lib/shared/components/Switch/Switch.js +26 -0
- package/lib/shared/components/Switch/index.js +1 -0
- package/lib/shared/components/Tab/Tab.js +59 -0
- package/lib/shared/components/Tab/index.js +1 -0
- package/lib/shared/components/Table/Table.js +47 -0
- package/lib/shared/components/Table/index.js +1 -0
- package/lib/shared/components/Text/Text.js +11 -0
- package/lib/shared/components/Text/index.js +1 -0
- package/lib/shared/components/TextList/TextList.js +15 -0
- package/lib/shared/components/TextList/index.js +1 -0
- package/lib/shared/components/TimePicker/TimePicker.js +161 -0
- package/lib/shared/components/TimePicker/index.js +1 -0
- package/lib/shared/components/Tooltip/Tooltip.js +13 -0
- package/lib/shared/components/Tooltip/index.js +1 -0
- package/lib/shared/components/Uploader/Uploader.js +63 -0
- package/lib/shared/components/Uploader/index.js +1 -0
- package/lib/shared/components/Video/Video.js +20 -0
- package/lib/shared/components/Video/index.js +1 -0
- package/lib/shared/components/index.d.js +0 -0
- package/lib/shared/components/index.js +50 -0
- package/lib/shared/elements/Color/ColorPallet.js +20 -0
- package/lib/shared/elements/Color/index.js +1 -0
- package/lib/shared/elements/Text.js +37 -0
- package/lib/shared/elements/index.js +1 -0
- package/lib/shared/helpers/FakeLink.js +8 -0
- package/lib/shared/helpers/constants.js +359 -0
- package/lib/shared/helpers/index.js +2 -0
- package/lib/shared/helpers/isEqual.js +56 -0
- package/lib/shared/index.d.js +0 -0
- package/lib/shared/index.js +1 -0
- package/lib/shared/stories/components/Avatar.stories.js +17 -0
- package/lib/shared/stories/components/Badge.stories.dev.js +37 -0
- package/lib/shared/stories/components/Button.stories.js +553 -0
- package/lib/shared/stories/components/Calendar.stories.js +62 -0
- package/lib/shared/stories/components/Cartel.stories.js +32 -0
- package/lib/shared/stories/components/Checkbox.stories.js +15 -0
- package/lib/shared/stories/components/ColorChecker.stories.dev.js +16 -0
- package/lib/shared/stories/components/DateTime.stories.js +27 -0
- package/lib/shared/stories/components/Disclosure.stories.js +30 -0
- package/lib/shared/stories/components/Dropdown.stories.js +39 -0
- package/lib/shared/stories/components/Form/Default.stories.js +201 -0
- package/lib/shared/stories/components/Form/DummyForm.stories.js +48 -0
- package/lib/shared/stories/components/Form/DynamicForm.stories.js +155 -0
- package/lib/shared/stories/components/Form/StepperForm.stories.js +138 -0
- package/lib/shared/stories/components/Form/ValidateForm.stories.js +70 -0
- package/lib/shared/stories/components/Form/Validation.stories.js +184 -0
- package/lib/shared/stories/components/GroupItems.stories.js +23 -0
- package/lib/shared/stories/components/Header.stories.js +29 -0
- package/lib/shared/stories/components/Heading.stories.js +27 -0
- package/lib/shared/stories/components/Icon.stories.js +22 -0
- package/lib/shared/stories/components/Image.stories.js +23 -0
- package/lib/shared/stories/components/Input/Checkbox.stories.js +45 -0
- package/lib/shared/stories/components/Input/DatePicker.stories.js +23 -0
- package/lib/shared/stories/components/Input/Defaut.stories.js +24 -0
- package/lib/shared/stories/components/Input/Number.stories.js +24 -0
- package/lib/shared/stories/components/Input/RCI.stories.js +59 -0
- package/lib/shared/stories/components/Input/Radiobox.stories.dev.js +28 -0
- package/lib/shared/stories/components/Input/Select.stories.dev.js +27 -0
- package/lib/shared/stories/components/Input/SelectMultiple.stories.dev.js +510 -0
- package/lib/shared/stories/components/Input/Textarea.stories.js +24 -0
- package/lib/shared/stories/components/List.stories.js +34 -0
- package/lib/shared/stories/components/Loader.stories.js +15 -0
- package/lib/shared/stories/components/Modal.stories.js +50 -0
- package/lib/shared/stories/components/Notification.stories.js +22 -0
- package/lib/shared/stories/components/Person.stories.js +41 -0
- package/lib/shared/stories/components/Picker.stories.js +15 -0
- package/lib/shared/stories/components/Popover.stories.js +36 -0
- package/lib/shared/stories/components/QRCode.stories.js +20 -0
- package/lib/shared/stories/components/RadioGroup.stories.js +56 -0
- package/lib/shared/stories/components/Select.stories.js +50 -0
- package/lib/shared/stories/components/Sidebar.stories.js +35 -0
- package/lib/shared/stories/components/Slider.stories.dev.js +48 -0
- package/lib/shared/stories/components/Stepper/Stepper.stories.js +38 -0
- package/lib/shared/stories/components/Steps.stories.js +15 -0
- package/lib/shared/stories/components/Switch.stories.js +15 -0
- package/lib/shared/stories/components/Tab.stories.js +15 -0
- package/lib/shared/stories/components/Table.stories.js +95 -0
- package/lib/shared/stories/components/TextList.stories.js +23 -0
- package/lib/shared/stories/components/Tooltip.stories.dev.js +40 -0
- package/lib/shared/stories/elements/Color.stories.js +269 -0
- package/lib/shared/stories/elements/Text.stories.js +45 -0
- package/lib/shared/types/index.js +1 -0
- package/lib/stories/Foundation/BrandIdentity.prod.stories.js +510 -0
- package/lib/stories/Foundation/Logo.stories.js +19 -0
- package/lib/stories/Foundation/RisingSun.stories.js +16 -0
- package/lib/stories/Foundation/Shadows.stories.js +601 -0
- package/lib/stories/Foundation/Symbol.stories.js +18 -0
- package/lib/stories/HeroContainer.stories.js +18 -0
- package/lib/styles/accessibilityTokens.js +72 -0
- package/lib/styles/borderWidth.js +10 -0
- package/lib/styles/colors.js +303 -0
- package/lib/styles/elevation.js +240 -0
- package/lib/styles/icons.js +218 -0
- package/lib/styles/index.js +29 -0
- package/lib/styles/motion.js +668 -0
- package/lib/styles/opacity.js +10 -0
- package/lib/styles/radius.js +11 -0
- package/lib/styles/sizing.js +35 -0
- package/lib/styles/space.js +24 -0
- package/lib/styles/theme/darkTheme.js +471 -0
- package/lib/styles/theme/index.js +44 -0
- package/lib/styles/theme/lightTheme.js +480 -0
- package/lib/styles/theme/themeTypes.js +1 -0
- package/lib/styles/theme/themeUtils.js +63 -0
- package/lib/styles/typography-advanced.js +510 -0
- package/lib/styles/typography.js +1419 -0
- package/lib/styles/zIndex.js +19 -0
- package/lib/tokens/borders.js +161 -0
- package/lib/tokens/colors.js +426 -0
- package/lib/tokens/components.js +499 -0
- package/lib/tokens/index.js +84 -0
- package/lib/tokens/lighting.js +384 -0
- package/lib/tokens/motion.js +284 -0
- package/lib/tokens/semantic.js +367 -0
- package/lib/tokens/shadows.js +114 -0
- package/lib/tokens/spacing.js +189 -0
- package/lib/tokens/typography.js +268 -0
- package/package.json +176 -0
- package/styles/generated-tokens.css +677 -0
- package/styles/index.css +2 -0
- package/styles/main.css +610 -0
- package/tailwind.config.js +64 -0
|
@@ -0,0 +1,164 @@
|
|
|
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 { getFields } from "../utils";
|
|
13
|
+
import { Debug } from "../../Debug";
|
|
14
|
+
// Import FormField
|
|
15
|
+
|
|
16
|
+
export var FormContext = /*#__PURE__*/React.createContext({});
|
|
17
|
+
export var FormProvider = function FormProvider(_ref) {
|
|
18
|
+
var children = _ref.children,
|
|
19
|
+
fields = _ref.fields,
|
|
20
|
+
_ref$mode = _ref.mode,
|
|
21
|
+
mode = _ref$mode === void 0 ? 'action' : _ref$mode,
|
|
22
|
+
actionUrl = _ref.actionUrl,
|
|
23
|
+
action = _ref.action,
|
|
24
|
+
FormComponent = _ref.component,
|
|
25
|
+
_ref$preventDefault = _ref.preventDefault,
|
|
26
|
+
preventDefault = _ref$preventDefault === void 0 ? true : _ref$preventDefault,
|
|
27
|
+
debug = _ref.debug;
|
|
28
|
+
var formRef = /*#__PURE__*/React.createRef();
|
|
29
|
+
var _React$useState = React.useState(null),
|
|
30
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
31
|
+
formState = _React$useState2[0],
|
|
32
|
+
updateFormState = _React$useState2[1];
|
|
33
|
+
// Assuming getFields correctly processes FormField[][]
|
|
34
|
+
var fieldsState = React.useMemo(function () {
|
|
35
|
+
return getFields(fields);
|
|
36
|
+
}, [fields]);
|
|
37
|
+
var updateForm = React.useCallback(function () {
|
|
38
|
+
updateFormState(getFormData());
|
|
39
|
+
}, [formRef]); // Added dependency
|
|
40
|
+
|
|
41
|
+
var getFormData = React.useCallback(function () {
|
|
42
|
+
if (!formRef.current) return [];
|
|
43
|
+
var currentFormData = new FormData(formRef.current);
|
|
44
|
+
var data = [];
|
|
45
|
+
currentFormData.forEach(function (value, key) {
|
|
46
|
+
// Handle potential multiple values for checkboxes/multi-select if needed
|
|
47
|
+
data.push({
|
|
48
|
+
id: key,
|
|
49
|
+
value: value
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
// Alternative: manual iteration like before if FormData doesn't capture everything
|
|
53
|
+
// Consider inputs managed by React state outside the form if needed
|
|
54
|
+
return data;
|
|
55
|
+
}, [formRef]); // Added dependency
|
|
56
|
+
|
|
57
|
+
React.useEffect(function () {
|
|
58
|
+
updateFormState(getFormData());
|
|
59
|
+
}, [getFormData]); // Updated dependencies
|
|
60
|
+
|
|
61
|
+
// This effect might cause infinite loops if updateForm isn't stable
|
|
62
|
+
// Consider if it's still necessary or how to make it safer
|
|
63
|
+
// React.useEffect(() => {
|
|
64
|
+
// const newState = getFormData();
|
|
65
|
+
// if (JSON.stringify(newState) !== JSON.stringify(formState)) {
|
|
66
|
+
// updateFormState(newState);
|
|
67
|
+
// }
|
|
68
|
+
// }, [formState, getFormData]);
|
|
69
|
+
|
|
70
|
+
var handleSubmit = /*#__PURE__*/function () {
|
|
71
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(event) {
|
|
72
|
+
var currentFormState, formDataObject;
|
|
73
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
74
|
+
while (1) switch (_context.prev = _context.next) {
|
|
75
|
+
case 0:
|
|
76
|
+
currentFormState = getFormData(); // Get latest data on submit
|
|
77
|
+
updateFormState(currentFormState);
|
|
78
|
+
if (!(mode === 'action')) {
|
|
79
|
+
_context.next = 20;
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
event.preventDefault(); // Prevent default only in action mode
|
|
83
|
+
if (!debug) {
|
|
84
|
+
_context.next = 8;
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
console.log('DEBUG FORM ON 🐛:', currentFormState);
|
|
88
|
+
_context.next = 18;
|
|
89
|
+
break;
|
|
90
|
+
case 8:
|
|
91
|
+
if (!(typeof action === 'function')) {
|
|
92
|
+
_context.next = 18;
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
_context.prev = 9;
|
|
96
|
+
// Convert array state to object for the action function
|
|
97
|
+
formDataObject = currentFormState.reduce(function (acc, _ref3) {
|
|
98
|
+
var id = _ref3.id,
|
|
99
|
+
value = _ref3.value;
|
|
100
|
+
acc[id] = value;
|
|
101
|
+
return acc;
|
|
102
|
+
}, {});
|
|
103
|
+
_context.next = 13;
|
|
104
|
+
return action(formDataObject);
|
|
105
|
+
case 13:
|
|
106
|
+
_context.next = 18;
|
|
107
|
+
break;
|
|
108
|
+
case 15:
|
|
109
|
+
_context.prev = 15;
|
|
110
|
+
_context.t0 = _context["catch"](9);
|
|
111
|
+
console.error('There has been a problem with the form action:', _context.t0);
|
|
112
|
+
// Handle action errors appropriately (e.g., display message to user)
|
|
113
|
+
case 18:
|
|
114
|
+
_context.next = 21;
|
|
115
|
+
break;
|
|
116
|
+
case 20:
|
|
117
|
+
if (mode === 'form') {
|
|
118
|
+
// Allow default form submission to actionUrl
|
|
119
|
+
if (debug) {
|
|
120
|
+
console.log('DEBUG FORM ON (native submit) 🐛:', currentFormState);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
case 21:
|
|
124
|
+
case "end":
|
|
125
|
+
return _context.stop();
|
|
126
|
+
}
|
|
127
|
+
}, _callee, null, [[9, 15]]);
|
|
128
|
+
}));
|
|
129
|
+
return function handleSubmit(_x) {
|
|
130
|
+
return _ref2.apply(this, arguments);
|
|
131
|
+
};
|
|
132
|
+
}();
|
|
133
|
+
var providerValue = React.useMemo(function () {
|
|
134
|
+
return {
|
|
135
|
+
fieldsState: fieldsState,
|
|
136
|
+
updateForm: updateForm,
|
|
137
|
+
formState: formState
|
|
138
|
+
};
|
|
139
|
+
}, [fieldsState, updateForm, formState]); // Memoize context value
|
|
140
|
+
|
|
141
|
+
return /*#__PURE__*/React.createElement(FormContext.Provider, {
|
|
142
|
+
value: providerValue
|
|
143
|
+
}, FormComponent ? /*#__PURE__*/React.createElement(FormComponent, {
|
|
144
|
+
method: "post",
|
|
145
|
+
action: actionUrl || '',
|
|
146
|
+
ref: formRef,
|
|
147
|
+
onSubmit: handleSubmit
|
|
148
|
+
}, children) : /*#__PURE__*/React.createElement("form", {
|
|
149
|
+
method: "post",
|
|
150
|
+
action: actionUrl || '',
|
|
151
|
+
ref: formRef,
|
|
152
|
+
onSubmit: handleSubmit
|
|
153
|
+
}, children), debug && formState && /*#__PURE__*/React.createElement(Debug, null, formState.map(function (_ref4, index) {
|
|
154
|
+
var id = _ref4.id,
|
|
155
|
+
value = _ref4.value;
|
|
156
|
+
// Added key
|
|
157
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
158
|
+
key: id || index
|
|
159
|
+
}, " ", id, ": ", String(value), " ");
|
|
160
|
+
})));
|
|
161
|
+
};
|
|
162
|
+
export var useForm = function useForm() {
|
|
163
|
+
return React.useContext(FormContext);
|
|
164
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useForm, FormContext, FormProvider } from "./Form";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Form } from "./Form";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
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 ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
export var getFields = function getFields(fields) {
|
|
8
|
+
return fields.map(function (item) {
|
|
9
|
+
var isArr = Object.prototype.toString.call(item) == '[object Array]';
|
|
10
|
+
if (isArr) {
|
|
11
|
+
var output = item.map(function (_ref) {
|
|
12
|
+
var field = _ref.field,
|
|
13
|
+
title = _ref.title,
|
|
14
|
+
description = _ref.description;
|
|
15
|
+
return _objectSpread(_objectSpread({}, field), {}, {
|
|
16
|
+
title: title,
|
|
17
|
+
description: description
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
return output;
|
|
21
|
+
} else {
|
|
22
|
+
var field = item.field,
|
|
23
|
+
title = item.title,
|
|
24
|
+
description = item.description;
|
|
25
|
+
return [_objectSpread(_objectSpread({}, field), {}, {
|
|
26
|
+
title: title,
|
|
27
|
+
description: description
|
|
28
|
+
})];
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Icon } from "../Icon";
|
|
3
|
+
export var GroupItems = function GroupItems(_ref) {
|
|
4
|
+
var items = _ref.items;
|
|
5
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
6
|
+
className: "grid grid-cols-2 gap-4 content-start p-[8px]"
|
|
7
|
+
}, items === null || items === void 0 ? void 0 : items.map(function (item, key) {
|
|
8
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
9
|
+
key: key,
|
|
10
|
+
className: "flex space-x-[4px] text-neutral-800"
|
|
11
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Icon, {
|
|
12
|
+
name: item[0]
|
|
13
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
14
|
+
className: "text-p3-bold text-neutral-900"
|
|
15
|
+
}, item[1]));
|
|
16
|
+
}));
|
|
17
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { GroupItems } from "./GroupItems";
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Button } from "../Button";
|
|
3
|
+
export var Header = function Header(_ref) {
|
|
4
|
+
var _ref$type = _ref.type,
|
|
5
|
+
type = _ref$type === void 0 ? 'SECTION' : _ref$type,
|
|
6
|
+
section = _ref.section,
|
|
7
|
+
page = _ref.page;
|
|
8
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
9
|
+
className: "sm:flex sm:items-center sm:justify-between h-v8 text-neutral-800"
|
|
10
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
11
|
+
className: "text-4xl font-bold leading-6 text-primary"
|
|
12
|
+
}, section === null || section === void 0 ? void 0 : section.title), /*#__PURE__*/React.createElement("div", {
|
|
13
|
+
className: "mt-3 flex sm:mt-0 sm:ml-4"
|
|
14
|
+
}, (section === null || section === void 0 ? void 0 : section.navOptions) && section.navOptions.map(function (_ref2, key) {
|
|
15
|
+
var title = _ref2.title,
|
|
16
|
+
action = _ref2.action,
|
|
17
|
+
icon = _ref2.icon;
|
|
18
|
+
return /*#__PURE__*/React.createElement(Button, {
|
|
19
|
+
key: key,
|
|
20
|
+
text: title,
|
|
21
|
+
icon: icon,
|
|
22
|
+
size: "small",
|
|
23
|
+
onClick: action
|
|
24
|
+
});
|
|
25
|
+
})));
|
|
26
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Header } from "./Header";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Heading } from "./Heading";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { icons } from "../../../assets/icons";
|
|
4
|
+
var Path = function Path(_ref) {
|
|
5
|
+
var name = _ref.name;
|
|
6
|
+
return /*#__PURE__*/React.createElement("path", {
|
|
7
|
+
d: icons["".concat(name)],
|
|
8
|
+
className: "w-full",
|
|
9
|
+
fill: "currentColor"
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
export var Icon = function Icon(_ref2) {
|
|
13
|
+
var name = _ref2.name,
|
|
14
|
+
color = _ref2.color,
|
|
15
|
+
_ref2$viewBox = _ref2.viewBox,
|
|
16
|
+
viewBox = _ref2$viewBox === void 0 ? "0 0 64 64" : _ref2$viewBox,
|
|
17
|
+
_ref2$size = _ref2.size,
|
|
18
|
+
size = _ref2$size === void 0 ? 'small' : _ref2$size,
|
|
19
|
+
customCss = _ref2.customCss;
|
|
20
|
+
var iconStyle = clsx(size === 'tiny' && 'w-[18px] h-[18px]', size === 'small' && 'w-[22px] h-[22px]', size === 'medium' && 'w-[30px] h-[30px]', size === 'large' && 'w-[36px] h-[36px]', size === 'xlarge' && 'w-[48px] h-[48px] flex justify-center', "".concat(customCss));
|
|
21
|
+
return /*#__PURE__*/React.createElement("svg", {
|
|
22
|
+
viewBox: viewBox,
|
|
23
|
+
className: iconStyle,
|
|
24
|
+
fill: "currentColor"
|
|
25
|
+
}, /*#__PURE__*/React.createElement(Path, {
|
|
26
|
+
name: name
|
|
27
|
+
}));
|
|
28
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Icon } from "./Icon";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
function _objectDestructuringEmpty(t) { if (null == t) throw new TypeError("Cannot destructure " + t); }
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export var Identicons = function Identicons(_ref) {
|
|
4
|
+
_objectDestructuringEmpty(_ref);
|
|
5
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
6
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Identicons } from "./Identicons";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
export var Image = function Image(_ref) {
|
|
4
|
+
var imageUrl = _ref.imageUrl,
|
|
5
|
+
customCss = _ref.customCss,
|
|
6
|
+
width = _ref.width,
|
|
7
|
+
height = _ref.height,
|
|
8
|
+
_ref$fullHeight = _ref.fullHeight,
|
|
9
|
+
fullHeight = _ref$fullHeight === void 0 ? false : _ref$fullHeight;
|
|
10
|
+
var style = clsx('bg-cover bg-center w-full h-full object-center object-cover', "".concat(customCss));
|
|
11
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
12
|
+
className: "w-[200px] ".concat(fullHeight ? 'h-full' : 'h-[200px]')
|
|
13
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
14
|
+
style: {
|
|
15
|
+
height: "".concat(height, "px"),
|
|
16
|
+
width: "".concat(width, "px")
|
|
17
|
+
},
|
|
18
|
+
className: style,
|
|
19
|
+
src: imageUrl,
|
|
20
|
+
alt: ""
|
|
21
|
+
}));
|
|
22
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Image } from "./Image";
|
|
@@ -0,0 +1,201 @@
|
|
|
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 ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
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; }
|
|
8
|
+
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); }
|
|
9
|
+
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); }); }; }
|
|
10
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
11
|
+
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."); }
|
|
12
|
+
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; } }
|
|
13
|
+
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; }
|
|
14
|
+
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; } }
|
|
15
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
16
|
+
import React from 'react';
|
|
17
|
+
import { useForm } from "../Form/context";
|
|
18
|
+
import { UploadFileInput, TextInput, TextAreaInput, SelectInput, DefaultInput, CheckBoxInput, RadioboxInput, NumberInput, PickerInput, RCInput, FileReaderInput, DateInput } from "./components";
|
|
19
|
+
import { DatePicker, TimePicker } from '..';
|
|
20
|
+
export var Input = function Input(_ref) {
|
|
21
|
+
var _ref$type = _ref.type,
|
|
22
|
+
type = _ref$type === void 0 ? 'text' : _ref$type,
|
|
23
|
+
_ref$id = _ref.id,
|
|
24
|
+
id = _ref$id === void 0 ? 'text' : _ref$id,
|
|
25
|
+
variant = _ref.variant,
|
|
26
|
+
_ref$autoComplete = _ref.autoComplete,
|
|
27
|
+
autoComplete = _ref$autoComplete === void 0 ? 'off' : _ref$autoComplete,
|
|
28
|
+
label = _ref.label,
|
|
29
|
+
placeholder = _ref.placeholder,
|
|
30
|
+
disabled = _ref.disabled,
|
|
31
|
+
populateOptions = _ref.populateOptions,
|
|
32
|
+
maxLength = _ref.maxLength,
|
|
33
|
+
uploadFile = _ref.uploadFile,
|
|
34
|
+
defaultValue = _ref.defaultValue,
|
|
35
|
+
belongs_to = _ref.belongs_to,
|
|
36
|
+
validation = _ref.validation,
|
|
37
|
+
icon = _ref.icon,
|
|
38
|
+
afterChange = _ref.afterChange,
|
|
39
|
+
options = _ref.options,
|
|
40
|
+
hidden = _ref.hidden,
|
|
41
|
+
_ref$debug = _ref.debug,
|
|
42
|
+
debug = _ref$debug === void 0 ? false : _ref$debug,
|
|
43
|
+
required = _ref.required,
|
|
44
|
+
multiple = _ref.multiple;
|
|
45
|
+
var _useForm = useForm(),
|
|
46
|
+
fieldsState = _useForm.fieldsState,
|
|
47
|
+
formState = _useForm.formState;
|
|
48
|
+
var _React$useState = React.useState(defaultValue),
|
|
49
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
50
|
+
value = _React$useState2[0],
|
|
51
|
+
setValue = _React$useState2[1];
|
|
52
|
+
var _React$useState3 = React.useState([]),
|
|
53
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
54
|
+
dependencies = _React$useState4[0],
|
|
55
|
+
setDependencies = _React$useState4[1];
|
|
56
|
+
React.useEffect(function () {
|
|
57
|
+
var field = fieldsState.map(function (fields) {
|
|
58
|
+
return fields.find(function (e) {
|
|
59
|
+
return e.id === id;
|
|
60
|
+
});
|
|
61
|
+
}).filter(function (e) {
|
|
62
|
+
return !!e;
|
|
63
|
+
})[0];
|
|
64
|
+
field.value && setValue(field.value);
|
|
65
|
+
}, []);
|
|
66
|
+
React.useEffect(function () {
|
|
67
|
+
if (belongs_to && populateOptions && formState) {
|
|
68
|
+
_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
69
|
+
var parentValue, options;
|
|
70
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
71
|
+
while (1) switch (_context.prev = _context.next) {
|
|
72
|
+
case 0:
|
|
73
|
+
parentValue = formState.map(function (field) {
|
|
74
|
+
return field.id === belongs_to ? field.value : undefined;
|
|
75
|
+
}).filter(function (item) {
|
|
76
|
+
return typeof item === 'string';
|
|
77
|
+
})[0];
|
|
78
|
+
_context.next = 3;
|
|
79
|
+
return populateOptions({
|
|
80
|
+
value: parentValue,
|
|
81
|
+
name: ''
|
|
82
|
+
});
|
|
83
|
+
case 3:
|
|
84
|
+
options = _context.sent;
|
|
85
|
+
setDependencies(options);
|
|
86
|
+
case 5:
|
|
87
|
+
case "end":
|
|
88
|
+
return _context.stop();
|
|
89
|
+
}
|
|
90
|
+
}, _callee);
|
|
91
|
+
}))();
|
|
92
|
+
}
|
|
93
|
+
}, [formState]);
|
|
94
|
+
if (!options && !dependencies && type === 'select') return /*#__PURE__*/React.createElement(React.Fragment, null, "You are missing the options for Select");
|
|
95
|
+
if (!options && !dependencies && type === 'radiobox') return /*#__PURE__*/React.createElement(React.Fragment, null, "You are missing the options for Radiobox");
|
|
96
|
+
var config = {
|
|
97
|
+
id: id,
|
|
98
|
+
debug: debug,
|
|
99
|
+
autoComplete: autoComplete,
|
|
100
|
+
variant: variant,
|
|
101
|
+
validation: validation,
|
|
102
|
+
afterChange: afterChange,
|
|
103
|
+
defaultValue: value,
|
|
104
|
+
maxLength: maxLength,
|
|
105
|
+
populateOptions: populateOptions,
|
|
106
|
+
label: label,
|
|
107
|
+
disabled: disabled,
|
|
108
|
+
icon: icon,
|
|
109
|
+
placeholder: placeholder,
|
|
110
|
+
hidden: hidden,
|
|
111
|
+
uploadFile: uploadFile,
|
|
112
|
+
options: options ? options : dependencies,
|
|
113
|
+
required: required,
|
|
114
|
+
belongs_to: belongs_to,
|
|
115
|
+
multiple: multiple
|
|
116
|
+
};
|
|
117
|
+
switch (type) {
|
|
118
|
+
case 'text':
|
|
119
|
+
return /*#__PURE__*/React.createElement(TextInput, {
|
|
120
|
+
config: _objectSpread(_objectSpread({}, config), {}, {
|
|
121
|
+
type: type
|
|
122
|
+
})
|
|
123
|
+
});
|
|
124
|
+
case 'textarea':
|
|
125
|
+
return /*#__PURE__*/React.createElement(TextAreaInput, {
|
|
126
|
+
config: _objectSpread(_objectSpread({}, config), {}, {
|
|
127
|
+
type: type
|
|
128
|
+
})
|
|
129
|
+
});
|
|
130
|
+
case 'select':
|
|
131
|
+
return /*#__PURE__*/React.createElement(SelectInput, {
|
|
132
|
+
config: _objectSpread(_objectSpread({}, config), {}, {
|
|
133
|
+
type: type
|
|
134
|
+
})
|
|
135
|
+
});
|
|
136
|
+
case 'time':
|
|
137
|
+
return /*#__PURE__*/React.createElement(PickerInput, {
|
|
138
|
+
config: _objectSpread(_objectSpread({}, config), {}, {
|
|
139
|
+
type: type
|
|
140
|
+
}),
|
|
141
|
+
component: TimePicker
|
|
142
|
+
});
|
|
143
|
+
case 'number':
|
|
144
|
+
return /*#__PURE__*/React.createElement(NumberInput, {
|
|
145
|
+
config: _objectSpread(_objectSpread({}, config), {}, {
|
|
146
|
+
type: type
|
|
147
|
+
})
|
|
148
|
+
});
|
|
149
|
+
case 'upload':
|
|
150
|
+
return /*#__PURE__*/React.createElement(UploadFileInput, {
|
|
151
|
+
uploadFile: uploadFile,
|
|
152
|
+
config: _objectSpread(_objectSpread({}, config), {}, {
|
|
153
|
+
type: type
|
|
154
|
+
})
|
|
155
|
+
});
|
|
156
|
+
case 'datepicker':
|
|
157
|
+
return /*#__PURE__*/React.createElement(PickerInput, {
|
|
158
|
+
config: _objectSpread(_objectSpread({}, config), {}, {
|
|
159
|
+
type: type
|
|
160
|
+
}),
|
|
161
|
+
component: DatePicker
|
|
162
|
+
});
|
|
163
|
+
case 'date':
|
|
164
|
+
return /*#__PURE__*/React.createElement(DateInput, {
|
|
165
|
+
config: _objectSpread(_objectSpread({}, config), {}, {
|
|
166
|
+
type: type
|
|
167
|
+
})
|
|
168
|
+
});
|
|
169
|
+
case 'checkbox':
|
|
170
|
+
return /*#__PURE__*/React.createElement(CheckBoxInput, {
|
|
171
|
+
config: _objectSpread(_objectSpread({}, config), {}, {
|
|
172
|
+
type: type
|
|
173
|
+
})
|
|
174
|
+
});
|
|
175
|
+
case 'radiobox':
|
|
176
|
+
return /*#__PURE__*/React.createElement(RadioboxInput, {
|
|
177
|
+
config: _objectSpread(_objectSpread({}, config), {}, {
|
|
178
|
+
type: type
|
|
179
|
+
})
|
|
180
|
+
});
|
|
181
|
+
case 'rci':
|
|
182
|
+
return /*#__PURE__*/React.createElement(RCInput, {
|
|
183
|
+
config: _objectSpread(_objectSpread({}, config), {}, {
|
|
184
|
+
type: type
|
|
185
|
+
})
|
|
186
|
+
});
|
|
187
|
+
case 'file_reader':
|
|
188
|
+
return /*#__PURE__*/React.createElement(FileReaderInput, {
|
|
189
|
+
config: _objectSpread(_objectSpread({}, config), {}, {
|
|
190
|
+
type: type
|
|
191
|
+
}),
|
|
192
|
+
uploadFile: uploadFile
|
|
193
|
+
});
|
|
194
|
+
default:
|
|
195
|
+
return /*#__PURE__*/React.createElement(DefaultInput, {
|
|
196
|
+
config: _objectSpread(_objectSpread({}, config), {}, {
|
|
197
|
+
type: type
|
|
198
|
+
})
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
};
|