UNPKG

1.89 kBPlain TextView Raw
1/**
2 * Phonon bundle
3 * List of components available as a UMD bundle
4 */
5import Accordion from './components/accordion';
6import Alert from './components/alert';
7import Collapse from './components/collapse';
8import Loader from './components/loader';
9import Modal from './components/modal';
10import ModalConfirm from './components/modal-confirm';
11import ModalLoader from './components/modal-loader';
12import ModalPrompt from './components/modal-prompt';
13import Notification from './components/notification';
14import OffCanvas from './components/offcanvas';
15import Progress from './components/progress';
16import Selectbox from './components/selectbox';
17import Tab from './components/tab';
18
19import Util from './util.js';
20
21const componentCreator = (component: any, options: any = {}) => {
22 return Util.Observer.getComponent(component, options) || new component(options);
23};
24
25const 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// rollup takes care to attach the API to window.phonon
42export default Object.assign(api, Util); // keep the utils in the bundle