From 16bfce165211ebeda7a67aa8a7d9ecd19bc42bfa Mon Sep 17 00:00:00 2001 From: Graham Fairweather Date: Mon, 26 Feb 2018 08:58:50 +0100 Subject: [PATCH] Common enums used in the project -DRY This is not all of them, just those found during the select rework. --- src/utils/enums.js | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/utils/enums.js diff --git a/src/utils/enums.js b/src/utils/enums.js new file mode 100644 index 00000000..08bcac35 --- /dev/null +++ b/src/utils/enums.js @@ -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, +]);