# Installation

```bash
npm install credcomponents --save
```
## Available components to use
    - Chat
    - File Upload
    - Macro Component
    - Maps
    - Mega Menu
    - Tooltip

## Available directives to use
    - Comma Seprator
    - Sticky Scroll

## Available utilities to use
    - LoadScript
       - Using `LoadScript` utility function you can load external files and can be unloaded using `unloadScript` utility function.
    - There are also other utilities to check type of variables, is property are available or not in object, loops, filters.

##  Usage

All the components, directives and utilites are tree shaked, where you will install only specific dependency not others with it.

```js

import {
    // Components
    FileUpload, 
    Chat,
    Macro,
    BubbleMap, 
    GoogleMap, 
    LeafletMaps, 
    LineMap, 
    yandexMap, 
    ymapMarker,
    ...,
    // Directives
    CommaSeprator,
    StickyScroll,
    ...,

    // Utilities
    isPrimitive,
    isUndef, 
    isDef, 
    isTrue, 
    isFalse, 
    isPrimitive, 
    isRefrence, 
    isPlainArray, 
    isPlainObject, 
    isRegExp, 
    isFunction, 
    isPromise, 
    isValidArrayIndex, 
    toNumber, 
    ...
} from 'credcomponents'
```


```js
// plugin
// To use Macro component you need to register it globally via plugin
import Vue from 'vue'
import { Macro } from 'credcomponents'

Vue.use(Macro, { 
    applicationName: "<< Your appname>>", macroJSFileUrl: "<<Your path for macro file, where in custom code get executed>>" 
});
```

## Above components can be used as webcomponents in your legacy application.

- Include `webcomponents/credence.min.js` in your html file or load the you load other javascript files.
- The use above published component this way.

```html 
<!doctype html>
    <meta charset="utf-8">
    <title>credence demo</title>
    <script src="https://unpkg.com/vue"></script>
    <script src="/credcomponents/webcomponents/credence.min.js"></script>
    <credence-file-upload></credence-file-upload>
    <credence-macro></credence-macro>
    <credence-mega-menu-web-component></credence-mega-menu-web-component>
```


## Each published components, directives and utility can be installed individually instead of installing all package `credcomponents`.

* e.g
```bash
npm install @credenceanalytics/file-upload --save
npm install @credenceanalytics/macro-component --save
```

```js
// plugin
// To use Macro component you need to register it globally via plugin
import Vue from 'vue'
import { Macro } from '@credenceanalytics/macro-component'

Vue.use(Macro, { 
    applicationName: "<< Your appname>>", macroJSFileUrl: "<<Your path for macro file, where in custom code get executed>>" 
});

import { FileUpload } from "@credenceanalytics/file-upload";

import SearchBar from "@credenceanalytics/search-bar"


```
