orcs-design-system 3.2.4 → 3.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/es/GlobalStyles.js +1 -31
  2. package/es/SystemThemeProvider.js +11 -5
  3. package/es/assets/Colour/Colour.stories.js +211 -0
  4. package/es/assets/Colour/index.js +3 -3
  5. package/es/components/ActionsMenu/ActionsMenu.stories.js +260 -233
  6. package/es/components/ActionsMenu/index.js +144 -229
  7. package/es/components/Avatar/Avatar.stories.js +212 -196
  8. package/es/components/Avatar/index.js +280 -307
  9. package/es/components/Badge/Badge.stories.js +71 -46
  10. package/es/components/Badge/index.js +71 -74
  11. package/es/components/Box/Box.stories.js +51 -35
  12. package/es/components/Box/index.js +33 -34
  13. package/es/components/Button/Button.stories.js +161 -145
  14. package/es/components/Button/ButtonLink.stories.js +152 -139
  15. package/es/components/Button/index.js +79 -99
  16. package/es/components/ButtonGroup/ButtonGroup.stories.js +43 -42
  17. package/es/components/ButtonGroup/ButtonGroupItem.stories.js +11 -13
  18. package/es/components/ButtonGroup/index.js +103 -99
  19. package/es/components/Card/Card.stories.js +94 -62
  20. package/es/components/Card/index.js +50 -71
  21. package/es/components/Checkbox/Checkbox.stories.js +37 -43
  22. package/es/components/Checkbox/index.js +61 -76
  23. package/es/components/DatePicker/DatePicker.stories.js +86 -118
  24. package/es/components/DatePicker/index.js +71 -187
  25. package/es/components/Divider/Divider.stories.js +39 -42
  26. package/es/components/Divider/index.js +21 -27
  27. package/es/components/Expandable/Expandable.stories.js +46 -36
  28. package/es/components/Expandable/index.js +55 -82
  29. package/es/components/Flex/Flex.stories.js +19 -5
  30. package/es/components/Flex/FlexItem.stories.js +10 -9
  31. package/es/components/Flex/index.js +34 -27
  32. package/es/components/Grid/Grid.stories.js +129 -55
  33. package/es/components/Grid/index.js +25 -24
  34. package/es/components/Header/Header.stories.js +101 -92
  35. package/es/components/Header/index.js +433 -436
  36. package/es/components/HeaderSimple/HeaderSimple.stories.js +23 -27
  37. package/es/components/HeaderSimple/index.js +73 -68
  38. package/es/components/Icon/Icon.stories.js +58 -57
  39. package/es/components/Icon/index.js +48 -46
  40. package/es/components/Loading/Loading.stories.js +32 -39
  41. package/es/components/Loading/index.js +44 -51
  42. package/es/components/Modal/Modal.stories.js +172 -153
  43. package/es/components/Modal/index.js +126 -134
  44. package/es/components/Notification/Notification.stories.js +59 -58
  45. package/es/components/Notification/index.js +123 -133
  46. package/es/components/Popover/Popover.stories.js +134 -102
  47. package/es/components/Popover/index.js +65 -111
  48. package/es/components/ProgressBar/ProgressBar.stories.js +36 -39
  49. package/es/components/ProgressBar/index.js +29 -34
  50. package/es/components/RadioButton/RadioButton.stories.js +32 -37
  51. package/es/components/RadioButton/index.js +170 -184
  52. package/es/components/Range/Range.stories.js +19 -19
  53. package/es/components/Range/index.js +35 -45
  54. package/es/components/Select/Select.stories.js +107 -128
  55. package/es/components/Select/index.js +324 -336
  56. package/es/components/SideNav/NavItem.js +112 -122
  57. package/es/components/SideNav/SideNav.stories.js +84 -57
  58. package/es/components/SideNav/index.js +161 -185
  59. package/es/components/Sidebar/Sidebar.stories.js +50 -33
  60. package/es/components/Sidebar/index.js +152 -155
  61. package/es/components/Spacer/Spacer.stories.js +35 -32
  62. package/es/components/Spacer/index.js +20 -20
  63. package/es/components/StatusDot/StatusDot.stories.js +103 -90
  64. package/es/components/StatusDot/index.js +36 -38
  65. package/es/components/StyledLink/StyledLink.stories.js +68 -69
  66. package/es/components/StyledLink/index.js +47 -48
  67. package/es/components/Table/Table.stories.js +118 -112
  68. package/es/components/Table/getExpandColumnConfig.js +67 -62
  69. package/es/components/Table/index.js +24 -27
  70. package/es/components/Table/muiStyleOverrides.js +10 -8
  71. package/es/components/Tabs/Tab.stories.js +55 -38
  72. package/es/components/Tabs/TabsContainer.stories.js +30 -22
  73. package/es/components/Tabs/index.js +95 -92
  74. package/es/components/Tag/Tag.stories.js +250 -220
  75. package/es/components/Tag/index.js +118 -190
  76. package/es/components/TextArea/TextArea.stories.js +76 -89
  77. package/es/components/TextArea/index.js +117 -115
  78. package/es/components/TextInput/TextInput.stories.js +41 -61
  79. package/es/components/TextInput/index.js +127 -171
  80. package/es/components/Toggle/Toggle.stories.js +63 -62
  81. package/es/components/Toggle/index.js +43 -77
  82. package/es/components/TreeNav/TreeNav.stories.js +7 -8
  83. package/es/components/TreeNav/index.js +72 -69
  84. package/es/components/Typography/Typography.stories.js +174 -0
  85. package/es/components/Typography/index.js +252 -308
  86. package/es/components.test.js +1 -1
  87. package/es/hooks/isVisible.js +6 -10
  88. package/es/hooks/keepInView.js +27 -32
  89. package/es/hooks/keypress.js +14 -14
  90. package/es/hooks/useInputFocus.js +5 -5
  91. package/es/hooks/usePrevious.js +3 -3
  92. package/es/systemThemeCollapsed.js +53 -53
  93. package/es/systemtheme.js +53 -53
  94. package/es/utils/selectUtil.js +1 -1
  95. package/es/utils/selectUtil.test.js +6 -6
  96. package/package.json +29 -38
