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.
- package/es/GlobalStyles.js +1 -31
- package/es/SystemThemeProvider.js +11 -5
- package/es/assets/Colour/Colour.stories.js +211 -0
- package/es/assets/Colour/index.js +3 -3
- package/es/components/ActionsMenu/ActionsMenu.stories.js +260 -233
- package/es/components/ActionsMenu/index.js +144 -229
- package/es/components/Avatar/Avatar.stories.js +212 -196
- package/es/components/Avatar/index.js +280 -307
- package/es/components/Badge/Badge.stories.js +71 -46
- package/es/components/Badge/index.js +71 -74
- package/es/components/Box/Box.stories.js +51 -35
- package/es/components/Box/index.js +33 -34
- package/es/components/Button/Button.stories.js +161 -145
- package/es/components/Button/ButtonLink.stories.js +152 -139
- package/es/components/Button/index.js +79 -99
- package/es/components/ButtonGroup/ButtonGroup.stories.js +43 -42
- package/es/components/ButtonGroup/ButtonGroupItem.stories.js +11 -13
- package/es/components/ButtonGroup/index.js +103 -99
- package/es/components/Card/Card.stories.js +94 -62
- package/es/components/Card/index.js +50 -71
- package/es/components/Checkbox/Checkbox.stories.js +37 -43
- package/es/components/Checkbox/index.js +61 -76
- package/es/components/DatePicker/DatePicker.stories.js +86 -118
- package/es/components/DatePicker/index.js +71 -187
- package/es/components/Divider/Divider.stories.js +39 -42
- package/es/components/Divider/index.js +21 -27
- package/es/components/Expandable/Expandable.stories.js +46 -36
- package/es/components/Expandable/index.js +55 -82
- package/es/components/Flex/Flex.stories.js +19 -5
- package/es/components/Flex/FlexItem.stories.js +10 -9
- package/es/components/Flex/index.js +34 -27
- package/es/components/Grid/Grid.stories.js +129 -55
- package/es/components/Grid/index.js +25 -24
- package/es/components/Header/Header.stories.js +101 -92
- package/es/components/Header/index.js +433 -436
- package/es/components/HeaderSimple/HeaderSimple.stories.js +23 -27
- package/es/components/HeaderSimple/index.js +73 -68
- package/es/components/Icon/Icon.stories.js +58 -57
- package/es/components/Icon/index.js +48 -46
- package/es/components/Loading/Loading.stories.js +32 -39
- package/es/components/Loading/index.js +44 -51
- package/es/components/Modal/Modal.stories.js +172 -153
- package/es/components/Modal/index.js +126 -134
- package/es/components/Notification/Notification.stories.js +59 -58
- package/es/components/Notification/index.js +123 -133
- package/es/components/Popover/Popover.stories.js +134 -102
- package/es/components/Popover/index.js +65 -111
- package/es/components/ProgressBar/ProgressBar.stories.js +36 -39
- package/es/components/ProgressBar/index.js +29 -34
- package/es/components/RadioButton/RadioButton.stories.js +32 -37
- package/es/components/RadioButton/index.js +170 -184
- package/es/components/Range/Range.stories.js +19 -19
- package/es/components/Range/index.js +35 -45
- package/es/components/Select/Select.stories.js +107 -128
- package/es/components/Select/index.js +324 -336
- package/es/components/SideNav/NavItem.js +112 -122
- package/es/components/SideNav/SideNav.stories.js +84 -57
- package/es/components/SideNav/index.js +161 -185
- package/es/components/Sidebar/Sidebar.stories.js +50 -33
- package/es/components/Sidebar/index.js +152 -155
- package/es/components/Spacer/Spacer.stories.js +35 -32
- package/es/components/Spacer/index.js +20 -20
- package/es/components/StatusDot/StatusDot.stories.js +103 -90
- package/es/components/StatusDot/index.js +36 -38
- package/es/components/StyledLink/StyledLink.stories.js +68 -69
- package/es/components/StyledLink/index.js +47 -48
- package/es/components/Table/Table.stories.js +118 -112
- package/es/components/Table/getExpandColumnConfig.js +67 -62
- package/es/components/Table/index.js +24 -27
- package/es/components/Table/muiStyleOverrides.js +10 -8
- package/es/components/Tabs/Tab.stories.js +55 -38
- package/es/components/Tabs/TabsContainer.stories.js +30 -22
- package/es/components/Tabs/index.js +95 -92
- package/es/components/Tag/Tag.stories.js +250 -220
- package/es/components/Tag/index.js +118 -190
- package/es/components/TextArea/TextArea.stories.js +76 -89
- package/es/components/TextArea/index.js +117 -115
- package/es/components/TextInput/TextInput.stories.js +41 -61
- package/es/components/TextInput/index.js +127 -171
- package/es/components/Toggle/Toggle.stories.js +63 -62
- package/es/components/Toggle/index.js +43 -77
- package/es/components/TreeNav/TreeNav.stories.js +7 -8
- package/es/components/TreeNav/index.js +72 -69
- package/es/components/Typography/Typography.stories.js +174 -0
- package/es/components/Typography/index.js +252 -308
- package/es/components.test.js +1 -1
- package/es/hooks/isVisible.js +6 -10
- package/es/hooks/keepInView.js +27 -32
- package/es/hooks/keypress.js +14 -14
- package/es/hooks/useInputFocus.js +5 -5
- package/es/hooks/usePrevious.js +3 -3
- package/es/systemThemeCollapsed.js +53 -53
- package/es/systemtheme.js +53 -53
- package/es/utils/selectUtil.js +1 -1
- package/es/utils/selectUtil.test.js +6 -6
- 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
|
|
10
|
-
|
|
11
|
-
|
|
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__*/
|
|
14
|
+
}), /*#__PURE__*/_jsx(Divider, {
|
|
15
15
|
thick: true
|
|
16
|
-
}), /*#__PURE__*/
|
|
16
|
+
}), /*#__PURE__*/_jsx(Divider, {
|
|
17
17
|
light: true,
|
|
18
18
|
thick: true
|
|
19
|
-
})
|
|
20
|
-
};
|
|
21
|
-
export
|
|
22
|
-
|
|
23
|
-
|
|
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__*/
|
|
25
|
+
}), /*#__PURE__*/_jsx(Divider, {
|
|
27
26
|
light: true,
|
|
28
27
|
dash: true
|
|
29
|
-
}), /*#__PURE__*/
|
|
28
|
+
}), /*#__PURE__*/_jsx(Divider, {
|
|
30
29
|
thick: true,
|
|
31
30
|
dash: true
|
|
32
|
-
}), /*#__PURE__*/
|
|
31
|
+
}), /*#__PURE__*/_jsx(Divider, {
|
|
33
32
|
light: true,
|
|
34
33
|
thick: true,
|
|
35
34
|
dash: true
|
|
36
|
-
})
|
|
37
|
-
};
|
|
38
|
-
export
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
})
|
|
57
|
-
};
|
|
58
|
-
export
|
|
59
|
-
|
|
60
|
-
|
|
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
|
-
|
|
11
|
-
|
|
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,
|
|
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
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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: [
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}],
|
|
8
|
+
decorators: [storyFn => /*#__PURE__*/_jsx(Box, {
|
|
9
|
+
height: "300px",
|
|
10
|
+
children: storyFn()
|
|
11
|
+
})],
|
|
12
12
|
component: Expandable
|
|
13
13
|
};
|
|
14
|
-
export
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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);}"],
|
|
19
|
-
|
|
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
|
-
|
|
21
|
+
const SubTitle = styled(Typography.Small).withConfig({
|
|
52
22
|
displayName: "Expandable__SubTitle",
|
|
53
23
|
componentId: "sc-na4gdb-3"
|
|
54
24
|
})(["display:block;"]);
|
|
55
|
-
|
|
25
|
+
const Content = styled.div.withConfig({
|
|
56
26
|
displayName: "Expandable__Content",
|
|
57
27
|
componentId: "sc-na4gdb-4"
|
|
58
|
-
})(["padding:", ";transition:", ";display:", ";"],
|
|
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
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
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
|
-
|
|
55
|
+
const onToggle = () => {
|
|
96
56
|
if (!toggleState) setToggle(true);else setToggle(false);
|
|
97
57
|
if (!baseState) setBase(true);else setBase(false);
|
|
98
58
|
};
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
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
|
|
10
|
-
|
|
11
|
-
mx: "s"
|
|
12
|
-
|
|
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
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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(
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
|
|
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
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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__*/
|
|
38
|
-
theme: theme
|
|
39
|
-
|
|
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__*/
|
|
42
|
-
theme: theme
|
|
43
|
-
|
|
44
|
+
return theme ? /*#__PURE__*/_jsx(ThemeProvider, {
|
|
45
|
+
theme: theme,
|
|
46
|
+
children: component
|
|
47
|
+
}) : component;
|
|
44
48
|
}
|
|
45
|
-
Flex.propTypes =
|
|
49
|
+
Flex.propTypes = {
|
|
46
50
|
/** Children of `Flex` are taken as node elements */
|
|
47
51
|
children: PropTypes.node,
|
|
48
|
-
theme: PropTypes.object
|
|
49
|
-
|
|
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",
|