Skip to content

Commit c2bb442

Browse files
committed
Working with react in peer dependencies and
removed styles directory
1 parent 52ff91e commit c2bb442

File tree

10 files changed

+79
-78
lines changed

10 files changed

+79
-78
lines changed

package-lock.json

+59-58
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
"react-final-form": "^6.5.7",
2828
"react-number-format": "^4.9.1"
2929
},
30+
"peerDependencies": {
31+
"react": "^16.8.6"
32+
},
3033
"scripts": {
3134
"start": "craco start",
3235
"build": "rm -rf dist && NODE_ENV=production babel src/lib --out-dir dist --copy-files",
@@ -66,7 +69,6 @@
6669
"babel-preset-minify": "^0.5.1",
6770
"node-sass": "^4.14.1",
6871
"postcss": "^7.0.39",
69-
"react": "^17.0.2",
7072
"react-dom": "^17.0.2",
7173
"react-router-dom": "^6.0.1",
7274
"react-scripts": "4.0.3",

src/App.css

-1
This file was deleted.

src/App.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import './App.css';
21
import { BrowserRouter, Routes, Route } from 'react-router-dom';
32
import ManagedForm from './examples/ManagedForm';
43
import HookParent from './examples/hookForm/Parent';

src/lib/exports/FetchFormsProvider.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
import { createContext, useContext, useState } from 'react';
1+
import React from 'react';
22

3-
export const FormsContext = createContext({});
3+
export const FormsContext = React.createContext({});
44

55
export const FetchFormsProvider = ({ permission, children }) => {
6-
const [token] = useState(permission);
6+
const [token] = React.useState(permission);
77

88
return (
99
<FormsContext.Provider value={token}>{children}</FormsContext.Provider>
1010
);
1111
};
1212

1313
export const usePermission = () => {
14-
return useContext(FormsContext);
14+
return React.useContext(FormsContext);
1515
};

src/lib/exports/components/FetchForm.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
import React, { useEffect, useState } from 'react';
1+
import React from 'react';
22
import { Form } from 'react-final-form';
33
import useFetchForms from '../hooks/useFetchForms';
44
import FetchFormItem from './form/FetchFormItem';
55
import { validate } from '../scripts/Validations';
6-
import '../styles/index.scss';
6+
import '../../../lib_styles/index.scss';
77

88
const FetchForm = ({ slug, showFormError, onSubmit }) => {
99
const [fetchForm, loading, error, doCloudSubmit] = useFetchForms(slug);
10-
const [validations, setValidations] = useState({});
11-
const [submitError, setSubmitError] = useState(false);
10+
const [validations, setValidations] = React.useState({});
11+
const [submitError, setSubmitError] = React.useState(false);
1212

13-
useEffect(() => {
13+
React.useEffect(() => {
1414
if (fetchForm) {
1515
setValidations(
1616
fetchForm.formItems.map((item) => ({
@@ -21,7 +21,7 @@ const FetchForm = ({ slug, showFormError, onSubmit }) => {
2121
}
2222
}, [fetchForm]);
2323

24-
useEffect(() => {
24+
React.useEffect(() => {
2525
if (showFormError) {
2626
setSubmitError(showFormError);
2727
}

src/lib/exports/components/form/fields/FetchFormRadio.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { useState } from 'react';
1+
import React from 'react';
22
import FetchLabel from '../FetchLabel';
33

44
const FetchFormRadio = ({ label, options, fieldName, html }) => {
5-
const [checked, setChecked] = useState('');
5+
const [checked, setChecked] = React.useState('');
66

77
return (
88
<div className='radio-group'>

src/lib/exports/hooks/useFetchForms.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import { useState, useEffect } from 'react';
1+
import React from 'react';
22
import { usePermission } from '../FetchFormsProvider';
33

44
const useFetchForms = (id, json) => {
5-
const [fetchForm, setFetchForm] = useState(null);
6-
const [loading, setLoading] = useState(true);
7-
const [error, setError] = useState(false);
5+
const [fetchForm, setFetchForm] = React.useState(null);
6+
const [loading, setLoading] = React.useState(true);
7+
const [error, setError] = React.useState(false);
88
const token = usePermission();
99

10-
useEffect(() => {
10+
React.useEffect(() => {
1111
const unsubscribe = async () => {
1212
setLoading(true);
1313

File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)