<!--

    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 class="tb-form-panel" [class.stroked]="strokedPanel" (click)="manageWidgetActions()" style="cursor: pointer;">
  <div class="flex flex-row items-center justify-start gap-4">
    <div class="tb-form-panel-title" translate style="padding-right: 48px;">widget-config.actions</div>
    <mat-chip-listbox class="flex-1">
      @for (actionSourceId of widgetActionSourceIds; track actionSourceId) {
        @for (widgetAction of widgetActionsByActionSourceId(actionSourceId); track widgetAction) {
          <mat-chip>
            <tb-icon matChipAvatar>{{ widgetAction.icon }}</tb-icon>
            {{ widgetAction.name }}
          </mat-chip>
        }
      }
    </mat-chip-listbox>
    @if (!hasWidgetActions) {
      <button mat-stroked-button color="primary">
        {{ 'widget-config.add-action' | translate }}
      </button>
    }
    @if (hasWidgetActions) {
      <button mat-icon-button color="primary">
        <mat-icon>add</mat-icon>
      </button>
    }
  </div>
</div>