@@ -1,4 +1,3 @@
1
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
1
  import { useState, useEffect } from "react";
3
2
  import { useInView } from "react-intersection-observer";
4
3
 
@@ -9,7 +8,7 @@ import { useInView } from "react-intersection-observer";
9
8
  * It may be better to allow these values to be set by the target - in that case state a nd prop changes and their effect
10
9
  * on rendering needs to be taken into account.
11
10
  */
12
- var ROOT_BOUNDS = {
11
+ const ROOT_BOUNDS = {
13
12
  top: 55,
14
13
  bottom: 100
15
14
  };
@@ -18,7 +17,7 @@ var ROOT_BOUNDS = {
18
17
  * An explicit mapping of directions to their opposites
19
18
  * This is used in oppositeDirection() to move the Popover when it leaves the viewPort
20
19
  */
21
- export var directions = {
20
+ export const directions = {
22
21
  top: "bottom",
23
22
  topRight: "bottomLeft",
24
23
  right: "left",
@@ -28,16 +27,16 @@ export var directions = {
28
27
  left: "right",
29
28
  topLeft: "bottomRight"
30
29
  };
31
- export var oppositeDirection = function oppositeDirection(direction) {
30
+ export const oppositeDirection = direction => {
32
31
  if (!direction || !directions[direction]) return "left";
33
32
  return directions[direction];
34
33
  };
35
- var isWithinRootBounds = function isWithinRootBounds(intersectionObserverEntry) {
36
- var rootBounds = intersectionObserverEntry.rootBounds;
37
- var intersectionRect = intersectionObserverEntry.intersectionRect;
34
+ const isWithinRootBounds = intersectionObserverEntry => {
35
+ const rootBounds = intersectionObserverEntry.rootBounds;
36
+ const intersectionRect = intersectionObserverEntry.intersectionRect;
38
37
  if (rootBounds && intersectionRect) {
39
- var topDiff = intersectionRect.top - rootBounds.top;
40
- var bottomDiff = rootBounds.bottom - intersectionRect.bottom;
38
+ const topDiff = intersectionRect.top - rootBounds.top;
39
+ const bottomDiff = rootBounds.bottom - intersectionRect.bottom;
41
40
  return topDiff > ROOT_BOUNDS.top && bottomDiff > ROOT_BOUNDS.bottom;
42
41
  }
43
42
  return true;
@@ -61,34 +60,30 @@ var isWithinRootBounds = function isWithinRootBounds(intersectionObserverEntry)
61
60
  * - a callback to change the direction of the component when it leaves the view port
62
61
  *
63
62
  */
64
- export var useKeepInView = function useKeepInView(_ref) {
65
- var direction = _ref.direction,
66
- _ref$shown = _ref.shown,
67
- shown = _ref$shown === void 0 ? false : _ref$shown,
68
- _ref$inViewOptions = _ref.inViewOptions,
69
- inViewOptions = _ref$inViewOptions === void 0 ? {
63
+ export const useKeepInView = _ref => {
64
+ let {
65
+ direction,
66
+ shown = false,
67
+ inViewOptions = {
70
68
  threshold: 1,
71
69
  initialInView: true,
72
70
  fallbackInView: true
73
- } : _ref$inViewOptions,
74
- callback = _ref.callback;
75
- var _useState = useState({
76
- direction: direction
77
- }),
78
- _useState2 = _slicedToArray(_useState, 1),
79
- lastDirection = _useState2[0];
80
- var _useState3 = useState(shown),
81
- _useState4 = _slicedToArray(_useState3, 2),
82
- isShown = _useState4[0],
83
- setIsShown = _useState4[1];
84
- var _useInView = useInView(inViewOptions),
85
- ref = _useInView.ref,
86
- inView = _useInView.inView,
87
- entry = _useInView.entry;
88
- useEffect(function () {
71
+ },
72
+ callback
73
+ } = _ref;
74
+ const [lastDirection] = useState({
75
+ direction
76
+ });
77
+ const [isShown, setIsShown] = useState(shown);
78
+ const {
79
+ ref,
80
+ inView,
81
+ entry
82
+ } = useInView(inViewOptions);
83
+ useEffect(() => {
89
84
  if (!inView && isShown) {
90
85
  if (isWithinRootBounds(entry)) {
91
- var newDirection = oppositeDirection(lastDirection.direction);
86
+ const newDirection = oppositeDirection(lastDirection.direction);
92
87
  callback(newDirection);
93
88
  lastDirection.direction = newDirection;
94
89
  }
@@ -1,6 +1,5 @@
1
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
1
  import { useEffect, useState } from "react";
3
- export var commonKeys = {
2
+ export const commonKeys = {
4
3
  DOWN: "Down",
5
4
  ARROW_DOWN: "ArrowDown",
6
5
  UP: "Up",
@@ -14,17 +13,16 @@ export var commonKeys = {
14
13
  ESCAPE: "Escape",
15
14
  TAB: "Tab"
16
15
  };
17
- export var useKeyPress = function useKeyPress(targetKey, callback) {
18
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
16
+ export const useKeyPress = function (targetKey, callback) {
17
+ let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
19
18
  // State for keeping track of whether key is pressed
20
- var _useState = useState(false),
21
- _useState2 = _slicedToArray(_useState, 2),
22
- keyPressed = _useState2[0],
23
- setKeyPressed = _useState2[1];
19
+ const [keyPressed, setKeyPressed] = useState(false);
24
20
 
25
21
  // If pressed key is our target key then set to true
26
- var downHandler = function downHandler(_ref) {
27
- var key = _ref.key;
22
+ const downHandler = _ref => {
23
+ let {
24
+ key
25
+ } = _ref;
28
26
  if (key === targetKey) {
29
27
  setKeyPressed(true);
30
28
  callback();
@@ -32,8 +30,10 @@ export var useKeyPress = function useKeyPress(targetKey, callback) {
32
30
  };
33
31
 
34
32
  // If released key is our target key then set to false
35
- var upHandler = function upHandler(_ref2) {
36
- var key = _ref2.key;
33
+ const upHandler = _ref2 => {
34
+ let {
35
+ key
36
+ } = _ref2;
37
37
  if (key === targetKey) {
38
38
  setKeyPressed(false);
39
39
  callback();
@@ -41,8 +41,8 @@ export var useKeyPress = function useKeyPress(targetKey, callback) {
41
41
  };
42
42
 
43
43
  // Add event listeners
44
- useEffect(function () {
45
- var removeEventListeners = function removeEventListeners() {
44
+ useEffect(() => {
45
+ const removeEventListeners = () => {
46
46
  window.removeEventListener("keydown", downHandler);
47
47
  window.removeEventListener("keyup", upHandler);
48
48
  };
@@ -1,9 +1,9 @@
1
1
  import React, { useEffect } from "react";
2
- var useInputFocus = function useInputFocus() {
3
- var ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
4
- var focus = arguments.length > 1 ? arguments[1] : undefined;
5
- var inputRef = ref || /*#__PURE__*/React.createRef();
6
- useEffect(function () {
2
+ const useInputFocus = function () {
3
+ let ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
4
+ let focus = arguments.length > 1 ? arguments[1] : undefined;
5
+ const inputRef = ref || /*#__PURE__*/React.createRef();
6
+ useEffect(() => {
7
7
  if (focus && inputRef && inputRef.current && inputRef.current.focus) {
8
8
  inputRef.current.focus();
9
9
  }
@@ -1,7 +1,7 @@
1
1
  import { useRef, useEffect } from "react";
2
- var usePrevious = function usePrevious(value) {
3
- var ref = useRef();
4
- useEffect(function () {
2
+ const usePrevious = value => {
3
+ const ref = useRef();
4
+ useEffect(() => {
5
5
  ref.current = value;
6
6
  });
7
7
  return ref.current;
@@ -1,20 +1,20 @@
1
1
  import { rgba, lighten, darken, desaturate, saturate } from "polished";
2
2
 
3
3
  // FONTS
4
- export var fonts = {
4
+ export const fonts = {
5
5
  main: '"Open Sans", -apple-system, BlinkMacSystemFont, Roboto, sans-serif'
6
6
  };
7
- export var font = fonts.main;
8
- export var fontFamilies = fonts;
9
- export var fontSizes = ["1.1rem", "1.2rem", "1.4rem", "1.6rem", "1.8rem", "2.2rem", "2.6rem", "3.0rem", "3.4rem", "4.4rem", "6rem"];
10
- export var fontWeights = [300, 400, 600];
11
- export var lineHeights = [1, 1.5, 2];
7
+ export const font = fonts.main;
8
+ export const fontFamilies = fonts;
9
+ export const fontSizes = ["1.1rem", "1.2rem", "1.4rem", "1.6rem", "1.8rem", "2.2rem", "2.6rem", "3.0rem", "3.4rem", "4.4rem", "6rem"];
10
+ export const fontWeights = [300, 400, 600];
11
+ export const lineHeights = [1, 1.5, 2];
12
12
 
13
13
  // Z-AXIS spec
14
- export var zIndices = [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 50];
14
+ export const zIndices = [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 50];
15
15
 
16
16
  // SPACING
17
- export var space = [0, "1px", "2px", "6px", "12px", "16px", "24px", "40px", "100px", "150px", "300px"];
17
+ export const space = [0, "1px", "2px", "6px", "12px", "16px", "24px", "40px", "100px", "150px", "300px"];
18
18
  space.xxs = space[1];
19
19
  space.xs = space[2];
20
20
  space.s = space[3];
@@ -27,7 +27,7 @@ space.between = "8px";
27
27
 
28
28
  // SIZES (for LAYOUT properties)
29
29
  // Half these values - Done
30
- export var sizes = [0, "1px", "2px", "4px", "8px", "12px", "16px", "32px", "64px", "128px", "256px"];
30
+ export const sizes = [0, "1px", "2px", "4px", "8px", "12px", "16px", "32px", "64px", "128px", "256px"];
31
31
  sizes.xxs = sizes[1];
32
32
  sizes.xs = sizes[2];
33
33
  sizes.s = sizes[3];
@@ -38,21 +38,21 @@ sizes.xxl = sizes[7];
38
38
  sizes.xxxl = sizes[8];
39
39
 
40
40
  // NEW ACCESSIBLE COLOUR PALETTE
41
- var black = "#000";
42
- var white = "#fff";
43
- var grey = "#90979A"; // Base grey - Mainly used for UI elements like backgrounds, muted text, icons, dividers or borders
44
- var primary = "#007ac4"; // Potential new colour: #2a5ec1. Base primary brand colour (blue) - Mainly used for buttons, links and selected states
45
- var secondary = "#8714f2"; // Change to #7211ED with new colour palette. Potential new purple colour. Introduce new secondary colour maybe purple when we re-design our colour palette
41
+ const black = "#000";
42
+ const white = "#fff";
43
+ const grey = "#90979A"; // Base grey - Mainly used for UI elements like backgrounds, muted text, icons, dividers or borders
44
+ const primary = "#007ac4"; // Potential new colour: #2a5ec1. Base primary brand colour (blue) - Mainly used for buttons, links and selected states
45
+ const secondary = "#8714f2"; // Change to #7211ED with new colour palette. Potential new purple colour. Introduce new secondary colour maybe purple when we re-design our colour palette
46
46
  //const tertiary = "#FF9E44"; // A tertiary colour for limited use. Not sure if needed.
47
- var success = "#00883b"; // Base brand success colour (green) - Mainly used to indicate success, status=good, valid, add, or save states
48
- var successDesaturated = desaturate(0.3, success); // This is because the lighter versions of success were too saturated and 'minty' coloured.
49
- var warning = "#ffb71c"; // Base brand warning colour - Mainly used to indicate warnings, slipping or near due states
50
- var warningSaturated = saturate(1, warning); // This is because the darker versions of warning were too under saturated and mustard looking.
51
- var danger = "#d90f27"; // Base brand danger/error colour - Mainly used to indicate error, status=bad, at risk or over due states
47
+ const success = "#00883b"; // Base brand success colour (green) - Mainly used to indicate success, status=good, valid, add, or save states
48
+ const successDesaturated = desaturate(0.3, success); // This is because the lighter versions of success were too saturated and 'minty' coloured.
49
+ const warning = "#ffb71c"; // Base brand warning colour - Mainly used to indicate warnings, slipping or near due states
50
+ const warningSaturated = saturate(1, warning); // This is because the darker versions of warning were too under saturated and mustard looking.
51
+ const danger = "#d90f27"; // Base brand danger/error colour - Mainly used to indicate error, status=bad, at risk or over due states
52
52
 
53
- export var colors = {
53
+ export const colors = {
54
54
  /* Greyscale */
55
- black: black,
55
+ black,
56
56
  black90: rgba(black, 0.9),
57
57
  black80: rgba(black, 0.8),
58
58
  black70: rgba(black, 0.7),
@@ -62,7 +62,7 @@ export var colors = {
62
62
  black30: rgba(black, 0.3),
63
63
  black20: rgba(black, 0.2),
64
64
  black10: rgba(black, 0.1),
65
- white: white,
65
+ white,
66
66
  white90: rgba(white, 0.9),
67
67
  white80: rgba(white, 0.8),
68
68
  white70: rgba(white, 0.7),
@@ -72,7 +72,7 @@ export var colors = {
72
72
  white30: rgba(white, 0.3),
73
73
  white20: rgba(white, 0.2),
74
74
  white10: rgba(white, 0.1),
75
- grey: grey,
75
+ grey,
76
76
  greyLight: lighten(0.2, grey),
77
77
  greyLighter: lighten(0.3, grey),
78
78
  greyLightest: lighten(0.35, grey),
@@ -80,7 +80,7 @@ export var colors = {
80
80
  greyDarker: darken(0.3, grey),
81
81
  greyDarkest: darken(0.4, grey),
82
82
  /* Colours */
83
- primary: primary,
83
+ primary,
84
84
  primaryLight: lighten(0.2, primary),
85
85
  primaryLighter: lighten(0.35, primary),
86
86
  primaryLightest: lighten(0.55, primary),
@@ -96,7 +96,7 @@ export var colors = {
96
96
  primary70: rgba(primary, 0.7),
97
97
  primary80: rgba(primary, 0.8),
98
98
  primary90: rgba(primary, 0.9),
99
- secondary: secondary,
99
+ secondary,
100
100
  secondaryLight: lighten(0.1, secondary),
101
101
  secondaryLighter: lighten(0.2, secondary),
102
102
  secondaryLightest: lighten(0.35, secondary),
@@ -129,7 +129,7 @@ export var colors = {
129
129
  // tertiary70: rgba(tertiary, 0.7),
130
130
  // tertiary80: rgba(tertiary, 0.8),
131
131
  // tertiary90: rgba(tertiary, 0.9),
132
- success: success,
132
+ success,
133
133
  // successLight: lighten(0.11, success),
134
134
  // successLighter: lighten(0.25, success),
135
135
  // successLightest: lighten(0.35, success),
@@ -149,7 +149,7 @@ export var colors = {
149
149
  success70: rgba(success, 0.7),
150
150
  success80: rgba(success, 0.8),
151
151
  success90: rgba(success, 0.9),
152
- warning: warning,
152
+ warning,
153
153
  warningLight: lighten(0.15, warning),
154
154
  warningLighter: lighten(0.25, warning),
155
155
  warningLightest: lighten(0.4, warning),
@@ -165,7 +165,7 @@ export var colors = {
165
165
  warning70: rgba(warning, 0.7),
166
166
  warning80: rgba(warning, 0.8),
167
167
  warning90: rgba(warning, 0.9),
168
- danger: danger,
168
+ danger,
169
169
  dangerLight: lighten(0.1, danger),
170
170
  dangerLighter: lighten(0.2, danger),
171
171
  dangerLightest: lighten(0.35, danger),
@@ -184,24 +184,24 @@ export var colors = {
184
184
  };
185
185
 
186
186
  // BORDERS
187
- export var radii = [0, "3px", "6px"];
188
- export var borderWidths = [0, "1px", "2px", "3px"];
187
+ export const radii = [0, "3px", "6px"];
188
+ export const borderWidths = [0, "1px", "2px", "3px"];
189
189
 
190
190
  // SHADOWS
191
- export var shadows = {
191
+ export const shadows = {
192
192
  boxDefault: "0 2px 5px 0 ".concat(colors.black10),
193
193
  thinOutline: "0 0 0 1px",
194
194
  thickOutline: "0 0 0 3px"
195
195
  };
196
196
 
197
197
  // ANIMATION
198
- export var transition = {
198
+ export const transition = {
199
199
  transitionDefault: "all 200ms ease-in-out"
200
200
  };
201
201
 
202
202
  // RESPONSIVE MEDIA BREAKPOINTS
203
- export var breakpoints = ["450px", "675px", "900px", "1100px", "1400px", "1900px"];
204
- export var mediaQueries = {
203
+ export const breakpoints = ["450px", "675px", "900px", "1100px", "1400px", "1900px"];
204
+ export const mediaQueries = {
205
205
  screenXS: "@media screen and (min-width: ".concat(breakpoints[0], ")"),
206
206
  screenS: "@media screen and (min-width: ".concat(breakpoints[1], ")"),
207
207
  screenM: "@media screen and (min-width: ".concat(breakpoints[2], ")"),
@@ -212,7 +212,7 @@ export var mediaQueries = {
212
212
 
213
213
  // APP-SPECIFIC DIMENSIONS
214
214
 
215
- export var appScale = {
215
+ export const appScale = {
216
216
  navBarSize: "50px",
217
217
  sidebarMaxWidth: "360px",
218
218
  sidebarMaxWidthLarge: "450px",
@@ -224,7 +224,7 @@ export var appScale = {
224
224
  inputHeightDefault: "32px",
225
225
  inputHeightLarge: "52px"
226
226
  };
227
- export var tagScale = {
227
+ export const tagScale = {
228
228
  tagHeightDefault: "22px",
229
229
  tagHeightSmall: "18px",
230
230
  tagPaddingDefault: "0 8px",
@@ -237,21 +237,21 @@ export var tagScale = {
237
237
  tagAvatarFontSizeSmall: "0.7rem"
238
238
  };
239
239
  export default {
240
- fonts: fonts,
241
- font: font,
242
- fontFamilies: fontFamilies,
243
- fontSizes: fontSizes,
244
- fontWeights: fontWeights,
245
- lineHeights: lineHeights,
246
- radii: radii,
247
- borderWidths: borderWidths,
248
- space: space,
249
- sizes: sizes,
250
- shadows: shadows,
251
- colors: colors,
252
- breakpoints: breakpoints,
253
- transition: transition,
254
- zIndices: zIndices,
255
- appScale: appScale,
256
- tagScale: tagScale
240
+ fonts,
241
+ font,
242
+ fontFamilies,
243
+ fontSizes,
244
+ fontWeights,
245
+ lineHeights,
246
+ radii,
247
+ borderWidths,
248
+ space,
249
+ sizes,
250
+ shadows,
251
+ colors,
252
+ breakpoints,
253
+ transition,
254
+ zIndices,
255
+ appScale,
256
+ tagScale
257
257
  };
package/es/systemtheme.js CHANGED
@@ -1,20 +1,20 @@
1
1
  import { rgba, lighten, darken, desaturate, saturate } from "polished";
2
2
 
3
3
  // FONTS
4
- export var fonts = {
4
+ export const fonts = {
5
5
  main: '"Open Sans", -apple-system, BlinkMacSystemFont, Roboto, sans-serif'
6
6
  };
7
- export var font = fonts.main;
8
- export var fontFamilies = fonts;
9
- export var fontSizes = ["1.2rem", "1.4rem", "1.6rem", "1.8rem", "2.0rem", "2.4rem", "2.8rem", "3.2rem", "3.6rem", "4.8rem", "6.4rem"];
10
- export var fontWeights = [300, 400, 600];
11
- export var lineHeights = [1, 1.5, 2];
7
+ export const font = fonts.main;
8
+ export const fontFamilies = fonts;
9
+ export const fontSizes = ["1.2rem", "1.4rem", "1.6rem", "1.8rem", "2.0rem", "2.4rem", "2.8rem", "3.2rem", "3.6rem", "4.8rem", "6.4rem"];
10
+ export const fontWeights = [300, 400, 600];
11
+ export const lineHeights = [1, 1.5, 2];
12
12
 
13
13
  // Z-AXIS spec
14
- export var zIndices = [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 50];
14
+ export const zIndices = [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 50];
15
15
 
16
16
  // SPACING
17
- export var space = [0, "2px", "4px", "8px", "16px", "24px", "32px", "64px", "128px", "256px", "512px"];
17
+ export const space = [0, "2px", "4px", "8px", "16px", "24px", "32px", "64px", "128px", "256px", "512px"];
18
18
  space.xxs = space[1];
19
19
  space.xs = space[2];
20
20
  space.s = space[3];
@@ -26,7 +26,7 @@ space.xxxl = space[8];
26
26
  space.between = "10px";
27
27
 
28
28
  // SIZES (for LAYOUT properties)
29
- export var sizes = [0, "2px", "4px", "8px", "16px", "24px", "32px", "64px", "128px", "256px", "512px"];
29
+ export const sizes = [0, "2px", "4px", "8px", "16px", "24px", "32px", "64px", "128px", "256px", "512px"];
30
30
  sizes.xxs = sizes[1];
31
31
  sizes.xs = sizes[2];
32
32
  sizes.s = sizes[3];
@@ -37,21 +37,21 @@ sizes.xxl = sizes[7];
37
37
  sizes.xxxl = sizes[8];
38
38
 
39
39
  // NEW ACCESSIBLE COLOUR PALETTE
40
- var black = "#000";
41
- var white = "#fff";
42
- var grey = "#90979A"; // Base grey - Mainly used for UI elements like backgrounds, muted text, icons, dividers or borders
43
- var primary = "#007BC7"; // Potential new colour: #2a5ec1. Base primary brand colour (blue) - Mainly used for buttons, links and selected states
44
- var secondary = "#8714f2"; // Change to #7211ED with new colour palette. Potential new purple colour. Introduce new secondary colour maybe purple when we re-design our colour palette
40
+ const black = "#000";
41
+ const white = "#fff";
42
+ const grey = "#90979A"; // Base grey - Mainly used for UI elements like backgrounds, muted text, icons, dividers or borders
43
+ const primary = "#007BC7"; // Potential new colour: #2a5ec1. Base primary brand colour (blue) - Mainly used for buttons, links and selected states
44
+ const secondary = "#8714f2"; // Change to #7211ED with new colour palette. Potential new purple colour. Introduce new secondary colour maybe purple when we re-design our colour palette
45
45
  //const tertiary = "#FF9E44"; // A tertiary colour for limited use. Not sure if needed.
46
- var success = "#00883b"; // Base brand success colour (green) - Mainly used to indicate success, status=good, valid, add, or save states
47
- var successDesaturated = desaturate(0.3, success); // This is because the lighter versions of success were too saturated and 'minty' coloured.
48
- var warning = "#ffb71c"; // Base brand warning colour - Mainly used to indicate warnings, slipping or near due states
49
- var warningSaturated = saturate(1, warning); // This is because the darker versions of warning were too under saturated and mustard looking.
50
- var danger = "#d90f27"; // Base brand danger/error colour - Mainly used to indicate error, status=bad, at risk or over due states
46
+ const success = "#00883b"; // Base brand success colour (green) - Mainly used to indicate success, status=good, valid, add, or save states
47
+ const successDesaturated = desaturate(0.3, success); // This is because the lighter versions of success were too saturated and 'minty' coloured.
48
+ const warning = "#ffb71c"; // Base brand warning colour - Mainly used to indicate warnings, slipping or near due states
49
+ const warningSaturated = saturate(1, warning); // This is because the darker versions of warning were too under saturated and mustard looking.
50
+ const danger = "#d90f27"; // Base brand danger/error colour - Mainly used to indicate error, status=bad, at risk or over due states
51
51
 
52
- export var colors = {
52
+ export const colors = {
53
53
  /* Greyscale */
54
- black: black,
54
+ black,
55
55
  black90: rgba(black, 0.9),
56
56
  black80: rgba(black, 0.8),
57
57
  black70: rgba(black, 0.7),
@@ -61,7 +61,7 @@ export var colors = {
61
61
  black30: rgba(black, 0.3),
62
62
  black20: rgba(black, 0.2),
63
63
  black10: rgba(black, 0.1),
64
- white: white,
64
+ white,
65
65
  white90: rgba(white, 0.9),
66
66
  white80: rgba(white, 0.8),
67
67
  white70: rgba(white, 0.7),
@@ -71,7 +71,7 @@ export var colors = {
71
71
  white30: rgba(white, 0.3),
72
72
  white20: rgba(white, 0.2),
73
73
  white10: rgba(white, 0.1),
74
- grey: grey,
74
+ grey,
75
75
  greyLight: lighten(0.2, grey),
76
76
  greyLighter: lighten(0.3, grey),
77
77
  greyLightest: lighten(0.35, grey),
@@ -79,7 +79,7 @@ export var colors = {
79
79
  greyDarker: darken(0.3, grey),
80
80
  greyDarkest: darken(0.4, grey),
81
81
  /* Colours */
82
- primary: primary,
82
+ primary,
83
83
  primaryLight: lighten(0.2, primary),
84
84
  primaryLighter: lighten(0.45, primary),
85
85
  primaryLightest: lighten(0.55, primary),
@@ -95,7 +95,7 @@ export var colors = {
95
95
  primary70: rgba(primary, 0.7),
96
96
  primary80: rgba(primary, 0.8),
97
97
  primary90: rgba(primary, 0.9),
98
- secondary: secondary,
98
+ secondary,
99
99
  secondaryLight: lighten(0.1, secondary),
100
100
  secondaryLighter: lighten(0.2, secondary),
101
101
  secondaryLightest: lighten(0.35, secondary),
@@ -128,7 +128,7 @@ export var colors = {
128
128
  // tertiary70: rgba(tertiary, 0.7),
129
129
  // tertiary80: rgba(tertiary, 0.8),
130
130
  // tertiary90: rgba(tertiary, 0.9),
131
- success: success,
131
+ success,
132
132
  // successLight: lighten(0.11, success),
133
133
  // successLighter: lighten(0.25, success),
134
134
  // successLightest: lighten(0.35, success),
@@ -148,7 +148,7 @@ export var colors = {
148
148
  success70: rgba(success, 0.7),
149
149
  success80: rgba(success, 0.8),
150
150
  success90: rgba(success, 0.9),
151
- warning: warning,
151
+ warning,
152
152
  warningLight: lighten(0.15, warningSaturated),
153
153
  warningLighter: lighten(0.25, warningSaturated),
154
154
  warningLightest: lighten(0.4, warningSaturated),
@@ -164,7 +164,7 @@ export var colors = {
164
164
  warning70: rgba(warning, 0.7),
165
165
  warning80: rgba(warning, 0.8),
166
166
  warning90: rgba(warning, 0.9),
167
- danger: danger,
167
+ danger,
168
168
  dangerLight: lighten(0.1, danger),
169
169
  dangerLighter: lighten(0.2, danger),
170
170
  dangerLightest: lighten(0.35, danger),
@@ -183,24 +183,24 @@ export var colors = {
183
183
  };
184
184
 
185
185
  // BORDERS
186
- export var radii = [0, "3px", "6px"];
187
- export var borderWidths = [0, "1px", "2px", "3px"];
186
+ export const radii = [0, "3px", "6px"];
187
+ export const borderWidths = [0, "1px", "2px", "3px"];
188
188
 
189
189
  // SHADOWS
190
- export var shadows = {
190
+ export const shadows = {
191
191
  boxDefault: "0 2px 5px 0 ".concat(colors.black10),
192
192
  thinOutline: "0 0 0 1px",
193
193
  thickOutline: "0 0 0 3px"
194
194
  };
195
195
 
196
196
  // ANIMATION
197
- export var transition = {
197
+ export const transition = {
198
198
  transitionDefault: "all 200ms ease-in-out"
199
199
  };
200
200
 
201
201
  // RESPONSIVE MEDIA BREAKPOINTS
202
- export var breakpoints = ["450px", "675px", "900px", "1100px", "1400px", "1900px"];
203
- export var mediaQueries = {
202
+ export const breakpoints = ["450px", "675px", "900px", "1100px", "1400px", "1900px"];
203
+ export const mediaQueries = {
204
204
  screenXS: "@media screen and (min-width: ".concat(breakpoints[0], ")"),
205
205
  screenS: "@media screen and (min-width: ".concat(breakpoints[1], ")"),
206
206
  screenM: "@media screen and (min-width: ".concat(breakpoints[2], ")"),
@@ -211,7 +211,7 @@ export var mediaQueries = {
211
211
 
212
212
  // APP-SPECIFIC DIMENSIONS
213
213
 
214
- export var appScale = {
214
+ export const appScale = {
215
215
  navBarSize: "54px",
216
216
  sidebarMaxWidth: "360px",
217
217
  sidebarMaxWidthLarge: "550px",
@@ -223,7 +223,7 @@ export var appScale = {
223
223
  inputHeightDefault: "38px",
224
224
  inputHeightLarge: "58px"
225
225
  };
226
- export var tagScale = {
226
+ export const tagScale = {
227
227
  tagHeightDefault: "28px",
228
228
  tagHeightSmall: "24px",
229
229
  tagPaddingDefault: "0 10px",
@@ -236,21 +236,21 @@ export var tagScale = {
236
236
  tagAvatarFontSizeSmall: "0.8rem"
237
237
  };
238
238
  export default {
239
- fonts: fonts,
240
- font: font,
241
- fontFamilies: fontFamilies,
242
- fontSizes: fontSizes,
243
- fontWeights: fontWeights,
244
- lineHeights: lineHeights,
245
- radii: radii,
246
- borderWidths: borderWidths,
247
- space: space,
248
- sizes: sizes,
249
- shadows: shadows,
250
- colors: colors,
251
- breakpoints: breakpoints,
252
- transition: transition,
253
- zIndices: zIndices,
254
- appScale: appScale,
255
- tagScale: tagScale
239
+ fonts,
240
+ font,
241
+ fontFamilies,
242
+ fontSizes,
243
+ fontWeights,
244
+ lineHeights,
245
+ radii,
246
+ borderWidths,
247
+ space,
248
+ sizes,
249
+ shadows,
250
+ colors,
251
+ breakpoints,
252
+ transition,
253
+ zIndices,
254
+ appScale,
255
+ tagScale
256
256
  };
@@ -1,5 +1,5 @@
1
1
  import { find } from "lodash";
2
- export var getOptionByValue = function getOptionByValue(options, value) {
2
+ export const getOptionByValue = (options, value) => {
3
3
  return find(options, ["value", value]);
4
4
  };
5
5
  export default getOptionByValue;
@@ -1,18 +1,18 @@
1
1
  import { getOptionByValue } from "./selectUtil";
2
- describe("get option by value", function () {
3
- var options = [{
2
+ describe("get option by value", () => {
3
+ const options = [{
4
4
  label: "1",
5
5
  value: "abc"
6
6
  }, {
7
7
  label: "2",
8
8
  value: "def"
9
9
  }];
10
- test("return option from value", function () {
11
- var option = getOptionByValue(options, "def");
10
+ test("return option from value", () => {
11
+ const option = getOptionByValue(options, "def");
12
12
  expect(option).toBe(options[1]);
13
13
  });
14
- test("return nothing if value not found", function () {
15
- var option = getOptionByValue(options, "xyz");
14
+ test("return nothing if value not found", () => {
15
+ const option = getOptionByValue(options, "xyz");
16
16
  expect(option).toBe(undefined);
17
17
  });
18
18
  });