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
@@ -2,64 +2,61 @@ import React from "react";
2
2
  import Divider from ".";
3
3
  import Spacer from "../Spacer";
4
4
  import Box from "../Box";
5
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
6
  export default {
6
7
  title: "Components/Divider",
7
8
  component: Divider
8
9
  };
9
- export var defaultDivider = function defaultDivider() {
10
- return /*#__PURE__*/React.createElement(Spacer, {
11
- my: "r"
12
- }, /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement(Divider, {
10
+ export const defaultDivider = () => /*#__PURE__*/_jsxs(Spacer, {
11
+ my: "r",
12
+ children: [/*#__PURE__*/_jsx(Divider, {}), /*#__PURE__*/_jsx(Divider, {
13
13
  light: true
14
- }), /*#__PURE__*/React.createElement(Divider, {
14
+ }), /*#__PURE__*/_jsx(Divider, {
15
15
  thick: true
16
- }), /*#__PURE__*/React.createElement(Divider, {
16
+ }), /*#__PURE__*/_jsx(Divider, {
17
17
  light: true,
18
18
  thick: true
19
- }));
20
- };
21
- export var dashDivider = function dashDivider() {
22
- return /*#__PURE__*/React.createElement(Spacer, {
23
- my: "r"
24
- }, /*#__PURE__*/React.createElement(Divider, {
19
+ })]
20
+ });
21
+ export const dashDivider = () => /*#__PURE__*/_jsxs(Spacer, {
22
+ my: "r",
23
+ children: [/*#__PURE__*/_jsx(Divider, {
25
24
  dash: true
26
- }), /*#__PURE__*/React.createElement(Divider, {
25
+ }), /*#__PURE__*/_jsx(Divider, {
27
26
  light: true,
28
27
  dash: true
29
- }), /*#__PURE__*/React.createElement(Divider, {
28
+ }), /*#__PURE__*/_jsx(Divider, {
30
29
  thick: true,
31
30
  dash: true
32
- }), /*#__PURE__*/React.createElement(Divider, {
31
+ }), /*#__PURE__*/_jsx(Divider, {
33
32
  light: true,
34
33
  thick: true,
35
34
  dash: true
36
- }));
37
- };
38
- export var invertedDivider = function invertedDivider() {
39
- return /*#__PURE__*/React.createElement(Box, {
40
- bg: "greyDarkest",
41
- p: "5"
42
- }, /*#__PURE__*/React.createElement(Spacer, {
43
- my: "r"
44
- }, /*#__PURE__*/React.createElement(Divider, {
45
- inverted: true
46
- }), /*#__PURE__*/React.createElement(Divider, {
47
- inverted: true,
48
- thick: true
49
- }), /*#__PURE__*/React.createElement(Divider, {
50
- inverted: true,
51
- dash: true
52
- }), /*#__PURE__*/React.createElement(Divider, {
53
- inverted: true,
54
- thick: true,
55
- dash: true
56
- })));
57
- };
58
- export var spanGrid = function spanGrid() {
59
- return /*#__PURE__*/React.createElement(Divider, {
60
- spanGrid: true
61
- });
62
- };
35
+ })]
36
+ });
37
+ export const invertedDivider = () => /*#__PURE__*/_jsx(Box, {
38
+ bg: "greyDarkest",
39
+ p: "5",
40
+ children: /*#__PURE__*/_jsxs(Spacer, {
41
+ my: "r",
42
+ children: [/*#__PURE__*/_jsx(Divider, {
43
+ inverted: true
44
+ }), /*#__PURE__*/_jsx(Divider, {
45
+ inverted: true,
46
+ thick: true
47
+ }), /*#__PURE__*/_jsx(Divider, {
48
+ inverted: true,
49
+ dash: true
50
+ }), /*#__PURE__*/_jsx(Divider, {
51
+ inverted: true,
52
+ thick: true,
53
+ dash: true
54
+ })]
55
+ })
56
+ });
57
+ export const spanGrid = () => /*#__PURE__*/_jsx(Divider, {
58
+ spanGrid: true
59
+ });
63
60
  defaultDivider.__docgenInfo = {
64
61
  "description": "",
65
62
  "methods": [],
@@ -1,44 +1,38 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["light", "thick", "dash", "inverted", "spanGrid", "theme"];
4
1
  import React from "react";
5
2
  import styled, { ThemeProvider } from "styled-components";
6
3
  import PropTypes from "prop-types";
7
4
  import { space, layout, color } from "styled-system";
8
5
  import { themeGet } from "@styled-system/theme-get";
9
6
  import shouldForwardProp from "@styled-system/should-forward-prop";
10
- var Item = styled.div.withConfig({
11
- shouldForwardProp: shouldForwardProp
7
+ import { jsx as _jsx } from "react/jsx-runtime";
8
+ const Item = styled.div.withConfig({
9
+ shouldForwardProp
12
10
  }).withConfig({
13
11
  displayName: "Divider__Item",
14
12
  componentId: "sc-106mlj-0"
15
- })(["", " ", " ", " display:block;width:100%;height:", ";grid-column:", ";border-bottom:", ";background-color:", ";"], space, layout, color, function (props) {
16
- return props.thick ? "3px" : "1px";
17
- }, function (props) {
18
- return props.spanGrid ? "1 / -1" : "auto";
19
- }, function (props) {
20
- return props.dash && props.thick && props.light ? "dashed 3px ".concat(themeGet("colors.black10")(props)) : props.dash && props.thick && props.inverted ? "dashed 3px ".concat(themeGet("colors.white20")(props)) : props.dash && props.inverted ? "dashed 1px ".concat(themeGet("colors.white20")(props)) : props.dash && props.light ? "dashed 1px ".concat(themeGet("colors.black10")(props)) : props.dash && props.thick ? "dashed 3px ".concat(themeGet("colors.black20")(props)) : props.dash ? "dashed 1px ".concat(themeGet("colors.black20")(props)) : "none";
21
- }, function (props) {
22
- return props.dash ? "transparent" : props.inverted ? themeGet("colors.white20")(props) : props.light ? themeGet("colors.black10")(props) : themeGet("colors.black20")(props);
23
- });
13
+ })(["", " ", " ", " display:block;width:100%;height:", ";grid-column:", ";border-bottom:", ";background-color:", ";"], space, layout, color, props => props.thick ? "3px" : "1px", props => props.spanGrid ? "1 / -1" : "auto", props => props.dash && props.thick && props.light ? "dashed 3px ".concat(themeGet("colors.black10")(props)) : props.dash && props.thick && props.inverted ? "dashed 3px ".concat(themeGet("colors.white20")(props)) : props.dash && props.inverted ? "dashed 1px ".concat(themeGet("colors.white20")(props)) : props.dash && props.light ? "dashed 1px ".concat(themeGet("colors.black10")(props)) : props.dash && props.thick ? "dashed 3px ".concat(themeGet("colors.black20")(props)) : props.dash ? "dashed 1px ".concat(themeGet("colors.black20")(props)) : "none", props => props.dash ? "transparent" : props.inverted ? themeGet("colors.white20")(props) : props.light ? themeGet("colors.black10")(props) : themeGet("colors.black20")(props));
24
14
  export default function Divider(_ref) {
25
- var light = _ref.light,
26
- thick = _ref.thick,
27
- dash = _ref.dash,
28
- inverted = _ref.inverted,
29
- spanGrid = _ref.spanGrid,
30
- theme = _ref.theme,
31
- props = _objectWithoutProperties(_ref, _excluded);
32
- var component = /*#__PURE__*/React.createElement(Item, _extends({
15
+ let {
16
+ light,
17
+ thick,
18
+ dash,
19
+ inverted,
20
+ spanGrid,
21
+ theme,
22
+ ...props
23
+ } = _ref;
24
+ const component = /*#__PURE__*/_jsx(Item, {
33
25
  light: light,
34
26
  thick: thick,
35
27
  dash: dash,
36
28
  inverted: inverted,
37
- spanGrid: spanGrid
38
- }, props));
39
- return theme ? /*#__PURE__*/React.createElement(ThemeProvider, {
40
- theme: theme
41
- }, component) : component;
29
+ spanGrid: spanGrid,
30
+ ...props
31
+ });
32
+ return theme ? /*#__PURE__*/_jsx(ThemeProvider, {
33
+ theme: theme,
34
+ children: component
35
+ }) : component;
42
36
  }
43
37
  Divider.propTypes = {
44
38
  /** Divider will use a lighter grey colour */
@@ -2,51 +2,61 @@ import React from "react";
2
2
  import Expandable from ".";
3
3
  import Typography from "../Typography";
4
4
  import Box from "../Box";
5
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
5
6
  export default {
6
7
  title: "Components/Expandable",
7
- decorators: [function (storyFn) {
8
- return /*#__PURE__*/React.createElement(Box, {
9
- height: "300px"
10
- }, storyFn());
11
- }],
8
+ decorators: [storyFn => /*#__PURE__*/_jsx(Box, {
9
+ height: "300px",
10
+ children: storyFn()
11
+ })],
12
12
  component: Expandable
13
13
  };
14
- export var defaultExpandable = function defaultExpandable() {
15
- return /*#__PURE__*/React.createElement(Expandable, {
16
- title: "Details"
17
- }, /*#__PURE__*/React.createElement(Typography.P, null, "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem."));
18
- };
19
- export var openExpandable = function openExpandable() {
20
- return /*#__PURE__*/React.createElement(Expandable, {
21
- isOpen: true,
22
- title: "Details"
23
- }, /*#__PURE__*/React.createElement(Typography.P, null, "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem."));
24
- };
25
- export var expandableWithSubtitle = function expandableWithSubtitle() {
26
- return /*#__PURE__*/React.createElement(Expandable, {
27
- title: "Complex example",
28
- subtitle: "Subtitle"
29
- }, /*#__PURE__*/React.createElement(Typography.P, null, "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem."));
30
- };
31
- export var expandableWithBadge = function expandableWithBadge() {
32
- return /*#__PURE__*/React.createElement(Expandable, {
33
- title: "Complex example",
34
- badge: "status",
35
- badgeColour: "success"
36
- }, /*#__PURE__*/React.createElement(Typography.P, null, "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem."));
37
- };
38
- export var expandableSmall = function expandableSmall() {
39
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Expandable, {
14
+ export const defaultExpandable = () => /*#__PURE__*/_jsx(Expandable, {
15
+ title: "Details",
16
+ children: /*#__PURE__*/_jsx(Typography.P, {
17
+ children: "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem."
18
+ })
19
+ });
20
+ export const openExpandable = () => /*#__PURE__*/_jsx(Expandable, {
21
+ isOpen: true,
22
+ title: "Details",
23
+ children: /*#__PURE__*/_jsx(Typography.P, {
24
+ children: "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem."
25
+ })
26
+ });
27
+ export const expandableWithSubtitle = () => /*#__PURE__*/_jsx(Expandable, {
28
+ title: "Complex example",
29
+ subtitle: "Subtitle",
30
+ children: /*#__PURE__*/_jsx(Typography.P, {
31
+ children: "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem."
32
+ })
33
+ });
34
+ export const expandableWithBadge = () => /*#__PURE__*/_jsx(Expandable, {
35
+ title: "Complex example",
36
+ badge: "status",
37
+ badgeColour: "success",
38
+ children: /*#__PURE__*/_jsx(Typography.P, {
39
+ children: "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem."
40
+ })
41
+ });
42
+ export const expandableSmall = () => /*#__PURE__*/_jsxs(_Fragment, {
43
+ children: [/*#__PURE__*/_jsx(Expandable, {
40
44
  small: true,
41
- title: "Small example"
42
- }, /*#__PURE__*/React.createElement(Typography.P, null, "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem.")), /*#__PURE__*/React.createElement(Expandable, {
45
+ title: "Small example",
46
+ children: /*#__PURE__*/_jsx(Typography.P, {
47
+ children: "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem."
48
+ })
49
+ }), /*#__PURE__*/_jsx(Expandable, {
43
50
  small: true,
44
51
  title: "Small complex example",
45
52
  subtitle: "Subtitle",
46
53
  badge: "status",
47
- badgeColour: "success"
48
- }, /*#__PURE__*/React.createElement(Typography.P, null, "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem.")));
49
- };
54
+ badgeColour: "success",
55
+ children: /*#__PURE__*/_jsx(Typography.P, {
56
+ children: "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem."
57
+ })
58
+ })]
59
+ });
50
60
  defaultExpandable.__docgenInfo = {
51
61
  "description": "",
52
62
  "methods": [],
@@ -1,6 +1,3 @@
1
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["children", "title", "subtitle", "badge", "badgeColour", "isOpen", "small", "theme"];
4
1
  import React, { useMemo, useState } from "react";
5
2
  import styled, { ThemeProvider } from "styled-components";
6
3
  import PropTypes from "prop-types";
@@ -8,60 +5,27 @@ import Flex from "../Flex";
8
5
  import Typography from "../Typography";
9
6
  import Badge from "../Badge";
10
7
  import { themeGet } from "@styled-system/theme-get";
11
- var Item = styled.div.withConfig({
8
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
+ const Item = styled.div.withConfig({
12
10
  displayName: "Expandable__Item",
13
11
  componentId: "sc-na4gdb-0"
14
12
  })(["margin:4px 0;"]);
15
- var Button = styled.button.withConfig({
13
+ const Button = styled.button.withConfig({
16
14
  displayName: "Expandable__Button",
17
15
  componentId: "sc-na4gdb-1"
18
- })(["position:relative;display:block;border:none;-moz-appearance:none;-webkit-appearance:none;appearance:none;box-shadow:none;font-family:\"Open Sans\",\"Helvetica Neue\",Helvetica,Arial,sans-serif;cursor:pointer;width:100%;margin:0;font-size:", ";text-align:left;color:", ";padding:", ";}border-left:solid 3px ", ";border-radius:", ";background:", ";transition:", ";&:hover{background:", ";border-left:solid 3px ", ";}&:focus{outline:0;border-left:solid 3px ", ";}&:after,&:before{content:\"\";position:absolute;top:50%;transform:translateY(-50%);width:2px;height:12px;right:", ";background-color:", ";transition:", ";}&:before{transform:", ";}&:after{transform:translateY(-50%) rotate(90deg);}"], function (props) {
19
- return themeGet("fontSizes.3")(props);
20
- }, function (props) {
21
- return themeGet("colors.greyDarker")(props);
22
- }, function (props) {
23
- return props.small ? "8px 33px 8px 8px" : "18px 48px 18px 16px";
24
- }, function (props) {
25
- return themeGet("colors.greyLightest")(props);
26
- }, function (props) {
27
- return themeGet("radii.1")(props);
28
- }, function (props) {
29
- return themeGet("colors.greyLightest")(props);
30
- }, function (props) {
31
- return themeGet("transition.transitionDefault")(props);
32
- }, function (props) {
33
- return themeGet("colors.greyLighter")(props);
34
- }, function (props) {
35
- return themeGet("colors.greyLighter")(props);
36
- }, function (props) {
37
- return themeGet("colors.primary")(props);
38
- }, function (props) {
39
- return props.small ? "16px" : "24px";
40
- }, function (props) {
41
- return themeGet("colors.greyDark")(props);
42
- }, function (props) {
43
- return themeGet("transition.transitionDefault")(props);
44
- }, function (props) {
45
- return props.open ? "translateY(-50%) rotate(90deg)" : "translateY(-50%)";
46
- });
47
- var Text = styled.div.withConfig({
16
+ })(["position:relative;display:block;border:none;-moz-appearance:none;-webkit-appearance:none;appearance:none;box-shadow:none;font-family:\"Open Sans\",\"Helvetica Neue\",Helvetica,Arial,sans-serif;cursor:pointer;width:100%;margin:0;font-size:", ";text-align:left;color:", ";padding:", ";}border-left:solid 3px ", ";border-radius:", ";background:", ";transition:", ";&:hover{background:", ";border-left:solid 3px ", ";}&:focus{outline:0;border-left:solid 3px ", ";}&:after,&:before{content:\"\";position:absolute;top:50%;transform:translateY(-50%);width:2px;height:12px;right:", ";background-color:", ";transition:", ";}&:before{transform:", ";}&:after{transform:translateY(-50%) rotate(90deg);}"], props => themeGet("fontSizes.3")(props), props => themeGet("colors.greyDarker")(props), props => props.small ? "8px 33px 8px 8px" : "18px 48px 18px 16px", props => themeGet("colors.greyLightest")(props), props => themeGet("radii.1")(props), props => themeGet("colors.greyLightest")(props), props => themeGet("transition.transitionDefault")(props), props => themeGet("colors.greyLighter")(props), props => themeGet("colors.greyLighter")(props), props => themeGet("colors.primary")(props), props => props.small ? "16px" : "24px", props => themeGet("colors.greyDark")(props), props => themeGet("transition.transitionDefault")(props), props => props.open ? "translateY(-50%) rotate(90deg)" : "translateY(-50%)");
17
+ const Text = styled.div.withConfig({
48
18
  displayName: "Expandable__Text",
49
19
  componentId: "sc-na4gdb-2"
50
20
  })(["padding-right:18px;"]);
51
- var SubTitle = styled(Typography.Small).withConfig({
21
+ const SubTitle = styled(Typography.Small).withConfig({
52
22
  displayName: "Expandable__SubTitle",
53
23
  componentId: "sc-na4gdb-3"
54
24
  })(["display:block;"]);
55
- var Content = styled.div.withConfig({
25
+ const Content = styled.div.withConfig({
56
26
  displayName: "Expandable__Content",
57
27
  componentId: "sc-na4gdb-4"
58
- })(["padding:", ";transition:", ";display:", ";"], function (props) {
59
- return themeGet("space.r")(props);
60
- }, function (props) {
61
- return themeGet("transition.transitionDefault")(props);
62
- }, function (props) {
63
- return props.open ? "block" : "none";
64
- });
28
+ })(["padding:", ";transition:", ";display:", ";"], props => themeGet("space.r")(props), props => themeGet("transition.transitionDefault")(props), props => props.open ? "block" : "none");
65
29
 
66
30
  /**
67
31
  * This component is to be used when there is a lot of content to present on a page that can instead be split into expandable sections to aid in user comprehension and explorability, rather than overwhelming the user with a whole page of content.
@@ -72,49 +36,58 @@ var Content = styled.div.withConfig({
72
36
  */
73
37
 
74
38
  export default function Expandable(_ref) {
75
- var children = _ref.children,
76
- title = _ref.title,
77
- subtitle = _ref.subtitle,
78
- badge = _ref.badge,
79
- badgeColour = _ref.badgeColour,
80
- isOpen = _ref.isOpen,
81
- small = _ref.small,
82
- theme = _ref.theme,
83
- props = _objectWithoutProperties(_ref, _excluded);
84
- var _useState = useState(isOpen),
85
- _useState2 = _slicedToArray(_useState, 2),
86
- baseState = _useState2[0],
87
- setBase = _useState2[1];
88
- var _useState3 = useState(false),
89
- _useState4 = _slicedToArray(_useState3, 2),
90
- toggleState = _useState4[0],
91
- setToggle = _useState4[1];
92
- var Heading = useMemo(function () {
39
+ let {
40
+ children,
41
+ title,
42
+ subtitle,
43
+ badge,
44
+ badgeColour,
45
+ isOpen,
46
+ small,
47
+ theme,
48
+ ...props
49
+ } = _ref;
50
+ const [baseState, setBase] = useState(isOpen);
51
+ const [toggleState, setToggle] = useState(false);
52
+ const Heading = useMemo(() => {
93
53
  return small ? Typography.H5 : Typography.H4;
94
54
  }, [small]);
95
- var onToggle = function onToggle() {
55
+ const onToggle = () => {
96
56
  if (!toggleState) setToggle(true);else setToggle(false);
97
57
  if (!baseState) setBase(true);else setBase(false);
98
58
  };
99
- var component = /*#__PURE__*/React.createElement(Item, props, /*#__PURE__*/React.createElement(Heading, null, /*#__PURE__*/React.createElement(Button, {
100
- open: baseState,
101
- small: small,
102
- "aria-expanded": baseState,
103
- onClick: onToggle
104
- }, /*#__PURE__*/React.createElement(Flex, {
105
- alignItems: "center",
106
- justifyContent: "space-between"
107
- }, /*#__PURE__*/React.createElement(Text, null, title, subtitle && /*#__PURE__*/React.createElement(SubTitle, {
108
- grey: true
109
- }, subtitle)), badge && /*#__PURE__*/React.createElement(Badge, {
110
- variant: badgeColour
111
- }, badge)))), /*#__PURE__*/React.createElement(Content, {
112
- open: baseState,
113
- expanded: toggleState
114
- }, children));
115
- return theme ? /*#__PURE__*/React.createElement(ThemeProvider, {
116
- theme: theme
117
- }, component) : component;
59
+ const component = /*#__PURE__*/_jsxs(Item, {
60
+ ...props,
61
+ children: [/*#__PURE__*/_jsx(Heading, {
62
+ children: /*#__PURE__*/_jsx(Button, {
63
+ open: baseState,
64
+ small: small,
65
+ "aria-expanded": baseState,
66
+ onClick: onToggle,
67
+ children: /*#__PURE__*/_jsxs(Flex, {
68
+ alignItems: "center",
69
+ justifyContent: "space-between",
70
+ children: [/*#__PURE__*/_jsxs(Text, {
71
+ children: [title, subtitle && /*#__PURE__*/_jsx(SubTitle, {
72
+ grey: true,
73
+ children: subtitle
74
+ })]
75
+ }), badge && /*#__PURE__*/_jsx(Badge, {
76
+ variant: badgeColour,
77
+ children: badge
78
+ })]
79
+ })
80
+ })
81
+ }), /*#__PURE__*/_jsx(Content, {
82
+ open: baseState,
83
+ expanded: toggleState,
84
+ children: children
85
+ })]
86
+ });
87
+ return theme ? /*#__PURE__*/_jsx(ThemeProvider, {
88
+ theme: theme,
89
+ children: component
90
+ }) : component;
118
91
  }
119
92
  Expandable.propTypes = {
120
93
  /** Sets expandable to open state by default */
@@ -2,15 +2,29 @@ import React from "react";
2
2
  import Flex from ".";
3
3
  import Button from "../Button";
4
4
  import Spacer from "../Spacer";
5
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
6
  export default {
6
7
  title: "Components/Flex",
7
8
  component: Flex
8
9
  };
9
- export var basicFlex = function basicFlex() {
10
- return /*#__PURE__*/React.createElement(Flex, null, /*#__PURE__*/React.createElement(Spacer, {
11
- mx: "s"
12
- }, /*#__PURE__*/React.createElement(Button, null, "Button 1"), /*#__PURE__*/React.createElement(Button, null, "Button 2"), /*#__PURE__*/React.createElement(Button, null, "Button 3"), /*#__PURE__*/React.createElement(Button, null, "Button 4"), /*#__PURE__*/React.createElement(Button, null, "Button 5"), /*#__PURE__*/React.createElement(Button, null, "Button 6")));
13
- };
10
+ export const basicFlex = () => /*#__PURE__*/_jsx(Flex, {
11
+ children: /*#__PURE__*/_jsxs(Spacer, {
12
+ mx: "s",
13
+ children: [/*#__PURE__*/_jsx(Button, {
14
+ children: "Button 1"
15
+ }), /*#__PURE__*/_jsx(Button, {
16
+ children: "Button 2"
17
+ }), /*#__PURE__*/_jsx(Button, {
18
+ children: "Button 3"
19
+ }), /*#__PURE__*/_jsx(Button, {
20
+ children: "Button 4"
21
+ }), /*#__PURE__*/_jsx(Button, {
22
+ children: "Button 5"
23
+ }), /*#__PURE__*/_jsx(Button, {
24
+ children: "Button 6"
25
+ })]
26
+ })
27
+ });
14
28
  basicFlex.storyName = "Basic Flex";
15
29
  basicFlex.__docgenInfo = {
16
30
  "description": "",
@@ -2,19 +2,20 @@ import React from "react";
2
2
  import { FlexItem } from ".";
3
3
  import Button from "../Button";
4
4
  import Icon from "../Icon";
5
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
6
  export default {
6
7
  title: "Components/FlexItem",
7
8
  component: FlexItem
8
9
  };
9
- export var basicFlexItem = function basicFlexItem() {
10
- return /*#__PURE__*/React.createElement(FlexItem, {
11
- mx: "s"
12
- }, /*#__PURE__*/React.createElement(Button, {
13
- iconRight: true
14
- }, "Right aligned icon", /*#__PURE__*/React.createElement(Icon, {
15
- icon: ["fas", "download"]
16
- })));
17
- };
10
+ export const basicFlexItem = () => /*#__PURE__*/_jsx(FlexItem, {
11
+ mx: "s",
12
+ children: /*#__PURE__*/_jsxs(Button, {
13
+ iconRight: true,
14
+ children: ["Right aligned icon", /*#__PURE__*/_jsx(Icon, {
15
+ icon: ["fas", "download"]
16
+ })]
17
+ })
18
+ });
18
19
  basicFlexItem.storyName = "Basic Flex Item";
19
20
  basicFlexItem.__docgenInfo = {
20
21
  "description": "",
@@ -1,8 +1,3 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["children", "theme"];
4
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6
1
  import React from "react";
7
2
  import PropTypes from "prop-types";
8
3
  import styled, { ThemeProvider } from "styled-components";
@@ -10,43 +5,55 @@ import { space, layout, flexbox, compose } from "styled-system";
10
5
  import { css } from "@styled-system/css";
11
6
  import shouldForwardProp from "@styled-system/should-forward-prop";
12
7
  import styledPropTypes from "@styled-system/prop-types";
13
- var FlexStyles = compose(space, layout, flexbox);
14
- var FlexWrapper = styled("div").withConfig({
15
- shouldForwardProp: shouldForwardProp,
8
+ import { jsx as _jsx } from "react/jsx-runtime";
9
+ const FlexStyles = compose(space, layout, flexbox);
10
+ const FlexWrapper = styled("div").withConfig({
11
+ shouldForwardProp,
16
12
  displayName: "Flex__FlexWrapper",
17
13
  componentId: "sc-1f3kfw7-0"
18
- }).attrs(function (props) {
19
- return {
20
- "data-testid": props.dataTestId ? props.dataTestId : props["data-testid"] ? props["data-testid"] : null
21
- };
22
- })(css({
14
+ }).attrs(props => ({
15
+ "data-testid": props.dataTestId ? props.dataTestId : props["data-testid"] ? props["data-testid"] : null
16
+ }))(css({
23
17
  boxSizing: "border-box"
24
18
  }), FlexStyles);
25
- var FlexItem = styled("div").withConfig({
19
+ const FlexItem = styled("div").withConfig({
26
20
  displayName: "Flex__FlexItem",
27
21
  componentId: "sc-1f3kfw7-1"
28
22
  })(css({
29
23
  boxSizing: "border-box"
30
24
  }), FlexStyles);
31
25
  export default function Flex(_ref) {
32
- var children = _ref.children,
33
- theme = _ref.theme,
34
- props = _objectWithoutProperties(_ref, _excluded);
35
- var component = /*#__PURE__*/React.createElement(FlexWrapper, props, children);
26
+ let {
27
+ children,
28
+ theme,
29
+ ...props
30
+ } = _ref;
31
+ const component = /*#__PURE__*/_jsx(FlexWrapper, {
32
+ ...props,
33
+ children: children
34
+ });
36
35
  if (theme) {
37
- return /*#__PURE__*/React.createElement(ThemeProvider, {
38
- theme: theme
39
- }, /*#__PURE__*/React.createElement(FlexWrapper, props, children));
36
+ return /*#__PURE__*/_jsx(ThemeProvider, {
37
+ theme: theme,
38
+ children: /*#__PURE__*/_jsx(FlexWrapper, {
39
+ ...props,
40
+ children: children
41
+ })
42
+ });
40
43
  }
41
- return theme ? /*#__PURE__*/React.createElement(ThemeProvider, {
42
- theme: theme
43
- }, component) : component;
44
+ return theme ? /*#__PURE__*/_jsx(ThemeProvider, {
45
+ theme: theme,
46
+ children: component
47
+ }) : component;
44
48
  }
45
- Flex.propTypes = _objectSpread(_objectSpread(_objectSpread({
49
+ Flex.propTypes = {
46
50
  /** Children of `Flex` are taken as node elements */
47
51
  children: PropTypes.node,
48
- theme: PropTypes.object
49
- }, styledPropTypes.space), styledPropTypes.layout), styledPropTypes.flexbox);
52
+ theme: PropTypes.object,
53
+ ...styledPropTypes.space,
54
+ ...styledPropTypes.layout,
55
+ ...styledPropTypes.flexbox
56
+ };
50
57
  Flex.defaultProps = {
51
58
  display: "flex",
52
59
  flexDirection: "row",