From 3bb760ceb361da2dfd3f33f20902fe258f5dd894 Mon Sep 17 00:00:00 2001 From: Bogdan Bodnar Date: Tue, 27 Aug 2019 16:42:33 +0200 Subject: [PATCH] Fix imports. --- babel.config.js | 3 +- package-lock.json | 9 ++++ package.json | 1 + src/form/__tests__/SubmitButton.test.js | 2 +- src/form/components/ForisForm.js | 8 ++-- src/index.js | 56 ++++++++++++++++--------- 6 files changed, 53 insertions(+), 26 deletions(-) diff --git a/babel.config.js b/babel.config.js index 569eecc..0bf9c14 100644 --- a/babel.config.js +++ b/babel.config.js @@ -8,7 +8,8 @@ module.exports = { "@babel/preset-react", ], plugins: [ - "@babel/plugin-syntax-export-default-from", "@babel/plugin-transform-runtime", + "@babel/plugin-syntax-export-namespace-from", + "@babel/plugin-syntax-export-default-from", ], }; diff --git a/package-lock.json b/package-lock.json index 224ab4f..49d3a49 100644 --- a/package-lock.json +++ b/package-lock.json @@ -426,6 +426,15 @@ "@babel/helper-plugin-utils": "^7.0.0" } }, + "@babel/plugin-syntax-export-namespace-from": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-export-namespace-from/-/plugin-syntax-export-namespace-from-7.2.0.tgz", + "integrity": "sha512-1zGA3UNch6A+A11nIzBVEaE3DDJbjfB+eLIcf0GGOh/BJr/8NxL3546MGhV/r0RhH4xADFIEso39TKCfEMlsGA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0" + } + }, "@babel/plugin-syntax-json-strings": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.2.0.tgz", diff --git a/package.json b/package.json index 7640775..36d338e 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,7 @@ "@babel/core": "^7.4.5", "@babel/plugin-proposal-class-properties": "^7.4.4", "@babel/plugin-syntax-export-default-from": "^7.2.0", + "@babel/plugin-syntax-export-namespace-from": "^7.2.0", "@babel/plugin-transform-runtime": "^7.4.4", "@babel/preset-env": "^7.4.5", "@babel/preset-react": "^7.0.0", diff --git a/src/form/__tests__/SubmitButton.test.js b/src/form/__tests__/SubmitButton.test.js index a7a6cfd..c121809 100644 --- a/src/form/__tests__/SubmitButton.test.js +++ b/src/form/__tests__/SubmitButton.test.js @@ -8,7 +8,7 @@ import React from "react"; import { render } from "customTestRender"; -import SubmitButton, { STATES } from "../components/SubmitButton"; +import { STATES, SubmitButton } from "../components/SubmitButton"; describe("", () => { it("Render ready", () => { diff --git a/src/form/components/ForisForm.js b/src/form/components/ForisForm.js index 4f09997..4781818 100644 --- a/src/form/components/ForisForm.js +++ b/src/form/components/ForisForm.js @@ -99,7 +99,7 @@ export default function ForisForm({ const [alertIsDismissed, setAlertIsDismissed] = useState(false); - if (!formState.data) return ; + if (!formState.data) return ; const formIsDisabled = disabled || forisModuleState.isLoading || postState.isSending; const submitButtonIsDisabled = disabled || !!formState.errors; @@ -126,15 +126,15 @@ export default function ForisForm({ let alert = null; if (!alertIsDismissed) { if (postState.isSuccess) { - alert = setAlertIsDismissed(true)}/>; + alert = setAlertIsDismissed(true)} />; } else if (postState.isError) { - alert = setAlertIsDismissed(true)}/>; + alert = setAlertIsDismissed(true)} />; } } return ( <> - + {alert}
{childrenWithFormProps} diff --git a/src/index.js b/src/index.js index 74837ee..dc8dafc 100644 --- a/src/index.js +++ b/src/index.js @@ -1,19 +1,40 @@ +import * as Alert from "bootstrap/Alert"; +import * as Button from "bootstrap/Button"; +import * as CheckBox from "bootstrap/Checkbox"; +import * as formFieldsSize from "bootstrap/constants"; +import * as DataTimeInput from "bootstrap/DataTimeInput"; +import * as EmailInput from "bootstrap/EmailInput"; +import * as Input from "bootstrap/Input"; +import * as NumberInput from "bootstrap/NumberInput"; +import * as PasswordInput from "bootstrap/PasswordInput"; +import * as RadioSet from "bootstrap/RadioSet"; +import * as Select from "bootstrap/Select"; +import * as TextInput from "bootstrap/TextInput"; + +import * as useWSForisModule from "webSockets/hooks"; +import * as WebSockets from "webSockets/WebSockets"; +import * as Portal from "utils/Portal"; + +import ForisForm from "form/components/ForisForm"; + // API export { useAPIGet, useAPIPost } from "./api/hooks"; // Bootstrap -export * as Alert from "bootstrap/Alert"; -export * as Button from "bootstrap/Button"; -export * as CheckBox from "bootstrap/Checkbox"; -export * as formFieldsSize from "bootstrap/constants"; -export * as DataTimeInput from "bootstrap/DataTimeInput"; -export * as EmailInput from "bootstrap/EmailInput"; -export * as Input from "bootstrap/Input"; -export * as NumberInput from "bootstrap/NumberInput"; -export * as PasswordInput from "bootstrap/PasswordInput"; -export * as RadioSet from "bootstrap/RadioSet"; -export * as Select from "bootstrap/Select"; -export * as TextInput from "bootstrap/TextInput"; +export { + Alert, + Button, + CheckBox, + formFieldsSize, + DataTimeInput, + EmailInput, + Input, + NumberInput, + PasswordInput, + RadioSet, + Select, + TextInput, +}; export { Spinner, SpinnerElement, @@ -27,7 +48,7 @@ export { // Form -export ForisForm from "form/components/ForisForm"; +export { ForisForm }; export { SubmitButton, STATES as SUBMIT_BUTTON_STATES } from "form/components/SubmitButton"; export { useForisModule, useForm } from "form/hooks"; @@ -35,20 +56,15 @@ export { useForisModule, useForm } from "form/hooks"; // Test Utils export { mockedWS } from "testUtils/mockWS"; - // WebSockets -export * as useWSForisModule from "webSockets/hooks"; -export * as WebSockets from "webSockets/WebSockets"; - +export { useWSForisModule, WebSockets }; // Utils -export * as Portal from "utils/Portal"; - +export { Portal }; // Foris URL export { ForisURLs, REFORIS_URL_PREFIX } from "./forisUrls"; - // Validation export { validateIPv4Address,