@redocly/openapi-docs 3.9.0 → 3.10.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.OperationsNavigation=void 0,exports.OperationsNavigationComponent=OperationsNavigationComponent;const jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),react_router_dom_1=require("react-router-dom"),theme_1=require("@redocly/theme"),styled_components_1=__importDefault(require("styled-components")),index_1=require("jotai/index"),common_1=require("../common"),app_1=require("../../jotai/app"),OperationNavigationItems_1=require("./OperationNavigationItems"),styled_1=require("./styled"),hooks_1=require("../../hooks"),MAX_OPERATIONS=8;function OperationsNavigationComponent({items:e,routingBasePath:t}){const o=(0,hooks_1.useTranslate)(),[a,i]=(0,react_1.useState)(!1),n=(0,react_router_dom_1.useNavigate)(),r=(0,index_1.useAtomValue)(app_1.layoutAtom)===theme_1.LayoutVariant.STACKED,{operations:s,webhooks:p,count:
|
|
1
|
+
"use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.OperationsNavigation=void 0,exports.OperationsNavigationComponent=OperationsNavigationComponent;const jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),react_router_dom_1=require("react-router-dom"),theme_1=require("@redocly/theme"),styled_components_1=__importDefault(require("styled-components")),index_1=require("jotai/index"),common_1=require("../common"),app_1=require("../../jotai/app"),OperationNavigationItems_1=require("./OperationNavigationItems"),styled_1=require("./styled"),hooks_1=require("../../hooks"),MAX_OPERATIONS=8;function OperationsNavigationComponent({items:e,routingBasePath:t}){const o=(0,hooks_1.useTranslate)(),[a,i]=(0,react_1.useState)(!1),n=(0,react_router_dom_1.useNavigate)(),r=(0,index_1.useAtomValue)(app_1.layoutAtom)===theme_1.LayoutVariant.STACKED,{operations:s,webhooks:p,count:u}=(0,react_1.useMemo)((()=>{const t=e.filter((e=>"operation"===e.type)),o=a?t:t.slice(0,MAX_OPERATIONS),{operations:i,webhooks:n}=o.reduce(((e,t)=>(t.isWebhook?e.webhooks.push(t):e.operations.push(t),e)),{operations:[],webhooks:[]});return{operations:i,webhooks:n,count:!a&&t.length>MAX_OPERATIONS?t.length-MAX_OPERATIONS:0}}),[a,e]),_=(0,react_1.useCallback)((e=>n(e)),[n]);return s.length||p.length?(0,jsx_runtime_1.jsxs)(Wrapper,{isStacked:r,"data-testid":"operation-navigation-list",children:[s.length>0&&(0,jsx_runtime_1.jsx)(OperationNavigationItems_1.OperationNavigationItems,{items:s,onClick:_,routingBasePath:t,translate:o,title:o("openapi.operations","Operations")}),p.length>0&&(0,jsx_runtime_1.jsx)(OperationNavigationItems_1.OperationNavigationItems,{items:p,onClick:_,routingBasePath:t,translate:o,title:o("openapi.webhooks","Webhooks")}),!a&&Boolean(u)&&(0,jsx_runtime_1.jsxs)(styled_1.StyledButton,{variant:"link",size:"large","data-testid":"show-more-operations",fullWidth:!0,onClick:()=>i(!0),children:[o("openapi.actions.show","Show")," ",u," ",o("openapi.actions.more","more"),"..."]})]}):null}exports.OperationsNavigation=(0,react_1.memo)(OperationsNavigationComponent);const Wrapper=(0,styled_components_1.default)(common_1.SamplesPanel)`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
gap: var(--spacing-xxs);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{useMemo,memo,useState,useCallback}from"react";import{useNavigate}from"react-router-dom";import{LayoutVariant}from"@redocly/theme";import styled from"styled-components";import{useAtomValue}from"jotai/index";import{SamplesPanel}from"../common";import{layoutAtom}from"../../jotai/app";import{OperationNavigationItems}from"./OperationNavigationItems";import{StyledButton}from"./styled";import{useTranslate}from"../../hooks";const MAX_OPERATIONS=8;export function OperationsNavigationComponent({items:o,routingBasePath:t}){const e=useTranslate(),[a,
|
|
1
|
+
import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{useMemo,memo,useState,useCallback}from"react";import{useNavigate}from"react-router-dom";import{LayoutVariant}from"@redocly/theme";import styled from"styled-components";import{useAtomValue}from"jotai/index";import{SamplesPanel}from"../common";import{layoutAtom}from"../../jotai/app";import{OperationNavigationItems}from"./OperationNavigationItems";import{StyledButton}from"./styled";import{useTranslate}from"../../hooks";const MAX_OPERATIONS=8;export function OperationsNavigationComponent({items:o,routingBasePath:t}){const e=useTranslate(),[a,i]=useState(!1),s=useNavigate(),n=useAtomValue(layoutAtom)===LayoutVariant.STACKED,{operations:r,webhooks:p,count:m}=useMemo((()=>{const t=o.filter((o=>"operation"===o.type)),e=a?t:t.slice(0,MAX_OPERATIONS),{operations:i,webhooks:s}=e.reduce(((o,t)=>(t.isWebhook?o.webhooks.push(t):o.operations.push(t),o)),{operations:[],webhooks:[]});return{operations:i,webhooks:s,count:!a&&t.length>MAX_OPERATIONS?t.length-MAX_OPERATIONS:0}}),[a,o]),l=useCallback((o=>s(o)),[s]);return r.length||p.length?_jsxs(Wrapper,{isStacked:n,"data-testid":"operation-navigation-list",children:[r.length>0&&_jsx(OperationNavigationItems,{items:r,onClick:l,routingBasePath:t,translate:e,title:e("openapi.operations","Operations")}),p.length>0&&_jsx(OperationNavigationItems,{items:p,onClick:l,routingBasePath:t,translate:e,title:e("openapi.webhooks","Webhooks")}),!a&&Boolean(m)&&_jsxs(StyledButton,{variant:"link",size:"large","data-testid":"show-more-operations",fullWidth:!0,onClick:()=>i(!0),children:[e("openapi.actions.show","Show")," ",m," ",e("openapi.actions.more","more"),"..."]})]}):null}export const OperationsNavigation=memo(OperationsNavigationComponent);const Wrapper=styled(SamplesPanel)`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
gap: var(--spacing-xxs);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/openapi-docs",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.10.0-next.0",
|
|
4
4
|
"description": "Redocly OpenAPI Docs",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib-esm/index.js",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"openapi-docs": "bin.js"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
|
-
"@redocly/theme": ">=0.
|
|
19
|
+
"@redocly/theme": ">=0.54.0-next.0",
|
|
20
20
|
"core-js": "^3.1.4",
|
|
21
21
|
"react": "^18.0.0",
|
|
22
22
|
"react-dom": "^18.0.0",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"util": "~0.12.5",
|
|
47
47
|
"web-vitals": "3.3.1",
|
|
48
48
|
"@redocly/config": "0.24.1",
|
|
49
|
-
"@redocly/replay": "0.
|
|
49
|
+
"@redocly/replay": "0.13.0-next.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@shikijs/transformers": "1.24.0",
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"webpack": "5.94.0",
|
|
93
93
|
"webpack-cli": "5.1.4",
|
|
94
94
|
"webpack-dev-server": "5.1.0",
|
|
95
|
-
"@redocly/theme": "0.
|
|
95
|
+
"@redocly/theme": "0.54.0-next.0"
|
|
96
96
|
},
|
|
97
97
|
"scripts": {
|
|
98
98
|
"start": "npm run copy-highlight-hook && webpack serve --mode=development --hot",
|