| 1 |
/// <reference types="react" /> |
| 2 |
/** Properties for adding search attributes to an advanced search input. These properties must |
| 3 |
* be passed in as an object within an array to the search input component's attribute property. |
| 4 |
*/ |
| 5 |
export interface SearchInputSearchAttribute { |
| 6 |
/** The search attribute's value to be provided in the search input's query string. |
| 7 |
* It should have no spaces and be unique for every attribute. |
| 8 |
*/ |
| 9 |
attr: string; |
| 10 |
/** The search attribute's display name. It is used to label the field in the advanced |
| 11 |
* search menu. |
| 12 |
*/ |
| 13 |
display: React.ReactNode; |
| 14 |
} |
| 15 |
/** Properties for creating an expandable search input. These properties should be passed into |
| 16 |
* the search input component's expandableInput property. |
| 17 |
*/ |
| 18 |
export interface SearchInputExpandable { |
| 19 |
/** Flag to indicate if the search input is expanded. */ |
| 20 |
isExpanded: boolean; |
| 21 |
/** Callback function to toggle the expandable search input. */ |
| 22 |
onToggleExpand: (event: React.SyntheticEvent<HTMLButtonElement>, isExpanded: boolean) => void; |
| 23 |
/** An accessible label for the expandable search input toggle. */ |
| 24 |
toggleAriaLabel: string; |
| 25 |
/** Flag indicating animations should be enabled when the search input expands and collapses. Note: this will change the component's DOM structure. In a future breaking change release, this will become the default behavior and will no longer be needed. */ |
| 26 |
hasAnimations?: boolean; |
| 27 |
} |
| 28 |
/** The main search input component. */ |
| 29 |
export interface SearchInputProps extends Omit<React.HTMLProps<HTMLDivElement>, 'onChange' | 'results' | 'ref'> { |
| 30 |
/** Delimiter in the query string for pairing attributes with search values. |
| 31 |
* Required whenever attributes are passed as props. |
| 32 |
*/ |
| 33 |
advancedSearchDelimiter?: string; |
| 34 |
/** The container to append the menu to. |
| 35 |
* If your menu is being cut off you can append it to an element higher up the DOM tree. |
| 36 |
* Some examples: |
| 37 |
* appendTo={() => document.body} |
| 38 |
* appendTo={document.getElementById('target')} |
| 39 |
*/ |
| 40 |
appendTo?: HTMLElement | (() => HTMLElement) | 'inline'; |
| 41 |
/** An accessible label for the search input. */ |
| 42 |
'aria-label'?: string; |
| 43 |
/** Flag to indicate utilities should be displayed. By default if this prop is undefined or false, utilities will only be displayed when the search input has a value. */ |
| 44 |
areUtilitiesDisplayed?: boolean; |
| 45 |
/** Array of attribute values used for dynamically generated advanced search. */ |
| 46 |
attributes?: string[] | SearchInputSearchAttribute[]; |
| 47 |
/** Additional classes added to the search input. */ |
| 48 |
className?: string; |
| 49 |
/** Object that makes the search input expandable/collapsible. */ |
| 50 |
expandableInput?: SearchInputExpandable; |
| 51 |
formAdditionalItems?: React.ReactNode; |
| 52 |
/** Attribute label for strings unassociated with one of the provided listed attributes. */ |
| 53 |
hasWordsAttrLabel?: React.ReactNode; |
| 54 |
/** A suggestion for autocompleting. */ |
| 55 |
hint?: string; |
| 56 |
/** Id for the search input */ |
| 57 |
searchInputId?: string; |
| 58 |
/** @hide A reference object to attach to the input box. */ |
| 59 |
innerRef?: React.RefObject<any>; |
| 60 |
/** A flag for controlling the open state of a custom advanced search implementation. */ |
| 61 |
isAdvancedSearchOpen?: boolean; |
| 62 |
/** Flag indicating if search input is disabled. */ |
| 63 |
isDisabled?: boolean; |
| 64 |
/** Flag indicating if the next navigation button is disabled. */ |
| 65 |
isNextNavigationButtonDisabled?: boolean; |
| 66 |
/** Flag indicating if the previous navigation button is disabled. */ |
| 67 |
isPreviousNavigationButtonDisabled?: boolean; |
| 68 |
/** Accessible label for the button to navigate to next result. */ |
| 69 |
nextNavigationButtonAriaLabel?: string; |
| 70 |
/** A callback for when the input value changes. */ |
| 71 |
onChange?: (event: React.FormEvent<HTMLInputElement>, value: string) => void; |
| 72 |
/** A callback for when the user clicks the clear button. */ |
| 73 |
onClear?: (event: React.SyntheticEvent<HTMLButtonElement>) => void; |
| 74 |
/** A callback for when the user clicks to navigate to next result. */ |
| 75 |
onNextClick?: (event: React.SyntheticEvent<HTMLButtonElement>) => void; |
| 76 |
/** A callback for when the user clicks to navigate to previous result. */ |
| 77 |
onPreviousClick?: (event: React.SyntheticEvent<HTMLButtonElement>) => void; |
| 78 |
/** A callback for when the search button is clicked. */ |
| 79 |
onSearch?: (event: React.SyntheticEvent<HTMLButtonElement>, value: string, attrValueMap: { |
| 80 |
[key: string]: string; |
| 81 |
}) => void; |
| 82 |
/** A callback for when the open advanced search button is clicked. */ |
| 83 |
onToggleAdvancedSearch?: (event: React.SyntheticEvent<HTMLButtonElement>, isOpen?: boolean) => void; |
| 84 |
/** Accessible label for the button which opens the advanced search form menu. */ |
| 85 |
openMenuButtonAriaLabel?: string; |
| 86 |
/** Placeholder text of the search input. */ |
| 87 |
placeholder?: string; |
| 88 |
/** Accessible label for the button to navigate to previous result. */ |
| 89 |
previousNavigationButtonAriaLabel?: string; |
| 90 |
/** z-index of the advanced search form when appendTo is not inline. */ |
| 91 |
zIndex?: number; |
| 92 |
/** Label for the button which resets the advanced search form and clears the search input. */ |
| 93 |
resetButtonLabel?: string; |
| 94 |
/** The number of search results returned. Either a total number of results, |
| 95 |
* or a string representing the current result over the total number of results. i.e. "1 / 5". */ |
| 96 |
resultsCount?: number | string; |
| 97 |
/** Screenreader text that will appear after resultsCount to give context for what that value represents to assistive technologies. */ |
| 98 |
resultsCountContext?: string; |
| 99 |
/** Label for the button which calls the onSearch event handler. */ |
| 100 |
submitSearchButtonLabel?: string; |
| 101 |
/** Value of the search input. */ |
| 102 |
value?: string; |
| 103 |
/** Name attribute for the search input */ |
| 104 |
name?: string; |
| 105 |
/** Additional props to spread to the search input element. */ |
| 106 |
inputProps?: any; |
| 107 |
} |
| 108 |
export declare const SearchInput: import("react").ForwardRefExoticComponent<SearchInputProps & import("react").RefAttributes<HTMLInputElement>>; |
| 109 |
//# sourceMappingURL=SearchInput.d.ts.map |