Common enums used in the project -DRY

This is not all of them, just those found during the select rework.
This commit is contained in:
Graham Fairweather 2018-02-26 08:58:50 +01:00
parent 899ad697b0
commit 16bfce1652

40
src/utils/enums.js Normal file
View file

@ -0,0 +1,40 @@
import {
BOTTOM,
DEFAULT,
LARGE,
SMALL,
TOP
} from './constants';
import {
ALT,
ARROWLEFT,
ARROWRIGHT,
CAPSLOCK,
CONTROL,
ENTER,
META,
SHIFT,
TAB,
} from './kbEventKeys';
export const PLACEMENT_LIST = Object.freeze([BOTTOM, TOP]);
export const PLACEMENT_MAP = Object.freeze({
[BOTTOM]: TOP,
[TOP]: BOTTOM,
});
export const SMALL_LARGE_DEFAULT_LIST = Object.freeze([SMALL, LARGE, DEFAULT]);
export const STRING_NUMBER_LIST = Object.freeze([String, Number]);
export const STRING_NUMBER_ARRAY_LIST = Object.freeze([String, Number, Array]);
export const IGNORE_KEY_LIST = Object.freeze([
ALT,
ARROWLEFT,
ARROWRIGHT,
CAPSLOCK,
CONTROL,
ENTER,
META,
SHIFT,
TAB,
]);