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
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["children", "direction", "width", "textAlign", "text", "inlineBlock", "theme", "variant", "enableSelectAll", "tabIndex"];
|
|
5
1
|
import React, { useId, useRef, useState } from "react";
|
|
6
2
|
import PropTypes from "prop-types";
|
|
7
3
|
import styled, { css, ThemeProvider } from "styled-components";
|
|
@@ -11,62 +7,25 @@ import Icon from "../Icon";
|
|
|
11
7
|
import { themeGet } from "@styled-system/theme-get";
|
|
12
8
|
import { useKeepInView, directions } from "../../hooks/keepInView";
|
|
13
9
|
import { commonKeys } from "../../hooks/keypress";
|
|
14
|
-
|
|
10
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
const Container = styled.div.withConfig({
|
|
15
12
|
displayName: "Popover__Container",
|
|
16
13
|
componentId: "sc-1bwoak-0"
|
|
17
|
-
})(["", " ", " display:", ";position:relative;&:hover,&:focus-within{.popoverText{opacity:1;z-index:100;visibility:visible;pointer-events:auto;}}"], space, layout,
|
|
18
|
-
|
|
19
|
-
});
|
|
20
|
-
var TooltipControl = styled.div.withConfig({
|
|
14
|
+
})(["", " ", " display:", ";position:relative;&:hover,&:focus-within{.popoverText{opacity:1;z-index:100;visibility:visible;pointer-events:auto;}}"], space, layout, props => props.inlineBlock ? "inline-block !important" : "block !important");
|
|
15
|
+
const TooltipControl = styled.div.withConfig({
|
|
21
16
|
displayName: "Popover__TooltipControl",
|
|
22
17
|
componentId: "sc-1bwoak-1"
|
|
23
|
-
})(["border:none;background:none;padding:0;cursor:help;font-size:1em;color:", ";transition:", ";&:hover,&:focus{outline:0;color:", ";}"],
|
|
24
|
-
|
|
25
|
-
}, function (props) {
|
|
26
|
-
return themeGet("transition.transitionDefault")(props);
|
|
27
|
-
}, function (props) {
|
|
28
|
-
return themeGet("colors.primary")(props);
|
|
29
|
-
});
|
|
30
|
-
var Text = styled.div.withConfig({
|
|
18
|
+
})(["border:none;background:none;padding:0;cursor:help;font-size:1em;color:", ";transition:", ";&:hover,&:focus{outline:0;color:", ";}"], props => themeGet("colors.black")(props), props => themeGet("transition.transitionDefault")(props), props => themeGet("colors.primary")(props));
|
|
19
|
+
const Text = styled.div.withConfig({
|
|
31
20
|
displayName: "Popover__Text",
|
|
32
21
|
componentId: "sc-1bwoak-2"
|
|
33
|
-
})(["position:absolute;font-size:", ";line-height:", ";font-weight:", ";text-align:", ";word-break:break-word;left:100%;top:50%;color:", ";outline:0;padding:", " ", ";border-radius:", ";transform:translateX(10px) translateY(-50%);width:", ";background:", ";border:1px solid ", ";box-shadow:", ";transition:all 300ms ease-in-out;transition-delay:300ms;opacity:0;z-index:-100;visibility:hidden;pointer-events:none;user-select:", ";& a{font-size:", ";}&:before{content:\"\";z-index:2;height:0;width:0;border-style:solid;border-width:6px 6px 6px 0;border-color:transparent;border-right-color:", ";left:-6px;top:50%;margin-top:-6px;position:absolute;}&:after{content:\"\";z-index:1;position:absolute;border-color:transparent;border-right-color:", ";height:0;width:0;border-style:solid;border-width:6px 6px 6px 0;left:-7px;top:50%;margin-top:-6px;}", ";"],
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}, function (props) {
|
|
38
|
-
return themeGet("fontWeights.1")(props);
|
|
39
|
-
}, function (props) {
|
|
40
|
-
return props.textAlign ? props.textAlign : "left";
|
|
41
|
-
}, function (props) {
|
|
42
|
-
return themeGet("colors.greyDarkest")(props);
|
|
43
|
-
}, function (props) {
|
|
44
|
-
return themeGet("space.3")(props);
|
|
45
|
-
}, function (props) {
|
|
46
|
-
return themeGet("space.3")(props);
|
|
47
|
-
}, function (props) {
|
|
48
|
-
return themeGet("radii.1")(props);
|
|
49
|
-
}, function (props) {
|
|
50
|
-
return props.width ? props.width : "200px";
|
|
51
|
-
}, function (props) {
|
|
52
|
-
return themeGet("colors.white")(props);
|
|
53
|
-
}, function (props) {
|
|
54
|
-
return themeGet("colors.greyLight")(props);
|
|
55
|
-
}, function (props) {
|
|
56
|
-
return themeGet("shadows.boxDefault")(props);
|
|
57
|
-
}, function (props) {
|
|
58
|
-
return props.enableSelectAll ? "all" : "auto";
|
|
59
|
-
}, function (props) {
|
|
60
|
-
return themeGet("fontSizes.0")(props);
|
|
61
|
-
}, function (props) {
|
|
62
|
-
return themeGet("colors.white")(props);
|
|
63
|
-
}, function (props) {
|
|
64
|
-
return themeGet("colors.grey")(props);
|
|
65
|
-
}, function (_ref) {
|
|
66
|
-
var direction = _ref.direction;
|
|
22
|
+
})(["position:absolute;font-size:", ";line-height:", ";font-weight:", ";text-align:", ";word-break:break-word;left:100%;top:50%;color:", ";outline:0;padding:", " ", ";border-radius:", ";transform:translateX(10px) translateY(-50%);width:", ";background:", ";border:1px solid ", ";box-shadow:", ";transition:all 300ms ease-in-out;transition-delay:300ms;opacity:0;z-index:-100;visibility:hidden;pointer-events:none;user-select:", ";& a{font-size:", ";}&:before{content:\"\";z-index:2;height:0;width:0;border-style:solid;border-width:6px 6px 6px 0;border-color:transparent;border-right-color:", ";left:-6px;top:50%;margin-top:-6px;position:absolute;}&:after{content:\"\";z-index:1;position:absolute;border-color:transparent;border-right-color:", ";height:0;width:0;border-style:solid;border-width:6px 6px 6px 0;left:-7px;top:50%;margin-top:-6px;}", ";"], props => themeGet("fontSizes.0")(props), props => themeGet("fontSizes.1")(props), props => themeGet("fontWeights.1")(props), props => props.textAlign ? props.textAlign : "left", props => themeGet("colors.greyDarkest")(props), props => themeGet("space.3")(props), props => themeGet("space.3")(props), props => themeGet("radii.1")(props), props => props.width ? props.width : "200px", props => themeGet("colors.white")(props), props => themeGet("colors.greyLight")(props), props => themeGet("shadows.boxDefault")(props), props => props.enableSelectAll ? "all" : "auto", props => themeGet("fontSizes.0")(props), props => themeGet("colors.white")(props), props => themeGet("colors.grey")(props), _ref => {
|
|
23
|
+
let {
|
|
24
|
+
direction
|
|
25
|
+
} = _ref;
|
|
67
26
|
return direction === "top" ? css(["left:50%;top:auto;bottom:100%;transform:translateX(-50%) translateY(-10px);&:before{left:50%;top:auto;margin-top:0;bottom:-9px;margin-left:-3px;transform:rotate(-90deg);}&:after{left:50%;top:auto;margin-top:0;bottom:-10px;margin-left:-3px;transform:rotate(-90deg);}"]) : direction === "topRight" ? css(["left:100%;top:auto;bottom:100%;transform:translateX(5px) translateY(-5px);&:before{left:0;top:auto;margin-top:0;bottom:-5px;margin-left:-5px;transform:rotate(-45deg);border-width:5px 10px 5px 0;}&:after{left:0;top:auto;margin-top:0;bottom:-6px;margin-left:-6px;transform:rotate(-45deg);border-width:5px 10px 5px 0;}"]) : direction === "right" ? css([""]) : direction === "bottomRight" ? css(["left:100%;top:100%;bottom:auto;transform:translateX(5px) translateY(5px);&:before{left:0;bottom:auto;margin-top:0;top:-5px;margin-left:-5px;transform:rotate(45deg);border-width:5px 10px 5px 0;}&:after{left:0;bottom:auto;margin-top:0;top:-6px;margin-left:-6px;transform:rotate(45deg);border-width:5px 10px 5px 0;}"]) : direction === "bottom" ? css(["left:50%;top:100%;transform:translateX(-50%) translateY(10px);&:before{left:50%;top:-9px;margin-top:0;margin-left:-3px;transform:rotate(90deg);}&:after{left:50%;top:-10px;margin-top:0;margin-left:-3px;transform:rotate(90deg);}"]) : direction === "bottomLeft" ? css(["right:100%;left:auto;top:100%;bottom:auto;transform:translateX(-5px) translateY(5px);&:before{right:0;left:auto;bottom:auto;margin-top:0;top:-5px;margin-right:-5px;transform:rotate(135deg);border-width:5px 10px 5px 0;}&:after{right:0;left:auto;bottom:auto;margin-top:0;top:-6px;margin-right:-6px;transform:rotate(135deg);border-width:5px 10px 5px 0;}"]) : direction === "left" ? css(["left:auto;right:100%;transform:translateX(-10px) translateY(-50%);&:before{left:auto;right:-6px;transform:rotate(180deg);}&:after{left:auto;right:-7px;transform:rotate(180deg);top:50%;margin-top:-6px;}"]) : direction === "topLeft" ? css(["right:100%;left:auto;top:auto;bottom:100%;transform:translateX(-5px) translateY(-5px);&:before{right:0;left:auto;top:auto;margin-top:0;bottom:-5px;margin-right:-5px;transform:rotate(225deg);border-width:5px 10px 5px 0;}&:after{right:0;left:auto;top:auto;margin-top:0;bottom:-6px;margin-right:-6px;transform:rotate(225deg);border-width:5px 10px 5px 0;}"]) : css([""]);
|
|
68
27
|
});
|
|
69
|
-
|
|
28
|
+
const HoverSpacer = styled.div.withConfig({
|
|
70
29
|
displayName: "Popover__HoverSpacer",
|
|
71
30
|
componentId: "sc-1bwoak-3"
|
|
72
31
|
})(["position:absolute;background:transparent;height:calc(100% + 24px);width:calc(100% + 24px);left:-12px;top:-12px;"]);
|
|
@@ -78,45 +37,36 @@ var HoverSpacer = styled.div.withConfig({
|
|
|
78
37
|
*/
|
|
79
38
|
|
|
80
39
|
export default function Popover(_ref2) {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
enableSelectAll =
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
var toolTipId = useId();
|
|
104
|
-
var _useKeepInView = useKeepInView({
|
|
105
|
-
direction: direction,
|
|
106
|
-
callback: setInViewDirection
|
|
107
|
-
}),
|
|
108
|
-
_useKeepInView2 = _slicedToArray(_useKeepInView, 2),
|
|
109
|
-
ref = _useKeepInView2[0],
|
|
110
|
-
setIsShown = _useKeepInView2[1];
|
|
111
|
-
var component = /*#__PURE__*/React.createElement(Container, _extends({
|
|
40
|
+
let {
|
|
41
|
+
children,
|
|
42
|
+
direction,
|
|
43
|
+
width,
|
|
44
|
+
textAlign,
|
|
45
|
+
text,
|
|
46
|
+
inlineBlock,
|
|
47
|
+
theme,
|
|
48
|
+
variant,
|
|
49
|
+
enableSelectAll = true,
|
|
50
|
+
tabIndex = 0,
|
|
51
|
+
...props
|
|
52
|
+
} = _ref2;
|
|
53
|
+
const containerRef = useRef();
|
|
54
|
+
const [inViewDirection, setInViewDirection] = useState(direction);
|
|
55
|
+
const [dismissed, setDismissed] = useState(false);
|
|
56
|
+
const toolTipId = useId();
|
|
57
|
+
const [ref, setIsShown] = useKeepInView({
|
|
58
|
+
direction,
|
|
59
|
+
callback: setInViewDirection
|
|
60
|
+
});
|
|
61
|
+
const component = /*#__PURE__*/_jsxs(Container, {
|
|
112
62
|
ref: containerRef,
|
|
113
|
-
inlineBlock: inlineBlock
|
|
114
|
-
|
|
115
|
-
onMouseEnter:
|
|
63
|
+
inlineBlock: inlineBlock,
|
|
64
|
+
...props,
|
|
65
|
+
onMouseEnter: () => {
|
|
116
66
|
setIsShown(true);
|
|
117
67
|
setDismissed(false);
|
|
118
68
|
},
|
|
119
|
-
onKeyDownCapture:
|
|
69
|
+
onKeyDownCapture: e => {
|
|
120
70
|
if ([commonKeys.ESCAPE, commonKeys.ESC].includes(e.key)) {
|
|
121
71
|
setDismissed(true);
|
|
122
72
|
if (containerRef !== null && containerRef !== void 0 && containerRef.current.contains(document.activeElement)) {
|
|
@@ -124,35 +74,39 @@ export default function Popover(_ref2) {
|
|
|
124
74
|
}
|
|
125
75
|
}
|
|
126
76
|
},
|
|
127
|
-
onBlur:
|
|
77
|
+
onBlur: () => {
|
|
128
78
|
setDismissed(false);
|
|
129
79
|
},
|
|
130
|
-
onMouseLeave:
|
|
80
|
+
onMouseLeave: () => {
|
|
131
81
|
setIsShown(false);
|
|
132
82
|
setDismissed(false);
|
|
133
83
|
},
|
|
134
|
-
"aria-describedby": toolTipId
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
}
|
|
84
|
+
"aria-describedby": toolTipId,
|
|
85
|
+
children: [variant === "tooltip" && /*#__PURE__*/_jsx(TooltipControl, {
|
|
86
|
+
tabIndex: tabIndex,
|
|
87
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
88
|
+
transform: "grow-4",
|
|
89
|
+
icon: ["fas", "question-circle"],
|
|
90
|
+
fontSize: "2"
|
|
91
|
+
})
|
|
92
|
+
}), !!text && !dismissed && /*#__PURE__*/_jsxs(Text, {
|
|
93
|
+
ref: ref,
|
|
94
|
+
role: "tooltip",
|
|
95
|
+
className: "popoverText",
|
|
96
|
+
textAlign: textAlign,
|
|
97
|
+
direction: inViewDirection,
|
|
98
|
+
width: width,
|
|
99
|
+
enableSelectAll: enableSelectAll,
|
|
100
|
+
id: toolTipId,
|
|
101
|
+
children: [/*#__PURE__*/_jsx(HoverSpacer, {
|
|
102
|
+
className: "popoverSpacer"
|
|
103
|
+
}), text]
|
|
104
|
+
}), children]
|
|
105
|
+
});
|
|
106
|
+
return theme ? /*#__PURE__*/_jsx(ThemeProvider, {
|
|
107
|
+
theme: theme,
|
|
108
|
+
children: component
|
|
109
|
+
}) : component;
|
|
156
110
|
}
|
|
157
111
|
Popover.propTypes = {
|
|
158
112
|
/** The element that requires the popover helper text. */
|
|
@@ -2,56 +2,53 @@ import React from "react";
|
|
|
2
2
|
import ProgressBar from ".";
|
|
3
3
|
import Box from "../Box";
|
|
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/ProgressBar",
|
|
7
|
-
decorators: [
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}],
|
|
8
|
+
decorators: [storyFn => /*#__PURE__*/_jsx(Box, {
|
|
9
|
+
p: "r",
|
|
10
|
+
children: storyFn()
|
|
11
|
+
})],
|
|
12
12
|
component: ProgressBar
|
|
13
13
|
};
|
|
14
|
-
export
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}, /*#__PURE__*/React.createElement(ProgressBar, {
|
|
14
|
+
export const defaultProgressBar = () => /*#__PURE__*/_jsxs(Spacer, {
|
|
15
|
+
m: "r",
|
|
16
|
+
children: [/*#__PURE__*/_jsx(ProgressBar, {
|
|
18
17
|
ariaLabel: "Percent Completed",
|
|
19
18
|
containerWidth: 100,
|
|
20
19
|
fillWidth: 40
|
|
21
|
-
}), /*#__PURE__*/
|
|
20
|
+
}), /*#__PURE__*/_jsx(ProgressBar, {
|
|
22
21
|
ariaLabel: "Percent Completed",
|
|
23
22
|
containerWidth: 50,
|
|
24
23
|
fillWidth: 70
|
|
25
|
-
})
|
|
26
|
-
};
|
|
24
|
+
})]
|
|
25
|
+
});
|
|
27
26
|
defaultProgressBar.storyName = "Default";
|
|
28
|
-
export
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
})));
|
|
54
|
-
};
|
|
27
|
+
export const gradient = () => /*#__PURE__*/_jsx(ProgressBar, {
|
|
28
|
+
ariaLabel: "Percent Completed",
|
|
29
|
+
containerWidth: 100,
|
|
30
|
+
fillWidth: 40,
|
|
31
|
+
gradient: true
|
|
32
|
+
});
|
|
33
|
+
export const onDarkBackground = () => /*#__PURE__*/_jsx(Box, {
|
|
34
|
+
bg: "greyDarkest",
|
|
35
|
+
p: "r",
|
|
36
|
+
children: /*#__PURE__*/_jsxs(Spacer, {
|
|
37
|
+
m: "r",
|
|
38
|
+
children: [/*#__PURE__*/_jsx(ProgressBar, {
|
|
39
|
+
ariaLabel: "Percent Completed",
|
|
40
|
+
containerWidth: 100,
|
|
41
|
+
fillWidth: 40,
|
|
42
|
+
inverted: true
|
|
43
|
+
}), /*#__PURE__*/_jsx(ProgressBar, {
|
|
44
|
+
ariaLabel: "Percent Completed",
|
|
45
|
+
containerWidth: 100,
|
|
46
|
+
fillWidth: 70,
|
|
47
|
+
gradient: true,
|
|
48
|
+
inverted: true
|
|
49
|
+
})]
|
|
50
|
+
})
|
|
51
|
+
});
|
|
55
52
|
defaultProgressBar.__docgenInfo = {
|
|
56
53
|
"description": "",
|
|
57
54
|
"methods": [],
|
|
@@ -1,26 +1,18 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["containerWidth", "fillWidth", "gradient", "theme", "ariaLabel"];
|
|
4
1
|
import React from "react";
|
|
5
2
|
import PropTypes from "prop-types";
|
|
6
3
|
import styled, { css, keyframes, ThemeProvider } from "styled-components";
|
|
7
4
|
import { space, layout } from "styled-system";
|
|
8
5
|
import { themeGet } from "@styled-system/theme-get";
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
const expandWidth = keyframes(["0%{width:0;}"]);
|
|
8
|
+
const Background = styled.div.withConfig({
|
|
11
9
|
displayName: "ProgressBar__Background",
|
|
12
10
|
componentId: "sc-q9qaaf-0"
|
|
13
|
-
})(["", " ", " position:relative;background:", ";height:16px;border-radius:8px;"], space, layout,
|
|
14
|
-
|
|
15
|
-
});
|
|
16
|
-
var Fill = styled.div.withConfig({
|
|
11
|
+
})(["", " ", " position:relative;background:", ";height:16px;border-radius:8px;"], space, layout, props => themeGet("colors.greyLighter")(props));
|
|
12
|
+
const Fill = styled.div.withConfig({
|
|
17
13
|
displayName: "ProgressBar__Fill",
|
|
18
14
|
componentId: "sc-q9qaaf-1"
|
|
19
|
-
})(["position:absolute;left:3px;top:3px;height:10px;border-radius:5px;animation:", " 1000ms ease-in-out 1;transition:", ";", ";"], expandWidth,
|
|
20
|
-
return themeGet("transition.transitionDefault")(props);
|
|
21
|
-
}, function (props) {
|
|
22
|
-
return props.gradient ? css(["background:linear-gradient( to right,", " 0%,", " 50%,", " 100% );"], themeGet("colors.danger")(props), themeGet("colors.warning")(props), themeGet("colors.success")(props)) : css(["background:", ";"], themeGet("colors.primary")(props));
|
|
23
|
-
});
|
|
15
|
+
})(["position:absolute;left:3px;top:3px;height:10px;border-radius:5px;animation:", " 1000ms ease-in-out 1;transition:", ";", ";"], expandWidth, props => themeGet("transition.transitionDefault")(props), props => props.gradient ? css(["background:linear-gradient( to right,", " 0%,", " 50%,", " 100% );"], themeGet("colors.danger")(props), themeGet("colors.warning")(props), themeGet("colors.success")(props)) : css(["background:", ";"], themeGet("colors.primary")(props)));
|
|
24
16
|
|
|
25
17
|
/**
|
|
26
18
|
* Progress bar is not intended to be used for loading (that's what the Loading component is for). The intended use is for indicating progress through steps or progress towards a goal.
|
|
@@ -31,31 +23,34 @@ var Fill = styled.div.withConfig({
|
|
|
31
23
|
*/
|
|
32
24
|
|
|
33
25
|
export default function ProgressBar(_ref) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
ariaLabel =
|
|
40
|
-
props
|
|
41
|
-
|
|
26
|
+
let {
|
|
27
|
+
containerWidth,
|
|
28
|
+
fillWidth,
|
|
29
|
+
gradient,
|
|
30
|
+
theme,
|
|
31
|
+
ariaLabel = "Progress",
|
|
32
|
+
...props
|
|
33
|
+
} = _ref;
|
|
34
|
+
const component = /*#__PURE__*/_jsx(Background, {
|
|
42
35
|
style: {
|
|
43
36
|
width: containerWidth + "%"
|
|
44
|
-
}
|
|
45
|
-
|
|
37
|
+
},
|
|
38
|
+
...props,
|
|
46
39
|
"aria-label": ariaLabel,
|
|
47
40
|
"aria-valuenow": fillWidth,
|
|
48
41
|
"aria-valuemin": "0",
|
|
49
|
-
"aria-valuemax": "100"
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
42
|
+
"aria-valuemax": "100",
|
|
43
|
+
children: /*#__PURE__*/_jsx(Fill, {
|
|
44
|
+
gradient: gradient,
|
|
45
|
+
style: {
|
|
46
|
+
width: fillWidth + "%"
|
|
47
|
+
}
|
|
48
|
+
})
|
|
49
|
+
});
|
|
50
|
+
return theme ? /*#__PURE__*/_jsx(ThemeProvider, {
|
|
51
|
+
theme: theme,
|
|
52
|
+
children: component
|
|
53
|
+
}) : component;
|
|
59
54
|
}
|
|
60
55
|
ProgressBar.propTypes = {
|
|
61
56
|
/** Sets the percentage width of the parent container */
|
|
@@ -2,74 +2,69 @@ import React from "react";
|
|
|
2
2
|
import RadioButton from ".";
|
|
3
3
|
import Box from "../Box";
|
|
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/RadioButton",
|
|
7
8
|
component: RadioButton
|
|
8
9
|
};
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}, /*#__PURE__*/React.createElement(RadioButton, {
|
|
10
|
+
export const defaultRadioButton = () => /*#__PURE__*/_jsxs(Spacer, {
|
|
11
|
+
m: "r",
|
|
12
|
+
children: [/*#__PURE__*/_jsx(RadioButton, {
|
|
13
13
|
name: "RadioButtons01",
|
|
14
14
|
label: "Default radio"
|
|
15
|
-
}), /*#__PURE__*/
|
|
15
|
+
}), /*#__PURE__*/_jsx(RadioButton, {
|
|
16
16
|
name: "RadioButtons01",
|
|
17
17
|
label: "Default radio 02"
|
|
18
|
-
})
|
|
19
|
-
};
|
|
18
|
+
})]
|
|
19
|
+
});
|
|
20
20
|
defaultRadioButton.storyName = "Default";
|
|
21
|
-
export
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return /*#__PURE__*/React.createElement(Spacer, {
|
|
30
|
-
m: "r"
|
|
31
|
-
}, /*#__PURE__*/React.createElement(RadioButton, {
|
|
21
|
+
export const checked = () => /*#__PURE__*/_jsx(RadioButton, {
|
|
22
|
+
name: "RadioButtons02",
|
|
23
|
+
label: "Default checked radio",
|
|
24
|
+
checked: true
|
|
25
|
+
});
|
|
26
|
+
export const disabled = () => /*#__PURE__*/_jsxs(Spacer, {
|
|
27
|
+
m: "r",
|
|
28
|
+
children: [/*#__PURE__*/_jsx(RadioButton, {
|
|
32
29
|
name: "RadioButtons03",
|
|
33
30
|
label: "Disabled unchecked radio",
|
|
34
31
|
disabled: true
|
|
35
|
-
}), /*#__PURE__*/
|
|
32
|
+
}), /*#__PURE__*/_jsx(RadioButton, {
|
|
36
33
|
name: "RadioButtons03",
|
|
37
34
|
label: "Disabled checked radio",
|
|
38
35
|
disabled: true,
|
|
39
36
|
checked: true
|
|
40
|
-
})
|
|
41
|
-
};
|
|
42
|
-
export
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}, /*#__PURE__*/React.createElement(RadioButton, {
|
|
37
|
+
})]
|
|
38
|
+
});
|
|
39
|
+
export const colour = () => /*#__PURE__*/_jsxs(Spacer, {
|
|
40
|
+
m: "r",
|
|
41
|
+
children: [/*#__PURE__*/_jsx(RadioButton, {
|
|
46
42
|
name: "RadioButtons",
|
|
47
43
|
label: "Primary colour radio",
|
|
48
44
|
variant: "primary"
|
|
49
|
-
}), /*#__PURE__*/
|
|
45
|
+
}), /*#__PURE__*/_jsx(RadioButton, {
|
|
50
46
|
name: "RadioButtons",
|
|
51
47
|
label: "Success colour radio",
|
|
52
48
|
variant: "success"
|
|
53
|
-
}), /*#__PURE__*/
|
|
49
|
+
}), /*#__PURE__*/_jsx(RadioButton, {
|
|
54
50
|
name: "RadioButtons",
|
|
55
51
|
label: "Warning colour radio",
|
|
56
52
|
variant: "warning"
|
|
57
|
-
}), /*#__PURE__*/
|
|
53
|
+
}), /*#__PURE__*/_jsx(RadioButton, {
|
|
58
54
|
name: "RadioButtons",
|
|
59
55
|
label: "Danger colour radio",
|
|
60
56
|
variant: "danger"
|
|
61
|
-
})
|
|
62
|
-
};
|
|
63
|
-
export
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}, /*#__PURE__*/React.createElement(RadioButton, {
|
|
57
|
+
})]
|
|
58
|
+
});
|
|
59
|
+
export const inverted = () => /*#__PURE__*/_jsx(Box, {
|
|
60
|
+
p: "r",
|
|
61
|
+
bg: "greyDarker",
|
|
62
|
+
children: /*#__PURE__*/_jsx(RadioButton, {
|
|
68
63
|
name: "RadioButtons04",
|
|
69
64
|
label: "Inverted radio",
|
|
70
65
|
variant: "white"
|
|
71
|
-
})
|
|
72
|
-
};
|
|
66
|
+
})
|
|
67
|
+
});
|
|
73
68
|
defaultRadioButton.__docgenInfo = {
|
|
74
69
|
"description": "",
|
|
75
70
|
"methods": [],
|