import { Component } from '@angular/core';
import { NgpButton } from 'ng-primitives/button';
import { NgpToggleGroupItem } from 'ng-primitives/toggle-group';

@Component({
  selector: 'button[<% if (prefix) { %><%= prefix %>-<% } %>toggle-group-item]',
  hostDirectives: [
    {
      directive: NgpToggleGroupItem,
      inputs: ['ngpToggleGroupItemValue:value', 'ngpToggleGroupItemDisabled:disabled'],
    },
    {
      directive: NgpButton,
      inputs: ['disabled'],
    },
  ],
  template: `
    <ng-content />
  `,
  styles: `
/* These styles rely on CSS variables that can be imported from ng-primitives/example-theme/index.css in your global styles */

    :host {
      display: flex;
      width: 2rem;
      height: 2rem;
      align-items: center;
      justify-content: center;
      border-radius: 0.25rem;
      border: 1px solid transparent;
      background: transparent;
      outline: none;
      transition: background-color 150ms cubic-bezier(0.4, 0, 0.2, 1);
      box-sizing: border-box;
      color: var(--ngp-text-primary);
      font-size: 1.125rem;
    }

    :host[data-hover] {
      background-color: var(--ngp-background-hover);
      border-color: var(--ngp-border);
    }

    :host[data-focus-visible] {
      outline: 2px solid var(--ngp-focus-ring);
    }

    :host[data-press] {
      background-color: var(--ngp-background-active);
    }

    :host[data-selected] {
      background-color: var(--ngp-background-inverse);
      color: var(--ngp-text-inverse);
      border-color: transparent;
    }

    /* Reduce motion for users who prefer reduced motion. */
    @media (prefers-reduced-motion: reduce) {
      :host {
        transition-duration: 0s;
      }
    }
  `,
})
export class ToggleGroupItem<%= componentSuffix %> {}
