@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
@@ -14,7 +14,7 @@ _Object$defineProperty(exports, "__esModule", {
14
14
  value: true
15
15
  });
16
16
 
17
- exports.icons = exports["default"] = exports.ARIA_STATUSES = void 0;
17
+ exports["default"] = exports.ARIA_STATUSES = void 0;
18
18
 
19
19
  var _values = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/values"));
20
20
 
@@ -28,29 +28,17 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime-c
28
28
 
29
29
  var _react = _interopRequireWildcard(require("react"));
30
30
 
31
- var _propTypes = _interopRequireDefault(require("prop-types"));
32
-
33
- var _AlertCircleIcon = _interopRequireDefault(require("mdi-react/AlertCircleIcon"));
34
-
35
- var _CheckCircleIcon = _interopRequireDefault(require("mdi-react/CheckCircleIcon"));
36
-
37
31
  var _CloseIcon = _interopRequireDefault(require("mdi-react/CloseIcon"));
38
32
 
39
- var _AlertIcon = _interopRequireDefault(require("mdi-react/AlertIcon"));
40
-
41
- var _InformationIcon = _interopRequireDefault(require("mdi-react/InformationIcon"));
33
+ var _propTypes = _interopRequireDefault(require("prop-types"));
42
34
 
43
- var _useStatusClasses4 = _interopRequireDefault(require("../../hooks/useStatusClasses"));
35
+ var _NoticeIcon = require("../Icon/NoticeIcon");
44
36
 
45
37
  var _statuses = _interopRequireDefault(require("../../utils/devUtils/constants/statuses"));
46
38
 
47
- var _Box = _interopRequireDefault(require("../Box"));
48
-
49
- var _Icon = _interopRequireDefault(require("../Icon"));
50
-
51
- var _IconButton = _interopRequireDefault(require("../IconButton"));
39
+ var _useStatusClasses4 = _interopRequireDefault(require("../../hooks/useStatusClasses"));
52
40
 
53
- var _Text = _interopRequireDefault(require("../Text"));
41
+ var _ = require("../..");
54
42
 
55
43
  var _react2 = require("@emotion/react");
56
44
 
@@ -60,13 +48,6 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "functi
60
48
 
61
49
  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; }
62
50
 
