// Import all components
import { AccessibleLink } from './components/accessible-link';
import { ActiveState } from './components/active-state';
import { AutoResize } from './components/auto-resize';
import { AutoSuggest } from './components/auto-suggest';
import { Card } from './components/card';
import { Carousel } from './components/carousel';
import { CharacterCounter } from './components/character-counter';
import { Charts } from './components/charts';
import { Chat } from './components/chat';
import { Checkable } from './components/checkable';
import { Clearable } from './components/clearable';
import { Closable } from './components/closable';
import { Collapsible } from './components/collapsible';
import { Conditional } from './components/conditional';
import { CustomGreeting } from './components/custom-greeting';
import { DatePicker } from './components/datepicker';
import { Filter } from './components/filter';
import { ImageGallery } from './components/image-gallery';
import { Maps } from './components/maps';
import { Modal } from './components/modal';
import { Navigation } from './components/navigation';
import { Pagination } from './components/pagination';
import { PasswordValidator } from './components/password-validator';
import { PasswordVisibility } from './components/password-visibility';
import { Popover } from './components/popover';
import { Selector } from './components/selector';
import { SharePrice } from './components/share-price';
import { Scroll } from './components/scroll';
import { Slider } from './components/slider';
import { Status } from './components/status';
import { Sticky } from './components/sticky';
import { TextArea } from './components/text-area';
import { TabBar } from './components/tab-bar';
import { Tags } from './components/tags';
import { Toast } from './components/toast';
import { Toggable } from './components/toggable';
import { ToggableGroup } from './components/toggable-group';
import { Tooltip } from './components/tooltip';
import { Untouched } from './components/untouched';
import { Upload } from './components/upload';
import { Video } from './components/video';

import 'babel-polyfill';

// List all components.
const components = [
  AccessibleLink,
  ActiveState,
  AutoResize,
  AutoSuggest,
  Card,
  Carousel,
  CharacterCounter,
  Charts,
  Chat,
  Checkable,
  Clearable,
  Closable,
  Collapsible,
  Conditional,
  CustomGreeting,
  DatePicker,
  Filter,
  ImageGallery,
  Maps,
  Modal,
  Navigation,
  Pagination,
  PasswordValidator,
  PasswordVisibility,
  Popover,
  Scroll,
  Selector,
  SharePrice,
  Slider,
  Status,
  Sticky,
  TabBar,
  Tags,
  TextArea,
  Toast,
  Toggable,
  ToggableGroup,
  Tooltip,
  Untouched,
  Upload,
  Video
];

// initialize all components
for (let i = 0; i < components.length; i = i + 1) {
  const componentsList = document.querySelectorAll(components[i].getSelector());
  if (componentsList.length) {
    for (const component of componentsList) {
      new components[i](component);
    }
  }
}
