"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Tabs = void 0;
var _react = _interopRequireDefault(require("react"));
var _classnames = _interopRequireDefault(require("classnames"));
var _tab = require("./tab");
var _types = require("./types");
var _jsxRuntime = require("react/jsx-runtime");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
/**
 * @midnight-gray-supported
 * @alpine-light-supported
 */
const Tabs = ({
  options,
  selectedKey,
  isDisabled,
  className,
  testId,
  ariaLabelledBy,
  ariaLabel,
  onSelect,
  accentType,
  groupIdentifier = '',
  size = _types.TAB_GROUP_SIZE.MEDIUM
}) => {
  const ariaAttrs = {
    ...(ariaLabelledBy && !ariaLabel && {
      'aria-labelledby': ariaLabelledBy
    }),
    ...(ariaLabel && !ariaLabelledBy && {
      'aria-label': ariaLabel
    })
  };
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("fieldset", {
    className: (0, _classnames.default)('tabgroup tabgroup-container', `${size}${className ? ` ${className}` : ''}`, accentType),
    disabled: isDisabled,
    "test-id": testId,
    ...ariaAttrs,
    children: options.map(option => /*#__PURE__*/(0, _jsxRuntime.jsx)(_tab.Tab, {
      option: option,
      onChange: onSelect,
      checked: option.key === selectedKey,
      groupIdentifier: groupIdentifier
    }, option.key))
  });
};
exports.Tabs = Tabs;