import { _ as _extends } from '../extends-e61fd370.js';
import { _ as _objectWithoutProperties } from '../objectWithoutProperties-72d23964.js';
import React__default, { createContext } from 'react';
import PropTypes from 'prop-types';
import cx from 'classnames';

var _excluded = ["children", "className", "spacing", "orientation"];
var ButtonGroupContext = /*#__PURE__*/createContext({});

function ButtonGroup(_ref) {
  var children = _ref.children,
      className = _ref.className,
      _ref$spacing = _ref.spacing,
      spacing = _ref$spacing === void 0 ? 1 : _ref$spacing,
      _ref$orientation = _ref.orientation,
      orientation = _ref$orientation === void 0 ? "horizontal" : _ref$orientation,
      props = _objectWithoutProperties(_ref, _excluded);

  var classes = cx("inline-flex border border-solid border-gray-200 rounded", className, "p-".concat(spacing), "gap-".concat(spacing), {
    "flex-col": orientation === "vertical"
  });
  return /*#__PURE__*/React__default.createElement("div", _extends({}, props, {
    className: classes,
    "data-testid": "btn-group"
  }), /*#__PURE__*/React__default.createElement(ButtonGroupContext.Provider, {
    value: {
      present: true
    }
  }, children));
}
ButtonGroup.propTypes = {
  spacing: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
  orientation: PropTypes.oneOf(["horizontal", "vertical"]),
  className: PropTypes.string,
  children: PropTypes.node
};

export { ButtonGroupContext, ButtonGroup as default };
