Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 390cdc6

Browse files
Providing types
1 parent f9b09e4 commit 390cdc6

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

‎index.d.ts

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import React, { CSSProperties, ReactNode } from 'react';
2+
export type onClearHandler = (ev: any) => void;
3+
export interface ReactCustomSearchListProps {
4+
/**will be shown in popup, if it is null then popup will not be visible */
5+
children?: React.ReactNode;
6+
/**input value */
7+
value: String;
8+
/**onChange function for input */
9+
onChange: (ev: any) => void;
10+
/** style object of the root element */
11+
rootStyle?: React.CSSProperties;
12+
/** style object of the parent element of text input */
13+
inputContainerStyle?: CSSProperties;
14+
/** style object of the input element */
15+
inputStyle?: CSSProperties;
16+
/** style object for popper container */
17+
popperStyle?: CSSProperties;
18+
/** defautl value is "search" */
19+
placeholder?: string;
20+
/** keydown handler for the input */
21+
onKeyDown?: (ev: any) => void;
22+
/** focus handler for the input */
23+
onFocus?: (ev: any) => void;
24+
/** blur handler for the input */
25+
onBlur?: (ev: any) => void;
26+
/** set popper width same as input, default value is true */
27+
fullWidth?: boolean;
28+
/** popper's placement, default value is "bottom-start" */
29+
placement?: 'auto' | 'auto-start' | 'auto-end' | 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'right' | 'right-start' | 'right-end' | 'left' | 'left-start' | 'left-end';
30+
/** custom Clear icon */
31+
ClearIconComponent?: (props: { value: string, onClear: onClearHandler }) => ReactNode;
32+
/** custom Magnifier icon */
33+
MagnifierIconComponent?: () => ReactNode;
34+
/** triggerd when the user clicks on the default Clear icon */
35+
onClear?: onClearHandler;
36+
/** searchbox theme, default value is "outline" */
37+
theme?: "underline" | "outline" | "panel";
38+
/** if set true then borderRadius would be "5px", default value is true */
39+
corner?: boolean;
40+
/** autoFocus attribute for the input element, default value is false */
41+
autoFocus?: boolean;
42+
/** name attribute for the input element */
43+
inputName?: string;
44+
/** if it is true then the suggestion list will be open when the user clicks on the input, default value is true */
45+
openOnClick?: boolean;
46+
/** it it returns true then the suggestion list will be open, default value is (e) => e.key === 'Enter' */
47+
openOnKeyDown?: boolean;
48+
}
49+
declare const ReactCustomSearchList: (props: ReactCustomSearchListProps) => ReactNode;
50+
export default ReactCustomSearchList;

‎package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@
116116
"directories": {
117117
"lib": "lib"
118118
},
119+
"types": "./index.d.ts",
119120
"jest": {
120121
"testEnvironment": "jsdom",
121122
"setupFilesAfterEnv": [

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /