-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
ViewWin32.Props.ts
281 lines (253 loc) · 8.76 KB
/
ViewWin32.Props.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
'use strict';
import React from 'react'
import RN = require('react-native');
// removes from interface T the members of interface K
type Omit<T, K> = Pick<T, Exclude<keyof T, keyof K>>;
// All of T becomes optional except for Keys
type PartiallyRequired<T, Keys extends keyof T = keyof T> = Pick<Partial<T>, Exclude<keyof T, Keys>> & Pick<T, Keys>;
/**
* All of TOrigin except Key from TUse
*/
export type UseFrom<TOrigin, TUse, Key extends keyof TUse> = Pick<TOrigin, Exclude<keyof TOrigin, Key>> & Pick<TUse, Key>;
export enum EventPhase {
None,
Capturing,
AtTarget,
Bubbling
}
export interface INativeKeyboardEvent {
altKey: boolean;
ctrlKey: boolean;
metaKey: boolean;
shiftKey: boolean;
key: string;
eventPhase: EventPhase;
}
export type IKeyboardEvent = RN.NativeSyntheticEvent<INativeKeyboardEvent>;
export type IHandledKeyboardEvent = PartiallyRequired<INativeKeyboardEvent, 'key'>;
export interface IViewWin32 {
focus: () => void;
}
export type ARIARole =
| 'alert'
| 'alertdialog'
| 'application'
| 'button'
| 'checkbox'
| 'combobox'
| 'dialog'
| 'group'
| 'link'
| 'listitem'
| 'menu'
| 'menubar'
| 'menuitem'
| 'none'
| 'presentation'
| 'progressbar'
| 'radio'
| 'radiogroup'
| 'scrollbar'
| 'search'
| 'spinbutton'
| 'switch'
| 'tab'
| 'tablist'
| 'tabpanel'
| 'textbox'
| 'timer'
| 'toolbar'
| 'tree'
| 'treeitem';
export type AnnotationType =
| 'AdvanceProofingIssue'
| 'Author'
| 'CircularReferenceError'
| 'Comment'
| 'ConflictingChange'
| 'DataValidationError'
| 'DeletionChange'
| 'EditingLockedChange'
| 'Endnote'
| 'ExternalChange'
| 'Footer'
| 'Footnote'
| 'FormatChange'
| 'FormulaError'
| 'GrammarError'
| 'Header'
| 'Highlighted'
| 'InsertionChange'
| 'Mathematics'
| 'MoveChange'
| 'SpellingError'
| 'TrackChanges'
| 'Unknown'
| 'UnsyncedChange';
export type AccessibilityAnnotationInfo = Readonly<{
typeID: AnnotationType;
typeName?: string;
author?: string;
dateTime?: string;
target?: string;
}>;
export type AccessibilityActionName =
| RN.AccessibilityActionName
| 'AddToSelection'
| 'RemoveFromSelection'
| 'Select'
| 'Expand'
| 'Collapse'
| 'Toggle';
export type Cursor =
| 'auto'
| 'default'
| 'pointer'
| 'help'
| 'not-allowed'
| 'wait'
| 'move'
| 'nesw-resize'
| 'ns-resize'
| 'nwse-resize'
| 'we-resize'
| 'text'
export type AccessibilityActionInfo = Readonly<{
name: AccessibilityActionName;
label?: string;
}>;
export type AccessibilityState = RN.AccessibilityState & { multiselectable?: boolean, required?: boolean };
export type SharedAccessibilityPropsIOSandWin32 = {
onAccessibilityTap?: () => void;
};
export type OmittedAccessibilityPropsWin32 = {
accessibilityActions?: ReadonlyArray<RN.AccessibilityActionInfo>;
accessibilityRole?: RN.AccessibilityRole;
accessibilityState?: RN.AccessibilityState;
};
export type BasePropsWin32 = {
/**
* Tells a person using a screen reader the type of element they are focused on.
*
* Overrides the `accessibilityRole` prop on React Native to accept a subset of ARIA roles.
*
* Possible values for ARIARole are: alert, alertdialog, application, button, checkbox,
* comobox, dialog, group, link, menu, menubar, menuitem, none, presentation, progressbar,
* radio, radiogroup, scrollbar, search, spinbutton, switch, tab, tablist, tabpanel, textbox,
* timer, toolbar, tree, and treeitem.
*/
accessibilityRole?: RN.AccessibilityRole | ARIARole;
accessibilityState?: AccessibilityState;
accessibilityActions?: ReadonlyArray<AccessibilityActionInfo>;
/**
* Windows Accessibility extensions for allowing other DOM elements to label or describe a given element.
*
* Defined as a reference to another DOM element inheriting from the primary base classes of React-Native elements.
* The reference will be converted to a native reference (tag) before passing to the native platform.
*/
accessibilityDescribedBy?: React.RefObject<any>;
accessibilityLabeledBy?: React.RefObject<any>;
/**
* Identifies the element whose contents or presence are controlled by another element.
*
* This is mainly used for a Textbox with a Dropdown PeoplePicker-type list. This allows an
* accessibility tool to query those other providers for properties and listen to their events.
*/
accessibilityControls?: React.RefObject<any>;
/**
* Identifies the ItemType property, which is a text string describing the type of the automation element.
* ItemType is used to obtain information about items in a list, tree view, or data grid. For example, an item in a file directory view might be a "Document File" or a "Folder".
*/
accessibilityItemType?: string;
/**
* Defines the level of an element in a hierarchical structure or the heading level of a text element.
* Note: accessibilityRole="header" must be used if using this property to define a heading level.
*/
accessibilityLevel?: number;
};
export type ViewWin32OmitTypes = RN.ViewPropsAndroid &
RN.ViewPropsIOS &
RN.AccessibilityPropsAndroid &
Omit<RN.AccessibilityPropsIOS, SharedAccessibilityPropsIOSandWin32> &
OmittedAccessibilityPropsWin32;
/**
* Properties for ViewWin32 component
*/
export interface IViewWin32Props extends Omit<RN.ViewProps, ViewWin32OmitTypes>, BasePropsWin32 {
type?: React.ElementType;
children?: React.ReactNode;
/**
* An access key to hook up to the UIA_AccessKey_Property.
* Access keys are used in keyboard navigation to allow quick navigation to UI in an application.
*/
accessibilityAccessKey?: string;
accessibilityActions?: ReadonlyArray<AccessibilityActionInfo>;
/**
* Tells a person using a screen reader what kind of annotation they
* have selected. If available, it will also tell a person the author of the annotation and
* the date and time the annotation was posted.
*
* Note: If typeID is 'Unknown', a typeName must be provided.
*/
accessibilityAnnotation?: AccessibilityAnnotationInfo;
/**
* accessibilityDescription provides more detailed information specific to the element (i.e. last edit date, full location for a file)
* while accessibilityHint provides infomation on what will happen when they perform an action.
*
*/
accessibilityDescription?: string;
accessibilityPositionInSet?: number;
accessibilitySetSize?: number;
animationClass?: string;
focusable?: boolean;
enableFocusRing?: boolean;
/*
* overrides the default behavior of some components that do not show a tooltip. i.e. components in a menu
*/
alwaysShowToolTip?: boolean;
/**
* The onBlur event occurs when an element loses focus. The opposite of onBlur is onFocus. Note that in React
* Native, unlike in the web, the onBlur event bubbles (similar to onFocusOut in the web).
*
* `ev.target === ev.currentTarget` when the focus is being lost from this component.
* `ev.target !== ev.currentTarget` when the focus is being lost from a descendant.
*/
onBlur?: (ev: RN.NativeSyntheticEvent<{}>) => void;
/**
* The onBlur event occurs when an element loses focus. The opposite of onBlur is onFocus. Note that in React
* Native, unlike in the web, the onBlur event bubbles (similar to onFocusOut in the web).
*
* `ev.target === ev.currentTarget` when the focus is being lost from this component.
* `ev.target !== ev.currentTarget` when the focus is being lost from a descendant.
*/
onBlurCapture?: (ev: RN.NativeSyntheticEvent<{}>) => void;
/**
* The onFocus event occurs when an element gets focus. The opposite of onFocus is onBlur. Note that in React
* Native, unlike in the web, the onFocus event bubbles (similar to onFocusIn in the web).
*
* `ev.target === ev.currentTarget` when the focus is being lost from this component.
* `ev.target !== ev.currentTarget` when the focus is being lost from a descendant.
*/
onFocus?: (ev: RN.NativeSyntheticEvent<{}>) => void;
/**
* The onFocus event occurs when an element gets focus. The opposite of onFocus is onBlur. Note that in React
* Native, unlike in the web, the onFocus event bubbles (similar to onFocusIn in the web).
*
* `ev.target === ev.currentTarget` when the focus is being lost from this component.
* `ev.target !== ev.currentTarget` when the focus is being lost from a descendant.
*/
onFocusCapture?: (ev: RN.NativeSyntheticEvent<{}>) => void;
onKeyDown?: (args: IKeyboardEvent) => void;
onKeyDownCapture?: (args: IKeyboardEvent) => void;
onKeyUp?: (args: IKeyboardEvent) => void;
onKeyUpCapture?: (args: IKeyboardEvent) => void;
onMouseEnter?: () => void;
onMouseLeave?: () => void;
keyDownEvents?: IHandledKeyboardEvent[];
keyUpEvents?: IHandledKeyboardEvent[];
/**
* Provides a screentip to be used on hover of the view
*/
tooltip?: string;
cursor?: Cursor;
}