<!--

    Copyright © 2016-2023 The Thingsboard Authors

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->
<div class="tb-flot-threshold">
  <mat-expansion-panel class="tb-settings tb-flot-threshold-settings" fxFlex [formGroup]="thresholdFormGroup" [(expanded)]="expanded">
    <mat-expansion-panel-header>
      <div class="tb-threshold-header">
        <div class="tb-threshold-text">{{ thresholdText() }}</div>
        <mat-divider vertical></mat-divider>
        <tb-color-input asBoxInput
                        formControlName="color">
        </tb-color-input>
        <mat-divider vertical></mat-divider>
      </div>
    </mat-expansion-panel-header>
    <ng-template matExpansionPanelContent>
      <tb-value-source [aliasController]="aliasController" formControlName="valueSource"></tb-value-source>
      <div class="tb-form-row space-between">
        <div translate>widgets.chart.line-width</div>
        <mat-form-field appearance="outline" class="number" subscriptSizing="dynamic">
          <input matInput formControlName="lineWidth" type="number" min="0" placeholder="{{ 'widget-config.set' | translate }}">
          <span matSuffix>px</span>
        </mat-form-field>
      </div>
    </ng-template>
  </mat-expansion-panel>
  <button *ngIf="!disabled" mat-icon-button
          type="button"
          (click)="removeThreshold.emit()"
          matTooltip="{{ 'action.remove' | translate }}"
          matTooltipPosition="above">
    <mat-icon>delete</mat-icon>
  </button>
</div>
