Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@docsearch/react

Package Overview
Dependencies
Maintainers
3
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@docsearch/react - npm Package Compare versions

Comparing version 3.0.0 to 3.1.0

348

dist/esm/__tests__/api.test.js

@@ -13,3 +13,3 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }

import { render, fireEvent, waitFor, screen, act } from '@testing-library/react';
import { render, act, fireEvent, screen } from '@testing-library/react';
import React from 'react';

@@ -47,8 +47,15 @@ import '@testing-library/jest-dom';

describe('api', function () {
var container;
var docSearchSelector = '.DocSearch';
beforeEach(function () {
document.body.innerHTML = '';
container = document.createElement('div');
document.body.appendChild(container);
});
afterEach(function () {
document.body.removeChild(container);
container = null;
});
it('renders with minimal parameters', function () {
render( /*#__PURE__*/React.createElement(DocSearch, null));
expect(document.querySelector('.DocSearch')).toBeInTheDocument();
expect(document.querySelector(docSearchSelector)).toBeInTheDocument();
});

@@ -65,9 +72,10 @@ describe('translations', function () {

}));
expect(document.querySelector(docSearchSelector)).toBeInTheDocument();
expect(document.querySelector('.DocSearch-Button-Placeholder').innerHTML).toBe('Recherche');
expect(document.querySelector('.DocSearch-Button').getAttribute('aria-label')).toBe('Recherche');
});
it('overrides the default DocSearchModal startScreen text', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
return regeneratorRuntime.wrap(function _callee$(_context) {
it('overrides the default DocSearchModal startScreen text', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
return regeneratorRuntime.wrap(function _callee2$(_context2) {
while (1) {
switch (_context.prev = _context.next) {
switch (_context2.prev = _context2.next) {
case 0:

@@ -83,21 +91,41 @@ render( /*#__PURE__*/React.createElement(DocSearch, {

}));
_context.next = 3;
return waitFor(function () {
fireEvent.click(document.querySelector('.DocSearch-Button'));
});
expect(document.querySelector(docSearchSelector)).toBeInTheDocument();
_context2.next = 4;
return act( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_context.t0 = fireEvent;
_context.next = 3;
return screen.findByText('Search');
case 3:
case 3:
_context.t1 = _context.sent;
_context.t0.click.call(_context.t0, _context.t1);
case 5:
case "end":
return _context.stop();
}
}
}, _callee);
})));
case 4:
expect(document.querySelector('.DocSearch-Modal')).toBeInTheDocument();
expect(screen.getByText('Pas de recherche récentes')).toBeInTheDocument();
case 4:
case 6:
case "end":
return _context.stop();
return _context2.stop();
}
}
}, _callee);
}, _callee2);
})));
it('overrides the default DocSearchModal noResultsScreen text', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
return regeneratorRuntime.wrap(function _callee3$(_context3) {
it('overrides the default DocSearchModal noResultsScreen text', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5() {
return regeneratorRuntime.wrap(function _callee5$(_context5) {
while (1) {
switch (_context3.prev = _context3.next) {
switch (_context5.prev = _context5.next) {
case 0:

@@ -123,29 +151,56 @@ render( /*#__PURE__*/React.createElement(DocSearch, {

}));
_context3.next = 3;
return act( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
return regeneratorRuntime.wrap(function _callee2$(_context2) {
expect(document.querySelector(docSearchSelector)).toBeInTheDocument();
_context5.next = 4;
return act( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
return regeneratorRuntime.wrap(function _callee3$(_context3) {
while (1) {
switch (_context2.prev = _context2.next) {
switch (_context3.prev = _context3.next) {
case 0:
_context2.next = 2;
return waitFor(function () {
fireEvent.click(document.querySelector('.DocSearch-Button'));
});
_context3.t0 = fireEvent;
_context3.next = 3;
return screen.findByText('Search');
case 2:
fireEvent.input(document.querySelector('.DocSearch-Input'), {
case 3:
_context3.t1 = _context3.sent;
_context3.t0.click.call(_context3.t0, _context3.t1);
case 5:
case "end":
return _context3.stop();
}
}
}, _callee3);
})));
case 4:
_context5.next = 6;
return act( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4() {
return regeneratorRuntime.wrap(function _callee4$(_context4) {
while (1) {
switch (_context4.prev = _context4.next) {
case 0:
_context4.t0 = fireEvent;
_context4.next = 3;
return screen.findByPlaceholderText('Search docs');
case 3:
_context4.t1 = _context4.sent;
_context4.t2 = {
target: {
value: 'q'
}
});
};
case 3:
_context4.t0.input.call(_context4.t0, _context4.t1, _context4.t2);
case 6:
case "end":
return _context2.stop();
return _context4.stop();
}
}
}, _callee2);
}, _callee4);
})));
case 3:
case 6:
expect(screen.getByText(/Pas de résultats pour/)).toBeInTheDocument();

@@ -157,13 +212,13 @@ expect(screen.getByText(/Ouvrez une issue sur docsearch-configs/)).toBeInTheDocument();

case 6:
case 9:
case "end":
return _context3.stop();
return _context5.stop();
}
}
}, _callee3);
}, _callee5);
})));
it('overrides the default DocSearchModal searchbox text', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4() {
return regeneratorRuntime.wrap(function _callee4$(_context4) {
it('overrides the default DocSearchModal searchbox text', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7() {
return regeneratorRuntime.wrap(function _callee7$(_context7) {
while (1) {
switch (_context4.prev = _context4.next) {
switch (_context7.prev = _context7.next) {
case 0:

@@ -182,8 +237,27 @@ render( /*#__PURE__*/React.createElement(DocSearch, {

}));
_context4.next = 3;
return waitFor(function () {
fireEvent.click(document.querySelector('.DocSearch-Button'));
});
expect(document.querySelector(docSearchSelector)).toBeInTheDocument();
_context7.next = 4;
return act( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6() {
return regeneratorRuntime.wrap(function _callee6$(_context6) {
while (1) {
switch (_context6.prev = _context6.next) {
case 0:
_context6.t0 = fireEvent;
_context6.next = 3;
return screen.findByText('Search');
case 3:
case 3:
_context6.t1 = _context6.sent;
_context6.t0.click.call(_context6.t0, _context6.t1);
case 5:
case "end":
return _context6.stop();
}
}
}, _callee6);
})));
case 4:
expect(document.querySelector('.DocSearch-Cancel').innerHTML).toBe('Annuler');

@@ -194,13 +268,13 @@ expect(document.querySelector('.DocSearch-Cancel').getAttribute('aria-label')).toBe('Annuler');

case 7:
case 8:
case "end":
return _context4.stop();
return _context7.stop();
}
}
}, _callee4);
}, _callee7);
})));
it('overrides the default DocSearchModal footer text', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5() {
return regeneratorRuntime.wrap(function _callee5$(_context5) {
it('overrides the default DocSearchModal footer text', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee9() {
return regeneratorRuntime.wrap(function _callee9$(_context9) {
while (1) {
switch (_context5.prev = _context5.next) {
switch (_context9.prev = _context9.next) {
case 0:

@@ -223,8 +297,27 @@ render( /*#__PURE__*/React.createElement(DocSearch, {

}));
_context5.next = 3;
return waitFor(function () {
fireEvent.click(document.querySelector('.DocSearch-Button'));
});
expect(document.querySelector(docSearchSelector)).toBeInTheDocument();
_context9.next = 4;
return act( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee8() {
return regeneratorRuntime.wrap(function _callee8$(_context8) {
while (1) {
switch (_context8.prev = _context8.next) {
case 0:
_context8.t0 = fireEvent;
_context8.next = 3;
return screen.findByText('Search');
case 3:
case 3:
_context8.t1 = _context8.sent;
_context8.t0.click.call(_context8.t0, _context8.t1);
case 5:
case "end":
return _context8.stop();
}
}
}, _callee8);
})));
case 4:
expect(screen.getByText('Recherche par')).toBeInTheDocument();

@@ -239,15 +332,15 @@ expect(screen.getByText('Pour fermer')).toBeInTheDocument();

case 11:
case 12:
case "end":
return _context5.stop();
return _context9.stop();
}
}
}, _callee5);
}, _callee9);
})));
});
describe('getMissingResultsUrl', function () {
it('does not render the link to the repository by default', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7() {
return regeneratorRuntime.wrap(function _callee7$(_context7) {
it('does not render the link to the repository by default', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee12() {
return regeneratorRuntime.wrap(function _callee12$(_context12) {
while (1) {
switch (_context7.prev = _context7.next) {
switch (_context12.prev = _context12.next) {
case 0:

@@ -261,44 +354,71 @@ render( /*#__PURE__*/React.createElement(DocSearch, {

}));
_context7.next = 3;
return act( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6() {
return regeneratorRuntime.wrap(function _callee6$(_context6) {
expect(document.querySelector(docSearchSelector)).toBeInTheDocument();
_context12.next = 4;
return act( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee10() {
return regeneratorRuntime.wrap(function _callee10$(_context10) {
while (1) {
switch (_context6.prev = _context6.next) {
switch (_context10.prev = _context10.next) {
case 0:
_context6.next = 2;
return waitFor(function () {
fireEvent.click(document.querySelector('.DocSearch-Button'));
});
_context10.t0 = fireEvent;
_context10.next = 3;
return screen.findByText('Search');
case 2:
fireEvent.input(document.querySelector('.DocSearch-Input'), {
case 3:
_context10.t1 = _context10.sent;
_context10.t0.click.call(_context10.t0, _context10.t1);
case 5:
case "end":
return _context10.stop();
}
}
}, _callee10);
})));
case 4:
_context12.next = 6;
return act( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee11() {
return regeneratorRuntime.wrap(function _callee11$(_context11) {
while (1) {
switch (_context11.prev = _context11.next) {
case 0:
_context11.t0 = fireEvent;
_context11.next = 3;
return screen.findByPlaceholderText('Search docs');
case 3:
_context11.t1 = _context11.sent;
_context11.t2 = {
target: {
value: 'q'
}
});
};
case 3:
_context11.t0.input.call(_context11.t0, _context11.t1, _context11.t2);
case 6:
case "end":
return _context6.stop();
return _context11.stop();
}
}
}, _callee6);
}, _callee11);
})));
case 3:
case 6:
expect(screen.getByText(/No results for/)).toBeInTheDocument();
expect(document.querySelector('.DocSearch-Help a')).not.toBeInTheDocument();
case 5:
case 8:
case "end":
return _context7.stop();
return _context12.stop();
}
}
}, _callee7);
}, _callee12);
})));
it('render the link to the repository', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee9() {
it('render the link to the repository', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee15() {
var link;
return regeneratorRuntime.wrap(function _callee9$(_context9) {
return regeneratorRuntime.wrap(function _callee15$(_context15) {
while (1) {
switch (_context9.prev = _context9.next) {
switch (_context15.prev = _context15.next) {
case 0:

@@ -311,34 +431,60 @@ render( /*#__PURE__*/React.createElement(DocSearch, {

},
getMissingResultsUrl: function getMissingResultsUrl(_ref9) {
var query = _ref9.query;
getMissingResultsUrl: function getMissingResultsUrl(_ref14) {
var query = _ref14.query;
return "https://github.com/algolia/docsearch/issues/new?title=".concat(query);
}
}));
_context9.next = 3;
return act( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee8() {
return regeneratorRuntime.wrap(function _callee8$(_context8) {
_context15.next = 3;
return act( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee13() {
return regeneratorRuntime.wrap(function _callee13$(_context13) {
while (1) {
switch (_context8.prev = _context8.next) {
switch (_context13.prev = _context13.next) {
case 0:
_context8.next = 2;
return waitFor(function () {
fireEvent.click(document.querySelector('.DocSearch-Button'));
});
_context13.t0 = fireEvent;
_context13.next = 3;
return screen.findByText('Search');
case 2:
fireEvent.input(document.querySelector('.DocSearch-Input'), {
case 3:
_context13.t1 = _context13.sent;
_context13.t0.click.call(_context13.t0, _context13.t1);
case 5:
case "end":
return _context13.stop();
}
}
}, _callee13);
})));
case 3:
_context15.next = 5;
return act( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee14() {
return regeneratorRuntime.wrap(function _callee14$(_context14) {
while (1) {
switch (_context14.prev = _context14.next) {
case 0:
_context14.t0 = fireEvent;
_context14.next = 3;
return screen.findByPlaceholderText('Search docs');
case 3:
_context14.t1 = _context14.sent;
_context14.t2 = {
target: {
value: 'q'
}
});
};
case 3:
_context14.t0.input.call(_context14.t0, _context14.t1, _context14.t2);
case 6:
case "end":
return _context8.stop();
return _context14.stop();
}
}
}, _callee8);
}, _callee14);
})));
case 3:
case 5:
expect(screen.getByText(/No results for/)).toBeInTheDocument();

@@ -349,10 +495,10 @@ link = document.querySelector('.DocSearch-Help a');

case 7:
case 9:
case "end":
return _context9.stop();
return _context15.stop();
}
}
}, _callee9);
}, _callee15);
})));
});
});

