@docsearch/react
Advanced tools
Comparing version
@@ -1,1 +0,1 @@ | ||
export { DocSearchButton } from './dist/esm/DocSearchButton.js'; | ||
export { DocSearchButton } from './dist/esm'; |
@@ -1,5 +0,195 @@ | ||
export * from './DocSearch'; | ||
export * from './DocSearchButton'; | ||
export * from './DocSearchModal'; | ||
export * from './useDocSearchKeyboardEvents'; | ||
export * from './version'; | ||
import { AutocompleteState, AutocompleteOptions } from '@algolia/autocomplete-core'; | ||
import { SearchOptions } from '@algolia/client-search'; | ||
import { SearchClient } from 'algoliasearch/lite'; | ||
import React from 'react'; | ||
declare type ContentType = 'content' | 'lvl0' | 'lvl1' | 'lvl2' | 'lvl3' | 'lvl4' | 'lvl5' | 'lvl6'; | ||
interface DocSearchHitAttributeHighlightResult { | ||
value: string; | ||
matchLevel: 'full' | 'none' | 'partial'; | ||
matchedWords: string[]; | ||
fullyHighlighted?: boolean; | ||
} | ||
interface DocSearchHitHighlightResultHierarchy { | ||
lvl0: DocSearchHitAttributeHighlightResult; | ||
lvl1: DocSearchHitAttributeHighlightResult; | ||
lvl2: DocSearchHitAttributeHighlightResult; | ||
lvl3: DocSearchHitAttributeHighlightResult; | ||
lvl4: DocSearchHitAttributeHighlightResult; | ||
lvl5: DocSearchHitAttributeHighlightResult; | ||
lvl6: DocSearchHitAttributeHighlightResult; | ||
} | ||
interface DocSearchHitHighlightResult { | ||
content: DocSearchHitAttributeHighlightResult; | ||
hierarchy: DocSearchHitHighlightResultHierarchy; | ||
hierarchy_camel: DocSearchHitHighlightResultHierarchy[]; | ||
} | ||
interface DocSearchHitAttributeSnippetResult { | ||
value: string; | ||
matchLevel: 'full' | 'none' | 'partial'; | ||
} | ||
interface DocSearchHitSnippetResult { | ||
content: DocSearchHitAttributeSnippetResult; | ||
hierarchy: DocSearchHitHighlightResultHierarchy; | ||
hierarchy_camel: DocSearchHitHighlightResultHierarchy[]; | ||
} | ||
declare type DocSearchHit = { | ||
objectID: string; | ||
content: string | null; | ||
url: string; | ||
url_without_anchor: string; | ||
type: ContentType; | ||
anchor: string | null; | ||
hierarchy: { | ||
lvl0: string; | ||
lvl1: string; | ||
lvl2: string | null; | ||
lvl3: string | null; | ||
lvl4: string | null; | ||
lvl5: string | null; | ||
lvl6: string | null; | ||
}; | ||
_highlightResult: DocSearchHitHighlightResult; | ||
_snippetResult: DocSearchHitSnippetResult; | ||
_rankingInfo?: { | ||
promoted: boolean; | ||
nbTypos: number; | ||
firstMatchedWord: number; | ||
proximityDistance?: number; | ||
geoDistance: number; | ||
geoPrecision?: number; | ||
nbExactWords: number; | ||
words: number; | ||
filters: number; | ||
userScore: number; | ||
matchedGeoLocation?: { | ||
lat: number; | ||
lng: number; | ||
distance: number; | ||
}; | ||
}; | ||
_distinctSeqID?: number; | ||
__autocomplete_indexName?: string; | ||
__autocomplete_queryID?: string; | ||
__autocomplete_algoliaCredentials?: { | ||
appId: string; | ||
apiKey: string; | ||
}; | ||
__autocomplete_id?: number; | ||
}; | ||
declare type InternalDocSearchHit = DocSearchHit & { | ||
__docsearch_parent: InternalDocSearchHit | null; | ||
}; | ||
declare type StoredDocSearchHit = Omit<DocSearchHit, '_highlightResult' | '_snippetResult'>; | ||
declare type DocSearchTranslations = Partial<{ | ||
button: ButtonTranslations; | ||
modal: ModalTranslations; | ||
}>; | ||
interface DocSearchProps { | ||
appId: string; | ||
apiKey: string; | ||
indexName: string; | ||
placeholder?: string; | ||
searchParameters?: SearchOptions; | ||
maxResultsPerGroup?: number; | ||
transformItems?: (items: DocSearchHit[]) => DocSearchHit[]; | ||
hitComponent?: (props: { | ||
hit: InternalDocSearchHit | StoredDocSearchHit; | ||
children: React.ReactNode; | ||
}) => JSX.Element; | ||
resultsFooterComponent?: (props: { | ||
state: AutocompleteState<InternalDocSearchHit>; | ||
}) => JSX.Element | null; | ||
transformSearchClient?: (searchClient: SearchClient) => SearchClient; | ||
disableUserPersonalization?: boolean; | ||
initialQuery?: string; | ||
navigator?: AutocompleteOptions<InternalDocSearchHit>['navigator']; | ||
translations?: DocSearchTranslations; | ||
getMissingResultsUrl?: ({ query }: { | ||
query: string; | ||
}) => string; | ||
insights?: AutocompleteOptions<InternalDocSearchHit>['insights']; | ||
} | ||
declare function DocSearch(props: DocSearchProps): JSX.Element; | ||
declare type ButtonTranslations = Partial<{ | ||
buttonText: string; | ||
buttonAriaLabel: string; | ||
}>; | ||
declare type DocSearchButtonProps = React.ComponentProps<'button'> & { | ||
translations?: ButtonTranslations; | ||
}; | ||
declare const DocSearchButton: React.ForwardRefExoticComponent<Pick<DocSearchButtonProps, "translations" | "key" | keyof React.ButtonHTMLAttributes<HTMLButtonElement>> & React.RefAttributes<HTMLButtonElement>>; | ||
declare type FooterTranslations = Partial<{ | ||
selectText: string; | ||
selectKeyAriaLabel: string; | ||
navigateText: string; | ||
navigateUpKeyAriaLabel: string; | ||
navigateDownKeyAriaLabel: string; | ||
closeText: string; | ||
closeKeyAriaLabel: string; | ||
searchByText: string; | ||
}>; | ||
declare type ErrorScreenTranslations = Partial<{ | ||
titleText: string; | ||
helpText: string; | ||
}>; | ||
declare type NoResultsScreenTranslations = Partial<{ | ||
noResultsText: string; | ||
suggestedQueryText: string; | ||
reportMissingResultsText: string; | ||
reportMissingResultsLinkText: string; | ||
}>; | ||
declare type StartScreenTranslations = Partial<{ | ||
recentSearchesTitle: string; | ||
noRecentSearchesText: string; | ||
saveRecentSearchButtonTitle: string; | ||
removeRecentSearchButtonTitle: string; | ||
favoriteSearchesTitle: string; | ||
removeFavoriteSearchButtonTitle: string; | ||
}>; | ||
declare type ScreenStateTranslations = Partial<{ | ||
errorScreen: ErrorScreenTranslations; | ||
startScreen: StartScreenTranslations; | ||
noResultsScreen: NoResultsScreenTranslations; | ||
}>; | ||
declare type SearchBoxTranslations = Partial<{ | ||
resetButtonTitle: string; | ||
resetButtonAriaLabel: string; | ||
cancelButtonText: string; | ||
cancelButtonAriaLabel: string; | ||
searchInputLabel: string; | ||
}>; | ||
declare type ModalTranslations = Partial<{ | ||
searchBox: SearchBoxTranslations; | ||
footer: FooterTranslations; | ||
}> & ScreenStateTranslations; | ||
declare type DocSearchModalProps = DocSearchProps & { | ||
initialScrollY: number; | ||
onClose?: () => void; | ||
translations?: ModalTranslations; | ||
}; | ||
declare function DocSearchModal({ appId, apiKey, indexName, placeholder, searchParameters, maxResultsPerGroup, onClose, transformItems, hitComponent, resultsFooterComponent, navigator, initialScrollY, transformSearchClient, disableUserPersonalization, initialQuery: initialQueryFromProp, translations, getMissingResultsUrl, insights, }: DocSearchModalProps): JSX.Element; | ||
interface UseDocSearchKeyboardEventsProps { | ||
isOpen: boolean; | ||
onOpen: () => void; | ||
onClose: () => void; | ||
onInput?: (event: KeyboardEvent) => void; | ||
searchButtonRef?: React.RefObject<HTMLButtonElement>; | ||
} | ||
declare function useDocSearchKeyboardEvents({ isOpen, onOpen, onClose, onInput, searchButtonRef, }: UseDocSearchKeyboardEventsProps): void; | ||
declare const version = "3.6.1"; | ||
export { type ButtonTranslations, DocSearch, DocSearchButton, type DocSearchButtonProps, DocSearchModal, type DocSearchModalProps, type DocSearchProps, type DocSearchTranslations, type ModalTranslations, type UseDocSearchKeyboardEventsProps, useDocSearchKeyboardEvents, version }; |
@@ -1,1 +0,1 @@ | ||
export { DocSearchModal } from './dist/esm/DocSearchModal.js'; | ||
export { DocSearchModal } from './dist/esm'; |
{ | ||
"name": "@docsearch/react", | ||
"description": "React package for DocSearch, the best search experience for docs.", | ||
"version": "3.6.0", | ||
"version": "3.6.1", | ||
"license": "MIT", | ||
@@ -28,7 +28,6 @@ "homepage": "https://docsearch.algolia.com", | ||
"build:clean": "rm -rf ./dist", | ||
"build:esm": "babel src --root-mode upward --extensions '.ts,.tsx' --out-dir dist/esm", | ||
"build:types": "tsc -p ./tsconfig.declaration.json --outDir ./dist/esm", | ||
"build:umd": "rollup --config", | ||
"build": "yarn build:clean && yarn build:umd && yarn build:esm && yarn build:types", | ||
"on:change": "concurrently \"yarn build:esm\" \"yarn build:types\"", | ||
"build:clean-types": "rm -rf ./dist/esm/types", | ||
"build:types": "tsc -p ./tsconfig.declaration.json --outDir ./dist/esm/types", | ||
"build": "yarn build:clean && yarn build:types && rollup --config && yarn build:clean-types", | ||
"on:change": "yarn build", | ||
"watch": "watch \"yarn on:change\" --ignoreDirectoryPattern \"/dist/\"" | ||
@@ -39,3 +38,3 @@ }, | ||
"@algolia/autocomplete-preset-algolia": "1.9.3", | ||
"@docsearch/css": "3.6.0", | ||
"@docsearch/css": "3.6.1", | ||
"algoliasearch": "^4.19.1" | ||
@@ -42,0 +41,0 @@ }, |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
519605
-4.31%12
-88.12%913
-67.25%2
100%1
Infinity%+ Added
- Removed
Updated