@pingux/astro 1.38.0-alpha.7 → 1.38.0-alpha.9

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.
Files changed (33) hide show
  1. package/lib/cjs/components/Bulletin/Bulletin.js +93 -0
  2. package/lib/cjs/components/Bulletin/Bulletin.stories.js +90 -0
  3. package/lib/cjs/components/Bulletin/Bulletin.test.js +70 -0
  4. package/lib/cjs/components/Bulletin/index.js +18 -0
  5. package/lib/cjs/components/ComboBox/ComboBoxInput.js +1 -1
  6. package/lib/cjs/components/ComboBoxField/ComboBoxField.js +15 -14
  7. package/lib/cjs/components/ComboBoxField/ComboBoxField.stories.js +15 -1
  8. package/lib/cjs/components/ComboBoxField/ComboBoxField.test.js +36 -0
  9. package/lib/cjs/components/Icon/NoticeIcon.js +71 -0
  10. package/lib/cjs/components/Icon/NoticeIcon.test.js +35 -0
  11. package/lib/cjs/components/Messages/Message.js +27 -41
  12. package/lib/cjs/components/Messages/Messages.test.js +13 -0
  13. package/lib/cjs/components/TextField/TextField.stories.js +3 -3
  14. package/lib/cjs/index.js +85 -62
  15. package/lib/cjs/styles/variants/bulletin.js +60 -0
  16. package/lib/cjs/styles/variants/variants.js +3 -0
  17. package/lib/components/Bulletin/Bulletin.js +70 -0
  18. package/lib/components/Bulletin/Bulletin.stories.js +59 -0
  19. package/lib/components/Bulletin/Bulletin.test.js +45 -0
  20. package/lib/components/Bulletin/index.js +1 -0
  21. package/lib/components/ComboBox/ComboBoxInput.js +1 -1
  22. package/lib/components/ComboBoxField/ComboBoxField.js +15 -14
  23. package/lib/components/ComboBoxField/ComboBoxField.stories.js +11 -0
  24. package/lib/components/ComboBoxField/ComboBoxField.test.js +34 -0
  25. package/lib/components/Icon/NoticeIcon.js +43 -0
  26. package/lib/components/Icon/NoticeIcon.test.js +24 -0
  27. package/lib/components/Messages/Message.js +21 -28
  28. package/lib/components/Messages/Messages.test.js +11 -0
  29. package/lib/components/TextField/TextField.stories.js +3 -3
  30. package/lib/index.js +2 -0
  31. package/lib/styles/variants/bulletin.js +41 -0
  32. package/lib/styles/variants/variants.js +2 -0
  33. package/package.json +1 -1
