"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var _chunkSJ67AQ6Icjs = require('./chunk-SJ67AQ6I.cjs');


var _chunkSNSG4HBQcjs = require('./chunk-SNSG4HBQ.cjs');


var _chunkRSHN4K6Ncjs = require('./chunk-RSHN4K6N.cjs');


var _chunkGH54P25Bcjs = require('./chunk-GH54P25B.cjs');


var _chunkJA7KZV3Qcjs = require('./chunk-JA7KZV3Q.cjs');



var _chunkZ6EUSUADcjs = require('./chunk-Z6EUSUAD.cjs');

// src/components/TextButton.tsx
var _react = require('@emotion/react');
var _styled = require('@emotion/styled'); var _styled2 = _interopRequireDefault(_styled);
var _jsxruntime = require('@emotion/react/jsx-runtime');
function TextButton({
  text: textProp,
  to,
  href,
  toParams,
  onClick,
  rightIcon,
  leftIcon,
  elide: elideArgs,
  disabled = false,
  mt = 0,
  ml = 0,
  mr = 0,
  padding = "0",
  iconMatchTextColor = false,
  typography
}) {
  const text = elideArgs ? _chunkJA7KZV3Qcjs.elide.call(void 0, textProp, elideArgs) : textProp;
  let rightIconProp = rightIcon;
  if (typeof rightIcon === "undefined" && typeof leftIcon === "undefined") {
    rightIconProp = {
      name: "ArrowRight"
    };
  }
  const defaultIconColor = iconMatchTextColor ? void 0 : "mcNeutral";
  const content = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, 
    _chunkSJ67AQ6Icjs.TextIconAligner,
    {
      onClick,
      leftIcon: leftIcon ? {
        name: leftIcon.name,
        color: leftIcon.color || defaultIconColor,
        width: leftIcon.width
      } : null,
      content: text,
      typography: _chunkZ6EUSUADcjs.__spreadValues.call(void 0, { size: "ExtraSmall" }, typography),
      rightIcon: rightIconProp ? {
        name: rightIconProp.name,
        color: rightIconProp.color || defaultIconColor,
        width: rightIconProp.width
      } : null
    }
  );
  const commonProps = {
    type: "button",
    onClick,
    disabled,
    padding,
    css: {
      marginTop: mt ? `${mt}px` : void 0,
      marginLeft: ml ? `${ml}px` : void 0,
      marginRight: mr ? `${mr}px` : void 0
    }
  };
  if (to) {
    return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ButtonLink, _chunkZ6EUSUADcjs.__spreadProps.call(void 0, _chunkZ6EUSUADcjs.__spreadValues.call(void 0, {}, commonProps), { to, params: toParams, children: content }));
  }
  return href ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ButtonHrefLink, _chunkZ6EUSUADcjs.__spreadProps.call(void 0, _chunkZ6EUSUADcjs.__spreadValues.call(void 0, {}, commonProps), { href, target: "_blank", children: content })) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, StyledButton, _chunkZ6EUSUADcjs.__spreadProps.call(void 0, _chunkZ6EUSUADcjs.__spreadValues.call(void 0, {}, commonProps), { children: content }));
}
var buttonStyle = ({
  theme,
  disabled,
  padding
}) => _react.css`
  display: inline-flex;
  opacity: ${disabled ? 0.2 : 1};
  align-items: center;
  transition: opacity 0.2s;
  padding: ${padding};

  &:focus-visible {
    outline: ${_chunkRSHN4K6Ncjs.getFocusOutline.call(void 0, { theme })};
  }

  & > * {
    width: 100%;
    text-align: center;
    white-space: nowrap;
    cursor: ${disabled ? "not-allowed" : "pointer"};
  }
`;
var StyledButton = _styled2.default.call(void 0, _chunkSNSG4HBQcjs.UnstyledButton)`
  ${(props) => buttonStyle(props)}
`;
var ButtonLink = _styled2.default.call(void 0, _chunkGH54P25Bcjs.Link)`
  ${(props) => buttonStyle(props)}
`;
var ButtonHrefLink = _styled2.default.a`
  ${(props) => buttonStyle(props)}
`;



exports.TextButton = TextButton;
