@stoplight/elements-dev-portal 1.5.0 → 1.5.1
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.
- package/components/Search/Search.d.ts +1 -0
- package/index.esm.js +5 -5
- package/index.js +4 -4
- package/index.mjs +5 -5
- package/package.json +2 -2
- package/version.d.ts +1 -1
- package/web-components.min.js +1 -1
|
@@ -2,6 +2,7 @@ import { ModalProps } from '@stoplight/mosaic';
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { NodeSearchResult } from '../../types';
|
|
4
4
|
export declare type SearchProps = {
|
|
5
|
+
isLoading?: boolean;
|
|
5
6
|
search?: string;
|
|
6
7
|
searchResults?: NodeSearchResult[];
|
|
7
8
|
onSearch: (search: string) => void;
|
package/index.esm.js
CHANGED
|
@@ -4,7 +4,7 @@ import React__default, { useRef, useEffect, useMemo, useCallback, useState } fro
|
|
|
4
4
|
import { withQueryClientProvider, withMosaicProvider, PersistenceContextProvider, MarkdownComponentsProvider, MockingProvider, Docs, withStyles, withPersistenceBoundary, NodeTypeIconDefs, NodeTypeColors, TableOfContents as TableOfContents$1, PoweredByLink, useRouter, findFirstNode, ReactRouterMarkdownLink, SidebarLayout } from '@stoplight/elements-core';
|
|
5
5
|
import { resolve, dirname } from '@stoplight/path';
|
|
6
6
|
import { NodeType } from '@stoplight/types';
|
|
7
|
-
import { faSearch, faCircleNotch, faExclamationTriangle } from '@fortawesome/free-solid-svg-icons';
|
|
7
|
+
import { faSpinner, faSearch, faCircleNotch, faExclamationTriangle } from '@fortawesome/free-solid-svg-icons';
|
|
8
8
|
import flow from 'lodash/flow.js';
|
|
9
9
|
import { Route, useParams, useHistory, Redirect, Link } from 'react-router-dom';
|
|
10
10
|
import { useQuery } from 'react-query';
|
|
@@ -88,7 +88,7 @@ function getBundledUrl(url) {
|
|
|
88
88
|
return bundledUrl.toString();
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
const SearchImpl = ({ search, searchResults, isOpen, onClose, onClick, onSearch }) => {
|
|
91
|
+
const SearchImpl = ({ isLoading, search, searchResults, isOpen, onClose, onClick, onSearch }) => {
|
|
92
92
|
const listBoxRef = React.useRef(null);
|
|
93
93
|
const onChange = React.useCallback(e => onSearch(e.currentTarget.value), [onSearch]);
|
|
94
94
|
const onKeyDown = React.useCallback(e => {
|
|
@@ -105,7 +105,7 @@ const SearchImpl = ({ search, searchResults, isOpen, onClose, onClick, onSearch
|
|
|
105
105
|
onClick(selectedResult);
|
|
106
106
|
}
|
|
107
107
|
}, [searchResults, onClick]);
|
|
108
|
-
return (React.createElement(Modal, { renderHeader: () => (React.createElement(Input, { appearance: "minimal", borderB: true, size: "lg", icon: React.createElement(Box, { as: Icon, ml: 1, icon: faSearch }), autoFocus: true, placeholder: "Search...", value: search, onChange: onChange, onKeyDown: onKeyDown })), isOpen: !!isOpen, onClose: onClose }, searchResults && searchResults.length > 0 ? (React.createElement(ListBox, { ref: listBoxRef, "aria-label": "Search", overflowY: "auto", h: 80, m: -5, items: searchResults, selectionMode: "single", onSelectionChange: onSelectionChange }, (searchResult) => {
|
|
108
|
+
return (React.createElement(Modal, { renderHeader: () => (React.createElement(Input, { appearance: "minimal", borderB: true, size: "lg", icon: React.createElement(Box, { as: Icon, ml: 1, icon: isLoading ? faSpinner : faSearch, spin: isLoading }), autoFocus: true, placeholder: "Search...", value: search, onChange: onChange, onKeyDown: onKeyDown })), isOpen: !!isOpen, onClose: onClose }, searchResults && searchResults.length > 0 ? (React.createElement(ListBox, { ref: listBoxRef, "aria-label": "Search", overflowY: "auto", h: 80, m: -5, items: searchResults, selectionMode: "single", onSelectionChange: onSelectionChange }, (searchResult) => {
|
|
109
109
|
var _a, _b;
|
|
110
110
|
return (React.createElement(ListBoxItem, { key: `${searchResult.id}-${searchResult.project_id}`, textValue: searchResult.title },
|
|
111
111
|
React.createElement(Box, { p: 3, borderB: true },
|
|
@@ -180,7 +180,7 @@ const UpgradeToStarter = () => (React__default.createElement(Flex, { as: "a", hr
|
|
|
180
180
|
React__default.createElement(Icon, { icon: faExclamationTriangle, size: "4x" }),
|
|
181
181
|
React__default.createElement(Box, { pt: 3 }, "Please upgrade your Stoplight Workspace to the Starter Plan to use Elements Dev Portal in production.")));
|
|
182
182
|
|
|
183
|
-
const appVersion = '1.5.
|
|
183
|
+
const appVersion = '1.5.1';
|
|
184
184
|
|
|
185
185
|
class ResponseError extends Error {
|
|
186
186
|
constructor(message, responseCode) {
|
|
@@ -590,7 +590,7 @@ function useDebounce(value, delay, options) {
|
|
|
590
590
|
function useGetNodes({ search, workspaceId, branchSlug, projectIds, pause, }) {
|
|
591
591
|
const { platformUrl, platformAuthToken } = React.useContext(PlatformContext);
|
|
592
592
|
const [debounceSearch] = useDebounce(search, 500);
|
|
593
|
-
return useQuery(['workspaceNodes', workspaceId, branchSlug, projectIds, debounceSearch
|
|
593
|
+
return useQuery(['workspaceNodes', platformUrl, platformAuthToken, workspaceId, branchSlug, projectIds, debounceSearch], () => getNodes({ workspaceId, branchSlug, projectIds, search: debounceSearch, platformUrl, platformAuthToken }), { enabled: !pause, keepPreviousData: true });
|
|
594
594
|
}
|
|
595
595
|
|
|
596
596
|
function useGetWorkspace({ projectIds }) {
|
package/index.js
CHANGED
|
@@ -115,7 +115,7 @@ function getBundledUrl(url) {
|
|
|
115
115
|
return bundledUrl.toString();
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
const SearchImpl = ({ search, searchResults, isOpen, onClose, onClick, onSearch }) => {
|
|
118
|
+
const SearchImpl = ({ isLoading, search, searchResults, isOpen, onClose, onClick, onSearch }) => {
|
|
119
119
|
const listBoxRef = React__namespace.useRef(null);
|
|
120
120
|
const onChange = React__namespace.useCallback(e => onSearch(e.currentTarget.value), [onSearch]);
|
|
121
121
|
const onKeyDown = React__namespace.useCallback(e => {
|
|
@@ -132,7 +132,7 @@ const SearchImpl = ({ search, searchResults, isOpen, onClose, onClick, onSearch
|
|
|
132
132
|
onClick(selectedResult);
|
|
133
133
|
}
|
|
134
134
|
}, [searchResults, onClick]);
|
|
135
|
-
return (React__namespace.createElement(mosaic.Modal, { renderHeader: () => (React__namespace.createElement(mosaic.Input, { appearance: "minimal", borderB: true, size: "lg", icon: React__namespace.createElement(mosaic.Box, { as: mosaic.Icon, ml: 1, icon: freeSolidSvgIcons.faSearch }), autoFocus: true, placeholder: "Search...", value: search, onChange: onChange, onKeyDown: onKeyDown })), isOpen: !!isOpen, onClose: onClose }, searchResults && searchResults.length > 0 ? (React__namespace.createElement(mosaic.ListBox, { ref: listBoxRef, "aria-label": "Search", overflowY: "auto", h: 80, m: -5, items: searchResults, selectionMode: "single", onSelectionChange: onSelectionChange }, (searchResult) => {
|
|
135
|
+
return (React__namespace.createElement(mosaic.Modal, { renderHeader: () => (React__namespace.createElement(mosaic.Input, { appearance: "minimal", borderB: true, size: "lg", icon: React__namespace.createElement(mosaic.Box, { as: mosaic.Icon, ml: 1, icon: isLoading ? freeSolidSvgIcons.faSpinner : freeSolidSvgIcons.faSearch, spin: isLoading }), autoFocus: true, placeholder: "Search...", value: search, onChange: onChange, onKeyDown: onKeyDown })), isOpen: !!isOpen, onClose: onClose }, searchResults && searchResults.length > 0 ? (React__namespace.createElement(mosaic.ListBox, { ref: listBoxRef, "aria-label": "Search", overflowY: "auto", h: 80, m: -5, items: searchResults, selectionMode: "single", onSelectionChange: onSelectionChange }, (searchResult) => {
|
|
136
136
|
var _a, _b;
|
|
137
137
|
return (React__namespace.createElement(mosaic.ListBoxItem, { key: `${searchResult.id}-${searchResult.project_id}`, textValue: searchResult.title },
|
|
138
138
|
React__namespace.createElement(mosaic.Box, { p: 3, borderB: true },
|
|
@@ -207,7 +207,7 @@ const UpgradeToStarter = () => (React__default["default"].createElement(mosaic.F
|
|
|
207
207
|
React__default["default"].createElement(mosaic.Icon, { icon: freeSolidSvgIcons.faExclamationTriangle, size: "4x" }),
|
|
208
208
|
React__default["default"].createElement(mosaic.Box, { pt: 3 }, "Please upgrade your Stoplight Workspace to the Starter Plan to use Elements Dev Portal in production.")));
|
|
209
209
|
|
|
210
|
-
const appVersion = '1.5.
|
|
210
|
+
const appVersion = '1.5.1';
|
|
211
211
|
|
|
212
212
|
class ResponseError extends Error {
|
|
213
213
|
constructor(message, responseCode) {
|
|
@@ -617,7 +617,7 @@ function useDebounce(value, delay, options) {
|
|
|
617
617
|
function useGetNodes({ search, workspaceId, branchSlug, projectIds, pause, }) {
|
|
618
618
|
const { platformUrl, platformAuthToken } = React__namespace.useContext(PlatformContext);
|
|
619
619
|
const [debounceSearch] = useDebounce(search, 500);
|
|
620
|
-
return reactQuery.useQuery(['workspaceNodes', workspaceId, branchSlug, projectIds, debounceSearch
|
|
620
|
+
return reactQuery.useQuery(['workspaceNodes', platformUrl, platformAuthToken, workspaceId, branchSlug, projectIds, debounceSearch], () => getNodes({ workspaceId, branchSlug, projectIds, search: debounceSearch, platformUrl, platformAuthToken }), { enabled: !pause, keepPreviousData: true });
|
|
621
621
|
}
|
|
622
622
|
|
|
623
623
|
function useGetWorkspace({ projectIds }) {
|
package/index.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import React__default, { useRef, useEffect, useMemo, useCallback, useState } fro
|
|
|
4
4
|
import { withQueryClientProvider, withMosaicProvider, PersistenceContextProvider, MarkdownComponentsProvider, MockingProvider, Docs, withStyles, withPersistenceBoundary, NodeTypeIconDefs, NodeTypeColors, TableOfContents as TableOfContents$1, PoweredByLink, useRouter, findFirstNode, ReactRouterMarkdownLink, SidebarLayout } from '@stoplight/elements-core';
|
|
5
5
|
import { resolve, dirname } from '@stoplight/path';
|
|
6
6
|
import { NodeType } from '@stoplight/types';
|
|
7
|
-
import { faSearch, faCircleNotch, faExclamationTriangle } from '@fortawesome/free-solid-svg-icons';
|
|
7
|
+
import { faSpinner, faSearch, faCircleNotch, faExclamationTriangle } from '@fortawesome/free-solid-svg-icons';
|
|
8
8
|
import flow from 'lodash/flow.js';
|
|
9
9
|
import { Route, useParams, useHistory, Redirect, Link } from 'react-router-dom';
|
|
10
10
|
import { useQuery } from 'react-query';
|
|
@@ -88,7 +88,7 @@ function getBundledUrl(url) {
|
|
|
88
88
|
return bundledUrl.toString();
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
const SearchImpl = ({ search, searchResults, isOpen, onClose, onClick, onSearch }) => {
|
|
91
|
+
const SearchImpl = ({ isLoading, search, searchResults, isOpen, onClose, onClick, onSearch }) => {
|
|
92
92
|
const listBoxRef = React.useRef(null);
|
|
93
93
|
const onChange = React.useCallback(e => onSearch(e.currentTarget.value), [onSearch]);
|
|
94
94
|
const onKeyDown = React.useCallback(e => {
|
|
@@ -105,7 +105,7 @@ const SearchImpl = ({ search, searchResults, isOpen, onClose, onClick, onSearch
|
|
|
105
105
|
onClick(selectedResult);
|
|
106
106
|
}
|
|
107
107
|
}, [searchResults, onClick]);
|
|
108
|
-
return (React.createElement(Modal, { renderHeader: () => (React.createElement(Input, { appearance: "minimal", borderB: true, size: "lg", icon: React.createElement(Box, { as: Icon, ml: 1, icon: faSearch }), autoFocus: true, placeholder: "Search...", value: search, onChange: onChange, onKeyDown: onKeyDown })), isOpen: !!isOpen, onClose: onClose }, searchResults && searchResults.length > 0 ? (React.createElement(ListBox, { ref: listBoxRef, "aria-label": "Search", overflowY: "auto", h: 80, m: -5, items: searchResults, selectionMode: "single", onSelectionChange: onSelectionChange }, (searchResult) => {
|
|
108
|
+
return (React.createElement(Modal, { renderHeader: () => (React.createElement(Input, { appearance: "minimal", borderB: true, size: "lg", icon: React.createElement(Box, { as: Icon, ml: 1, icon: isLoading ? faSpinner : faSearch, spin: isLoading }), autoFocus: true, placeholder: "Search...", value: search, onChange: onChange, onKeyDown: onKeyDown })), isOpen: !!isOpen, onClose: onClose }, searchResults && searchResults.length > 0 ? (React.createElement(ListBox, { ref: listBoxRef, "aria-label": "Search", overflowY: "auto", h: 80, m: -5, items: searchResults, selectionMode: "single", onSelectionChange: onSelectionChange }, (searchResult) => {
|
|
109
109
|
var _a, _b;
|
|
110
110
|
return (React.createElement(ListBoxItem, { key: `${searchResult.id}-${searchResult.project_id}`, textValue: searchResult.title },
|
|
111
111
|
React.createElement(Box, { p: 3, borderB: true },
|
|
@@ -180,7 +180,7 @@ const UpgradeToStarter = () => (React__default.createElement(Flex, { as: "a", hr
|
|
|
180
180
|
React__default.createElement(Icon, { icon: faExclamationTriangle, size: "4x" }),
|
|
181
181
|
React__default.createElement(Box, { pt: 3 }, "Please upgrade your Stoplight Workspace to the Starter Plan to use Elements Dev Portal in production.")));
|
|
182
182
|
|
|
183
|
-
const appVersion = '1.5.
|
|
183
|
+
const appVersion = '1.5.1';
|
|
184
184
|
|
|
185
185
|
class ResponseError extends Error {
|
|
186
186
|
constructor(message, responseCode) {
|
|
@@ -590,7 +590,7 @@ function useDebounce(value, delay, options) {
|
|
|
590
590
|
function useGetNodes({ search, workspaceId, branchSlug, projectIds, pause, }) {
|
|
591
591
|
const { platformUrl, platformAuthToken } = React.useContext(PlatformContext);
|
|
592
592
|
const [debounceSearch] = useDebounce(search, 500);
|
|
593
|
-
return useQuery(['workspaceNodes', workspaceId, branchSlug, projectIds, debounceSearch
|
|
593
|
+
return useQuery(['workspaceNodes', platformUrl, platformAuthToken, workspaceId, branchSlug, projectIds, debounceSearch], () => getNodes({ workspaceId, branchSlug, projectIds, search: debounceSearch, platformUrl, platformAuthToken }), { enabled: !pause, keepPreviousData: true });
|
|
594
594
|
}
|
|
595
595
|
|
|
596
596
|
function useGetWorkspace({ projectIds }) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stoplight/elements-dev-portal",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"description": "UI components for composing beautiful developer documentation.",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"main": "./index.js",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@fortawesome/free-solid-svg-icons": "^5.10.2",
|
|
30
|
-
"@stoplight/elements-core": "~7.4.
|
|
30
|
+
"@stoplight/elements-core": "~7.4.1",
|
|
31
31
|
"@stoplight/markdown-viewer": "^5.3.2",
|
|
32
32
|
"@stoplight/mosaic": "^1.12.4",
|
|
33
33
|
"@stoplight/path": "^1.3.2",
|
package/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const appVersion = "1.5.
|
|
1
|
+
export declare const appVersion = "1.5.1";
|