@pingux/astro 2.17.0-alpha.5 → 2.17.0-alpha.7
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/EnvironmentBreadcrumb/EnvironmentBreadcrumb.test.js +7 -2
- package/lib/cjs/components/EnvironmentBreadcrumb/EnvironmentBreadcrumbAxe.test.js +7 -0
- package/lib/cjs/components/ListView/ListView.stories.js +38 -3
- package/lib/cjs/components/ListViewItem/ListViewItem.mdx +1 -0
- package/lib/cjs/components/ListViewItem/ListViewItem.stories.js +36 -2
- package/lib/cjs/components/ListViewItem/ListViewItem.styles.js +1 -1
- package/lib/cjs/components/ListViewItem/controls/chart/ListViewItemChart.js +102 -0
- package/lib/cjs/components/ListViewItem/controls/chart/ListViewItemChart.mdx +11 -0
- package/lib/cjs/components/ListViewItem/controls/chart/ListViewItemChart.stories.js +50 -0
- package/lib/cjs/components/ListViewItem/controls/chart/ListViewItemChart.styles.js +112 -0
- package/lib/cjs/components/ListViewItem/controls/chart/ListViewItemChart.test.js +76 -0
- package/lib/cjs/components/ListViewItem/controls/chart/ListViewItemChartAttributes.js +127 -0
- package/lib/cjs/components/ListViewItem/controls/chart/chartData.js +45 -0
- package/lib/cjs/index.d.ts +1 -0
- package/lib/cjs/index.js +8 -0
- package/lib/cjs/styles/variants/variants.js +2 -0
- package/lib/cjs/utils/testUtils/testAxe.js +4 -3
- package/lib/components/EnvironmentBreadcrumb/EnvironmentBreadcrumb.test.js +3 -4
- package/lib/components/EnvironmentBreadcrumb/EnvironmentBreadcrumbAxe.test.js +4 -0
- package/lib/components/ListView/ListView.stories.js +32 -2
- package/lib/components/ListViewItem/ListViewItem.mdx +1 -0
- package/lib/components/ListViewItem/ListViewItem.stories.js +30 -2
- package/lib/components/ListViewItem/ListViewItem.styles.js +1 -1
- package/lib/components/ListViewItem/controls/chart/ListViewItemChart.js +88 -0
- package/lib/components/ListViewItem/controls/chart/ListViewItemChart.mdx +11 -0
- package/lib/components/ListViewItem/controls/chart/ListViewItemChart.stories.js +35 -0
- package/lib/components/ListViewItem/controls/chart/ListViewItemChart.styles.js +104 -0
- package/lib/components/ListViewItem/controls/chart/ListViewItemChart.test.js +73 -0
- package/lib/components/ListViewItem/controls/chart/ListViewItemChartAttributes.js +118 -0
- package/lib/components/ListViewItem/controls/chart/chartData.js +37 -0
- package/lib/index.js +1 -0
- package/lib/styles/variants/variants.js +2 -0
- package/lib/utils/testUtils/testAxe.js +4 -3
- package/package.json +2 -2
@@ -0,0 +1,73 @@
|
|
1
|
+
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
2
|
+
import React from 'react';
|
3
|
+
import useResizeObserver from 'use-resize-observer';
|
4
|
+
import axeTest from '../../../../utils/testUtils/testAxe';
|
5
|
+
import { render, screen } from '../../../../utils/testUtils/testWrapper';
|
6
|
+
import Box from '../../../Box/Box';
|
7
|
+
import { chartData } from './chartData';
|
8
|
+
import ListViewItemChart from './ListViewItemChart';
|
9
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
10
|
+
jest.mock('use-resize-observer');
|
11
|
+
var Chart = function Chart(props) {
|
12
|
+
var ref = React.useRef();
|
13
|
+
return ___EmotionJSX(Box, {
|
14
|
+
ref: ref
|
15
|
+
}, ___EmotionJSX(ListViewItemChart, _extends({
|
16
|
+
containerRef: ref,
|
17
|
+
chartData: chartData,
|
18
|
+
chartDataKey: "fullData",
|
19
|
+
title: "Avg daily sign-ons:",
|
20
|
+
contentCount: "1,234,234",
|
21
|
+
contentCountLabel: "Past 7 days",
|
22
|
+
chartLabel: "12 wk trend",
|
23
|
+
trend: "+ 8.6%",
|
24
|
+
tooltipText: "See Contributing Data"
|
25
|
+
}, props)));
|
26
|
+
};
|
27
|
+
var getComponent = function getComponent() {
|
28
|
+
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
29
|
+
return render(___EmotionJSX(Chart, props));
|
30
|
+
};
|
31
|
+
var _window = window,
|
32
|
+
ResizeObserver = _window.ResizeObserver;
|
33
|
+
beforeEach(function () {
|
34
|
+
useResizeObserver.mockReturnValue({
|
35
|
+
width: 800
|
36
|
+
});
|
37
|
+
jest.spyOn(HTMLElement.prototype, 'clientHeight', 'get').mockReturnValue(400);
|
38
|
+
jest.spyOn(HTMLElement.prototype, 'clientWidth', 'get').mockReturnValue(800);
|
39
|
+
delete window.ResizeObserver;
|
40
|
+
window.ResizeObserver = jest.fn().mockImplementation(function () {
|
41
|
+
return {
|
42
|
+
observe: jest.fn(),
|
43
|
+
unobserve: jest.fn(),
|
44
|
+
disconnect: jest.fn()
|
45
|
+
};
|
46
|
+
});
|
47
|
+
});
|
48
|
+
afterEach(function () {
|
49
|
+
window.ResizeObserver = ResizeObserver;
|
50
|
+
jest.restoreAllMocks();
|
51
|
+
});
|
52
|
+
|
53
|
+
// Need to be added to each test file to test accessibility using axe.
|
54
|
+
axeTest(getComponent);
|
55
|
+
test('renders ListViewItemChart component', function () {
|
56
|
+
getComponent();
|
57
|
+
var chart = screen.getByRole('region');
|
58
|
+
var content = screen.getByText('Past 7 days');
|
59
|
+
expect(chart).toBeInTheDocument();
|
60
|
+
expect(content).toBeInTheDocument();
|
61
|
+
expect(!!content.parentNode.getAttribute('style')).toBeFalsy();
|
62
|
+
});
|
63
|
+
test('renders ListViewItemChart component for tablet', function () {
|
64
|
+
useResizeObserver.mockReturnValue({
|
65
|
+
width: 500
|
66
|
+
});
|
67
|
+
getComponent();
|
68
|
+
var chart = screen.getByRole('region');
|
69
|
+
var content = screen.getByText('Past 7 days');
|
70
|
+
expect(chart).toBeInTheDocument();
|
71
|
+
expect(content).toBeInTheDocument();
|
72
|
+
expect(!!content.parentNode.getAttribute('style')).toBeTruthy();
|
73
|
+
});
|
@@ -0,0 +1,118 @@
|
|
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
|
+
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
|
+
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
|
+
import PropTypes from 'prop-types';
|
13
|
+
import { docArgTypes } from '../../../../utils/docUtils/docArgTypes';
|
14
|
+
import { buttonArgTypes } from '../../../Button/buttonAttributes';
|
15
|
+
var descriptions = {
|
16
|
+
buttonProps: 'Object includes same props as `Button` component',
|
17
|
+
chartData: 'Array with objects `{ id, keyName }` for chart',
|
18
|
+
chartDataKey: 'Name of the `keyName` in `chartData`',
|
19
|
+
chartLabel: 'Label under chart',
|
20
|
+
mobileBreakPoint: 'Container width breakpoint to hide all ListViewItemChart',
|
21
|
+
tabletBreakPoint: 'Container width breakpoint to hide content (counter and counter label)',
|
22
|
+
title: 'Main title of chart',
|
23
|
+
tooltipText: 'Text inside tooltip',
|
24
|
+
contentCount: 'Number of events',
|
25
|
+
contentCountLabel: 'Label under `contentCount`',
|
26
|
+
trend: 'Text for trend'
|
27
|
+
};
|
28
|
+
export var listViewItemChartArgTypes = {
|
29
|
+
buttonProps: _objectSpread(_objectSpread({}, buttonArgTypes), {}, {
|
30
|
+
type: {
|
31
|
+
summary: docArgTypes.object
|
32
|
+
},
|
33
|
+
description: descriptions.buttonProps,
|
34
|
+
control: 'object'
|
35
|
+
}),
|
36
|
+
chartData: {
|
37
|
+
description: descriptions.chartData,
|
38
|
+
type: {
|
39
|
+
summary: docArgTypes.object
|
40
|
+
},
|
41
|
+
control: 'object'
|
42
|
+
},
|
43
|
+
chartDataKey: {
|
44
|
+
description: descriptions.chartDataKey,
|
45
|
+
type: {
|
46
|
+
summary: docArgTypes.string
|
47
|
+
},
|
48
|
+
control: 'text'
|
49
|
+
},
|
50
|
+
chartLabel: {
|
51
|
+
description: descriptions.chartLabel,
|
52
|
+
type: {
|
53
|
+
summary: docArgTypes.string
|
54
|
+
},
|
55
|
+
control: 'text'
|
56
|
+
},
|
57
|
+
mobileBreakPoint: {
|
58
|
+
description: descriptions.mobileBreakPoint,
|
59
|
+
type: {
|
60
|
+
summary: docArgTypes.number
|
61
|
+
},
|
62
|
+
control: 'number'
|
63
|
+
},
|
64
|
+
tabletBreakPoint: {
|
65
|
+
description: descriptions.tabletBreakPoint,
|
66
|
+
type: {
|
67
|
+
summary: docArgTypes.number
|
68
|
+
},
|
69
|
+
control: 'number'
|
70
|
+
},
|
71
|
+
title: {
|
72
|
+
description: descriptions.title,
|
73
|
+
type: {
|
74
|
+
summary: docArgTypes.string
|
75
|
+
},
|
76
|
+
control: 'text'
|
77
|
+
},
|
78
|
+
tooltipText: {
|
79
|
+
description: descriptions.tooltipText,
|
80
|
+
type: {
|
81
|
+
summary: docArgTypes.string
|
82
|
+
},
|
83
|
+
control: 'text'
|
84
|
+
},
|
85
|
+
contentCount: {
|
86
|
+
description: descriptions.contentCount,
|
87
|
+
type: {
|
88
|
+
summary: docArgTypes.string
|
89
|
+
},
|
90
|
+
control: 'text'
|
91
|
+
},
|
92
|
+
contentCountLabel: {
|
93
|
+
description: descriptions.contentCountLabel,
|
94
|
+
type: {
|
95
|
+
summary: docArgTypes.string
|
96
|
+
},
|
97
|
+
control: 'text'
|
98
|
+
},
|
99
|
+
trend: {
|
100
|
+
description: descriptions.trend,
|
101
|
+
type: {
|
102
|
+
summary: docArgTypes.string
|
103
|
+
},
|
104
|
+
control: 'text'
|
105
|
+
}
|
106
|
+
};
|
107
|
+
export var listViewItemChartPropTypes = {
|
108
|
+
chartData: PropTypes.arrayOf(PropTypes.shape({})),
|
109
|
+
chartLabel: PropTypes.string,
|
110
|
+
chartDataKey: PropTypes.string,
|
111
|
+
contentCount: PropTypes.string,
|
112
|
+
contentCountLabel: PropTypes.string,
|
113
|
+
mobileBreakPoint: PropTypes.number,
|
114
|
+
tabletBreakPoint: PropTypes.number,
|
115
|
+
title: PropTypes.string,
|
116
|
+
tooltipText: PropTypes.string,
|
117
|
+
trend: PropTypes.string
|
118
|
+
};
|
@@ -0,0 +1,37 @@
|
|
1
|
+
export var chartData = [{
|
2
|
+
id: 1,
|
3
|
+
fullData: 1
|
4
|
+
}, {
|
5
|
+
id: 2,
|
6
|
+
fullData: 5
|
7
|
+
}, {
|
8
|
+
id: 3,
|
9
|
+
fullData: 3
|
10
|
+
}, {
|
11
|
+
id: 4,
|
12
|
+
fullData: 2
|
13
|
+
}, {
|
14
|
+
id: 5,
|
15
|
+
fullData: 5
|
16
|
+
}, {
|
17
|
+
id: 6,
|
18
|
+
fullData: 1
|
19
|
+
}, {
|
20
|
+
id: 7,
|
21
|
+
fullData: 5
|
22
|
+
}, {
|
23
|
+
id: 8,
|
24
|
+
fullData: 5
|
25
|
+
}, {
|
26
|
+
id: 9,
|
27
|
+
fullData: 1
|
28
|
+
}, {
|
29
|
+
id: 10,
|
30
|
+
fullData: 2
|
31
|
+
}, {
|
32
|
+
id: 11,
|
33
|
+
fullData: 4
|
34
|
+
}, {
|
35
|
+
id: 12,
|
36
|
+
fullData: 11
|
37
|
+
}];
|
package/lib/index.js
CHANGED
@@ -84,6 +84,7 @@ export * from './components/ListItem';
|
|
84
84
|
export { default as ListView } from './components/ListView';
|
85
85
|
export * from './components/ListView';
|
86
86
|
export { default as ListViewItem } from './components/ListViewItem';
|
87
|
+
export { default as ListViewItemChart } from './components/ListViewItem/controls/chart/ListViewItemChart';
|
87
88
|
export { default as ListViewItemEditButton } from './components/ListViewItem/controls/ListViewItemEditButton';
|
88
89
|
export { default as ListViewItemMenu } from './components/ListViewItem/controls/ListViewItemMenu';
|
89
90
|
export { default as ListViewItemSwitchField } from './components/ListViewItem/controls/ListViewItemSwitchField';
|
@@ -26,6 +26,7 @@ import helpHint from '../../components/HelpHint/HelpHint.styles';
|
|
26
26
|
import imageUpload from '../../components/ImageUploadField/imageUpload';
|
27
27
|
import listBox from '../../components/ListBox/ListBox.styles';
|
28
28
|
import listItem from '../../components/ListItem/ListItem.styles';
|
29
|
+
import lisViewItemChart from '../../components/ListViewItem/controls/chart/ListViewItemChart.styles';
|
29
30
|
import listViewItem from '../../components/ListViewItem/ListViewItem.styles';
|
30
31
|
import loader from '../../components/Loader/Loader.styles';
|
31
32
|
import menu from '../../components/Menu/Menu.styles';
|
@@ -63,6 +64,7 @@ export default _objectSpread({
|
|
63
64
|
listBox: listBox,
|
64
65
|
listItem: listItem,
|
65
66
|
listViewItem: listViewItem,
|
67
|
+
lisViewItemChart: lisViewItemChart,
|
66
68
|
loader: loader,
|
67
69
|
menu: menu,
|
68
70
|
menuItem: menuItem,
|
@@ -24,13 +24,14 @@ var axeTest = /*#__PURE__*/function () {
|
|
24
24
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
25
25
|
while (1) switch (_context.prev = _context.next) {
|
26
26
|
case 0:
|
27
|
+
jest.useRealTimers();
|
27
28
|
_getComponent = getComponent(), container = _getComponent.container;
|
28
|
-
_context.next =
|
29
|
+
_context.next = 4;
|
29
30
|
return axe(container, rules);
|
30
|
-
case
|
31
|
+
case 4:
|
31
32
|
results = _context.sent;
|
32
33
|
expect(results).toHaveNoViolations();
|
33
|
-
case
|
34
|
+
case 6:
|
34
35
|
case "end":
|
35
36
|
return _context.stop();
|
36
37
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@pingux/astro",
|
3
|
-
"version": "2.17.0-alpha.
|
3
|
+
"version": "2.17.0-alpha.7",
|
4
4
|
"description": "React component library for Ping Identity's design system",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
@@ -102,7 +102,7 @@
|
|
102
102
|
"react-color": "^2.19.3",
|
103
103
|
"react-dropzone": "^11.4.2",
|
104
104
|
"react-stately": "^3.20.0",
|
105
|
-
"recharts": "^2.
|
105
|
+
"recharts": "^2.7.0",
|
106
106
|
"regenerator-runtime": "^0.13.7",
|
107
107
|
"styled-system": "^5.1.5",
|
108
108
|
"theme-ui": "^0.10.0",
|