@atlaskit/quick-search 8.0.12 → 8.0.13

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/quick-search
2
2
 
3
+ ## 8.0.13
4
+
5
+ ### Patch Changes
6
+
7
+ - [`8cc2f888c83`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8cc2f888c83) - Upgrade Typescript from `4.3.5` to `4.5.5`
8
+
3
9
  ## 8.0.12
4
10
 
5
11
  ### Patch Changes
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/quick-search",
3
- "version": "8.0.12"
3
+ "version": "8.0.13"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/quick-search",
3
- "version": "8.0.12"
3
+ "version": "8.0.13"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/quick-search",
3
- "version": "8.0.12"
3
+ "version": "8.0.13"
4
4
  }
@@ -0,0 +1,122 @@
1
+ import React from 'react';
2
+ import { ResultData, SelectedResultId } from './Results/types';
3
+ import { ResultContextType } from './context';
4
+ import { ResultBase } from './Results/ResultBase';
5
+ export declare type Props = {
6
+ /** Search results in the form of ResultItemGroups containing Result components */
7
+ children: React.ReactNode;
8
+ /** Set search loading state */
9
+ isLoading?: boolean;
10
+ /** onBlur callback for search input */
11
+ onSearchBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;
12
+ /** onInput callback for search input */
13
+ onSearchInput?: (event: React.FormEvent<HTMLInputElement>, isAutocompleted?: boolean) => void;
14
+ /** onKeyDown callback for search input */
15
+ onSearchKeyDown?: (event: React.KeyboardEvent<HTMLInputElement>) => void;
16
+ /** Called when the user submits the search form without selecting a result */
17
+ onSearchSubmit?: (event: React.KeyboardEvent<HTMLInputElement>) => void;
18
+ /** Placeholder text for search input field */
19
+ placeholder?: string;
20
+ /** Value of the search input field */
21
+ value?: string;
22
+ /** Corresponds to the `resultId` of the selected result */
23
+ selectedResultId?: SelectedResultId;
24
+ /** Optional way of being notified when the selected result changes due to keyboard nav */
25
+ onSelectedResultIdChanged?: (id: SelectedResultId) => void;
26
+ firePrivateAnalyticsEvent?: (eventName: string, eventData: Object) => void;
27
+ /** React component to be used for rendering links */
28
+ linkComponent?: React.ComponentType<any>;
29
+ /** The elements to render to the right of the search input. */
30
+ inputControls?: React.ReactNode;
31
+ /** One string that is used to autocomplete the current search query */
32
+ autocompleteText?: string;
33
+ };
34
+ export declare type State = {
35
+ selectedResultId: SelectedResultId;
36
+ context: ResultContextType;
37
+ value?: string;
38
+ };
39
+ export declare class QuickSearch extends React.Component<Props, State> {
40
+ static defaultProps: {
41
+ children: never[];
42
+ firePrivateAnalyticsEvent: (_: any) => void;
43
+ isLoading: boolean;
44
+ onSearchBlur: (_: any) => void;
45
+ onSearchKeyDown: (_: any) => void;
46
+ onSearchSubmit: (_: any) => void;
47
+ placeholder: string;
48
+ value: string;
49
+ };
50
+ inputSearchRef?: React.Ref<any>;
51
+ flatResults: Array<ResultBase>;
52
+ hasSearchQueryEventFired: boolean;
53
+ hasKeyDownEventFired: boolean;
54
+ lastKeyPressed: string;
55
+ constructor(props: Props);
56
+ componentDidMount(): void;
57
+ componentWillUnmount(): void;
58
+ UNSAFE_componentWillReceiveProps(nextProps: Props): void;
59
+ fireKeyboardControlEvent(selectedResultId: SelectedResultId): void;
60
+ /**
61
+ * Uses the virtual list, this.flatResults, to move the selection across grouped results as if
62
+ * results were in a single, circular list.
63
+ *
64
+ * Process:
65
+ * 1. Finds the index of the selected result in the flatResults array,
66
+ * 2. Increments or decrements this index by the supplied adjustment amount,
67
+ * 3. Sets the new selectedResultId based on the modifed index
68
+ */
69
+ adjustSelectedResultIndex: (adjustment: number) => void;
70
+ /** Select next result */
71
+ selectNext: () => void;
72
+ /** Select previous result */
73
+ selectPrevious: () => void;
74
+ /**
75
+ * Callback for register results in flatResults
76
+ */
77
+ handleRegisterResult: (result: ResultBase) => void;
78
+ /**
79
+ * Callback for unregister results in flatResults
80
+ * It will reconcile a list of results for keyboard navigation after every update.
81
+ * 1. Component starts with an empty list of results
82
+ * 2. componentDidMount / componentDidUpdate lifecycle methods in ResultBase will be invoked
83
+ * 3. All ResultBase components call registerResult() in order to register itself in quick search
84
+ * 4. All ResultBase components call unregisterResult() in order to unregister itself in quick search
85
+ */
86
+ handleUnregisterResult: (result: ResultBase) => void;
87
+ /**
88
+ * Callback for mouseEnter events on individual results
89
+ * Move selection to hovered result
90
+ */
91
+ handleResultMouseEnter: (resultData: ResultData) => void;
92
+ /**
93
+ * Callback for mouseLeave events on individual results
94
+ * Clear result selection
95
+ */
96
+ handleResultMouseLeave: () => void;
97
+ /**
98
+ * Clear result selection when search input is blurred
99
+ */
100
+ handleSearchBlur: (event: React.FocusEvent<HTMLInputElement>) => void;
101
+ onInput: (event: React.FormEvent<HTMLInputElement>) => void;
102
+ /**
103
+ * Keyboard controls
104
+ * Up - Select previous result
105
+ * Down - Select next result
106
+ * Enter - Submit selected result
107
+ * Tab / ArrowRight - Accept autocomplete
108
+ */
109
+ handleSearchKeyDown: (event: React.KeyboardEvent<HTMLInputElement>) => void;
110
+ acceptAutocomplete: (event: React.KeyboardEvent<HTMLInputElement>, text?: string | undefined) => void;
111
+ setSearchInputRef: (refs: any) => void;
112
+ focusSearchInput: () => void;
113
+ render(): JSX.Element;
114
+ }
115
+ declare const _default: React.ComponentClass<Props, any>;
116
+ /**
117
+ * HOCs:
118
+ * `decorateWithAnalyticsData` - Wrapper that decorates analytics events with additional data.
119
+ * `withAnalytics` - Injects analytics firing methods that are picked up by
120
+ * @atlaskit/analytics/AnalyticsListener.
121
+ */
122
+ export default _default;
@@ -0,0 +1,38 @@
1
+ import React from 'react';
2
+ declare type Props = {
3
+ /** Text to appear to the right of the text. It has a lower font-weight. */
4
+ caption?: string;
5
+ /** Location to link out to on click. This is passed down to the custom link component if one is provided. */
6
+ href?: string;
7
+ /** Target frame for item `href` link to be aimed at. */
8
+ target?: string;
9
+ /** React element to appear to the left of the text. This should be an @atlaskit/icon component. */
10
+ icon?: React.ReactNode;
11
+ /** Makes the navigation item appear with reduced padding and font size. */
12
+ isCompact?: boolean;
13
+ /** Set whether the item should be highlighted as selected. Selected items have a different background color. */
14
+ isSelected?: boolean;
15
+ /** Set whether the item has been highlighted using mouse navigation. Mouse selected items will not display the selectedIcon. */
16
+ isMouseSelected?: boolean;
17
+ /** Function to be called on click. This is passed down to a custom link component, if one is provided. */
18
+ onClick?(e: MouseEvent): void;
19
+ /** Standard onmouseenter event */
20
+ onMouseEnter?: (e: MouseEvent) => void;
21
+ /** Standard onmouseleave event */
22
+ onMouseLeave?: (e: MouseEvent) => void;
23
+ /** Text to be shown alongside the main `text`. */
24
+ subText?: React.ReactNode;
25
+ /** Main text to be displayed as the item. Accepts a react component but in most cases this should just be a string. */
26
+ text?: React.ReactNode;
27
+ /** React component to be placed to the right of the main text. */
28
+ textAfter?: React.ReactNode;
29
+ /** React component to be placed to the right of the main text when the item is selected with keyboard navigation. */
30
+ selectedIcon?: React.ReactNode;
31
+ /** React component to be used for rendering links */
32
+ linkComponent?: React.ComponentType;
33
+ };
34
+ declare class ResultItem extends React.PureComponent<Props> {
35
+ static defaultProps: Partial<Props>;
36
+ render(): JSX.Element;
37
+ }
38
+ export default ResultItem;
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ declare type Props = {
3
+ /** Text to appear as heading above group. Will be auto-capitalised. */
4
+ title: React.ReactNode;
5
+ /** React Elements to be displayed within the group. This should generally be a collection of ResultItems. */
6
+ children?: React.ReactNode;
7
+ };
8
+ export default class ResultItemGroup extends React.Component<Props> {
9
+ render(): JSX.Element;
10
+ }
11
+ export {};
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ export declare const ResultItemGroupHeader: import("styled-components").StyledComponentClass<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement>, any, import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement>>;
3
+ export declare const ResultItemGroupTitle: import("styled-components").StyledComponentClass<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement>, any, import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement>>;
4
+ export declare const ResultItemAfter: import("styled-components").StyledComponentClass<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
5
+ shouldTakeSpace: boolean;
6
+ }, any, import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
7
+ shouldTakeSpace: boolean;
8
+ }>;
9
+ export declare const ResultItemAfterWrapper: import("styled-components").StyledComponentClass<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement>, any, import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement>>;
10
+ export declare const ResultItemCaption: import("styled-components").StyledComponentClass<import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement>, any, import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement>>;
11
+ export declare const ResultItemSubText: import("styled-components").StyledComponentClass<import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement>, any, import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement>>;
12
+ export declare const ResultItemIcon: import("styled-components").StyledComponentClass<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement>, any, import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement>>;
13
+ export declare const ResultItemTextAfter: import("styled-components").StyledComponentClass<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement>, any, import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement>>;
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import { CommonResultProps } from './types';
3
+ export declare type Props = CommonResultProps & {
4
+ /** Name of the container. Provides the main text to be displayed as the item. */
5
+ name: React.ReactNode;
6
+ /** Text to appear to the right of the text. It has a lower font-weight. */
7
+ caption?: string;
8
+ /** Set whether to display a lock on the result's icon */
9
+ isPrivate?: boolean;
10
+ /** Text to be shown alongside the main `text`. */
11
+ subText?: React.ReactNode;
12
+ };
13
+ /**
14
+ * Generic result type for Atlassian containers.
15
+ */
16
+ export default class ContainerResult extends React.PureComponent<Props> {
17
+ getAvatar: () => {};
18
+ render(): JSX.Element;
19
+ }
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ import { CommonResultProps } from './types';
3
+ export declare type Props = CommonResultProps & {
4
+ /** Name of the container. Provides the main text to be displayed as the item. */
5
+ name: React.ReactNode;
6
+ /** Text to appear to the right of the text. It has a lower font-weight. */
7
+ caption?: string;
8
+ /** Name of the container to which the object belongs. Displayed alongside the name */
9
+ containerName?: React.ReactNode;
10
+ /** Set whether to display a lock on the result's icon */
11
+ isPrivate?: boolean;
12
+ /** A key or identifier of the object. Ajoined to the `containerName` when provided. */
13
+ objectKey?: React.ReactNode;
14
+ };
15
+ /**
16
+ * Generic result type for Atlassian objects.
17
+ */
18
+ export default class ObjectResult extends React.PureComponent<Props> {
19
+ getAvatar: () => {};
20
+ getSubtext(): {} | null | undefined;
21
+ render(): JSX.Element;
22
+ }
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import { CommonResultProps } from './types';
3
+ export declare type Props = CommonResultProps & {
4
+ /** Name of the container. Provides the main text to be displayed as the item. */
5
+ name: React.ReactNode;
6
+ /** A user's custom handle. Appears to the right of their `name`. It has a lower font-weight. */
7
+ mentionName?: string;
8
+ /** A character with which to prefix the `mentionName`. Defaults to '@' */
9
+ mentionPrefix?: string;
10
+ /** Text to be shown alongside the main `text`. */
11
+ presenceMessage?: React.ReactNode;
12
+ /** Sets the appearance of the presence indicator */
13
+ presenceState?: 'online' | 'busy' | 'offline' | null;
14
+ };
15
+ export default class PersonResult extends React.PureComponent<Props> {
16
+ static defaultProps: Partial<Props>;
17
+ getMention: () => string | undefined;
18
+ getAvatar: () => {};
19
+ render(): JSX.Element;
20
+ }
@@ -0,0 +1,37 @@
1
+ import React from 'react';
2
+ import { AnalyticsData, CommonResultProps } from './types';
3
+ import { ResultContextType } from '../context';
4
+ export declare type Props = CommonResultProps & {
5
+ /** Type of the result. This is passed as a parameter to certain callbacks. */
6
+ type: string;
7
+ /** Main text to be displayed as the item. */
8
+ text: React.ReactNode;
9
+ /** Text to be shown alongside the main `text`. */
10
+ subText?: React.ReactNode;
11
+ /** Text to appear to the right of the text. It has a lower font-weight. */
12
+ caption?: string;
13
+ /** React element to appear to the left of the text. */
14
+ icon?: React.ReactNode;
15
+ /** The context provided by QuickSearch. */
16
+ context?: ResultContextType;
17
+ };
18
+ declare type DefaultProps = {
19
+ context: ResultContextType;
20
+ };
21
+ export declare class ResultBase extends React.PureComponent<DefaultProps & Props> {
22
+ static defaultProps: Partial<Props>;
23
+ state: {
24
+ isMouseSelected: boolean;
25
+ };
26
+ registerResult(): void;
27
+ componentDidMount(): void;
28
+ componentDidUpdate(): void;
29
+ componentWillUnmount(): void;
30
+ getAnalyticsData(): AnalyticsData;
31
+ handleClick: (e: MouseEvent) => void;
32
+ handleMouseEnter: (event: MouseEvent) => void;
33
+ handleMouseLeave: () => void;
34
+ render(): JSX.Element;
35
+ }
36
+ declare const _default: (props: Props) => JSX.Element;
37
+ export default _default;
@@ -0,0 +1,4 @@
1
+ export { default as ContainerResult } from './ContainerResult';
2
+ export { default as ObjectResult } from './ObjectResult';
3
+ export { default as PersonResult } from './PersonResult';
4
+ export { default as ResultBase } from './ResultBase';
@@ -0,0 +1,34 @@
1
+ import { ReactNode } from 'react';
2
+ export declare type AnalyticsData = Object;
3
+ export declare type ResultId = string | number;
4
+ export declare type SelectedResultId = ResultId | null;
5
+ export declare type CancelableEvent = KeyboardEvent | MouseEvent | React.KeyboardEvent<HTMLInputElement> | React.MouseEvent<HTMLElement>;
6
+ export declare type ResultData = {
7
+ resultId: ResultId;
8
+ type: string;
9
+ event: CancelableEvent;
10
+ };
11
+ export declare type CommonResultProps = {
12
+ /** Unique ID of the result. This is passed as a parameter to certain callbacks */
13
+ resultId: string | number;
14
+ /** Type of the result. This is passed as a parameter to certain callbacks. */
15
+ type?: string;
16
+ /** Src URL of the image to be used as the result's icon, overriden by avatar prop */
17
+ avatarUrl?: string;
18
+ /** React Component of the image to be used as the result's icon, takes precedence over avatarUrl */
19
+ avatar?: ReactNode;
20
+ /** Content to be shown after the main content. Shown to the right of content (or to the left in RTL mode). */
21
+ elemAfter?: ReactNode;
22
+ /** Icon to be shown after the main content when the result is selected */
23
+ selectedIcon?: ReactNode;
24
+ /** Location to link out to on click. */
25
+ href?: string;
26
+ /** Target to open the link in. */
27
+ target?: string;
28
+ /** Reduces padding and font size. */
29
+ isCompact?: boolean;
30
+ /** Triggered by mouseClick event. */
31
+ onClick?: (resultData: ResultData) => void;
32
+ /** key/value pairs of attributes to be send in analytics events. */
33
+ analyticsData?: AnalyticsData | (() => AnalyticsData);
34
+ };
@@ -0,0 +1,31 @@
1
+ import React from 'react';
2
+ export declare const controlKeys: string[];
3
+ declare type Props = {
4
+ /** The elements to render as options to search from. */
5
+ children?: React.ReactNode;
6
+ /** The elements to render to the right of the search input. */
7
+ inputControls?: React.ReactNode;
8
+ /** Set whether the loading state should be shown. */
9
+ isLoading?: boolean;
10
+ /** Function to be called when the search input loses focus. */
11
+ onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;
12
+ /** Function to be called when a input action occurs (native `oninput` event). */
13
+ onInput?: (event: React.FormEvent<HTMLInputElement>) => void;
14
+ /** Function to be called when the user hits the escape key. */
15
+ onKeyDown?: (event: React.KeyboardEvent<HTMLInputElement>) => void;
16
+ /** Placeholder text for search field. */
17
+ placeholder?: string;
18
+ /** Current value of search field. */
19
+ value?: string;
20
+ /** Autocomplete information */
21
+ autocompleteText?: string;
22
+ };
23
+ export default class Search extends React.PureComponent<Props> {
24
+ static defaultProps: Partial<Props>;
25
+ onInputKeyDown: (event: React.KeyboardEvent<HTMLInputElement>) => void;
26
+ setInputRef: (ref: React.Ref<any>) => void;
27
+ renderInputControls: () => JSX.Element | null;
28
+ inputRef?: React.Ref<any>;
29
+ render(): JSX.Element;
30
+ }
31
+ export {};
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ export declare const SearchBox: import("styled-components").StyledComponentClass<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement>, any, import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement>>;
3
+ export declare const SearchFieldBaseOuter: import("styled-components").StyledComponentClass<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement>, any, import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement>>;
4
+ export declare const SearchFieldBaseInner: import("styled-components").StyledComponentClass<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement>, any, import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement>>;
5
+ export declare const SearchInner: import("styled-components").StyledComponentClass<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement>, any, import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement>>;
6
+ export declare const getPlaceholderStyle: (style: any) => import("styled-components").InterpolationValue[];
7
+ export declare const getPlaceholderColor: import("styled-components").FlattenInterpolation<import("styled-components").ThemedStyledProps<import("@atlaskit/theme").ThemeProps | undefined, any>>[];
8
+ export declare const SearchInput: import("styled-components").StyledComponentClass<import("react").ClassAttributes<HTMLInputElement> & import("react").InputHTMLAttributes<HTMLInputElement>, any, import("react").ClassAttributes<HTMLInputElement> & import("react").InputHTMLAttributes<HTMLInputElement>>;
9
+ export declare const SearchInputTypeAhead: import("styled-components").StyledComponentClass<import("react").ClassAttributes<HTMLInputElement> & import("react").InputHTMLAttributes<HTMLInputElement>, any, import("react").ClassAttributes<HTMLInputElement> & import("react").InputHTMLAttributes<HTMLInputElement>>;
10
+ export declare const SearchInputControlsContainer: import("styled-components").StyledComponentClass<import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement>, any, import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement>>;
@@ -0,0 +1,6 @@
1
+ export declare const ATLASKIT_QUICKSEARCH_NS = "atlaskit.navigation.quick-search";
2
+ export declare const QS_ANALYTICS_EV_CLOSE: string;
3
+ export declare const QS_ANALYTICS_EV_KB_CTRLS_USED: string;
4
+ export declare const QS_ANALYTICS_EV_OPEN: string;
5
+ export declare const QS_ANALYTICS_EV_QUERY_ENTERED: string;
6
+ export declare const QS_ANALYTICS_EV_SUBMIT: string;
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ import { ComponentType } from 'react';
3
+ import { ResultData, ResultId, SelectedResultId } from './Results/types';
4
+ import { ResultBase } from './Results/ResultBase';
5
+ export declare type ResultContextType = {
6
+ /** Register result as keyboard navigation target */
7
+ registerResult: (result: ResultBase) => void;
8
+ /** Unregister result as keyboard navigation target */
9
+ unregisterResult: (result: ResultBase) => void;
10
+ /** Triggered by mouseEnter event. */
11
+ onMouseEnter: (resultData: ResultData) => void;
12
+ /** Standard onMouseLeave event. */
13
+ onMouseLeave: () => void;
14
+ /** Fires an analytics event */
15
+ sendAnalytics?: (eventName: string, eventData: Object) => void;
16
+ /** get the index of the search result in the list of result */
17
+ getIndex: (resultId: ResultId) => number | null;
18
+ /** React component to be used for rendering links */
19
+ linkComponent?: ComponentType;
20
+ };
21
+ export declare const ResultContext: React.Context<ResultContextType>;
22
+ export declare const SelectedResultIdContext: React.Context<SelectedResultId>;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { Props } from './QuickSearch';
3
+ export default function decorateWithAnalyticsData(WrappedQuickSearch: React.ComponentClass<Props>): React.ComponentClass<Props>;
@@ -0,0 +1,6 @@
1
+ declare const _default: (element: any) => boolean;
2
+ /**
3
+ * Heuristically check whether an element is a react element or not.
4
+ * React elements have constructors for their type property but native elements use strings.
5
+ */
6
+ export default _default;
@@ -0,0 +1,17 @@
1
+ import * as resultTypes from './components/Results';
2
+ export { default as AkNavigationItemGroup } from './components/ResultItem/ResultItemGroup';
3
+ export { default as AkNavigationItem } from './components/ResultItem/ResultItem';
4
+ export { default as AkQuickSearch } from './components/QuickSearch';
5
+ export { default as AkSearch } from './components/Search/Search';
6
+ export { resultTypes as quickSearchResultTypes };
7
+ export { default as QuickSearch } from './components/QuickSearch';
8
+ export { default as ResultItemGroup } from './components/ResultItem/ResultItemGroup';
9
+ export { default as ObjectResult } from './components/Results/ObjectResult';
10
+ export type { Props as ObjectResultProps } from './components/Results/ObjectResult';
11
+ export { default as PersonResult } from './components/Results/PersonResult';
12
+ export type { Props as PersonResultProps } from './components/Results/PersonResult';
13
+ export { default as ContainerResult } from './components/Results/ContainerResult';
14
+ export type { Props as ContainerResultProps } from './components/Results/ContainerResult';
15
+ export { default as ResultBase } from './components/Results/ResultBase';
16
+ export type { Props as ResultBaseProps } from './components/Results/ResultBase';
17
+ export type { CancelableEvent, ResultData } from './components/Results/types';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/quick-search",
3
- "version": "8.0.12",
3
+ "version": "8.0.13",
4
4
  "description": "A quick-search component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -12,6 +12,13 @@
