@pingux/astro 1.38.0-alpha.8 → 1.38.1
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 +28 -0
- package/NOTICE.html +4707 -0
- package/lib/cjs/components/Messages/Message.js +41 -27
- package/lib/cjs/components/Messages/Messages.test.js +0 -13
- package/lib/cjs/index.js +62 -85
- package/lib/cjs/styles/variants/variants.js +0 -3
- package/lib/components/Messages/Message.js +28 -21
- package/lib/components/Messages/Messages.test.js +0 -11
- package/lib/index.js +0 -2
- package/lib/styles/variants/variants.js +0 -2
- package/package.json +2 -1
- package/lib/cjs/components/Bulletin/Bulletin.js +0 -93
- package/lib/cjs/components/Bulletin/Bulletin.stories.js +0 -90
- package/lib/cjs/components/Bulletin/Bulletin.test.js +0 -70
- package/lib/cjs/components/Bulletin/index.js +0 -18
- package/lib/cjs/components/Icon/NoticeIcon.js +0 -71
- package/lib/cjs/components/Icon/NoticeIcon.test.js +0 -35
- package/lib/cjs/styles/variants/bulletin.js +0 -60
- package/lib/components/Bulletin/Bulletin.js +0 -70
- package/lib/components/Bulletin/Bulletin.stories.js +0 -59
- package/lib/components/Bulletin/Bulletin.test.js +0 -45
- package/lib/components/Bulletin/index.js +0 -1
- package/lib/components/Icon/NoticeIcon.js +0 -43
- package/lib/components/Icon/NoticeIcon.test.js +0 -24
- package/lib/styles/variants/bulletin.js +0 -41
@@ -5,13 +5,25 @@ import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectW
|
|
5
5
|
var _excluded = ["color"];
|
6
6
|
import _Object$values from "@babel/runtime-corejs3/core-js-stable/object/values";
|
7
7
|
import React, { forwardRef, useRef, useState, useLayoutEffect } from 'react';
|
8
|
-
import CloseIcon from 'mdi-react/CloseIcon';
|
9
8
|
import PropTypes from 'prop-types';
|
10
|
-
import
|
11
|
-
import
|
9
|
+
import AlertCircleIcon from 'mdi-react/AlertCircleIcon';
|
10
|
+
import CheckCircleIcon from 'mdi-react/CheckCircleIcon';
|
11
|
+
import CloseIcon from 'mdi-react/CloseIcon';
|
12
|
+
import AlertIcon from 'mdi-react/AlertIcon';
|
13
|
+
import InformationIcon from 'mdi-react/InformationIcon';
|
12
14
|
import useStatusClasses from '../../hooks/useStatusClasses';
|
13
|
-
import
|
15
|
+
import statuses from '../../utils/devUtils/constants/statuses';
|
16
|
+
import Box from '../Box';
|
17
|
+
import Icon from '../Icon';
|
18
|
+
import IconButton from '../IconButton';
|
19
|
+
import Text from '../Text';
|
14
20
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
21
|
+
export var icons = {
|
22
|
+
"default": InformationIcon,
|
23
|
+
success: CheckCircleIcon,
|
24
|
+
error: AlertCircleIcon,
|
25
|
+
warning: AlertIcon
|
26
|
+
};
|
15
27
|
export var ARIA_STATUSES = {
|
16
28
|
SUCCESS: 'Success Message',
|
17
29
|
ERROR: 'Error Message',
|
@@ -38,10 +50,10 @@ var CloseButton = function CloseButton(_ref) {
|
|
38
50
|
CloseButton.propTypes = {
|
39
51
|
color: PropTypes.string
|
40
52
|
};
|
41
|
-
var Message = /*#__PURE__*/forwardRef(function (
|
42
|
-
var className =
|
43
|
-
item =
|
44
|
-
onClose =
|
53
|
+
var Message = /*#__PURE__*/forwardRef(function (props, ref) {
|
54
|
+
var className = props.className,
|
55
|
+
item = props.item,
|
56
|
+
onClose = props.onClose;
|
45
57
|
var key = item.key,
|
46
58
|
itemProps = item.props;
|
47
59
|
var children = itemProps.children,
|
@@ -49,7 +61,8 @@ var Message = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
49
61
|
status = _itemProps$status === void 0 ? 'default' : _itemProps$status,
|
50
62
|
bg = itemProps.bg,
|
51
63
|
color = itemProps.color,
|
52
|
-
icon = itemProps.icon,
|
64
|
+
_itemProps$icon = itemProps.icon,
|
65
|
+
icon = _itemProps$icon === void 0 ? icons[status] : _itemProps$icon,
|
53
66
|
_itemProps$isHidden = itemProps.isHidden,
|
54
67
|
isHidden = _itemProps$isHidden === void 0 ? false : _itemProps$isHidden,
|
55
68
|
dataId = itemProps['data-id'];
|
@@ -91,17 +104,6 @@ var Message = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
91
104
|
return '';
|
92
105
|
};
|
93
106
|
|
94
|
-
var messageIconProps = {
|
95
|
-
className: statusClasses,
|
96
|
-
color: color,
|
97
|
-
mr: 'md'
|
98
|
-
};
|
99
|
-
var messageIcon = icon ? ___EmotionJSX(Icon, _extends({
|
100
|
-
icon: icon,
|
101
|
-
"data-testid": "custom-icon-testid"
|
102
|
-
}, messageIconProps)) : ___EmotionJSX(NoticeIcon, _extends({
|
103
|
-
status: status
|
104
|
-
}, messageIconProps));
|
105
107
|
return ___EmotionJSX(Box, {
|
106
108
|
variant: "messages.transition",
|
107
109
|
className: wrapperClasses,
|
@@ -120,7 +122,12 @@ var Message = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
120
122
|
variant: "messages.item",
|
121
123
|
className: statusClasses,
|
122
124
|
bg: bg
|
123
|
-
},
|
125
|
+
}, icon && ___EmotionJSX(Icon, {
|
126
|
+
icon: icon,
|
127
|
+
className: statusClasses,
|
128
|
+
color: color,
|
129
|
+
mr: "md"
|
130
|
+
}), ___EmotionJSX(Text, {
|
124
131
|
className: statusClasses,
|
125
132
|
color: color,
|
126
133
|
mr: "md"
|
@@ -5,7 +5,6 @@ import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
|
5
5
|
import React from 'react';
|
6
6
|
import { Item } from '@react-stately/collections';
|
7
7
|
import userEvent from '@testing-library/user-event';
|
8
|
-
import AccountIcon from 'mdi-react/AccountIcon';
|
9
8
|
import axeTest from '../../utils/testUtils/testAxe';
|
10
9
|
import { render, screen } from '../../utils/testUtils/testWrapper';
|
11
10
|
import Messages, { messagesReducerStory, multiMessagesReducerStory } from '.';
|
@@ -147,14 +146,4 @@ test('should render messages with multiMessagesReducerStory', function () {
|
|
147
146
|
getComponent();
|
148
147
|
multiMessagesReducerStory.actions.showSuccessMessage();
|
149
148
|
expect(screen.getByTestId(testId)).toBeInTheDocument();
|
150
|
-
});
|
151
|
-
test('should render a custom icon', function () {
|
152
|
-
getWithDynamicList({
|
153
|
-
items: [{
|
154
|
-
key: 'message1',
|
155
|
-
text: 'test text',
|
156
|
-
icon: AccountIcon
|
157
|
-
}]
|
158
|
-
});
|
159
|
-
screen.getByTestId('custom-icon-testid');
|
160
149
|
});
|
package/lib/index.js
CHANGED
@@ -22,8 +22,6 @@ export { default as Bracket } from './components/Bracket';
|
|
22
22
|
export * from './components/Bracket';
|
23
23
|
export { default as Breadcrumbs } from './components/Breadcrumbs';
|
24
24
|
export * from './components/Breadcrumbs';
|
25
|
-
export { default as Bulletin } from './components/Bulletin';
|
26
|
-
export * from './components/Bulletin';
|
27
25
|
export { default as Button } from './components/Button';
|
28
26
|
export * from './components/Button';
|
29
27
|
export { default as Card } from './components/Card';
|
@@ -35,12 +35,10 @@ import table from './table';
|
|
35
35
|
import * as tabs from './tabs';
|
36
36
|
import tooltip from './tooltip';
|
37
37
|
import collapsiblePanel from './collapsiblePanel';
|
38
|
-
import bulletin from './bulletin';
|
39
38
|
import dataTable from './../../components/DataTable/DataTable.styles';
|
40
39
|
export default _objectSpread(_objectSpread({
|
41
40
|
accordion: accordion,
|
42
41
|
boxes: boxes,
|
43
|
-
bulletin: bulletin,
|
44
42
|
codeView: codeView,
|
45
43
|
images: images,
|
46
44
|
imageUpload: imageUpload,
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@pingux/astro",
|
3
|
-
"version": "1.38.
|
3
|
+
"version": "1.38.1",
|
4
4
|
"description": "PingUX themeable React component library",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
@@ -17,6 +17,7 @@
|
|
17
17
|
"lib"
|
18
18
|
],
|
19
19
|
"scripts": {
|
20
|
+
"append-version": "node ../../append_current_version.js",
|
20
21
|
"build": "rm -rf lib && npm-run-all build:*",
|
21
22
|
"build:cjs": "BABEL_ENV=cjs babel --config-file ./babel.config.js ./src --out-dir lib/cjs",
|
22
23
|
"build:esm": "BABEL_ENV=esm babel --config-file ./babel.config.js ./src --out-dir lib/",
|
@@ -1,93 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
4
|
-
|
5
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
6
|
-
|
7
|
-
_Object$defineProperty(exports, "__esModule", {
|
8
|
-
value: true
|
9
|
-
});
|
10
|
-
|
11
|
-
exports["default"] = exports.BULLETIN_TEST_ID = void 0;
|
12
|
-
|
13
|
-
var _values = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/values"));
|
14
|
-
|
15
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
16
|
-
|
17
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/objectWithoutProperties"));
|
18
|
-
|
19
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
20
|
-
|
21
|
-
var _react = _interopRequireDefault(require("react"));
|
22
|
-
|
23
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
24
|
-
|
25
|
-
var _ = require("../..");
|
26
|
-
|
27
|
-
var _statuses = _interopRequireDefault(require("../../utils/devUtils/constants/statuses"));
|
28
|
-
|
29
|
-
var _NoticeIcon = require("../Icon/NoticeIcon");
|
30
|
-
|
31
|
-
var _react2 = require("@emotion/react");
|
32
|
-
|
33
|
-
var _excluded = ["children", "status"];
|
34
|
-
|
35
|
-
var _bulletinProps;
|
36
|
-
|
37
|
-
var BULLETIN_TEST_ID = 'bulletinTestId';
|
38
|
-
exports.BULLETIN_TEST_ID = BULLETIN_TEST_ID;
|
39
|
-
var bulletinProps = (_bulletinProps = {}, (0, _defineProperty2["default"])(_bulletinProps, _statuses["default"].DEFAULT, {
|
40
|
-
color: 'text.secondary',
|
41
|
-
variant: 'bulletin.base'
|
42
|
-
}), (0, _defineProperty2["default"])(_bulletinProps, _statuses["default"].ERROR, {
|
43
|
-
color: 'critical.bright',
|
44
|
-
variant: 'bulletin.error'
|
45
|
-
}), (0, _defineProperty2["default"])(_bulletinProps, _statuses["default"].SUCCESS, {
|
46
|
-
color: 'success.bright',
|
47
|
-
variant: 'bulletin.success'
|
48
|
-
}), (0, _defineProperty2["default"])(_bulletinProps, _statuses["default"].WARNING, {
|
49
|
-
color: 'warning.bright',
|
50
|
-
variant: 'bulletin.warning'
|
51
|
-
}), _bulletinProps);
|
52
|
-
var defaultIconProps = {
|
53
|
-
mr: 'md',
|
54
|
-
ml: 'md',
|
55
|
-
size: 'md'
|
56
|
-
};
|
57
|
-
/**
|
58
|
-
*Bulletin is composed of the Box, Icon, and Text components. It's a persistent component
|
59
|
-
that should be placed at the top of panels or above related content. If the Bulletins
|
60
|
-
status is error or warning, the text should include a direct link to instructions on resolving the
|
61
|
-
issue or error.
|
62
|
-
*
|
63
|
-
*Please note, Bulletin is a static component, the [Messages](./?path=/docs/messages) component is
|
64
|
-
recommended if you need to interrupt and notify users of successful/failed actions or
|
65
|
-
give warnings of unexpected events.
|
66
|
-
*/
|
67
|
-
|
68
|
-
var Bulletin = function Bulletin(_ref) {
|
69
|
-
var children = _ref.children,
|
70
|
-
status = _ref.status,
|
71
|
-
others = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
72
|
-
return (0, _react2.jsx)(_.Box, (0, _extends2["default"])({
|
73
|
-
"data-testid": BULLETIN_TEST_ID,
|
74
|
-
isRow: true,
|
75
|
-
role: "note",
|
76
|
-
variant: bulletinProps[status].variant
|
77
|
-
}, others), (0, _react2.jsx)(_NoticeIcon.NoticeIcon, (0, _extends2["default"])({
|
78
|
-
color: bulletinProps[status].color,
|
79
|
-
status: status,
|
80
|
-
"aria-label": "".concat(status, "-icon")
|
81
|
-
}, defaultIconProps)), children);
|
82
|
-
};
|
83
|
-
|
84
|
-
Bulletin.propTypes = {
|
85
|
-
/** Determines the icon and color */
|
86
|
-
status: _propTypes["default"].oneOf((0, _values["default"])(_statuses["default"]))
|
87
|
-
};
|
88
|
-
Bulletin.defaultProps = {
|
89
|
-
status: _statuses["default"].DEFAULT
|
90
|
-
};
|
91
|
-
Bulletin.displayName = 'Bulletin';
|
92
|
-
var _default = Bulletin;
|
93
|
-
exports["default"] = _default;
|
@@ -1,90 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
4
|
-
|
5
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
6
|
-
|
7
|
-
_Object$defineProperty(exports, "__esModule", {
|
8
|
-
value: true
|
9
|
-
});
|
10
|
-
|
11
|
-
exports["default"] = exports.Warning = exports.Success = exports.ErrorStatus = exports.Default = void 0;
|
12
|
-
|
13
|
-
var _values = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/values"));
|
14
|
-
|
15
|
-
var _react = _interopRequireDefault(require("react"));
|
16
|
-
|
17
|
-
var _ = require("../..");
|
18
|
-
|
19
|
-
var _statuses = _interopRequireDefault(require("../../utils/devUtils/constants/statuses"));
|
20
|
-
|
21
|
-
var _Bulletin = _interopRequireDefault(require("./Bulletin"));
|
22
|
-
|
23
|
-
var _react2 = require("@emotion/react");
|
24
|
-
|
25
|
-
var _default = {
|
26
|
-
title: 'Bulletin',
|
27
|
-
component: _Bulletin["default"],
|
28
|
-
argTypes: {
|
29
|
-
status: {
|
30
|
-
control: {
|
31
|
-
type: 'select',
|
32
|
-
options: (0, _values["default"])(_statuses["default"])
|
33
|
-
}
|
34
|
-
}
|
35
|
-
}
|
36
|
-
}; // main
|
37
|
-
|
38
|
-
exports["default"] = _default;
|
39
|
-
|
40
|
-
var Default = function Default(args) {
|
41
|
-
return (0, _react2.jsx)(_Bulletin["default"], args, (0, _react2.jsx)(_.Text, null, "You should be aware of this. It might be good or bad, I don\u2019t know. You may already be aware of it, but I want to be sure", (0, _react2.jsx)(_.Link, {
|
42
|
-
href: "https://pingidentity.com",
|
43
|
-
target: "_blank",
|
44
|
-
"aria-label": "".concat(_statuses["default"].DEFAULT, "-bulletin"),
|
45
|
-
variant: "app"
|
46
|
-
}, " Read More")));
|
47
|
-
};
|
48
|
-
|
49
|
-
exports.Default = Default;
|
50
|
-
|
51
|
-
var ErrorStatus = function ErrorStatus() {
|
52
|
-
return (0, _react2.jsx)(_Bulletin["default"], {
|
53
|
-
status: _statuses["default"].ERROR
|
54
|
-
}, (0, _react2.jsx)(_.Text, null, "You\u2019ve got problems. Allow me to tell you about them in some detail so that you can address them", (0, _react2.jsx)(_.Link, {
|
55
|
-
href: "https://pingidentity.com",
|
56
|
-
target: "_blank",
|
57
|
-
"aria-label": "".concat(_statuses["default"].ERROR, "-bulletin"),
|
58
|
-
variant: "app"
|
59
|
-
}, " Read More")));
|
60
|
-
}; // Avoiding using Error as the function name due to it being a JS built-in method
|
61
|
-
|
62
|
-
|
63
|
-
exports.ErrorStatus = ErrorStatus;
|
64
|
-
ErrorStatus.storyName = 'Error';
|
65
|
-
|
66
|
-
var Success = function Success() {
|
67
|
-
return (0, _react2.jsx)(_Bulletin["default"], {
|
68
|
-
status: _statuses["default"].SUCCESS
|
69
|
-
}, (0, _react2.jsx)(_.Text, null, "It Worked! Maybe there is something else related to it working that I need to explain", (0, _react2.jsx)(_.Link, {
|
70
|
-
href: "https://pingidentity.com",
|
71
|
-
target: "_blank",
|
72
|
-
"aria-label": "".concat(_statuses["default"].SUCCESS, "-bulletin"),
|
73
|
-
variant: "app"
|
74
|
-
}, " Read More")));
|
75
|
-
};
|
76
|
-
|
77
|
-
exports.Success = Success;
|
78
|
-
|
79
|
-
var Warning = function Warning() {
|
80
|
-
return (0, _react2.jsx)(_Bulletin["default"], {
|
81
|
-
status: _statuses["default"].WARNING
|
82
|
-
}, (0, _react2.jsx)(_.Text, null, "You\u2019ve got issues. Allow me to tell you about them in some detail so that you can address them. I\u2019ll continue to type enough text to demonstrate that the Bulletin box will grow in height with the content", (0, _react2.jsx)(_.Link, {
|
83
|
-
href: "https://pingidentity.com",
|
84
|
-
target: "_blank",
|
85
|
-
"aria-label": "".concat(_statuses["default"].WARNING, "-bulletin"),
|
86
|
-
variant: "app"
|
87
|
-
}, " Read More")));
|
88
|
-
};
|
89
|
-
|
90
|
-
exports.Warning = Warning;
|
@@ -1,70 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var _typeof = require("@babel/runtime-corejs3/helpers/typeof");
|
4
|
-
|
5
|
-
var _WeakMap = require("@babel/runtime-corejs3/core-js-stable/weak-map");
|
6
|
-
|
7
|
-
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
8
|
-
|
9
|
-
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
|
10
|
-
|
11
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
12
|
-
|
13
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
14
|
-
|
15
|
-
var _react = _interopRequireDefault(require("react"));
|
16
|
-
|
17
|
-
var _react2 = require("@testing-library/react");
|
18
|
-
|
19
|
-
var _statuses = _interopRequireDefault(require("../../utils/devUtils/constants/statuses"));
|
20
|
-
|
21
|
-
var _testWrapper = require("../../utils/testUtils/testWrapper");
|
22
|
-
|
23
|
-
var _NoticeIcon = require("../Icon/NoticeIcon");
|
24
|
-
|
25
|
-
var _Bulletin = _interopRequireWildcard(require("./Bulletin"));
|
26
|
-
|
27
|
-
var _react3 = require("@emotion/react");
|
28
|
-
|
29
|
-
var _testColors;
|
30
|
-
|
31
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
32
|
-
|
33
|
-
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; }
|
34
|
-
|
35
|
-
var TEST_TEXT = 'test text';
|
36
|
-
var testColors = (_testColors = {}, (0, _defineProperty2["default"])(_testColors, _statuses["default"].DEFAULT, 'var(--theme-ui-colors-text-secondary)'), (0, _defineProperty2["default"])(_testColors, _statuses["default"].ERROR, 'var(--theme-ui-colors-critical-bright)'), (0, _defineProperty2["default"])(_testColors, _statuses["default"].SUCCESS, 'var(--theme-ui-colors-success-bright)'), (0, _defineProperty2["default"])(_testColors, _statuses["default"].WARNING, 'var(--theme-ui-colors-warning-bright)'), _testColors);
|
37
|
-
|
38
|
-
var getComponent = function getComponent() {
|
39
|
-
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
40
|
-
return (0, _testWrapper.render)((0, _react3.jsx)(_Bulletin["default"], props, TEST_TEXT));
|
41
|
-
};
|
42
|
-
|
43
|
-
describe('Bulletin', function () {
|
44
|
-
test('renders', function () {
|
45
|
-
getComponent();
|
46
|
-
|
47
|
-
_react2.screen.getByText(TEST_TEXT);
|
48
|
-
});
|
49
|
-
test('renders the default color', function () {
|
50
|
-
getComponent();
|
51
|
-
expect(_react2.screen.getByTestId(_Bulletin.BULLETIN_TEST_ID)).toHaveStyle({
|
52
|
-
'border-color': testColors[_statuses["default"].DEFAULT]
|
53
|
-
});
|
54
|
-
});
|
55
|
-
test.each([[_statuses["default"].DEFAULT, testColors[_statuses["default"].DEFAULT]], [_statuses["default"].ERROR, testColors[_statuses["default"].ERROR]], [_statuses["default"].SUCCESS, testColors[_statuses["default"].SUCCESS]], [_statuses["default"].WARNING, testColors[_statuses["default"].WARNING]]])('when given status %s it renders Bulletin with color %s', function (status, expected) {
|
56
|
-
getComponent({
|
57
|
-
status: status
|
58
|
-
});
|
59
|
-
expect(_react2.screen.getByTestId(_Bulletin.BULLETIN_TEST_ID)).toHaveStyle({
|
60
|
-
'border-color': expected
|
61
|
-
});
|
62
|
-
});
|
63
|
-
test.each([[_statuses["default"].DEFAULT, _NoticeIcon.noticeIcons[_statuses["default"].DEFAULT].testid], [_statuses["default"].ERROR, _NoticeIcon.noticeIcons[_statuses["default"].ERROR].testid], [_statuses["default"].SUCCESS, _NoticeIcon.noticeIcons[_statuses["default"].SUCCESS].testid], [_statuses["default"].WARNING, _NoticeIcon.noticeIcons[_statuses["default"].WARNING].testid]])('when given status %s it renders %s', function (status, icon) {
|
64
|
-
getComponent({
|
65
|
-
status: status
|
66
|
-
});
|
67
|
-
|
68
|
-
_react2.screen.getByTestId(icon);
|
69
|
-
});
|
70
|
-
});
|
@@ -1,18 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
4
|
-
|
5
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
6
|
-
|
7
|
-
_Object$defineProperty(exports, "__esModule", {
|
8
|
-
value: true
|
9
|
-
});
|
10
|
-
|
11
|
-
_Object$defineProperty(exports, "default", {
|
12
|
-
enumerable: true,
|
13
|
-
get: function get() {
|
14
|
-
return _Bulletin["default"];
|
15
|
-
}
|
16
|
-
});
|
17
|
-
|
18
|
-
var _Bulletin = _interopRequireDefault(require("./Bulletin"));
|
@@ -1,71 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
4
|
-
|
5
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
6
|
-
|
7
|
-
_Object$defineProperty(exports, "__esModule", {
|
8
|
-
value: true
|
9
|
-
});
|
10
|
-
|
11
|
-
exports.noticeIcons = exports.NoticeIcon = void 0;
|
12
|
-
|
13
|
-
var _values = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/values"));
|
14
|
-
|
15
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
16
|
-
|
17
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/objectWithoutProperties"));
|
18
|
-
|
19
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
20
|
-
|
21
|
-
var _react = _interopRequireDefault(require("react"));
|
22
|
-
|
23
|
-
var _AlertCircleIcon = _interopRequireDefault(require("mdi-react/AlertCircleIcon"));
|
24
|
-
|
25
|
-
var _AlertIcon = _interopRequireDefault(require("mdi-react/AlertIcon"));
|
26
|
-
|
27
|
-
var _CheckCircleIcon = _interopRequireDefault(require("mdi-react/CheckCircleIcon"));
|
28
|
-
|
29
|
-
var _InformationIcon = _interopRequireDefault(require("mdi-react/InformationIcon"));
|
30
|
-
|
31
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
32
|
-
|
33
|
-
var _ = require("../..");
|
34
|
-
|
35
|
-
var _statuses = _interopRequireDefault(require("../../utils/devUtils/constants/statuses"));
|
36
|
-
|
37
|
-
var _react2 = require("@emotion/react");
|
38
|
-
|
39
|
-
var _excluded = ["status"];
|
40
|
-
|
41
|
-
var _noticeIcons;
|
42
|
-
|
43
|
-
var noticeIcons = (_noticeIcons = {}, (0, _defineProperty2["default"])(_noticeIcons, _statuses["default"].DEFAULT, {
|
44
|
-
icon: _InformationIcon["default"],
|
45
|
-
testid: 'default-icon-testid'
|
46
|
-
}), (0, _defineProperty2["default"])(_noticeIcons, _statuses["default"].ERROR, {
|
47
|
-
icon: _AlertCircleIcon["default"],
|
48
|
-
testid: 'error-icon-testid'
|
49
|
-
}), (0, _defineProperty2["default"])(_noticeIcons, _statuses["default"].SUCCESS, {
|
50
|
-
icon: _CheckCircleIcon["default"],
|
51
|
-
testid: 'success-icon-testid'
|
52
|
-
}), (0, _defineProperty2["default"])(_noticeIcons, _statuses["default"].WARNING, {
|
53
|
-
icon: _AlertIcon["default"],
|
54
|
-
testid: 'warning-icon-testid'
|
55
|
-
}), _noticeIcons);
|
56
|
-
exports.noticeIcons = noticeIcons;
|
57
|
-
|
58
|
-
var NoticeIcon = function NoticeIcon(_ref) {
|
59
|
-
var _ref$status = _ref.status,
|
60
|
-
status = _ref$status === void 0 ? _statuses["default"].DEFAULT : _ref$status,
|
61
|
-
others = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
62
|
-
return (0, _react2.jsx)(_.Icon, (0, _extends2["default"])({
|
63
|
-
"data-testid": noticeIcons[status].testid,
|
64
|
-
icon: noticeIcons[status].icon
|
65
|
-
}, others));
|
66
|
-
};
|
67
|
-
|
68
|
-
exports.NoticeIcon = NoticeIcon;
|
69
|
-
NoticeIcon.propTypes = {
|
70
|
-
status: _propTypes["default"].oneOf((0, _values["default"])(_statuses["default"]))
|
71
|
-
};
|
@@ -1,35 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
4
|
-
|
5
|
-
var _react = _interopRequireDefault(require("react"));
|
6
|
-
|
7
|
-
var _react2 = require("@testing-library/react");
|
8
|
-
|
9
|
-
var _statuses = _interopRequireDefault(require("../../utils/devUtils/constants/statuses"));
|
10
|
-
|
11
|
-
var _testWrapper = require("../../utils/testUtils/testWrapper");
|
12
|
-
|
13
|
-
var _NoticeIcon = require("./NoticeIcon");
|
14
|
-
|
15
|
-
var _react3 = require("@emotion/react");
|
16
|
-
|
17
|
-
var getComponent = function getComponent() {
|
18
|
-
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
19
|
-
return (0, _testWrapper.render)((0, _react3.jsx)(_NoticeIcon.NoticeIcon, props));
|
20
|
-
};
|
21
|
-
|
22
|
-
describe('NoticeIcon', function () {
|
23
|
-
test('renders', function () {
|
24
|
-
getComponent();
|
25
|
-
|
26
|
-
_react2.screen.getByTestId(_NoticeIcon.noticeIcons[_statuses["default"].DEFAULT].testid);
|
27
|
-
});
|
28
|
-
test.each([[_statuses["default"].DEFAULT, _NoticeIcon.noticeIcons[_statuses["default"].DEFAULT].testid], [_statuses["default"].ERROR, _NoticeIcon.noticeIcons[_statuses["default"].ERROR].testid], [_statuses["default"].SUCCESS, _NoticeIcon.noticeIcons[_statuses["default"].SUCCESS].testid], [_statuses["default"].WARNING, _NoticeIcon.noticeIcons[_statuses["default"].WARNING].testid]])('when given status %s it renders icon with %s', function (status, icon) {
|
29
|
-
getComponent({
|
30
|
-
status: status
|
31
|
-
});
|
32
|
-
|
33
|
-
_react2.screen.getByTestId(icon);
|
34
|
-
});
|
35
|
-
});
|
@@ -1,60 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var _Object$keys = require("@babel/runtime-corejs3/core-js-stable/object/keys");
|
4
|
-
|
5
|
-
var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols");
|
6
|
-
|
7
|
-
var _filterInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/filter");
|
8
|
-
|
9
|
-
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
|
10
|
-
|
11
|
-
var _forEachInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/for-each");
|
12
|
-
|
13
|
-
var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors");
|
14
|
-
|
15
|
-
var _Object$defineProperties = require("@babel/runtime-corejs3/core-js-stable/object/define-properties");
|
16
|
-
|
17
|
-
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
18
|
-
|
19
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
20
|
-
|
21
|
-
_Object$defineProperty(exports, "__esModule", {
|
22
|
-
value: true
|
23
|
-
});
|
24
|
-
|
25
|
-
exports["default"] = void 0;
|
26
|
-
|
27
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
28
|
-
|
29
|
-
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
30
|
-
|
31
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(source), !0)).call(_context, function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
32
|
-
|
33
|
-
var base = {
|
34
|
-
alignItems: 'center',
|
35
|
-
border: '1px solid',
|
36
|
-
borderColor: 'text.secondary',
|
37
|
-
fontSize: 'md',
|
38
|
-
p: '15px 12px 15px 0',
|
39
|
-
width: '600px'
|
40
|
-
};
|
41
|
-
|
42
|
-
var error = _objectSpread(_objectSpread({}, base), {}, {
|
43
|
-
borderColor: 'critical.bright'
|
44
|
-
});
|
45
|
-
|
46
|
-
var success = _objectSpread(_objectSpread({}, base), {}, {
|
47
|
-
borderColor: 'success.bright'
|
48
|
-
});
|
49
|
-
|
50
|
-
var warning = _objectSpread(_objectSpread({}, base), {}, {
|
51
|
-
borderColor: 'warning.bright'
|
52
|
-
});
|
53
|
-
|
54
|
-
var _default = {
|
55
|
-
base: base,
|
56
|
-
error: error,
|
57
|
-
success: success,
|
58
|
-
warning: warning
|
59
|
-
};
|
60
|
-
exports["default"] = _default;
|
@@ -1,70 +0,0 @@
|
|
1
|
-
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
2
|
-
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
3
|
-
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
4
|
-
var _excluded = ["children", "status"];
|
5
|
-
|
6
|
-
var _bulletinProps;
|
7
|
-
|
8
|
-
import _Object$values from "@babel/runtime-corejs3/core-js-stable/object/values";
|
9
|
-
import React from 'react';
|
10
|
-
import PropTypes from 'prop-types';
|
11
|
-
import { Box } from '../..';
|
12
|
-
import statuses from '../../utils/devUtils/constants/statuses';
|
13
|
-
import { NoticeIcon } from '../Icon/NoticeIcon';
|
14
|
-
import { jsx as ___EmotionJSX } from "@emotion/react";
|
15
|
-
export var BULLETIN_TEST_ID = 'bulletinTestId';
|
16
|
-
var bulletinProps = (_bulletinProps = {}, _defineProperty(_bulletinProps, statuses.DEFAULT, {
|
17
|
-
color: 'text.secondary',
|
18
|
-
variant: 'bulletin.base'
|
19
|
-
}), _defineProperty(_bulletinProps, statuses.ERROR, {
|
20
|
-
color: 'critical.bright',
|
21
|
-
variant: 'bulletin.error'
|
22
|
-
}), _defineProperty(_bulletinProps, statuses.SUCCESS, {
|
23
|
-
color: 'success.bright',
|
24
|
-
variant: 'bulletin.success'
|
25
|
-
}), _defineProperty(_bulletinProps, statuses.WARNING, {
|
26
|
-
color: 'warning.bright',
|
27
|
-
variant: 'bulletin.warning'
|
28
|
-
}), _bulletinProps);
|
29
|
-
var defaultIconProps = {
|
30
|
-
mr: 'md',
|
31
|
-
ml: 'md',
|
32
|
-
size: 'md'
|
33
|
-
};
|
34
|
-
/**
|
35
|
-
*Bulletin is composed of the Box, Icon, and Text components. It's a persistent component
|
36
|
-
that should be placed at the top of panels or above related content. If the Bulletins
|
37
|
-
status is error or warning, the text should include a direct link to instructions on resolving the
|
38
|
-
issue or error.
|
39
|
-
*
|
40
|
-
*Please note, Bulletin is a static component, the [Messages](./?path=/docs/messages) component is
|
41
|
-
recommended if you need to interrupt and notify users of successful/failed actions or
|
42
|
-
give warnings of unexpected events.
|
43
|
-
*/
|
44
|
-
|
45
|
-
var Bulletin = function Bulletin(_ref) {
|
46
|
-
var children = _ref.children,
|
47
|
-
status = _ref.status,
|
48
|
-
others = _objectWithoutProperties(_ref, _excluded);
|
49
|
-
|
50
|
-
return ___EmotionJSX(Box, _extends({
|
51
|
-
"data-testid": BULLETIN_TEST_ID,
|
52
|
-
isRow: true,
|
53
|
-
role: "note",
|
54
|
-
variant: bulletinProps[status].variant
|
55
|
-
}, others), ___EmotionJSX(NoticeIcon, _extends({
|
56
|
-
color: bulletinProps[status].color,
|
57
|
-
status: status,
|
58
|
-
"aria-label": "".concat(status, "-icon")
|
59
|
-
}, defaultIconProps)), children);
|
60
|
-
};
|
61
|
-
|
62
|
-
Bulletin.propTypes = {
|
63
|
-
/** Determines the icon and color */
|
64
|
-
status: PropTypes.oneOf(_Object$values(statuses))
|
65
|
-
};
|
66
|
-
Bulletin.defaultProps = {
|
67
|
-
status: statuses.DEFAULT
|
68
|
-
};
|
69
|
-
Bulletin.displayName = 'Bulletin';
|
70
|
-
export default Bulletin;
|