"use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.TagItem=exports.TagItemComponent=void 0;const jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),theme_1=require("@redocly/theme"),react_router_dom_1=require("react-router-dom"),styled_components_1=__importDefault(require("styled-components")),jotai_1=require("jotai"),common_1=require("../common"),Markdown_1=require("../Markdown"),OperationsNavigation_1=require("./OperationsNavigation"),app_1=require("../../jotai/app");function TagItemComponent({item:e,routingBasePath:t="",isExpanded:a}){const{description:r,name:n,href:i}=e,o=(0,react_router_dom_1.useNavigate)(),m=(0,jotai_1.useAtomValue)(app_1.layoutAtom),s=(0,react_1.useCallback)((()=>{o(t+e.href)}),[e.href,o,t]),_=Boolean(e.items.length),u=m===theme_1.LayoutVariant.STACKED;return(0,jsx_runtime_1.jsxs)(Wrapper,{expanded:a,children:[(0,jsx_runtime_1.jsxs)(common_1.Row,{layout:m,children:[(0,jsx_runtime_1.jsxs)(common_1.SamplesMiddlePanel,{fullWidth:!_,isStacked:u,children:[(0,jsx_runtime_1.jsxs)(Heading,{children:[(0,jsx_runtime_1.jsx)(common_1.ShareLink,{to:i,"aria-label":`link to ${n}`}),n]}),(0,jsx_runtime_1.jsx)(Markdown_1.Markdown,{source:r})]}),_&&(0,jsx_runtime_1.jsx)(OperationsNavigation_1.OperationsNavigation,{items:e.items,routingBasePath:t})]}),_&&!a&&(0,jsx_runtime_1.jsx)(ShowButton,{type:"button",variant:"text",size:"medium",onClick:s,children:"+ Show"})]})}exports.TagItemComponent=TagItemComponent,exports.TagItem=(0,react_1.memo)(TagItemComponent);const Wrapper=styled_components_1.default.div`
  padding-top: var(--spacing-lg);
  padding-bottom: ${({expanded:e})=>e?"var(--spacing-xxl)":""};
`,ShowButton=(0,styled_components_1.default)(theme_1.Button)`
  margin: var(--spacing-md) var(--spacing-xl) var(--spacing-xxs);
  width: calc(100% - var(--spacing-xl) * 2);

  @media screen and (min-width: ${theme_1.breakpoints.medium}) {
    --button-margin-md: calc(var(--spacing-xl) * 2);

    margin-left: var(--button-margin-md);
    margin-right: var(--button-margin-md);
    width: calc(100% - var(--button-margin-md) * 2);
  }
`,Heading=(0,styled_components_1.default)(theme_1.H2)`
  :hover {
    ${theme_1.LinkIcon} {
      opacity: 1;
      visibility: visible;
    }
  }
`;
//# sourceMappingURL=TagItem.js.map