12
12
  "module": "dist/esm/index.js",
13
13
  "module:es2019": "dist/es2019/index.js",
14
14
  "types": "dist/types/index.d.ts",
15
+ "typesVersions": {
16
+ ">=4.0 <4.5": {
17
+ "*": [
18
+ "dist/types-ts4.0/*"
19
+ ]
20
+ }
21
+ },
15
22
  "atlaskit:src": "src/index.ts",
16
23
  "atlassian": {
17
24
  "team": "Search Platform: Search Experience",
@@ -26,7 +33,7 @@
26
33
  "@atlaskit/avatar": "^21.0.0",
27
34
  "@atlaskit/item": "^12.0.0",
28
35
  "@atlaskit/spinner": "^15.0.0",
29
- "@atlaskit/theme": "^12.1.0",
36
+ "@atlaskit/theme": "^12.2.0",
30
37
  "@babel/runtime": "^7.0.0",
31
38
  "keycode": "^2.1.7"
32
39
  },
@@ -37,7 +44,7 @@
37
44
  "devDependencies": {
38
45
  "@atlaskit/avatar": "^21.0.0",
39
46
  "@atlaskit/docs": "*",
40
- "@atlaskit/drawer": "^7.1.0",
47
+ "@atlaskit/drawer": "^7.2.0",
41
48
  "@atlaskit/icon": "^21.10.0",
42
49
  "@atlaskit/navigation": "^37.0.0",
43
50
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
@@ -45,7 +52,7 @@
45
52
  "prop-types": "^15.5.10",
46
53
  "react": "^16.8.0",
47
54
  "sinon": "^2.2.0",
48
- "typescript": "4.3.5",
55
+ "typescript": "4.5.5",
49
56
  "uuid": "^3.1.0"
50
57
  },
