forked from furcan/KioskBoard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
194 lines (166 loc) · 5.99 KB
/
index.d.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
/*!
* KioskBoard - Virtual Keyboard ('https://github.com/furcan/KioskBoard')
* Version: 2.3.0
* Description: TypeScript Declaration.
* Author: Furkan ('https://github.com/furcan')
* Copyright 2022 KioskBoard - Virtual Keyboard, MIT Licence ('https://opensource.org/licenses/MIT')*
*/
/**
* KioskBoard is a pure JavaScript library for using virtual keyboards.
* @namespace KioskBoard
* @memberof Global
*/
declare namespace KioskBoard {
/**
* @interface IKioskBoardOptions
* @memberof KioskBoard
*/
export interface IKioskBoardOptions {
/**
* @property {Array<Object>} - Required, An Array of Objects has to be defined for the custom keys.
* @defaultValue `null`
*
* e.g. [{"key":"value"}, {"key":"value"}] => [{"0":"A","1":"B","2":"C"}, {"0":"D","1":"E","2":"F"}]
*
* Hint: Each object creates a row element (HTML) on the keyboard.
*/
keysArrayOfObjects: { [index: string]: string }[];
/**
* @property {string} - Required only if `keysArrayOfObjects` option is `null`.
* @defaultValue `null`
*
* The path of the "kioskboard-keys-${langugage}.json" file must be set to the "keysJsonUrl" option. (XMLHttpRequest to get the keys from JSON file.)
*
* e.g. '/Content/Plugins/KioskBoard/dist/kioskboard-keys-english.json'
*/
keysJsonUrl?: string;
/**
* @property {Array<string>} - Optional, An Array of Strings can be set to override the built-in special characters.
* @defaultValue `null`
*
* e.g. ["#", "€", "%", "+", "-", "*"]
*/
keysSpecialCharsArrayOfStrings?: string[];
/**
* @property {Array<number>} - Optional, An Array of Numbers can be set to override the built-in numpad keys. (From 0 to 9, in any order.)
* @defaultValue `null`
*
* e.g. [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]
*/
keysNumpadArrayOfNumbers?: number[];
/**
* @property {string} - Optional, Language Code `(ISO 639-1)` for custom keys (for language support).
* @defaultValue `en`
*
* e.g. `de`, `en`, `fr`, `hu`, `tr`, etc...
*/
language?: string;
/**
* @property {string} - Optional, The theme of keyboard.
* @defaultValue `light`
*/
theme?: 'light' | 'dark' | 'flat' | 'material' | 'oldschool';
/**
* @property {boolean} - Optional, Scrolls the document to the top or bottom(by the placement option) of the input/textarea element. Prevented when `false`.
* @defaultValue `true`
*/
autoScroll?: boolean;
/**
* @property {boolean} - Optional, Uppercase or lowercase to start. Uppercased when `true`.
* @defaultValue `true`
*/
capsLockActive?: boolean;
/**
* @property {boolean} - Optional, Allow or prevent real/physical keyboard usage. Prevented when `false`.
* @defaultValue `false`
*
* In addition, the `allowMobileKeyboard` option must be `true` as well, if the real/physical keyboard has wanted to be used.
*/
allowRealKeyboard?: boolean;
/**
* @property {boolean} - Optional, Allow or prevent mobile keyboard usage. Prevented when `false`.
* @defaultValue `false`
*/
allowMobileKeyboard?: boolean;
/**
* @property {boolean} - Optional, CSS animations for opening or closing the keyboard.
* @defaultValue `true`
*/
cssAnimations?: boolean;
/**
* @property {number} - Optional, CSS animations duration as millisecond.
* @defaultValue `360`
*/
cssAnimationsDuration?: number;
/**
* @property {string} - Optional, CSS animations style for opening or closing the keyboard.
* @defaultValue `slide`
*/
cssAnimationsStyle?: 'slide' | 'fade';
/**
* @property {boolean} - Optional, Enable or Disable Spacebar functionality on the keyboard. The Spacebar will be passive when `false`.
* @defaultValue `true`
*/
keysAllowSpacebar?: boolean;
/**
* @property {string} - Optional, Text of the space key (Spacebar). Without text => `" "`
* @defaultValue `Space`
*/
keysSpacebarText?: string;
/**
* @property {string} - Optional, Font family of the keys.
* @defaultValue `sans-serif`
*/
keysFontFamily?: string;
/**
* @property {string} - Optional, Font size of the keys.
* @defaultValue `22px`
*/
keysFontSize?: string;
/**
* @property {string} - Optional, Font weight of the keys.
* @defaultValue `normal`
*/
keysFontWeight?: string;
/**
* @property {string} - Optional, Size of the icon keys.
* @defaultValue `25px`
*/
keysIconSize?: string;
/**
* @property {string} - Optional, Text of the Enter key (Enter/Return). Without text => `" "`
* @defaultValue `Enter`
*/
keysEnterText?: string;
/**
* @property {function} - Optional, The callback function of the Enter key. This function will be called when the enter key has been clicked.
* @defaultValue `undefined`
*/
keysEnterCallback?: () => void;
/**
* @property {boolean} - Optional, The Enter key can close and remove the keyboard. Prevented when `false`
* @defaultValue `true`
*/
keysEnterCanClose?: boolean;
}
/**
* This method can be used to set custom options globally for KioskBoard.
* @function init
* @memberof KioskBoard
* @param {Object} initOptions - Required, `KioskBoard.IKioskBoardOptions`.
*/
function init(initOptions: IKioskBoardOptions): void;
/**
* This method can be used to use KioskBoard on the selected `input` and/or `textarea` elements.
* @function run
* @memberof KioskBoard
* @param {string | HTMLInputElement | HTMLTextAreaElement } selectorOrElement - Required, CSS selector(s) that matches the element(s) or an `input`/`textarea` element.
* @param {Object} initOptions - Required, `KioskBoard.IKioskBoardOptions`.
*/
function run(
selectorOrElement: string | HTMLInputElement | HTMLTextAreaElement,
initOptions: IKioskBoardOptions,
): void;
}
export = KioskBoard;
export as namespace KioskBoard;