@@ -1,2 +0,1 @@

/// <reference types="react" />
declare type AlgoliaLogoTranslations = Partial<{

@@ -3,0 +2,0 @@ searchByText: string;

@@ -47,7 +47,7 @@ var _excluded = ["translations"];

className: "DocSearch-Button-Keys"
}, key !== null && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
}, key !== null && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("kbd", {
className: "DocSearch-Button-Key"
}, key === ACTION_KEY_DEFAULT ? /*#__PURE__*/React.createElement(ControlKeyIcon, null) : key), /*#__PURE__*/React.createElement("span", {
}, key === ACTION_KEY_DEFAULT ? /*#__PURE__*/React.createElement(ControlKeyIcon, null) : key), /*#__PURE__*/React.createElement("kbd", {
className: "DocSearch-Button-Key"
}, "K"))));
});

@@ -1,2 +0,1 @@

/// <reference types="react" />
import type { DocSearchProps } from './DocSearch';

@@ -3,0 +2,0 @@ import type { FooterTranslations } from './Footer';

@@ -1,2 +0,1 @@

/// <reference types="react" />
export declare type ErrorScreenTranslations = Partial<{

@@ -3,0 +2,0 @@ titleText: string;

@@ -1,2 +0,1 @@

/// <reference types="react" />
export declare type FooterTranslations = Partial<{

@@ -3,0 +2,0 @@ selectText: string;

@@ -46,3 +46,3 @@ import React from 'react';

className: "DocSearch-Commands"
}, /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement("span", {
}, /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement("kbd", {
className: "DocSearch-Commands-Key"

@@ -55,3 +55,3 @@ }, /*#__PURE__*/React.createElement(CommandIcon, {

className: "DocSearch-Label"
}, selectText)), /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement("span", {
}, selectText)), /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement("kbd", {
className: "DocSearch-Commands-Key"

@@ -62,3 +62,3 @@ }, /*#__PURE__*/React.createElement(CommandIcon, {

d: "M7.5 3.5v8M10.5 8.5l-3 3-3-3"
}))), /*#__PURE__*/React.createElement("span", {
}))), /*#__PURE__*/React.createElement("kbd", {
className: "DocSearch-Commands-Key"

@@ -71,3 +71,3 @@ }, /*#__PURE__*/React.createElement(CommandIcon, {

className: "DocSearch-Label"
}, navigateText)), /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement("span", {
}, navigateText)), /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement("kbd", {
className: "DocSearch-Commands-Key"

@@ -74,0 +74,0 @@ }, /*#__PURE__*/React.createElement(CommandIcon, {

@@ -1,2 +0,1 @@

/// <reference types="react" />
export declare function ControlKeyIcon(): JSX.Element;

@@ -1,2 +0,1 @@

/// <reference types="react" />
export declare function ErrorIcon(): JSX.Element;

@@ -1,2 +0,1 @@

/// <reference types="react" />
export declare function GoToExternal(): JSX.Element;

@@ -1,2 +0,1 @@

/// <reference types="react" />
export declare function LoadingIcon(): JSX.Element;

@@ -1,2 +0,1 @@

/// <reference types="react" />
export declare function NoResultsIcon(): JSX.Element;

@@ -1,2 +0,1 @@

/// <reference types="react" />
export declare function RecentIcon(): JSX.Element;

@@ -1,2 +0,1 @@

/// <reference types="react" />
export declare function ResetIcon(): JSX.Element;

@@ -1,2 +0,1 @@

/// <reference types="react" />
export declare function SearchIcon(): JSX.Element;

@@ -1,2 +0,1 @@

/// <reference types="react" />
export declare function SelectIcon(): JSX.Element;

@@ -1,4 +0,3 @@

/// <reference types="react" />
export declare function SourceIcon(props: {
type: string;
}): JSX.Element;

@@ -1,2 +0,1 @@

/// <reference types="react" />
export declare function StarIcon(): JSX.Element;

@@ -1,2 +0,1 @@

/// <reference types="react" />
import type { ScreenStateProps } from './ScreenState';

@@ -3,0 +2,0 @@ import type { InternalDocSearchHit } from './types';

@@ -1,2 +0,1 @@

/// <reference types="react" />
import type { ScreenStateProps } from './ScreenState';

@@ -3,0 +2,0 @@ import type { InternalDocSearchHit } from './types';

@@ -1,2 +0,1 @@

/// <reference types="react" />
import type { ScreenStateProps } from './ScreenState';

@@ -3,0 +2,0 @@ import type { InternalDocSearchHit } from './types';

@@ -1,1 +0,1 @@

export declare const version = "3.0.0";
export declare const version = "3.1.0";

@@ -1,1 +0,1 @@

export var version = '3.0.0';
export var version = '3.1.0';
{
"name": "@docsearch/react",
"description": "React package for DocSearch, the best search experience for docs.",
"version": "3.0.0",
"version": "3.1.0",
"license": "MIT",

@@ -33,16 +33,14 @@ "homepage": "https://docsearch.algolia.com",

"on:change": "concurrently \"yarn build:esm\" \"yarn build:types\"",
"prepare": "yarn build:esm && yarn build:types",
"watch": "watch \"yarn on:change\" --ignoreDirectoryPattern \"/dist/\""
},
"dependencies": {
"@algolia/autocomplete-core": "1.5.2",
"@algolia/autocomplete-preset-algolia": "1.5.2",
"@docsearch/css": "3.0.0",
"@algolia/autocomplete-core": "1.6.3",
"@docsearch/css": "3.1.0",
"algoliasearch": "^4.0.0"
},
"peerDependencies": {
"@types/react": ">= 16.8.0 < 18.0.0",
"react": ">= 16.8.0 < 18.0.0",
"react-dom": ">= 16.8.0 < 18.0.0"
"@types/react": ">= 16.8.0 < 19.0.0",
"react": ">= 16.8.0 < 19.0.0",
"react-dom": ">= 16.8.0 < 19.0.0"
}
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc