@pingux/astro 2.127.0 → 2.128.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17,7 +17,7 @@ var _ = require("../..");
17
17
  var _statuses = _interopRequireDefault(require("../../utils/devUtils/constants/statuses"));
18
18
  var _NoticeIcon = require("../Icon/NoticeIcon");
19
19
  var _react2 = require("@emotion/react");
20
- var _excluded = ["children", "status"];
20
+ var _excluded = ["children", "status", "icon"];
21
21
  var _calloutProps;
22
22
  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); }
23
23
  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; }
@@ -52,6 +52,7 @@ var Callout = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
52
52
  var children = _ref.children,
53
53
  _ref$status = _ref.status,
54
54
  status = _ref$status === void 0 ? _statuses["default"].DEFAULT : _ref$status,
55
+ icon = _ref.icon,
55
56
  others = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
56
57
  return (0, _react2.jsx)(_.Box, (0, _extends2["default"])({
57
58
  ref: ref,
@@ -59,7 +60,7 @@ var Callout = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
59
60
  isRow: true,
60
61
  role: "note",
61
62
  variant: calloutProps[status].variant
62
- }, others), (0, _react2.jsx)(_NoticeIcon.NoticeIcon, (0, _extends2["default"])({
63
+ }, others), icon || (0, _react2.jsx)(_NoticeIcon.NoticeIcon, (0, _extends2["default"])({
63
64
  color: calloutProps[status].color,
64
65
  status: status,
65
66
  "aria-label": "".concat(status, "-icon")
@@ -16,3 +16,4 @@ export declare const WithLink: {
16
16
  };
17
17
  };
18
18
  export declare const Warning: StoryFn;
19
+ export declare const WithCustomIcon: StoryFn;
@@ -12,9 +12,10 @@ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequ
12
12
  _Object$defineProperty(exports, "__esModule", {
13
13
  value: true
14
14
  });
15
- exports["default"] = exports.WithLink = exports.Warning = exports.Success = exports.ErrorStatus = exports.Default = void 0;
15
+ exports["default"] = exports.WithLink = exports.WithCustomIcon = exports.Warning = exports.Success = exports.ErrorStatus = exports.Default = void 0;
16
16
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
17
17
  var _react = _interopRequireDefault(require("react"));
18
+ var _CheckBoldIcon = _interopRequireDefault(require("@pingux/mdi-react/CheckBoldIcon"));
18
19
  var _storybookAddonDesigns = require("storybook-addon-designs");
19
20
  var _storybookDocsLayout = _interopRequireDefault(require("../../../.storybook/storybookDocsLayout"));
20
21
  var _index = require("../../index");
@@ -105,4 +106,22 @@ Warning.parameters = {
105
106
  type: 'figma',
106
107
  url: _figmaLinks.FIGMA_LINKS.callout.warning
107
108
  }
108
- };
109
+ };
110
+ var WithCustomIcon = function WithCustomIcon() {
111
+ return (0, _react2.jsx)(_index.Callout, {
112
+ icon: (0, _react2.jsx)(_index.Box, {
113
+ variant: "stepper.step.completed",
114
+ mx: "md",
115
+ minHeight: 25,
116
+ minWidth: 25,
117
+ height: 25,
118
+ width: 25
119
+ }, (0, _react2.jsx)(_index.Icon, {
120
+ icon: _CheckBoldIcon["default"],
121
+ title: {
122
+ name: 'Check Circle Outline Icon'
123
+ }
124
+ }))
125
+ }, (0, _react2.jsx)(_index.Text, null, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque vitae lacinia diam, nec ullamcorper neque. In egestas dui vel dolor tincidunt, sit amet ullamcorper leo consequat."));
126
+ };
127
+ exports.WithCustomIcon = WithCustomIcon;
@@ -7,7 +7,9 @@ var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-s
7
7
  var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
9
9
  var _react = _interopRequireDefault(require("react"));
10
+ var _CheckBoldIcon = _interopRequireDefault(require("@pingux/mdi-react/CheckBoldIcon"));
10
11
  var _react2 = require("@testing-library/react");
12
+ var _index = require("../../index");
11
13
  var _statuses = _interopRequireDefault(require("../../utils/devUtils/constants/statuses"));
12
14
  var _testWrapper = require("../../utils/testUtils/testWrapper");
13
15
  var _universalComponentTest = require("../../utils/testUtils/universalComponentTest");
@@ -55,4 +57,15 @@ describe('Callout', function () {
55
57
  });
56
58
  _react2.screen.getByTestId(icon);
57
59
  });
60
+ test('renders custom icon', function () {
61
+ var customIcon = (0, _react3.jsx)(_index.Icon, {
62
+ icon: _CheckBoldIcon["default"],
63
+ size: 14,
64
+ "data-testid": "iconId"
65
+ });
66
+ getComponent({
67
+ icon: customIcon
68
+ });
69
+ expect(_react2.screen.getByTestId('iconId')).toBeInTheDocument();
70
+ });
58
71
  });
@@ -71,8 +71,7 @@ var CollectionTab = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
71
71
  }, (0, _reactAria.mergeProps)(focusProps, hoverProps, tabProps), (0, _pendoID.getPendoID)('Tab'), {
72
72
  ref: tabRef
73
73
  }, itemProps, {
74
- title: itemProps === null || itemProps === void 0 ? void 0 : itemProps.textValue,
75
- "data-testid": "test-me"
74
+ title: itemProps === null || itemProps === void 0 ? void 0 : itemProps.textValue
76
75
  }), (0, _react2.jsx)(_react["default"].Fragment, null, itemProps === null || itemProps === void 0 ? void 0 : itemProps.icon, (0, _react2.jsx)(_.Text, (0, _extends2["default"])({
77
76
  variant: "tabLabel"
78
77
  }, itemProps === null || itemProps === void 0 ? void 0 : itemProps.tabLabelProps), rendered), isSelected && !isDisabled && (0, _react2.jsx)(TabLine, itemProps === null || itemProps === void 0 ? void 0 : itemProps.tabLineProps))), slots === null || slots === void 0 ? void 0 : slots.afterTab);
@@ -238,7 +238,8 @@ var CustomPanelProps = function CustomPanelProps() {
238
238
  }, function (item) {
239
239
  return (0, _react2.jsx)(_index.Tab, {
240
240
  key: item.name,
241
- title: item.name
241
+ title: item.name,
242
+ "data-testid": "testing-".concat(item.name)
242
243
  }, item.children);
243
244
  });
244
245
  };
@@ -93,7 +93,9 @@ var getComponent = function getComponent() {
93
93
  return (0, _react2.jsx)(_Tab["default"], (0, _extends2["default"])({
94
94
  key: name,
95
95
  title: name
96
- }, tabProps), children);
96
+ }, tabProps, {
97
+ "data-testid": "testing-".concat(name)
98
+ }), children);
97
99
  }))
98
100
  // </CacheProvider>
99
101
  );
