@pingux/astro 1.40.0-alpha.0 → 1.40.1-alpha.0
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 +16 -0
- package/lib/cjs/components/{Bulletin/Bulletin.js → Callout/Callout.js} +26 -26
- package/lib/cjs/components/{Bulletin/Bulletin.stories.js → Callout/Callout.stories.js} +11 -13
- package/lib/cjs/components/{Bulletin/Bulletin.test.js → Callout/Callout.test.js} +6 -6
- package/lib/cjs/components/{Bulletin → Callout}/index.js +2 -2
- package/lib/cjs/components/CopyText/CopyText.js +1 -1
- package/lib/cjs/components/EnvironmentBreadcrumb/EnvironmentBreadcrumb.js +7 -8
- package/lib/cjs/components/EnvironmentBreadcrumb/EnvironmentBreadcrumb.test.js +55 -14
- package/lib/cjs/index.js +13 -5
- package/lib/cjs/styles/variants/boxes.js +2 -1
- package/lib/cjs/styles/variants/{bulletin.js → callout.js} +0 -0
- package/lib/cjs/styles/variants/variants.js +17 -18
- package/lib/components/{Bulletin/Bulletin.js → Callout/Callout.js} +24 -24
- package/lib/components/{Bulletin/Bulletin.stories.js → Callout/Callout.stories.js} +12 -13
- package/lib/components/{Bulletin/Bulletin.test.js → Callout/Callout.test.js} +6 -6
- package/lib/components/Callout/index.js +1 -0
- package/lib/components/CopyText/CopyText.js +1 -1
- package/lib/components/EnvironmentBreadcrumb/EnvironmentBreadcrumb.js +8 -8
- package/lib/components/EnvironmentBreadcrumb/EnvironmentBreadcrumb.test.js +52 -15
- package/lib/index.js +3 -2
- package/lib/styles/variants/boxes.js +2 -1
- package/lib/styles/variants/{bulletin.js → callout.js} +0 -0
- package/lib/styles/variants/variants.js +13 -14
- package/package.json +1 -1
- package/lib/components/Bulletin/index.js +0 -1
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,22 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
+
# [1.40.0](https://gitlab.corp.pingidentity.com/ux/pingux/compare/@pingux/astro@1.39.2...@pingux/astro@1.40.0) (2023-01-17)
|
7
|
+
|
8
|
+
|
9
|
+
### Bug Fixes
|
10
|
+
|
11
|
+
* [UIP-5988] Badge Variant Path Updates ([053d1b5](https://gitlab.corp.pingidentity.com/ux/pingux/commit/053d1b5a3273864ad095f5585af4125c02bb632a))
|
12
|
+
|
13
|
+
|
14
|
+
### Features
|
15
|
+
|
16
|
+
* [UIP-5987] Custom scrollbar colors for NavBar ([8a144ae](https://gitlab.corp.pingidentity.com/ux/pingux/commit/8a144aef93c4fbd1ccc5c8a06304b7cff2e5482f))
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
|
6
22
|
## [1.39.2](https://gitlab.corp.pingidentity.com/ux/pingux/compare/@pingux/astro@1.39.1...@pingux/astro@1.39.2) (2023-01-12)
|
7
23
|
|
8
24
|
|
@@ -8,7 +8,7 @@ _Object$defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
9
9
|
});
|
10
10
|
|
11
|
-
exports["default"] = exports.
|
11
|
+
exports["default"] = exports.CALLOUT_TEST_ID = void 0;
|
12
12
|
|
13
13
|
var _values = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/values"));
|
14
14
|
|
@@ -32,62 +32,62 @@ var _react2 = require("@emotion/react");
|
|
32
32
|
|
33
33
|
var _excluded = ["children", "status"];
|
34
34
|
|
35
|
-
var
|
35
|
+
var _calloutProps;
|
36
36
|
|
37
|
-
var
|
38
|
-
exports.
|
39
|
-
var
|
37
|
+
var CALLOUT_TEST_ID = 'CalloutTestId';
|
38
|
+
exports.CALLOUT_TEST_ID = CALLOUT_TEST_ID;
|
39
|
+
var calloutProps = (_calloutProps = {}, (0, _defineProperty2["default"])(_calloutProps, _statuses["default"].DEFAULT, {
|
40
40
|
color: 'text.secondary',
|
41
|
-
variant: '
|
42
|
-
}), (0, _defineProperty2["default"])(
|
41
|
+
variant: 'callout.base'
|
42
|
+
}), (0, _defineProperty2["default"])(_calloutProps, _statuses["default"].ERROR, {
|
43
43
|
color: 'critical.bright',
|
44
|
-
variant: '
|
45
|
-
}), (0, _defineProperty2["default"])(
|
44
|
+
variant: 'callout.error'
|
45
|
+
}), (0, _defineProperty2["default"])(_calloutProps, _statuses["default"].SUCCESS, {
|
46
46
|
color: 'success.bright',
|
47
|
-
variant: '
|
48
|
-
}), (0, _defineProperty2["default"])(
|
47
|
+
variant: 'callout.success'
|
48
|
+
}), (0, _defineProperty2["default"])(_calloutProps, _statuses["default"].WARNING, {
|
49
49
|
color: 'warning.bright',
|
50
|
-
variant: '
|
51
|
-
}),
|
50
|
+
variant: 'callout.warning'
|
51
|
+
}), _calloutProps);
|
52
52
|
var defaultIconProps = {
|
53
53
|
mr: 'md',
|
54
54
|
ml: 'md',
|
55
55
|
size: 'md'
|
56
56
|
};
|
57
57
|
/**
|
58
|
-
*
|
59
|
-
that should be placed at the top of panels or above related content. If the
|
58
|
+
*Callout 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 Callouts
|
60
60
|
status is error or warning, the text should include a direct link to instructions on resolving the
|
61
61
|
issue or error.
|
62
62
|
*
|
63
|
-
*Please note,
|
64
|
-
recommended if you need to interrupt and notify users of successful/failed actions
|
65
|
-
give warnings of unexpected events.
|
63
|
+
*Please note, Callout is a static component, the [Messages](./?path=/docs/components-messages)
|
64
|
+
component is recommended if you need to interrupt and notify users of successful/failed actions
|
65
|
+
or give warnings of unexpected events.
|
66
66
|
*/
|
67
67
|
|
68
|
-
var
|
68
|
+
var Callout = function Callout(_ref) {
|
69
69
|
var children = _ref.children,
|
70
70
|
status = _ref.status,
|
71
71
|
others = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
72
72
|
return (0, _react2.jsx)(_.Box, (0, _extends2["default"])({
|
73
|
-
"data-testid":
|
73
|
+
"data-testid": CALLOUT_TEST_ID,
|
74
74
|
isRow: true,
|
75
75
|
role: "note",
|
76
|
-
variant:
|
76
|
+
variant: calloutProps[status].variant
|
77
77
|
}, others), (0, _react2.jsx)(_NoticeIcon.NoticeIcon, (0, _extends2["default"])({
|
78
|
-
color:
|
78
|
+
color: calloutProps[status].color,
|
79
79
|
status: status,
|
80
80
|
"aria-label": "".concat(status, "-icon")
|
81
81
|
}, defaultIconProps)), children);
|
82
82
|
};
|
83
83
|
|
84
|
-
|
84
|
+
Callout.propTypes = {
|
85
85
|
/** Determines the icon and color */
|
86
86
|
status: _propTypes["default"].oneOf((0, _values["default"])(_statuses["default"]))
|
87
87
|
};
|
88
|
-
|
88
|
+
Callout.defaultProps = {
|
89
89
|
status: _statuses["default"].DEFAULT
|
90
90
|
};
|
91
|
-
|
92
|
-
var _default =
|
91
|
+
Callout.displayName = 'Callout';
|
92
|
+
var _default = Callout;
|
93
93
|
exports["default"] = _default;
|
@@ -18,13 +18,11 @@ var _ = require("../..");
|
|
18
18
|
|
19
19
|
var _statuses = _interopRequireDefault(require("../../utils/devUtils/constants/statuses"));
|
20
20
|
|
21
|
-
var _Bulletin = _interopRequireDefault(require("./Bulletin"));
|
22
|
-
|
23
21
|
var _react2 = require("@emotion/react");
|
24
22
|
|
25
23
|
var _default = {
|
26
|
-
title: '
|
27
|
-
component:
|
24
|
+
title: 'Components/Callout',
|
25
|
+
component: _.Callout,
|
28
26
|
argTypes: {
|
29
27
|
status: {
|
30
28
|
control: {
|
@@ -38,10 +36,10 @@ var _default = {
|
|
38
36
|
exports["default"] = _default;
|
39
37
|
|
40
38
|
var Default = function Default(args) {
|
41
|
-
return (0, _react2.jsx)(
|
39
|
+
return (0, _react2.jsx)(_.Callout, 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
40
|
href: "https://pingidentity.com",
|
43
41
|
target: "_blank",
|
44
|
-
"aria-label": "".concat(_statuses["default"].DEFAULT, "-
|
42
|
+
"aria-label": "".concat(_statuses["default"].DEFAULT, "-callout"),
|
45
43
|
variant: "app"
|
46
44
|
}, " Read More")));
|
47
45
|
};
|
@@ -49,12 +47,12 @@ var Default = function Default(args) {
|
|
49
47
|
exports.Default = Default;
|
50
48
|
|
51
49
|
var ErrorStatus = function ErrorStatus() {
|
52
|
-
return (0, _react2.jsx)(
|
50
|
+
return (0, _react2.jsx)(_.Callout, {
|
53
51
|
status: _statuses["default"].ERROR
|
54
52
|
}, (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
53
|
href: "https://pingidentity.com",
|
56
54
|
target: "_blank",
|
57
|
-
"aria-label": "".concat(_statuses["default"].ERROR, "-
|
55
|
+
"aria-label": "".concat(_statuses["default"].ERROR, "-callout"),
|
58
56
|
variant: "app"
|
59
57
|
}, " Read More")));
|
60
58
|
}; // Avoiding using Error as the function name due to it being a JS built-in method
|
@@ -64,12 +62,12 @@ exports.ErrorStatus = ErrorStatus;
|
|
64
62
|
ErrorStatus.storyName = 'Error';
|
65
63
|
|
66
64
|
var Success = function Success() {
|
67
|
-
return (0, _react2.jsx)(
|
65
|
+
return (0, _react2.jsx)(_.Callout, {
|
68
66
|
status: _statuses["default"].SUCCESS
|
69
67
|
}, (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
68
|
href: "https://pingidentity.com",
|
71
69
|
target: "_blank",
|
72
|
-
"aria-label": "".concat(_statuses["default"].SUCCESS, "-
|
70
|
+
"aria-label": "".concat(_statuses["default"].SUCCESS, "-callout"),
|
73
71
|
variant: "app"
|
74
72
|
}, " Read More")));
|
75
73
|
};
|
@@ -77,12 +75,12 @@ var Success = function Success() {
|
|
77
75
|
exports.Success = Success;
|
78
76
|
|
79
77
|
var Warning = function Warning() {
|
80
|
-
return (0, _react2.jsx)(
|
78
|
+
return (0, _react2.jsx)(_.Callout, {
|
81
79
|
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
|
80
|
+
}, (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 Callout box will grow in height with the content", (0, _react2.jsx)(_.Link, {
|
83
81
|
href: "https://pingidentity.com",
|
84
82
|
target: "_blank",
|
85
|
-
"aria-label": "".concat(_statuses["default"].WARNING, "-
|
83
|
+
"aria-label": "".concat(_statuses["default"].WARNING, "-callout"),
|
86
84
|
variant: "app"
|
87
85
|
}, " Read More")));
|
88
86
|
};
|
@@ -22,7 +22,7 @@ var _testWrapper = require("../../utils/testUtils/testWrapper");
|
|
22
22
|
|
23
23
|
var _NoticeIcon = require("../Icon/NoticeIcon");
|
24
24
|
|
25
|
-
var
|
25
|
+
var _Callout = _interopRequireWildcard(require("./Callout"));
|
26
26
|
|
27
27
|
var _react3 = require("@emotion/react");
|
28
28
|
|
@@ -37,10 +37,10 @@ var testColors = (_testColors = {}, (0, _defineProperty2["default"])(_testColors
|
|
37
37
|
|
38
38
|
var getComponent = function getComponent() {
|
39
39
|
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
40
|
-
return (0, _testWrapper.render)((0, _react3.jsx)(
|
40
|
+
return (0, _testWrapper.render)((0, _react3.jsx)(_Callout["default"], props, TEST_TEXT));
|
41
41
|
};
|
42
42
|
|
43
|
-
describe('
|
43
|
+
describe('Callout', function () {
|
44
44
|
test('renders', function () {
|
45
45
|
getComponent();
|
46
46
|
|
@@ -48,15 +48,15 @@ describe('Bulletin', function () {
|
|
48
48
|
});
|
49
49
|
test('renders the default color', function () {
|
50
50
|
getComponent();
|
51
|
-
expect(_react2.screen.getByTestId(
|
51
|
+
expect(_react2.screen.getByTestId(_Callout.CALLOUT_TEST_ID)).toHaveStyle({
|
52
52
|
'border-color': testColors[_statuses["default"].DEFAULT]
|
53
53
|
});
|
54
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
|
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 Callout with color %s', function (status, expected) {
|
56
56
|
getComponent({
|
57
57
|
status: status
|
58
58
|
});
|
59
|
-
expect(_react2.screen.getByTestId(
|
59
|
+
expect(_react2.screen.getByTestId(_Callout.CALLOUT_TEST_ID)).toHaveStyle({
|
60
60
|
'border-color': expected
|
61
61
|
});
|
62
62
|
});
|
@@ -11,8 +11,8 @@ _Object$defineProperty(exports, "__esModule", {
|
|
11
11
|
_Object$defineProperty(exports, "default", {
|
12
12
|
enumerable: true,
|
13
13
|
get: function get() {
|
14
|
-
return
|
14
|
+
return _Callout["default"];
|
15
15
|
}
|
16
16
|
});
|
17
17
|
|
18
|
-
var
|
18
|
+
var _Callout = _interopRequireDefault(require("./Callout"));
|
@@ -186,7 +186,7 @@ var CopyText = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
186
186
|
ref: pressableRef
|
187
187
|
}, (0, _utils.mergeProps)(hoverProps, pressableProps), {
|
188
188
|
sx: {
|
189
|
-
width: '
|
189
|
+
width: 'fit-content'
|
190
190
|
}
|
191
191
|
}), (0, _react2.jsx)(_index.Box, (0, _extends2["default"])({
|
192
192
|
ref: ref,
|
@@ -145,22 +145,21 @@ var EnvironmentBreadcrumb = /*#__PURE__*/(0, _react.forwardRef)(function (props,
|
|
145
145
|
var filterNodesWithChildren = function filterNodesWithChildren(iterableNode) {
|
146
146
|
var nodeArr = (0, _from["default"])(iterableNode); // with this function we are filtering child items if they have sections
|
147
147
|
// we can't filter items because if it would be a section - we can't change childNodes
|
148
|
-
// eslint-disable-next-line array-callback-return,consistent-return
|
149
148
|
|
150
149
|
var filteredSections = (0, _map["default"])(nodeArr).call(nodeArr, function f(nodeItem) {
|
150
|
+
var _context;
|
151
|
+
|
151
152
|
if ((nodeItem === null || nodeItem === void 0 ? void 0 : nodeItem.type) === 'item') {
|
152
153
|
var _nodeItem$value;
|
153
154
|
|
154
|
-
return contains(nodeItem === null || nodeItem === void 0 ? void 0 : (_nodeItem$value = nodeItem.value) === null || _nodeItem$value === void 0 ? void 0 : _nodeItem$value.name, searchValue)
|
155
|
+
return contains(nodeItem === null || nodeItem === void 0 ? void 0 : (_nodeItem$value = nodeItem.value) === null || _nodeItem$value === void 0 ? void 0 : _nodeItem$value.name, searchValue) && nodeItem;
|
155
156
|
}
|
156
157
|
|
157
|
-
|
158
|
-
var _context;
|
158
|
+
var childNodes = (0, _filter["default"])(_context = (0, _from["default"])(nodeItem.childNodes)).call(_context, f); // Don't return sections without children, see UIP-5951
|
159
159
|
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
}
|
160
|
+
return childNodes.length !== 0 && _objectSpread(_objectSpread({}, nodeItem), {}, {
|
161
|
+
childNodes: childNodes
|
162
|
+
});
|
164
163
|
}); // we are filtering null items here since we were not able to filter them in previous function
|
165
164
|
|
166
165
|
return (0, _filter["default"])(filteredSections).call(filteredSections, function (item) {
|
@@ -8,7 +8,7 @@ var _filterInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/ins
|
|
8
8
|
|
9
9
|
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
|
10
10
|
|
11
|
-
var
|
11
|
+
var _forEachInstanceProperty2 = require("@babel/runtime-corejs3/core-js-stable/instance/for-each");
|
12
12
|
|
13
13
|
var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors");
|
14
14
|
|
@@ -20,6 +20,10 @@ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequ
|
|
20
20
|
|
21
21
|
var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs3/regenerator"));
|
22
22
|
|
23
|
+
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
24
|
+
|
25
|
+
var _forEach = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
|
26
|
+
|
23
27
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/asyncToGenerator"));
|
24
28
|
|
25
29
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
@@ -44,7 +48,7 @@ var _react2 = require("@emotion/react");
|
|
44
48
|
|
45
49
|
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; }
|
46
50
|
|
47
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var
|
51
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context5, _context6; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty2(_context5 = ownKeys(Object(source), !0)).call(_context5, function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty2(_context6 = ownKeys(Object(source))).call(_context6, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
48
52
|
|
49
53
|
var testEnvBreadcrumb = 'test-env-breadcrumb';
|
50
54
|
var testName = 'test-name';
|
@@ -66,6 +70,15 @@ var itemsWithSections = [{
|
|
66
70
|
}, {
|
67
71
|
name: 'Baz'
|
68
72
|
}]
|
73
|
+
}, {
|
74
|
+
name: 'Heading 2',
|
75
|
+
options: [{
|
76
|
+
name: 'Foo'
|
77
|
+
}, {
|
78
|
+
name: 'Zod'
|
79
|
+
}, {
|
80
|
+
name: 'Zay'
|
81
|
+
}]
|
69
82
|
}];
|
70
83
|
var defaultProps = {
|
71
84
|
'data-testid': testEnvBreadcrumb,
|
@@ -106,11 +119,13 @@ var getSectionsComponent = function getSectionsComponent() {
|
|
106
119
|
return (// eslint-disable-next-line testing-library/no-node-access
|
107
120
|
(0, _react2.jsx)(_collections.Section, {
|
108
121
|
key: section.name,
|
109
|
-
|
122
|
+
title: section.name,
|
110
123
|
items: section.options
|
111
124
|
}, function (item) {
|
125
|
+
var _context;
|
126
|
+
|
112
127
|
return (0, _react2.jsx)(_index.Item, {
|
113
|
-
key: item.name,
|
128
|
+
key: (0, _concat["default"])(_context = "".concat(section.name, "-")).call(_context, item.name),
|
114
129
|
childItems: item.options
|
115
130
|
}, item.name);
|
116
131
|
})
|
@@ -199,9 +214,9 @@ test('should not call onNamePress when current env button pressed', function ()
|
|
199
214
|
expect(onNamePressMock).not.toHaveBeenCalled();
|
200
215
|
});
|
201
216
|
test('should render items passed in props', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
202
|
-
return _regenerator["default"].wrap(function _callee$(
|
217
|
+
return _regenerator["default"].wrap(function _callee$(_context2) {
|
203
218
|
while (1) {
|
204
|
-
switch (
|
219
|
+
switch (_context2.prev = _context2.next) {
|
205
220
|
case 0:
|
206
221
|
getComponent();
|
207
222
|
expect(_testWrapper.screen.queryByRole('listbox')).not.toBeInTheDocument();
|
@@ -214,7 +229,7 @@ test('should render items passed in props', /*#__PURE__*/(0, _asyncToGenerator2[
|
|
214
229
|
|
215
230
|
case 6:
|
216
231
|
case "end":
|
217
|
-
return
|
232
|
+
return _context2.stop();
|
218
233
|
}
|
219
234
|
}
|
220
235
|
}, _callee);
|
@@ -226,9 +241,23 @@ test('should render items with sections passed in props', function () {
|
|
226
241
|
|
227
242
|
_userEvent["default"].click(_testWrapper.screen.getByText(testSelectedItem));
|
228
243
|
|
229
|
-
|
244
|
+
var groups = _testWrapper.screen.getAllByRole('group');
|
245
|
+
|
246
|
+
expect(groups).toHaveLength(2);
|
230
247
|
expect(_testWrapper.screen.queryByRole('listbox')).toBeInTheDocument();
|
231
|
-
expect(_testWrapper.screen.queryAllByRole('option')).toHaveLength(
|
248
|
+
expect(_testWrapper.screen.queryAllByRole('option')).toHaveLength(6);
|
249
|
+
(0, _forEach["default"])(groups).call(groups, function (group, index) {
|
250
|
+
var _context3;
|
251
|
+
|
252
|
+
expect(function () {
|
253
|
+
return (0, _testWrapper.within)(group).getByText(itemsWithSections[index].name);
|
254
|
+
});
|
255
|
+
(0, _forEach["default"])(_context3 = itemsWithSections[index].options).call(_context3, function (opt) {
|
256
|
+
return expect(function () {
|
257
|
+
return (0, _testWrapper.within)(group).getByText(opt.name);
|
258
|
+
});
|
259
|
+
});
|
260
|
+
});
|
232
261
|
});
|
233
262
|
test('should call onSelectionChange when env clicked', function () {
|
234
263
|
var onSelectionChangeMock = jest.fn();
|
@@ -313,22 +342,22 @@ test('should show empty state in search if there are no results', function () {
|
|
313
342
|
test('should have no accessibility violations', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
314
343
|
var _getComponent, container, results;
|
315
344
|
|
316
|
-
return _regenerator["default"].wrap(function _callee2$(
|
345
|
+
return _regenerator["default"].wrap(function _callee2$(_context4) {
|
317
346
|
while (1) {
|
318
|
-
switch (
|
347
|
+
switch (_context4.prev = _context4.next) {
|
319
348
|
case 0:
|
320
349
|
jest.useRealTimers();
|
321
350
|
_getComponent = getComponent(), container = _getComponent.container;
|
322
|
-
|
351
|
+
_context4.next = 4;
|
323
352
|
return (0, _jestAxe.axe)(container);
|
324
353
|
|
325
354
|
case 4:
|
326
|
-
results =
|
355
|
+
results = _context4.sent;
|
327
356
|
expect(results).toHaveNoViolations();
|
328
357
|
|
329
358
|
case 6:
|
330
359
|
case "end":
|
331
|
-
return
|
360
|
+
return _context4.stop();
|
332
361
|
}
|
333
362
|
}
|
334
363
|
}, _callee2);
|
@@ -373,4 +402,16 @@ test('should add data-id to dropdown list', function () {
|
|
373
402
|
expect(_testWrapper.screen.getByRole('listbox', {
|
374
403
|
name: 'Items List'
|
375
404
|
})).toHaveAttribute('data-id', _EnvironmentBreadcrumb.breadCrumbDataIds.dropdownList);
|
405
|
+
});
|
406
|
+
test('should hide section title if no search results within it', function () {
|
407
|
+
getSectionsComponent(); // Open popover
|
408
|
+
|
409
|
+
_userEvent["default"].click(_testWrapper.screen.getByText(testSelectedItem)); // Search for option exclusive to only one section
|
410
|
+
|
411
|
+
|
412
|
+
_userEvent["default"].type(_testWrapper.screen.getByRole('searchbox'), 'Zod'); // 'Heading 1' should not be rendered, but 'Heading 2' should be
|
413
|
+
|
414
|
+
|
415
|
+
expect(_testWrapper.screen.queryByText(itemsWithSections[0].name)).not.toBeInTheDocument();
|
416
|
+
expect(_testWrapper.screen.queryByText(itemsWithSections[1].name)).toBeInTheDocument();
|
376
417
|
});
|
package/lib/cjs/index.js
CHANGED
@@ -33,6 +33,7 @@ var _exportNames = {
|
|
33
33
|
Bracket: true,
|
34
34
|
Breadcrumbs: true,
|
35
35
|
Bulletin: true,
|
36
|
+
Callout: true,
|
36
37
|
Button: true,
|
37
38
|
Card: true,
|
38
39
|
Checkbox: true,
|
@@ -197,7 +198,7 @@ _Object$defineProperty(exports, "Breadcrumbs", {
|
|
197
198
|
_Object$defineProperty(exports, "Bulletin", {
|
198
199
|
enumerable: true,
|
199
200
|
get: function get() {
|
200
|
-
return
|
201
|
+
return _Callout["default"];
|
201
202
|
}
|
202
203
|
});
|
203
204
|
|
@@ -208,6 +209,13 @@ _Object$defineProperty(exports, "Button", {
|
|
208
209
|
}
|
209
210
|
});
|
210
211
|
|
212
|
+
_Object$defineProperty(exports, "Callout", {
|
213
|
+
enumerable: true,
|
214
|
+
get: function get() {
|
215
|
+
return _Callout["default"];
|
216
|
+
}
|
217
|
+
});
|
218
|
+
|
211
219
|
_Object$defineProperty(exports, "Card", {
|
212
220
|
enumerable: true,
|
213
221
|
get: function get() {
|
@@ -927,17 +935,17 @@ _forEachInstanceProperty(_context10 = _Object$keys(_Breadcrumbs)).call(_context1
|
|
927
935
|
});
|
928
936
|
});
|
929
937
|
|
930
|
-
var
|
938
|
+
var _Callout = _interopRequireWildcard(require("./components/Callout"));
|
931
939
|
|
932
|
-
_forEachInstanceProperty(_context11 = _Object$keys(
|
940
|
+
_forEachInstanceProperty(_context11 = _Object$keys(_Callout)).call(_context11, function (key) {
|
933
941
|
if (key === "default" || key === "__esModule") return;
|
934
942
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
935
|
-
if (key in exports && exports[key] ===
|
943
|
+
if (key in exports && exports[key] === _Callout[key]) return;
|
936
944
|
|
937
945
|
_Object$defineProperty(exports, key, {
|
938
946
|
enumerable: true,
|
939
947
|
get: function get() {
|
940
|
-
return
|
948
|
+
return _Callout[key];
|
941
949
|
}
|
942
950
|
});
|
943
951
|
});
|
File without changes
|
@@ -34,26 +34,32 @@ var _accordion = _interopRequireDefault(require("./accordion"));
|
|
34
34
|
|
35
35
|
var _boxes = _interopRequireDefault(require("./boxes"));
|
36
36
|
|
37
|
+
var _callout = _interopRequireDefault(require("./callout"));
|
38
|
+
|
37
39
|
var _codeView = _interopRequireDefault(require("./codeView"));
|
38
40
|
|
39
|
-
var
|
41
|
+
var _collapsiblePanel = _interopRequireDefault(require("./collapsiblePanel"));
|
42
|
+
|
43
|
+
var _DataTable = _interopRequireDefault(require("./../../components/DataTable/DataTable.styles"));
|
40
44
|
|
41
45
|
var _imageUpload = _interopRequireDefault(require("./imageUpload"));
|
42
46
|
|
47
|
+
var _images = _interopRequireDefault(require("./images"));
|
48
|
+
|
43
49
|
var _links = _interopRequireDefault(require("./links"));
|
44
50
|
|
45
51
|
var _listBox = _interopRequireDefault(require("./listBox"));
|
46
52
|
|
47
53
|
var _loader = _interopRequireDefault(require("./loader"));
|
48
54
|
|
49
|
-
var _modal = _interopRequireDefault(require("./modal"));
|
50
|
-
|
51
55
|
var _menu = _interopRequireDefault(require("./menu"));
|
52
56
|
|
53
57
|
var _menuItem = _interopRequireDefault(require("./menuItem"));
|
54
58
|
|
55
59
|
var _messages = _interopRequireDefault(require("./messages"));
|
56
60
|
|
61
|
+
var _modal = _interopRequireDefault(require("./modal"));
|
62
|
+
|
57
63
|
var _navBar = _interopRequireDefault(require("./navBar"));
|
58
64
|
|
59
65
|
var _numberField = _interopRequireDefault(require("./numberField"));
|
@@ -74,12 +80,6 @@ var tabs = _interopRequireWildcard(require("./tabs"));
|
|
74
80
|
|
75
81
|
var _tooltip = _interopRequireDefault(require("./tooltip"));
|
76
82
|
|
77
|
-
var _collapsiblePanel = _interopRequireDefault(require("./collapsiblePanel"));
|
78
|
-
|
79
|
-
var _bulletin = _interopRequireDefault(require("./bulletin"));
|
80
|
-
|
81
|
-
var _DataTable = _interopRequireDefault(require("./../../components/DataTable/DataTable.styles"));
|
82
|
-
|
83
83
|
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); }
|
84
84
|
|
85
85
|
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; }
|
@@ -88,21 +88,22 @@ function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (
|
|
88
88
|
|
89
89
|
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; }
|
90
90
|
|
91
|
-
var _default = _objectSpread(_objectSpread({
|
91
|
+
var _default = _objectSpread(_objectSpread({}, tabs), {}, {
|
92
92
|
accordion: _accordion["default"],
|
93
93
|
boxes: _boxes["default"],
|
94
|
-
|
94
|
+
callout: _callout["default"],
|
95
95
|
codeView: _codeView["default"],
|
96
|
-
|
96
|
+
collapsiblePanel: _collapsiblePanel["default"],
|
97
|
+
dataTable: _DataTable["default"],
|
97
98
|
imageUpload: _imageUpload["default"],
|
98
|
-
|
99
|
+
images: _images["default"],
|
99
100
|
links: _links["default"],
|
100
101
|
listBox: _listBox["default"],
|
102
|
+
loader: _loader["default"],
|
101
103
|
menu: _menu["default"],
|
102
104
|
menuItem: _menuItem["default"],
|
103
105
|
messages: _messages["default"],
|
104
106
|
modal: _modal["default"],
|
105
|
-
collapsiblePanel: _collapsiblePanel["default"],
|
106
107
|
navBar: _navBar["default"],
|
107
108
|
numberField: _numberField["default"],
|
108
109
|
overlayPanel: _overlayPanel["default"],
|
@@ -110,10 +111,8 @@ var _default = _objectSpread(_objectSpread({
|
|
110
111
|
rockerbutton: _rockerbutton["default"],
|
111
112
|
separator: _separator["default"],
|
112
113
|
stepper: _stepper["default"],
|
113
|
-
table: _table["default"]
|
114
|
-
|
115
|
-
tooltip: _tooltip["default"],
|
116
|
-
dataTable: _DataTable["default"]
|
114
|
+
table: _table["default"],
|
115
|
+
tooltip: _tooltip["default"]
|
117
116
|
});
|
118
117
|
|
119
118
|
exports["default"] = _default;
|
@@ -3,7 +3,7 @@ import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectW
|
|
3
3
|
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
4
4
|
var _excluded = ["children", "status"];
|
5
5
|
|
6
|
-
var
|
6
|
+
var _calloutProps;
|
7
7
|
|
8
8
|
import _Object$values from "@babel/runtime-corejs3/core-js-stable/object/values";
|
9
9
|
import React from 'react';
|
@@ -12,59 +12,59 @@ import { Box } from '../..';
|
|
12
12
|
import statuses from '../../utils/devUtils/constants/statuses';
|
13
13
|
import { NoticeIcon } from '../Icon/NoticeIcon';
|
14
14
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
15
|
-
export var
|
16
|
-
var
|
15
|
+
export var CALLOUT_TEST_ID = 'CalloutTestId';
|
16
|
+
var calloutProps = (_calloutProps = {}, _defineProperty(_calloutProps, statuses.DEFAULT, {
|
17
17
|
color: 'text.secondary',
|
18
|
-
variant: '
|
19
|
-
}), _defineProperty(
|
18
|
+
variant: 'callout.base'
|
19
|
+
}), _defineProperty(_calloutProps, statuses.ERROR, {
|
20
20
|
color: 'critical.bright',
|
21
|
-
variant: '
|
22
|
-
}), _defineProperty(
|
21
|
+
variant: 'callout.error'
|
22
|
+
}), _defineProperty(_calloutProps, statuses.SUCCESS, {
|
23
23
|
color: 'success.bright',
|
24
|
-
variant: '
|
25
|
-
}), _defineProperty(
|
24
|
+
variant: 'callout.success'
|
25
|
+
}), _defineProperty(_calloutProps, statuses.WARNING, {
|
26
26
|
color: 'warning.bright',
|
27
|
-
variant: '
|
28
|
-
}),
|
27
|
+
variant: 'callout.warning'
|
28
|
+
}), _calloutProps);
|
29
29
|
var defaultIconProps = {
|
30
30
|
mr: 'md',
|
31
31
|
ml: 'md',
|
32
32
|
size: 'md'
|
33
33
|
};
|
34
34
|
/**
|
35
|
-
*
|
36
|
-
that should be placed at the top of panels or above related content. If the
|
35
|
+
*Callout 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 Callouts
|
37
37
|
status is error or warning, the text should include a direct link to instructions on resolving the
|
38
38
|
issue or error.
|
39
39
|
*
|
40
|
-
*Please note,
|
41
|
-
recommended if you need to interrupt and notify users of successful/failed actions
|
42
|
-
give warnings of unexpected events.
|
40
|
+
*Please note, Callout is a static component, the [Messages](./?path=/docs/components-messages)
|
41
|
+
component is recommended if you need to interrupt and notify users of successful/failed actions
|
42
|
+
or give warnings of unexpected events.
|
43
43
|
*/
|
44
44
|
|
45
|
-
var
|
45
|
+
var Callout = function Callout(_ref) {
|
46
46
|
var children = _ref.children,
|
47
47
|
status = _ref.status,
|
48
48
|
others = _objectWithoutProperties(_ref, _excluded);
|
49
49
|
|
50
50
|
return ___EmotionJSX(Box, _extends({
|
51
|
-
"data-testid":
|
51
|
+
"data-testid": CALLOUT_TEST_ID,
|
52
52
|
isRow: true,
|
53
53
|
role: "note",
|
54
|
-
variant:
|
54
|
+
variant: calloutProps[status].variant
|
55
55
|
}, others), ___EmotionJSX(NoticeIcon, _extends({
|
56
|
-
color:
|
56
|
+
color: calloutProps[status].color,
|
57
57
|
status: status,
|
58
58
|
"aria-label": "".concat(status, "-icon")
|
59
59
|
}, defaultIconProps)), children);
|
60
60
|
};
|
61
61
|
|
62
|
-
|
62
|
+
Callout.propTypes = {
|
63
63
|
/** Determines the icon and color */
|
64
64
|
status: PropTypes.oneOf(_Object$values(statuses))
|
65
65
|
};
|
66
|
-
|
66
|
+
Callout.defaultProps = {
|
67
67
|
status: statuses.DEFAULT
|
68
68
|
};
|
69
|
-
|
70
|
-
export default
|
69
|
+
Callout.displayName = 'Callout';
|
70
|
+
export default Callout;
|
@@ -1,12 +1,11 @@
|
|
1
1
|
import _Object$values from "@babel/runtime-corejs3/core-js-stable/object/values";
|
2
2
|
import React from 'react';
|
3
|
-
import { Link, Text } from '../..';
|
3
|
+
import { Link, Text, Callout } from '../..';
|
4
4
|
import statuses from '../../utils/devUtils/constants/statuses';
|
5
|
-
import Bulletin from './Bulletin';
|
6
5
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
7
6
|
export default {
|
8
|
-
title: '
|
9
|
-
component:
|
7
|
+
title: 'Components/Callout',
|
8
|
+
component: Callout,
|
10
9
|
argTypes: {
|
11
10
|
status: {
|
12
11
|
control: {
|
@@ -18,42 +17,42 @@ export default {
|
|
18
17
|
}; // main
|
19
18
|
|
20
19
|
export var Default = function Default(args) {
|
21
|
-
return ___EmotionJSX(
|
20
|
+
return ___EmotionJSX(Callout, args, ___EmotionJSX(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", ___EmotionJSX(Link, {
|
22
21
|
href: "https://pingidentity.com",
|
23
22
|
target: "_blank",
|
24
|
-
"aria-label": "".concat(statuses.DEFAULT, "-
|
23
|
+
"aria-label": "".concat(statuses.DEFAULT, "-callout"),
|
25
24
|
variant: "app"
|
26
25
|
}, " Read More")));
|
27
26
|
};
|
28
27
|
export var ErrorStatus = function ErrorStatus() {
|
29
|
-
return ___EmotionJSX(
|
28
|
+
return ___EmotionJSX(Callout, {
|
30
29
|
status: statuses.ERROR
|
31
30
|
}, ___EmotionJSX(Text, null, "You\u2019ve got problems. Allow me to tell you about them in some detail so that you can address them", ___EmotionJSX(Link, {
|
32
31
|
href: "https://pingidentity.com",
|
33
32
|
target: "_blank",
|
34
|
-
"aria-label": "".concat(statuses.ERROR, "-
|
33
|
+
"aria-label": "".concat(statuses.ERROR, "-callout"),
|
35
34
|
variant: "app"
|
36
35
|
}, " Read More")));
|
37
36
|
}; // Avoiding using Error as the function name due to it being a JS built-in method
|
38
37
|
|
39
38
|
ErrorStatus.storyName = 'Error';
|
40
39
|
export var Success = function Success() {
|
41
|
-
return ___EmotionJSX(
|
40
|
+
return ___EmotionJSX(Callout, {
|
42
41
|
status: statuses.SUCCESS
|
43
42
|
}, ___EmotionJSX(Text, null, "It Worked! Maybe there is something else related to it working that I need to explain", ___EmotionJSX(Link, {
|
44
43
|
href: "https://pingidentity.com",
|
45
44
|
target: "_blank",
|
46
|
-
"aria-label": "".concat(statuses.SUCCESS, "-
|
45
|
+
"aria-label": "".concat(statuses.SUCCESS, "-callout"),
|
47
46
|
variant: "app"
|
48
47
|
}, " Read More")));
|
49
48
|
};
|
50
49
|
export var Warning = function Warning() {
|
51
|
-
return ___EmotionJSX(
|
50
|
+
return ___EmotionJSX(Callout, {
|
52
51
|
status: statuses.WARNING
|
53
|
-
}, ___EmotionJSX(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
|
52
|
+
}, ___EmotionJSX(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 Callout box will grow in height with the content", ___EmotionJSX(Link, {
|
54
53
|
href: "https://pingidentity.com",
|
55
54
|
target: "_blank",
|
56
|
-
"aria-label": "".concat(statuses.WARNING, "-
|
55
|
+
"aria-label": "".concat(statuses.WARNING, "-callout"),
|
57
56
|
variant: "app"
|
58
57
|
}, " Read More")));
|
59
58
|
};
|
@@ -7,32 +7,32 @@ import { screen } from '@testing-library/react';
|
|
7
7
|
import statuses from '../../utils/devUtils/constants/statuses';
|
8
8
|
import { render } from '../../utils/testUtils/testWrapper';
|
9
9
|
import { noticeIcons } from '../Icon/NoticeIcon';
|
10
|
-
import
|
10
|
+
import Callout, { CALLOUT_TEST_ID } from './Callout';
|
11
11
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
12
12
|
var TEST_TEXT = 'test text';
|
13
13
|
var testColors = (_testColors = {}, _defineProperty(_testColors, statuses.DEFAULT, 'var(--theme-ui-colors-text-secondary)'), _defineProperty(_testColors, statuses.ERROR, 'var(--theme-ui-colors-critical-bright)'), _defineProperty(_testColors, statuses.SUCCESS, 'var(--theme-ui-colors-success-bright)'), _defineProperty(_testColors, statuses.WARNING, 'var(--theme-ui-colors-warning-bright)'), _testColors);
|
14
14
|
|
15
15
|
var getComponent = function getComponent() {
|
16
16
|
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
17
|
-
return render(___EmotionJSX(
|
17
|
+
return render(___EmotionJSX(Callout, props, TEST_TEXT));
|
18
18
|
};
|
19
19
|
|
20
|
-
describe('
|
20
|
+
describe('Callout', function () {
|
21
21
|
test('renders', function () {
|
22
22
|
getComponent();
|
23
23
|
screen.getByText(TEST_TEXT);
|
24
24
|
});
|
25
25
|
test('renders the default color', function () {
|
26
26
|
getComponent();
|
27
|
-
expect(screen.getByTestId(
|
27
|
+
expect(screen.getByTestId(CALLOUT_TEST_ID)).toHaveStyle({
|
28
28
|
'border-color': testColors[statuses.DEFAULT]
|
29
29
|
});
|
30
30
|
});
|
31
|
-
test.each([[statuses.DEFAULT, testColors[statuses.DEFAULT]], [statuses.ERROR, testColors[statuses.ERROR]], [statuses.SUCCESS, testColors[statuses.SUCCESS]], [statuses.WARNING, testColors[statuses.WARNING]]])('when given status %s it renders
|
31
|
+
test.each([[statuses.DEFAULT, testColors[statuses.DEFAULT]], [statuses.ERROR, testColors[statuses.ERROR]], [statuses.SUCCESS, testColors[statuses.SUCCESS]], [statuses.WARNING, testColors[statuses.WARNING]]])('when given status %s it renders Callout with color %s', function (status, expected) {
|
32
32
|
getComponent({
|
33
33
|
status: status
|
34
34
|
});
|
35
|
-
expect(screen.getByTestId(
|
35
|
+
expect(screen.getByTestId(CALLOUT_TEST_ID)).toHaveStyle({
|
36
36
|
'border-color': expected
|
37
37
|
});
|
38
38
|
});
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default } from './Callout';
|
@@ -88,23 +88,23 @@ var EnvironmentBreadcrumb = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
88
88
|
var filterNodesWithChildren = function filterNodesWithChildren(iterableNode) {
|
89
89
|
var nodeArr = _Array$from(iterableNode); // with this function we are filtering child items if they have sections
|
90
90
|
// we can't filter items because if it would be a section - we can't change childNodes
|
91
|
-
// eslint-disable-next-line array-callback-return,consistent-return
|
92
91
|
|
93
92
|
|
94
93
|
var filteredSections = _mapInstanceProperty(nodeArr).call(nodeArr, function f(nodeItem) {
|
94
|
+
var _context;
|
95
|
+
|
95
96
|
if ((nodeItem === null || nodeItem === void 0 ? void 0 : nodeItem.type) === 'item') {
|
96
97
|
var _nodeItem$value;
|
97
98
|
|
98
|
-
return contains(nodeItem === null || nodeItem === void 0 ? void 0 : (_nodeItem$value = nodeItem.value) === null || _nodeItem$value === void 0 ? void 0 : _nodeItem$value.name, searchValue)
|
99
|
+
return contains(nodeItem === null || nodeItem === void 0 ? void 0 : (_nodeItem$value = nodeItem.value) === null || _nodeItem$value === void 0 ? void 0 : _nodeItem$value.name, searchValue) && nodeItem;
|
99
100
|
}
|
100
101
|
|
101
|
-
|
102
|
-
var _context;
|
102
|
+
var childNodes = _filterInstanceProperty(_context = _Array$from(nodeItem.childNodes)).call(_context, f); // Don't return sections without children, see UIP-5951
|
103
103
|
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
}
|
104
|
+
|
105
|
+
return childNodes.length !== 0 && _objectSpread(_objectSpread({}, nodeItem), {}, {
|
106
|
+
childNodes: childNodes
|
107
|
+
});
|
108
108
|
}); // we are filtering null items here since we were not able to filter them in previous function
|
109
109
|
|
110
110
|
|
@@ -2,7 +2,6 @@ import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
|
2
2
|
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
|
3
3
|
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
4
4
|
import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor";
|
5
|
-
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
6
5
|
import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
|
7
6
|
import _Object$defineProperties from "@babel/runtime-corejs3/core-js-stable/object/define-properties";
|
8
7
|
import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
|
@@ -13,13 +12,15 @@ import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
|
|
13
12
|
|
14
13
|
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; }
|
15
14
|
|
16
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var
|
15
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context5, _context6; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context5 = ownKeys(Object(source), !0)).call(_context5, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context6 = ownKeys(Object(source))).call(_context6, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
17
16
|
|
17
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
18
|
+
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
18
19
|
import React from 'react';
|
19
20
|
import userEvent from '@testing-library/user-event';
|
20
21
|
import { Section } from '@react-stately/collections';
|
21
22
|
import { axe } from 'jest-axe';
|
22
|
-
import { render, screen } from '../../utils/testUtils/testWrapper';
|
23
|
+
import { render, screen, within } from '../../utils/testUtils/testWrapper';
|
23
24
|
import { EnvironmentBreadcrumb, Item, OverlayProvider } from '../../index';
|
24
25
|
import { breadCrumbDataIds } from './EnvironmentBreadcrumb';
|
25
26
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
@@ -43,6 +44,15 @@ var itemsWithSections = [{
|
|
43
44
|
}, {
|
44
45
|
name: 'Baz'
|
45
46
|
}]
|
47
|
+
}, {
|
48
|
+
name: 'Heading 2',
|
49
|
+
options: [{
|
50
|
+
name: 'Foo'
|
51
|
+
}, {
|
52
|
+
name: 'Zod'
|
53
|
+
}, {
|
54
|
+
name: 'Zay'
|
55
|
+
}]
|
46
56
|
}];
|
47
57
|
var defaultProps = {
|
48
58
|
'data-testid': testEnvBreadcrumb,
|
@@ -83,11 +93,13 @@ var getSectionsComponent = function getSectionsComponent() {
|
|
83
93
|
return (// eslint-disable-next-line testing-library/no-node-access
|
84
94
|
___EmotionJSX(Section, {
|
85
95
|
key: section.name,
|
86
|
-
|
96
|
+
title: section.name,
|
87
97
|
items: section.options
|
88
98
|
}, function (item) {
|
99
|
+
var _context;
|
100
|
+
|
89
101
|
return ___EmotionJSX(Item, {
|
90
|
-
key: item.name,
|
102
|
+
key: _concatInstanceProperty(_context = "".concat(section.name, "-")).call(_context, item.name),
|
91
103
|
childItems: item.options
|
92
104
|
}, item.name);
|
93
105
|
})
|
@@ -164,9 +176,9 @@ test('should not call onNamePress when current env button pressed', function ()
|
|
164
176
|
expect(onNamePressMock).not.toHaveBeenCalled();
|
165
177
|
});
|
166
178
|
test('should render items passed in props', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
167
|
-
return _regeneratorRuntime.wrap(function _callee$(
|
179
|
+
return _regeneratorRuntime.wrap(function _callee$(_context2) {
|
168
180
|
while (1) {
|
169
|
-
switch (
|
181
|
+
switch (_context2.prev = _context2.next) {
|
170
182
|
case 0:
|
171
183
|
getComponent();
|
172
184
|
expect(screen.queryByRole('listbox')).not.toBeInTheDocument();
|
@@ -177,7 +189,7 @@ test('should render items passed in props', /*#__PURE__*/_asyncToGenerator( /*#_
|
|
177
189
|
|
178
190
|
case 6:
|
179
191
|
case "end":
|
180
|
-
return
|
192
|
+
return _context2.stop();
|
181
193
|
}
|
182
194
|
}
|
183
195
|
}, _callee);
|
@@ -187,9 +199,24 @@ test('should render items with sections passed in props', function () {
|
|
187
199
|
expect(screen.queryByRole('listbox')).not.toBeInTheDocument();
|
188
200
|
expect(screen.queryByRole('option')).not.toBeInTheDocument();
|
189
201
|
userEvent.click(screen.getByText(testSelectedItem));
|
190
|
-
|
202
|
+
var groups = screen.getAllByRole('group');
|
203
|
+
expect(groups).toHaveLength(2);
|
191
204
|
expect(screen.queryByRole('listbox')).toBeInTheDocument();
|
192
|
-
expect(screen.queryAllByRole('option')).toHaveLength(
|
205
|
+
expect(screen.queryAllByRole('option')).toHaveLength(6);
|
206
|
+
|
207
|
+
_forEachInstanceProperty(groups).call(groups, function (group, index) {
|
208
|
+
var _context3;
|
209
|
+
|
210
|
+
expect(function () {
|
211
|
+
return within(group).getByText(itemsWithSections[index].name);
|
212
|
+
});
|
213
|
+
|
214
|
+
_forEachInstanceProperty(_context3 = itemsWithSections[index].options).call(_context3, function (opt) {
|
215
|
+
return expect(function () {
|
216
|
+
return within(group).getByText(opt.name);
|
217
|
+
});
|
218
|
+
});
|
219
|
+
});
|
193
220
|
});
|
194
221
|
test('should call onSelectionChange when env clicked', function () {
|
195
222
|
var onSelectionChangeMock = jest.fn();
|
@@ -257,22 +284,22 @@ test('should show empty state in search if there are no results', function () {
|
|
257
284
|
test('should have no accessibility violations', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
258
285
|
var _getComponent, container, results;
|
259
286
|
|
260
|
-
return _regeneratorRuntime.wrap(function _callee2$(
|
287
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context4) {
|
261
288
|
while (1) {
|
262
|
-
switch (
|
289
|
+
switch (_context4.prev = _context4.next) {
|
263
290
|
case 0:
|
264
291
|
jest.useRealTimers();
|
265
292
|
_getComponent = getComponent(), container = _getComponent.container;
|
266
|
-
|
293
|
+
_context4.next = 4;
|
267
294
|
return axe(container);
|
268
295
|
|
269
296
|
case 4:
|
270
|
-
results =
|
297
|
+
results = _context4.sent;
|
271
298
|
expect(results).toHaveNoViolations();
|
272
299
|
|
273
300
|
case 6:
|
274
301
|
case "end":
|
275
|
-
return
|
302
|
+
return _context4.stop();
|
276
303
|
}
|
277
304
|
}
|
278
305
|
}, _callee2);
|
@@ -309,4 +336,14 @@ test('should add data-id to dropdown list', function () {
|
|
309
336
|
expect(screen.getByRole('listbox', {
|
310
337
|
name: 'Items List'
|
311
338
|
})).toHaveAttribute('data-id', breadCrumbDataIds.dropdownList);
|
339
|
+
});
|
340
|
+
test('should hide section title if no search results within it', function () {
|
341
|
+
getSectionsComponent(); // Open popover
|
342
|
+
|
343
|
+
userEvent.click(screen.getByText(testSelectedItem)); // Search for option exclusive to only one section
|
344
|
+
|
345
|
+
userEvent.type(screen.getByRole('searchbox'), 'Zod'); // 'Heading 1' should not be rendered, but 'Heading 2' should be
|
346
|
+
|
347
|
+
expect(screen.queryByText(itemsWithSections[0].name)).not.toBeInTheDocument();
|
348
|
+
expect(screen.queryByText(itemsWithSections[1].name)).toBeInTheDocument();
|
312
349
|
});
|
package/lib/index.js
CHANGED
@@ -22,8 +22,9 @@ 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/
|
26
|
-
export
|
25
|
+
export { default as Bulletin } from './components/Callout';
|
26
|
+
export { default as Callout } from './components/Callout';
|
27
|
+
export * from './components/Callout';
|
27
28
|
export { default as Button } from './components/Button';
|
28
29
|
export * from './components/Button';
|
29
30
|
export { default as Card } from './components/Card';
|
File without changes
|
@@ -14,16 +14,19 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
14
14
|
|
15
15
|
import accordion from './accordion';
|
16
16
|
import boxes from './boxes';
|
17
|
+
import callout from './callout';
|
17
18
|
import codeView from './codeView';
|
18
|
-
import
|
19
|
+
import collapsiblePanel from './collapsiblePanel';
|
20
|
+
import dataTable from './../../components/DataTable/DataTable.styles';
|
19
21
|
import imageUpload from './imageUpload';
|
22
|
+
import images from './images';
|
20
23
|
import links from './links';
|
21
24
|
import listBox from './listBox';
|
22
25
|
import loader from './loader';
|
23
|
-
import modal from './modal';
|
24
26
|
import menu from './menu';
|
25
27
|
import menuItem from './menuItem';
|
26
28
|
import messages from './messages';
|
29
|
+
import modal from './modal';
|
27
30
|
import navBar from './navBar';
|
28
31
|
import numberField from './numberField';
|
29
32
|
import overlayPanel from './overlayPanel';
|
@@ -34,24 +37,22 @@ import stepper from './stepper';
|
|
34
37
|
import table from './table';
|
35
38
|
import * as tabs from './tabs';
|
36
39
|
import tooltip from './tooltip';
|
37
|
-
|
38
|
-
import bulletin from './bulletin';
|
39
|
-
import dataTable from './../../components/DataTable/DataTable.styles';
|
40
|
-
export default _objectSpread(_objectSpread({
|
40
|
+
export default _objectSpread(_objectSpread({}, tabs), {}, {
|
41
41
|
accordion: accordion,
|
42
42
|
boxes: boxes,
|
43
|
-
|
43
|
+
callout: callout,
|
44
44
|
codeView: codeView,
|
45
|
-
|
45
|
+
collapsiblePanel: collapsiblePanel,
|
46
|
+
dataTable: dataTable,
|
46
47
|
imageUpload: imageUpload,
|
47
|
-
|
48
|
+
images: images,
|
48
49
|
links: links,
|
49
50
|
listBox: listBox,
|
51
|
+
loader: loader,
|
50
52
|
menu: menu,
|
51
53
|
menuItem: menuItem,
|
52
54
|
messages: messages,
|
53
55
|
modal: modal,
|
54
|
-
collapsiblePanel: collapsiblePanel,
|
55
56
|
navBar: navBar,
|
56
57
|
numberField: numberField,
|
57
58
|
overlayPanel: overlayPanel,
|
@@ -59,8 +60,6 @@ export default _objectSpread(_objectSpread({
|
|
59
60
|
rockerbutton: rockerbutton,
|
60
61
|
separator: separator,
|
61
62
|
stepper: stepper,
|
62
|
-
table: table
|
63
|
-
|
64
|
-
tooltip: tooltip,
|
65
|
-
dataTable: dataTable
|
63
|
+
table: table,
|
64
|
+
tooltip: tooltip
|
66
65
|
});
|
package/package.json
CHANGED
@@ -1 +0,0 @@
|
|
1
|
-
export { default } from './Bulletin';
|