## Installation
Using npm
  ```shell
$ npm i -g npm
$ npm i react react-dom @piximind/validation @piximind/custom-hook
```
Pre requirements:
```shell
$ npm i react version 18
$ npm i @piximind/validation
```

## useEffectOnce:
```jsx
code :
useEffectOnce(() => {
  console.log("useEffectOnce");
})
this runs only once at the component build level
```


## useUpdateEffect:
```jsx
code :
useUpdateEffect(() => {
  console.log("useUpdateEffect");
},[DependencyList])
this launches after modifying dependency
```


## useWindowSize:
```jsx
code :
const { width, height } = useWindowSize()
return screen size
```


## useOnlineStatus:
```jsx
code :
const onLineStatus = useOnlineStatus()
return network status
```


## useEventListener:
```jsx
code :
useEventListener("event" ,callbackFunction)
create event listener
```


## useClickOutside:
```jsx
code :
useClickOutside(React.ref ,callbackFunction)
detect element clict out side
```
## useCustomState:
```jsx
code :
const[state, setState]=useCustomState(value)
```
## useForm:
```jsx
code :
const{state, onChange, onValidForm, isFormValid ,onReset}=useForm(isRealTimeValidation: true,data:IListElementUseForm)

```
onReset function description : 
if you pass a false param into the onReset function the form will be setten to initial state, else the form will be totally emptied
## Interfaces:
```jsx
enum EListFunction {
    isMail = "isMail",
    hasUperCase = "hasUperCase",
    hasLowerCase = "hasLowerCase",
    hasNumber = "hasNumber",
    isEmpty = "isEmpty",
    isNumber = "isNumber",
    isDate = "isDate",
    isUrl = "isUrl",
    isDateValidation = "isDateValidation",
    hasAlpha = "hasAlpha",
    hasSpecial = "hasSpecial",
    hasSpecialDate = "hasSpecialDate",
    checkIsDate = "checkIsDate",
    isNotEmpty = "isNotEmpty",
    isArray = "isArray",
    isTrue = "isTrue",
}
interface IRule {
    priority: number,
    function: EListFunction,
    messageError: string,
}

interface IListRules extends Array<IRule> { }

interface IElementUseForm {
    value: string | number | boolean,
    isRealTimeValidation?: boolean,
    rules?: IListRules,
    successMessage?: string,
    key: string
}

interface IListElementUseForm extends Array<IElementUseForm> { }

interface IUseForm {
    isRealTimeValidation?: boolean,
    data: IListElementUseForm
}
interface IElementState {
    value: string | number | boolean,
    isValid: boolean,
    successMessage: string,
    isInvalid: boolean,
    errorMessage: string,
}

interface IState {
    [key: string]: IElementState;
}

interface IOnChnage {
    value: string | number | boolean,
    key: string
}

interface IUseFormResult {
    state: IState,
    onChange: Function,
    onValidForm: Function,
    isFormValid: boolean,
    onReset: Function,
    onUpdateData: Function,
    onUpdateState: Function
}

```