63
- var icons = {
64
- "default": _InformationIcon["default"],
65
- success: _CheckCircleIcon["default"],
66
- error: _AlertCircleIcon["default"],
67
- warning: _AlertIcon["default"]
68
- };
69
- exports.icons = icons;
70
51
  var ARIA_STATUSES = {
71
52
  SUCCESS: 'Success Message',
72
53
  ERROR: 'Error Message',
@@ -77,9 +58,9 @@ exports.ARIA_STATUSES = ARIA_STATUSES;
77
58
  var CloseButton = function CloseButton(_ref) {
78
59
  var color = _ref.color,
79
60
  others = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
80
- return (0, _react2.jsx)(_IconButton["default"], (0, _extends2["default"])({
61
+ return (0, _react2.jsx)(_.IconButton, (0, _extends2["default"])({
81
62
  "aria-label": "Close"
82
- }, others), (0, _react2.jsx)(_Icon["default"], {
63
+ }, others), (0, _react2.jsx)(_.Icon, {
83
64
  color: color,
84
65
  icon: _CloseIcon["default"],
85
66
  sx: {
@@ -93,10 +74,10 @@ var CloseButton = function CloseButton(_ref) {
93
74
  CloseButton.propTypes = {
94
75
  color: _propTypes["default"].string
95
76
  };
96
- var Message = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
97
- var className = props.className,
98
- item = props.item,
99
- onClose = props.onClose;
77
+ var Message = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
78
+ var className = _ref2.className,
79
+ item = _ref2.item,
80
+ onClose = _ref2.onClose;
100
81
  var key = item.key,
101
82
  itemProps = item.props;
102
83
  var children = itemProps.children,
@@ -104,8 +85,7 @@ var Message = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
104
85
  status = _itemProps$status === void 0 ? 'default' : _itemProps$status,
105
86
  bg = itemProps.bg,
106
87
  color = itemProps.color,
107
- _itemProps$icon = itemProps.icon,
108
- icon = _itemProps$icon === void 0 ? icons[status] : _itemProps$icon,
88
+ icon = itemProps.icon,
109
89
  _itemProps$isHidden = itemProps.isHidden,
110
90
  isHidden = _itemProps$isHidden === void 0 ? false : _itemProps$isHidden,
111
91
  dataId = itemProps['data-id'];
@@ -147,7 +127,18 @@ var Message = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
147
127
  return '';
148
128
  };
149
129
 
150
- return (0, _react2.jsx)(_Box["default"], {
130
+ var messageIconProps = {
131
+ className: statusClasses,
132
+ color: color,
133
+ mr: 'md'
134
+ };
135
+ var messageIcon = icon ? (0, _react2.jsx)(_.Icon, (0, _extends2["default"])({
136
+ icon: icon,
137
+ "data-testid": "custom-icon-testid"
138
+ }, messageIconProps)) : (0, _react2.jsx)(_NoticeIcon.NoticeIcon, (0, _extends2["default"])({
139
+ status: status
140
+ }, messageIconProps));
141
+ return (0, _react2.jsx)(_.Box, {
151
142
  variant: "messages.transition",
152
143
  className: wrapperClasses,
153
144
  sx: {
@@ -157,20 +148,15 @@ var Message = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
157
148
  role: "status",
158
149
  "aria-live": "polite",
159
150
  "aria-label": ariaStatus(statusClasses)
160
- }, (0, _react2.jsx)(_Box["default"], {
151
+ }, (0, _react2.jsx)(_.Box, {
161
152
  ref: innerRef
162
- }, (0, _react2.jsx)(_Box["default"], {
153
+ }, (0, _react2.jsx)(_.Box, {
163
154
  ref: ref,
164
155
  isRow: true,
165
156
  variant: "messages.item",
166
157
  className: statusClasses,
167
158
  bg: bg
168
- }, icon && (0, _react2.jsx)(_Icon["default"], {
169
- icon: icon,
170
- className: statusClasses,
171
- color: color,
172
- mr: "md"
173
- }), (0, _react2.jsx)(_Text["default"], {
159
+ }, messageIcon, (0, _react2.jsx)(_.Text, {
174
160
  className: statusClasses,
175
161
  color: color,
176
162
  mr: "md"
@@ -24,6 +24,8 @@ var _collections = require("@react-stately/collections");
24
24
 
25
25
  var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
26
26
 
27
+ var _AccountIcon = _interopRequireDefault(require("mdi-react/AccountIcon"));
28
+
27
29
  var _testAxe = _interopRequireDefault(require("../../utils/testUtils/testAxe"));
28
30
 
29
31
  var _testWrapper = require("../../utils/testUtils/testWrapper");
@@ -195,4 +197,15 @@ test('should render messages with multiMessagesReducerStory', function () {
195
197
  _.multiMessagesReducerStory.actions.showSuccessMessage();
196
198
 
197
199
  expect(_testWrapper.screen.getByTestId(testId)).toBeInTheDocument();
200
+ });
201
+ test('should render a custom icon', function () {
202
+ getWithDynamicList({
203
+ items: [{
204
+ key: 'message1',
205
+ text: 'test text',
206
+ icon: _AccountIcon["default"]
207
+ }]
208
+ });
209
+
210
+ _testWrapper.screen.getByTestId('custom-icon-testid');
198
211
  });
@@ -99,7 +99,7 @@ var Default = function Default(_ref) {
99
99
  var variant = _ref.variant,
100
100
  args = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
101
101
  return (0, _react2.jsx)(_["default"], (0, _extends2["default"])({
102
- id: "custom-id",
102
+ id: "default-id",
103
103
  name: "custom-name",
104
104
  label: "Example Label"
105
105
  }, variant && {
@@ -113,7 +113,7 @@ exports.Default = Default;
113
113
 
114
114
  var SmallVariant = function SmallVariant() {
115
115
  return (0, _react2.jsx)(_["default"], {
116
- id: "custom-id",
116
+ id: "small-variant-id",
117
117
  name: "custom-name",
118
118
  label: "Example Label",
119
119
  controlProps: {
@@ -268,7 +268,7 @@ exports.Warning = Warning;
268
268
 
269
269
  var WithHelpHint = function WithHelpHint() {
270
270
  return (0, _react2.jsx)(_["default"], {
271
- id: "custom-id",
271
+ id: "with-help-hint-id",
272
272
  name: "custom-name",
273
273
  hintText: "Example Hint",
274
274
  label: "Example Label"