@@ -523,7 +525,7 @@ test('tooltip renders on tab\'s hover in `tooltip` mode', /*#__PURE__*/(0, _asyn
523
525
  // fireEvent.mouseMove(tab1);
524
526
  // fireEvent.mouseEnter(tab1);
525
527
  // await userEvent.hover(tab1);
526
- test = _testWrapper.screen.getAllByTestId('test-me')[1];
528
+ test = _testWrapper.screen.getByTestId('testing-Tab 2');
527
529
  _testWrapper.fireEvent.mouseMove(test);
528
530
  _testWrapper.fireEvent.mouseEnter(test);
529
531
  _context9.next = 7;
@@ -1,5 +1,7 @@
1
+ /// <reference types="react" />
1
2
  import { Status } from './item';
2
3
  import { DOMAttributes, StyleProps } from './shared';
3
4
  export interface CalloutProps extends StyleProps, DOMAttributes {
4
5
  status?: Status;
6
+ icon?: React.ReactNode;
5
7
  }
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
3
3
  import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
4
- var _excluded = ["children", "status"];
4
+ var _excluded = ["children", "status", "icon"];
5
5
  var _calloutProps;
6
6
  import React, { forwardRef } from 'react';
7
7
  import { Box } from '../..';
@@ -38,6 +38,7 @@ var Callout = /*#__PURE__*/forwardRef(function (_ref, ref) {
38
38
  var children = _ref.children,
39
39
  _ref$status = _ref.status,
40
40
  status = _ref$status === void 0 ? statuses.DEFAULT : _ref$status,
41
+ icon = _ref.icon,
41
42
  others = _objectWithoutProperties(_ref, _excluded);
42
43
  return ___EmotionJSX(Box, _extends({
43
44
  ref: ref,
@@ -45,7 +46,7 @@ var Callout = /*#__PURE__*/forwardRef(function (_ref, ref) {
45
46
  isRow: true,
46
47
  role: "note",
47
48
  variant: calloutProps[status].variant
48
- }, others), ___EmotionJSX(NoticeIcon, _extends({
49
+ }, others), icon || ___EmotionJSX(NoticeIcon, _extends({
49
50
  color: calloutProps[status].color,
50
51
  status: status,
51
52
  "aria-label": "".concat(status, "-icon")
@@ -10,9 +10,10 @@ import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
10
10
  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; }
11
11
  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; }
12
12
  import React from 'react';
13
+ import CheckBoldIcon from '@pingux/mdi-react/CheckBoldIcon';
13
14
  import { withDesign } from 'storybook-addon-designs';
14
15
  import DocsLayout from '../../../.storybook/storybookDocsLayout';
15
- import { Callout, Link, Text } from '../../index';
16
+ import { Box, Callout, Icon, Link, Text } from '../../index';
16
17
  import { FIGMA_LINKS } from '../../utils/designUtils/figmaLinks';
17
18
  import statuses from '../../utils/devUtils/constants/statuses';
18
19
  import { statusArgTypes } from '../../utils/docUtils/statusProp';
@@ -94,4 +95,21 @@ Warning.parameters = {
94
95
  type: 'figma',
95
96
  url: FIGMA_LINKS.callout.warning
96
97
  }
98
+ };
99
+ export var WithCustomIcon = function WithCustomIcon() {
100
+ return ___EmotionJSX(Callout, {
101
+ icon: ___EmotionJSX(Box, {
102
+ variant: "stepper.step.completed",
103
+ mx: "md",
104
+ minHeight: 25,
105
+ minWidth: 25,
106
+ height: 25,
107
+ width: 25
108
+ }, ___EmotionJSX(Icon, {
109
+ icon: CheckBoldIcon,
110
+ title: {
111
+ name: 'Check Circle Outline Icon'
112
+ }
113
+ }))
114
+ }, ___EmotionJSX(Text, null, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque vitae lacinia diam, nec ullamcorper neque. In egestas dui vel dolor tincidunt, sit amet ullamcorper leo consequat."));
97
115
  };
@@ -1,7 +1,9 @@
1
1
  import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
2
2
  var _testColors;
3
3
  import React from 'react';
4
+ import CheckBoldIcon from '@pingux/mdi-react/CheckBoldIcon';
4
5
  import { screen } from '@testing-library/react';
6
+ import { Icon } from '../../index';
5
7
  import statuses from '../../utils/devUtils/constants/statuses';
6
8
  import { render } from '../../utils/testUtils/testWrapper';
7
9
  import { universalComponentTests } from '../../utils/testUtils/universalComponentTest';
@@ -46,4 +48,15 @@ describe('Callout', function () {
46
48
  });
47
49
  screen.getByTestId(icon);
48
50
  });
51
+ test('renders custom icon', function () {
52
+ var customIcon = ___EmotionJSX(Icon, {
53
+ icon: CheckBoldIcon,
54
+ size: 14,
55
+ "data-testid": "iconId"
56
+ });
57
+ getComponent({
58
+ icon: customIcon
59
+ });
60
+ expect(screen.getByTestId('iconId')).toBeInTheDocument();
61
+ });
49
62
  });
@@ -58,8 +58,7 @@ export var CollectionTab = /*#__PURE__*/forwardRef(function (props, ref) {
58
58
  }, mergeProps(focusProps, hoverProps, tabProps), getPendoID('Tab'), {
59
59
  ref: tabRef
60
60
  }, itemProps, {
61
- title: itemProps === null || itemProps === void 0 ? void 0 : itemProps.textValue,
62
- "data-testid": "test-me"
61
+ title: itemProps === null || itemProps === void 0 ? void 0 : itemProps.textValue
63
62
  }), ___EmotionJSX(React.Fragment, null, itemProps === null || itemProps === void 0 ? void 0 : itemProps.icon, ___EmotionJSX(Text, _extends({
64
63
  variant: "tabLabel"
65
64
  }, itemProps === null || itemProps === void 0 ? void 0 : itemProps.tabLabelProps), rendered), isSelected && !isDisabled && ___EmotionJSX(TabLine, itemProps === null || itemProps === void 0 ? void 0 : itemProps.tabLineProps))), slots === null || slots === void 0 ? void 0 : slots.afterTab);
@@ -216,7 +216,8 @@ export var CustomPanelProps = function CustomPanelProps() {
216
216
  }, function (item) {
217
217
  return ___EmotionJSX(Tab, {
218
218
  key: item.name,
219
- title: item.name
219
+ title: item.name,
220
+ "data-testid": "testing-".concat(item.name)
220
221
  }, item.children);
221
222
  });
222
223
  };
@@ -92,7 +92,9 @@ var getComponent = function getComponent() {
92
92
  return ___EmotionJSX(Tab, _extends({
93
93
  key: name,
94
94
  title: name
95
- }, tabProps), children);
95
+ }, tabProps, {
96
+ "data-testid": "testing-".concat(name)
97
+ }), children);
96
98
  }))
97
99
  // </CacheProvider>
98
100
  );
@@ -522,7 +524,7 @@ test('tooltip renders on tab\'s hover in `tooltip` mode', /*#__PURE__*/_asyncToG
522
524
  // fireEvent.mouseMove(tab1);
523
525
  // fireEvent.mouseEnter(tab1);
524
526
  // await userEvent.hover(tab1);
525
- test = screen.getAllByTestId('test-me')[1];
527
+ test = screen.getByTestId('testing-Tab 2');
526
528
  fireEvent.mouseMove(test);
527
529
  fireEvent.mouseEnter(test);
528
530
  _context9.next = 7;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pingux/astro",
3
- "version": "2.127.0",
3
+ "version": "2.128.0-alpha.1",
4
4
  "description": "React component library for Ping Identity's design system",
5
5
  "repository": {
6
6
  "type": "git",