@pingux/astro 2.17.0-alpha.4 → 2.17.0-alpha.6
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/ArrayField/ArrayField.stories.js +1 -3
- package/lib/cjs/components/HelpHint/HelpHint.js +5 -2
- package/lib/cjs/components/HelpHint/HelpHint.stories.js +3 -2
- package/lib/cjs/components/HelpHint/HelpHint.styles.js +5 -1
- package/lib/cjs/components/HelpHint/HelpHint.test.js +13 -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/components/ArrayField/ArrayField.stories.js +1 -3
- package/lib/components/HelpHint/HelpHint.js +5 -2
- package/lib/components/HelpHint/HelpHint.stories.js +3 -2
- package/lib/components/HelpHint/HelpHint.styles.js +5 -1
- package/lib/components/HelpHint/HelpHint.test.js +13 -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/package.json +2 -2
@@ -0,0 +1,127 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _Object$keys = require("@babel/runtime-corejs3/core-js-stable/object/keys");
|
4
|
+
var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols");
|
5
|
+
var _filterInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/filter");
|
6
|
+
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
|
7
|
+
var _forEachInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/for-each");
|
8
|
+
var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors");
|
9
|
+
var _Object$defineProperties = require("@babel/runtime-corejs3/core-js-stable/object/define-properties");
|
10
|
+
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
11
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
12
|
+
_Object$defineProperty(exports, "__esModule", {
|
13
|
+
value: true
|
14
|
+
});
|
15
|
+
exports.listViewItemChartPropTypes = exports.listViewItemChartArgTypes = void 0;
|
16
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
17
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
18
|
+
var _docArgTypes = require("../../../../utils/docUtils/docArgTypes");
|
19
|
+
var _buttonAttributes = require("../../../Button/buttonAttributes");
|
20
|
+
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; }
|
21
|
+
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) { (0, _defineProperty2["default"])(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; }
|
22
|
+
var descriptions = {
|
23
|
+
buttonProps: 'Object includes same props as `Button` component',
|
24
|
+
chartData: 'Array with objects `{ id, keyName }` for chart',
|
25
|
+
chartDataKey: 'Name of the `keyName` in `chartData`',
|
26
|
+
chartLabel: 'Label under chart',
|
27
|
+
mobileBreakPoint: 'Container width breakpoint to hide all ListViewItemChart',
|
28
|
+
tabletBreakPoint: 'Container width breakpoint to hide content (counter and counter label)',
|
29
|
+
title: 'Main title of chart',
|
30
|
+
tooltipText: 'Text inside tooltip',
|
31
|
+
contentCount: 'Number of events',
|
32
|
+
contentCountLabel: 'Label under `contentCount`',
|
33
|
+
trend: 'Text for trend'
|
34
|
+
};
|
35
|
+
var listViewItemChartArgTypes = {
|
36
|
+
buttonProps: _objectSpread(_objectSpread({}, _buttonAttributes.buttonArgTypes), {}, {
|
37
|
+
type: {
|
38
|
+
summary: _docArgTypes.docArgTypes.object
|
39
|
+
},
|
40
|
+
description: descriptions.buttonProps,
|
41
|
+
control: 'object'
|
42
|
+
}),
|
43
|
+
chartData: {
|
44
|
+
description: descriptions.chartData,
|
45
|
+
type: {
|
46
|
+
summary: _docArgTypes.docArgTypes.object
|
47
|
+
},
|
48
|
+
control: 'object'
|
49
|
+
},
|
50
|
+
chartDataKey: {
|
51
|
+
description: descriptions.chartDataKey,
|
52
|
+
type: {
|
53
|
+
summary: _docArgTypes.docArgTypes.string
|
54
|
+
},
|
55
|
+
control: 'text'
|
56
|
+
},
|
57
|
+
chartLabel: {
|
58
|
+
description: descriptions.chartLabel,
|
59
|
+
type: {
|
60
|
+
summary: _docArgTypes.docArgTypes.string
|
61
|
+
},
|
62
|
+
control: 'text'
|
63
|
+
},
|
64
|
+
mobileBreakPoint: {
|
65
|
+
description: descriptions.mobileBreakPoint,
|
66
|
+
type: {
|
67
|
+
summary: _docArgTypes.docArgTypes.number
|
68
|
+
},
|
69
|
+
control: 'number'
|
70
|
+
},
|
71
|
+
tabletBreakPoint: {
|
72
|
+
description: descriptions.tabletBreakPoint,
|
73
|
+
type: {
|
74
|
+
summary: _docArgTypes.docArgTypes.number
|
75
|
+
},
|
76
|
+
control: 'number'
|
77
|
+
},
|
78
|
+
title: {
|
79
|
+
description: descriptions.title,
|
80
|
+
type: {
|
81
|
+
summary: _docArgTypes.docArgTypes.string
|
82
|
+
},
|
83
|
+
control: 'text'
|
84
|
+
},
|
85
|
+
tooltipText: {
|
86
|
+
description: descriptions.tooltipText,
|
87
|
+
type: {
|
88
|
+
summary: _docArgTypes.docArgTypes.string
|
89
|
+
},
|
90
|
+
control: 'text'
|
91
|
+
},
|
92
|
+
contentCount: {
|
93
|
+
description: descriptions.contentCount,
|
94
|
+
type: {
|
95
|
+
summary: _docArgTypes.docArgTypes.string
|
96
|
+
},
|
97
|
+
control: 'text'
|
98
|
+
},
|
99
|
+
contentCountLabel: {
|
100
|
+
description: descriptions.contentCountLabel,
|
101
|
+
type: {
|
102
|
+
summary: _docArgTypes.docArgTypes.string
|
103
|
+
},
|
104
|
+
control: 'text'
|
105
|
+
},
|
106
|
+
trend: {
|
107
|
+
description: descriptions.trend,
|
108
|
+
type: {
|
109
|
+
summary: _docArgTypes.docArgTypes.string
|
110
|
+
},
|
111
|
+
control: 'text'
|
112
|
+
}
|
113
|
+
};
|
114
|
+
exports.listViewItemChartArgTypes = listViewItemChartArgTypes;
|
115
|
+
var listViewItemChartPropTypes = {
|
116
|
+
chartData: _propTypes["default"].arrayOf(_propTypes["default"].shape({})),
|
117
|
+
chartLabel: _propTypes["default"].string,
|
118
|
+
chartDataKey: _propTypes["default"].string,
|
119
|
+
contentCount: _propTypes["default"].string,
|
120
|
+
contentCountLabel: _propTypes["default"].string,
|
121
|
+
mobileBreakPoint: _propTypes["default"].number,
|
122
|
+
tabletBreakPoint: _propTypes["default"].number,
|
123
|
+
title: _propTypes["default"].string,
|
124
|
+
tooltipText: _propTypes["default"].string,
|
125
|
+
trend: _propTypes["default"].string
|
126
|
+
};
|
127
|
+
exports.listViewItemChartPropTypes = listViewItemChartPropTypes;
|
@@ -0,0 +1,45 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
4
|
+
_Object$defineProperty(exports, "__esModule", {
|
5
|
+
value: true
|
6
|
+
});
|
7
|
+
exports.chartData = void 0;
|
8
|
+
var chartData = [{
|
9
|
+
id: 1,
|
10
|
+
fullData: 1
|
11
|
+
}, {
|
12
|
+
id: 2,
|
13
|
+
fullData: 5
|
14
|
+
}, {
|
15
|
+
id: 3,
|
16
|
+
fullData: 3
|
17
|
+
}, {
|
18
|
+
id: 4,
|
19
|
+
fullData: 2
|
20
|
+
}, {
|
21
|
+
id: 5,
|
22
|
+
fullData: 5
|
23
|
+
}, {
|
24
|
+
id: 6,
|
25
|
+
fullData: 1
|
26
|
+
}, {
|
27
|
+
id: 7,
|
28
|
+
fullData: 5
|
29
|
+
}, {
|
30
|
+
id: 8,
|
31
|
+
fullData: 5
|
32
|
+
}, {
|
33
|
+
id: 9,
|
34
|
+
fullData: 1
|
35
|
+
}, {
|
36
|
+
id: 10,
|
37
|
+
fullData: 2
|
38
|
+
}, {
|
39
|
+
id: 11,
|
40
|
+
fullData: 4
|
41
|
+
}, {
|
42
|
+
id: 12,
|
43
|
+
fullData: 11
|
44
|
+
}];
|
45
|
+
exports.chartData = chartData;
|
package/lib/cjs/index.d.ts
CHANGED
@@ -80,6 +80,7 @@ export * from './components/ListItem';
|
|
80
80
|
export { default as ListView } from './components/ListView';
|
81
81
|
export * from './components/ListView';
|
82
82
|
export { default as ListViewItem } from './components/ListViewItem';
|
83
|
+
export { default as ListViewItemChart } from './components/ListViewItem/controls/chart/ListViewItemChart';
|
83
84
|
export { default as ListViewItemEditButton } from './components/ListViewItem/controls/ListViewItemEditButton';
|
84
85
|
export { default as ListViewItemMenu } from './components/ListViewItem/controls/ListViewItemMenu';
|
85
86
|
export { default as ListViewItemSwitchField } from './components/ListViewItem/controls/ListViewItemSwitchField';
|
package/lib/cjs/index.js
CHANGED
@@ -58,6 +58,7 @@ var _exportNames = {
|
|
58
58
|
ListItem: true,
|
59
59
|
ListView: true,
|
60
60
|
ListViewItem: true,
|
61
|
+
ListViewItemChart: true,
|
61
62
|
ListViewItemEditButton: true,
|
62
63
|
ListViewItemMenu: true,
|
63
64
|
ListViewItemSwitchField: true,
|
@@ -451,6 +452,12 @@ _Object$defineProperty(exports, "ListViewItem", {
|
|
451
452
|
return _ListViewItem["default"];
|
452
453
|
}
|
453
454
|
});
|
455
|
+
_Object$defineProperty(exports, "ListViewItemChart", {
|
456
|
+
enumerable: true,
|
457
|
+
get: function get() {
|
458
|
+
return _ListViewItemChart["default"];
|
459
|
+
}
|
460
|
+
});
|
454
461
|
_Object$defineProperty(exports, "ListViewItemEditButton", {
|
455
462
|
enumerable: true,
|
456
463
|
get: function get() {
|
@@ -1210,6 +1217,7 @@ _forEachInstanceProperty(_context36 = _Object$keys(_ListView)).call(_context36,
|
|
1210
1217
|
});
|
1211
1218
|
});
|
1212
1219
|
var _ListViewItem = _interopRequireDefault(require("./components/ListViewItem"));
|
1220
|
+
var _ListViewItemChart = _interopRequireDefault(require("./components/ListViewItem/controls/chart/ListViewItemChart"));
|
1213
1221
|
var _ListViewItemEditButton = _interopRequireDefault(require("./components/ListViewItem/controls/ListViewItemEditButton"));
|
1214
1222
|
var _ListViewItemMenu = _interopRequireDefault(require("./components/ListViewItem/controls/ListViewItemMenu"));
|
1215
1223
|
var _ListViewItemSwitchField = _interopRequireDefault(require("./components/ListViewItem/controls/ListViewItemSwitchField"));
|
@@ -33,6 +33,7 @@ var _HelpHint = _interopRequireDefault(require("../../components/HelpHint/HelpHi
|
|
33
33
|
var _imageUpload = _interopRequireDefault(require("../../components/ImageUploadField/imageUpload"));
|
34
34
|
var _ListBox = _interopRequireDefault(require("../../components/ListBox/ListBox.styles"));
|
35
35
|
var _ListItem = _interopRequireDefault(require("../../components/ListItem/ListItem.styles"));
|
36
|
+
var _ListViewItemChart = _interopRequireDefault(require("../../components/ListViewItem/controls/chart/ListViewItemChart.styles"));
|
36
37
|
var _ListViewItem = _interopRequireDefault(require("../../components/ListViewItem/ListViewItem.styles"));
|
37
38
|
var _Loader = _interopRequireDefault(require("../../components/Loader/Loader.styles"));
|
38
39
|
var _Menu = _interopRequireDefault(require("../../components/Menu/Menu.styles"));
|
@@ -74,6 +75,7 @@ var _default = _objectSpread({
|
|
74
75
|
listBox: _ListBox["default"],
|
75
76
|
listItem: _ListItem["default"],
|
76
77
|
listViewItem: _ListViewItem["default"],
|
78
|
+
lisViewItemChart: _ListViewItemChart["default"],
|
77
79
|
loader: _Loader["default"],
|
78
80
|
menu: _Menu["default"],
|
79
81
|
menuItem: _MenuItem["default"],
|
@@ -85,9 +85,7 @@ export var Uncontrolled = function Uncontrolled(_ref) {
|
|
85
85
|
hintText: 'Example Hint',
|
86
86
|
isRequired: true,
|
87
87
|
helpHintProps: {
|
88
|
-
|
89
|
-
direction: 'top'
|
90
|
-
}
|
88
|
+
direction: 'top'
|
91
89
|
}
|
92
90
|
},
|
93
91
|
renderField: function renderField(id, fieldValue, onFieldValueChange, onFieldDelete, isDisabled, otherFieldProps) {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
2
2
|
import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
3
3
|
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
4
|
-
var _excluded = ["align", "arrowCrossOffset", "children", "className", "closeDelay", "direction", "hasNoArrow", "iconButtonProps", "isDarkMode", "isNotFlippable", "offset", "popoverProps"];
|
4
|
+
var _excluded = ["align", "arrowCrossOffset", "children", "className", "closeDelay", "direction", "hasNoArrow", "iconButtonProps", "isDarkMode", "isNotFlippable", "offset", "popoverProps", "tooltipProps"];
|
5
5
|
import _setTimeout from "@babel/runtime-corejs3/core-js-stable/set-timeout";
|
6
6
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
7
7
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
@@ -43,6 +43,7 @@ var HelpHint = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
43
43
|
isNotFlippable = props.isNotFlippable,
|
44
44
|
offset = props.offset,
|
45
45
|
popoverProps = props.popoverProps,
|
46
|
+
tooltipProps = props.tooltipProps,
|
46
47
|
others = _objectWithoutProperties(props, _excluded);
|
47
48
|
var _useState = useState(false),
|
48
49
|
_useState2 = _slicedToArray(_useState, 2),
|
@@ -152,7 +153,7 @@ var HelpHint = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
152
153
|
onClose: close,
|
153
154
|
placement: placement,
|
154
155
|
ref: overlayRef
|
155
|
-
}, mergeProps(overlayProps, positionProps, popoverProps, overlayHoverProps, focusWithinProps)), ___EmotionJSX(FocusScope, {
|
156
|
+
}, mergeProps(overlayProps, positionProps, popoverProps || tooltipProps, overlayHoverProps, focusWithinProps)), ___EmotionJSX(FocusScope, {
|
156
157
|
restoreFocus: true,
|
157
158
|
autoFocus: isFocusVisible
|
158
159
|
}, ___EmotionJSX(Box, {
|
@@ -162,6 +163,8 @@ var HelpHint = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
162
163
|
HelpHint.propTypes = {
|
163
164
|
/** Props object that is spread directly into the popover element. */
|
164
165
|
popoverProps: PropTypes.shape({}),
|
166
|
+
/** @ignore Alias for `popoverProps` prop. Exists for backwards-compatibility. */
|
167
|
+
tooltipProps: PropTypes.shape({}),
|
165
168
|
/** Props object that is spread directly into the IconButton element. */
|
166
169
|
iconButtonProps: PropTypes.shape({}),
|
167
170
|
/** Defaults to true, displays dark popover with white text */
|
@@ -45,11 +45,12 @@ export var WithPopoverAndIconButtonProps = function WithPopoverAndIconButtonProp
|
|
45
45
|
p: 50
|
46
46
|
}, ___EmotionJSX(HelpHint, {
|
47
47
|
popoverProps: {
|
48
|
-
|
48
|
+
'data-id': 'popover-container'
|
49
49
|
},
|
50
50
|
iconButtonProps: {
|
51
51
|
'aria-label': 'Help hint'
|
52
|
-
}
|
52
|
+
},
|
53
|
+
direction: "bottom"
|
53
54
|
}, "Text of the popover right here..."));
|
54
55
|
};
|
55
56
|
export var ContentWithLink = function ContentWithLink() {
|
@@ -50,7 +50,11 @@ var popoverContainer = _objectSpread(_objectSpread({}, container), {}, {
|
|
50
50
|
p: '10px',
|
51
51
|
fontSize: 'sm',
|
52
52
|
fontWeight: 1,
|
53
|
-
|
53
|
+
maxWidth: '300px',
|
54
|
+
overflow: 'visible',
|
55
|
+
textOverflow: '',
|
56
|
+
maxHeight: 'unset',
|
57
|
+
display: 'flex'
|
54
58
|
});
|
55
59
|
export default {
|
56
60
|
hintButton: hintButton,
|
@@ -151,6 +151,19 @@ test('applies popoverProps', function () {
|
|
151
151
|
});
|
152
152
|
expect(screen.getByText(popoverValue)).toBeInTheDocument();
|
153
153
|
});
|
154
|
+
test('applies tooltipProps', function () {
|
155
|
+
getComponent({
|
156
|
+
tooltipProps: {
|
157
|
+
isOpen: true,
|
158
|
+
maxWidth: 'unset',
|
159
|
+
width: '1000px'
|
160
|
+
}
|
161
|
+
});
|
162
|
+
var popover = screen.queryByRole('presentation');
|
163
|
+
expect(popover).toBeInTheDocument();
|
164
|
+
expect(popover).toHaveStyle('width: 1000px');
|
165
|
+
expect(popover).toHaveStyle('maxWidth: unset');
|
166
|
+
});
|
154
167
|
test('applies iconButtonProps', function () {
|
155
168
|
var newLabel = 'New label';
|
156
169
|
getComponent({
|
@@ -15,14 +15,15 @@ import _Promise from "@babel/runtime-corejs3/core-js-stable/promise";
|
|
15
15
|
import _setTimeout from "@babel/runtime-corejs3/core-js-stable/set-timeout";
|
16
16
|
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
|
17
17
|
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
18
|
-
import React from 'react';
|
18
|
+
import React, { useRef } from 'react';
|
19
19
|
import { Item, useAsyncList } from 'react-stately';
|
20
20
|
import FormSelectIcon from '@pingux/mdi-react/FormSelectIcon';
|
21
21
|
import { action } from '@storybook/addon-actions';
|
22
22
|
import isChromatic from 'chromatic/isChromatic';
|
23
23
|
import DocsLayout from '../../../.storybook/storybookDocsLayout';
|
24
|
-
import { Box, ListView, ListViewItem, ListViewItemMenu, ListViewItemSwitchField } from '../..';
|
24
|
+
import { Box, ListView, ListViewItem, ListViewItemChart, ListViewItemMenu, ListViewItemSwitchField } from '../..';
|
25
25
|
import loadingStates from '../../utils/devUtils/constants/loadingStates';
|
26
|
+
import { chartData } from '../ListViewItem/controls/chart/chartData';
|
26
27
|
import ListViewReadme from './ListView.mdx';
|
27
28
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
28
29
|
export default {
|
@@ -720,4 +721,33 @@ export var MultipleSelection = function MultipleSelection(_ref5) {
|
|
720
721
|
}
|
721
722
|
}, ___EmotionJSX(Controls, null)));
|
722
723
|
});
|
724
|
+
};
|
725
|
+
export var WithCharts = function WithCharts(_ref6) {
|
726
|
+
var args = _extends({}, (_objectDestructuringEmpty(_ref6), _ref6));
|
727
|
+
var chartContainerRef = useRef();
|
728
|
+
return ___EmotionJSX(ListView, _extends({}, args, {
|
729
|
+
items: items,
|
730
|
+
selectionMode: "multiple"
|
731
|
+
}), function (item) {
|
732
|
+
return ___EmotionJSX(Item, {
|
733
|
+
key: item.name
|
734
|
+
}, ___EmotionJSX(ListViewItem, {
|
735
|
+
ref: chartContainerRef,
|
736
|
+
data: {
|
737
|
+
text: item.name,
|
738
|
+
subtext: item.subtext,
|
739
|
+
icon: FormSelectIcon
|
740
|
+
}
|
741
|
+
}, ___EmotionJSX(ListViewItemChart, {
|
742
|
+
containerRef: chartContainerRef,
|
743
|
+
chartData: chartData,
|
744
|
+
chartDataKey: "fullData",
|
745
|
+
title: "Avg daily sign-ons:",
|
746
|
+
contentCount: "31",
|
747
|
+
contentCountLabel: "Past 7 days",
|
748
|
+
chartLabel: "12 wk trend",
|
749
|
+
trend: "+115.0%",
|
750
|
+
tooltipText: "See Contributing Data"
|
751
|
+
}), ___EmotionJSX(Controls, null)));
|
752
|
+
});
|
723
753
|
};
|
@@ -38,6 +38,7 @@ styled control components to easily match Ping specs.
|
|
38
38
|
- [ListViewItemEditButton](./?path=/docs/components-listviewitem-controls-listviewitemeditbutton--docs)
|
39
39
|
- [ListViewItemMenu](./?path=/docs/components-listviewitem-controls-listviewitemmenu--docs)
|
40
40
|
- [ListViewItemSwitchField](./?path=/docs/components-listviewitem-controls-listviewitemswitchfield--docs)
|
41
|
+
- [ListViewItemChart](./?path=/docs/components-listviewitem-controls-listviewitemchart--docs)
|
41
42
|
|
42
43
|
### Note:
|
43
44
|
The nature of components that have been styled to match design specs is that as design specs are updated, so will the matching component. Be aware that styles
|
@@ -1,10 +1,11 @@
|
|
1
|
-
import React from 'react';
|
1
|
+
import React, { useRef } from 'react';
|
2
2
|
import { Item } from 'react-stately';
|
3
3
|
import AccountIcon from '@pingux/mdi-react/AccountIcon';
|
4
4
|
import FormSelectIcon from '@pingux/mdi-react/FormSelectIcon';
|
5
5
|
import DocsLayout from '../../../.storybook/storybookDocsLayout';
|
6
|
-
import { Badge, Box, ListViewItem, ListViewItemEditButton, ListViewItemMenu, ListViewItemSwitchField, Separator, Text } from '../..';
|
6
|
+
import { Badge, Box, ListViewItem, ListViewItemChart, ListViewItemEditButton, ListViewItemMenu, ListViewItemSwitchField, Separator, Text } from '../..';
|
7
7
|
import { pingImg } from '../../utils/devUtils/constants/images';
|
8
|
+
import { chartData } from './controls/chart/chartData';
|
8
9
|
import ListViewItemReadMe from './ListViewItem.mdx';
|
9
10
|
import { listViewItemArgTypes } from './listViewItemAttributes';
|
10
11
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
@@ -140,6 +141,33 @@ export var WithLeftOfDataSlot = function WithLeftOfDataSlot() {
|
|
140
141
|
key: "delete"
|
141
142
|
}, "Delete user"))));
|
142
143
|
};
|
144
|
+
export var WithCharts = function WithCharts() {
|
145
|
+
var containerRef = useRef();
|
146
|
+
return ___EmotionJSX(Wrapper, null, ___EmotionJSX(ListViewItem, {
|
147
|
+
ref: containerRef,
|
148
|
+
data: {
|
149
|
+
text: 'Kangaroo',
|
150
|
+
subtext: 'kangaroo@example.com',
|
151
|
+
icon: FormSelectIcon
|
152
|
+
}
|
153
|
+
}, ___EmotionJSX(ListViewItemChart, {
|
154
|
+
containerRef: containerRef,
|
155
|
+
chartData: chartData,
|
156
|
+
title: "Avg daily sign-ons:",
|
157
|
+
chartDataKey: "fullData",
|
158
|
+
contentCount: "31",
|
159
|
+
contentCountLabel: "Past 7 days",
|
160
|
+
chartLabel: "12 wk trend",
|
161
|
+
trend: "+115.0%",
|
162
|
+
tooltipText: "See Contributing Data"
|
163
|
+
}), ___EmotionJSX(ListViewItemSwitchField, null), ___EmotionJSX(ListViewItemMenu, null, ___EmotionJSX(Item, {
|
164
|
+
key: "enable"
|
165
|
+
}, "Enable user"), ___EmotionJSX(Item, {
|
166
|
+
key: "disable"
|
167
|
+
}, "Disable user"), ___EmotionJSX(Item, {
|
168
|
+
key: "delete"
|
169
|
+
}, "Delete user"))));
|
170
|
+
};
|
143
171
|
export var WithExtraLongText = function WithExtraLongText() {
|
144
172
|
var renderRightOfData = ___EmotionJSX(Box, {
|
145
173
|
isRow: true,
|
@@ -0,0 +1,88 @@
|
|
1
|
+
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
2
|
+
import React, { useCallback, useMemo } from 'react';
|
3
|
+
import { useVisuallyHidden } from 'react-aria';
|
4
|
+
import { Line, LineChart, ResponsiveContainer } from 'recharts';
|
5
|
+
import useResizeObserver from 'use-resize-observer';
|
6
|
+
import { Box, Button, Text, Tooltip, TooltipTrigger } from '../../../../index';
|
7
|
+
import { neutral } from '../../../../styles/colors';
|
8
|
+
import { listViewItemChartPropTypes } from './ListViewItemChartAttributes';
|
9
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
10
|
+
var ListViewItemChart = function ListViewItemChart(props) {
|
11
|
+
var buttonProps = props.buttonProps,
|
12
|
+
chartData = props.chartData,
|
13
|
+
chartLabel = props.chartLabel,
|
14
|
+
containerRef = props.containerRef,
|
15
|
+
title = props.title,
|
16
|
+
tooltipText = props.tooltipText,
|
17
|
+
contentCount = props.contentCount,
|
18
|
+
contentCountLabel = props.contentCountLabel,
|
19
|
+
trend = props.trend,
|
20
|
+
chartDataKey = props.chartDataKey,
|
21
|
+
_props$tabletBreakPoi = props.tabletBreakPoint,
|
22
|
+
tabletBreakPoint = _props$tabletBreakPoi === void 0 ? 605 : _props$tabletBreakPoi,
|
23
|
+
_props$mobileBreakPoi = props.mobileBreakPoint,
|
24
|
+
mobileBreakPoint = _props$mobileBreakPoi === void 0 ? 350 : _props$mobileBreakPoi;
|
25
|
+
var _useResizeObserver = useResizeObserver({
|
26
|
+
ref: containerRef
|
27
|
+
}),
|
28
|
+
width = _useResizeObserver.width;
|
29
|
+
var _useVisuallyHidden = useVisuallyHidden(),
|
30
|
+
visuallyHiddenProps = _useVisuallyHidden.visuallyHiddenProps;
|
31
|
+
var isTablet = useMemo(function () {
|
32
|
+
return width <= tabletBreakPoint;
|
33
|
+
}, [tabletBreakPoint, width]);
|
34
|
+
var isMobile = useMemo(function () {
|
35
|
+
return width <= mobileBreakPoint;
|
36
|
+
}, [mobileBreakPoint, width]);
|
37
|
+
var hideIfTablet = useCallback(function () {
|
38
|
+
return isTablet && visuallyHiddenProps;
|
39
|
+
}, [isTablet, visuallyHiddenProps]);
|
40
|
+
var hideIfMobile = useCallback(function () {
|
41
|
+
return isMobile && visuallyHiddenProps;
|
42
|
+
}, [isMobile, visuallyHiddenProps]);
|
43
|
+
return ___EmotionJSX(Box, {
|
44
|
+
isRow: true,
|
45
|
+
alignItems: "center",
|
46
|
+
height: 0,
|
47
|
+
mr: "md"
|
48
|
+
}, ___EmotionJSX(Box, _extends({
|
49
|
+
variant: "lisViewItemChart.titleContainer"
|
50
|
+
}, hideIfMobile()), ___EmotionJSX(Text, {
|
51
|
+
variant: "variants.lisViewItemChart.title"
|
52
|
+
}, title)), ___EmotionJSX(Box, _extends({
|
53
|
+
variant: "lisViewItemChart.content"
|
54
|
+
}, hideIfTablet()), ___EmotionJSX(Text, {
|
55
|
+
variant: "variants.lisViewItemChart.count"
|
56
|
+
}, contentCount), ___EmotionJSX(Text, {
|
57
|
+
variant: "variants.lisViewItemChart.countLabel"
|
58
|
+
}, contentCountLabel)), ___EmotionJSX(TooltipTrigger, null, ___EmotionJSX(Button, _extends({
|
59
|
+
variant: "variants.lisViewItemChart.chartButton",
|
60
|
+
"aria-label": "line-chart button"
|
61
|
+
}, buttonProps, hideIfMobile()), ___EmotionJSX(Box, {
|
62
|
+
variant: "lisViewItemChart.divider"
|
63
|
+
}), ___EmotionJSX(Box, {
|
64
|
+
ml: "md"
|
65
|
+
}, ___EmotionJSX(Box, {
|
66
|
+
variant: "lisViewItemChart.chartContainer"
|
67
|
+
}, ___EmotionJSX(ResponsiveContainer, {
|
68
|
+
variant: "lisViewItemChart.responsiveContainer"
|
69
|
+
}, ___EmotionJSX(LineChart, {
|
70
|
+
data: chartData,
|
71
|
+
variant: "lisViewItemChart.chart"
|
72
|
+
}, ___EmotionJSX(Line, {
|
73
|
+
type: "monotone",
|
74
|
+
dataKey: chartDataKey,
|
75
|
+
dot: false,
|
76
|
+
stroke: neutral[20]
|
77
|
+
})))), ___EmotionJSX(Text, {
|
78
|
+
variant: "variants.lisViewItemChart.chartLabel"
|
79
|
+
}, chartLabel)), ___EmotionJSX(Box, {
|
80
|
+
size: "sm",
|
81
|
+
variant: "lisViewItemChart.trendContainer"
|
82
|
+
}, ___EmotionJSX(Text, {
|
83
|
+
variant: "variants.lisViewItemChart.trend"
|
84
|
+
}, trend))), ___EmotionJSX(Tooltip, null, tooltipText)));
|
85
|
+
};
|
86
|
+
ListViewItemChart.propTypes = listViewItemChartPropTypes;
|
87
|
+
ListViewItemChart.displayName = 'ListViewItemChart';
|
88
|
+
export default ListViewItemChart;
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { Meta } from '@storybook/addon-docs';
|
2
|
+
|
3
|
+
<Meta title="Experimental/controls/ListViewItemChart" />
|
4
|
+
|
5
|
+
# ListViewItemChart
|
6
|
+
|
7
|
+
The ListViewItemChart allows easy creation of chart inside ListViewItem. Styles have been included to match Ping specs.
|
8
|
+
|
9
|
+
### Recommended Use
|
10
|
+
This component is intended to be used inside a ListViewItem component. See the [ListViewItem](./?path=/docs/experimental-listviewitem--docs)
|
11
|
+
docs for a more detailed examples.
|
@@ -0,0 +1,35 @@
|
|
1
|
+
import React, { useRef } from 'react';
|
2
|
+
import DocsLayout from '../../../../../.storybook/storybookDocsLayout';
|
3
|
+
import { Box, ListViewItemChart } from '../../../../index';
|
4
|
+
import { chartData } from './chartData';
|
5
|
+
import ListViewItemChartReadMe from './ListViewItemChart.mdx';
|
6
|
+
import { listViewItemChartArgTypes } from './ListViewItemChartAttributes';
|
7
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
8
|
+
export default {
|
9
|
+
title: 'Components/ListViewItem/Controls/ListViewItemChart',
|
10
|
+
component: ListViewItemChart,
|
11
|
+
parameters: {
|
12
|
+
docs: {
|
13
|
+
page: function page() {
|
14
|
+
return ___EmotionJSX(React.Fragment, null, ___EmotionJSX(ListViewItemChartReadMe, null), ___EmotionJSX(DocsLayout, null));
|
15
|
+
}
|
16
|
+
}
|
17
|
+
},
|
18
|
+
argTypes: listViewItemChartArgTypes
|
19
|
+
};
|
20
|
+
export var Default = function Default() {
|
21
|
+
var ref = useRef();
|
22
|
+
return ___EmotionJSX(Box, {
|
23
|
+
ref: ref
|
24
|
+
}, ___EmotionJSX(ListViewItemChart, {
|
25
|
+
containerRef: ref,
|
26
|
+
chartData: chartData,
|
27
|
+
chartDataKey: "fullData",
|
28
|
+
title: "Avg daily sign-ons:",
|
29
|
+
contentCount: "31",
|
30
|
+
contentCountLabel: "Past 7 days",
|
31
|
+
chartLabel: "12 wk trend",
|
32
|
+
trend: "+115.0%",
|
33
|
+
tooltipText: "See Contributing Data"
|
34
|
+
}));
|
35
|
+
};
|