import { Host, h } from "@stencil/core";
import { OverlayScrollbars } from "overlayscrollbars";
/**
 * Utility that replaces the default browser scrollbar with a custom one.
 */
export class KlevuUtilScrollbars {
  constructor() {
    this.overflowX = undefined;
    this.overflowY = undefined;
  }
  componentDidLoad() {
    if (!this.container) {
      return;
    }
    const options = {
      overflow: {},
      scrollbars: {
        theme: "os-theme-klevu",
      },
    };
    if (this.overflowX) {
      options.overflow.x = this.overflowX;
    }
    if (this.overflowY) {
      options.overflow.y = this.overflowY;
    }
    this.instance = OverlayScrollbars(this.container, options);
  }
  async getContainer() {
    return this.container;
  }
  async getInstance() {
    return this.instance;
  }
  render() {
    return (h(Host, null, h("div", { style: {
        height: "100%",
        "--os-size": "4px !important",
        "--os-handle-bg": "red !important",
        "--os-handle-bg-hover": "var(--klevu-color-neutral-6) !important",
        "--os-handle-bg-active": "var(--klevu-color-neutral-7) !important",
      }, ref: (el) => (this.container = el) }, h("slot", null))));
  }
  static get is() { return "klevu-util-scrollbars"; }
  static get originalStyleUrls() {
    return {
      "$": ["klevu-util-scrollbars.css"]
    };
  }
  static get styleUrls() {
    return {
      "$": ["klevu-util-scrollbars.css"]
    };
  }
  static get properties() {
    return {
      "overflowX": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "OverflowBehavior",
          "resolved": "\"hidden\" | \"scroll\" | \"visible\" | \"visible-hidden\" | \"visible-scroll\" | undefined",
          "references": {
            "OverflowBehavior": {
              "location": "import",
              "path": "overlayscrollbars"
            }
          }
        },
        "required": false,
        "optional": true,
        "docs": {
          "tags": [],
          "text": ""
        },
        "attribute": "overflow-x",
        "reflect": false
      },
      "overflowY": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "OverflowBehavior",
          "resolved": "\"hidden\" | \"scroll\" | \"visible\" | \"visible-hidden\" | \"visible-scroll\" | undefined",
          "references": {
            "OverflowBehavior": {
              "location": "import",
              "path": "overlayscrollbars"
            }
          }
        },
        "required": false,
        "optional": true,
        "docs": {
          "tags": [],
          "text": ""
        },
        "attribute": "overflow-y",
        "reflect": false
      }
    };
  }
  static get methods() {
    return {
      "getContainer": {
        "complexType": {
          "signature": "() => Promise<HTMLDivElement | undefined>",
          "parameters": [],
          "references": {
            "Promise": {
              "location": "global"
            },
            "HTMLDivElement": {
              "location": "global"
            }
          },
          "return": "Promise<HTMLDivElement | undefined>"
        },
        "docs": {
          "text": "",
          "tags": []
        }
      },
      "getInstance": {
        "complexType": {
          "signature": "() => Promise<OverlayScrollbars | undefined>",
          "parameters": [],
          "references": {
            "Promise": {
              "location": "global"
            },
            "OverlayScrollbars": {
              "location": "import",
              "path": "overlayscrollbars"
            }
          },
          "return": "Promise<OverlayScrollbars | undefined>"
        },
        "docs": {
          "text": "",
          "tags": []
        }
      }
    };
  }
  static get elementRef() { return "el"; }
}
//# sourceMappingURL=klevu-util-scrollbars.js.map
