|
1 | 1 | export const NumberInputActionTypes = {
|
2 |
| - blur: 'numberInput:blur', |
| 2 | + clamp: 'numberInput:clamp', |
3 | 3 | inputChange: 'numberInput:inputChange',
|
4 |
| - keyDown: 'numberInput:keyDown', |
5 | 4 | increment: 'numberInput:increment',
|
6 | 5 | decrement: 'numberInput:decrement',
|
| 6 | + decrementToMin: 'numberInput:decrementToMin', |
| 7 | + incrementToMax: 'numberInput:incrementToMax', |
7 | 8 | } as const;
|
8 | 9 |
|
9 |
| -interface NumberInputBlurAction { |
10 |
| - type: typeof NumberInputActionTypes.blur; |
11 |
| - event: React.FocusEvent; |
| 10 | +interface NumberInputClampAction { |
| 11 | + type: typeof NumberInputActionTypes.clamp; |
| 12 | + inputValue: string; |
12 | 13 | }
|
13 | 14 |
|
14 | 15 | interface NumberInputInputChangeAction {
|
15 | 16 | type: typeof NumberInputActionTypes.inputChange;
|
16 |
| - event: React.ChangeEvent; |
17 |
| -} |
18 |
| - |
19 |
| -interface NumberInputKeyDownAction { |
20 |
| - type: typeof NumberInputActionTypes.keyDown; |
21 |
| - event: React.KeyboardEvent; |
22 |
| - key: string; |
| 17 | + inputValue: string; |
23 | 18 | }
|
24 | 19 |
|
25 | 20 | interface NumberInputIncrementAction {
|
26 | 21 | type: typeof NumberInputActionTypes.increment;
|
27 |
| - // triggering a button with the keyboard fires a PointerEvent |
28 |
| - event: React.PointerEvent; |
| 22 | + shiftKey: boolean; |
29 | 23 | }
|
30 | 24 |
|
31 | 25 | interface NumberInputDecrementAction {
|
32 | 26 | type: typeof NumberInputActionTypes.decrement;
|
33 |
| - // triggering a button with the keyboard fires a PointerEvent |
34 |
| - event: React.PointerEvent; |
| 27 | + shiftKey: boolean; |
| 28 | +} |
| 29 | + |
| 30 | +interface NumberInputIncrementToMaxAction { |
| 31 | + type: typeof NumberInputActionTypes.incrementToMax; |
| 32 | +} |
| 33 | + |
| 34 | +interface NumberInputDecrementToMinAction { |
| 35 | + type: typeof NumberInputActionTypes.decrementToMin; |
35 | 36 | }
|
36 | 37 |
|
37 | 38 | export type NumberInputAction =
|
38 |
| - | NumberInputBlurAction |
| 39 | + | NumberInputClampAction |
39 | 40 | | NumberInputInputChangeAction
|
40 |
| - | NumberInputKeyDownAction |
41 | 41 | | NumberInputIncrementAction
|
42 |
| - | NumberInputDecrementAction; |
| 42 | + | NumberInputDecrementAction |
| 43 | + | NumberInputIncrementToMaxAction |
| 44 | + | NumberInputDecrementToMinAction; |
0 commit comments