/* index.tsx generated by @compiled/babel-plugin v0.39.1 */
import _extends from "@babel/runtime/helpers/extends";
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
var _excluded = ["children", "isDisabled", "viewType", "isSlimDesign"],
  _excluded2 = ["onClick"];
import "./index.compiled.css";
import * as React from 'react';
import { ax, ix } from "@compiled/react/runtime";
import { forwardRef } from 'react';
import { fg } from '@atlaskit/platform-feature-flags';
import { Pressable, Box } from '@atlaskit/primitives/compiled';
var styles = {
  button: "_1e0c1bgi",
  innerContainer: "_1e0c1nu9 _1y1m1u8q _16d9qvcn _k48p1wq8 _19bv12x7 _ca0qv77o _n3tdv77o _u5f312x7 _y3gn18uv _o5721btx _1nmz9jpi",
  innerContainerSocialProofConnect: "_2rko12b0 _syaz15cr _80omtlke _bfhkjmqp _2hwxv77o _1e0c1nu9 _4cvr1h6o _1wybtjj4 _1y1m1u8q _16d9qvcn _19bv12x7 _ca0qv77o _n3tdv77o _u5f312x7 _y3gn18uv _s7n4t94y _o5721btx _1nmz9jpi _irr31q28 _1di612kk",
  innerContainerNoWrap: "_o5721q9c _1nmz4jg8",
  enabled: "_syazi7uo _80omtlke _bfhki8nm _irr3plhp _1di61gdz",
  disabled: "_syaz1gmx _80om13gf _bfhk187o",
  unauthorised: "_syaz15cr _80omtlke _bfhkjmqp _qrwqlb4i _1o0zlb4i _13lilb4i _mrkblb4i _ca0qt94y _n3tdt94y _2hwxt94y _k48pi7a9 _irr31q28 _1di612kk"
};

/* eslint-enable @compiled/shorthand-property-sorting */

/**
 * Action button has to be a span for the overflow to work correctly
 */
export var ActionButton = /*#__PURE__*/forwardRef(function (_ref, ref) {
  var children = _ref.children,
    isDisabled = _ref.isDisabled,
    _ref$viewType = _ref.viewType,
    viewType = _ref$viewType === void 0 ? 'default' : _ref$viewType,
    _ref$isSlimDesign = _ref.isSlimDesign,
    isSlimDesign = _ref$isSlimDesign === void 0 ? false : _ref$isSlimDesign,
    props = _objectWithoutProperties(_ref, _excluded);
  var shouldUseUnauthorisedSlimStyle = viewType === 'unauthorised' && isSlimDesign && fg('platform_sl_3p_preauth_soc_proof_inline_killswitch');
  if (shouldUseUnauthorisedSlimStyle && !isDisabled) {
    var onClick = props.onClick,
      boxProps = _objectWithoutProperties(props, _excluded2);
    return /*#__PURE__*/React.createElement(Box, _extends({}, boxProps, {
      ref: ref,
      style: {
        font: "inherit"
      },
      xcss: styles.button
    }), /*#__PURE__*/React.createElement("span", {
      className: ax([styles.innerContainerSocialProofConnect, fg('platform_lp_social_proof_inline_overflow_bug') && ""])
    }, children));
  }
  return /*#__PURE__*/React.createElement(Pressable, _extends({}, props, {
    isDisabled: isDisabled,
    ref: ref
    // We need to reset Pressable fixed font size to allow inline card to inherit the font size
    // from parent component such as paragraph and heading
    ,
    style: {
      font: "inherit"
    },
    xcss: styles.button
  }), /*#__PURE__*/React.createElement("span", {
    tabIndex: isDisabled ? undefined : 0,
    className: ax([styles.innerContainer, isDisabled ? styles.disabled : viewType === 'unauthorised' ? styles.unauthorised : styles.enabled])
  }, children));
});