var _excluded = ["children"],
  _excluded2 = ["children", "settingsHref", "settingsLink"],
  _excluded3 = ["children"];
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
import { Cog } from '@procore/core-icons/dist';
import React from 'react';
import { LinkButton } from '../Button';
import { DetailPage, DetailPageViewContext } from '../DetailPage';
import { Page } from '../PageLayout';
import { Tooltip } from '../Tooltip';
import { useI18nContext } from '../_hooks/I18n';
import { addSubcomponents } from '../_utils/addSubcomponents';
import { StyledTitleInner, StyledTitleOuter, StyledToolLandingPageBodyContent } from './ToolLandingPage.styles';
export var ToolLandingPage_ = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
  var children = _ref.children,
    props = _objectWithoutProperties(_ref, _excluded);
  return /*#__PURE__*/React.createElement(DetailPageViewContext.Provider, {
    value: {
      width: 'xl',
      hasNavigation: false
    }
  }, /*#__PURE__*/React.createElement(Page, _extends({
    ref: ref
  }, props, {
    "data-core-react": "tool-landing-page"
  }), children));
});
export var Title = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
  var children = _ref2.children,
    settingsHref = _ref2.settingsHref,
    settingsLink = _ref2.settingsLink,
    props = _objectWithoutProperties(_ref2, _excluded2);
  var i18n = useI18nContext();

  // Use settingsLink if provided, otherwise fall back to settingsHref for backwards compatibility
  var link = settingsLink !== null && settingsLink !== void 0 ? settingsLink : settingsHref;
  var settingsLinkIsString = typeof link === 'string';
  var settingsButton = link ? /*#__PURE__*/React.createElement(Tooltip, {
    overlay: i18n.t('core.toolHeader.settingsAction'),
    trigger: ['hover', 'focus']
  }, /*#__PURE__*/React.createElement(LinkButton, {
    "aria-label": i18n.t('core.toolHeader.settingsAction'),
    as: settingsLinkIsString ? undefined : link,
    href: settingsLinkIsString ? link : undefined,
    icon: /*#__PURE__*/React.createElement(Cog, null),
    role: "link",
    variant: "secondary"
  })) : null;
  return /*#__PURE__*/React.createElement(StyledTitleOuter, _extends({
    ref: ref
  }, props), settingsButton, /*#__PURE__*/React.createElement(StyledTitleInner, null, children));
});
export var Body = /*#__PURE__*/React.forwardRef(function (_ref3, ref) {
  var children = _ref3.children,
    props = _objectWithoutProperties(_ref3, _excluded3);
  return /*#__PURE__*/React.createElement(DetailPage.Body, _extends({
    ref: ref
  }, props), /*#__PURE__*/React.createElement(StyledToolLandingPageBodyContent, null, children));
});

/**
 * A list page is basically a copy of SettingsPage/DetailPage. However, it has some differences.
 * ToolLandingPage does not have Breadcrumbs, nested sections (although, we may need them in the future), and Footer.
 *
 * @since 12.9.0
 *
 * @see [Storybook](https://stories.core.procore.com/?path=/story/core-react_demos-toollandingpage--demo)
 *
 * @see [Design Guidelines](https://design.procore.com/tool-landing-layout)
 */

export var ToolLandingPage = addSubcomponents({
  Main: Page.Main,
  Header: Page.Header,
  Banner: Page.Banner,
  Title: Title,
  Tabs: Page.Tabs,
  Body: Body,
  Aside: Page.Aside
}, ToolLandingPage_);
ToolLandingPage_.displayName = 'ToolLandingPage';
//# sourceMappingURL=ToolLandingPage.js.map