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", "width", "height", "maxWidth", "maxHeight", "minWidth", "minHeight", "overflow", "onClose", "theme", "visible", "overlayID", "modalID", "headerContent", "footerContent"];
|
|
5
1
|
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
|
6
2
|
import ReactDOM from "react-dom";
|
|
7
3
|
import PropTypes from "prop-types";
|
|
@@ -13,98 +9,80 @@ import Icon from "../Icon";
|
|
|
13
9
|
import Button from "../Button";
|
|
14
10
|
import Flex from "../Flex";
|
|
15
11
|
import Box from "../Box";
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
const scaleIn = keyframes(["0%{transform:scale(0);}100%{transform:scale(1);}"]);
|
|
14
|
+
const fadeIn = keyframes(["0%{opacity:0;}100%{opacity:1;}"]);
|
|
15
|
+
const Overlay = styled(Flex).withConfig({
|
|
19
16
|
displayName: "Modal__Overlay",
|
|
20
17
|
componentId: "sc-1v5puuo-0"
|
|
21
18
|
})(["position:fixed;background:rgba(0,0,0,0.7);top:0;right:0;bottom:0;left:0;margin:0;opacity:0;transition:all 300ms ease-in-out;opacity:1;z-index:900;visibility:visible;animation:300ms ", " ease-in-out;justify-content:center;align-items:center;"], fadeIn);
|
|
22
|
-
|
|
19
|
+
const Container = styled(Box).withConfig({
|
|
23
20
|
displayName: "Modal__Container",
|
|
24
21
|
componentId: "sc-1v5puuo-1"
|
|
25
|
-
})(["position:relative;z-index:9001;animation:300ms ", " ease-in-out,300ms ", " ease-in-out;display:flex;flex-direction:column;resize:both;overflow:", ";"], fadeIn, scaleIn,
|
|
26
|
-
|
|
27
|
-
});
|
|
28
|
-
var CloseButton = styled(Button).withConfig({
|
|
22
|
+
})(["position:relative;z-index:9001;animation:300ms ", " ease-in-out,300ms ", " ease-in-out;display:flex;flex-direction:column;resize:both;overflow:", ";"], fadeIn, scaleIn, props => props.overflow === "visible" ? "visible" : "hidden");
|
|
23
|
+
const CloseButton = styled(Button).withConfig({
|
|
29
24
|
displayName: "Modal__CloseButton",
|
|
30
25
|
componentId: "sc-1v5puuo-2"
|
|
31
|
-
})(
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
"
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
});
|
|
49
|
-
var HeaderContent = styled.div.withConfig({
|
|
26
|
+
})(props => css({
|
|
27
|
+
position: "absolute",
|
|
28
|
+
top: "s",
|
|
29
|
+
right: "s",
|
|
30
|
+
bg: "transparent",
|
|
31
|
+
color: themeGet("colors.greyDark")(props),
|
|
32
|
+
borderColor: "transparent",
|
|
33
|
+
"&:hover": {
|
|
34
|
+
bg: themeGet("colors.greyLighter")(props),
|
|
35
|
+
borderColor: themeGet("colors.greyLighter")(props)
|
|
36
|
+
},
|
|
37
|
+
"&:focus": {
|
|
38
|
+
outline: "0",
|
|
39
|
+
boxShadow: themeGet("shadows.thinOutline")(props) + " " + themeGet("colors.black20")(props)
|
|
40
|
+
}
|
|
41
|
+
}));
|
|
42
|
+
const HeaderContent = styled.div.withConfig({
|
|
50
43
|
displayName: "Modal__HeaderContent",
|
|
51
44
|
componentId: "sc-1v5puuo-3"
|
|
52
|
-
})(["display:flex;align-items:flex-start;justify-content:space-between;width:100%;padding-bottom:", ";border-bottom:solid 1px ", ";flex:0 0 auto;"],
|
|
53
|
-
|
|
54
|
-
}, function (props) {
|
|
55
|
-
return themeGet("colors.greyLighter")(props);
|
|
56
|
-
});
|
|
57
|
-
var FooterContent = styled.div.withConfig({
|
|
45
|
+
})(["display:flex;align-items:flex-start;justify-content:space-between;width:100%;padding-bottom:", ";border-bottom:solid 1px ", ";flex:0 0 auto;"], props => themeGet("space.r")(props), props => themeGet("colors.greyLighter")(props));
|
|
46
|
+
const FooterContent = styled.div.withConfig({
|
|
58
47
|
displayName: "Modal__FooterContent",
|
|
59
48
|
componentId: "sc-1v5puuo-4"
|
|
60
|
-
})(["display:flex;align-items:flex-start;justify-content:space-between;width:100%;padding-top:", ";border-top:solid 1px ", ";flex:0 0 auto;"],
|
|
61
|
-
|
|
62
|
-
}, function (props) {
|
|
63
|
-
return themeGet("colors.greyLighter")(props);
|
|
64
|
-
});
|
|
65
|
-
var ScrollableContent = styled.div.withConfig({
|
|
49
|
+
})(["display:flex;align-items:flex-start;justify-content:space-between;width:100%;padding-top:", ";border-top:solid 1px ", ";flex:0 0 auto;"], props => themeGet("space.r")(props), props => themeGet("colors.greyLighter")(props));
|
|
50
|
+
const ScrollableContent = styled.div.withConfig({
|
|
66
51
|
displayName: "Modal__ScrollableContent",
|
|
67
52
|
componentId: "sc-1v5puuo-5"
|
|
68
|
-
})(["--scrollbar-size:8px;--scrollbar-minlength:30px;--scrollbar-ff-width:thin;--scrollbar-track-color:rgba(0,0,0,0.05);--scrollbar-color:rgba(0,0,0,0.2);--scrollbar-color-hover:rgba(0,0,0,0.35);--scrollbar-color-active:rgba(0,0,0,0.5);height:100%;flex:1 1 auto;overflow-y:", ";margin-top:", ";-webkit-overflow-scrolling:touch;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;scrollbar-width:var(--scrollbar-ff-width);scrollbar-color:var(--scrollbar-color) var(--scrollbar-track-color);&::-webkit-scrollbar{height:var(--scrollbar-size);width:var(--scrollbar-size);}&::-webkit-scrollbar-track{background-color:var(--scrollbar-track-color);}&::-webkit-scrollbar-thumb{background-color:var(--scrollbar-color);border-radius:4px;}&::-webkit-scrollbar-thumb:hover{background-color:var(--scrollbar-color-hover);}&::-webkit-scrollbar-thumb:active{background-color:var(--scrollbar-color-active);}&::-webkit-scrollbar-thumb:vertical{min-height:var(--scrollbar-minlength);}&::-webkit-scrollbar-thumb:horizontal{min-width:var(--scrollbar-minlength);}"],
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
footerContent = _ref.footerContent,
|
|
92
|
-
restProps = _objectWithoutProperties(_ref, _excluded);
|
|
93
|
-
var _useState = useState(null),
|
|
94
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
95
|
-
lastActiveElement = _useState2[0],
|
|
96
|
-
setLastActiveElement = _useState2[1];
|
|
97
|
-
var ariaLabel = useMemo(function () {
|
|
53
|
+
})(["--scrollbar-size:8px;--scrollbar-minlength:30px;--scrollbar-ff-width:thin;--scrollbar-track-color:rgba(0,0,0,0.05);--scrollbar-color:rgba(0,0,0,0.2);--scrollbar-color-hover:rgba(0,0,0,0.35);--scrollbar-color-active:rgba(0,0,0,0.5);height:100%;flex:1 1 auto;overflow-y:", ";margin-top:", ";-webkit-overflow-scrolling:touch;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;scrollbar-width:var(--scrollbar-ff-width);scrollbar-color:var(--scrollbar-color) var(--scrollbar-track-color);&::-webkit-scrollbar{height:var(--scrollbar-size);width:var(--scrollbar-size);}&::-webkit-scrollbar-track{background-color:var(--scrollbar-track-color);}&::-webkit-scrollbar-thumb{background-color:var(--scrollbar-color);border-radius:4px;}&::-webkit-scrollbar-thumb:hover{background-color:var(--scrollbar-color-hover);}&::-webkit-scrollbar-thumb:active{background-color:var(--scrollbar-color-active);}&::-webkit-scrollbar-thumb:vertical{min-height:var(--scrollbar-minlength);}&::-webkit-scrollbar-thumb:horizontal{min-width:var(--scrollbar-minlength);}"], props => props.overflow === "visible" ? "visible" : "auto", props => props.headerContent ? "0" : "20px");
|
|
54
|
+
const isHidden = el => window.getComputedStyle(el).display === "none";
|
|
55
|
+
const Modal = _ref => {
|
|
56
|
+
let {
|
|
57
|
+
children,
|
|
58
|
+
width,
|
|
59
|
+
height,
|
|
60
|
+
maxWidth,
|
|
61
|
+
maxHeight,
|
|
62
|
+
minWidth,
|
|
63
|
+
minHeight,
|
|
64
|
+
overflow,
|
|
65
|
+
onClose,
|
|
66
|
+
theme,
|
|
67
|
+
visible,
|
|
68
|
+
overlayID,
|
|
69
|
+
modalID,
|
|
70
|
+
headerContent,
|
|
71
|
+
footerContent,
|
|
72
|
+
...restProps
|
|
73
|
+
} = _ref;
|
|
74
|
+
const [lastActiveElement, setLastActiveElement] = useState(null);
|
|
75
|
+
const ariaLabel = useMemo(() => {
|
|
98
76
|
if (restProps.ariaLabel) {
|
|
99
77
|
return restProps.ariaLabel;
|
|
100
78
|
} else if (typeof headerContent === "string") {
|
|
101
79
|
return headerContent;
|
|
102
80
|
}
|
|
103
81
|
}, [restProps.ariaLabel, headerContent]);
|
|
104
|
-
|
|
82
|
+
const focusLastActiveElement = useCallback(() => {
|
|
105
83
|
if (!lastActiveElement) return;
|
|
106
84
|
if (lastActiveElement !== null && lastActiveElement !== void 0 && lastActiveElement.dataset.actionMenuId && isHidden(lastActiveElement === null || lastActiveElement === void 0 ? void 0 : lastActiveElement.parentNode)) {
|
|
107
|
-
|
|
85
|
+
const actionMenu = document.getElementById(lastActiveElement.dataset.actionMenuId);
|
|
108
86
|
actionMenu.focus();
|
|
109
87
|
} else {
|
|
110
88
|
lastActiveElement.focus();
|
|
@@ -112,7 +90,7 @@ var Modal = function Modal(_ref) {
|
|
|
112
90
|
}, [lastActiveElement]);
|
|
113
91
|
|
|
114
92
|
// On becoming visible focus the top
|
|
115
|
-
useEffect(
|
|
93
|
+
useEffect(() => {
|
|
116
94
|
if (visible && !lastActiveElement) {
|
|
117
95
|
// Keep track of last clicked element to refocus to after dialog closes
|
|
118
96
|
setLastActiveElement(document.activeElement);
|
|
@@ -123,83 +101,97 @@ var Modal = function Modal(_ref) {
|
|
|
123
101
|
focusLastActiveElement();
|
|
124
102
|
}
|
|
125
103
|
}, [visible, focusLastActiveElement, lastActiveElement]);
|
|
126
|
-
useEffect(
|
|
104
|
+
useEffect(() => {
|
|
127
105
|
if (!visible) return;
|
|
128
106
|
|
|
129
107
|
/* Adding onClick handler on the Overlay does not work.
|
|
130
108
|
* So we add a global listener and check if the element clicked is the
|
|
131
109
|
* overlay vida overlayID.
|
|
132
110
|
*/
|
|
133
|
-
|
|
111
|
+
const handler = e => {
|
|
134
112
|
if (e.target.id === overlayID) {
|
|
135
113
|
onClose();
|
|
136
114
|
}
|
|
137
115
|
};
|
|
138
|
-
|
|
139
|
-
eventTypes.map(
|
|
116
|
+
const eventTypes = ["touchstart", "click"];
|
|
117
|
+
eventTypes.map(type => {
|
|
140
118
|
window.addEventListener(type, handler, true);
|
|
141
119
|
});
|
|
142
|
-
return
|
|
143
|
-
eventTypes.map(
|
|
120
|
+
return () => {
|
|
121
|
+
eventTypes.map(type => {
|
|
144
122
|
window.removeEventListener(type, handler, true);
|
|
145
123
|
});
|
|
146
124
|
};
|
|
147
125
|
}, [visible, onClose, overlayID]);
|
|
148
126
|
if (!visible) return null;
|
|
149
|
-
|
|
127
|
+
const component = /*#__PURE__*/_jsx(Overlay, {
|
|
150
128
|
alignItems: "center",
|
|
151
129
|
justifyContent: "center",
|
|
152
|
-
id: overlayID
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
130
|
+
id: overlayID,
|
|
131
|
+
...restProps,
|
|
132
|
+
children: visible && /*#__PURE__*/_jsx(FocusTrap, {
|
|
133
|
+
focusTrapOptions: {
|
|
134
|
+
onDeactivate: onClose
|
|
135
|
+
},
|
|
136
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
137
|
+
role: "dialog",
|
|
138
|
+
"aria-modal": "true",
|
|
139
|
+
"aria-label": ariaLabel,
|
|
140
|
+
children: /*#__PURE__*/_jsxs(Container, {
|
|
141
|
+
width: width,
|
|
142
|
+
height: height,
|
|
143
|
+
maxWidth: maxWidth,
|
|
144
|
+
maxHeight: maxHeight,
|
|
145
|
+
minWidth: minWidth,
|
|
146
|
+
minHeight: minHeight,
|
|
147
|
+
overflow: overflow,
|
|
148
|
+
borderRadius: "2",
|
|
149
|
+
bg: "white",
|
|
150
|
+
p: "r",
|
|
151
|
+
id: modalID,
|
|
152
|
+
children: [headerContent ? /*#__PURE__*/_jsxs(HeaderContent, {
|
|
153
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
|
154
|
+
mr: "xl",
|
|
155
|
+
width: "100%",
|
|
156
|
+
children: headerContent
|
|
157
|
+
}), /*#__PURE__*/_jsx(CloseButton, {
|
|
158
|
+
onClick: onClose,
|
|
159
|
+
className: "modal-close",
|
|
160
|
+
small: true,
|
|
161
|
+
px: "6px",
|
|
162
|
+
"aria-label": "Close dialog",
|
|
163
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
164
|
+
icon: ["fas", "times"],
|
|
165
|
+
color: "greyDark",
|
|
166
|
+
size: "lg"
|
|
167
|
+
})
|
|
168
|
+
})]
|
|
169
|
+
}) : /*#__PURE__*/_jsx(CloseButton, {
|
|
170
|
+
onClick: onClose,
|
|
171
|
+
className: "modal-close",
|
|
172
|
+
small: true,
|
|
173
|
+
px: "6px",
|
|
174
|
+
"aria-label": "Close dialog",
|
|
175
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
176
|
+
icon: ["fas", "times"],
|
|
177
|
+
color: "greyDark",
|
|
178
|
+
size: "lg"
|
|
179
|
+
})
|
|
180
|
+
}), /*#__PURE__*/_jsx(ScrollableContent, {
|
|
181
|
+
headerContent: headerContent,
|
|
182
|
+
overflow: overflow,
|
|
183
|
+
children: children
|
|
184
|
+
}), footerContent && /*#__PURE__*/_jsx(FooterContent, {
|
|
185
|
+
children: footerContent
|
|
186
|
+
})]
|
|
187
|
+
})
|
|
188
|
+
})
|
|
189
|
+
})
|
|
190
|
+
});
|
|
191
|
+
return /*#__PURE__*/ReactDOM.createPortal(theme ? /*#__PURE__*/_jsx(ThemeProvider, {
|
|
192
|
+
theme: theme,
|
|
193
|
+
children: component
|
|
194
|
+
}) : component, document.body);
|
|
203
195
|
};
|
|
204
196
|
Modal.propTypes = {
|
|
205
197
|
/** Specifies the children of the Modal */
|
|
@@ -2,80 +2,81 @@ import React from "react";
|
|
|
2
2
|
import Notification 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/Notification",
|
|
7
8
|
component: Notification,
|
|
8
|
-
decorators: [
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}]
|
|
14
|
-
};
|
|
15
|
-
export var basicNotification = function basicNotification() {
|
|
16
|
-
return /*#__PURE__*/React.createElement(Notification, {
|
|
17
|
-
icon: ["fas", "share-square"]
|
|
18
|
-
}, "Default notification message for messages that are not super important, e.g. Link shared.");
|
|
9
|
+
decorators: [storyFn => /*#__PURE__*/_jsx(Box, {
|
|
10
|
+
p: "r",
|
|
11
|
+
height: "250px",
|
|
12
|
+
children: storyFn()
|
|
13
|
+
})]
|
|
19
14
|
};
|
|
15
|
+
export const basicNotification = () => /*#__PURE__*/_jsx(Notification, {
|
|
16
|
+
icon: ["fas", "share-square"],
|
|
17
|
+
children: "Default notification message for messages that are not super important, e.g. Link shared."
|
|
18
|
+
});
|
|
20
19
|
basicNotification.storyName = "Basic";
|
|
21
|
-
export
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}, /*#__PURE__*/React.createElement(Notification, {
|
|
20
|
+
export const colourNotification = () => /*#__PURE__*/_jsxs(Spacer, {
|
|
21
|
+
m: "r",
|
|
22
|
+
children: [/*#__PURE__*/_jsx(Notification, {
|
|
25
23
|
colour: "success",
|
|
26
|
-
icon: ["fas", "check-circle"]
|
|
27
|
-
|
|
24
|
+
icon: ["fas", "check-circle"],
|
|
25
|
+
children: "Green notification for good/successful notifications, e.g. Details updated successfully!"
|
|
26
|
+
}), /*#__PURE__*/_jsx(Notification, {
|
|
28
27
|
colour: "warning",
|
|
29
|
-
icon: ["fas", "exclamation-triangle"]
|
|
30
|
-
|
|
28
|
+
icon: ["fas", "exclamation-triangle"],
|
|
29
|
+
children: "Yellow warning notification e.g. This may take a few minutes to update."
|
|
30
|
+
}), /*#__PURE__*/_jsx(Notification, {
|
|
31
31
|
colour: "danger",
|
|
32
|
-
icon: ["fas", "exclamation-circle"]
|
|
33
|
-
|
|
34
|
-
}
|
|
32
|
+
icon: ["fas", "exclamation-circle"],
|
|
33
|
+
children: "Red error notification e.g. Update failed! Please try again."
|
|
34
|
+
})]
|
|
35
|
+
});
|
|
35
36
|
colourNotification.storyName = "Alternate Colours";
|
|
36
|
-
export
|
|
37
|
-
|
|
38
|
-
};
|
|
37
|
+
export const textOnlyNotification = () => /*#__PURE__*/_jsx(Notification, {
|
|
38
|
+
children: "Text-only notification"
|
|
39
|
+
});
|
|
39
40
|
textOnlyNotification.storyName = "Text-only";
|
|
40
|
-
export
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
};
|
|
41
|
+
export const closeDisabledNotification = () => /*#__PURE__*/_jsx(Notification, {
|
|
42
|
+
closable: false,
|
|
43
|
+
children: "Closing this notification is disabled, this should be used for persistent notifications e.g. Stage 1 is now locked and is read-only."
|
|
44
|
+
});
|
|
45
45
|
closeDisabledNotification.storyName = "Close Disabled";
|
|
46
|
-
export
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}, /*#__PURE__*/React.createElement(Notification, {
|
|
50
|
-
loading: true
|
|
51
|
-
}, "In progress notification E.g. Importing data..."), /*#__PURE__*/React.createElement(Notification, {
|
|
46
|
+
export const loadingNotification = () => /*#__PURE__*/_jsxs(Spacer, {
|
|
47
|
+
m: "r",
|
|
48
|
+
children: [/*#__PURE__*/_jsx(Notification, {
|
|
52
49
|
loading: true,
|
|
53
|
-
|
|
54
|
-
}
|
|
50
|
+
children: "In progress notification E.g. Importing data..."
|
|
51
|
+
}), /*#__PURE__*/_jsx(Notification, {
|
|
55
52
|
loading: true,
|
|
56
|
-
colour: "
|
|
57
|
-
|
|
53
|
+
colour: "success",
|
|
54
|
+
children: "In progress notification E.g. Importing data..."
|
|
55
|
+
}), /*#__PURE__*/_jsx(Notification, {
|
|
58
56
|
loading: true,
|
|
59
|
-
colour: "
|
|
60
|
-
|
|
61
|
-
}
|
|
57
|
+
colour: "warning",
|
|
58
|
+
children: "In progress notification E.g. Importing data..."
|
|
59
|
+
}), /*#__PURE__*/_jsx(Notification, {
|
|
60
|
+
loading: true,
|
|
61
|
+
colour: "danger",
|
|
62
|
+
children: "In progress notification E.g. Importing data..."
|
|
63
|
+
})]
|
|
64
|
+
});
|
|
62
65
|
loadingNotification.storyName = "Loading";
|
|
63
|
-
export
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
};
|
|
66
|
+
export const floatingNotification = () => /*#__PURE__*/_jsx(Notification, {
|
|
67
|
+
floating: true,
|
|
68
|
+
bottom: "20px",
|
|
69
|
+
right: "20px",
|
|
70
|
+
icon: ["fas", "bell"],
|
|
71
|
+
children: "Floating notification."
|
|
72
|
+
});
|
|
71
73
|
floatingNotification.storyName = "Floating";
|
|
72
|
-
export
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
};
|
|
74
|
+
export const centeredNotification = () => /*#__PURE__*/_jsx(Notification, {
|
|
75
|
+
centered: true,
|
|
76
|
+
floating: true,
|
|
77
|
+
bottom: "20px",
|
|
78
|
+
children: "Centered notification"
|
|
79
|
+
});
|
|
79
80
|
centeredNotification.storyName = "Floating and Centered";
|
|
80
81
|
basicNotification.__docgenInfo = {
|
|
81
82
|
"description": "",
|