import { Component, Prop, h, Watch } from '@stencil/core';
import { ListVariants } from '../../types/ListVariant';
import { ListTags } from '../../types/ListTag';
import { ListItemAlignments, } from '../../types/ListItemAlignment';
export class TeliaList {
  constructor() {
    /** List layout, it can be vertical or horizontal */
    this.variant = ListVariants.column;
    /** List tag to be used for rendering list items */
    this.listTag = ListTags.ul;
    /** Justify content along main axis of container */
    this.justifycontent = ListItemAlignments.start;
    /** Adds spacing between list items inside on navigation */
    /** Should be changed to string value and used for wider purpose */
    this.itemSpacing = false;
    /** Tracking id is used to identify and count Component usage */
    this.dataTrackingId = 'telia-list';
  }
  componentWillLoad() {
    this.validateListTag(this.listTag);
  }
  /**
   * Validates list tag property for non-typescript env
   * @private
   */
  validateListTag(listTag) {
    const validListTags = Object.values(ListTags);
    if (validListTags.indexOf(listTag) === -1) {
      throw new Error(`Invalid list tag ${listTag} is used. Use one of: ${validListTags.join(', ')}`);
    }
  }
  render() {
    const containerClass = {
      'telia-list': true,
      ['telia-list--navigation-row']: !!this.itemSpacing,
      [`telia-list--${this.variant}`]: !!this.variant,
      [`telia-list--${this.justifycontent}`]: !!this.justifycontent,
    };
    const ListTag = this.listTag;
    return (h(ListTag, { class: containerClass, role: this.listTag === ListTags.ul ? 'list' : '' },
      h("slot", null),
      h("telia-vst", { dataTrackingId: this.dataTrackingId })));
  }
  static get is() { return "telia-list"; }
  static get encapsulation() { return "shadow"; }
  static get originalStyleUrls() { return {
    "$": ["telia-list.scss"]
  }; }
  static get styleUrls() { return {
    "$": ["telia-list.css"]
  }; }
  static get properties() { return {
    "dataTestid": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": "Test id set for web component host"
      },
      "attribute": "data-testid",
      "reflect": false
    },
    "variant": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "ListVariant",
        "resolved": "\"column\" | \"row\"",
        "references": {
          "ListVariant": {
            "location": "import",
            "path": "../../types/ListVariant"
          }
        }
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": "List layout, it can be vertical or horizontal"
      },
      "attribute": "variant",
      "reflect": false,
      "defaultValue": "ListVariants.column"
    },
    "listTag": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "ListTag",
        "resolved": "\"dl\" | \"ol\" | \"ul\"",
        "references": {
          "ListTag": {
            "location": "import",
            "path": "../../types/ListTag"
          }
        }
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": "List tag to be used for rendering list items"
      },
      "attribute": "list-tag",
      "reflect": false,
      "defaultValue": "ListTags.ul"
    },
    "justifycontent": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "ListItemAlignment",
        "resolved": "\"space-around\" | \"space-between\" | \"start\"",
        "references": {
          "ListItemAlignment": {
            "location": "import",
            "path": "../../types/ListItemAlignment"
          }
        }
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": "Justify content along main axis of container"
      },
      "attribute": "justifycontent",
      "reflect": false,
      "defaultValue": "ListItemAlignments.start"
    },
    "itemSpacing": {
      "type": "boolean",
      "mutable": false,
      "complexType": {
        "original": "boolean",
        "resolved": "boolean",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": "Should be changed to string value and used for wider purpose"
      },
      "attribute": "item-spacing",
      "reflect": false,
      "defaultValue": "false"
    }
  }; }
  static get watchers() { return [{
      "propName": "listTag",
      "methodName": "validateListTag"
    }]; }
}
