@pingux/astro 1.38.0-alpha.6 → 1.38.0-alpha.8

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.
@@ -76,6 +76,8 @@ var _tooltip = _interopRequireDefault(require("./tooltip"));
76
76
 
77
77
  var _collapsiblePanel = _interopRequireDefault(require("./collapsiblePanel"));
78
78
 
79
+ var _bulletin = _interopRequireDefault(require("./bulletin"));
80
+
79
81
  var _DataTable = _interopRequireDefault(require("./../../components/DataTable/DataTable.styles"));
80
82
 
81
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); }
@@ -89,6 +91,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
89
91
  var _default = _objectSpread(_objectSpread({
90
92
  accordion: _accordion["default"],
91
93
  boxes: _boxes["default"],
94
+ bulletin: _bulletin["default"],
92
95
  codeView: _codeView["default"],
93
96
  images: _images["default"],
94
97
  imageUpload: _imageUpload["default"],
@@ -0,0 +1,70 @@
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;
@@ -0,0 +1,59 @@
1
+ import _Object$values from "@babel/runtime-corejs3/core-js-stable/object/values";
2
+ import React from 'react';
3
+ import { Link, Text } from '../..';
4
+ import statuses from '../../utils/devUtils/constants/statuses';
5
+ import Bulletin from './Bulletin';
6
+ import { jsx as ___EmotionJSX } from "@emotion/react";
7
+ export default {
8
+ title: 'Bulletin',
9
+ component: Bulletin,
10
+ argTypes: {
11
+ status: {
12
+ control: {
13
+ type: 'select',
14
+ options: _Object$values(statuses)
15
+ }
16
+ }
17
+ }
18
+ }; // main
19
+
20
+ export var Default = function Default(args) {
21
+ return ___EmotionJSX(Bulletin, 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
+ href: "https://pingidentity.com",
23
+ target: "_blank",
24
+ "aria-label": "".concat(statuses.DEFAULT, "-bulletin"),
25
+ variant: "app"
26
+ }, " Read More")));
27
+ };
28
+ export var ErrorStatus = function ErrorStatus() {
29
+ return ___EmotionJSX(Bulletin, {
30
+ status: statuses.ERROR
31
+ }, ___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
+ href: "https://pingidentity.com",
33
+ target: "_blank",
34
+ "aria-label": "".concat(statuses.ERROR, "-bulletin"),
35
+ variant: "app"
36
+ }, " Read More")));
37
+ }; // Avoiding using Error as the function name due to it being a JS built-in method
38
+
39
+ ErrorStatus.storyName = 'Error';
40
+ export var Success = function Success() {
41
+ return ___EmotionJSX(Bulletin, {
42
+ status: statuses.SUCCESS
43
+ }, ___EmotionJSX(Text, null, "It Worked! Maybe there is something else related to it working that I need to explain", ___EmotionJSX(Link, {
44
+ href: "https://pingidentity.com",
45
+ target: "_blank",
46
+ "aria-label": "".concat(statuses.SUCCESS, "-bulletin"),
47
+ variant: "app"
48
+ }, " Read More")));
49
+ };
50
+ export var Warning = function Warning() {
51
+ return ___EmotionJSX(Bulletin, {
52
+ 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 Bulletin box will grow in height with the content", ___EmotionJSX(Link, {
54
+ href: "https://pingidentity.com",
55
+ target: "_blank",
56
+ "aria-label": "".concat(statuses.WARNING, "-bulletin"),
57
+ variant: "app"
58
+ }, " Read More")));
59
+ };
@@ -0,0 +1,45 @@
1
+ import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
2
+
3
+ var _testColors;
4
+
5
+ import React from 'react';
6
+ import { screen } from '@testing-library/react';
7
+ import statuses from '../../utils/devUtils/constants/statuses';
8
+ import { render } from '../../utils/testUtils/testWrapper';
9
+ import { noticeIcons } from '../Icon/NoticeIcon';
10
+ import Bulletin, { BULLETIN_TEST_ID } from './Bulletin';
11
+ import { jsx as ___EmotionJSX } from "@emotion/react";
12
+ var TEST_TEXT = 'test text';
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
+
15
+ var getComponent = function getComponent() {
16
+ var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
17
+ return render(___EmotionJSX(Bulletin, props, TEST_TEXT));
18
+ };
19
+
20
+ describe('Bulletin', function () {
21
+ test('renders', function () {
22
+ getComponent();
23
+ screen.getByText(TEST_TEXT);
24
+ });
25
+ test('renders the default color', function () {
26
+ getComponent();
27
+ expect(screen.getByTestId(BULLETIN_TEST_ID)).toHaveStyle({
28
+ 'border-color': testColors[statuses.DEFAULT]
29
+ });
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 Bulletin with color %s', function (status, expected) {
32
+ getComponent({
33
+ status: status
34
+ });
35
+ expect(screen.getByTestId(BULLETIN_TEST_ID)).toHaveStyle({
36
+ 'border-color': expected
37
+ });
38
+ });
39
+ test.each([[statuses.DEFAULT, noticeIcons[statuses.DEFAULT].testid], [statuses.ERROR, noticeIcons[statuses.ERROR].testid], [statuses.SUCCESS, noticeIcons[statuses.SUCCESS].testid], [statuses.WARNING, noticeIcons[statuses.WARNING].testid]])('when given status %s it renders %s', function (status, icon) {
40
+ getComponent({
41
+ status: status
42
+ });
43
+ screen.getByTestId(icon);
44
+ });
45
+ });
@@ -0,0 +1 @@
1
+ export { default } from './Bulletin';
@@ -0,0 +1,43 @@
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 = ["status"];
5
+
6
+ var _noticeIcons;
7
+
8
+ import _Object$values from "@babel/runtime-corejs3/core-js-stable/object/values";
9
+ import React from 'react';
10
+ import AlertCircleIcon from 'mdi-react/AlertCircleIcon';
11
+ import AlertIcon from 'mdi-react/AlertIcon';
12
+ import CheckCircleIcon from 'mdi-react/CheckCircleIcon';
13
+ import InformationIcon from 'mdi-react/InformationIcon';
14
+ import PropTypes from 'prop-types';
15
+ import { Icon } from '../..';
16
+ import statuses from '../../utils/devUtils/constants/statuses';
17
+ import { jsx as ___EmotionJSX } from "@emotion/react";
18
+ export var noticeIcons = (_noticeIcons = {}, _defineProperty(_noticeIcons, statuses.DEFAULT, {
19
+ icon: InformationIcon,
20
+ testid: 'default-icon-testid'
21
+ }), _defineProperty(_noticeIcons, statuses.ERROR, {
22
+ icon: AlertCircleIcon,
23
+ testid: 'error-icon-testid'
24
+ }), _defineProperty(_noticeIcons, statuses.SUCCESS, {
25
+ icon: CheckCircleIcon,
26
+ testid: 'success-icon-testid'
27
+ }), _defineProperty(_noticeIcons, statuses.WARNING, {
28
+ icon: AlertIcon,
29
+ testid: 'warning-icon-testid'
30
+ }), _noticeIcons);
31
+ export var NoticeIcon = function NoticeIcon(_ref) {
32
+ var _ref$status = _ref.status,
33
+ status = _ref$status === void 0 ? statuses.DEFAULT : _ref$status,
34
+ others = _objectWithoutProperties(_ref, _excluded);
35
+
36
+ return ___EmotionJSX(Icon, _extends({
37
+ "data-testid": noticeIcons[status].testid,
38
+ icon: noticeIcons[status].icon
39
+ }, others));
40
+ };
41
+ NoticeIcon.propTypes = {
42
+ status: PropTypes.oneOf(_Object$values(statuses))
43
+ };
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ import { screen } from '@testing-library/react';
3
+ import statuses from '../../utils/devUtils/constants/statuses';
4
+ import { render } from '../../utils/testUtils/testWrapper';
5
+ import { NoticeIcon, noticeIcons } from './NoticeIcon';
6
+ import { jsx as ___EmotionJSX } from "@emotion/react";
7
+
8
+ var getComponent = function getComponent() {
9
+ var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
10
+ return render(___EmotionJSX(NoticeIcon, props));
11
+ };
12
+
13
+ describe('NoticeIcon', function () {
14
+ test('renders', function () {
15
+ getComponent();
16
+ screen.getByTestId(noticeIcons[statuses.DEFAULT].testid);
17
+ });
18
+ test.each([[statuses.DEFAULT, noticeIcons[statuses.DEFAULT].testid], [statuses.ERROR, noticeIcons[statuses.ERROR].testid], [statuses.SUCCESS, noticeIcons[statuses.SUCCESS].testid], [statuses.WARNING, noticeIcons[statuses.WARNING].testid]])('when given status %s it renders icon with %s', function (status, icon) {
19
+ getComponent({
20
+ status: status
21
+ });
22
+ screen.getByTestId(icon);
23
+ });
24
+ });
@@ -5,25 +5,13 @@ 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 PropTypes from 'prop-types';
9
- import AlertCircleIcon from 'mdi-react/AlertCircleIcon';
10
- import CheckCircleIcon from 'mdi-react/CheckCircleIcon';
11
8
  import CloseIcon from 'mdi-react/CloseIcon';