51
58
  "prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
package/report.api.md CHANGED
@@ -1,6 +1,10 @@
1
- ## API Report File for "@atlaskit/quick-search".
1
+ ## API Report File for "@atlaskit/quick-search"
2
2
 
3
- > Do not edit this file. This report is auto-generated by [API Extractor](https://api-extractor.com/).
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ <!--
6
+ Generated API Report version: 2.0
7
+ -->
4
8
 
5
9
  [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
6
10
 
@@ -9,219 +13,179 @@ import { ComponentType } from 'react';
9
13
  import { default as React_2 } from 'react';
10
14
  import { ReactNode } from 'react';
11
15
 
12
- export declare class AkNavigationItem extends React_2.PureComponent<Props_2> {
16
+ // @public (undocumented)
17
+ export class AkNavigationItem extends React_2.PureComponent<Props_2> {
18
+ // (undocumented)
13
19
  static defaultProps: Partial<Props_2>;
20
+ // (undocumented)
14
21
  render(): JSX.Element;
15
22
  }
16
23
 
17
- export declare class AkSearch extends React_2.PureComponent<Props_4> {
24
+ // @public (undocumented)
25
+ export class AkSearch extends React_2.PureComponent<Props_4> {
26
+ // (undocumented)
18
27
  static defaultProps: Partial<Props_4>;
19
- onInputKeyDown: (event: React_2.KeyboardEvent<HTMLInputElement>) => void;
20
- setInputRef: (ref: React_2.Ref<any>) => void;
21
- renderInputControls: () => JSX.Element | null;
28
+ // (undocumented)
22
29
  inputRef?: React_2.Ref<any>;
30
+ // (undocumented)
31
+ onInputKeyDown: (event: React_2.KeyboardEvent<HTMLInputElement>) => void;
32
+ // (undocumented)
23
33
  render(): JSX.Element;
34
+ // (undocumented)
35
+ renderInputControls: () => JSX.Element | null;
36
+ // (undocumented)
37
+ setInputRef: (ref: React_2.Ref<any>) => void;
24
38
  }
25
39
 
26
- declare type AnalyticsData = Object;
40
+ // @public (undocumented)
41
+ type AnalyticsData = Object;
27
42
 
28
- export declare type CancelableEvent =
43
+ // @public (undocumented)
44
+ export type CancelableEvent =
29
45
  | KeyboardEvent
30
46
  | MouseEvent
31
47
  | React.KeyboardEvent<HTMLInputElement>
32
48
  | React.MouseEvent<HTMLElement>;
33
49
 
34
- declare type CommonResultProps = {
35
- /** Unique ID of the result. This is passed as a parameter to certain callbacks */
50
+ // @public (undocumented)
51
+ type CommonResultProps = {
36
52
  resultId: string | number;
37
- /** Type of the result. This is passed as a parameter to certain callbacks. */
38
53
  type?: string;
39
- /** Src URL of the image to be used as the result's icon, overriden by avatar prop */
40
54
  avatarUrl?: string;
41
- /** React Component of the image to be used as the result's icon, takes precedence over avatarUrl */
42
55
  avatar?: ReactNode;
43
- /** Content to be shown after the main content. Shown to the right of content (or to the left in RTL mode). */
44
56
  elemAfter?: ReactNode;
45
- /** Icon to be shown after the main content when the result is selected */
46
57
  selectedIcon?: ReactNode;
47
- /** Location to link out to on click. */
48
58
  href?: string;
49
- /** Target to open the link in. */
50
59
  target?: string;
51
- /** Reduces padding and font size. */
52
60
  isCompact?: boolean;
53
- /** Triggered by mouseClick event. */
54
61
  onClick?: (resultData: ResultData) => void;
55
- /** key/value pairs of attributes to be send in analytics events. */
56
62
  analyticsData?: AnalyticsData | (() => AnalyticsData);
57
63
  };
58
64
 
59
- /**
60
- * Generic result type for Atlassian containers.
61
- */
62
- export declare class ContainerResult extends React_2.PureComponent<
65
+ // @public
66
+ export class ContainerResult extends React_2.PureComponent<
63
67
  ContainerResultProps
64
68
  > {
69
+ // (undocumented)
65
70
  getAvatar: () => {};
71
+ // (undocumented)
66
72
  render(): JSX.Element;
67
73
  }
68
74
 
69
- export declare type ContainerResultProps = CommonResultProps & {
70
- /** Name of the container. Provides the main text to be displayed as the item. */
75
+ // @public (undocumented)
76
+ export type ContainerResultProps = CommonResultProps & {
71
77
  name: React_2.ReactNode;
72
- /** Text to appear to the right of the text. It has a lower font-weight. */
73
78
  caption?: string;
74
- /** Set whether to display a lock on the result's icon */
75
79
  isPrivate?: boolean;
76
- /** Text to be shown alongside the main `text`. */
77
80
  subText?: React_2.ReactNode;
78
81
  };
79
82
 
80
- declare const _default: React_2.ComponentClass<Props_3, any>;
83
+ // @public (undocumented)
84
+ const _default: React_2.ComponentClass<Props_3, any>;
81
85
  export { _default as AkQuickSearch };
82
86
  export { _default as QuickSearch };
83
87
 
84
- declare type DefaultProps = {
88
+ // @public (undocumented)
89
+ type DefaultProps = {
85
90
  context: ResultContextType;
86
91
  };
87
92
 
88
- /**
89
- * Generic result type for Atlassian objects.
90
- */
91
- export declare class ObjectResult extends React_2.PureComponent<
92
- ObjectResultProps
93
- > {
93
+ // @public
94
+ export class ObjectResult extends React_2.PureComponent<ObjectResultProps> {
95
+ // (undocumented)
94
96
  getAvatar: () => {};
97
+ // (undocumented)
95
98
  getSubtext(): {} | null | undefined;
99
+ // (undocumented)
96
100
  render(): JSX.Element;
97
101
  }
98
102
 
99
- export declare type ObjectResultProps = CommonResultProps & {
100
- /** Name of the container. Provides the main text to be displayed as the item. */
103
+ // @public (undocumented)
104
+ export type ObjectResultProps = CommonResultProps & {
101
105
  name: React_2.ReactNode;
102
- /** Text to appear to the right of the text. It has a lower font-weight. */
103
106
  caption?: string;
104
- /** Name of the container to which the object belongs. Displayed alongside the name */
105
107
  containerName?: React_2.ReactNode;
106
- /** Set whether to display a lock on the result's icon */
107
108
  isPrivate?: boolean;
108
- /** A key or identifier of the object. Ajoined to the `containerName` when provided. */
109
109
  objectKey?: React_2.ReactNode;
110
110
  };
111
111
 
112
- export declare class PersonResult extends React_2.PureComponent<
113
- PersonResultProps
114
- > {
112
+ // @public (undocumented)
113
+ export class PersonResult extends React_2.PureComponent<PersonResultProps> {
114
+ // (undocumented)
115
115
  static defaultProps: Partial<PersonResultProps>;
116
- getMention: () => string | undefined;
116
+ // (undocumented)
117
117
  getAvatar: () => {};
118
+ // (undocumented)
119
+ getMention: () => string | undefined;
120
+ // (undocumented)
118
121
  render(): JSX.Element;
119
122
  }
120
123
 
121
- export declare type PersonResultProps = CommonResultProps & {
122
- /** Name of the container. Provides the main text to be displayed as the item. */
124
+ // @public (undocumented)
125
+ export type PersonResultProps = CommonResultProps & {
123
126
  name: React_2.ReactNode;
124
- /** A user's custom handle. Appears to the right of their `name`. It has a lower font-weight. */
125
127
  mentionName?: string;
126
- /** A character with which to prefix the `mentionName`. Defaults to '@' */
127
128
  mentionPrefix?: string;
128
- /** Text to be shown alongside the main `text`. */
129
129
  presenceMessage?: React_2.ReactNode;
130
- /** Sets the appearance of the presence indicator */
131
130
  presenceState?: 'online' | 'busy' | 'offline' | null;
132
131
  };
133
132
 
134
- declare type Props = {
135
- /** Text to appear as heading above group. Will be auto-capitalised. */
133
+ // @public (undocumented)
134
+ type Props = {
136
135
  title: React_2.ReactNode;
137
- /** React Elements to be displayed within the group. This should generally be a collection of ResultItems. */
138
136
  children?: React_2.ReactNode;
139
137
  };
140
138
 
141
- declare type Props_2 = {
142
- /** Text to appear to the right of the text. It has a lower font-weight. */
139
+ // @public (undocumented)
140
+ type Props_2 = {
143
141
  caption?: string;
144
- /** Location to link out to on click. This is passed down to the custom link component if one is provided. */
145
142
  href?: string;
146
- /** Target frame for item `href` link to be aimed at. */
147
143
  target?: string;
148
- /** React element to appear to the left of the text. This should be an @atlaskit/icon component. */
149
144
  icon?: React_2.ReactNode;
150
- /** Makes the navigation item appear with reduced padding and font size. */
151
145
  isCompact?: boolean;
152
- /** Set whether the item should be highlighted as selected. Selected items have a different background color. */
153
146
  isSelected?: boolean;
154
- /** Set whether the item has been highlighted using mouse navigation. Mouse selected items will not display the selectedIcon. */
155
147
  isMouseSelected?: boolean;
156
- /** Function to be called on click. This is passed down to a custom link component, if one is provided. */
157
148
  onClick?(e: MouseEvent): void;
158
- /** Standard onmouseenter event */
159
149
  onMouseEnter?: (e: MouseEvent) => void;
160
- /** Standard onmouseleave event */
161
150
  onMouseLeave?: (e: MouseEvent) => void;
162
- /** Text to be shown alongside the main `text`. */
163
151
  subText?: React_2.ReactNode;
164
- /** Main text to be displayed as the item. Accepts a react component but in most cases this should just be a string. */
165
152
  text?: React_2.ReactNode;
166
- /** React component to be placed to the right of the main text. */
167
153
  textAfter?: React_2.ReactNode;
168
- /** React component to be placed to the right of the main text when the item is selected with keyboard navigation. */
169
154
  selectedIcon?: React_2.ReactNode;
170
- /** React component to be used for rendering links */
171
155
  linkComponent?: React_2.ComponentType;
172
156
  };
173
157
 
174
- declare type Props_3 = {
175
- /** Search results in the form of ResultItemGroups containing Result components */
158
+ // @public (undocumented)
159
+ type Props_3 = {
176
160
  children: React_2.ReactNode;
177
- /** Set search loading state */
178
161
  isLoading?: boolean;
179
- /** onBlur callback for search input */
180
162
  onSearchBlur?: (event: React_2.FocusEvent<HTMLInputElement>) => void;
181
- /** onInput callback for search input */
182
163
  onSearchInput?: (
183
164
  event: React_2.FormEvent<HTMLInputElement>,
184
165
  isAutocompleted?: boolean,
185
166
  ) => void;
186
- /** onKeyDown callback for search input */
187
167
  onSearchKeyDown?: (event: React_2.KeyboardEvent<HTMLInputElement>) => void;
188
- /** Called when the user submits the search form without selecting a result */
189
168
  onSearchSubmit?: (event: React_2.KeyboardEvent<HTMLInputElement>) => void;
190
- /** Placeholder text for search input field */
191
169
  placeholder?: string;
192
- /** Value of the search input field */
193
170
  value?: string;
194
- /** Corresponds to the `resultId` of the selected result */
195
171
  selectedResultId?: SelectedResultId;
196
- /** Optional way of being notified when the selected result changes due to keyboard nav */
197
172
  onSelectedResultIdChanged?: (id: SelectedResultId) => void;
198
173
  firePrivateAnalyticsEvent?: (eventName: string, eventData: Object) => void;
199
- /** React component to be used for rendering links */
200
174
  linkComponent?: React_2.ComponentType<any>;
201
- /** The elements to render to the right of the search input. */
202
175
  inputControls?: React_2.ReactNode;
203
- /** One string that is used to autocomplete the current search query */
204
176
  autocompleteText?: string;
205
177
  };
206
178
 
207
- declare type Props_4 = {
208
- /** The elements to render as options to search from. */
179
+ // @public (undocumented)
180
+ type Props_4 = {
209
181
  children?: React_2.ReactNode;
210
- /** The elements to render to the right of the search input. */
211
182
  inputControls?: React_2.ReactNode;
212
- /** Set whether the loading state should be shown. */
213
183
  isLoading?: boolean;
214
- /** Function to be called when the search input loses focus. */
215
184
  onBlur?: (event: React_2.FocusEvent<HTMLInputElement>) => void;
216
- /** Function to be called when a input action occurs (native `oninput` event). */
217
185
  onInput?: (event: React_2.FormEvent<HTMLInputElement>) => void;
218
- /** Function to be called when the user hits the escape key. */
219
186
  onKeyDown?: (event: React_2.KeyboardEvent<HTMLInputElement>) => void;
220
- /** Placeholder text for search field. */
221
187
  placeholder?: string;
222
- /** Current value of search field. */
223
188
  value?: string;
224
- /** Autocomplete information */
225
189
  autocompleteText?: string;
226
190
  };
227
191
 
@@ -230,73 +194,80 @@ declare namespace quickSearchResultTypes {
230
194
  }
231
195
  export { quickSearchResultTypes };
232
196
 
233
- export declare const ResultBase: (props: ResultBaseProps) => JSX.Element;
197
+ // @public (undocumented)
198
+ export const ResultBase: (props: ResultBaseProps) => JSX.Element;
234
199
 
235
- declare class ResultBase_2 extends React_2.PureComponent<
200
+ // @public (undocumented)
201
+ class ResultBase_2 extends React_2.PureComponent<
236
202
  DefaultProps & ResultBaseProps
237
203
  > {
238
- static defaultProps: Partial<ResultBaseProps>;
239
- state: {
240
- isMouseSelected: boolean;
241
- };
242
- registerResult(): void;
204
+ // (undocumented)
243
205
  componentDidMount(): void;
206
+ // (undocumented)
244
207
  componentDidUpdate(): void;
208
+ // (undocumented)
245
209
  componentWillUnmount(): void;
210
+ // (undocumented)
211
+ static defaultProps: Partial<ResultBaseProps>;
212
+ // (undocumented)
246
213
  getAnalyticsData(): AnalyticsData;
214
+ // (undocumented)
247
215
  handleClick: (e: MouseEvent) => void;
216
+ // (undocumented)
248
217
  handleMouseEnter: (event: MouseEvent) => void;
218
+ // (undocumented)
249
219
  handleMouseLeave: () => void;
220
+ // (undocumented)
221
+ registerResult(): void;
222
+ // (undocumented)
250
223
  render(): JSX.Element;
224
+ // (undocumented)
225
+ state: {
226
+ isMouseSelected: boolean;
227
+ };
251
228
  }
252
229
 
253
- export declare type ResultBaseProps = CommonResultProps & {
254
- /** Type of the result. This is passed as a parameter to certain callbacks. */
230
+ // @public (undocumented)
231
+ export type ResultBaseProps = CommonResultProps & {
255
232
  type: string;
256
- /** Main text to be displayed as the item. */
257
233
  text: React_2.ReactNode;
258
- /** Text to be shown alongside the main `text`. */
259
234
  subText?: React_2.ReactNode;
260
- /** Text to appear to the right of the text. It has a lower font-weight. */
261
235
  caption?: string;
262
- /** React element to appear to the left of the text. */
263
236
  icon?: React_2.ReactNode;
264
- /** The context provided by QuickSearch. */
265
237
  context?: ResultContextType;
266
238
  };
267
239
 
268
- declare type ResultContextType = {
269
- /** Register result as keyboard navigation target */
240
+ // @public (undocumented)
241
+ type ResultContextType = {
270
242
  registerResult: (result: ResultBase_2) => void;
271
- /** Unregister result as keyboard navigation target */
272
243
  unregisterResult: (result: ResultBase_2) => void;
273
- /** Triggered by mouseEnter event. */
274
244
  onMouseEnter: (resultData: ResultData) => void;
275
- /** Standard onMouseLeave event. */
276
245
  onMouseLeave: () => void;
277
- /** Fires an analytics event */
278
246
  sendAnalytics?: (eventName: string, eventData: Object) => void;
279
- /** get the index of the search result in the list of result */
280
247
  getIndex: (resultId: ResultId) => number | null;
281
- /** React component to be used for rendering links */
282
248
  linkComponent?: ComponentType;
283
249
  };
284
250
 
285
- export declare type ResultData = {
251
+ // @public (undocumented)
252
+ export type ResultData = {
286
253
  resultId: ResultId;
287
254
  type: string;
288
255
  event: CancelableEvent;
289
256
  };
290
257
 
291
- declare type ResultId = string | number;
258
+ // @public (undocumented)
259
+ type ResultId = string | number;
292
260
 
293
- declare class ResultItemGroup extends React_2.Component<Props> {
261
+ // @public (undocumented)
262
+ class ResultItemGroup extends React_2.Component<Props> {
263
+ // (undocumented)
294
264
  render(): JSX.Element;
295
265
  }
296
266
  export { ResultItemGroup as AkNavigationItemGroup };
297
267
  export { ResultItemGroup };
298
268
 
299
- declare type SelectedResultId = ResultId | null;
269
+ // @public (undocumented)
270
+ type SelectedResultId = ResultId | null;
300
271
 
301
- export {};
272
+ // (No @packageDocumentation comment for this package)
302
273
  ```