@pingux/astro 2.42.0-alpha.3 → 2.42.0-alpha.5
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/IconBadge/IconBadge.d.ts +4 -0
- package/lib/cjs/components/IconBadge/IconBadge.js +1 -19
- package/lib/cjs/components/IconBadge/IconBadge.stories.d.ts +5 -0
- package/lib/cjs/components/IconBadge/IconBadge.stories.js +1 -1
- package/lib/cjs/components/IconBadge/IconBadge.test.d.ts +1 -0
- package/lib/cjs/components/IconBadge/IconBadge.test.js +9 -0
- package/lib/cjs/components/IconBadge/index.d.ts +1 -0
- package/lib/cjs/components/RadioGroupField/RadioGroupField.js +1 -3
- package/lib/cjs/types/iconBadge.d.ts +21 -0
- package/lib/cjs/types/iconBadge.js +6 -0
- package/lib/cjs/types/index.d.ts +1 -0
- package/lib/cjs/types/index.js +20 -9
- package/lib/components/IconBadge/IconBadge.js +1 -19
- package/lib/components/IconBadge/IconBadge.stories.js +1 -1
- package/lib/components/IconBadge/IconBadge.test.js +9 -0
- package/lib/components/RadioGroupField/RadioGroupField.js +1 -3
- package/lib/types/iconBadge.js +1 -0
- package/lib/types/index.js +1 -0
- package/package.json +1 -1
@@ -20,7 +20,6 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/he
|
|
20
20
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/slicedToArray"));
|
21
21
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/objectWithoutProperties"));
|
22
22
|
var _react = _interopRequireWildcard(require("react"));
|
23
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
24
23
|
var _index = require("../../index");
|
25
24
|
var _react2 = require("@emotion/react");
|
26
25
|
var _excluded = ["children", "sx", "circleColor", "baseSize", "circleSize"];
|
@@ -55,7 +54,7 @@ var IconBadge = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
55
54
|
position: 'absolute',
|
56
55
|
bottom: '-5.5px',
|
57
56
|
right: '1px',
|
58
|
-
borderRadius: "".concat(circleSize / 2, "px"),
|
57
|
+
borderRadius: "".concat(circleSize !== undefined && circleSize / 2, "px"),
|
59
58
|
height: "".concat(circleSize, "px"),
|
60
59
|
width: "".concat(circleSize, "px"),
|
61
60
|
alignItems: 'center',
|
@@ -64,23 +63,6 @@ var IconBadge = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
64
63
|
}
|
65
64
|
}, secondIcon));
|
66
65
|
});
|
67
|
-
IconBadge.propTypes = {
|
68
|
-
/** JSX styling that is passed into the component. */
|
69
|
-
sx: _propTypes["default"].shape({}),
|
70
|
-
/** Color that is applied to the circular background.
|
71
|
-
* Default is white.
|
72
|
-
*/
|
73
|
-
circleColor: _propTypes["default"].string,
|
74
|
-
/**
|
75
|
-
* The size of the base Icon. When given a number value, it will be converted to pixels.
|
76
|
-
*/
|
77
|
-
baseSize: _propTypes["default"].number,
|
78
|
-
/**
|
79
|
-
* The size of the Icon within the circle.
|
80
|
-
* When given a number value, it will be converted to pixels.
|
81
|
-
*/
|
82
|
-
circleSize: _propTypes["default"].number
|
83
|
-
};
|
84
66
|
IconBadge.defaultProps = {
|
85
67
|
circleColor: 'white'
|
86
68
|
};
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import { StoryFn } from '@storybook/react';
|
2
|
+
import { IconBadgeProps } from '../../types';
|
3
|
+
declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react/dist/types-0a347bb9").R, import("@storybook/types").Args>;
|
4
|
+
export default _default;
|
5
|
+
export declare const Default: StoryFn<IconBadgeProps>;
|
@@ -13,7 +13,7 @@ var _ArrowTopRightThickIcon = _interopRequireDefault(require("@pingux/mdi-react/
|
|
13
13
|
var _storybookAddonDesigns = require("storybook-addon-designs");
|
14
14
|
var _storybookDocsLayout = _interopRequireDefault(require("../../../.storybook/storybookDocsLayout"));
|
15
15
|
var _index = require("../../index");
|
16
|
-
var _figmaLinks = require("../../utils/designUtils/figmaLinks
|
16
|
+
var _figmaLinks = require("../../utils/designUtils/figmaLinks");
|
17
17
|
var _IconBadge = _interopRequireDefault(require("./IconBadge.mdx"));
|
18
18
|
var _react2 = require("@emotion/react");
|
19
19
|
var _default = {
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -62,4 +62,13 @@ test('default iconbadge render', function () {
|
|
62
62
|
getComponent();
|
63
63
|
var iconButton = _react2.screen.getByTestId(testId);
|
64
64
|
expect(iconButton).toBeInTheDocument();
|
65
|
+
});
|
66
|
+
test('iconbadge borderRadius renders correctly', function () {
|
67
|
+
var circleSize = 20;
|
68
|
+
getComponent({
|
69
|
+
circleSize: 20
|
70
|
+
});
|
71
|
+
var icons = _react2.screen.getAllByRole('img');
|
72
|
+
var secondIcon = icons[1].closest('span');
|
73
|
+
expect(secondIcon).toHaveStyle("border-radius: ".concat(circleSize / 2, "px"));
|
65
74
|
});
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default } from './IconBadge';
|
@@ -73,9 +73,7 @@ var RadioGroupField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
|
|
73
73
|
"aria-labelledby": helperText && helperTextId,
|
74
74
|
"data-testid": "radioGroupWrapper"
|
75
75
|
}, (0, _react2.jsx)(_RadioField.RadioContext.Provider, {
|
76
|
-
value:
|
77
|
-
isDisabled: isDisabled
|
78
|
-
}, state)
|
76
|
+
value: state
|
79
77
|
}, children)), helperText && (0, _react2.jsx)(_.FieldHelperText, {
|
80
78
|
status: status,
|
81
79
|
sx: {
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import { StylePropertyValue, ThemeUICSSObject } from 'theme-ui';
|
2
|
+
import { DOMAttributes, StyleProps } from './shared';
|
3
|
+
type UpdatedStyleProps = Omit<StyleProps, 'as'>;
|
4
|
+
export interface IconBadgeProps extends UpdatedStyleProps, DOMAttributes {
|
5
|
+
/** JSX styling that is passed into the component. */
|
6
|
+
sx?: ThemeUICSSObject;
|
7
|
+
/** Color that is applied to the circular background.
|
8
|
+
* Default is white.
|
9
|
+
*/
|
10
|
+
circleColor?: StylePropertyValue<string | undefined>;
|
11
|
+
/**
|
12
|
+
* The size of the base Icon. When given a number value, it will be converted to pixels.
|
13
|
+
*/
|
14
|
+
baseSize?: number | string | undefined;
|
15
|
+
/**
|
16
|
+
* The size of the Icon within the circle.
|
17
|
+
* When given a number value, it will be converted to pixels.
|
18
|
+
*/
|
19
|
+
circleSize?: number | undefined | 0;
|
20
|
+
}
|
21
|
+
export {};
|
package/lib/cjs/types/index.d.ts
CHANGED
package/lib/cjs/types/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
var _context, _context2, _context3, _context4, _context5, _context6, _context7, _context8, _context9, _context10, _context11, _context12, _context13, _context14;
|
3
|
+
var _context, _context2, _context3, _context4, _context5, _context6, _context7, _context8, _context9, _context10, _context11, _context12, _context13, _context14, _context15;
|
4
4
|
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
5
5
|
var _forEachInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/for-each");
|
6
6
|
var _Object$keys = require("@babel/runtime-corejs3/core-js-stable/object/keys");
|
@@ -73,8 +73,19 @@ _forEachInstanceProperty(_context6 = _Object$keys(_icon)).call(_context6, functi
|
|
73
73
|
}
|
74
74
|
});
|
75
75
|
});
|
76
|
+
var _iconBadge = require("./iconBadge");
|
77
|
+
_forEachInstanceProperty(_context7 = _Object$keys(_iconBadge)).call(_context7, function (key) {
|
78
|
+
if (key === "default" || key === "__esModule") return;
|
79
|
+
if (key in exports && exports[key] === _iconBadge[key]) return;
|
80
|
+
_Object$defineProperty(exports, key, {
|
81
|
+
enumerable: true,
|
82
|
+
get: function get() {
|
83
|
+
return _iconBadge[key];
|
84
|
+
}
|
85
|
+
});
|
86
|
+
});
|
76
87
|
var _item = require("./item");
|
77
|
-
_forEachInstanceProperty(
|
88
|
+
_forEachInstanceProperty(_context8 = _Object$keys(_item)).call(_context8, function (key) {
|
78
89
|
if (key === "default" || key === "__esModule") return;
|
79
90
|
if (key in exports && exports[key] === _item[key]) return;
|
80
91
|
_Object$defineProperty(exports, key, {
|
@@ -85,7 +96,7 @@ _forEachInstanceProperty(_context7 = _Object$keys(_item)).call(_context7, functi
|
|
85
96
|
});
|
86
97
|
});
|
87
98
|
var _link = require("./link");
|
88
|
-
_forEachInstanceProperty(
|
99
|
+
_forEachInstanceProperty(_context9 = _Object$keys(_link)).call(_context9, function (key) {
|
89
100
|
if (key === "default" || key === "__esModule") return;
|
90
101
|
if (key in exports && exports[key] === _link[key]) return;
|
91
102
|
_Object$defineProperty(exports, key, {
|
@@ -96,7 +107,7 @@ _forEachInstanceProperty(_context8 = _Object$keys(_link)).call(_context8, functi
|
|
96
107
|
});
|
97
108
|
});
|
98
109
|
var _loader = require("./loader");
|
99
|
-
_forEachInstanceProperty(
|
110
|
+
_forEachInstanceProperty(_context10 = _Object$keys(_loader)).call(_context10, function (key) {
|
100
111
|
if (key === "default" || key === "__esModule") return;
|
101
112
|
if (key in exports && exports[key] === _loader[key]) return;
|
102
113
|
_Object$defineProperty(exports, key, {
|
@@ -107,7 +118,7 @@ _forEachInstanceProperty(_context9 = _Object$keys(_loader)).call(_context9, func
|
|
107
118
|
});
|
108
119
|
});
|
109
120
|
var _popoverContainer = require("./popoverContainer");
|
110
|
-
_forEachInstanceProperty(
|
121
|
+
_forEachInstanceProperty(_context11 = _Object$keys(_popoverContainer)).call(_context11, function (key) {
|
111
122
|
if (key === "default" || key === "__esModule") return;
|
112
123
|
if (key in exports && exports[key] === _popoverContainer[key]) return;
|
113
124
|
_Object$defineProperty(exports, key, {
|
@@ -118,7 +129,7 @@ _forEachInstanceProperty(_context10 = _Object$keys(_popoverContainer)).call(_con
|
|
118
129
|
});
|
119
130
|
});
|
120
131
|
var _separator = require("./separator");
|
121
|
-
_forEachInstanceProperty(
|
132
|
+
_forEachInstanceProperty(_context12 = _Object$keys(_separator)).call(_context12, function (key) {
|
122
133
|
if (key === "default" || key === "__esModule") return;
|
123
134
|
if (key in exports && exports[key] === _separator[key]) return;
|
124
135
|
_Object$defineProperty(exports, key, {
|
@@ -129,7 +140,7 @@ _forEachInstanceProperty(_context11 = _Object$keys(_separator)).call(_context11,
|
|
129
140
|
});
|
130
141
|
});
|
131
142
|
var _shared = require("./shared");
|
132
|
-
_forEachInstanceProperty(
|
143
|
+
_forEachInstanceProperty(_context13 = _Object$keys(_shared)).call(_context13, function (key) {
|
133
144
|
if (key === "default" || key === "__esModule") return;
|
134
145
|
if (key in exports && exports[key] === _shared[key]) return;
|
135
146
|
_Object$defineProperty(exports, key, {
|
@@ -140,7 +151,7 @@ _forEachInstanceProperty(_context12 = _Object$keys(_shared)).call(_context12, fu
|
|
140
151
|
});
|
141
152
|
});
|
142
153
|
var _tableCell = require("./tableCell");
|
143
|
-
_forEachInstanceProperty(
|
154
|
+
_forEachInstanceProperty(_context14 = _Object$keys(_tableCell)).call(_context14, function (key) {
|
144
155
|
if (key === "default" || key === "__esModule") return;
|
145
156
|
if (key in exports && exports[key] === _tableCell[key]) return;
|
146
157
|
_Object$defineProperty(exports, key, {
|
@@ -151,7 +162,7 @@ _forEachInstanceProperty(_context13 = _Object$keys(_tableCell)).call(_context13,
|
|
151
162
|
});
|
152
163
|
});
|
153
164
|
var _text = require("./text");
|
154
|
-
_forEachInstanceProperty(
|
165
|
+
_forEachInstanceProperty(_context15 = _Object$keys(_text)).call(_context15, function (key) {
|
155
166
|
if (key === "default" || key === "__esModule") return;
|
156
167
|
if (key in exports && exports[key] === _text[key]) return;
|
157
168
|
_Object$defineProperty(exports, key, {
|
@@ -14,7 +14,6 @@ var _excluded = ["children", "sx", "circleColor", "baseSize", "circleSize"];
|
|
14
14
|
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; }
|
15
15
|
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; }
|
16
16
|
import React, { forwardRef } from 'react';
|
17
|
-
import PropTypes from 'prop-types';
|
18
17
|
import { Box } from '../../index';
|
19
18
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
20
19
|
var IconBadge = /*#__PURE__*/forwardRef(function (props, ref) {
|
@@ -44,7 +43,7 @@ var IconBadge = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
44
43
|
position: 'absolute',
|
45
44
|
bottom: '-5.5px',
|
46
45
|
right: '1px',
|
47
|
-
borderRadius: "".concat(circleSize / 2, "px"),
|
46
|
+
borderRadius: "".concat(circleSize !== undefined && circleSize / 2, "px"),
|
48
47
|
height: "".concat(circleSize, "px"),
|
49
48
|
width: "".concat(circleSize, "px"),
|
50
49
|
alignItems: 'center',
|
@@ -53,23 +52,6 @@ var IconBadge = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
53
52
|
}
|
54
53
|
}, secondIcon));
|
55
54
|
});
|
56
|
-
IconBadge.propTypes = {
|
57
|
-
/** JSX styling that is passed into the component. */
|
58
|
-
sx: PropTypes.shape({}),
|
59
|
-
/** Color that is applied to the circular background.
|
60
|
-
* Default is white.
|
61
|
-
*/
|
62
|
-
circleColor: PropTypes.string,
|
63
|
-
/**
|
64
|
-
* The size of the base Icon. When given a number value, it will be converted to pixels.
|
65
|
-
*/
|
66
|
-
baseSize: PropTypes.number,
|
67
|
-
/**
|
68
|
-
* The size of the Icon within the circle.
|
69
|
-
* When given a number value, it will be converted to pixels.
|
70
|
-
*/
|
71
|
-
circleSize: PropTypes.number
|
72
|
-
};
|
73
55
|
IconBadge.defaultProps = {
|
74
56
|
circleColor: 'white'
|
75
57
|
};
|
@@ -5,7 +5,7 @@ import ArrowIcon from '@pingux/mdi-react/ArrowTopRightThickIcon';
|
|
5
5
|
import { withDesign } from 'storybook-addon-designs';
|
6
6
|
import DocsLayout from '../../../.storybook/storybookDocsLayout';
|
7
7
|
import { Box, Icon, IconBadge } from '../../index';
|
8
|
-
import { FIGMA_LINKS } from '../../utils/designUtils/figmaLinks
|
8
|
+
import { FIGMA_LINKS } from '../../utils/designUtils/figmaLinks';
|
9
9
|
import IconBadgeReadme from './IconBadge.mdx';
|
10
10
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
11
11
|
export default {
|
@@ -59,4 +59,13 @@ test('default iconbadge render', function () {
|
|
59
59
|
getComponent();
|
60
60
|
var iconButton = screen.getByTestId(testId);
|
61
61
|
expect(iconButton).toBeInTheDocument();
|
62
|
+
});
|
63
|
+
test('iconbadge borderRadius renders correctly', function () {
|
64
|
+
var circleSize = 20;
|
65
|
+
getComponent({
|
66
|
+
circleSize: 20
|
67
|
+
});
|
68
|
+
var icons = screen.getAllByRole('img');
|
69
|
+
var secondIcon = icons[1].closest('span');
|
70
|
+
expect(secondIcon).toHaveStyle("border-radius: ".concat(circleSize / 2, "px"));
|
62
71
|
});
|
@@ -62,9 +62,7 @@ var RadioGroupField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
62
62
|
"aria-labelledby": helperText && helperTextId,
|
63
63
|
"data-testid": "radioGroupWrapper"
|
64
64
|
}, ___EmotionJSX(RadioContext.Provider, {
|
65
|
-
value:
|
66
|
-
isDisabled: isDisabled
|
67
|
-
}, state)
|
65
|
+
value: state
|
68
66
|
}, children)), helperText && ___EmotionJSX(FieldHelperText, {
|
69
67
|
status: status,
|
70
68
|
sx: {
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
package/lib/types/index.js
CHANGED