12
- import AlertIcon from 'mdi-react/AlertIcon';
13
- import InformationIcon from 'mdi-react/InformationIcon';
14
- import useStatusClasses from '../../hooks/useStatusClasses';
9
+ import PropTypes from 'prop-types';
10
+ import { NoticeIcon } from '../Icon/NoticeIcon';
15
11
  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';
12
+ import useStatusClasses from '../../hooks/useStatusClasses';
13
+ import { Box, Icon, IconButton, Text } from '../..';
20
14
  import { jsx as ___EmotionJSX } from "@emotion/react";
21
- export var icons = {
22
- "default": InformationIcon,
23
- success: CheckCircleIcon,
24
- error: AlertCircleIcon,
25
- warning: AlertIcon
26
- };
27
15
  export var ARIA_STATUSES = {
28
16
  SUCCESS: 'Success Message',
29
17
  ERROR: 'Error Message',
@@ -50,10 +38,10 @@ var CloseButton = function CloseButton(_ref) {
50
38
  CloseButton.propTypes = {
51
39
  color: PropTypes.string
52
40
  };
53
- var Message = /*#__PURE__*/forwardRef(function (props, ref) {
54
- var className = props.className,
55
- item = props.item,
56
- onClose = props.onClose;
41
+ var Message = /*#__PURE__*/forwardRef(function (_ref2, ref) {
42
+ var className = _ref2.className,
43
+ item = _ref2.item,
44
+ onClose = _ref2.onClose;
57
45
  var key = item.key,
58
46
  itemProps = item.props;
59
47
  var children = itemProps.children,
@@ -61,8 +49,7 @@ var Message = /*#__PURE__*/forwardRef(function (props, ref) {
61
49
  status = _itemProps$status === void 0 ? 'default' : _itemProps$status,
62
50
  bg = itemProps.bg,
63
51
  color = itemProps.color,
64
- _itemProps$icon = itemProps.icon,
65
- icon = _itemProps$icon === void 0 ? icons[status] : _itemProps$icon,
52
+ icon = itemProps.icon,
66
53
  _itemProps$isHidden = itemProps.isHidden,
67
54
  isHidden = _itemProps$isHidden === void 0 ? false : _itemProps$isHidden,
68
55
  dataId = itemProps['data-id'];
@@ -104,6 +91,17 @@ var Message = /*#__PURE__*/forwardRef(function (props, ref) {
104
91
  return '';
105
92
  };
106
93
 
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));
107
105
  return ___EmotionJSX(Box, {
108
106
  variant: "messages.transition",
109
107
  className: wrapperClasses,
@@ -122,12 +120,7 @@ var Message = /*#__PURE__*/forwardRef(function (props, ref) {
122
120
  variant: "messages.item",
123
121
  className: statusClasses,
124
122
  bg: bg
125
- }, icon && ___EmotionJSX(Icon, {
126
- icon: icon,
127
- className: statusClasses,
128
- color: color,
129
- mr: "md"
130
- }), ___EmotionJSX(Text, {
123
+ }, messageIcon, ___EmotionJSX(Text, {
131
124
  className: statusClasses,
132
125
  color: color,
133
126
  mr: "md"
@@ -5,6 +5,7 @@ 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';
8
9
  import axeTest from '../../utils/testUtils/testAxe';
9
10
  import { render, screen } from '../../utils/testUtils/testWrapper';
10
11
  import Messages, { messagesReducerStory, multiMessagesReducerStory } from '.';
@@ -146,4 +147,14 @@ test('should render messages with multiMessagesReducerStory', function () {
146
147
  getComponent();
147
148
  multiMessagesReducerStory.actions.showSuccessMessage();
148
149
  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');
149
160
  });
package/lib/index.js CHANGED
@@ -22,6 +22,8 @@ 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';
25
27
  export { default as Button } from './components/Button';
26
28
  export * from './components/Button';
27
29
  export { default as Card } from './components/Card';
@@ -0,0 +1,41 @@
1
+ import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
2
+ import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
3
+ import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
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
+ import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
7
+ import _Object$defineProperties from "@babel/runtime-corejs3/core-js-stable/object/define-properties";
8
+ import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
9
+ import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
10
+
11
+ 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; }
12
+
13
+ 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) { _defineProperty(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; }
14
+
15
+ var base = {
16
+ alignItems: 'center',
17
+ border: '1px solid',
18
+ borderColor: 'text.secondary',
19
+ fontSize: 'md',
20
+ p: '15px 12px 15px 0',
21
+ width: '600px'
22
+ };
23
+
24
+ var error = _objectSpread(_objectSpread({}, base), {}, {
25
+ borderColor: 'critical.bright'
26
+ });
27
+
28
+ var success = _objectSpread(_objectSpread({}, base), {}, {
29
+ borderColor: 'success.bright'
30
+ });
31
+
32
+ var warning = _objectSpread(_objectSpread({}, base), {}, {
33
+ borderColor: 'warning.bright'
34
+ });
35
+
36
+ export default {
37
+ base: base,
38
+ error: error,
39
+ success: success,
40
+ warning: warning
41
+ };
@@ -35,10 +35,12 @@ 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';
38
39
  import dataTable from './../../components/DataTable/DataTable.styles';
39
40
  export default _objectSpread(_objectSpread({
40
41
  accordion: accordion,
41
42
  boxes: boxes,
43
+ bulletin: bulletin,
42
44
  codeView: codeView,
43
45
  images: images,
44
46
  imageUpload: imageUpload,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pingux/astro",
3
- "version": "1.38.0-alpha.6",
3
+ "version": "1.38.0-alpha.8",
4
4
  "description": "PingUX themeable React component library",
5
5
  "repository": {
6
6
  "type": "git",