How to use the @material/textfield.MDCTextFieldFoundation function in @material/textfield

To help you get started, we’ve selected a few @material/textfield 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 trimox / angular-mdc-web / packages / textfield / text-field.ts View on Github external
getNativeInput: () => this._getInputElement(),
    helperText: this._helperText ? this.helperText.helperTextFoundation : undefined,
    icon: this._icons ? this._icons.first.iconTextFoundation : undefined
  };

  private _foundation: {
    init(): void,
    destroy(): void,
    isDisabled(): boolean,
    setDisabled(disabled: boolean): void,
    setValid(isValid: boolean): void,
    setValue(value: any): void,
    isValid(): boolean,
    notchOutline(openNotch: boolean): void,
    setUseNativeValidation(useNativeValidation: boolean): void
  } = new MDCTextFieldFoundation(this._mdcAdapter);

  /** View -> model callback called when value changes */
  _onChange: (value: any) => void = () => { };

  /** View -> model callback called when text field has been touched */
  _onTouched = () => { };

  constructor(
    private _platform: Platform,
    private _changeDetectorRef: ChangeDetectorRef,
    public elementRef: ElementRef,
    private _ripple: MdcRipple) {

    // Force setter to be called in case id was not specified.
    this.id = this.id;
  }
github trimox / angular-mdc-web / packages / textfield / text-field.ts View on Github external
ngAfterViewInit(): void {
    this._foundation = new MDCTextFieldFoundation(this._mdcAdapter);
    this._foundation.init();

    this._initRipple();
  }
github jamesmfriedman / rmwc / src / textfield / index.tsx View on Github external
getDefaultFoundation() {
    return new MDCTextFieldFoundation(
      {
        addClass: (className: string) => this.root.addClass(className),
        removeClass: (className: string) => this.root.removeClass(className),
        hasClass: (className: string) => this.root.hasClass(className),
        registerTextFieldInteractionHandler: (
          evtType: K,
          handler: SpecificEventListener
        ): void => this.root.addEventListener(evtType, handler),
        deregisterTextFieldInteractionHandler: (
          evtType: K,
          handler: SpecificEventListener
        ): void => this.root.removeEventListener(evtType, handler),
        registerValidationAttributeChangeHandler: (
          handler: (attributeNames: string[]) => void
        ): MutationObserver => {
          const getAttributesList = (mutationsList: MutationRecord[]) =>