How to use the @material/tab-scroller.MDCTabScrollerFoundation function in @material/tab-scroller

To help you get started, we’ve selected a few @material/tab-scroller examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jamesmfriedman / rmwc / src / tabs / tab-scroller.tsx View on Github external
getDefaultFoundation() {
    return new MDCTabScrollerFoundation({
      eventTargetMatchesSelector: (evtTarget: EventTarget, selector: string) =>
        matches(evtTarget as HTMLElement, selector),
      addClass: (className: string) => this.root.addClass(className),
      removeClass: (className: string) => this.root.removeClass(className),
      addScrollAreaClass: (className: string) => this.area.addClass(className),
      setScrollAreaStyleProperty: (prop: string, value: string) =>
        this.area.setStyle(prop, value),
      setScrollContentStyleProperty: (prop: string, value: string) =>
        this.content.setStyle(prop, value),
      getScrollContentStyleValue: (propName: string) => {
        const val =
          this.content.ref &&
          window.getComputedStyle(this.content.ref).getPropertyValue(propName);

        return val || 'none';
      },
github trimox / angular-mdc-web / packages / tab-scroller / tab-scroller.ts View on Github external
setScrollContentStyleProperty: (propName: string, value: string) =>
        this.content.nativeElement.style.setProperty(propName, value),
      getScrollContentStyleValue: (propName: string) =>
        this._platform.isBrowser ? window.getComputedStyle(this.content.nativeElement).getPropertyValue(propName) : '',
      setScrollAreaScrollLeft: (scrollX: number) => this.area.nativeElement.scrollLeft = scrollX,
      getScrollAreaScrollLeft: () => this.area.nativeElement.scrollLeft,
      getScrollContentOffsetWidth: () => this.content.nativeElement.offsetWidth,
      getScrollAreaOffsetWidth: () => this.area.nativeElement.offsetWidth,
      computeScrollAreaClientRect: () =>
        this._platform.isBrowser ? this.area.nativeElement.getBoundingClientRect() : {},
      computeScrollContentClientRect: () =>
        this._platform.isBrowser ? this.content.nativeElement.getBoundingClientRect() : {},
      computeHorizontalScrollbarHeight: () =>
        this._platform.isBrowser ? util.computeHorizontalScrollbarHeight(document) : 0
    };
    return new MDCTabScrollerFoundation(adapter);
  }