@spaced-out/ui-design-system 0.0.59 → 0.0.61
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/CHANGELOG.md +14 -0
- package/lib/components/Dropdown/Dropdown.js +3 -1
- package/lib/components/Dropdown/Dropdown.js.flow +5 -2
- package/lib/components/ErrorMessage/ErrorImages/ForbiddenImage.js +77 -0
- package/lib/components/ErrorMessage/ErrorImages/ForbiddenImage.js.flow +89 -0
- package/lib/components/ErrorMessage/ErrorImages/NotFoundImage.js +105 -0
- package/lib/components/ErrorMessage/ErrorImages/NotFoundImage.js.flow +121 -0
- package/lib/components/ErrorMessage/ErrorImages/ServerErrorImage.js +202 -0
- package/lib/components/ErrorMessage/ErrorImages/ServerErrorImage.js.flow +241 -0
- package/lib/components/ErrorMessage/ErrorImages/UnauthorizedImage.js +66 -0
- package/lib/components/ErrorMessage/ErrorImages/UnauthorizedImage.js.flow +77 -0
- package/lib/components/ErrorMessage/ErrorImages/index.js +49 -0
- package/lib/components/ErrorMessage/ErrorImages/index.js.flow +6 -0
- package/lib/components/ErrorMessage/ErrorMessage.js +45 -0
- package/lib/components/ErrorMessage/ErrorMessage.js.flow +86 -0
- package/lib/components/ErrorMessage/ErrorMessage.module.css +35 -0
- package/lib/components/ErrorMessage/index.js +16 -0
- package/lib/components/ErrorMessage/index.js.flow +3 -0
- package/lib/components/Menu/Menu.js +15 -0
- package/lib/components/Menu/Menu.js.flow +33 -0
- package/lib/components/Menu/Menu.module.css +11 -0
- package/lib/components/Menu/index.js +21 -13
- package/lib/components/Menu/index.js.flow +2 -3
- package/package.json +1 -1
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _ForbiddenImage = require("./ForbiddenImage");
|
|
7
|
+
Object.keys(_ForbiddenImage).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _ForbiddenImage[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _ForbiddenImage[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _NotFoundImage = require("./NotFoundImage");
|
|
18
|
+
Object.keys(_NotFoundImage).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _NotFoundImage[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _NotFoundImage[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
var _ServerErrorImage = require("./ServerErrorImage");
|
|
29
|
+
Object.keys(_ServerErrorImage).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _ServerErrorImage[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _ServerErrorImage[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
var _UnauthorizedImage = require("./UnauthorizedImage");
|
|
40
|
+
Object.keys(_UnauthorizedImage).forEach(function (key) {
|
|
41
|
+
if (key === "default" || key === "__esModule") return;
|
|
42
|
+
if (key in exports && exports[key] === _UnauthorizedImage[key]) return;
|
|
43
|
+
Object.defineProperty(exports, key, {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () {
|
|
46
|
+
return _UnauthorizedImage[key];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ErrorMessage = void 0;
|
|
7
|
+
var React = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _classify = _interopRequireDefault(require("../../utils/classify"));
|
|
9
|
+
var _ErrorImages = require("./ErrorImages");
|
|
10
|
+
var _ErrorMessageModule = _interopRequireDefault(require("./ErrorMessage.module.css"));
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
14
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
15
|
+
const ErrorMessage = _ref => {
|
|
16
|
+
let {
|
|
17
|
+
classNames,
|
|
18
|
+
children,
|
|
19
|
+
imageVariant,
|
|
20
|
+
title,
|
|
21
|
+
description,
|
|
22
|
+
customImageUrl,
|
|
23
|
+
heading,
|
|
24
|
+
...props
|
|
25
|
+
} = _ref;
|
|
26
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, props, {
|
|
27
|
+
"data-testid": "ErrorMessage",
|
|
28
|
+
className: (0, _classify.default)(_ErrorMessageModule.default.wrapper, classNames?.wrapper)
|
|
29
|
+
}), !!imageVariant && !customImageUrl && /*#__PURE__*/React.createElement("div", {
|
|
30
|
+
className: (0, _classify.default)(_ErrorMessageModule.default.image, classNames?.image)
|
|
31
|
+
}, imageVariant === 'unauthorized' && /*#__PURE__*/React.createElement(_ErrorImages.UnauthorizedImage, null), imageVariant === 'forbidden' && /*#__PURE__*/React.createElement(_ErrorImages.ForbiddenImage, null), imageVariant === 'notFound' && /*#__PURE__*/React.createElement(_ErrorImages.NotFoundImage, null), imageVariant === 'serverError' && /*#__PURE__*/React.createElement(_ErrorImages.ServerErrorImage, null)), customImageUrl && /*#__PURE__*/React.createElement("img", {
|
|
32
|
+
className: (0, _classify.default)(_ErrorMessageModule.default.image, classNames?.image),
|
|
33
|
+
src: customImageUrl,
|
|
34
|
+
alt: "Empty State"
|
|
35
|
+
}), !!heading && /*#__PURE__*/React.createElement("div", {
|
|
36
|
+
className: (0, _classify.default)(_ErrorMessageModule.default.heading, classNames?.heading)
|
|
37
|
+
}, heading), !!title && /*#__PURE__*/React.createElement("div", {
|
|
38
|
+
className: (0, _classify.default)(_ErrorMessageModule.default.title, classNames?.title)
|
|
39
|
+
}, title), !!description && /*#__PURE__*/React.createElement("div", {
|
|
40
|
+
className: (0, _classify.default)(_ErrorMessageModule.default.description, classNames?.description)
|
|
41
|
+
}, description), !!children && /*#__PURE__*/React.createElement("div", {
|
|
42
|
+
className: (0, _classify.default)(_ErrorMessageModule.default.childrenWrapper, classNames?.children)
|
|
43
|
+
}, children));
|
|
44
|
+
};
|
|
45
|
+
exports.ErrorMessage = ErrorMessage;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
// @flow strict
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
|
|
5
|
+
import classify from '../../utils/classify';
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
ForbiddenImage,
|
|
9
|
+
NotFoundImage,
|
|
10
|
+
ServerErrorImage,
|
|
11
|
+
UnauthorizedImage,
|
|
12
|
+
} from './ErrorImages';
|
|
13
|
+
|
|
14
|
+
import css from './ErrorMessage.module.css';
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
type ClassNames = $ReadOnly<{
|
|
18
|
+
wrapper?: string,
|
|
19
|
+
image?: string,
|
|
20
|
+
heading?: string,
|
|
21
|
+
title?: string,
|
|
22
|
+
description?: string,
|
|
23
|
+
children?: string,
|
|
24
|
+
}>;
|
|
25
|
+
|
|
26
|
+
export type ErrorMessageProps = {
|
|
27
|
+
classNames?: ClassNames,
|
|
28
|
+
children?: React.Node,
|
|
29
|
+
imageVariant?: 'unauthorized' | 'forbidden' | 'notFound' | 'serverError',
|
|
30
|
+
title?: React.Node,
|
|
31
|
+
description?: React.Node,
|
|
32
|
+
heading?: React.Node,
|
|
33
|
+
customImageUrl?: string,
|
|
34
|
+
...
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const ErrorMessage = ({
|
|
38
|
+
classNames,
|
|
39
|
+
children,
|
|
40
|
+
imageVariant,
|
|
41
|
+
title,
|
|
42
|
+
description,
|
|
43
|
+
customImageUrl,
|
|
44
|
+
heading,
|
|
45
|
+
...props
|
|
46
|
+
}: ErrorMessageProps): React.Node => (
|
|
47
|
+
<div
|
|
48
|
+
{...props}
|
|
49
|
+
data-testid="ErrorMessage"
|
|
50
|
+
className={classify(css.wrapper, classNames?.wrapper)}
|
|
51
|
+
>
|
|
52
|
+
{!!imageVariant && !customImageUrl && (
|
|
53
|
+
<div className={classify(css.image, classNames?.image)}>
|
|
54
|
+
{imageVariant === 'unauthorized' && <UnauthorizedImage />}
|
|
55
|
+
{imageVariant === 'forbidden' && <ForbiddenImage />}
|
|
56
|
+
{imageVariant === 'notFound' && <NotFoundImage />}
|
|
57
|
+
{imageVariant === 'serverError' && <ServerErrorImage />}
|
|
58
|
+
</div>
|
|
59
|
+
)}
|
|
60
|
+
{customImageUrl && (
|
|
61
|
+
<img
|
|
62
|
+
className={classify(css.image, classNames?.image)}
|
|
63
|
+
src={customImageUrl}
|
|
64
|
+
alt="Empty State"
|
|
65
|
+
/>
|
|
66
|
+
)}
|
|
67
|
+
{!!heading && (
|
|
68
|
+
<div className={classify(css.heading, classNames?.heading)}>
|
|
69
|
+
{heading}
|
|
70
|
+
</div>
|
|
71
|
+
)}
|
|
72
|
+
{!!title && (
|
|
73
|
+
<div className={classify(css.title, classNames?.title)}>{title}</div>
|
|
74
|
+
)}
|
|
75
|
+
{!!description && (
|
|
76
|
+
<div className={classify(css.description, classNames?.description)}>
|
|
77
|
+
{description}
|
|
78
|
+
</div>
|
|
79
|
+
)}
|
|
80
|
+
{!!children && (
|
|
81
|
+
<div className={classify(css.childrenWrapper, classNames?.children)}>
|
|
82
|
+
{children}
|
|
83
|
+
</div>
|
|
84
|
+
)}
|
|
85
|
+
</div>
|
|
86
|
+
);
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
@value (colorTextSecondary, colorTextClickable) from '../../styles/variables/_color.css';
|
|
2
|
+
@value (spaceMedium, spaceXSmall, spaceSmall) from '../../styles/variables/_space.css';
|
|
3
|
+
@value (sizeFluid, size140) from '../../styles/variables/_size.css';
|
|
4
|
+
|
|
5
|
+
.wrapper {
|
|
6
|
+
display: flex;
|
|
7
|
+
width: sizeFluid;
|
|
8
|
+
height: sizeFluid;
|
|
9
|
+
flex-flow: column;
|
|
10
|
+
align-items: center;
|
|
11
|
+
justify-content: center;
|
|
12
|
+
text-align: center;
|
|
13
|
+
padding: spaceMedium;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.image {
|
|
17
|
+
max-width: size140;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.heading {
|
|
21
|
+
composes: jumboMedium from '../../styles/typography.module.css';
|
|
22
|
+
margin-bottom: spaceSmall;
|
|
23
|
+
color: colorTextClickable;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.title {
|
|
27
|
+
composes: subTitleMedium from '../../styles/typography.module.css';
|
|
28
|
+
margin-bottom: spaceXSmall;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.description {
|
|
32
|
+
composes: bodyMedium from '../../styles/typography.module.css';
|
|
33
|
+
color: colorTextSecondary;
|
|
34
|
+
margin-bottom: spaceMedium;
|
|
35
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _ErrorMessage = require("./ErrorMessage");
|
|
7
|
+
Object.keys(_ErrorMessage).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _ErrorMessage[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _ErrorMessage[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -16,6 +16,7 @@ const RenderOption = _ref => {
|
|
|
16
16
|
let {
|
|
17
17
|
options,
|
|
18
18
|
composeOptions,
|
|
19
|
+
groupTitleOptions,
|
|
19
20
|
...restProps
|
|
20
21
|
} = _ref;
|
|
21
22
|
if (options && Array.isArray(options) && options.length) {
|
|
@@ -38,6 +39,20 @@ const RenderOption = _ref => {
|
|
|
38
39
|
option: option
|
|
39
40
|
}, restProps)))))));
|
|
40
41
|
}
|
|
42
|
+
if (groupTitleOptions && Array.isArray(groupTitleOptions) && groupTitleOptions.length) {
|
|
43
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, groupTitleOptions.map((optionsGroup, index) =>
|
|
44
|
+
/*#__PURE__*/
|
|
45
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
46
|
+
React.createElement(React.Fragment, {
|
|
47
|
+
key: index
|
|
48
|
+
}, !!optionsGroup.groupTitle && /*#__PURE__*/React.createElement("div", {
|
|
49
|
+
className: _MenuModule.default.groupTitleWrapper
|
|
50
|
+
}, optionsGroup.groupTitle), optionsGroup.options?.map(option => /*#__PURE__*/React.createElement(React.Fragment, {
|
|
51
|
+
key: option.key
|
|
52
|
+
}, /*#__PURE__*/React.createElement(_MenuOptionButton.MenuOptionButton, _extends({
|
|
53
|
+
option: option
|
|
54
|
+
}, restProps)))))));
|
|
55
|
+
}
|
|
41
56
|
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
42
57
|
};
|
|
43
58
|
const Menu = props => {
|
|
@@ -39,14 +39,21 @@ export type MenuProps = {
|
|
|
39
39
|
|
|
40
40
|
export type MenuSizeTypes = 'medium' | 'small';
|
|
41
41
|
|
|
42
|
+
export type MenuGroupTitleOption = {
|
|
43
|
+
groupTitle?: React.Node,
|
|
44
|
+
options?: Array<MenuOption>,
|
|
45
|
+
};
|
|
46
|
+
|
|
42
47
|
export type MenuOptionTypes = {
|
|
43
48
|
options?: Array<MenuOption>,
|
|
44
49
|
composeOptions?: Array<Array<MenuOption>>,
|
|
50
|
+
groupTitleOptions?: Array<MenuGroupTitleOption>,
|
|
45
51
|
};
|
|
46
52
|
|
|
47
53
|
const RenderOption = ({
|
|
48
54
|
options,
|
|
49
55
|
composeOptions,
|
|
56
|
+
groupTitleOptions,
|
|
50
57
|
...restProps
|
|
51
58
|
}: MenuProps): React.Node => {
|
|
52
59
|
if (options && Array.isArray(options) && options.length) {
|
|
@@ -80,6 +87,32 @@ const RenderOption = ({
|
|
|
80
87
|
</>
|
|
81
88
|
);
|
|
82
89
|
}
|
|
90
|
+
if (
|
|
91
|
+
groupTitleOptions &&
|
|
92
|
+
Array.isArray(groupTitleOptions) &&
|
|
93
|
+
groupTitleOptions.length
|
|
94
|
+
) {
|
|
95
|
+
return (
|
|
96
|
+
<>
|
|
97
|
+
{groupTitleOptions.map((optionsGroup, index) => (
|
|
98
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
99
|
+
<React.Fragment key={index}>
|
|
100
|
+
{!!optionsGroup.groupTitle && (
|
|
101
|
+
<div className={css.groupTitleWrapper}>
|
|
102
|
+
{optionsGroup.groupTitle}
|
|
103
|
+
</div>
|
|
104
|
+
)}
|
|
105
|
+
|
|
106
|
+
{optionsGroup.options?.map((option) => (
|
|
107
|
+
<React.Fragment key={option.key}>
|
|
108
|
+
<MenuOptionButton option={option} {...restProps} />
|
|
109
|
+
</React.Fragment>
|
|
110
|
+
))}
|
|
111
|
+
</React.Fragment>
|
|
112
|
+
))}
|
|
113
|
+
</>
|
|
114
|
+
);
|
|
115
|
+
}
|
|
83
116
|
return <></>;
|
|
84
117
|
};
|
|
85
118
|
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
spaceSmall,
|
|
35
35
|
spaceXSmall,
|
|
36
36
|
spaceXXSmall,
|
|
37
|
+
spaceMedium,
|
|
37
38
|
spaceNone
|
|
38
39
|
) from '../../styles/variables/_space.css';
|
|
39
40
|
|
|
@@ -185,3 +186,13 @@
|
|
|
185
186
|
.menuDivider:last-child {
|
|
186
187
|
padding-bottom: spaceNone;
|
|
187
188
|
}
|
|
189
|
+
|
|
190
|
+
.groupTitleWrapper {
|
|
191
|
+
composes: formLabelSmall from '../../styles/typography.module.css';
|
|
192
|
+
display: flex;
|
|
193
|
+
margin-bottom: spaceXSmall;
|
|
194
|
+
padding-left: spaceSmall;
|
|
195
|
+
padding-right: calc(spaceXSmall / 2);
|
|
196
|
+
color: colorTextTertiary;
|
|
197
|
+
margin-top: spaceSmall;
|
|
198
|
+
}
|
|
@@ -3,17 +3,25 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
Object.defineProperty(exports, "Menu", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _Menu.Menu;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "MenuOptionButton", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _MenuOptionButton.MenuOptionButton;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
6
|
var _Menu = require("./Menu");
|
|
19
|
-
|
|
7
|
+
Object.keys(_Menu).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _Menu[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _Menu[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _MenuOptionButton = require("./MenuOptionButton");
|
|
18
|
+
Object.keys(_MenuOptionButton).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _MenuOptionButton[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _MenuOptionButton[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|