UNPKG

2.64 kBTypeScriptView Raw
1import { View } from '../core/view';
2import { Property } from '../core/properties';
3import { EventData } from '../../data/observable';
4import { Color } from '../../color';
5
6/**
7 * Represents a search bar component.
8 */
9export class SearchBar extends View {
10 /**
11 * String value used when hooking to submit event.
12 */
13 public static submitEvent: string;
14
15 /**
16 * String value used when hooking to clear event.
17 */
18 public static clearEvent: string;
19
20 /**
21 * Gets the native [android widget](http://developer.android.com/reference/android/widget/SearchView.html) that represents the user interface for this component. Valid only when running on Android OS.
22 */
23 android: any /* android.widget.SearchView */;
24
25 /**
26 * Gets the native iOS [UISearchBar](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UISearchBar_Class/) that represents the user interface for this component. Valid only when running on iOS.
27 */
28 ios: any /* UISearchBar */;
29
30 /**
31 * Gets or sets a search bar text.
32 */
33 text: string;
34
35 /**
36 * Gets or sets the text of the search bar text field hint/placeholder.
37 */
38 hint: string;
39
40 /**
41 * Gets or sets the TextField background color of the SearchBar component.
42 */
43 textFieldBackgroundColor: Color;
44
45 /**
46 * Gets or sets the TextField Hint color of the SearchBar component.
47 */
48 textFieldHintColor: Color;
49
50 /**
51 * Adds a listener for the specified event name.
52 *
53 * @param eventName The name of the event.
54 * @param callback The event listener to add. Will be called when an event of
55 * the given name is raised.
56 * @param thisArg An optional parameter which, when set, will be bound as the
57 * `this` context when the callback is called. Falsy values will be not be
58 * bound.
59 */
60 on(eventName: string, callback: (data: EventData) => void, thisArg?: any): void;
61
62 /**
63 * Raised when a search bar search is submitted.
64 */
65 on(event: 'submit', callback: (args: EventData) => void, thisArg?: any): void;
66
67 /**
68 * Raised when a search bar search is closed.
69 */
70 on(event: 'close', callback: (args: EventData) => void, thisArg?: any): void;
71
72 /**
73 * Hides the soft input method, usually a soft keyboard.
74 */
75 dismissSoftInput(): void;
76}
77
78/**
79 * Dependency property used to support binding operations related to search-bar text.
80 */
81export const textProperty: Property<SearchBar, string>;
82export const hintProperty: Property<SearchBar, string>;
83
84/**
85 * Gets or sets the TextField background color of the SearchBar component.
86 */
87export const textFieldBackgroundColorProperty: Property<SearchBar, Color>;
88
89export const textFieldHintColorProperty: Property<SearchBar, Color>;