@pingux/astro 2.127.0 → 2.128.0-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/lib/cjs/components/Callout/Callout.js +3 -2
- package/lib/cjs/components/Callout/Callout.stories.d.ts +1 -0
- package/lib/cjs/components/Callout/Callout.stories.js +21 -2
- package/lib/cjs/components/Callout/Callout.test.js +13 -0
- package/lib/cjs/types/callout.d.ts +2 -0
- package/lib/components/Callout/Callout.js +3 -2
- package/lib/components/Callout/Callout.stories.js +19 -1
- package/lib/components/Callout/Callout.test.js +13 -0
- package/package.json +1 -1
@@ -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")
|
@@ -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
|
});
|
@@ -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
|
});
|