<!--

    Copyright © 2016-2026 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 [formGroup]="cssSizeFormGroup" class="flex flex-row items-center justify-start gap-2">
  <mat-form-field appearance="outline" subscriptSizing="dynamic" class="tb-inline-field tb-suffix-absolute number" [class.flex]="flex">
    <input matInput [required]="required"
           type="number" min="0" formControlName="size" placeholder="{{ 'widget-config.set' | translate }}">
    @if (cssSizeFormGroup.get('size').invalid && cssSizeFormGroup.get('size').touched) {
      <mat-icon matSuffix
                matTooltipPosition="above"
                matTooltipClass="tb-error-tooltip"
              [matTooltip]="cssSizeFormGroup.get('size').hasError('required') ? ((requiredText ? requiredText : 'css-size.size-value-required') | translate) :
                               ('css-size.invalid-size-value' | translate)"
        class="tb-error">
        warning
      </mat-icon>
    }
  </mat-form-field>
  <tb-css-unit-select [allowEmpty]="allowEmptyUnit" [style.flex]="flex ? '1' : null"
  [width]="flex ? '100%' : ''" formControlName="unit"></tb-css-unit-select>
</div>
