1 |
|
2 |
|
3 |
|
4 |
|
5 | import Accordion from './components/accordion';
|
6 | import Alert from './components/alert';
|
7 | import Collapse from './components/collapse';
|
8 | import Loader from './components/loader';
|
9 | import Modal from './components/modal';
|
10 | import ModalConfirm from './components/modal-confirm';
|
11 | import ModalLoader from './components/modal-loader';
|
12 | import ModalPrompt from './components/modal-prompt';
|
13 | import Notification from './components/notification';
|
14 | import OffCanvas from './components/offcanvas';
|
15 | import Progress from './components/progress';
|
16 | import Selectbox from './components/selectbox';
|
17 | import Tab from './components/tab';
|
18 |
|
19 | import Util from './util.js';
|
20 |
|
21 | const componentCreator = (component: any, options: any = {}) => {
|
22 | return Util.Observer.getComponent(component, options) || new component(options);
|
23 | };
|
24 |
|
25 | const api = {
|
26 | accordion: (options: any) => componentCreator(Accordion, options),
|
27 | alert: (options: any) => componentCreator(Alert, options),
|
28 | modal: (options: any) => componentCreator(Modal, options),
|
29 | modalConfirm: (options: any) => componentCreator(ModalConfirm, options),
|
30 | modalLoader: (options: any) => componentCreator(ModalLoader, options),
|
31 | modalPrompt: (options: any) => componentCreator(ModalPrompt, options),
|
32 | loader: (options: any) => componentCreator(Loader, options),
|
33 | collapse: (options: any) => componentCreator(Collapse, options),
|
34 | notification: (options: any) => componentCreator(Notification, options),
|
35 | offCanvas: (options: any) => componentCreator(OffCanvas, options),
|
36 | tab: (options: any) => componentCreator(Tab, options),
|
37 | selectbox: (options: any) => componentCreator(Selectbox, options),
|
38 | progress: (options: any) => componentCreator(Progress, options),
|
39 | };
|
40 |
|
41 |
|
42 | export default Object.assign(api, Util);
|