/*! Copyright 2026 Fonticons, Inc. - https://webawesome.com/license */
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __decorateClass = (decorators, target, key, kind) => {
  var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
    if (decorator = decorators[i])
      result = (kind ? decorator(target, key, result) : decorator(result)) || result;
  if (kind && result) __defProp(target, key, result);
  return result;
};
import { html } from "lit";
import { customElement, property, query, state } from "lit/decorators.js";
import WebAwesomeElement from "../../internal/webawesome-element.js";
import styles from "./button-group.styles.js";
let WaButtonGroup = class extends WebAwesomeElement {
  constructor() {
    super(...arguments);
    this.disableRole = false;
    this.hasOutlined = false;
    this.label = "";
    this.orientation = "horizontal";
    this.childSelector = "wa-button, wa-radio-button";
  }
  updated(changedProperties) {
    super.updated(changedProperties);
    if (changedProperties.has("orientation")) {
      this.setAttribute("aria-orientation", this.orientation);
    }
  }
  handleFocus(event) {
    const button = findButton(event.target, this.childSelector);
    button?.classList.add("button-focus");
  }
  handleBlur(event) {
    const button = findButton(event.target, this.childSelector);
    button?.classList.remove("button-focus");
  }
  handleMouseOver(event) {
    const button = findButton(event.target, this.childSelector);
    button?.classList.add("button-hover");
  }
  handleMouseOut(event) {
    const button = findButton(event.target, this.childSelector);
    button?.classList.remove("button-hover");
  }
  render() {
    return html`
      <slot
        part="base"
        class="button-group"
        role="${this.disableRole ? "presentation" : "group"}"
        aria-label=${this.label}
        aria-orientation=${this.orientation}
        @focusout=${this.handleBlur}
        @focusin=${this.handleFocus}
        @mouseover=${this.handleMouseOver}
        @mouseout=${this.handleMouseOut}
      ></slot>
    `;
  }
};
WaButtonGroup.css = [styles];
__decorateClass([
  query("slot")
], WaButtonGroup.prototype, "defaultSlot", 2);
__decorateClass([
  state()
], WaButtonGroup.prototype, "disableRole", 2);
__decorateClass([
  state()
], WaButtonGroup.prototype, "hasOutlined", 2);
__decorateClass([
  property()
], WaButtonGroup.prototype, "label", 2);
__decorateClass([
  property({ reflect: true })
], WaButtonGroup.prototype, "orientation", 2);
__decorateClass([
  property()
], WaButtonGroup.prototype, "childSelector", 2);
WaButtonGroup = __decorateClass([
  customElement("wa-button-group")
], WaButtonGroup);
function findButton(el, selector) {
  return el.closest(selector) ?? el.querySelector(selector);
}
export {
  WaButtonGroup as default
};