@@ -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';
@@ -104,7 +104,7 @@ var ComboBoxInput = /*#__PURE__*/forwardRef(function (props, ref) {
104
104
 
105
105
  usePropWarning(props, 'disabled', 'isDisabled');
106
106
 
107
- var button = ___EmotionJSX(Box, {
107
+ var button = !isReadOnly && ___EmotionJSX(Box, {
108
108
  isRow: true,
109
109
  variant: "boxes.inputInContainerSlot"
110
110
  }, // Render loader after delay if filtering or loading
@@ -10,7 +10,7 @@ import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
10
10
  import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
11
11
  import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
12
12
  import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
13
- var _excluded = ["hasAutoFocus", "hasAddOption", "hasCustomValue", "hasNoEmptySelection", "selectedKey", "onSelectionChange", "defaultItems", "items", "loadingState", "onLoadMore", "inputValue", "menuTrigger", "isNotFlippable", "direction", "scrollBoxProps", "controlProps", "defaultFilter", "status", "helperText"],
13
+ var _excluded = ["hasAutoFocus", "hasAddOption", "hasCustomValue", "hasNoEmptySelection", "selectedKey", "onSelectionChange", "defaultItems", "items", "loadingState", "onLoadMore", "inputValue", "isReadOnly", "menuTrigger", "isNotFlippable", "direction", "scrollBoxProps", "controlProps", "defaultFilter", "status", "helperText"],
14
14
  _excluded2 = ["shouldFocusOnHover", "shouldSelectOnPressUp"];
15
15
  import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
16
16
  import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
@@ -59,6 +59,7 @@ var ComboBoxField = /*#__PURE__*/forwardRef(function (props, ref) {
59
59
  loadingState = props.loadingState,
60
60
  onLoadMore = props.onLoadMore,
61
61
  inputValue = props.inputValue,
62
+ isReadOnly = props.isReadOnly,
62
63
  menuTrigger = props.menuTrigger,
63
64
  isNotFlippable = props.isNotFlippable,
64
65
  direction = props.direction,
@@ -135,7 +136,7 @@ var ComboBoxField = /*#__PURE__*/forwardRef(function (props, ref) {
135
136
  contains = _useFilter.contains;
136
137
 
137
138
  var state = useComboBoxState(_objectSpread(_objectSpread({}, comboBoxOptions), {}, {
138
- defaultItems: defaultItems,
139
+ defaultItems: isReadOnly ? [] : defaultItems,
139
140
  items: items,
140
141
  onSelectionChange: hasAddOption || hasCustomValue ? onSelectionChangeHandler : onSelectionChange,
141
142
  defaultFilter: typeof defaultFilter !== 'undefined' ? defaultFilter : contains
@@ -206,7 +207,16 @@ var ComboBoxField = /*#__PURE__*/forwardRef(function (props, ref) {
206
207
  minWidth: menuWidth
207
208
  });
208
209
 
209
- var listbox = ___EmotionJSX(FocusScope, {
210
+ var listBox = !isReadOnly && ___EmotionJSX(PopoverContainer, {
211
+ hasNoArrow: true,
212
+ isDismissable: true,
213
+ isNonModal: true,
214
+ isOpen: state.isOpen,
215
+ onClose: state.close,
216
+ placement: placement,
217
+ ref: popoverRef,
218
+ style: style
219
+ }, ___EmotionJSX(FocusScope, {
210
220
  restoreFocus: true
211
221
  }, ___EmotionJSX(DismissButton, {
212
222
  onDismiss: state.close
@@ -222,7 +232,7 @@ var ComboBoxField = /*#__PURE__*/forwardRef(function (props, ref) {
222
232
  isSelectedOnPressUp: shouldSelectOnPressUp
223
233
  }, otherListBoxProps))), ___EmotionJSX(DismissButton, {
224
234
  onDismiss: state.close
225
- }));
235
+ })));
226
236
 
227
237
  return ___EmotionJSX(React.Fragment, null, ___EmotionJSX(ComboBoxInput, _extends({}, props, {
228
238
  isOpen: state.isOpen,
@@ -234,16 +244,7 @@ var ComboBoxField = /*#__PURE__*/forwardRef(function (props, ref) {
234
244
  triggerRef: buttonRef,
235
245
  controlProps: controlProps,
236
246
  "aria-invalid": status === 'error' && true
237
- })), ___EmotionJSX(PopoverContainer, {
238
- hasNoArrow: true,
239
- isDismissable: true,
240
- isNonModal: true,
241
- isOpen: state.isOpen,
242
- onClose: state.close,
243
- placement: placement,
244
- ref: popoverRef,
245
- style: style
246
- }, listbox));
247
+ })), listBox);
247
248
  });
248
249
  ComboBoxField.propTypes = _objectSpread({
249
250
  /* Whether or not adding new options to the list is enabled. */
@@ -478,6 +478,17 @@ export var HelperText = function HelperText() {
478
478
  }, item.name);
479
479
  }));
480
480
  };
481
+ export var ReadOnly = function ReadOnly() {
482
+ return ___EmotionJSX(OverlayProvider, null, ___EmotionJSX(ComboBoxField, _extends({
483
+ label: "Example label",
484
+ defaultItems: items,
485
+ isReadOnly: true
486
+ }, actions), function (item) {
487
+ return ___EmotionJSX(Item, {
488
+ key: item.name
489
+ }, item.name);
490
+ }));
491
+ };
481
492
  export var Required = function Required() {
482
493
  return ___EmotionJSX(OverlayProvider, null, ___EmotionJSX(ComboBoxField, _extends({
483
494
  label: "Example label",
@@ -1008,4 +1008,38 @@ test('popover closes on input blur', function () {
1008
1008
  userEvent.click(document.body);
1009
1009
  expect(screen.queryByRole('listbox')).not.toBeInTheDocument();
1010
1010
  expect(screen.queryByRole('option')).not.toBeInTheDocument();
1011
+ });
1012
+ describe('when isReadOnly is true', function () {
1013
+ var testProp = {
1014
+ isReadOnly: true
1015
+ };
1016
+ var TEST_DEFAULT_INPUT_VALUE = 'test default input value';
1017
+ test('it does not have the show suggestions button', function () {
1018
+ getComponent(testProp);
1019
+ expect(screen.queryByRole('button', {
1020
+ name: "".concat(defaultProps.label, " Show suggestions")
1021
+ })).not.toBeInTheDocument();
1022
+ });
1023
+ test('it has attribute readonly', function () {
1024
+ getComponent(testProp);
1025
+ expect(screen.getByRole('combobox', {
1026
+ name: defaultProps.label
1027
+ })).toHaveAttribute('readonly');
1028
+ });
1029
+ test('the default selected value is selected', function () {
1030
+ testProp.defaultInputValue = TEST_DEFAULT_INPUT_VALUE;
1031
+ getComponent(testProp);
1032
+ expect(screen.getByRole('combobox', {
1033
+ name: defaultProps.label
1034
+ })).toHaveValue(TEST_DEFAULT_INPUT_VALUE);
1035
+ });
1036
+ test('the dropdown does not open when clicked', function () {
1037
+ getComponent(testProp);
1038
+ userEvent.click(screen.getByRole('combobox', {
1039
+ name: defaultProps.label
1040
+ }));
1041
+ expect(screen.queryByRole('listbox', {
1042
+ name: 'Test Label Suggestions'
1043
+ })).not.toBeInTheDocument();
1044
+ });
1011
1045
  });
@@ -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
  });
@@ -57,7 +57,7 @@ export var Default = function Default(_ref) {
57
57
  args = _objectWithoutProperties(_ref, _excluded);
58
58
 
59
59
  return ___EmotionJSX(TextField, _extends({
60
- id: "custom-id",
60
+ id: "default-id",
61
61
  name: "custom-name",
62
62
  label: "Example Label"
63
63
  }, variant && {
@@ -68,7 +68,7 @@ export var Default = function Default(_ref) {
68
68
  };
69
69
  export var SmallVariant = function SmallVariant() {
70
70
  return ___EmotionJSX(TextField, {
71
- id: "custom-id",
71
+ id: "small-variant-id",
72
72
  name: "custom-name",
73
73
  label: "Example Label",
74
74
  controlProps: {
@@ -187,7 +187,7 @@ export var Warning = function Warning() {
187
187
  };
188
188
  export var WithHelpHint = function WithHelpHint() {
189
189
  return ___EmotionJSX(TextField, {
190
- id: "custom-id",
190
+ id: "with-help-hint-id",
191
191
  name: "custom-name",
192
192
  hintText: "Example Hint",
193
193
  label: "Example Label"
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.7",
3
+ "version": "1.38.0-alpha.9",
4
4
  "description": "PingUX themeable React component library",
5
5
  "repository": {
6
6
  "type": "git",