Main Dialog Text. Are you sure you want to xxxxx?
;
diff --git a/packages/patternfly-3/patternfly-react/src/components/MessageDialog/Stories/MessageDialogSuccess.js b/packages/patternfly-3/patternfly-react/src/components/MessageDialog/Stories/MessageDialogSuccess.js
index 96ecf0d473b..8700ea9416e 100644
--- a/packages/patternfly-3/patternfly-react/src/components/MessageDialog/Stories/MessageDialogSuccess.js
+++ b/packages/patternfly-3/patternfly-react/src/components/MessageDialog/Stories/MessageDialogSuccess.js
@@ -11,15 +11,15 @@ class MessageDialogSuccess extends Component {
primaryAction = () => {
this.setState(() => ({ show: false }));
- }
+ };
secondaryAction = () => {
this.setState(() => ({ show: false }));
- }
+ };
showModal = () => {
this.setState(() => ({ show: true }));
- }
+ };
render() {
const primaryContent =
diff --git a/packages/patternfly-3/patternfly-react/src/components/Table/TableConfirmButtonsRow.js b/packages/patternfly-3/patternfly-react/src/components/Table/TableConfirmButtonsRow.js
index 590bde30cc7..fe1f008abd6 100644
--- a/packages/patternfly-3/patternfly-react/src/components/Table/TableConfirmButtonsRow.js
+++ b/packages/patternfly-3/patternfly-react/src/components/Table/TableConfirmButtonsRow.js
@@ -34,16 +34,16 @@ class TableConfirmButtonsRow extends React.Component {
rowDimensions: this.element.getBoundingClientRect()
});
}
- }
+ };
handleScroll = event => {
this.saveRowDimensions();
- }
+ };
handleResize = event => {
this.fetchClientDimensions();
this.saveRowDimensions();
- }
+ };
fetchClientDimensions() {
this.setState({
diff --git a/packages/patternfly-3/patternfly-react/src/components/Table/__mocks__/mockClientPaginationTable.js b/packages/patternfly-3/patternfly-react/src/components/Table/__mocks__/mockClientPaginationTable.js
index f617b3fc87d..ad836bea4ab 100644
--- a/packages/patternfly-3/patternfly-react/src/components/Table/__mocks__/mockClientPaginationTable.js
+++ b/packages/patternfly-3/patternfly-react/src/components/Table/__mocks__/mockClientPaginationTable.js
@@ -251,34 +251,34 @@ export class MockClientPaginationTable extends React.Component {
}
onFirstPage = () => {
this.setPage(1);
- }
+ };
onLastPage = () => {
const { page } = this.state.pagination;
const totalPages = this.totalPages();
if (page < totalPages) {
this.setPage(totalPages);
}
- }
+ };
onNextPage = () => {
const { page } = this.state.pagination;
if (page < this.totalPages()) {
this.setPage(this.state.pagination.page + 1);
}
- }
+ };
onPageInput = e => {
this.setState({ pageChangeValue: e.target.value });
- }
+ };
onPerPageSelect = (eventKey, e) => {
const newPaginationState = Object.assign({}, this.state.pagination);
newPaginationState.perPage = eventKey;
newPaginationState.page = 1;
this.setState({ pagination: newPaginationState });
- }
+ };
onPreviousPage = () => {
if (this.state.pagination.page > 1) {
this.setPage(this.state.pagination.page - 1);
}
- }
+ };
onRow = (row, { rowIndex }) => {
const { selectedRows } = this.state;
const selected = selectedRows.indexOf(row.id) > -1;
@@ -286,7 +286,7 @@ export class MockClientPaginationTable extends React.Component {
className: classNames({ selected }),
role: 'row'
};
- }
+ };
onSelectAllRows = event => {
const { onRowsLogger } = this.props;
const { rows, selectedRows } = this.state;
@@ -316,7 +316,7 @@ export class MockClientPaginationTable extends React.Component {
});
onRowsLogger(updatedRows.filter(r => r.selected));
}
- }
+ };
onSelectRow = (event, row) => {
const { onRowsLogger } = this.props;
const { rows, selectedRows } = this.state;
@@ -339,10 +339,10 @@ export class MockClientPaginationTable extends React.Component {
});
onRowsLogger(rows.filter(r => r.selected));
}
- }
+ };
onSubmit = () => {
this.setPage(this.state.pageChangeValue);
- }
+ };
setPage = value => {
const page = Number(value);
if (!Number.isNaN(value) && value !== '' && page > 0 && page <= this.totalPages()) {
@@ -350,7 +350,7 @@ export class MockClientPaginationTable extends React.Component {
newPaginationState.page = page;
this.setState({ pagination: newPaginationState, pageChangeValue: page });
}
- }
+ };
currentRows() {
const { rows, sortingColumns, columns, pagination } = this.state;
return compose(
@@ -366,7 +366,7 @@ export class MockClientPaginationTable extends React.Component {
totalPages = () => {
const { perPage } = this.state.pagination;
return Math.ceil(mockRows.length / perPage);
- }
+ };
render() {
const { columns, pagination, sortingColumns, pageChangeValue } = this.state;
const sortedPaginatedRows = this.currentRows();
diff --git a/packages/patternfly-3/patternfly-react/src/components/Table/__mocks__/mockServerPaginationTable.js b/packages/patternfly-3/patternfly-react/src/components/Table/__mocks__/mockServerPaginationTable.js
index 7189dd5ea8a..80eb02ce349 100644
--- a/packages/patternfly-3/patternfly-react/src/components/Table/__mocks__/mockServerPaginationTable.js
+++ b/packages/patternfly-3/patternfly-react/src/components/Table/__mocks__/mockServerPaginationTable.js
@@ -211,14 +211,14 @@ export class MockServerPaginationTable extends React.Component {
const newPaginationState = Object.assign({}, this.state.pagination);
newPaginationState.page = page;
this.getPage(this.state.sortingColumns, newPaginationState);
- }
+ };
onPerPageSelect = (eventKey, e) => {
const newPaginationState = Object.assign({}, this.state.pagination);
newPaginationState.perPage = eventKey;
newPaginationState.page = 1;
this.getPage(this.state.sortingColumns, newPaginationState);
- }
+ };
onSelectAllRows = event => {
const { sortingColumns, pagination, rows } = this.state;
@@ -227,7 +227,7 @@ export class MockServerPaginationTable extends React.Component {
// refresh rows after all rows selected
this.getPage(sortingColumns, pagination);
});
- }
+ };
onSelectRow = (event, row) => {
const { sortingColumns, pagination } = this.state;
@@ -235,7 +235,7 @@ export class MockServerPaginationTable extends React.Component {
// refresh rows after row is selected
this.getPage(sortingColumns, pagination);
});
- }
+ };
onSort = (e, column, sortDirection) => {
// Clearing existing sortingColumns does simple single column sort. To do multisort,
// set each column based on existing sorts specified and set sort position.
@@ -249,7 +249,7 @@ export class MockServerPaginationTable extends React.Component {
alert(`Server API called with: sort by ${column.property} ${updatedSortingColumns[column.property].direction}`);
this.getPage(updatedSortingColumns, this.state.pagination);
- }
+ };
getPage(sortingColumns, pagination) {
const { onServerPageLogger } = this.props;
diff --git a/packages/patternfly-3/patternfly-react/src/components/ToastNotification/TimedToastNotification.js b/packages/patternfly-3/patternfly-react/src/components/ToastNotification/TimedToastNotification.js
index d664e68238b..c6fce04bd4d 100644
--- a/packages/patternfly-3/patternfly-react/src/components/ToastNotification/TimedToastNotification.js
+++ b/packages/patternfly-3/patternfly-react/src/components/ToastNotification/TimedToastNotification.js
@@ -43,12 +43,12 @@ class TimedToastNotification extends React.Component {
onMouseEnter = () => {
const { onMouseEnter } = this.props;
onMouseEnter && onMouseEnter();
- }
+ };
onMouseLeave = () => {
const { onMouseLeave } = this.props;
onMouseLeave && onMouseLeave();
- }
+ };
render() {
const { children, className, type, onDismiss } = this.props;
const { onMouseEnter, onMouseLeave } = this;
diff --git a/packages/patternfly-3/patternfly-react/src/components/ToastNotification/ToastNotification.stories.js b/packages/patternfly-3/patternfly-react/src/components/ToastNotification/ToastNotification.stories.js
index 818c17254d8..b6ff9e27b33 100644
--- a/packages/patternfly-3/patternfly-react/src/components/ToastNotification/ToastNotification.stories.js
+++ b/packages/patternfly-3/patternfly-react/src/components/ToastNotification/ToastNotification.stories.js
@@ -70,7 +70,7 @@ class ToastNotificationStoryWrapper extends React.Component {
type: 'info',
persistent: false,
timerdelay: 8000,
- message: 'By default, a toast notification\'s timer expires after eight seconds.'
+ message: "By default, a toast notification's timer expires after eight seconds."
},
{
key: 2,
diff --git a/packages/patternfly-3/patternfly-react/src/components/ToastNotification/ToastNotificationList.js b/packages/patternfly-3/patternfly-react/src/components/ToastNotification/ToastNotificationList.js
index d9a615781d5..fe5bbadf510 100644
--- a/packages/patternfly-3/patternfly-react/src/components/ToastNotification/ToastNotificationList.js
+++ b/packages/patternfly-3/patternfly-react/src/components/ToastNotification/ToastNotificationList.js
@@ -18,19 +18,19 @@ class ToastNotificationList extends React.Component {
this.setState({ paused: true });
const { onMouseEnter } = this.props;
onMouseEnter();
- }
+ };
onMouseLeave = () => {
this.setState({ paused: false });
const { onMouseLeave } = this.props;
onMouseLeave();
- }
+ };
onMouseOver = () => {
this.setState({ paused: true });
const { onMouseOver } = this.props;
onMouseOver();
- }
+ };
renderChildren() {
const { paused } = this.state;
diff --git a/packages/patternfly-3/patternfly-react/src/components/Toolbar/ToolbarFind.js b/packages/patternfly-3/patternfly-react/src/components/Toolbar/ToolbarFind.js
index 7a81ea1b44e..72f9e606cf5 100644
--- a/packages/patternfly-3/patternfly-react/src/components/Toolbar/ToolbarFind.js
+++ b/packages/patternfly-3/patternfly-react/src/components/Toolbar/ToolbarFind.js
@@ -19,7 +19,7 @@ class ToolbarFind extends React.Component {
if (keyEvent.key === 'Enter' && onEnter) {
onEnter(currentValue);
}
- }
+ };
handleFindNext = () => {
const { currentValue } = this.state;
@@ -28,7 +28,7 @@ class ToolbarFind extends React.Component {
if (onFindNext) {
onFindNext(currentValue);
}
- }
+ };
handleFindPrevious = () => {
const { currentValue } = this.state;
@@ -37,7 +37,7 @@ class ToolbarFind extends React.Component {
if (onFindPrevious) {
onFindPrevious(currentValue);
}
- }
+ };
handleValueChange = event => {
const { onChange } = this.props;
@@ -47,15 +47,15 @@ class ToolbarFind extends React.Component {
if (onChange) {
onChange(event.target.value);
}
- }
+ };
hideDropdown = () => {
this.setState({ dropdownShown: false });
- }
+ };
toggleDropdownShown = () => {
this.setState(prevState => ({ dropdownShown: !prevState.dropdownShown }));
- }
+ };
renderCounts() {
const { currentValue } = this.state;
diff --git a/packages/patternfly-3/patternfly-react/src/components/Toolbar/__mocks__/mockToolbarExample.js b/packages/patternfly-3/patternfly-react/src/components/Toolbar/__mocks__/mockToolbarExample.js
index 0e5585ad349..8fb4f02a42f 100644
--- a/packages/patternfly-3/patternfly-react/src/components/Toolbar/__mocks__/mockToolbarExample.js
+++ b/packages/patternfly-3/patternfly-react/src/components/Toolbar/__mocks__/mockToolbarExample.js
@@ -26,7 +26,7 @@ export class MockToolbarExample extends React.Component {
keyEvent.stopPropagation();
keyEvent.preventDefault();
}
- }
+ };
setViewType(viewType) {
const { onViewChanged } = this.props;
@@ -47,13 +47,13 @@ export class MockToolbarExample extends React.Component {
this.filterAdded(currentFilterType, filterValue);
}
}
- }
+ };
clearFilters = () => {
const { onFiltersChanged } = this.props;
this.setState({ activeFilters: [] });
onFiltersChanged && onFiltersChanged('Filters cleared.');
- }
+ };
filterAdded = (field, value) => {
const { onFiltersChanged } = this.props;
@@ -77,14 +77,14 @@ export class MockToolbarExample extends React.Component {
const activeFilters = [...this.state.activeFilters, { label: filterText }];
this.setState({ activeFilters });
onFiltersChanged && onFiltersChanged(`Filter Added: ${filterText}`);
- }
+ };
filterCategorySelected = category => {
const { filterCategory } = this.state;
if (filterCategory !== category) {
this.setState({ filterCategory: category });
}
- }
+ };
filterValueSelected = filterValue => {
const { currentFilterType, currentValue } = this.state;
@@ -95,7 +95,7 @@ export class MockToolbarExample extends React.Component {
this.filterAdded(currentFilterType, filterValue);
}
}
- }
+ };
removeFilter = filter => {
const { onFiltersChanged } = this.props;
@@ -107,7 +107,7 @@ export class MockToolbarExample extends React.Component {
this.setState({ activeFilters: updated });
}
onFiltersChanged && onFiltersChanged(`Filter Removed: ${filter.label}`);
- }
+ };
selectFilterType = filterType => {
const { currentFilterType } = this.state;
@@ -118,7 +118,7 @@ export class MockToolbarExample extends React.Component {
this.setState({ filterCategory: undefined });
}
}
- }
+ };
toggleCurrentSortDirection = () => {
const { isSortAscending } = this.state;
@@ -126,7 +126,7 @@ export class MockToolbarExample extends React.Component {
this.setState({ isSortAscending: !isSortAscending });
onSortChanged && onSortChanged(`sort ascending: ${!isSortAscending}`);
- }
+ };
updateCurrentSortType = sortType => {
const { currentSortType } = this.state;
@@ -140,11 +140,11 @@ export class MockToolbarExample extends React.Component {
});
}
onSortChanged && onSortChanged(`sort type: ${sortType.title}`);
- }
+ };
updateCurrentValue = event => {
this.setState({ currentValue: event.target.value });
- }
+ };
renderInput() {
const { currentFilterType, currentValue, filterCategory } = this.state;
diff --git a/packages/patternfly-3/patternfly-react/src/components/TreeView/TreeView.js b/packages/patternfly-3/patternfly-react/src/components/TreeView/TreeView.js
index 74b50133226..0abb5006c21 100644
--- a/packages/patternfly-3/patternfly-react/src/components/TreeView/TreeView.js
+++ b/packages/patternfly-3/patternfly-react/src/components/TreeView/TreeView.js
@@ -16,7 +16,7 @@ class TreeView extends React.Component {
onFocus = node => {
this.setState(() => ({ focusedNodeId: node.dataset.id }));
- }
+ };
onKeyDown = event => {
const nodes = this.getVisibleNodes([...this.treeRef.current.getElementsByTagName('li')]);
@@ -33,7 +33,7 @@ class TreeView extends React.Component {
const [lastVisibleNode] = nodes.slice(-1);
lastVisibleNode.focus();
}
- }
+ };
onKeyPress = event => {
const nodes = this.getVisibleNodes([...this.treeRef.current.getElementsByTagName('li')]);
@@ -58,13 +58,13 @@ class TreeView extends React.Component {
if (key === '*') {
this.setState(prevState => ({ expandSiblings: prevState.focusedNodeId }));
}
- }
+ };
getVisibleNodes = nodes => nodes.filter(node => !node.className.match(/node-hidden/));
clearExpandSiblings = () => {
this.setState(() => ({ expandSiblings: '' }));
- }
+ };
treeRef = React.createRef();
diff --git a/packages/patternfly-3/patternfly-react/src/components/TreeView/TreeViewNode.js b/packages/patternfly-3/patternfly-react/src/components/TreeView/TreeViewNode.js
index b513f8c7f2d..c4562eb9d50 100644
--- a/packages/patternfly-3/patternfly-react/src/components/TreeView/TreeViewNode.js
+++ b/packages/patternfly-3/patternfly-react/src/components/TreeView/TreeViewNode.js
@@ -64,17 +64,17 @@ class TreeViewNode extends Component {
e.stopPropagation();
this.handleSelect(e);
}
- }
+ };
onFocus = e => {
e.stopPropagation();
this.props.onFocus(this.nodeRef.current);
this.setState(() => ({ focused: true }));
- }
+ };
onBlur = () => {
this.setState(() => ({ focused: false }));
- }
+ };
handleSelect = e => {
const { node, selectNode } = this.props;
@@ -85,16 +85,16 @@ class TreeViewNode extends Component {
this.nodeRef.current.focus();
selectNode(node);
}
- }
+ };
toggleExpand = e => {
e.stopPropagation();
this.toggleExpandedState();
- }
+ };
toggleExpandedState = () => {
this.setState(prevState => ({ expanded: !prevState.expanded }));
- }
+ };
nodeRef = React.createRef();
diff --git a/packages/patternfly-3/patternfly-react/src/components/TreeView/__mocks__/MockTreeView.js b/packages/patternfly-3/patternfly-react/src/components/TreeView/__mocks__/MockTreeView.js
index 677aa85ef5f..8c9400277d7 100644
--- a/packages/patternfly-3/patternfly-react/src/components/TreeView/__mocks__/MockTreeView.js
+++ b/packages/patternfly-3/patternfly-react/src/components/TreeView/__mocks__/MockTreeView.js
@@ -27,13 +27,13 @@ export class MockTreeView extends React.Component {
return { ...node, selected: false };
}
return node;
- })
+ });
selectNode = selectedNode => {
this.setState(prevState => ({
nodes: this.nodeSelector(prevState.nodes, selectedNode)
}));
- }
+ };
render() {
const { nodes } = this.state;
diff --git a/packages/patternfly-3/patternfly-react/src/components/TypeAheadSelect/AsyncTypeAheadSelect.js b/packages/patternfly-3/patternfly-react/src/components/TypeAheadSelect/AsyncTypeAheadSelect.js
index 53d17c9505c..766f4124607 100644
--- a/packages/patternfly-3/patternfly-react/src/components/TypeAheadSelect/AsyncTypeAheadSelect.js
+++ b/packages/patternfly-3/patternfly-react/src/components/TypeAheadSelect/AsyncTypeAheadSelect.js
@@ -16,7 +16,7 @@ class AsyncTypeAheadSelect extends React.Component {
handleSearch = query => {
this.onSearchStart();
Promise.resolve(this.props.onSearch(query)).then(options => this.onSearchEnd(options));
- }
+ };
render() {
const { innerRef, ...props } = this.props;
diff --git a/packages/patternfly-3/patternfly-react/src/components/TypeAheadSelect/mock.js b/packages/patternfly-3/patternfly-react/src/components/TypeAheadSelect/mock.js
index 14dcfbf6514..63fd6ee93d8 100644
--- a/packages/patternfly-3/patternfly-react/src/components/TypeAheadSelect/mock.js
+++ b/packages/patternfly-3/patternfly-react/src/components/TypeAheadSelect/mock.js
@@ -185,7 +185,7 @@ const mockData = {
'Tajikistan',
'Tanzania',
'Thailand',
- 'Timor L\'Este',
+ "Timor L'Este",
'Togo',
'Tonga',
'Trinidad & Tobago',
diff --git a/packages/patternfly-3/patternfly-react/src/components/VerticalNav/VerticalNav.js b/packages/patternfly-3/patternfly-react/src/components/VerticalNav/VerticalNav.js
index 393fd9626b6..a85a3477277 100644
--- a/packages/patternfly-3/patternfly-react/src/components/VerticalNav/VerticalNav.js
+++ b/packages/patternfly-3/patternfly-react/src/components/VerticalNav/VerticalNav.js
@@ -63,29 +63,29 @@ class BaseVerticalNav extends React.Component {
const { onLayoutChange, setControlledState } = this.props;
setControlledState({ isMobile: newLayout === 'mobile' });
onLayoutChange && onLayoutChange(newLayout);
- }
+ };
setActivePath = activePath => {
if (!this.state.controlledActivePath) {
this.props.setControlledState({ activePath });
}
- }
+ };
setControlledActivePath = controlledActivePath => {
this.setState({ controlledActivePath });
- }
+ };
setControlledHoverPath = controlledHoverPath => {
this.setState({ controlledHoverPath });
- }
+ };
setControlledMobilePath = controlledMobilePath => {
this.setState({ controlledMobilePath });
- }
+ };
setControlledPinnedPath = controlledPinnedPath => {
this.setState({ controlledPinnedPath });
- }
+ };
setHoverPath = hoverPath => {
if (!this.state.controlledHoverPath) {
@@ -94,56 +94,56 @@ class BaseVerticalNav extends React.Component {
...(hoverPath === null ? { showMobileNav: false } : {})
});
}
- }
+ };
setMobilePath = mobilePath => {
if (!this.state.controlledMobilePath) {
this.props.setControlledState({ mobilePath });
}
- }
+ };
setPinnedPath = pinnedPath => {
if (!this.state.controlledPinnedPath) {
this.props.setControlledState({ pinnedPath });
}
- }
+ };
hoverTimer = new Timer();
clearBodyClasses = () => {
if (this.props.dynamicBodyClasses) {
setBodyClassIf(false, 'collapsed-nav');
setBodyClassIf(false, 'hidden-nav');
}
- }
+ };
collapseMenu = () => {
const { onCollapse, setControlledState } = this.props;
setControlledState({ navCollapsed: true });
onCollapse && onCollapse();
- }
+ };
expandMenu = () => {
const { onExpand, setControlledState } = this.props;
setControlledState({ navCollapsed: false });
onExpand && onExpand();
- }
+ };
forceHideSecondaryMenu = () => {
this.setState({ forceHidden: true }); // eslint-disable-line react/no-unused-state
setTimeout(() => {
this.setState({ forceHidden: false }); // eslint-disable-line react/no-unused-state
}, 500);
- }
+ };
handleBodyClick = () => {
// Clear hover state on body click. Helps especially when using blurDisabled prop.
this.setHoverPath(null);
- }
+ };
navigateToItem = item => {
const { onNavigate } = this.props;
onNavigate(item);
// Note: This should become router-aware later on.
- }
+ };
updateBodyClasses = () => {
// Note: Updating the body element classes from here like this is a hacky, non-react-y pattern.
@@ -154,7 +154,7 @@ class BaseVerticalNav extends React.Component {
setBodyClassIf(!isMobile && collapsed, 'collapsed-nav');
setBodyClassIf(isMobile, 'hidden-nav');
}
- }
+ };
updateNavOnItemBlur = (primary, secondary, tertiary, idPath, parentPath, noDelay, callback) => {
const { hoverPath, blurDelay, blurDisabled, setControlledState } = this.props;
@@ -181,7 +181,7 @@ class BaseVerticalNav extends React.Component {
}
}
}
- }
+ };
updateNavOnItemClick = (primary, secondary, tertiary, idPath, parentPath) => {
const { onItemClick, hoverPath, hoverDisabled, isMobile } = this.props;
@@ -201,7 +201,7 @@ class BaseVerticalNav extends React.Component {
this.navigateToItem(item);
}
onItemClick && onItemClick(primary, secondary, tertiary);
- }
+ };
updateNavOnItemHover = (primary, secondary, tertiary, idPath, parentPath, callback) => {
const { onItemHover, hoverPath, hoverDelay, hoverDisabled, isMobile } = this.props;
@@ -221,7 +221,7 @@ class BaseVerticalNav extends React.Component {
}, hoverDelay);
}
}
- }
+ };
updateNavOnMenuToggleClick = () => {
const { onMenuToggleClick, isMobile, showMobileNav, navCollapsed, setControlledState } = this.props;
@@ -238,21 +238,21 @@ class BaseVerticalNav extends React.Component {
this.collapseMenu();
}
onMenuToggleClick && onMenuToggleClick();
- }
+ };
updateNavOnMobileSelection = (primary, secondary, tertiary) => {
const { onMobileSelection } = this.props;
// All the behavior here is handled by mobilePath and setMobilePath,
// but we still make a callback available here.
onMobileSelection && onMobileSelection(primary, secondary, tertiary);
- }
+ };
updateNavOnPin = (item, depth, pinned) => {
const { onItemPin, isMobile } = this.props;
if (!isMobile) {
onItemPin && onItemPin(item, depth, pinned);
}
- }
+ };
render() {
const { items, children } = this.props;
diff --git a/packages/patternfly-3/patternfly-react/src/components/VerticalNav/VerticalNav.stories.js b/packages/patternfly-3/patternfly-react/src/components/VerticalNav/VerticalNav.stories.js
index 9f8447198fe..9ef30c6c463 100644
--- a/packages/patternfly-3/patternfly-react/src/components/VerticalNav/VerticalNav.stories.js
+++ b/packages/patternfly-3/patternfly-react/src/components/VerticalNav/VerticalNav.stories.js
@@ -215,7 +215,8 @@ stories.add(
'Custom Masthead',
withInfo({
propTablesExclude: [MockFixedLayout, MockIconBarChildren, Icon, MenuItem, Dropdown, Dropdown.Menu, Dropdown.Toggle],
- text: 'Example using the **Masthead**, **Brand** and **IconBar** components with images. (items from \'Items as Objects\').'
+ text:
+ "Example using the **Masthead**, **Brand** and **IconBar** components with images. (items from 'Items as Objects')."
})(() => (
diff --git a/packages/patternfly-3/patternfly-react/src/components/VerticalNav/VerticalNavConstants.js b/packages/patternfly-3/patternfly-react/src/components/VerticalNav/VerticalNavConstants.js
index 4772ceda46d..a84168296ee 100644
--- a/packages/patternfly-3/patternfly-react/src/components/VerticalNav/VerticalNavConstants.js
+++ b/packages/patternfly-3/patternfly-react/src/components/VerticalNav/VerticalNavConstants.js
@@ -118,9 +118,15 @@ const getNextDepth = depth =>
const deepestOf = (pri, sec, ter) => (pri && sec && ter) || (pri && sec) || pri;
const componentForDepth = depth => {
- if (depth === 'primary') { return VerticalNavItem; }
- if (depth === 'secondary') { return VerticalNavSecondaryItem; }
- if (depth === 'tertiary') { return VerticalNavTertiaryItem; }
+ if (depth === 'primary') {
+ return VerticalNavItem;
+ }
+ if (depth === 'secondary') {
+ return VerticalNavSecondaryItem;
+ }
+ if (depth === 'tertiary') {
+ return VerticalNavTertiaryItem;
+ }
return null;
};
diff --git a/packages/patternfly-3/patternfly-react/src/components/VerticalNav/VerticalNavItem.js b/packages/patternfly-3/patternfly-react/src/components/VerticalNav/VerticalNavItem.js
index bb63db12a77..927054ce0f1 100644
--- a/packages/patternfly-3/patternfly-react/src/components/VerticalNav/VerticalNavItem.js
+++ b/packages/patternfly-3/patternfly-react/src/components/VerticalNav/VerticalNavItem.js
@@ -9,7 +9,9 @@ import VerticalNavItemHelper from './VerticalNavItemHelper';
* In the future, we could lift some of the primary-specific code from Helper into this file.
*/
const BaseVerticalNavItem = props => {
- if (wrongDepth(props, 'primary')) { return correctDepth(props); }
+ if (wrongDepth(props, 'primary')) {
+ return correctDepth(props);
+ }
return ;
};
diff --git a/packages/patternfly-3/patternfly-react/src/components/VerticalNav/VerticalNavItemHelper.js b/packages/patternfly-3/patternfly-react/src/components/VerticalNav/VerticalNavItemHelper.js
index 74a41d4e261..292e0da4762 100644
--- a/packages/patternfly-3/patternfly-react/src/components/VerticalNav/VerticalNavItemHelper.js
+++ b/packages/patternfly-3/patternfly-react/src/components/VerticalNav/VerticalNavItemHelper.js
@@ -78,7 +78,7 @@ class BaseVerticalNavItemHelper extends React.Component {
const { primary, secondary, tertiary } = this.getContextNavItems();
const { updateNavOnItemBlur, idPath, onBlur } = this.props;
updateNavOnItemBlur(primary, secondary, tertiary, this.idPath(), idPath, noDelay, onBlur);
- }
+ };
onItemClick = event => {
const { primary, secondary, tertiary } = this.getContextNavItems();
@@ -95,19 +95,19 @@ class BaseVerticalNavItemHelper extends React.Component {
}
this.setActive();
onClick && onClick(primary, secondary, tertiary);
- }
+ };
onItemHover = () => {
const { primary, secondary, tertiary } = this.getContextNavItems();
const { updateNavOnItemHover, idPath, onHover } = this.props;
updateNavOnItemHover(primary, secondary, tertiary, this.idPath(), idPath, onHover);
- }
+ };
onMobileSelection = (primary, secondary, tertiary) => {
const { setMobilePath, updateNavOnMobileSelection } = this.props;
setMobilePath(this.idPath());
updateNavOnMobileSelection(primary, secondary, tertiary);
- }
+ };
getContextNavItems = () => {
// We have primary, secondary, and tertiary items as props if they are part of the parent context,
@@ -119,11 +119,11 @@ class BaseVerticalNavItemHelper extends React.Component {
secondary: depth === 'secondary' ? navItem : secondaryItem,
tertiary: depth === 'tertiary' ? navItem : tertiaryItem
};
- }
+ };
setActive = () => {
this.props.setActivePath(this.idPath());
- }
+ };
setHovered() {
this.props.setHoverPath(this.idPath());
@@ -132,7 +132,7 @@ class BaseVerticalNavItemHelper extends React.Component {
id = () => {
const { id, title } = this.navItem(null, true); // Need to ignorePath here so we don't get an infinite call stack...
return id || title || this.props.index;
- }
+ };
idPath = () => `${this.props.idPath}${this.id()}/`;
@@ -150,7 +150,7 @@ class BaseVerticalNavItemHelper extends React.Component {
selectedOnMobile: valOrOnPath(item.selectedOnMobile, props.mobilePath),
pinned: valOrOnPath(item.pinned, props.pinnedPath)
};
- }
+ };
pinNextDepth = () => {
const {
@@ -181,7 +181,7 @@ class BaseVerticalNavItemHelper extends React.Component {
}
}
updateNavOnPin(this.navItem(), nextDepth, !pinnedPath);
- }
+ };
render() {
const {
diff --git a/packages/patternfly-3/patternfly-react/src/components/VerticalNav/VerticalNavSecondaryItem.js b/packages/patternfly-3/patternfly-react/src/components/VerticalNav/VerticalNavSecondaryItem.js
index 847044a2f64..abb29759b92 100644
--- a/packages/patternfly-3/patternfly-react/src/components/VerticalNav/VerticalNavSecondaryItem.js
+++ b/packages/patternfly-3/patternfly-react/src/components/VerticalNav/VerticalNavSecondaryItem.js
@@ -9,7 +9,9 @@ import VerticalNavItemHelper from './VerticalNavItemHelper';
* In the future, we could lift some of the secondary-specific code from Helper into this file.
*/
const BaseVerticalNavSecondaryItem = props => {
- if (wrongDepth(props, 'secondary')) { return correctDepth(props); }
+ if (wrongDepth(props, 'secondary')) {
+ return correctDepth(props);
+ }
return ;
};
diff --git a/packages/patternfly-3/patternfly-react/src/components/VerticalNav/VerticalNavTertiaryItem.js b/packages/patternfly-3/patternfly-react/src/components/VerticalNav/VerticalNavTertiaryItem.js
index a7d4443b516..48e91daa135 100644
--- a/packages/patternfly-3/patternfly-react/src/components/VerticalNav/VerticalNavTertiaryItem.js
+++ b/packages/patternfly-3/patternfly-react/src/components/VerticalNav/VerticalNavTertiaryItem.js
@@ -9,7 +9,9 @@ import VerticalNavItemHelper from './VerticalNavItemHelper';
* In the future, we could lift some of the tertiary-specific code from Helper into this file.
*/
const BaseVerticalNavTertiaryItem = props => {
- if (wrongDepth(props, 'tertiary')) { return correctDepth(props); }
+ if (wrongDepth(props, 'tertiary')) {
+ return correctDepth(props);
+ }
return ;
};
diff --git a/packages/patternfly-3/patternfly-react/src/components/VerticalNav/__mocks__/mockNavItems.js b/packages/patternfly-3/patternfly-react/src/components/VerticalNav/__mocks__/mockNavItems.js
index 852539a301c..715259be74c 100644
--- a/packages/patternfly-3/patternfly-react/src/components/VerticalNav/__mocks__/mockNavItems.js
+++ b/packages/patternfly-3/patternfly-react/src/components/VerticalNav/__mocks__/mockNavItems.js
@@ -96,7 +96,7 @@ export const mockNavItems = [
badges: [
{
count: 9999,
- tooltip: 'Whoa, that\'s a lot'
+ tooltip: "Whoa, that's a lot"
}
]
},
diff --git a/packages/patternfly-3/patternfly-react/src/components/VerticalNav/__mocks__/mockWithMastHeadComponent.js b/packages/patternfly-3/patternfly-react/src/components/VerticalNav/__mocks__/mockWithMastHeadComponent.js
index 169a1367a72..759d803214d 100644
--- a/packages/patternfly-3/patternfly-react/src/components/VerticalNav/__mocks__/mockWithMastHeadComponent.js
+++ b/packages/patternfly-3/patternfly-react/src/components/VerticalNav/__mocks__/mockWithMastHeadComponent.js
@@ -9,7 +9,7 @@ export class MockWithMastHeadComponent extends React.Component {
onCollapse = () => {
this.setState({ collapse: !this.state.collapse });
- }
+ };
render() {
return (
diff --git a/packages/patternfly-3/patternfly-react/src/components/Wizard/Patterns/StatefulWizardPattern.js b/packages/patternfly-3/patternfly-react/src/components/Wizard/Patterns/StatefulWizardPattern.js
index d105aae944d..f6ba81a9d2b 100644
--- a/packages/patternfly-3/patternfly-react/src/components/Wizard/Patterns/StatefulWizardPattern.js
+++ b/packages/patternfly-3/patternfly-react/src/components/Wizard/Patterns/StatefulWizardPattern.js
@@ -33,7 +33,7 @@ class StatefulWizardPattern extends React.Component {
return;
}
this.setState({ activeStepIndex: newStepIndex });
- }
+ };
render() {
const { shouldDisableNextStep, shouldDisablePreviousStep, shouldDisableCancelButton, ...otherProps } = this.props;
diff --git a/packages/patternfly-3/patternfly-react/src/components/Wizard/Patterns/WizardPattern.js b/packages/patternfly-3/patternfly-react/src/components/Wizard/Patterns/WizardPattern.js
index 26510ffeee7..ef4c3a03981 100644
--- a/packages/patternfly-3/patternfly-react/src/components/Wizard/Patterns/WizardPattern.js
+++ b/packages/patternfly-3/patternfly-react/src/components/Wizard/Patterns/WizardPattern.js
@@ -58,18 +58,26 @@ const WizardPattern = ({
const activeStep = getStep();
const goToStep = newStepIndex => {
- if (shouldPreventGoToStep(newStepIndex)) { return; }
+ if (shouldPreventGoToStep(newStepIndex)) {
+ return;
+ }
if (newStepIndex === activeStepIndex + 1) {
const stepOnNextResult = activeStep.onNext && activeStep.onNext();
const propOnNextResult = onNext(newStepIndex);
const stepFailed = stepOnNextResult === false || propOnNextResult === false;
- if (stepFailed) { return; }
+ if (stepFailed) {
+ return;
+ }
}
if (newStepIndex === activeStepIndex - 1) {
const stepFailed = onBack(newStepIndex) === false;
- if (stepFailed) { return; }
+ if (stepFailed) {
+ return;
+ }
+ }
+ if (onStepChanged) {
+ onStepChanged(newStepIndex);
}
- if (onStepChanged) { onStepChanged(newStepIndex); }
};
const shouldPreventGoToStep = newStepIndex => {
diff --git a/packages/patternfly-3/patternfly-react/src/components/Wizard/Stories/LoadingWizardExample.js b/packages/patternfly-3/patternfly-react/src/components/Wizard/Stories/LoadingWizardExample.js
index 4c741e6ae10..59dcf2e6b2a 100644
--- a/packages/patternfly-3/patternfly-react/src/components/Wizard/Stories/LoadingWizardExample.js
+++ b/packages/patternfly-3/patternfly-react/src/components/Wizard/Stories/LoadingWizardExample.js
@@ -12,10 +12,10 @@ export class LoadingWizardExample extends React.Component {
}
close = () => {
this.setState({ showModal: false });
- }
+ };
open = () => {
this.setState({ showModal: true });
- }
+ };
render() {
const { showModal } = this.state;
diff --git a/packages/patternfly-3/patternfly-react/src/components/Wizard/Stories/WizardExample.js b/packages/patternfly-3/patternfly-react/src/components/Wizard/Stories/WizardExample.js
index 42b17eb44f4..cde44b59d2f 100644
--- a/packages/patternfly-3/patternfly-react/src/components/Wizard/Stories/WizardExample.js
+++ b/packages/patternfly-3/patternfly-react/src/components/Wizard/Stories/WizardExample.js
@@ -11,10 +11,10 @@ import { renderWizardSteps, renderSidebarItems, renderWizardContents } from './m
export class WizardExample extends MockWizardBase {
open = () => {
this.setState({ showModal: true });
- }
+ };
close = () => {
this.setState({ showModal: false });
- }
+ };
render() {
const { showModal, activeStepIndex, activeSubStepIndex } = this.state;
diff --git a/packages/patternfly-3/patternfly-react/src/components/Wizard/Stories/WizardPatternExample.js b/packages/patternfly-3/patternfly-react/src/components/Wizard/Stories/WizardPatternExample.js
index 6a65b88de5f..9f3244ceeaa 100644
--- a/packages/patternfly-3/patternfly-react/src/components/Wizard/Stories/WizardPatternExample.js
+++ b/packages/patternfly-3/patternfly-react/src/components/Wizard/Stories/WizardPatternExample.js
@@ -28,13 +28,13 @@ export class WizardPatternExample extends React.Component {
close = () => {
this.setState({ showModal: false, loading: false });
- }
+ };
open = () => {
this.setState({ showModal: true, loading: true });
setTimeout(() => {
this.setState({ loading: false });
}, 1000);
- }
+ };
renderStateless = () => {
// We need knobs on the stateless example, because we must drive its state ourselves.
const { loading, activeStepIndex } = this.state;
@@ -64,7 +64,7 @@ export class WizardPatternExample extends React.Component {
/>
);
- }
+ };
renderStateful = () => (
// No knobs for the stateful example, we want to let it control its own state.
@@ -84,7 +84,7 @@ export class WizardPatternExample extends React.Component {
loading={this.state.loading}
/>
- )
+ );
render() {
return this.props.stateful ? this.renderStateful() : this.renderStateless();
}
diff --git a/packages/patternfly-3/patternfly-react/src/components/Wizard/Stories/mockWizardBase.js b/packages/patternfly-3/patternfly-react/src/components/Wizard/Stories/mockWizardBase.js
index 148086e03a4..ba024559f88 100644
--- a/packages/patternfly-3/patternfly-react/src/components/Wizard/Stories/mockWizardBase.js
+++ b/packages/patternfly-3/patternfly-react/src/components/Wizard/Stories/mockWizardBase.js
@@ -23,7 +23,7 @@ class MockWizardBase extends React.Component {
activeSubStepIndex: steps[prevState.activeStepIndex - 1].subSteps.length - 1
}));
}
- }
+ };
onNextButtonClick = () => {
const { steps } = this.props;
const { activeStepIndex, activeSubStepIndex } = this.state;
@@ -39,13 +39,13 @@ class MockWizardBase extends React.Component {
activeSubStepIndex: 0
}));
}
- }
+ };
onSidebarItemClick = (stepIndex, subStepIndex) => {
this.setState({
activeStepIndex: stepIndex,
activeSubStepIndex: subStepIndex
});
- }
+ };
onStepClick = stepIndex => {
if (stepIndex === this.state.activeStepIndex) {
return;
@@ -54,7 +54,7 @@ class MockWizardBase extends React.Component {
activeStepIndex: stepIndex,
activeSubStepIndex: 0
});
- }
+ };
render() {
return false;
}
diff --git a/packages/patternfly-3/patternfly-react/src/components/Wizard/Stories/mockWizardReviewStepsManager.js b/packages/patternfly-3/patternfly-react/src/components/Wizard/Stories/mockWizardReviewStepsManager.js
index 8c7d78ae614..0f9bba1d4f5 100644
--- a/packages/patternfly-3/patternfly-react/src/components/Wizard/Stories/mockWizardReviewStepsManager.js
+++ b/packages/patternfly-3/patternfly-react/src/components/Wizard/Stories/mockWizardReviewStepsManager.js
@@ -16,7 +16,7 @@ class MockWizardReviewStepsManager extends React.Component {
this.setState({
steps: updated
});
- }
+ };
subStepClicked = (e, stepIndex, subStepIndex) => {
e.preventDefault();
const updated = [...this.state.steps];
@@ -24,7 +24,7 @@ class MockWizardReviewStepsManager extends React.Component {
this.setState({
steps: updated
});
- }
+ };
render() {
const { steps } = this.state;
return (
diff --git a/packages/patternfly-3/react-console/src/SerialConsole/SerialConsole.js b/packages/patternfly-3/react-console/src/SerialConsole/SerialConsole.js
index 6ea69fc2623..41364823820 100644
--- a/packages/patternfly-3/react-console/src/SerialConsole/SerialConsole.js
+++ b/packages/patternfly-3/react-console/src/SerialConsole/SerialConsole.js
@@ -24,21 +24,25 @@ class SerialConsole extends React.Component {
}
onResetClick = event => {
- if (event.button !== 0) { return; }
+ if (event.button !== 0) {
+ return;
+ }
this.props.onDisconnect();
this.props.onConnect();
event.target.blur();
this.focusTerminal();
- }
+ };
onDisconnectClick = event => {
- if (event.button !== 0) { return; }
+ if (event.button !== 0) {
+ return;
+ }
this.props.onDisconnect();
event.target.blur();
this.focusTerminal();
- }
+ };
/**
* Backend sent data.
@@ -60,7 +64,7 @@ class SerialConsole extends React.Component {
focusTerminal = () => {
this.childTerminal && this.childTerminal.focus();
- }
+ };
render() {
const { id, status, topClassName } = this.props;
diff --git a/packages/patternfly-3/react-console/src/SerialConsole/SerialConsole.stories.js b/packages/patternfly-3/react-console/src/SerialConsole/SerialConsole.stories.js
index 6ccb51a59df..acffffacdf8 100644
--- a/packages/patternfly-3/react-console/src/SerialConsole/SerialConsole.stories.js
+++ b/packages/patternfly-3/react-console/src/SerialConsole/SerialConsole.stories.js
@@ -44,13 +44,13 @@ export class SerialConsoleConnector extends React.Component {
passKeys: false,
status: DISCONNECTED // will close the terminal window
});
- }
+ };
onConnect = () => {
log('SerialConsoleConnector.onConnect(), ', this.state);
this.setConnected();
this.tellFairyTale();
- }
+ };
onData = data => {
log('UI terminal component produced data, i.e. a key was pressed, pass it to backend. [', data, ']');
@@ -60,32 +60,32 @@ export class SerialConsoleConnector extends React.Component {
if (this.state.passKeys) {
this.onDataFromBackend(data);
}
- }
+ };
onDataFromBackend = data => {
log('Backend sent data, pass them to the UI component. [', data, ']');
if (this.childSerialconsole) {
this.childSerialconsole.onDataReceived(data);
}
- }
+ };
onDisconnect = () => {
this.setState({
status: DISCONNECTED
});
timeoutIds.forEach(id => clearTimeout(id));
- }
+ };
onResize = (rows, cols) => {
log('UI has been resized, pass this info to backend. [', rows, ', ', cols, ']');
- }
+ };
setConnected = () => {
this.setState({
status: CONNECTED,
passKeys: true
});
- }
+ };
tellFairyTale = () => {
let time = 1000;
@@ -102,7 +102,7 @@ export class SerialConsoleConnector extends React.Component {
time += 5000;
timeoutIds.push(setTimeout(this.onBackendDisconnected, time));
- }
+ };
render() {
return (
diff --git a/packages/patternfly-3/react-console/src/SerialConsole/XTerm.js b/packages/patternfly-3/react-console/src/SerialConsole/XTerm.js
index 9d122ae8506..6a005a02047 100644
--- a/packages/patternfly-3/react-console/src/SerialConsole/XTerm.js
+++ b/packages/patternfly-3/react-console/src/SerialConsole/XTerm.js
@@ -100,7 +100,7 @@ class XTerm extends React.Component {
// https://developer.mozilla.org/en-US/docs/Web/Events/beforeunload
event.returnValue = '';
return '';
- }
+ };
/**
* Backend closed connection.
@@ -125,11 +125,11 @@ class XTerm extends React.Component {
onFocus = () => {
window.addEventListener('beforeunload', this.onBeforeUnload);
- }
+ };
onBlur = () => {
window.removeEventListener('beforeunload', this.onBeforeUnload);
- }
+ };
/**
* If autoFit is enabled, compute the size and set it
@@ -174,8 +174,10 @@ class XTerm extends React.Component {
}
focus = () => {
- if (this.state.terminal) { this.state.terminal.focus(); }
- }
+ if (this.state.terminal) {
+ this.state.terminal.focus();
+ }
+ };
render() {
// ensure react never reuses this div by keying it with the terminal widget
diff --git a/packages/patternfly-3/react-console/src/SpiceConsole/SpiceConsole.js b/packages/patternfly-3/react-console/src/SpiceConsole/SpiceConsole.js
index 82092c82b07..908ac2bca15 100644
--- a/packages/patternfly-3/react-console/src/SpiceConsole/SpiceConsole.js
+++ b/packages/patternfly-3/react-console/src/SpiceConsole/SpiceConsole.js
@@ -45,7 +45,7 @@ class SpiceConsole extends React.Component {
}
onConnected = () => {
this.setState({ status: CONNECTED });
- }
+ };
onCtrlAltDel = e => {
if (this.sc) {
@@ -54,23 +54,23 @@ class SpiceConsole extends React.Component {
sendCtrlAltDel();
window.sc = undefined;
}
- }
+ };
onSpiceError = e => {
this.disconnect();
this.onDisconnected(e);
// if (e !== undefined && e.message === "Permission denied.") {
- }
+ };
onDisconnected = e => {
this.setState({ status: DISCONNECTED });
this.props.onDisconnected(e);
- }
+ };
onSecurityFailure = e => {
this.setState({ status: DISCONNECTED });
this.props.onSecurityFailure(e);
- }
+ };
render() {
const { textDisconnected, textConnecting, textSendShortcut, textCtrlAltDel } = this.props;
diff --git a/packages/patternfly-3/react-console/src/VncConsole/VncConsole.js b/packages/patternfly-3/react-console/src/VncConsole/VncConsole.js
index 91d8af39448..a6df6a15508 100644
--- a/packages/patternfly-3/react-console/src/VncConsole/VncConsole.js
+++ b/packages/patternfly-3/react-console/src/VncConsole/VncConsole.js
@@ -73,45 +73,45 @@ class VncConsole extends React.Component {
return;
}
this.rfb.disconnect();
- }
+ };
onConnected = () => {
this.setState({ status: CONNECTED });
- }
+ };
onCtrlAltDel = e => {
if (this.rfb) {
this.rfb.sendCtrlAltDel();
this.focusVnc(e);
}
- }
+ };
onDisconnected = e => {
this.setState({ status: DISCONNECTED });
this.props.onDisconnected(e);
- }
+ };
onSecurityFailure = e => {
this.setState({ status: DISCONNECTED });
this.props.onSecurityFailure(e);
- }
+ };
removeEventListeners = () => {
this.rfb.removeEventListener('connect', this.onConnected);
this.rfb.removeEventListener('disconnect', this.onDisconnected);
this.rfb.removeEventListener('securityfailure', this.onSecurityFailure);
- }
+ };
setNovncElem = e => {
this.novncElem = e;
- }
+ };
focusVnc = e => {
if (e && e.target && e.target.blur) {
e.target.blur();
}
this.novncElem && this.novncElem.focus();
- }
+ };
render() {
const {
diff --git a/packages/patternfly-4/react-charts/src/components/Chart/Chart.test.tsx b/packages/patternfly-4/react-charts/src/components/Chart/Chart.test.tsx
index 94041f55506..a1535f42455 100644
--- a/packages/patternfly-4/react-charts/src/components/Chart/Chart.test.tsx
+++ b/packages/patternfly-4/react-charts/src/components/Chart/Chart.test.tsx
@@ -4,7 +4,7 @@ import { Chart } from './Chart';
import { ChartGroup } from '../ChartGroup';
import { ChartLine } from '../ChartLine';
-Object.values([true, false]).forEach((isRead) => {
+Object.values([true, false]).forEach(isRead => {
test('Chart', () => {
const view = shallow();
expect(view).toMatchSnapshot();
diff --git a/packages/patternfly-4/react-charts/src/components/Chart/Chart.tsx b/packages/patternfly-4/react-charts/src/components/Chart/Chart.tsx
index a56b71b40c7..e5021ca5d8d 100644
--- a/packages/patternfly-4/react-charts/src/components/Chart/Chart.tsx
+++ b/packages/patternfly-4/react-charts/src/components/Chart/Chart.tsx
@@ -13,19 +13,13 @@ import {
VictoryChart,
VictoryChartProps,
VictoryStyleInterface,
- VictoryZoomContainer,
+ VictoryZoomContainer
} from 'victory';
import { ChartContainer } from '../ChartContainer';
-import {
- ChartLegend,
- ChartLegendOrientation,
- ChartLegendPosition,
- ChartLegendWrapper
-} from '../ChartLegend';
+import { ChartLegend, ChartLegendOrientation, ChartLegendPosition, ChartLegendWrapper } from '../ChartLegend';
import { ChartCommonStyles, ChartThemeDefinition } from '../ChartTheme';
import { getClassName, getLabelTextSize, getPaddingForSide, getTheme } from '../ChartUtils';
-
/**
* See https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/victory/index.d.ts
*/
@@ -229,7 +223,7 @@ export interface ChartProps extends VictoryChartProps {
* maxDomain={0}
* maxDomain={{ y: 0 }}
*/
- maxDomain?: number | { x?: number, y?: number };
+ maxDomain?: number | { x?: number; y?: number };
/**
* The minDomain prop defines a minimum domain value for a chart. This prop is useful in situations where the minimum
* domain of a chart is static, while the maximum value depends on data or other variable information. If the domain
@@ -244,7 +238,7 @@ export interface ChartProps extends VictoryChartProps {
* minDomain={0}
* minDomain={{ y: 0 }}
*/
- minDomain?: number | { x?: number, y?: number };
+ minDomain?: number | { x?: number; y?: number };
/**
* The padding props specifies the amount of padding in number of pixels between
* the edge of the chart and any rendered child components. This prop can be given
@@ -270,17 +264,20 @@ export interface ChartProps extends VictoryChartProps {
* Cartesian: range={{ x: [50, 250], y: [50, 250] }}
* Polar: range={{ x: [0, 360], y: [0, 250] }}
*/
- range?: [number, number] | { x?: [number, number], y?: [number, number] };
+ range?: [number, number] | { x?: [number, number]; y?: [number, number] };
/**
* The scale prop determines which scales your chart should use. This prop can be
* given as a string specifying a supported scale ("linear", "time", "log", "sqrt"),
* as a d3 scale function, or as an object with scales specified for x and y
* @example d3Scale.time(), {x: "linear", y: "log"}
*/
- scale?: ScalePropType | D3Scale | {
- x?: ScalePropType | D3Scale;
- y?: ScalePropType | D3Scale;
- };
+ scale?:
+ | ScalePropType
+ | D3Scale
+ | {
+ x?: ScalePropType | D3Scale;
+ y?: ScalePropType | D3Scale;
+ };
/**
* The sharedEvents prop is used internally to coordinate events between components. It should not be set manually.
*/
@@ -302,7 +299,7 @@ export interface ChartProps extends VictoryChartProps {
* singleQuadrantDomainPadding={false}
* singleQuadrantDomainPadding={{ x: false }}
*/
- singleQuadrantDomainPadding?: boolean | { x: boolean, y: boolean };
+ singleQuadrantDomainPadding?: boolean | { x: boolean; y: boolean };
/**
* The standalone prop determines whether the component will render a standalone svg
* or a tag that will be included in an external svg. Set standalone to false to
@@ -360,7 +357,7 @@ export const Chart: React.FunctionComponent = ({
ariaDesc,
ariaTitle,
children,
- legendComponent = ,
+ legendComponent = ,
legendData,
legendPosition = ChartCommonStyles.legend.position as ChartLegendPosition,
padding,
@@ -377,10 +374,10 @@ export const Chart: React.FunctionComponent = ({
...rest
}: ChartProps) => {
const defaultPadding = {
- bottom: getPaddingForSide('bottom', padding, theme.chart.padding),
+ bottom: getPaddingForSide('bottom', padding, theme.chart.padding),
left: getPaddingForSide('left', padding, theme.chart.padding),
right: getPaddingForSide('right', padding, theme.chart.padding),
- top: getPaddingForSide('top', padding, theme.chart.padding),
+ top: getPaddingForSide('top', padding, theme.chart.padding)
};
// Clone so users can override container props
@@ -389,7 +386,7 @@ export const Chart: React.FunctionComponent = ({
title: ariaTitle,
theme,
...containerComponent.props,
- className: getClassName({className: containerComponent.props.className}) // Override VictoryContainer class name
+ className: getClassName({ className: containerComponent.props.className }) // Override VictoryContainer class name
});
const legend = React.cloneElement(legendComponent, {
@@ -412,7 +409,7 @@ export const Chart: React.FunctionComponent = ({
// Adjust for axis label
React.Children.toArray(children).map((child: any) => {
if (child.type.role === 'axis' && child.props.label && !child.props.dependentAxis) {
- xAxisLabelHeight = getLabelTextSize({text: child.props.label, theme}).height + 10;
+ xAxisLabelHeight = getLabelTextSize({ text: child.props.label, theme }).height + 10;
legendTitleHeight = 0;
}
});
diff --git a/packages/patternfly-4/react-charts/src/components/ChartArea/ChartArea.test.tsx b/packages/patternfly-4/react-charts/src/components/ChartArea/ChartArea.test.tsx
index 1fb3b2b5cec..864a3e8bccf 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartArea/ChartArea.test.tsx
+++ b/packages/patternfly-4/react-charts/src/components/ChartArea/ChartArea.test.tsx
@@ -2,7 +2,7 @@ import * as React from 'react';
import { shallow } from 'enzyme';
import { ChartArea } from '../ChartArea';
-Object.values([true, false]).forEach((isRead) => {
+Object.values([true, false]).forEach(isRead => {
test('ChartArea', () => {
const view = shallow();
expect(view).toMatchSnapshot();
diff --git a/packages/patternfly-4/react-charts/src/components/ChartArea/ChartArea.tsx b/packages/patternfly-4/react-charts/src/components/ChartArea/ChartArea.tsx
index cfa704e996b..03b4012aad7 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartArea/ChartArea.tsx
+++ b/packages/patternfly-4/react-charts/src/components/ChartArea/ChartArea.tsx
@@ -201,7 +201,7 @@ export interface ChartAreaProps extends VictoryAreaProps {
* maxDomain={0}
* maxDomain={{ y: 0 }}
*/
- maxDomain?: number | { x?: number, y?: number };
+ maxDomain?: number | { x?: number; y?: number };
/**
* The minDomain prop defines a minimum domain value for a chart. This prop is useful in situations where the minimum
* domain of a chart is static, while the maximum value depends on data or other variable information. If the domain
@@ -216,7 +216,7 @@ export interface ChartAreaProps extends VictoryAreaProps {
* minDomain={0}
* minDomain={{ y: 0 }}
*/
- minDomain?: number | { x?: number, y?: number };
+ minDomain?: number | { x?: number; y?: number };
/**
* The name prop is used to reference a component instance when defining shared events.
*/
@@ -225,7 +225,7 @@ export interface ChartAreaProps extends VictoryAreaProps {
* Victory components will pass an origin prop is to define the center point in svg coordinates for polar charts.
* **This prop should not be set manually.**
*/
- origin?: { x: number, y: number };
+ origin?: { x: number; y: number };
/**
* The padding props specifies the amount of padding in number of pixels between
* the edge of the chart and any rendered child components. This prop can be given
@@ -251,7 +251,7 @@ export interface ChartAreaProps extends VictoryAreaProps {
* Cartesian: range={{ x: [50, 250], y: [50, 250] }}
* Polar: range={{ x: [0, 360], y: [0, 250] }}
*/
- range?: [number, number] | { x?: [number, number], y?: [number, number] };
+ range?: [number, number] | { x?: [number, number]; y?: [number, number] };
/**
* The samples prop specifies how many individual points to plot when plotting
* y as a function of x. Samples is ignored if x props are provided instead.
@@ -263,10 +263,13 @@ export interface ChartAreaProps extends VictoryAreaProps {
* as a d3 scale function, or as an object with scales specified for x and y
* @example d3Scale.time(), {x: "linear", y: "log"}
*/
- scale?: ScalePropType | D3Scale | {
- x?: ScalePropType | D3Scale;
- y?: ScalePropType | D3Scale;
- };
+ scale?:
+ | ScalePropType
+ | D3Scale
+ | {
+ x?: ScalePropType | D3Scale;
+ y?: ScalePropType | D3Scale;
+ };
/**
* The sharedEvents prop is used internally to coordinate events between components. It should not be set manually.
*/
@@ -288,7 +291,7 @@ export interface ChartAreaProps extends VictoryAreaProps {
* singleQuadrantDomainPadding={false}
* singleQuadrantDomainPadding={{ x: false }}
*/
- singleQuadrantDomainPadding?: boolean | { x: boolean, y: boolean };
+ singleQuadrantDomainPadding?: boolean | { x: boolean; y: boolean };
/**
* Use the sortKey prop to indicate how data should be sorted. This prop
* is given directly to the lodash sortBy function to be executed on the
@@ -389,7 +392,7 @@ export const ChartArea: React.FunctionComponent = ({
...containerComponent.props
});
return ;
-}
+};
// Note: VictoryArea.role must be hoisted
hoistNonReactStatics(ChartArea, VictoryArea);
diff --git a/packages/patternfly-4/react-charts/src/components/ChartAxis/ChartAxis.test.tsx b/packages/patternfly-4/react-charts/src/components/ChartAxis/ChartAxis.test.tsx
index 8555b10f3e1..bf763765772 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartAxis/ChartAxis.test.tsx
+++ b/packages/patternfly-4/react-charts/src/components/ChartAxis/ChartAxis.test.tsx
@@ -5,7 +5,7 @@ import { ChartAxis } from './ChartAxis';
import { ChartGroup } from '../ChartGroup';
import { ChartLine } from '../ChartLine';
-Object.values([true, false]).forEach((isRead) => {
+Object.values([true, false]).forEach(isRead => {
test('ChartAxis', () => {
const view = shallow();
expect(view).toMatchSnapshot();
diff --git a/packages/patternfly-4/react-charts/src/components/ChartAxis/ChartAxis.tsx b/packages/patternfly-4/react-charts/src/components/ChartAxis/ChartAxis.tsx
index 77f52cb57a6..b4dd9a6a413 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartAxis/ChartAxis.tsx
+++ b/packages/patternfly-4/react-charts/src/components/ChartAxis/ChartAxis.tsx
@@ -9,7 +9,7 @@ import {
PaddingProps,
ScalePropType,
VictoryAxis,
- VictoryAxisProps,
+ VictoryAxisProps
} from 'victory';
import { ChartContainer } from '../ChartContainer';
import { ChartThemeDefinition } from '../ChartTheme';
@@ -193,7 +193,7 @@ export interface ChartAxisProps extends VictoryAxisProps {
* maxDomain={0}
* maxDomain={{ y: 0 }}
*/
- maxDomain?: number | { x?: number, y?: number };
+ maxDomain?: number | { x?: number; y?: number };
/**
* The minDomain prop defines a minimum domain value for a chart. This prop is useful in situations where the minimum
* domain of a chart is static, while the maximum value depends on data or other variable information. If the domain
@@ -208,7 +208,7 @@ export interface ChartAxisProps extends VictoryAxisProps {
* minDomain={0}
* minDomain={{ y: 0 }}
*/
- minDomain?: number | { x?: number, y?: number };
+ minDomain?: number | { x?: number; y?: number };
/**
* ChartAxis uses the standard name prop
*/
@@ -249,17 +249,20 @@ export interface ChartAxisProps extends VictoryAxisProps {
* Cartesian: range={{ x: [50, 250], y: [50, 250] }}
* Polar: range={{ x: [0, 360], y: [0, 250] }}
*/
- range?: [number, number] | { x?: [number, number], y?: [number, number] };
+ range?: [number, number] | { x?: [number, number]; y?: [number, number] };
/**
* The scale prop determines which scales your chart should use. This prop can be
* given as a string specifying a supported scale ("linear", "time", "log", "sqrt"),
* as a d3 scale function, or as an object with scales specified for x and y
* @example d3Scale.time(), {x: "linear", y: "log"}
*/
- scale?: ScalePropType | D3Scale | {
- x?: ScalePropType | D3Scale;
- y?: ScalePropType | D3Scale;
- };
+ scale?:
+ | ScalePropType
+ | D3Scale
+ | {
+ x?: ScalePropType | D3Scale;
+ y?: ScalePropType | D3Scale;
+ };
/**
* The sharedEvents prop is used internally to coordinate events between components. It should not be set manually.
*/
@@ -285,7 +288,7 @@ export interface ChartAxisProps extends VictoryAxisProps {
* singleQuadrantDomainPadding={false}
* singleQuadrantDomainPadding={{ x: false }}
*/
- singleQuadrantDomainPadding?: boolean | { x: boolean, y: boolean };
+ singleQuadrantDomainPadding?: boolean | { x: boolean; y: boolean };
/**
* The standalone prop determines whether the component will render a standalone svg
* or a tag that will be included in an external svg. Set standalone to false to
@@ -310,22 +313,13 @@ export interface ChartAxisProps extends VictoryAxisProps {
axis?: React.CSSProperties;
axisLabel?: React.CSSProperties;
grid?: {
- [K in keyof React.CSSProperties]:
- | string
- | number
- | ((tick?: any) => string | number)
+ [K in keyof React.CSSProperties]: string | number | ((tick?: any) => string | number);
};
ticks?: {
- [K in keyof React.CSSProperties]:
- | string
- | number
- | ((tick?: any) => string | number)
+ [K in keyof React.CSSProperties]: string | number | ((tick?: any) => string | number);
};
tickLabels?: {
- [K in keyof React.CSSProperties]:
- | string
- | number
- | ((tick?: any) => string | number)
+ [K in keyof React.CSSProperties]: string | number | ((tick?: any) => string | number);
};
};
/**
diff --git a/packages/patternfly-4/react-charts/src/components/ChartBar/ChartBar.test.tsx b/packages/patternfly-4/react-charts/src/components/ChartBar/ChartBar.test.tsx
index 48237775359..e0a4d6fb0b6 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartBar/ChartBar.test.tsx
+++ b/packages/patternfly-4/react-charts/src/components/ChartBar/ChartBar.test.tsx
@@ -4,7 +4,7 @@ import { Chart } from '../Chart';
import { ChartBar } from './ChartBar';
import { ChartGroup } from '../ChartGroup';
-Object.values([true, false]).forEach((isRead) => {
+Object.values([true, false]).forEach(isRead => {
test('ChartBar', () => {
const view = shallow();
expect(view).toMatchSnapshot();
diff --git a/packages/patternfly-4/react-charts/src/components/ChartBar/ChartBar.tsx b/packages/patternfly-4/react-charts/src/components/ChartBar/ChartBar.tsx
index 8635f5cc7ca..4e13b7d62bb 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartBar/ChartBar.tsx
+++ b/packages/patternfly-4/react-charts/src/components/ChartBar/ChartBar.tsx
@@ -15,7 +15,7 @@ import {
StringOrNumberOrCallback,
VictoryStyleInterface,
VictoryBar,
- VictoryBarProps,
+ VictoryBarProps
} from 'victory';
import { ChartContainer } from '../ChartContainer';
import { ChartThemeDefinition } from '../ChartTheme';
@@ -82,15 +82,16 @@ export interface ChartBarProps extends VictoryBarProps {
* If this prop is given as a single number, the radius will only be applied to the top of each bar.
* When this prop is given as a function, it will be evaluated with the arguments datum, and active.
*/
- cornerRadius?: NumberOrCallback
+ cornerRadius?:
+ | NumberOrCallback
| {
- top?: number | (NumberOrCallback),
- topLeft?: number | (NumberOrCallback),
- topRight?: number | (NumberOrCallback),
- bottom?: number | (NumberOrCallback),
- bottomLeft?: number | (NumberOrCallback),
- bottomRight?: number | (NumberOrCallback)
- };
+ top?: number | (NumberOrCallback);
+ topLeft?: number | (NumberOrCallback);
+ topRight?: number | (NumberOrCallback);
+ bottom?: number | (NumberOrCallback);
+ bottomLeft?: number | (NumberOrCallback);
+ bottomRight?: number | (NumberOrCallback);
+ };
/**
* The data prop specifies the data to be plotted. Data should be in the form of an array
* of data points, or an array of arrays of data points for multiple datasets.
@@ -228,7 +229,7 @@ export interface ChartBarProps extends VictoryBarProps {
* maxDomain={0}
* maxDomain={{ y: 0 }}
*/
- maxDomain?: number | { x?: number, y?: number };
+ maxDomain?: number | { x?: number; y?: number };
/**
* The minDomain prop defines a minimum domain value for a chart. This prop is useful in situations where the minimum
* domain of a chart is static, while the maximum value depends on data or other variable information. If the domain
@@ -243,7 +244,7 @@ export interface ChartBarProps extends VictoryBarProps {
* minDomain={0}
* minDomain={{ y: 0 }}
*/
- minDomain?: number | { x?: number, y?: number };
+ minDomain?: number | { x?: number; y?: number };
/**
* The name prop is used to reference a component instance when defining shared events.
*/
@@ -252,7 +253,7 @@ export interface ChartBarProps extends VictoryBarProps {
* Victory components will pass an origin prop is to define the center point in svg coordinates for polar charts.
* **This prop should not be set manually.**
*/
- origin?: { x: number, y: number };
+ origin?: { x: number; y: number };
/**
* The padding props specifies the amount of padding in number of pixels between
* the edge of the chart and any rendered child components. This prop can be given
@@ -278,7 +279,7 @@ export interface ChartBarProps extends VictoryBarProps {
* Cartesian: range={{ x: [50, 250], y: [50, 250] }}
* Polar: range={{ x: [0, 360], y: [0, 250] }}
*/
- range?: [number, number] | { x?: [number, number], y?: [number, number] };
+ range?: [number, number] | { x?: [number, number]; y?: [number, number] };
/**
* The samples prop specifies how many individual points to plot when plotting
* y as a function of x. Samples is ignored if x props are provided instead.
@@ -290,10 +291,13 @@ export interface ChartBarProps extends VictoryBarProps {
* as a d3 scale function, or as an object with scales specified for x and y
* @example d3Scale.time(), {x: "linear", y: "log"}
*/
- scale?: ScalePropType | D3Scale | {
- x?: ScalePropType | D3Scale;
- y?: ScalePropType | D3Scale;
- };
+ scale?:
+ | ScalePropType
+ | D3Scale
+ | {
+ x?: ScalePropType | D3Scale;
+ y?: ScalePropType | D3Scale;
+ };
/**
* The sharedEvents prop is used internally to coordinate events between components. It should not be set manually.
*/
@@ -315,7 +319,7 @@ export interface ChartBarProps extends VictoryBarProps {
* singleQuadrantDomainPadding={false}
* singleQuadrantDomainPadding={{ x: false }}
*/
- singleQuadrantDomainPadding?: boolean | { x: boolean, y: boolean };
+ singleQuadrantDomainPadding?: boolean | { x: boolean; y: boolean };
/**
* Use the sortKey prop to indicate how data should be sorted. This prop
* is given directly to the lodash sortBy function to be executed on the
@@ -405,7 +409,7 @@ export const ChartBar: React.FunctionComponent = ({
themeColor,
themeVariant,
- // destructure last
+ // destructure last
theme = getTheme(themeColor, themeVariant),
...rest
}: ChartBarProps) => {
@@ -415,7 +419,7 @@ export const ChartBar: React.FunctionComponent = ({
...containerComponent.props
});
return ;
-}
+};
// Note: VictoryBar.getDomain & VictoryBar.role must be hoisted
hoistNonReactStatics(ChartBar, VictoryBar);
diff --git a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBullet.test.tsx b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBullet.test.tsx
index 1860a3d6123..39a839116b9 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBullet.test.tsx
+++ b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBullet.test.tsx
@@ -2,7 +2,7 @@ import * as React from 'react';
import { shallow } from 'enzyme';
import { ChartBullet } from './ChartBullet';
-Object.values([true, false]).forEach((isRead) => {
+Object.values([true, false]).forEach(isRead => {
test('ChartBulletQualitativeRange', () => {
const view = shallow();
expect(view).toMatchSnapshot();
@@ -14,9 +14,9 @@ test('renders component data', () => {
`${datum.name}: ${datum.y}`}
- maxDomain={{y: 100}}
+ maxDomain={{ y: 100 }}
primarySegmentedMeasureData={[{ name: 'Measure', y: 50 }]}
qualitativeRangeData={[{ name: 'Range', y: 50 }, { name: 'Range', y: 75 }]}
width={450}
diff --git a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBullet.tsx b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBullet.tsx
index e004ca84467..683616b59b5 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBullet.tsx
+++ b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBullet.tsx
@@ -1,11 +1,6 @@
import * as React from 'react';
import hoistNonReactStatics from 'hoist-non-react-statics';
-import {
- DataGetterPropType,
- DomainPropType,
- PaddingProps,
- VictoryChart,
-} from 'victory';
+import { DataGetterPropType, DomainPropType, PaddingProps, VictoryChart } from 'victory';
import {
getComparativeMeasureErrorWidth,
getComparativeMeasureWidth,
@@ -243,7 +238,7 @@ export interface ChartBulletProps {
*
* Note: The x domain is expected to be `x: 2` in order to position all measures properly
*/
- maxDomain?: number | { x?: number, y?: number };
+ maxDomain?: number | { x?: number; y?: number };
/**
* The minDomain prop defines a minimum domain value for a chart. This prop is useful in situations where the minimum
* domain of a chart is static, while the maximum value depends on data or other variable information. If the domain
@@ -260,7 +255,7 @@ export interface ChartBulletProps {
*
* Note: The x domain is expected to be `x: 0` in order to position all measures properly
*/
- minDomain?: number | { x?: number, y?: number };
+ minDomain?: number | { x?: number; y?: number };
/**
* The padding props specifies the amount of padding in number of pixels between
* the edge of the chart and any rendered child components. This prop can be given
@@ -540,10 +535,10 @@ export const ChartBullet: React.FunctionComponent = ({
};
const defaultPadding = {
- bottom: getPaddingForSide('bottom', padding, theme.chart.padding),
+ bottom: getPaddingForSide('bottom', padding, theme.chart.padding),
left: getPaddingForSide('left', padding, theme.chart.padding),
right: getPaddingForSide('right', padding, theme.chart.padding),
- top: getPaddingForSide('top', padding, theme.chart.padding),
+ top: getPaddingForSide('top', padding, theme.chart.padding)
};
// Bullet group title
@@ -574,7 +569,7 @@ export const ChartBullet: React.FunctionComponent = ({
// Comparative error measure
const comparativeErrorMeasure = React.cloneElement(comparativeErrorMeasureComponent, {
allowTooltip,
- barWidth: getComparativeMeasureErrorWidth({height: chartSize.height, horizontal, width: chartSize.width}),
+ barWidth: getComparativeMeasureErrorWidth({ height: chartSize.height, horizontal, width: chartSize.width }),
constrainToVisibleArea,
data: comparativeErrorMeasureData,
domain,
@@ -592,7 +587,7 @@ export const ChartBullet: React.FunctionComponent = ({
// Comparative warning measure
const comparativeWarningMeasure = React.cloneElement(comparativeWarningMeasureComponent, {
allowTooltip,
- barWidth: getComparativeMeasureWarningWidth({height: chartSize.height, horizontal, width: chartSize.width}),
+ barWidth: getComparativeMeasureWarningWidth({ height: chartSize.height, horizontal, width: chartSize.width }),
constrainToVisibleArea,
data: comparativeWarningMeasureData,
domain,
@@ -609,8 +604,8 @@ export const ChartBullet: React.FunctionComponent = ({
// Comparative zero measure
const comparativeZeroMeasure = React.cloneElement(comparativeZeroMeasureComponent, {
- barWidth: getComparativeMeasureWidth({height: chartSize.height, horizontal, width: chartSize.width}),
- data: [{y: 0}],
+ barWidth: getComparativeMeasureWidth({ height: chartSize.height, horizontal, width: chartSize.width }),
+ data: [{ y: 0 }],
domain,
height: chartSize.height,
horizontal,
@@ -618,7 +613,7 @@ export const ChartBullet: React.FunctionComponent = ({
standalone: false,
width: chartSize.width,
...comparativeZeroMeasureComponent.props
- })
+ });
// Legend
const legend = React.cloneElement(legendComponent, {
@@ -648,7 +643,7 @@ export const ChartBullet: React.FunctionComponent = ({
labelComponent: allowTooltip ? : undefined,
labels,
padding,
- size: getPrimaryDotMeasureSize({height: chartSize.height, horizontal, width: chartSize.width}),
+ size: getPrimaryDotMeasureSize({ height: chartSize.height, horizontal, width: chartSize.width }),
standalone: false,
themeColor,
themeVariant,
@@ -661,7 +656,7 @@ export const ChartBullet: React.FunctionComponent = ({
const primarySegmentedMeasure = React.cloneElement(primarySegmentedMeasureComponent, {
allowTooltip,
constrainToVisibleArea,
- barWidth: getPrimarySegmentedMeasureWidth({height: chartSize.height, horizontal, width: chartSize.width}),
+ barWidth: getPrimarySegmentedMeasureWidth({ height: chartSize.height, horizontal, width: chartSize.width }),
data: primarySegmentedMeasureData,
domain,
height: chartSize.height,
@@ -682,7 +677,7 @@ export const ChartBullet: React.FunctionComponent = ({
const qualitativeRange = React.cloneElement(qualitativeRangeComponent, {
allowTooltip,
constrainToVisibleArea,
- barWidth: getQualitativeRangeBarWidth({height: chartSize.height, horizontal, width: chartSize.width}),
+ barWidth: getQualitativeRangeBarWidth({ height: chartSize.height, horizontal, width: chartSize.width }),
data: qualitativeRangeData,
domain,
height: chartSize.height,
@@ -710,7 +705,7 @@ export const ChartBullet: React.FunctionComponent = ({
range = maxVal - minVal;
}
const tickInterval = range / (ChartBulletStyles.axisTickCount - 1);
- for (let i = minVal; i < maxVal;) {
+ for (let i = minVal; i < maxVal; ) {
i += tickInterval;
tickValues.push(Math.ceil(i));
}
@@ -728,12 +723,16 @@ export const ChartBullet: React.FunctionComponent = ({
// Adjust for padding
if (legendPosition === ChartLegendPosition.bottom) {
dy = horizontal
- ? defaultPadding.top * .5 + (defaultPadding.bottom * .5 - (defaultPadding.bottom)) - 25
- : title ? -defaultPadding.bottom + 60 : -defaultPadding.bottom;
+ ? defaultPadding.top * 0.5 + (defaultPadding.bottom * 0.5 - defaultPadding.bottom) - 25
+ : title
+ ? -defaultPadding.bottom + 60
+ : -defaultPadding.bottom;
} else if (legendPosition === ChartLegendPosition.bottomLeft) {
dy = horizontal
- ? defaultPadding.top * .5 + (defaultPadding.bottom * .5 - (defaultPadding.bottom)) - 25
- : title ? -defaultPadding.bottom + 60 : -defaultPadding.bottom;
+ ? defaultPadding.top * 0.5 + (defaultPadding.bottom * 0.5 - defaultPadding.bottom) - 25
+ : title
+ ? -defaultPadding.bottom + 60
+ : -defaultPadding.bottom;
dx = -10;
}
return (
@@ -755,12 +754,12 @@ export const ChartBullet: React.FunctionComponent = ({
// Returns comparative zero measure
const getComparativeZeroMeasure = () => {
const _domain: any = domain;
- const low = Array.isArray(_domain)
- ? _domain[0]
- : _domain.y && Array.isArray(_domain.y) ? _domain.y[0] : 0;
+ const low = Array.isArray(_domain) ? _domain[0] : _domain.y && Array.isArray(_domain.y) ? _domain.y[0] : 0;
const high = Array.isArray(_domain)
? _domain[_domain.length - 1]
- : _domain.y && Array.isArray(_domain.y) ? _domain.y[_domain.y.length - 1] : 0;
+ : _domain.y && Array.isArray(_domain.y)
+ ? _domain.y[_domain.y.length - 1]
+ : 0;
if (low < 0 && high > 0) {
return comparativeZeroMeasure;
@@ -771,14 +770,16 @@ export const ChartBullet: React.FunctionComponent = ({
// Axis component for custom tick values
const axis = React.cloneElement(axisComponent, {
dependentAxis: horizontal ? false : true,
- domain: !horizontal ? domain : {
- x: (domain as any).y,
- y: (domain as any).x
- },
+ domain: !horizontal
+ ? domain
+ : {
+ x: (domain as any).y,
+ y: (domain as any).x
+ },
height: chartSize.height,
// Adjust for padding
- offsetX: !horizontal ? defaultPadding.left * .5 + (defaultPadding.right * .5 - (defaultPadding.right - 55)) : 0,
- offsetY: horizontal ? 80 - defaultPadding.top * .5 + (defaultPadding.bottom * .5 - 25) : 0,
+ offsetX: !horizontal ? defaultPadding.left * 0.5 + (defaultPadding.right * 0.5 - (defaultPadding.right - 55)) : 0,
+ offsetY: horizontal ? 80 - defaultPadding.top * 0.5 + (defaultPadding.bottom * 0.5 - 25) : 0,
padding,
standalone: false,
tickCount: ChartBulletStyles.axisTickCount,
@@ -803,19 +804,11 @@ export const ChartBullet: React.FunctionComponent = ({
);
return standalone ? (
-
+
{bulletChart}
) : (
-
- {bulletChart}
-
+ {bulletChart}
);
};
diff --git a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletComparativeErrorMeasure.test.tsx b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletComparativeErrorMeasure.test.tsx
index 70ec37eef46..b68c2fe56e7 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletComparativeErrorMeasure.test.tsx
+++ b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletComparativeErrorMeasure.test.tsx
@@ -2,7 +2,7 @@ import * as React from 'react';
import { shallow } from 'enzyme';
import { ChartBulletComparativeErrorMeasure } from './ChartBulletComparativeErrorMeasure';
-Object.values([true, false]).forEach((isRead) => {
+Object.values([true, false]).forEach(isRead => {
test('ChartBulletComparativeErrorMeasure', () => {
const view = shallow();
expect(view).toMatchSnapshot();
@@ -10,12 +10,6 @@ Object.values([true, false]).forEach((isRead) => {
});
test('renders component data', () => {
- const view = shallow(
-
- );
+ const view = shallow();
expect(view).toMatchSnapshot();
});
diff --git a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletComparativeErrorMeasure.tsx b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletComparativeErrorMeasure.tsx
index d7ed97682c6..5a216ee9548 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletComparativeErrorMeasure.tsx
+++ b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletComparativeErrorMeasure.tsx
@@ -1,14 +1,8 @@
import * as React from 'react';
import hoistNonReactStatics from 'hoist-non-react-statics';
-import {
- DataGetterPropType,
- DomainPropType,
- NumberOrCallback,
- PaddingProps,
- VictoryBar,
-} from 'victory';
+import { DataGetterPropType, DomainPropType, NumberOrCallback, PaddingProps, VictoryBar } from 'victory';
import { ChartContainer } from '../ChartContainer';
-import { ChartThemeDefinition} from '../ChartTheme';
+import { ChartThemeDefinition } from '../ChartTheme';
import { getBulletComparativeErrorMeasureTheme } from '../ChartUtils';
import { ChartBulletComparativeMeasure } from './ChartBulletComparativeMeasure';
@@ -211,9 +205,7 @@ export const ChartBulletComparativeErrorMeasure: React.FunctionComponent
) : (
-
- {measure}
-
+ {measure}
);
};
diff --git a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletComparativeMeasure.test.tsx b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletComparativeMeasure.test.tsx
index 15affe868a5..d65dd925056 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletComparativeMeasure.test.tsx
+++ b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletComparativeMeasure.test.tsx
@@ -2,7 +2,7 @@ import * as React from 'react';
import { shallow } from 'enzyme';
import { ChartBulletComparativeMeasure } from './ChartBulletComparativeMeasure';
-Object.values([true, false]).forEach((isRead) => {
+Object.values([true, false]).forEach(isRead => {
test('ChartBulletComparativeMeasure', () => {
const view = shallow();
expect(view).toMatchSnapshot();
@@ -10,12 +10,6 @@ Object.values([true, false]).forEach((isRead) => {
});
test('renders component data', () => {
- const view = shallow(
-
- );
+ const view = shallow();
expect(view).toMatchSnapshot();
});
diff --git a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletComparativeMeasure.tsx b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletComparativeMeasure.tsx
index 34ceea44e1a..3fc31dbc4f4 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletComparativeMeasure.tsx
+++ b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletComparativeMeasure.tsx
@@ -1,16 +1,10 @@
import * as React from 'react';
import hoistNonReactStatics from 'hoist-non-react-statics';
-import {
- DataGetterPropType,
- DomainPropType,
- NumberOrCallback,
- PaddingProps,
- VictoryBar,
-} from 'victory';
-import { getComparativeMeasureData } from './utils';
+import { DataGetterPropType, DomainPropType, NumberOrCallback, PaddingProps, VictoryBar } from 'victory';
+import { getComparativeMeasureData } from './utils';
import { ChartBar } from '../ChartBar';
import { ChartContainer } from '../ChartContainer';
-import { ChartBulletStyles, ChartThemeDefinition} from '../ChartTheme';
+import { ChartBulletStyles, ChartThemeDefinition } from '../ChartTheme';
import { ChartTooltip } from '../ChartTooltip';
import { getBulletComparativeMeasureTheme } from '../ChartUtils';
@@ -202,14 +196,14 @@ export const ChartBulletComparativeMeasure: React.FunctionComponent {
if (!horizontal) {
return 0;
}
- const result = (typeof barWidth === 'function') ? barWidth(data, false) : barWidth;
+ const result = typeof barWidth === 'function' ? barWidth(data, false) : barWidth;
return -(result / 2);
},
orientation: 'top',
@@ -219,7 +213,7 @@ export const ChartBulletComparativeMeasure: React.FunctionComponent {
return React.cloneElement(measureComponent, {
barWidth,
- data: [{...dataPoint}],
+ data: [{ ...dataPoint }],
domain,
height,
horizontal,
@@ -239,9 +233,7 @@ export const ChartBulletComparativeMeasure: React.FunctionComponent
) : (
-
- {measure}
-
+ {measure}
);
};
diff --git a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletComparativeWarningMeasure.test.tsx b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletComparativeWarningMeasure.test.tsx
index ce00bdfb564..f87bf35ce3e 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletComparativeWarningMeasure.test.tsx
+++ b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletComparativeWarningMeasure.test.tsx
@@ -2,7 +2,7 @@ import * as React from 'react';
import { shallow } from 'enzyme';
import { ChartBulletComparativeWarningMeasure } from './ChartBulletComparativeWarningMeasure';
-Object.values([true, false]).forEach((isRead) => {
+Object.values([true, false]).forEach(isRead => {
test('ChartBulletComparativeZeroMeasure', () => {
const view = shallow();
expect(view).toMatchSnapshot();
@@ -11,11 +11,7 @@ Object.values([true, false]).forEach((isRead) => {
test('renders component data', () => {
const view = shallow(
-
+
);
expect(view).toMatchSnapshot();
});
diff --git a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletComparativeWarningMeasure.tsx b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletComparativeWarningMeasure.tsx
index ec1006b3cad..c9623972e4a 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletComparativeWarningMeasure.tsx
+++ b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletComparativeWarningMeasure.tsx
@@ -1,14 +1,8 @@
import * as React from 'react';
import hoistNonReactStatics from 'hoist-non-react-statics';
-import {
- DataGetterPropType,
- DomainPropType,
- NumberOrCallback,
- PaddingProps,
- VictoryBar,
-} from 'victory';
+import { DataGetterPropType, DomainPropType, NumberOrCallback, PaddingProps, VictoryBar } from 'victory';
import { ChartContainer } from '../ChartContainer';
-import { ChartThemeDefinition} from '../ChartTheme';
+import { ChartThemeDefinition } from '../ChartTheme';
import { getBulletComparativeWarningMeasureTheme } from '../ChartUtils';
import { ChartBulletComparativeMeasure } from './ChartBulletComparativeMeasure';
@@ -161,7 +155,9 @@ export interface ChartBulletComparativeWarningMeasureProps {
y?: DataGetterPropType;
}
-export const ChartBulletComparativeWarningMeasure: React.FunctionComponent = ({
+export const ChartBulletComparativeWarningMeasure: React.FunctionComponent<
+ ChartBulletComparativeWarningMeasureProps
+> = ({
allowTooltip = true,
ariaDesc,
ariaTitle,
@@ -211,9 +207,7 @@ export const ChartBulletComparativeWarningMeasure: React.FunctionComponent
) : (
-
- {measure}
-
+ {measure}
);
};
diff --git a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletGroupTitle.test.tsx b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletGroupTitle.test.tsx
index 3eab6fe3dbb..700d3873f1a 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletGroupTitle.test.tsx
+++ b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletGroupTitle.test.tsx
@@ -2,7 +2,7 @@ import * as React from 'react';
import { shallow } from 'enzyme';
import { ChartBulletGroupTitle } from './ChartBulletGroupTitle';
-Object.values([true, false]).forEach((isRead) => {
+Object.values([true, false]).forEach(isRead => {
test('ChartBulletGroupTitle', () => {
const view = shallow();
expect(view).toMatchSnapshot();
@@ -10,11 +10,6 @@ Object.values([true, false]).forEach((isRead) => {
});
test('renders component data', () => {
- const view = shallow(
-
- );
+ const view = shallow();
expect(view).toMatchSnapshot();
});
diff --git a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletGroupTitle.tsx b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletGroupTitle.tsx
index 89a723dbe3d..a333ffd272f 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletGroupTitle.tsx
+++ b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletGroupTitle.tsx
@@ -1,13 +1,16 @@
import * as React from 'react';
-import {
- PaddingProps,
- StringOrNumberOrCallback,
-} from 'victory';
+import { PaddingProps, StringOrNumberOrCallback } from 'victory';
import { Line } from 'victory-core';
import { ChartContainer } from '../ChartContainer';
import { ChartLabel } from '../ChartLabel';
import { ChartBulletStyles, ChartThemeDefinition } from '../ChartTheme';
-import { getBulletGroupTitleTheme, getLabelTextSize, getBulletLabelX, getBulletLabelY, getPaddingForSide } from '../ChartUtils';
+import {
+ getBulletGroupTitleTheme,
+ getLabelTextSize,
+ getBulletLabelX,
+ getBulletLabelY,
+ getPaddingForSide
+} from '../ChartUtils';
/**
* See https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/victory/index.d.ts
@@ -130,26 +133,27 @@ export const ChartBulletGroupTitle: React.FunctionComponent {
const defaultPadding = {
- bottom: getPaddingForSide('bottom', padding, theme.chart.padding),
+ bottom: getPaddingForSide('bottom', padding, theme.chart.padding),
left: getPaddingForSide('left', padding, theme.chart.padding),
right: getPaddingForSide('right', padding, theme.chart.padding),
- top: getPaddingForSide('top', padding, theme.chart.padding),
+ top: getPaddingForSide('top', padding, theme.chart.padding)
};
const labelPadding = {
- bottom: getPaddingForSide('bottom', padding, theme.legend.style.labels.padding),
+ bottom: getPaddingForSide('bottom', padding, theme.legend.style.labels.padding),
left: getPaddingForSide('left', padding, theme.legend.style.labels.padding),
right: getPaddingForSide('right', padding, theme.legend.style.labels.padding),
- top: getPaddingForSide('top', padding, theme.legend.style.labels.padding),
+ top: getPaddingForSide('top', padding, theme.legend.style.labels.padding)
};
// Horizontal divider to render under the group title
const getDivider = () => {
- const titleSize = getLabelTextSize({text: title, theme});
- const subTitleSize = getLabelTextSize({text: subTitle, theme});
- const dy = title && subTitle
- ? titleSize.height + subTitleSize.height + labelPadding.top + labelPadding.bottom
- : titleSize.height + labelPadding.top + labelPadding.bottom;
+ const titleSize = getLabelTextSize({ text: title, theme });
+ const subTitleSize = getLabelTextSize({ text: subTitle, theme });
+ const dy =
+ title && subTitle
+ ? titleSize.height + subTitleSize.height + labelPadding.top + labelPadding.bottom
+ : titleSize.height + labelPadding.top + labelPadding.bottom;
return React.cloneElement(dividerComponent, {
x1: defaultPadding.left,
@@ -166,7 +170,7 @@ export const ChartBulletGroupTitle: React.FunctionComponent
- {getTitle()}
- {getDivider()}
-
- )
+ const groupTitle = Boolean(title) && (
+
+ {getTitle()}
+ {getDivider()}
+
);
return standalone ? (
@@ -198,8 +200,6 @@ export const ChartBulletGroupTitle: React.FunctionComponent
) : (
-
- {groupTitle}
-
+ {groupTitle}
);
};
diff --git a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletPrimaryDotMeasure.test.tsx b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletPrimaryDotMeasure.test.tsx
index 297eecccbed..a8fedaeb9c9 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletPrimaryDotMeasure.test.tsx
+++ b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletPrimaryDotMeasure.test.tsx
@@ -2,7 +2,7 @@ import * as React from 'react';
import { shallow } from 'enzyme';
import { ChartBulletPrimaryDotMeasure } from './ChartBulletPrimaryDotMeasure';
-Object.values([true, false]).forEach((isRead) => {
+Object.values([true, false]).forEach(isRead => {
test('ChartBulletPrimaryDotMeasure', () => {
const view = shallow();
expect(view).toMatchSnapshot();
@@ -11,10 +11,7 @@ Object.values([true, false]).forEach((isRead) => {
test('renders component data', () => {
const view = shallow(
-
+
);
expect(view).toMatchSnapshot();
});
diff --git a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletPrimaryDotMeasure.tsx b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletPrimaryDotMeasure.tsx
index 28a32ff33ae..1cf3a31d472 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletPrimaryDotMeasure.tsx
+++ b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletPrimaryDotMeasure.tsx
@@ -1,12 +1,7 @@
import * as React from 'react';
import hoistNonReactStatics from 'hoist-non-react-statics';
-import {
- DataGetterPropType,
- DomainPropType,
- PaddingProps,
- VictoryScatter
-} from 'victory';
-import { getPrimaryDotMeasureData } from './utils';
+import { DataGetterPropType, DomainPropType, PaddingProps, VictoryScatter } from 'victory';
+import { getPrimaryDotMeasureData } from './utils';
import { ChartContainer } from '../ChartContainer';
import { ChartScatter } from '../ChartScatter';
import { ChartBulletStyles, ChartThemeDefinition } from '../ChartTheme';
@@ -209,14 +204,14 @@ export const ChartBulletPrimaryDotMeasure: React.FunctionComponent {
return React.cloneElement(measureComponent, {
- data: [{...dataPoint}],
+ data: [{ ...dataPoint }],
domain,
height,
horizontal,
@@ -242,9 +237,7 @@ export const ChartBulletPrimaryDotMeasure: React.FunctionComponent
) : (
-
- {measure}
-
+ {measure}
);
};
diff --git a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletPrimarySegmentedMeasure.test.tsx b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletPrimarySegmentedMeasure.test.tsx
index b79dbdbd416..82b8c90bbc2 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletPrimarySegmentedMeasure.test.tsx
+++ b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletPrimarySegmentedMeasure.test.tsx
@@ -2,7 +2,7 @@ import * as React from 'react';
import { shallow } from 'enzyme';
import { ChartBulletPrimarySegmentedMeasure } from './ChartBulletPrimarySegmentedMeasure';
-Object.values([true, false]).forEach((isRead) => {
+Object.values([true, false]).forEach(isRead => {
test('ChartBulletPrimarySegmentedMeasure', () => {
const view = shallow();
expect(view).toMatchSnapshot();
@@ -11,10 +11,7 @@ Object.values([true, false]).forEach((isRead) => {
test('renders component data', () => {
const view = shallow(
-
+
);
expect(view).toMatchSnapshot();
});
diff --git a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletPrimarySegmentedMeasure.tsx b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletPrimarySegmentedMeasure.tsx
index 748dd5c3f43..0e00f5753b3 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletPrimarySegmentedMeasure.tsx
+++ b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletPrimarySegmentedMeasure.tsx
@@ -1,13 +1,7 @@
import * as React from 'react';
import hoistNonReactStatics from 'hoist-non-react-statics';
-import {
- DataGetterPropType,
- DomainPropType,
- NumberOrCallback,
- PaddingProps,
- VictoryBar,
-} from 'victory';
-import { getPrimarySegmentedMeasureData } from './utils';
+import { DataGetterPropType, DomainPropType, NumberOrCallback, PaddingProps, VictoryBar } from 'victory';
+import { getPrimarySegmentedMeasureData } from './utils';
import { ChartBar } from '../ChartBar';
import { ChartContainer } from '../ChartContainer';
import { ChartBulletStyles, ChartThemeDefinition } from '../ChartTheme';
@@ -227,14 +221,14 @@ export const ChartBulletPrimarySegmentedMeasure: React.FunctionComponent {
if (!horizontal) {
return 0;
}
- const result = (typeof barWidth === 'function') ? barWidth(data, false) : barWidth;
+ const result = typeof barWidth === 'function' ? barWidth(data, false) : barWidth;
return -(result / 2);
},
orientation: 'top',
@@ -244,7 +238,7 @@ export const ChartBulletPrimarySegmentedMeasure: React.FunctionComponent {
return React.cloneElement(measureComponent, {
barWidth,
- data: [{...dataPoint}],
+ data: [{ ...dataPoint }],
domain,
height,
horizontal,
@@ -269,9 +263,7 @@ export const ChartBulletPrimarySegmentedMeasure: React.FunctionComponent
) : (
-
- {measure}
-
+ {measure}
);
};
diff --git a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletQualitativeRange.test.tsx b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletQualitativeRange.test.tsx
index 19d6251f36e..d34ce604ec8 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletQualitativeRange.test.tsx
+++ b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletQualitativeRange.test.tsx
@@ -2,7 +2,7 @@ import * as React from 'react';
import { shallow } from 'enzyme';
import { ChartBulletQualitativeRange } from './ChartBulletQualitativeRange';
-Object.values([true, false]).forEach((isRead) => {
+Object.values([true, false]).forEach(isRead => {
test('ChartBulletQualitativeRange', () => {
const view = shallow();
expect(view).toMatchSnapshot();
@@ -11,10 +11,7 @@ Object.values([true, false]).forEach((isRead) => {
test('renders component data', () => {
const view = shallow(
-
+
);
expect(view).toMatchSnapshot();
});
diff --git a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletQualitativeRange.tsx b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletQualitativeRange.tsx
index 9812095581b..dfbd5f4d8f8 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletQualitativeRange.tsx
+++ b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletQualitativeRange.tsx
@@ -1,13 +1,7 @@
import * as React from 'react';
import hoistNonReactStatics from 'hoist-non-react-statics';
-import {
- DataGetterPropType,
- DomainPropType,
- NumberOrCallback,
- PaddingProps,
- VictoryBar
-} from 'victory';
-import { getQualitativeRangeData } from './utils';
+import { DataGetterPropType, DomainPropType, NumberOrCallback, PaddingProps, VictoryBar } from 'victory';
+import { getQualitativeRangeData } from './utils';
import { ChartBar } from '../ChartBar';
import { ChartContainer } from '../ChartContainer';
import { ChartBulletStyles, ChartThemeDefinition } from '../ChartTheme';
@@ -238,14 +232,14 @@ export const ChartBulletQualitativeRange: React.FunctionComponent {
if (!horizontal) {
return 0;
}
- const result = (typeof barWidth === 'function') ? barWidth(data, false) : barWidth;
+ const result = typeof barWidth === 'function' ? barWidth(data, false) : barWidth;
return -(result / 2);
},
orientation: 'top',
@@ -255,7 +249,7 @@ export const ChartBulletQualitativeRange: React.FunctionComponent {
return React.cloneElement(measureComponent, {
barWidth,
- data: [{...dataPoint}],
+ data: [{ ...dataPoint }],
domain,
height,
horizontal,
@@ -280,9 +274,7 @@ export const ChartBulletQualitativeRange: React.FunctionComponent
) : (
-
- {measure}
-
+ {measure}
);
};
diff --git a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletTitle.test.tsx b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletTitle.test.tsx
index 1852fc9f663..58d66cd4dc1 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletTitle.test.tsx
+++ b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletTitle.test.tsx
@@ -2,7 +2,7 @@ import * as React from 'react';
import { shallow } from 'enzyme';
import { ChartBulletTitle } from './ChartBulletTitle';
-Object.values([true, false]).forEach((isRead) => {
+Object.values([true, false]).forEach(isRead => {
test('ChartBulletTitle', () => {
const view = shallow();
expect(view).toMatchSnapshot();
@@ -10,11 +10,6 @@ Object.values([true, false]).forEach((isRead) => {
});
test('renders component data', () => {
- const view = shallow(
-
- );
+ const view = shallow();
expect(view).toMatchSnapshot();
});
diff --git a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletTitle.tsx b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletTitle.tsx
index 889d5bc3046..7ee6ab48c15 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletTitle.tsx
+++ b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletTitle.tsx
@@ -1,8 +1,5 @@
import * as React from 'react';
-import {
- PaddingProps,
- StringOrNumberOrCallback,
-} from 'victory';
+import { PaddingProps, StringOrNumberOrCallback } from 'victory';
import { ChartContainer } from '../ChartContainer';
import { ChartLabel } from '../ChartLabel';
import { ChartLegendPosition } from '../ChartLegend';
@@ -150,10 +147,10 @@ export const ChartBulletTitle: React.FunctionComponent =
};
const defaultPadding = {
- bottom: getPaddingForSide('bottom', padding, theme.chart.padding),
+ bottom: getPaddingForSide('bottom', padding, theme.chart.padding),
left: getPaddingForSide('left', padding, theme.chart.padding),
right: getPaddingForSide('right', padding, theme.chart.padding),
- top: getPaddingForSide('top', padding, theme.chart.padding),
+ top: getPaddingForSide('top', padding, theme.chart.padding)
};
// Returns title
@@ -168,7 +165,7 @@ export const ChartBulletTitle: React.FunctionComponent =
// The x and y calculations below are used to adjust the position of the title, based on padding and scale.
// This ensures that when padding is adjusted, the title moves along with the chart's position.
return React.cloneElement(titleComponent, {
- ...showBoth && { capHeight },
+ ...(showBoth && { capHeight }),
style: [ChartBulletStyles.label.title, ChartBulletStyles.label.subTitle],
text: showBoth ? [title, subTitle] : title,
textAnchor: labelPosition === 'top-left' ? 'start' : horizontal ? 'end' : 'middle',
@@ -176,24 +173,30 @@ export const ChartBulletTitle: React.FunctionComponent =
// Adjust for padding
x: horizontal
? getBulletLabelX({
- chartWidth: chartSize.width,
- dx: labelPosition === 'top-left'
- ? defaultPadding.left
- : defaultPadding.left - ChartCommonStyles.label.margin * 1.75,
- labelPosition: 'left', // skip 'bottom'
- legendPosition,
- svgWidth: width
- })
- : defaultPadding.left * .5 + (defaultPadding.right * .5 - (defaultPadding.right - 50)) +
+ chartWidth: chartSize.width,
+ dx:
+ labelPosition === 'top-left'
+ ? defaultPadding.left
+ : defaultPadding.left - ChartCommonStyles.label.margin * 1.75,
+ labelPosition: 'left', // skip 'bottom'
+ legendPosition,
+ svgWidth: width
+ })
+ : defaultPadding.left * 0.5 +
+ (defaultPadding.right * 0.5 - (defaultPadding.right - 50)) +
ChartBulletStyles.qualitativeRangeWidth / 2,
y: getBulletLabelY({
chartHeight: chartSize.height,
// Adjust for padding
- dy: labelPosition === 'top-left'
- ? defaultPadding.top * .5 + (defaultPadding.bottom * .5 - (defaultPadding.bottom)) + 58 -
- ChartCommonStyles.legend.margin + (showBoth ? 0 : 1)
- : horizontal
- ? defaultPadding.top * .5 + (defaultPadding.bottom * .5 - (defaultPadding.bottom))
+ dy:
+ labelPosition === 'top-left'
+ ? defaultPadding.top * 0.5 +
+ (defaultPadding.bottom * 0.5 - defaultPadding.bottom) +
+ 58 -
+ ChartCommonStyles.legend.margin +
+ (showBoth ? 0 : 1)
+ : horizontal
+ ? defaultPadding.top * 0.5 + (defaultPadding.bottom * 0.5 - defaultPadding.bottom)
: ChartCommonStyles.legend.margin * 2 - defaultPadding.bottom,
labelPosition
}),
@@ -206,8 +209,6 @@ export const ChartBulletTitle: React.FunctionComponent =
{getTitle()}
) : (
-
- {getTitle()}
-
+ {getTitle()}
);
};
diff --git a/packages/patternfly-4/react-charts/src/components/ChartBullet/utils/chart-bullet-data.ts b/packages/patternfly-4/react-charts/src/components/ChartBullet/utils/chart-bullet-data.ts
index 6ac6b8a7294..c16d8226d2b 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartBullet/utils/chart-bullet-data.ts
+++ b/packages/patternfly-4/react-charts/src/components/ChartBullet/utils/chart-bullet-data.ts
@@ -51,12 +51,12 @@ export const getComparativeMeasureData = ({
}: ChartBulletDataInterface) => {
const datum: any[] = [];
- Data.formatData(data, {y}, ['y']).forEach(((dataPoint: any, index: number) => {
+ Data.formatData(data, { y }, ['y']).forEach((dataPoint: any, index: number) => {
datum.push({
...dataPoint,
_index: index // Save to sync legend color
});
- }));
+ });
const computedData = datum.map((dataPoint: any, index: number) => {
return {
@@ -126,7 +126,7 @@ export const getPrimarySegmentedMeasureData = ({
const negativeDatum: any[] = [];
const positiveDatum: any[] = [];
- Data.formatData(data, {y, y0}, ['y', 'y0']).forEach(((dataPoint: any, index: number) => {
+ Data.formatData(data, { y, y0 }, ['y', 'y0']).forEach((dataPoint: any, index: number) => {
if (dataPoint._y < 0) {
negativeDatum.push({
...dataPoint,
@@ -138,11 +138,12 @@ export const getPrimarySegmentedMeasureData = ({
_index: index // Save to sync legend color
});
}
- }));
+ });
// Instead of relying on colorScale, colors must be added to each measure in ascending order
- const negativeComputedData = negativeDatum.sort((a: any, b: any) => b._y - a._y).
- map((dataPoint: any, index: number) => {
+ const negativeComputedData = negativeDatum
+ .sort((a: any, b: any) => b._y - a._y)
+ .map((dataPoint: any, index: number) => {
return {
...dataPoint,
x: 1,
@@ -152,11 +153,13 @@ export const getPrimarySegmentedMeasureData = ({
: negativeMeasureTheme.group.colorScale[index % theme.group.colorScale.length]
};
// Sort descending so largest bar is appears behind others
- }).reverse();
+ })
+ .reverse();
// Instead of relying on colorScale, colors must be added to each measure in ascending order
- const positiveComputedData = positiveDatum.sort((a: any, b: any) => a._y - b._y).
- map((dataPoint: any, index: number) => {
+ const positiveComputedData = positiveDatum
+ .sort((a: any, b: any) => a._y - b._y)
+ .map((dataPoint: any, index: number) => {
return {
...dataPoint,
x: 1,
@@ -166,12 +169,10 @@ export const getPrimarySegmentedMeasureData = ({
: theme.group.colorScale[index % theme.group.colorScale.length]
};
// Sort descending so largest bar is appears behind others
- }).reverse();
+ })
+ .reverse();
- return [
- ...negativeComputedData,
- ...positiveComputedData
- ];
+ return [...negativeComputedData, ...positiveComputedData];
};
export const getQualitativeRangeData = ({
@@ -187,15 +188,16 @@ export const getQualitativeRangeData = ({
}: ChartBulletDataInterface) => {
const datum: any[] = [];
- Data.formatData(data, {y, y0}, ['y', 'y0']).forEach(((dataPoint: any, index: number) => {
+ Data.formatData(data, { y, y0 }, ['y', 'y0']).forEach((dataPoint: any, index: number) => {
datum.push({
...dataPoint,
_index: index // Save to sync legend color
});
- }));
+ });
- const computedData = datum.sort((a: any, b: any) => invert ? b._y - a._y : a._y - b._y).
- map((dataPoint: any, index: number) => {
+ const computedData = datum
+ .sort((a: any, b: any) => (invert ? b._y - a._y : a._y - b._y))
+ .map((dataPoint: any, index: number) => {
return {
...dataPoint,
x: 1,
@@ -204,7 +206,8 @@ export const getQualitativeRangeData = ({
_color: theme.group.colorScale[index % theme.group.colorScale.length]
};
// Sort descending so largest bar is appears behind others
- }).reverse();
+ })
+ .reverse();
return computedData;
};
diff --git a/packages/patternfly-4/react-charts/src/components/ChartBullet/utils/chart-bullet-domain.ts b/packages/patternfly-4/react-charts/src/components/ChartBullet/utils/chart-bullet-domain.ts
index 984b4e08805..cf094f19fac 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartBullet/utils/chart-bullet-domain.ts
+++ b/packages/patternfly-4/react-charts/src/components/ChartBullet/utils/chart-bullet-domain.ts
@@ -1,4 +1,4 @@
-import * as React from "react";
+import * as React from 'react';
import { ChartDomain, getDomains } from '../../ChartUtils';
interface ChartBulletDomainInterface {
@@ -34,22 +34,28 @@ export const getBulletDomain = ({
const domain = getDomains({
maxDomain,
minDomain,
- sources: [{
- component: comparativeErrorMeasureComponent,
- data: comparativeErrorMeasureData
- }, {
- component: comparativeWarningMeasureComponent,
- data: comparativeWarningMeasureData
- }, {
- component: primaryDotMeasureComponent,
- data: primaryDotMeasureData
- }, {
- component: primarySegmentedMeasureComponent,
- data: primarySegmentedMeasureData
- }, {
- component: qualitativeRangeComponent,
- data: qualitativeRangeData
- }]
+ sources: [
+ {
+ component: comparativeErrorMeasureComponent,
+ data: comparativeErrorMeasureData
+ },
+ {
+ component: comparativeWarningMeasureComponent,
+ data: comparativeWarningMeasureData
+ },
+ {
+ component: primaryDotMeasureComponent,
+ data: primaryDotMeasureData
+ },
+ {
+ component: primarySegmentedMeasureComponent,
+ data: primarySegmentedMeasureData
+ },
+ {
+ component: qualitativeRangeComponent,
+ data: qualitativeRangeData
+ }
+ ]
});
// Note that comparative measures and qualitative range bars are currently given an x-value of 1, while the bar widths
// fill the domain. At one point, lines were used to represent comparative warning, comparative error, and zero
diff --git a/packages/patternfly-4/react-charts/src/components/ChartBullet/utils/chart-bullet-size.ts b/packages/patternfly-4/react-charts/src/components/ChartBullet/utils/chart-bullet-size.ts
index 680fdcbe94a..95ebc4762a1 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartBullet/utils/chart-bullet-size.ts
+++ b/packages/patternfly-4/react-charts/src/components/ChartBullet/utils/chart-bullet-size.ts
@@ -1,5 +1,5 @@
import { ChartThemeDefinition } from '../../ChartTheme';
-import { ChartBulletStyles } from '../../ChartTheme';
+import { ChartBulletStyles } from '../../ChartTheme';
import {
getBulletComparativeErrorMeasureTheme,
getBulletComparativeMeasureTheme,
@@ -24,7 +24,7 @@ interface ChartBulletSizeInterface {
theme?: ChartThemeDefinition;
themeColor?: string;
themeVariant?: string;
- width: number; // The chart width -- not SVG width
+ width: number; // The chart width -- not SVG width
}
export const getComparativeMeasureErrorWidth = ({
@@ -35,14 +35,15 @@ export const getComparativeMeasureErrorWidth = ({
width,
// destructure last
- theme = getBulletComparativeErrorMeasureTheme(themeColor, themeVariant),
-}: ChartBulletSizeInterface) => scaleBarWidth({
- defaultSize: theme.bar.height,
- height,
- horizontal,
- value: ChartBulletStyles.comparativeMeasureErrorWidth,
- width
-});
+ theme = getBulletComparativeErrorMeasureTheme(themeColor, themeVariant)
+}: ChartBulletSizeInterface) =>
+ scaleBarWidth({
+ defaultSize: theme.bar.height,
+ height,
+ horizontal,
+ value: ChartBulletStyles.comparativeMeasureErrorWidth,
+ width
+ });
export const getComparativeMeasureWidth = ({
height,
@@ -52,14 +53,15 @@ export const getComparativeMeasureWidth = ({
width,
// destructure last
- theme = getBulletComparativeMeasureTheme(themeColor, themeVariant),
-}: ChartBulletSizeInterface) => scaleBarWidth({
- defaultSize: theme.bar.height,
- height,
- horizontal,
- value: ChartBulletStyles.comparativeMeasureWidth,
- width
-});
+ theme = getBulletComparativeMeasureTheme(themeColor, themeVariant)
+}: ChartBulletSizeInterface) =>
+ scaleBarWidth({
+ defaultSize: theme.bar.height,
+ height,
+ horizontal,
+ value: ChartBulletStyles.comparativeMeasureWidth,
+ width
+ });
export const getComparativeMeasureWarningWidth = ({
height,
@@ -69,14 +71,15 @@ export const getComparativeMeasureWarningWidth = ({
width,
// destructure last
- theme = getBulletComparativeWarningMeasureTheme(themeColor, themeVariant),
-}: ChartBulletSizeInterface) => scaleBarWidth({
- defaultSize: theme.bar.height,
- height,
- horizontal,
- value: ChartBulletStyles.comparativeMeasureWarningWidth,
- width
-});
+ theme = getBulletComparativeWarningMeasureTheme(themeColor, themeVariant)
+}: ChartBulletSizeInterface) =>
+ scaleBarWidth({
+ defaultSize: theme.bar.height,
+ height,
+ horizontal,
+ value: ChartBulletStyles.comparativeMeasureWarningWidth,
+ width
+ });
export const getPrimaryDotMeasureSize = ({
height,
@@ -86,14 +89,15 @@ export const getPrimaryDotMeasureSize = ({
width,
// destructure last
- theme = getBulletPrimaryDotMeasureTheme(themeColor, themeVariant),
-}: ChartBulletSizeInterface) => scaleSize({
- defaultSize: theme.group.height,
- height,
- horizontal,
- value: ChartBulletStyles.primaryDotMeasureSize,
- width
-});
+ theme = getBulletPrimaryDotMeasureTheme(themeColor, themeVariant)
+}: ChartBulletSizeInterface) =>
+ scaleSize({
+ defaultSize: theme.group.height,
+ height,
+ horizontal,
+ value: ChartBulletStyles.primaryDotMeasureSize,
+ width
+ });
export const getPrimarySegmentedMeasureWidth = ({
height,
@@ -103,15 +107,16 @@ export const getPrimarySegmentedMeasureWidth = ({
width,
// destructure last
- theme = getBulletPrimarySegmentedMeasureTheme(themeColor, themeVariant),
-}: ChartBulletSizeInterface) => scaleBarWidth({
- defaultSize: theme.group.height,
- height,
- horizontal,
- scale: .3,
- value: ChartBulletStyles.primarySegmentedMeasureWidth,
- width
-});
+ theme = getBulletPrimarySegmentedMeasureTheme(themeColor, themeVariant)
+}: ChartBulletSizeInterface) =>
+ scaleBarWidth({
+ defaultSize: theme.group.height,
+ height,
+ horizontal,
+ scale: 0.3,
+ value: ChartBulletStyles.primarySegmentedMeasureWidth,
+ width
+ });
export const getQualitativeRangeBarWidth = ({
height,
@@ -121,27 +126,22 @@ export const getQualitativeRangeBarWidth = ({
width,
// destructure last
- theme = getBulletQualitativeRangeTheme(themeColor, themeVariant),
-}: ChartBulletSizeInterface) => scaleBarWidth({
- defaultSize: theme.group.height,
- height,
- horizontal,
- value: ChartBulletStyles.qualitativeRangeWidth,
- width
-});
-
-const scale = ({
- defaultSize,
- height,
- horizontal = true,
- scale = 1,
- value,
- width
-}: ChartBulletScaleInterface) => horizontal
- ? height > defaultSize
- ? value + (height - defaultSize) * scale
- : value - (defaultSize - height) * scale
- : width > defaultSize
+ theme = getBulletQualitativeRangeTheme(themeColor, themeVariant)
+}: ChartBulletSizeInterface) =>
+ scaleBarWidth({
+ defaultSize: theme.group.height,
+ height,
+ horizontal,
+ value: ChartBulletStyles.qualitativeRangeWidth,
+ width
+ });
+
+const scale = ({ defaultSize, height, horizontal = true, scale = 1, value, width }: ChartBulletScaleInterface) =>
+ horizontal
+ ? height > defaultSize
+ ? value + (height - defaultSize) * scale
+ : value - (defaultSize - height) * scale
+ : width > defaultSize
? value + (width - defaultSize) * scale
: value - (defaultSize - width) * scale;
@@ -149,13 +149,11 @@ const scale = ({
export const scaleBarWidth = (props: ChartBulletScaleInterface) => Math.max(scale(props), 0);
// Scale size per the given size properties
-export const scaleSize = ({
- value,
- ...rest
-}: ChartBulletScaleInterface) => Math.round(
- scale({
- scale: 1 / value,
- value,
- ...rest,
- })
-);
+export const scaleSize = ({ value, ...rest }: ChartBulletScaleInterface) =>
+ Math.round(
+ scale({
+ scale: 1 / value,
+ value,
+ ...rest
+ })
+ );
diff --git a/packages/patternfly-4/react-charts/src/components/ChartBullet/utils/chart-bullet-theme.ts b/packages/patternfly-4/react-charts/src/components/ChartBullet/utils/chart-bullet-theme.ts
index 5c2d25d3fcb..a95f5d98df6 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartBullet/utils/chart-bullet-theme.ts
+++ b/packages/patternfly-4/react-charts/src/components/ChartBullet/utils/chart-bullet-theme.ts
@@ -4,7 +4,7 @@ import {
getComparativeWarningMeasureData,
getPrimarySegmentedMeasureData,
getQualitativeRangeData
-} from './chart-bullet-data';
+} from './chart-bullet-data';
import { ChartThemeDefinition } from '../../ChartTheme';
import { getBulletTheme } from '../../ChartUtils';
@@ -125,7 +125,8 @@ export const getBulletThemeWithLegendColorScale = ({
qualitativeRangeData,
qualitativeRangeLegendData,
themeColor,
- themeVariant});
+ themeVariant
+ });
const theme = getBulletTheme(themeColor, themeVariant);
theme.legend.colorScale = [...colorScale];
diff --git a/packages/patternfly-4/react-charts/src/components/ChartContainer/ChartContainer.test.tsx b/packages/patternfly-4/react-charts/src/components/ChartContainer/ChartContainer.test.tsx
index 25ed039c08d..6ac0370f3af 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartContainer/ChartContainer.test.tsx
+++ b/packages/patternfly-4/react-charts/src/components/ChartContainer/ChartContainer.test.tsx
@@ -3,7 +3,7 @@ import { shallow } from 'enzyme';
import { ChartContainer } from './ChartContainer';
import { ChartLegend } from '../ChartLegend';
-Object.values([true, false]).forEach((isRead) => {
+Object.values([true, false]).forEach(isRead => {
test('ChartContainer', () => {
const view = shallow();
expect(view).toMatchSnapshot();
diff --git a/packages/patternfly-4/react-charts/src/components/ChartContainer/ChartContainer.tsx b/packages/patternfly-4/react-charts/src/components/ChartContainer/ChartContainer.tsx
index 9f596bd3e1d..1a5c989eba4 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartContainer/ChartContainer.tsx
+++ b/packages/patternfly-4/react-charts/src/components/ChartContainer/ChartContainer.tsx
@@ -1,9 +1,6 @@
import * as React from 'react';
import hoistNonReactStatics from 'hoist-non-react-statics';
-import {
- VictoryContainer,
- VictoryContainerProps
-} from 'victory';
+import { VictoryContainer, VictoryContainerProps } from 'victory';
import { ChartThemeDefinition } from '../ChartTheme';
import { getClassName, getTheme } from '../ChartUtils';
@@ -116,12 +113,12 @@ export const ChartContainer: React.FunctionComponent = ({
theme = getTheme(themeColor, themeVariant),
...rest
}: ChartContainerProps) => {
- const chartClassName = getClassName({className});
+ const chartClassName = getClassName({ className });
// Note: theme is valid, but @types/victory is missing a prop type
// @ts-ignore
return ;
-}
+};
// Note: VictoryContainer.role must be hoisted
hoistNonReactStatics(ChartContainer, VictoryContainer);
diff --git a/packages/patternfly-4/react-charts/src/components/ChartDonut/ChartDonut.test.tsx b/packages/patternfly-4/react-charts/src/components/ChartDonut/ChartDonut.test.tsx
index b8b58c42a7c..3e0f7cc5303 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartDonut/ChartDonut.test.tsx
+++ b/packages/patternfly-4/react-charts/src/components/ChartDonut/ChartDonut.test.tsx
@@ -2,7 +2,7 @@ import * as React from 'react';
import { shallow } from 'enzyme';
import { ChartDonut } from './ChartDonut';
-Object.values([true, false]).forEach((isRead) => {
+Object.values([true, false]).forEach(isRead => {
test('ChartDonut', () => {
const view = shallow();
expect(view).toMatchSnapshot();
diff --git a/packages/patternfly-4/react-charts/src/components/ChartDonut/ChartDonut.tsx b/packages/patternfly-4/react-charts/src/components/ChartDonut/ChartDonut.tsx
index 9b8b16d24f1..37bcbd0dd90 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartDonut/ChartDonut.tsx
+++ b/packages/patternfly-4/react-charts/src/components/ChartDonut/ChartDonut.tsx
@@ -11,7 +11,7 @@ import {
VictoryPie,
VictoryStyleInterface
} from 'victory';
-import { Helpers } from "victory-core";
+import { Helpers } from 'victory-core';
import { getDonutTheme } from '../ChartUtils/chart-theme';
import { ChartContainer } from '../ChartContainer';
import { ChartLabel } from '../ChartLabel';
@@ -297,7 +297,7 @@ export interface ChartDonutProps extends ChartPieProps {
* Victory components will pass an origin prop is to define the center point in svg coordinates for polar charts.
* **This prop should not be set manually.**
*/
- origin?: { x: number, y: number };
+ origin?: { x: number; y: number };
/**
* The padAngle prop determines the amount of separation between adjacent data slices
* in number of degrees
@@ -454,16 +454,18 @@ export const ChartDonut: React.FunctionComponent = ({
...rest
}: ChartDonutProps) => {
const defaultPadding = {
- bottom: getPaddingForSide('bottom', padding, theme.pie.padding),
+ bottom: getPaddingForSide('bottom', padding, theme.pie.padding),
left: getPaddingForSide('left', padding, theme.pie.padding),
right: getPaddingForSide('right', padding, theme.pie.padding),
- top: getPaddingForSide('top', padding, theme.pie.padding),
+ top: getPaddingForSide('top', padding, theme.pie.padding)
};
- const chartRadius = radius ? radius : Helpers.getRadius({
- height,
- width,
- padding: defaultPadding
- });
+ const chartRadius = radius
+ ? radius
+ : Helpers.getRadius({
+ height,
+ width,
+ padding: defaultPadding
+ });
const chartInnerRadius = innerRadius ? innerRadius : chartRadius - 9; // Todo: Add pf-core variable
// Returns subtitle
@@ -505,7 +507,7 @@ export const ChartDonut: React.FunctionComponent = ({
const showBoth = title && subTitle && subTitlePosition == ChartDonutSubTitlePosition.center;
return React.cloneElement(titleComponent, {
- ...showBoth && { capHeight },
+ ...(showBoth && { capHeight }),
key: 'pf-chart-donut-title',
style: [ChartDonutStyles.label.title, ChartDonutStyles.label.subTitle],
text: showBoth ? [title, subTitle] : title,
@@ -545,19 +547,21 @@ export const ChartDonut: React.FunctionComponent = ({
);
// Clone so users can override container props
- const container = React.cloneElement(containerComponent, {
- desc: ariaDesc,
- height,
- title: ariaTitle,
- width,
- theme,
- ...containerComponent.props
- }, [chart, getTitle(), getSubTitle()]);
+ const container = React.cloneElement(
+ containerComponent,
+ {
+ desc: ariaDesc,
+ height,
+ title: ariaTitle,
+ width,
+ theme,
+ ...containerComponent.props
+ },
+ [chart, getTitle(), getSubTitle()]
+ );
return standalone ? (
-
- {container}
-
+ {container}
) : (
{chart}
diff --git a/packages/patternfly-4/react-charts/src/components/ChartDonutUtilization/ChartDonutThreshold.test.tsx b/packages/patternfly-4/react-charts/src/components/ChartDonutUtilization/ChartDonutThreshold.test.tsx
index b1d80e3f66a..cd32d654816 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartDonutUtilization/ChartDonutThreshold.test.tsx
+++ b/packages/patternfly-4/react-charts/src/components/ChartDonutUtilization/ChartDonutThreshold.test.tsx
@@ -2,7 +2,7 @@ import * as React from 'react';
import { shallow } from 'enzyme';
import { ChartDonutThreshold } from './ChartDonutThreshold';
-Object.values([true, false]).forEach((isRead) => {
+Object.values([true, false]).forEach(isRead => {
test('ChartDonutThreshold', () => {
const view = shallow();
expect(view).toMatchSnapshot();
diff --git a/packages/patternfly-4/react-charts/src/components/ChartDonutUtilization/ChartDonutThreshold.tsx b/packages/patternfly-4/react-charts/src/components/ChartDonutUtilization/ChartDonutThreshold.tsx
index 4d205581182..b4fdfa5e0dc 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartDonutUtilization/ChartDonutThreshold.tsx
+++ b/packages/patternfly-4/react-charts/src/components/ChartDonutUtilization/ChartDonutThreshold.tsx
@@ -270,7 +270,7 @@ export interface ChartDonutThresholdProps extends ChartDonutProps {
* Victory components will pass an origin prop is to define the center point in svg coordinates for polar charts.
* It should not be set manually.**
*/
- origin?: { x: number, y: number };
+ origin?: { x: number; y: number };
/**
* The padAngle prop determines the amount of separation between adjacent data slices
* in number of degrees
@@ -420,40 +420,45 @@ export const ChartDonutThreshold: React.FunctionComponent {
const defaultPadding = {
- bottom: getPaddingForSide('bottom', padding, theme.pie.padding),
+ bottom: getPaddingForSide('bottom', padding, theme.pie.padding),
left: getPaddingForSide('left', padding, theme.pie.padding),
right: getPaddingForSide('right', padding, theme.pie.padding),
- top: getPaddingForSide('top', padding, theme.pie.padding),
+ top: getPaddingForSide('top', padding, theme.pie.padding)
};
- const chartRadius = radius | Helpers.getRadius({
- height,
- width,
- padding: defaultPadding
- });
+ const chartRadius =
+ radius |
+ Helpers.getRadius({
+ height,
+ width,
+ padding: defaultPadding
+ });
// Returns computed data representing pie chart slices
const getComputedData = () => {
// Format and sort data. Sorting ensures thresholds are displayed in the correct order and simplifies calculations.
- const datum = Data.formatData(data, {x, y, ...rest}, ['x', 'y']).sort((a: any, b: any) => a._y - b._y);
+ const datum = Data.formatData(data, { x, y, ...rest }, ['x', 'y']).sort((a: any, b: any) => a._y - b._y);
// Data must be offset so that the sum of all data point y-values (including the final slice) == 100.
- const [prev, computedData] = datum.reduce((acc: [number, any], dataPoint: {_x: number | string, _y: number}) => {
- return [
- dataPoint._y, // Set the previous value to current y value
- [
- ...acc[1],
- {
- x: dataPoint._x, // Conditionally add x property only if it is in the original data object
- y: dataPoint._y - acc[0] // Must be offset by previous value
- }
- ]
- ];
- }, [0, []]);
+ const [prev, computedData] = datum.reduce(
+ (acc: [number, any], dataPoint: { _x: number | string; _y: number }) => {
+ return [
+ dataPoint._y, // Set the previous value to current y value
+ [
+ ...acc[1],
+ {
+ x: dataPoint._x, // Conditionally add x property only if it is in the original data object
+ y: dataPoint._y - acc[0] // Must be offset by previous value
+ }
+ ]
+ ];
+ },
+ [0, []]
+ );
return [
...computedData,
{
- y: prev ? (100 - prev) : 0
+ y: prev ? 100 - prev : 0
}
];
};
@@ -464,9 +469,9 @@ export const ChartDonutThreshold: React.FunctionComponent
- {container}
-
+ {container}
) : (
{chart}
diff --git a/packages/patternfly-4/react-charts/src/components/ChartDonutUtilization/ChartDonutUtilization.test.tsx b/packages/patternfly-4/react-charts/src/components/ChartDonutUtilization/ChartDonutUtilization.test.tsx
index 59536336d51..00e55e5822c 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartDonutUtilization/ChartDonutUtilization.test.tsx
+++ b/packages/patternfly-4/react-charts/src/components/ChartDonutUtilization/ChartDonutUtilization.test.tsx
@@ -2,7 +2,7 @@ import * as React from 'react';
import { shallow } from 'enzyme';
import { ChartDonutUtilization } from './ChartDonutUtilization';
-Object.values([true, false]).forEach((isRead) => {
+Object.values([true, false]).forEach(isRead => {
test('ChartDonutUtilization', () => {
const view = shallow();
expect(view).toMatchSnapshot();
@@ -10,12 +10,6 @@ Object.values([true, false]).forEach((isRead) => {
});
test('renders component data', () => {
- const view = shallow(
-
- );
+ const view = shallow();
expect(view).toMatchSnapshot();
});
diff --git a/packages/patternfly-4/react-charts/src/components/ChartDonutUtilization/ChartDonutUtilization.tsx b/packages/patternfly-4/react-charts/src/components/ChartDonutUtilization/ChartDonutUtilization.tsx
index ae013d63948..e08e2579217 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartDonutUtilization/ChartDonutUtilization.tsx
+++ b/packages/patternfly-4/react-charts/src/components/ChartDonutUtilization/ChartDonutUtilization.tsx
@@ -320,7 +320,7 @@ export interface ChartDonutUtilizationProps extends ChartDonutProps {
* Victory components will pass an origin prop is to define the center point in svg coordinates for polar charts.
* **This prop should not be set manually.**
*/
- origin?: { x: number, y: number };
+ origin?: { x: number; y: number };
/**
* The padAngle prop determines the amount of separation between adjacent data slices
* in number of degrees
@@ -481,7 +481,7 @@ export const ChartDonutUtilization: React.FunctionComponent {
const datum = getData();
- const computedData: [{ x?: any, y: any}] = [{ x: datum[0]._x, y: datum[0]._y || 0 }];
+ const computedData: [{ x?: any; y: any }] = [{ x: datum[0]._x, y: datum[0]._y || 0 }];
if (showStatic) {
computedData.push({ y: datum[0]._x ? Math.abs(100 - datum[0]._y) : 100 });
}
@@ -503,7 +503,8 @@ export const ChartDonutUtilization: React.FunctionComponent
- {container}
-
- ) : (
-
- {chart}
-
+ const container = React.cloneElement(
+ containerComponent,
+ {
+ desc: ariaDesc,
+ height,
+ title: ariaTitle,
+ width,
+ theme,
+ ...containerComponent.props
+ },
+ [chart]
);
+
+ return standalone ? {container} : {chart};
};
// Note: VictoryPie.role must be hoisted
diff --git a/packages/patternfly-4/react-charts/src/components/ChartGroup/ChartGroup.test.tsx b/packages/patternfly-4/react-charts/src/components/ChartGroup/ChartGroup.test.tsx
index 9041c15dcfe..2ead03e167b 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartGroup/ChartGroup.test.tsx
+++ b/packages/patternfly-4/react-charts/src/components/ChartGroup/ChartGroup.test.tsx
@@ -3,7 +3,7 @@ import { shallow } from 'enzyme';
import { ChartArea } from '../ChartArea';
import { ChartGroup } from './ChartGroup';
-Object.values([true, false]).forEach((isRead) => {
+Object.values([true, false]).forEach(isRead => {
test('ChartGroup', () => {
const view = shallow();
expect(view).toMatchSnapshot();
diff --git a/packages/patternfly-4/react-charts/src/components/ChartGroup/ChartGroup.tsx b/packages/patternfly-4/react-charts/src/components/ChartGroup/ChartGroup.tsx
index d7fc23edb50..adef2134eb5 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartGroup/ChartGroup.tsx
+++ b/packages/patternfly-4/react-charts/src/components/ChartGroup/ChartGroup.tsx
@@ -225,7 +225,7 @@ export interface ChartGroupProps extends VictoryGroupProps {
* maxDomain={0}
* maxDomain={{ y: 0 }}
*/
- maxDomain?: number | { x?: number, y?: number };
+ maxDomain?: number | { x?: number; y?: number };
/**
* The minDomain prop defines a minimum domain value for a chart. This prop is useful in situations where the minimum
* domain of a chart is static, while the maximum value depends on data or other variable information. If the domain
@@ -240,7 +240,7 @@ export interface ChartGroupProps extends VictoryGroupProps {
* minDomain={0}
* minDomain={{ y: 0 }}
*/
- minDomain?: number | { x?: number, y?: number };
+ minDomain?: number | { x?: number; y?: number };
/**
* The name prop is used to reference a component instance when defining shared events.
*/
@@ -256,7 +256,7 @@ export interface ChartGroupProps extends VictoryGroupProps {
* Victory components will pass an origin prop is to define the center point in svg coordinates for polar charts.
* **This prop should not be set manually.**
*/
- origin?: { x: number, y: number };
+ origin?: { x: number; y: number };
/**
* The padding props specifies the amount of padding in number of pixels between
* the edge of the chart and any rendered child components. This prop can be given
@@ -282,7 +282,7 @@ export interface ChartGroupProps extends VictoryGroupProps {
* Cartesian: range={{ x: [50, 250], y: [50, 250] }}
* Polar: range={{ x: [0, 360], y: [0, 250] }}
*/
- range?: [number, number] | { x?: [number, number], y?: [number, number] };
+ range?: [number, number] | { x?: [number, number]; y?: [number, number] };
/**
* The samples prop specifies how many individual points to plot when plotting
* y as a function of x. Samples is ignored if x props are provided instead.
@@ -294,10 +294,13 @@ export interface ChartGroupProps extends VictoryGroupProps {
* as a d3 scale function, or as an object with scales specified for x and y
* @example d3Scale.time(), {x: "linear", y: "log"}
*/
- scale?: ScalePropType | D3Scale | {
- x?: ScalePropType | D3Scale;
- y?: ScalePropType | D3Scale;
- };
+ scale?:
+ | ScalePropType
+ | D3Scale
+ | {
+ x?: ScalePropType | D3Scale;
+ y?: ScalePropType | D3Scale;
+ };
/**
* The sharedEvents prop is used internally to coordinate events between components. It should not be set manually.
*/
@@ -319,7 +322,7 @@ export interface ChartGroupProps extends VictoryGroupProps {
* singleQuadrantDomainPadding={false}
* singleQuadrantDomainPadding={{ x: false }}
*/
- singleQuadrantDomainPadding?: boolean | { x: boolean, y: boolean };
+ singleQuadrantDomainPadding?: boolean | { x: boolean; y: boolean };
/**
* Use the sortKey prop to indicate how data should be sorted. This prop
* is given directly to the lodash sortBy function to be executed on the
@@ -420,9 +423,13 @@ export const ChartGroup: React.FunctionComponent = ({
title: ariaTitle,
theme,
...containerComponent.props,
- className: getClassName({className: containerComponent.props.className}) // Override VictoryContainer class name
+ className: getClassName({ className: containerComponent.props.className }) // Override VictoryContainer class name
});
- return {children};
+ return (
+
+ {children}
+
+ );
};
// Note: VictoryGroup.role must be hoisted
diff --git a/packages/patternfly-4/react-charts/src/components/ChartLabel/ChartLabel.test.tsx b/packages/patternfly-4/react-charts/src/components/ChartLabel/ChartLabel.test.tsx
index 9972c4be9c2..e2ee380e557 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartLabel/ChartLabel.test.tsx
+++ b/packages/patternfly-4/react-charts/src/components/ChartLabel/ChartLabel.test.tsx
@@ -2,7 +2,7 @@ import * as React from 'react';
import { shallow } from 'enzyme';
import { ChartLabel } from './ChartLabel';
-Object.values([true, false]).forEach((isRead) => {
+Object.values([true, false]).forEach(isRead => {
test('ChartLabel', () => {
const view = shallow();
expect(view).toMatchSnapshot();
diff --git a/packages/patternfly-4/react-charts/src/components/ChartLabel/ChartLabel.tsx b/packages/patternfly-4/react-charts/src/components/ChartLabel/ChartLabel.tsx
index e2e1c40b37b..faf6c823d69 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartLabel/ChartLabel.tsx
+++ b/packages/patternfly-4/react-charts/src/components/ChartLabel/ChartLabel.tsx
@@ -1,11 +1,7 @@
import * as React from 'react';
import hoistNonReactStatics from 'hoist-non-react-statics';
import { defaults } from 'lodash';
-import {
- StringOrNumberOrCallback,
- VictoryLabel,
- VictoryLabelProps
-} from 'victory';
+import { StringOrNumberOrCallback, VictoryLabel, VictoryLabelProps } from 'victory';
import { ChartCommonStyles } from '../ChartTheme';
export enum ChartLabelDirection {
@@ -109,7 +105,7 @@ export interface ChartLabelProps extends VictoryLabelProps {
* Victory components will pass an origin prop is to define the center point in svg coordinates for polar charts.
* **This prop should not be set manually.**
*/
- origin?: { x: number, y: number };
+ origin?: { x: number; y: number };
/**
* Victory components can pass a boolean polar prop to specify whether a label is part of a polar chart.
* **This prop should not be set manually.**
@@ -124,7 +120,7 @@ export interface ChartLabelProps extends VictoryLabelProps {
* Victory components can pass a scale prop to their label component. This can be used to calculate the position of
* label elements from datum. This prop should not be set manually.
*/
- scale?: { x?: any, y?: any };
+ scale?: { x?: any; y?: any };
/**
* The style prop applies CSS properties to the rendered `` element.
*/
@@ -162,15 +158,13 @@ export interface ChartLabelProps extends VictoryLabelProps {
y?: number;
}
-export const ChartLabel: React.FunctionComponent = ({
- style,
- ...rest
-}: ChartLabelProps) => {
- const applyDefaultStyle = (customStyle: React.CSSProperties) => defaults(customStyle, {
- fontFamily: ChartCommonStyles.label.fontFamily,
- fontSize: ChartCommonStyles.label.fontSize,
- letterSpacing: ChartCommonStyles.label.letterSpacing
- });
+export const ChartLabel: React.FunctionComponent = ({ style, ...rest }: ChartLabelProps) => {
+ const applyDefaultStyle = (customStyle: React.CSSProperties) =>
+ defaults(customStyle, {
+ fontFamily: ChartCommonStyles.label.fontFamily,
+ fontSize: ChartCommonStyles.label.fontSize,
+ letterSpacing: ChartCommonStyles.label.letterSpacing
+ });
const newStyle = Array.isArray(style) ? style.map(applyDefaultStyle) : applyDefaultStyle(style);
return ;
};
diff --git a/packages/patternfly-4/react-charts/src/components/ChartLegend/ChartLegend.test.tsx b/packages/patternfly-4/react-charts/src/components/ChartLegend/ChartLegend.test.tsx
index 9d4f6660e4b..808284cb00b 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartLegend/ChartLegend.test.tsx
+++ b/packages/patternfly-4/react-charts/src/components/ChartLegend/ChartLegend.test.tsx
@@ -2,7 +2,7 @@ import * as React from 'react';
import { shallow } from 'enzyme';
import { ChartLegend } from './ChartLegend';
-Object.values([true, false]).forEach((isRead) => {
+Object.values([true, false]).forEach(isRead => {
test('ChartLegend', () => {
const view = shallow();
expect(view).toMatchSnapshot();
diff --git a/packages/patternfly-4/react-charts/src/components/ChartLegend/ChartLegend.tsx b/packages/patternfly-4/react-charts/src/components/ChartLegend/ChartLegend.tsx
index 15ded51d46a..155a323e66d 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartLegend/ChartLegend.tsx
+++ b/packages/patternfly-4/react-charts/src/components/ChartLegend/ChartLegend.tsx
@@ -10,7 +10,7 @@ import {
StringOrNumberOrCallback,
VictoryLegend,
VictoryLegendProps,
- VictoryStyleInterface,
+ VictoryStyleInterface
} from 'victory';
import { ChartContainer } from '../ChartContainer';
import { ChartPoint } from '../ChartPoint';
@@ -137,7 +137,7 @@ export interface ChartLegendProps extends VictoryLegendProps {
* gutters are between columns. When orientation is vertical, gutters
* are the space between rows.
*/
- gutter?: number | {left: number, right: number};
+ gutter?: number | { left: number; right: number };
/**
* Specifies the height the svg viewBox of the chart container. This value should be given as a
* number of pixels.
@@ -304,4 +304,4 @@ export const ChartLegend: React.FunctionComponent = ({
};
// Note: VictoryLegend.role must be hoisted, but getBaseProps causes error with ChartVoronoiContainer
-hoistNonReactStatics(ChartLegend, VictoryLegend, { getBaseProps: true});
+hoistNonReactStatics(ChartLegend, VictoryLegend, { getBaseProps: true });
diff --git a/packages/patternfly-4/react-charts/src/components/ChartLegend/ChartLegendWrapper.tsx b/packages/patternfly-4/react-charts/src/components/ChartLegend/ChartLegendWrapper.tsx
index 2fbd6ef1fe8..a5c147dbd56 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartLegend/ChartLegendWrapper.tsx
+++ b/packages/patternfly-4/react-charts/src/components/ChartLegend/ChartLegendWrapper.tsx
@@ -147,7 +147,7 @@ export const ChartLegendWrapper: React.FunctionComponent
- {legend}
-
- );
+ return {legend};
};
diff --git a/packages/patternfly-4/react-charts/src/components/ChartLine/ChartLine.test.tsx b/packages/patternfly-4/react-charts/src/components/ChartLine/ChartLine.test.tsx
index d1f9ec35543..fd042c7655a 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartLine/ChartLine.test.tsx
+++ b/packages/patternfly-4/react-charts/src/components/ChartLine/ChartLine.test.tsx
@@ -4,7 +4,7 @@ import { Chart } from '../Chart';
import { ChartGroup } from '../ChartGroup';
import { ChartLine } from './ChartLine';
-Object.values([true, false]).forEach((isRead) => {
+Object.values([true, false]).forEach(isRead => {
test('ChartLine', () => {
const view = shallow();
expect(view).toMatchSnapshot();
diff --git a/packages/patternfly-4/react-charts/src/components/ChartLine/ChartLine.tsx b/packages/patternfly-4/react-charts/src/components/ChartLine/ChartLine.tsx
index 5a035fd241b..8fe61608dca 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartLine/ChartLine.tsx
+++ b/packages/patternfly-4/react-charts/src/components/ChartLine/ChartLine.tsx
@@ -14,7 +14,7 @@ import {
StringOrNumberOrCallback,
VictoryStyleInterface,
VictoryLine,
- VictoryLineProps,
+ VictoryLineProps
} from 'victory';
import { ChartContainer } from '../ChartContainer';
import { ChartThemeDefinition } from '../ChartTheme';
@@ -198,7 +198,7 @@ export interface ChartLineProps extends VictoryLineProps {
* maxDomain={0}
* maxDomain={{ y: 0 }}
*/
- maxDomain?: number | { x?: number, y?: number };
+ maxDomain?: number | { x?: number; y?: number };
/**
* The minDomain prop defines a minimum domain value for a chart. This prop is useful in situations where the minimum
* domain of a chart is static, while the maximum value depends on data or other variable information. If the domain
@@ -213,7 +213,7 @@ export interface ChartLineProps extends VictoryLineProps {
* minDomain={0}
* minDomain={{ y: 0 }}
*/
- minDomain?: number | { x?: number, y?: number };
+ minDomain?: number | { x?: number; y?: number };
/**
* The name prop is used to reference a component instance when defining shared events.
*/
@@ -222,7 +222,7 @@ export interface ChartLineProps extends VictoryLineProps {
* Victory components will pass an origin prop is to define the center point in svg coordinates for polar charts.
* **This prop should not be set manually.**
*/
- origin?: { x: number, y: number };
+ origin?: { x: number; y: number };
/**
* The padding props specifies the amount of padding in number of pixels between
* the edge of the chart and any rendered child components. This prop can be given
@@ -248,7 +248,7 @@ export interface ChartLineProps extends VictoryLineProps {
* Cartesian: range={{ x: [50, 250], y: [50, 250] }}
* Polar: range={{ x: [0, 360], y: [0, 250] }}
*/
- range?: [number, number] | { x?: [number, number], y?: [number, number] };
+ range?: [number, number] | { x?: [number, number]; y?: [number, number] };
/**
* The samples prop specifies how many individual points to plot when plotting
* y as a function of x. Samples is ignored if x props are provided instead.
@@ -260,10 +260,13 @@ export interface ChartLineProps extends VictoryLineProps {
* as a d3 scale function, or as an object with scales specified for x and y
* @example d3Scale.time(), {x: "linear", y: "log"}
*/
- scale?: ScalePropType | D3Scale | {
- x?: ScalePropType | D3Scale;
- y?: ScalePropType | D3Scale;
- };
+ scale?:
+ | ScalePropType
+ | D3Scale
+ | {
+ x?: ScalePropType | D3Scale;
+ y?: ScalePropType | D3Scale;
+ };
/**
* The sharedEvents prop is used internally to coordinate events between components. It should not be set manually.
*/
@@ -285,7 +288,7 @@ export interface ChartLineProps extends VictoryLineProps {
* singleQuadrantDomainPadding={false}
* singleQuadrantDomainPadding={{ x: false }}
*/
- singleQuadrantDomainPadding?: boolean | { x: boolean, y: boolean };
+ singleQuadrantDomainPadding?: boolean | { x: boolean; y: boolean };
/**
* Use the sortKey prop to indicate how data should be sorted. This prop
* is given directly to the lodash sortBy function to be executed on the
@@ -385,7 +388,7 @@ export const ChartLine: React.FunctionComponent = ({
...containerComponent.props
});
return ;
-}
+};
// Note: VictoryLine.role must be hoisted
hoistNonReactStatics(ChartLine, VictoryLine);
diff --git a/packages/patternfly-4/react-charts/src/components/ChartPie/ChartPie.test.tsx b/packages/patternfly-4/react-charts/src/components/ChartPie/ChartPie.test.tsx
index 3bc3ff60c17..75adc55423e 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartPie/ChartPie.test.tsx
+++ b/packages/patternfly-4/react-charts/src/components/ChartPie/ChartPie.test.tsx
@@ -2,7 +2,7 @@ import * as React from 'react';
import { shallow } from 'enzyme';
import { ChartPie } from './ChartPie';
-Object.values([true, false]).forEach((isRead) => {
+Object.values([true, false]).forEach(isRead => {
test('ChartPie', () => {
const view = shallow();
expect(view).toMatchSnapshot();
diff --git a/packages/patternfly-4/react-charts/src/components/ChartPie/ChartPie.tsx b/packages/patternfly-4/react-charts/src/components/ChartPie/ChartPie.tsx
index c2cf316ca38..0a415309828 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartPie/ChartPie.tsx
+++ b/packages/patternfly-4/react-charts/src/components/ChartPie/ChartPie.tsx
@@ -290,7 +290,7 @@ export interface ChartPieProps extends VictoryPieProps {
* Victory components will pass an origin prop is to define the center point in svg coordinates for polar charts.
* **This prop should not be set manually.**
*/
- origin?: { x: number, y: number };
+ origin?: { x: number; y: number };
/**
* The padAngle prop determines the amount of separation between adjacent data slices
* in number of degrees
@@ -396,7 +396,7 @@ export interface ChartPieProps extends VictoryPieProps {
y?: DataGetterPropType;
}
-let someId = 0;
+const someId = 0;
export const ChartPie: React.FunctionComponent = ({
allowTooltip = true,
@@ -416,23 +416,29 @@ export const ChartPie: React.FunctionComponent = ({
// destructure last
theme = getTheme(themeColor, themeVariant),
- labelComponent = allowTooltip ? : undefined,
+ labelComponent = allowTooltip ? (
+
+ ) : (
+ undefined
+ ),
legendOrientation = theme.legend.orientation as ChartLegendOrientation,
height = theme.pie.height,
width = theme.pie.width,
...rest
}: ChartPieProps) => {
const defaultPadding = {
- bottom: getPaddingForSide('bottom', padding, theme.pie.padding),
+ bottom: getPaddingForSide('bottom', padding, theme.pie.padding),
left: getPaddingForSide('left', padding, theme.pie.padding),
right: getPaddingForSide('right', padding, theme.pie.padding),
- top: getPaddingForSide('top', padding, theme.pie.padding),
+ top: getPaddingForSide('top', padding, theme.pie.padding)
};
- const chartRadius = radius ? radius : Helpers.getRadius({
- height,
- width,
- padding: defaultPadding
- });
+ const chartRadius = radius
+ ? radius
+ : Helpers.getRadius({
+ height,
+ width,
+ padding: defaultPadding
+ });
const chart = (
= ({
};
// Clone so users can override container props
- const container = React.cloneElement(containerComponent, {
- desc: ariaDesc,
- height,
- title: ariaTitle,
- width,
- theme,
- ...containerComponent.props
- }, [chart, getWrappedLegend()]);
+ const container = React.cloneElement(
+ containerComponent,
+ {
+ desc: ariaDesc,
+ height,
+ title: ariaTitle,
+ width,
+ theme,
+ ...containerComponent.props
+ },
+ [chart, getWrappedLegend()]
+ );
return standalone ? (
-
- {container}
-
+ {container}
) : (
{chart}
diff --git a/packages/patternfly-4/react-charts/src/components/ChartPoint/ChartPoint.test.tsx b/packages/patternfly-4/react-charts/src/components/ChartPoint/ChartPoint.test.tsx
index cbb16660766..b12bbdd21c0 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartPoint/ChartPoint.test.tsx
+++ b/packages/patternfly-4/react-charts/src/components/ChartPoint/ChartPoint.test.tsx
@@ -3,7 +3,7 @@ import { shallow } from 'enzyme';
import { ChartLegend } from '../ChartLegend';
import { ChartPoint } from './ChartPoint';
-Object.values([true, false]).forEach((isRead) => {
+Object.values([true, false]).forEach(isRead => {
test('ChartPoint', () => {
const view = shallow(} />);
expect(view).toMatchSnapshot();
diff --git a/packages/patternfly-4/react-charts/src/components/ChartPoint/ChartPoint.tsx b/packages/patternfly-4/react-charts/src/components/ChartPoint/ChartPoint.tsx
index 1f6428a1999..607a8a80246 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartPoint/ChartPoint.tsx
+++ b/packages/patternfly-4/react-charts/src/components/ChartPoint/ChartPoint.tsx
@@ -42,7 +42,7 @@ export interface ChartPointProps {
/**
* The svg coordinates of the center point of a polar chart
*/
- origin?: { x?: number, y?: number };
+ origin?: { x?: number; y?: number };
/**
* The rendered path element
*/
@@ -75,8 +75,18 @@ export interface ChartPointProps {
* The 'circle', 'diamond', 'plus', 'minus', 'square', 'star', 'triangleDown', 'triangleUp', or 'dash' which symbol
* the point should render
*/
- symbol?: 'circle' | 'diamond' | 'plus' | 'minus' | 'square' | 'star' | 'triangleDown' | 'triangleUp' | 'dash' |
- 'threshold' | Function;
+ symbol?:
+ | 'circle'
+ | 'diamond'
+ | 'plus'
+ | 'minus'
+ | 'square'
+ | 'star'
+ | 'triangleDown'
+ | 'triangleUp'
+ | 'dash'
+ | 'threshold'
+ | Function;
/**
* A transform that will be supplied to elements this component renders
*/
@@ -129,7 +139,7 @@ export const ChartPoint: React.FunctionComponent = ({
return React.cloneElement(pathComponent, {
className,
clipPath,
- d: getPath({datum, active, ...rest}),
+ d: getPath({ datum, active, ...rest }),
events,
role,
shapeRendering,
diff --git a/packages/patternfly-4/react-charts/src/components/ChartPoint/path-helpers.ts b/packages/patternfly-4/react-charts/src/components/ChartPoint/path-helpers.ts
index 4f17fc381db..e6b3175c2b6 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartPoint/path-helpers.ts
+++ b/packages/patternfly-4/react-charts/src/components/ChartPoint/path-helpers.ts
@@ -89,7 +89,7 @@ export const PathHelpers = {
const baseSize = 1.35 * size;
const angle = Math.PI / 5;
const range = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
- const starCoords = range.map((index) => {
+ const starCoords = range.map(index => {
const length = index % 2 === 0 ? baseSize : baseSize / 2;
return `${length * Math.sin(angle * (index + 1)) + x},
${length * Math.cos(angle * (index + 1)) + y}`;
diff --git a/packages/patternfly-4/react-charts/src/components/ChartScatter/ChartScatter.test.tsx b/packages/patternfly-4/react-charts/src/components/ChartScatter/ChartScatter.test.tsx
index c6175d6e2f3..6436a9d29f6 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartScatter/ChartScatter.test.tsx
+++ b/packages/patternfly-4/react-charts/src/components/ChartScatter/ChartScatter.test.tsx
@@ -4,7 +4,7 @@ import { Chart } from '../Chart/Chart';
import { ChartGroup } from '../ChartGroup/ChartGroup';
import { ChartScatter } from './ChartScatter';
-Object.values([true, false]).forEach((isRead) => {
+Object.values([true, false]).forEach(isRead => {
test('ChartScatter', () => {
const view = shallow();
expect(view).toMatchSnapshot();
diff --git a/packages/patternfly-4/react-charts/src/components/ChartScatter/ChartScatter.tsx b/packages/patternfly-4/react-charts/src/components/ChartScatter/ChartScatter.tsx
index b10e82429e5..726f513a3e4 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartScatter/ChartScatter.tsx
+++ b/packages/patternfly-4/react-charts/src/components/ChartScatter/ChartScatter.tsx
@@ -203,7 +203,7 @@ export interface ChartScatterProps extends VictoryScatterProps {
* maxDomain={0}
* maxDomain={{ y: 0 }}
*/
- maxDomain?: number | { x?: number, y?: number };
+ maxDomain?: number | { x?: number; y?: number };
/**
* The minBubbleSize prop sets a lower limit for scaling data points in a bubble chart
*/
@@ -222,7 +222,7 @@ export interface ChartScatterProps extends VictoryScatterProps {
* minDomain={0}
* minDomain={{ y: 0 }}
*/
- minDomain?: number | { x?: number, y?: number };
+ minDomain?: number | { x?: number; y?: number };
/**
* The name prop is used to reference a component instance when defining shared events.
*/
@@ -231,7 +231,7 @@ export interface ChartScatterProps extends VictoryScatterProps {
* Victory components will pass an origin prop is to define the center point in svg coordinates for polar charts.
* **This prop should not be set manually.**
*/
- origin?: { x: number, y: number };
+ origin?: { x: number; y: number };
/**
* The padding props specifies the amount of padding in number of pixels between
* the edge of the chart and any rendered child components. This prop can be given
@@ -257,7 +257,7 @@ export interface ChartScatterProps extends VictoryScatterProps {
* Cartesian: range={{ x: [50, 250], y: [50, 250] }}
* Polar: range={{ x: [0, 360], y: [0, 250] }}
*/
- range?: [number, number] | { x?: [number, number], y?: [number, number] };
+ range?: [number, number] | { x?: [number, number]; y?: [number, number] };
/**
* The samples prop specifies how many individual points to plot when plotting
* y as a function of x. Samples is ignored if x props are provided instead.
@@ -269,10 +269,13 @@ export interface ChartScatterProps extends VictoryScatterProps {
* as a d3 scale function, or as an object with scales specified for x and y
* @example d3Scale.time(), {x: "linear", y: "log"}
*/
- scale?: ScalePropType | D3Scale | {
- x?: ScalePropType | D3Scale;
- y?: ScalePropType | D3Scale;
- };
+ scale?:
+ | ScalePropType
+ | D3Scale
+ | {
+ x?: ScalePropType | D3Scale;
+ y?: ScalePropType | D3Scale;
+ };
/**
* The sharedEvents prop is used internally to coordinate events between components. It should not be set manually.
*/
@@ -294,7 +297,7 @@ export interface ChartScatterProps extends VictoryScatterProps {
* singleQuadrantDomainPadding={false}
* singleQuadrantDomainPadding={{ x: false }}
*/
- singleQuadrantDomainPadding?: boolean | { x: boolean, y: boolean };
+ singleQuadrantDomainPadding?: boolean | { x: boolean; y: boolean };
/**
* The size prop determines how to scale each data point
*/
@@ -402,7 +405,7 @@ export const ChartScatter: React.FunctionComponent = ({
...containerComponent.props
});
return ;
-}
+};
// Note: VictoryLine.role must be hoisted
hoistNonReactStatics(ChartScatter, VictoryScatter);
diff --git a/packages/patternfly-4/react-charts/src/components/ChartStack/ChartStack.test.tsx b/packages/patternfly-4/react-charts/src/components/ChartStack/ChartStack.test.tsx
index 96ebbf158ac..6525217cd60 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartStack/ChartStack.test.tsx
+++ b/packages/patternfly-4/react-charts/src/components/ChartStack/ChartStack.test.tsx
@@ -4,7 +4,7 @@ import { Chart } from '../Chart';
import { ChartBar } from '../ChartBar';
import { ChartStack } from './ChartStack';
-Object.values([true, false]).forEach((isRead) => {
+Object.values([true, false]).forEach(isRead => {
test('ChartStack', () => {
const view = shallow();
expect(view).toMatchSnapshot();
diff --git a/packages/patternfly-4/react-charts/src/components/ChartStack/ChartStack.tsx b/packages/patternfly-4/react-charts/src/components/ChartStack/ChartStack.tsx
index d7c80475f39..955abd3532d 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartStack/ChartStack.tsx
+++ b/packages/patternfly-4/react-charts/src/components/ChartStack/ChartStack.tsx
@@ -204,7 +204,7 @@ export interface ChartStackProps extends VictoryStackProps {
* maxDomain={0}
* maxDomain={{ y: 0 }}
*/
- maxDomain?: number | { x?: number, y?: number };
+ maxDomain?: number | { x?: number; y?: number };
/**
* The minDomain prop defines a minimum domain value for a chart. This prop is useful in situations where the minimum
* domain of a chart is static, while the maximum value depends on data or other variable information. If the domain
@@ -219,7 +219,7 @@ export interface ChartStackProps extends VictoryStackProps {
* minDomain={0}
* minDomain={{ y: 0 }}
*/
- minDomain?: number | { x?: number, y?: number };
+ minDomain?: number | { x?: number; y?: number };
/**
* The name prop is used to reference a component instance when defining shared events.
*/
@@ -228,7 +228,7 @@ export interface ChartStackProps extends VictoryStackProps {
* Victory components will pass an origin prop is to define the center point in svg coordinates for polar charts.
* **This prop should not be set manually.**
*/
- origin?: { x: number, y: number };
+ origin?: { x: number; y: number };
/**
* The padding props specifies the amount of padding in number of pixels between
* the edge of the chart and any rendered child components. This prop can be given
@@ -254,17 +254,20 @@ export interface ChartStackProps extends VictoryStackProps {
* Cartesian: range={{ x: [50, 250], y: [50, 250] }}
* Polar: range={{ x: [0, 360], y: [0, 250] }}
*/
- range?: [number, number] | { x?: [number, number], y?: [number, number] };
+ range?: [number, number] | { x?: [number, number]; y?: [number, number] };
/**
* The scale prop determines which scales your chart should use. This prop can be
* given as a string specifying a supported scale ("linear", "time", "log", "sqrt"),
* as a d3 scale function, or as an object with scales specified for x and y
* @example d3Scale.time(), {x: "linear", y: "log"}
*/
- scale?: ScalePropType | D3Scale | {
- x?: ScalePropType | D3Scale;
- y?: ScalePropType | D3Scale;
- };
+ scale?:
+ | ScalePropType
+ | D3Scale
+ | {
+ x?: ScalePropType | D3Scale;
+ y?: ScalePropType | D3Scale;
+ };
/**
* The sharedEvents prop is used internally to coordinate events between components. It should not be set manually.
*/
@@ -286,7 +289,7 @@ export interface ChartStackProps extends VictoryStackProps {
* singleQuadrantDomainPadding={false}
* singleQuadrantDomainPadding={{ x: false }}
*/
- singleQuadrantDomainPadding?: boolean | { x: boolean, y: boolean };
+ singleQuadrantDomainPadding?: boolean | { x: boolean; y: boolean };
/**
* The standalone prop determines whether the component will render a standalone svg
* or a tag that will be included in an external svg. Set standalone to false to
@@ -352,10 +355,14 @@ export const ChartStack: React.FunctionComponent = ({
title: ariaTitle,
theme,
...containerComponent.props,
- className: getClassName({className: containerComponent.props.className}) // Override VictoryContainer class name
+ className: getClassName({ className: containerComponent.props.className }) // Override VictoryContainer class name
});
- return {children};
-}
+ return (
+
+ {children}
+
+ );
+};
// Note: VictoryStack.getChildren & VictoryStack.role must be hoisted
hoistNonReactStatics(ChartStack, VictoryStack);
diff --git a/packages/patternfly-4/react-charts/src/components/ChartTheme/ChartTheme.ts b/packages/patternfly-4/react-charts/src/components/ChartTheme/ChartTheme.ts
index 9e3e34dc075..0b96d5de731 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartTheme/ChartTheme.ts
+++ b/packages/patternfly-4/react-charts/src/components/ChartTheme/ChartTheme.ts
@@ -14,14 +14,8 @@ import {
} from './themes/bullet-theme';
import { DonutTheme } from './themes/donut-theme';
import { ThresholdTheme } from './themes/threshold-theme';
-import {
- DonutThresholdDynamicTheme,
- DonutThresholdStaticTheme
-} from './themes/donut-threshold-theme';
-import {
- DonutUtilizationDynamicTheme,
- DonutUtilizationStaticTheme
-} from './themes/donut-utilization-theme';
+import { DonutThresholdDynamicTheme, DonutThresholdStaticTheme } from './themes/donut-threshold-theme';
+import { DonutUtilizationDynamicTheme, DonutUtilizationStaticTheme } from './themes/donut-utilization-theme';
export interface ChartThemeDefinitionInterface extends VictoryThemeDefinition {
area?: any;
diff --git a/packages/patternfly-4/react-charts/src/components/ChartTheme/styles/common-styles.ts b/packages/patternfly-4/react-charts/src/components/ChartTheme/styles/common-styles.ts
index c8b1a925ef6..e65bf3f4260 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartTheme/styles/common-styles.ts
+++ b/packages/patternfly-4/react-charts/src/components/ChartTheme/styles/common-styles.ts
@@ -17,10 +17,10 @@ export const CommonStyles = {
fontFamily: TYPOGRAPHY_FONT_FAMILY,
fontSize: TYPOGRAPHY_FONT_SIZE,
letterSpacing: TYPOGRAPHY_LETTER_SPACING,
- margin: chart_global_label_Margin.value,
+ margin: chart_global_label_Margin.value
},
legend: {
margin: chart_legend_Margin.value,
position: chart_legend_position.value
- },
+ }
};
diff --git a/packages/patternfly-4/react-charts/src/components/ChartTheme/styles/donut-utilization-styles.ts b/packages/patternfly-4/react-charts/src/components/ChartTheme/styles/donut-utilization-styles.ts
index b2d23728b3f..672997d07c1 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartTheme/styles/donut-utilization-styles.ts
+++ b/packages/patternfly-4/react-charts/src/components/ChartTheme/styles/donut-utilization-styles.ts
@@ -1,15 +1,9 @@
/* eslint-disable camelcase */
-import {
- chart_donut_threshold_warning_Color,
- chart_donut_threshold_danger_Color,
-} from '@patternfly/react-tokens';
+import { chart_donut_threshold_warning_Color, chart_donut_threshold_danger_Color } from '@patternfly/react-tokens';
// Donut utilization styles
export const DonutUtilizationStyles = {
thresholds: {
- colorScale: [
- chart_donut_threshold_warning_Color.value,
- chart_donut_threshold_danger_Color.value
- ]
+ colorScale: [chart_donut_threshold_warning_Color.value, chart_donut_threshold_danger_Color.value]
}
};
diff --git a/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/axis-theme.ts b/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/axis-theme.ts
index 090899e63b7..48787097eb3 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/axis-theme.ts
+++ b/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/axis-theme.ts
@@ -1,8 +1,5 @@
/* eslint-disable camelcase */
-import {
- chart_axis_grid_stroke_Color,
- chart_axis_tick_stroke_Color
-} from '@patternfly/react-tokens';
+import { chart_axis_grid_stroke_Color, chart_axis_tick_stroke_Color } from '@patternfly/react-tokens';
// Axis theme
export const AxisTheme = {
@@ -15,5 +12,5 @@ export const AxisTheme = {
stroke: chart_axis_tick_stroke_Color.value
}
}
- },
+ }
};
diff --git a/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/base-theme.ts b/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/base-theme.ts
index c1f7c79c04e..5c8c383b678 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/base-theme.ts
+++ b/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/base-theme.ts
@@ -96,7 +96,7 @@ import {
chart_voronoi_flyout_stroke_Width,
chart_voronoi_flyout_PointerEvents,
chart_voronoi_flyout_stroke_Color,
- chart_voronoi_flyout_stroke_Fill,
+ chart_voronoi_flyout_stroke_Fill
} from '@patternfly/react-tokens';
// Note: Values must be in pixles
@@ -361,7 +361,7 @@ export const BaseTheme = {
fill: chart_voronoi_flyout_stroke_Fill.value, // background
pointerEvents: chart_voronoi_flyout_PointerEvents.value,
stroke: chart_voronoi_flyout_stroke_Color.value, // border
- strokeWidth: chart_voronoi_flyout_stroke_Width.value,
+ strokeWidth: chart_voronoi_flyout_stroke_Width.value
}
}
}
diff --git a/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/color-theme.ts b/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/color-theme.ts
index 730b33a3759..00ff87b38de 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/color-theme.ts
+++ b/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/color-theme.ts
@@ -4,9 +4,7 @@ interface ColorThemeInterface {
// Victory theme properties only
export const ColorTheme = (props: ColorThemeInterface) => {
- const {
- COLOR_SCALE
- } = props;
+ const { COLOR_SCALE } = props;
return {
area: {
diff --git a/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/dark/cyan-color-theme.ts b/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/dark/cyan-color-theme.ts
index 039a89eb594..0e1d514c86c 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/dark/cyan-color-theme.ts
+++ b/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/dark/cyan-color-theme.ts
@@ -20,4 +20,4 @@ const COLOR_SCALE = [
export const DarkCyanColorTheme = ColorTheme({
COLOR_SCALE
-}) ;
+});
diff --git a/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/dark/gold-color-theme.ts b/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/dark/gold-color-theme.ts
index 1b67e5c8273..a273d911ad7 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/dark/gold-color-theme.ts
+++ b/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/dark/gold-color-theme.ts
@@ -15,10 +15,9 @@ const COLOR_SCALE = [
chart_color_gold_100.value,
chart_color_gold_500.value,
chart_color_gold_200.value,
- chart_color_gold_400.value,
-
+ chart_color_gold_400.value
];
export const DarkGoldColorTheme = ColorTheme({
COLOR_SCALE
-}) ;
+});
diff --git a/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/dark/orange-color-theme.ts b/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/dark/orange-color-theme.ts
index 52df58f9472..9cd224804ac 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/dark/orange-color-theme.ts
+++ b/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/dark/orange-color-theme.ts
@@ -15,8 +15,7 @@ const COLOR_SCALE = [
chart_color_orange_100.value,
chart_color_orange_500.value,
chart_color_orange_200.value,
- chart_color_orange_400.value,
-
+ chart_color_orange_400.value
];
export const DarkOrangeColorTheme = ColorTheme({
diff --git a/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/donut-threshold-theme.ts b/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/donut-threshold-theme.ts
index 88c4a659f23..9cfbd8e5d30 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/donut-threshold-theme.ts
+++ b/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/donut-threshold-theme.ts
@@ -15,10 +15,7 @@ import {
// Donut threshold dynamic theme
export const DonutThresholdDynamicTheme = {
legend: {
- colorScale: [
- chart_donut_threshold_second_Color.value,
- chart_donut_threshold_third_Color.value
- ]
+ colorScale: [chart_donut_threshold_second_Color.value, chart_donut_threshold_third_Color.value]
},
pie: {
height: chart_donut_threshold_dynamic_pie_Height.value,
diff --git a/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/donut-utilization-theme.ts b/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/donut-utilization-theme.ts
index 31c8cad58e1..a422f71f1f4 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/donut-utilization-theme.ts
+++ b/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/donut-utilization-theme.ts
@@ -7,7 +7,7 @@ import {
chart_donut_utilization_dynamic_pie_angle_Padding,
chart_donut_utilization_dynamic_pie_Padding,
chart_donut_utilization_dynamic_pie_Width,
- chart_donut_utilization_static_pie_Padding,
+ chart_donut_utilization_static_pie_Padding
} from '@patternfly/react-tokens';
// Donut utilization dynamic theme
@@ -27,12 +27,10 @@ export const DonutUtilizationStaticTheme = {
chart_donut_threshold_first_Color.value,
chart_donut_threshold_second_Color.value,
chart_donut_threshold_third_Color.value
- ],
+ ]
},
pie: {
- colorScale: [
- chart_donut_threshold_first_Color.value
- ],
+ colorScale: [chart_donut_threshold_first_Color.value],
padding: chart_donut_utilization_static_pie_Padding.value
}
};
diff --git a/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/light/gold-color-theme.ts b/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/light/gold-color-theme.ts
index 40ce58cbad0..da90e67def5 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/light/gold-color-theme.ts
+++ b/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/light/gold-color-theme.ts
@@ -15,8 +15,7 @@ const COLOR_SCALE = [
chart_color_gold_100.value,
chart_color_gold_500.value,
chart_color_gold_200.value,
- chart_color_gold_400.value,
-
+ chart_color_gold_400.value
];
export const LightGoldColorTheme = ColorTheme({
diff --git a/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/light/orange-color-theme.ts b/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/light/orange-color-theme.ts
index 55d0ea6508e..1b15441aaf6 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/light/orange-color-theme.ts
+++ b/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/light/orange-color-theme.ts
@@ -15,8 +15,7 @@ const COLOR_SCALE = [
chart_color_orange_100.value,
chart_color_orange_500.value,
chart_color_orange_200.value,
- chart_color_orange_400.value,
-
+ chart_color_orange_400.value
];
export const LightOrangeColorTheme = ColorTheme({
diff --git a/packages/patternfly-4/react-charts/src/components/ChartThreshold/ChartThreshold.test.tsx b/packages/patternfly-4/react-charts/src/components/ChartThreshold/ChartThreshold.test.tsx
index ad7dcac0e25..10bd51e2358 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartThreshold/ChartThreshold.test.tsx
+++ b/packages/patternfly-4/react-charts/src/components/ChartThreshold/ChartThreshold.test.tsx
@@ -5,7 +5,7 @@ import { ChartGroup } from '../ChartGroup';
import { ChartThreshold } from './ChartThreshold';
import { ChartThemeColor, ChartThemeVariant } from '../ChartTheme';
-Object.values([true, false]).forEach((isRead) => {
+Object.values([true, false]).forEach(isRead => {
test('ChartThreshold', () => {
const view = shallow();
expect(view).toMatchSnapshot();
@@ -17,16 +17,12 @@ test('renders component data', () => {
{ name: 'Birds Threshold', x: 0, y: 2 },
{ name: 'Birds Threshold', x: 2, y: 2 },
{ name: 'Birds Threshold', x: 2, y: 3 },
- { name: 'Birds Threshold', x: 5, y: 3 },
+ { name: 'Birds Threshold', x: 5, y: 3 }
];
const view = shallow(
-
+
);
diff --git a/packages/patternfly-4/react-charts/src/components/ChartThreshold/ChartThreshold.tsx b/packages/patternfly-4/react-charts/src/components/ChartThreshold/ChartThreshold.tsx
index 4c0810646b4..ac15e01ff5a 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartThreshold/ChartThreshold.tsx
+++ b/packages/patternfly-4/react-charts/src/components/ChartThreshold/ChartThreshold.tsx
@@ -11,9 +11,7 @@ export const ChartThreshold: React.FunctionComponent = ({
...rest
}: ChartLineProps) => {
const theme = getThresholdTheme(themeColor, themeVariant);
- return (
-
- );
+ return ;
};
// Note: VictoryPie.role must be hoisted
diff --git a/packages/patternfly-4/react-charts/src/components/ChartTooltip/ChartTooltip.test.tsx b/packages/patternfly-4/react-charts/src/components/ChartTooltip/ChartTooltip.test.tsx
index 95b74833919..8fc8b5e48b7 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartTooltip/ChartTooltip.test.tsx
+++ b/packages/patternfly-4/react-charts/src/components/ChartTooltip/ChartTooltip.test.tsx
@@ -5,7 +5,7 @@ import { ChartGroup } from '../ChartGroup';
import { ChartVoronoiContainer } from '../ChartVoronoiContainer';
import { ChartTooltip } from './ChartTooltip';
-Object.values([true, false]).forEach((isRead) => {
+Object.values([true, false]).forEach(isRead => {
test('ChartTooltip', () => {
const view = shallow();
expect(view).toMatchSnapshot();
@@ -15,7 +15,7 @@ Object.values([true, false]).forEach((isRead) => {
test('allows tooltip via container component', () => {
const view = shallow(
'y: ' + point.y} />}
+ containerComponent={ 'y: ' + point.y} />}
height={200}
width={200}
>
diff --git a/packages/patternfly-4/react-charts/src/components/ChartTooltip/ChartTooltip.tsx b/packages/patternfly-4/react-charts/src/components/ChartTooltip/ChartTooltip.tsx
index 72a7eaadbf1..511daed0350 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartTooltip/ChartTooltip.tsx
+++ b/packages/patternfly-4/react-charts/src/components/ChartTooltip/ChartTooltip.tsx
@@ -6,7 +6,7 @@ import {
StringOrNumberOrCallback,
VictoryStyleObject,
VictoryTooltip,
- VictoryTooltipProps,
+ VictoryTooltipProps
} from 'victory';
import { ChartThemeDefinition } from '../ChartTheme';
import { getTheme } from '../ChartUtils';
@@ -34,14 +34,14 @@ export interface ChartTooltipProps extends VictoryTooltipProps {
* ChartVoronoiContainer, the center prop is what enables the mouseFollowTooltips option. When this prop is set,
* non-zero pointerLength values will no longer be respected.
*/
- center?: { x: number, y: number };
+ center?: { x: number; y: number };
/**
* The centerOffset prop determines the position of the center of the tooltip flyout in relation to the flyout
* pointer. This prop should be given as an object of x and y, where each is either a numeric offset value or a
* function that returns a numeric value. When this prop is set, non-zero pointerLength values will no longer be
* respected.
*/
- centerOffset?: { x: number | Function, y: number | Function };
+ centerOffset?: { x: number | Function; y: number | Function };
/**
* The constrainToVisibleArea prop determines whether to coerce tooltips so that they fit within the visible area of
* the chart. When this prop is set to true, tooltip pointers will still point to the correct data point, but the
@@ -104,7 +104,7 @@ export interface ChartTooltipProps extends VictoryTooltipProps {
* function of datum. If this prop is not set, flyoutWidth will be determined based on an approximate text size
* calculated from the text and style props provided to VictoryTooltip.
*/
- flyoutWidth?: NumberOrCallback,
+ flyoutWidth?: NumberOrCallback;
/**
* The groupComponent prop takes a component instance which will be used to create group elements for use within
* container elements. This prop defaults to a tag.}
@@ -211,7 +211,7 @@ export const ChartTooltip: React.FunctionComponent = ({
// @ts-ignore
return ;
-}
+};
// Note: VictoryTooltip.defaultEvents must be hoisted
hoistNonReactStatics(ChartTooltip, VictoryTooltip);
diff --git a/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-domain.ts b/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-domain.ts
index 109eb724110..88494dcb043 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-domain.ts
+++ b/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-domain.ts
@@ -19,16 +19,13 @@ interface SourcesInterface {
}[];
}
-export interface ChartDomain {x: [number, number], y: [number, number]}
+export interface ChartDomain {
+ x: [number, number];
+ y: [number, number];
+}
// Returns the min and max domain for given data
-export const getDomain = ({
- data,
- maxDomain,
- minDomain,
- x,
- y
-}: DomainInterface): ChartDomain => {
+export const getDomain = ({ data, maxDomain, minDomain, x, y }: DomainInterface): ChartDomain => {
// x-domain
let xLow = 0;
let xHigh = 0;
@@ -70,7 +67,7 @@ export const getDomain = ({
}
// Search data for max / min range
- const datum = Data.formatData(data, {x, y}, ['x', 'y']);
+ const datum = Data.formatData(data, { x, y }, ['x', 'y']);
datum.forEach((dataPoint: any) => {
if (xLowSearch) {
if (dataPoint._x < xLow) {
@@ -93,17 +90,13 @@ export const getDomain = ({
}
}
});
- return {x: [xLow, xHigh], y: [yLow, yHigh]};
+ return { x: [xLow, xHigh], y: [yLow, yHigh] };
};
-export const getDomains = ({
- maxDomain,
- minDomain,
- sources
-}: SourcesInterface): ChartDomain => {
+export const getDomains = ({ maxDomain, minDomain, sources }: SourcesInterface): ChartDomain => {
const domains: ChartDomain[] = [];
- sources.forEach((source) => {
- const {data: compData = source.data} = source.component ? source.component.props : undefined;
+ sources.forEach(source => {
+ const { data: compData = source.data } = source.component ? source.component.props : undefined;
const domain = getDomain({
data: compData,
maxDomain,
@@ -126,5 +119,5 @@ export const getDomains = ({
const yLow = Math.min(...yDomains);
const yHigh = Math.max(...yDomains);
- return {x: [xLow, xHigh], y: [yLow, yHigh]};
+ return { x: [xLow, xHigh], y: [yLow, yHigh] };
};
diff --git a/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-helpers.ts b/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-helpers.ts
index c0dfe1eb46e..be00355ffa4 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-helpers.ts
+++ b/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-helpers.ts
@@ -5,16 +5,16 @@ interface ChartClassNameInterface {
}
// Returns the class name that will be applied to the outer-most div rendered by the chart's container
-export const getClassName = ({
- className
-}: ChartClassNameInterface) => {
+export const getClassName = ({ className }: ChartClassNameInterface) => {
let cleanClassName;
// Workaround for VictoryContainer class name
if (className) {
- cleanClassName = className.replace(/VictoryContainer/g, '')
+ cleanClassName = className
+ .replace(/VictoryContainer/g, '')
.replace(/pf-c-chart/g, '')
- .replace(/\s+/g,' ').trim();
+ .replace(/\s+/g, ' ')
+ .trim();
}
- return (cleanClassName && cleanClassName.length) ? `pf-c-chart ${cleanClassName}` : 'pf-c-chart';
-}
+ return cleanClassName && cleanClassName.length ? `pf-c-chart ${cleanClassName}` : 'pf-c-chart';
+};
diff --git a/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-label.ts b/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-label.ts
index 731c259868a..5465b3d63d9 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-label.ts
+++ b/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-label.ts
@@ -18,7 +18,7 @@ interface ChartPieLabelInterface {
dx?: number; // Horizontal shift from the x coordinate
dy?: number; // Horizontal shift from the y coordinate
height: number; // Chart height
- labelPosition?: 'bottom' | 'center' | 'right' ; // Position of label
+ labelPosition?: 'bottom' | 'center' | 'right'; // Position of label
legendPosition?: 'bottom' | 'right'; // Position of legend
padding: any; // Chart padding
width: number; // Chart width
@@ -30,20 +30,12 @@ interface ChartLabelTextSizeInterface {
}
// Returns x coordinate for bullet labels
-export const getBulletLabelX = ({
- chartWidth,
- dx = 0,
- labelPosition
-}: ChartBulletLabelInterface) => {
- return (labelPosition === 'top' && chartWidth) ? Math.round(chartWidth / 2) : dx;
+export const getBulletLabelX = ({ chartWidth, dx = 0, labelPosition }: ChartBulletLabelInterface) => {
+ return labelPosition === 'top' && chartWidth ? Math.round(chartWidth / 2) : dx;
};
// Returns y coordinate for bullet labels
-export const getBulletLabelY = ({
- chartHeight,
- dy = 0,
- labelPosition
-}: ChartBulletLabelInterface) => {
+export const getBulletLabelY = ({ chartHeight, dy = 0, labelPosition }: ChartBulletLabelInterface) => {
switch (labelPosition) {
case 'bottom':
return chartHeight + ChartCommonStyles.label.margin + dy;
@@ -85,13 +77,7 @@ export const getPieLabelX = ({
};
// Returns x coordinate for pie labels
-export const getPieLabelY = ({
- dy = 0,
- height,
- labelPosition,
- padding,
- width
-}: ChartPieLabelInterface) => {
+export const getPieLabelY = ({ dy = 0, height, labelPosition, padding, width }: ChartPieLabelInterface) => {
const origin = getPieOrigin({ height, padding, width });
const radius = Helpers.getRadius({ height, width, padding });
@@ -110,12 +96,9 @@ export const getPieLabelY = ({
export const overpassFontCharacterConstant = 2.5875;
// Returns an approximate size for the give text
-export const getLabelTextSize = ({
- text,
- theme
-}: ChartLabelTextSizeInterface): {height: number, width: number} => {
+export const getLabelTextSize = ({ text, theme }: ChartLabelTextSizeInterface): { height: number; width: number } => {
const style = theme.legend.style.labels;
- return TextSize.approximateTextSize(text, {
+ return TextSize.approximateTextSize(text, {
...style,
characterConstant: overpassFontCharacterConstant
});
diff --git a/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-legend.ts b/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-legend.ts
index 402271eefca..d63d8af1305 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-legend.ts
+++ b/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-legend.ts
@@ -3,7 +3,7 @@ import { Helpers, TextSize } from 'victory-core';
import { ChartLegendProps } from '../ChartLegend';
import { ChartCommonStyles, ChartThemeDefinition } from '../ChartTheme';
import { overpassFontCharacterConstant } from './chart-label';
-import {getPieOrigin} from "./chart-origin";
+import { getPieOrigin } from './chart-origin';
interface ChartLegendInterface {
chartType?: string; // The type of chart (e.g., pie) to lookup for props
@@ -51,16 +51,11 @@ export const getLegendDimensions = ({
};
// Returns x coordinate for legend
-export const getLegendX = ({
- chartType,
- ...rest
-}: ChartLegendInterface) => (chartType === 'pie') ? getPieLegendX(rest) : getChartLegendX(rest);
+export const getLegendX = ({ chartType, ...rest }: ChartLegendInterface) =>
+ chartType === 'pie' ? getPieLegendX(rest) : getChartLegendX(rest);
// Returns y coordinate for legend
-export const getLegendY = ({
- chartType,
- ...rest
-}: ChartLegendInterface) => {
+export const getLegendY = ({ chartType, ...rest }: ChartLegendInterface) => {
switch (chartType) {
case 'pie':
return getPieLegendY(rest);
@@ -69,7 +64,7 @@ export const getLegendY = ({
default:
return getChartLegendY(rest);
}
-}
+};
// Returns y coordinate for bullet legends
export const getBulletLegendY = ({
@@ -83,9 +78,9 @@ export const getBulletLegendY = ({
theme,
width
}: ChartLegendInterface) => {
- const { left, right } = Helpers.getPadding({padding});
+ const { left, right } = Helpers.getPadding({ padding });
const chartSize = {
- height: height, // Fixed size
+ height, // Fixed size
width: width - left - right
};
@@ -121,7 +116,7 @@ export const getChartLegendX = ({
theme,
width
}: ChartLegendInterface) => {
- const { top, bottom, left, right } = Helpers.getPadding({padding});
+ const { top, bottom, left, right } = Helpers.getPadding({ padding });
const chartSize = {
height: Math.abs(height - (bottom + top)),
width: Math.abs(width - (left + right))
@@ -141,7 +136,8 @@ export const getChartLegendX = ({
switch (legendPosition) {
case 'bottom':
return width > legendDimensions.width - textSizeWorkAround
- ? Math.round((width - (legendDimensions.width - textSizeWorkAround)) / 2) + dx : dx;
+ ? Math.round((width - (legendDimensions.width - textSizeWorkAround)) / 2) + dx
+ : dx;
case 'bottom-left':
return left + dx;
case 'right':
@@ -163,7 +159,7 @@ export const getChartLegendY = ({
theme,
width
}: ChartLegendInterface) => {
- const { top, bottom, left, right } = Helpers.getPadding({padding});
+ const { top, bottom, left, right } = Helpers.getPadding({ padding });
const chartSize = {
height: Math.abs(height - (bottom + top)),
width: Math.abs(width - (left + right))
@@ -183,7 +179,7 @@ export const getChartLegendY = ({
});
const originX = chartSize.height / 2 + top;
const legendPadding = (legendData: any[]) => (legendData && legendData.length > 0 ? 2 : 0);
- return (originX - legendDimensions.height / 2) + legendPadding(legendData);
+ return originX - legendDimensions.height / 2 + legendPadding(legendData);
}
default:
return dy;
@@ -219,7 +215,8 @@ export const getPieLegendX = ({
switch (legendPosition) {
case 'bottom':
return width > legendDimensions.width - textSizeWorkAround
- ? Math.round((width - (legendDimensions.width - textSizeWorkAround)) / 2) + dx : dx;
+ ? Math.round((width - (legendDimensions.width - textSizeWorkAround)) / 2) + dx
+ : dx;
case 'right':
return origin.x + ChartCommonStyles.label.margin + dx + radius;
default:
@@ -254,7 +251,7 @@ export const getPieLegendY = ({
theme
});
const legendPadding = (legendData: any[]) => (legendData && legendData.length > 0 ? 2 : 0);
- return (origin.y - legendDimensions.height / 2) + legendPadding(legendData);
+ return origin.y - legendDimensions.height / 2 + legendPadding(legendData);
}
default:
return dy;
@@ -264,11 +261,7 @@ export const getPieLegendY = ({
// Returns an approximation of over-sized text width due to growing character count
//
// See https://github.com/FormidableLabs/victory/issues/864
-const getTextSizeWorkAround = ({
- legendData,
- legendOrientation,
- theme
-}: ChartLegendTextSizeInterface) => {
+const getTextSizeWorkAround = ({ legendData, legendOrientation, theme }: ChartLegendTextSizeInterface) => {
const style = theme.legend.style.labels;
if (!(legendData && legendData.length)) {
return 0;
@@ -279,14 +272,14 @@ const getTextSizeWorkAround = ({
// For vertical legends, account for the growing char count of the longest legend item
if (legendOrientation === 'vertical') {
- legendData.forEach((data) => {
+ legendData.forEach(data => {
if (data.name && data.name.length > result.length) {
result = data.name;
}
});
}
- const textSize = TextSize.approximateTextSize(result, style);
- const adjustedTextSize = TextSize.approximateTextSize(result, {
+ const textSize = TextSize.approximateTextSize(result, style);
+ const adjustedTextSize = TextSize.approximateTextSize(result, {
...style,
characterConstant: overpassFontCharacterConstant
});
diff --git a/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-origin.ts b/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-origin.ts
index a8714a7bef8..0a357941113 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-origin.ts
+++ b/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-origin.ts
@@ -8,12 +8,8 @@ interface ChartPieOriginInterface {
// Returns te origin for pie based charts. For example, something with a radius such as pie, donut, donut utilization,
// and donut threshold.
-export const getPieOrigin = ({
- height,
- padding,
- width
-}: ChartPieOriginInterface) => {
- const { top, bottom, left, right } = Helpers.getPadding({padding});
+export const getPieOrigin = ({ height, padding, width }: ChartPieOriginInterface) => {
+ const { top, bottom, left, right } = Helpers.getPadding({ padding });
const radius = Helpers.getRadius({ height, width, padding });
const offsetX = (width - radius * 2 - left - right) / 2;
const offsetY = (height - radius * 2 - top - bottom) / 2;
@@ -21,4 +17,4 @@ export const getPieOrigin = ({
x: radius + left + offsetX,
y: radius + top + offsetY
};
-}
+};
diff --git a/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-padding.ts b/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-padding.ts
index a10859d6522..d7bdd25a4d7 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-padding.ts
+++ b/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-padding.ts
@@ -1,7 +1,11 @@
import { get, isEmpty, isFinite } from 'lodash';
import { PaddingProps } from 'victory';
-export const getPaddingForSide = (side: 'bottom' | 'left' | 'right' | 'top', padding: PaddingProps, fallback: PaddingProps): number => {
+export const getPaddingForSide = (
+ side: 'bottom' | 'left' | 'right' | 'top',
+ padding: PaddingProps,
+ fallback: PaddingProps
+): number => {
if (!isEmpty(padding)) {
return get(padding, side, 0);
}
diff --git a/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-theme.ts b/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-theme.ts
index 21df85ccbae..ae7fd017b9a 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-theme.ts
+++ b/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-theme.ts
@@ -42,9 +42,11 @@ import {
import { cloneDeep } from 'lodash';
// Apply custom properties to base and color themes
-export const getCustomTheme = (themeColor: string, themeVariant: string, customTheme: ChartThemeDefinition
-): ChartThemeDefinition =>
- merge(getTheme(themeColor, themeVariant), customTheme);
+export const getCustomTheme = (
+ themeColor: string,
+ themeVariant: string,
+ customTheme: ChartThemeDefinition
+): ChartThemeDefinition => merge(getTheme(themeColor, themeVariant), customTheme);
// Returns axis theme
export const getAxisTheme = (themeColor: string, themeVariant: string): ChartThemeDefinition => {
@@ -65,8 +67,10 @@ export const getBulletComparativeMeasureTheme = (themeColor: string, themeVarian
getCustomTheme(themeColor, themeVariant, ChartBulletComparativeMeasureTheme);
// Returns comparative warning measure theme for bullet chart
-export const getBulletComparativeWarningMeasureTheme = (themeColor: string, themeVariant: string): ChartThemeDefinition =>
- getCustomTheme(themeColor, themeVariant, ChartBulletComparativeWarningMeasureTheme);
+export const getBulletComparativeWarningMeasureTheme = (
+ themeColor: string,
+ themeVariant: string
+): ChartThemeDefinition => getCustomTheme(themeColor, themeVariant, ChartBulletComparativeWarningMeasureTheme);
// Returns group title theme for bullet chart
export const getBulletGroupTitleTheme = (themeColor: string, themeVariant: string): ChartThemeDefinition =>
@@ -105,7 +109,10 @@ export const getDonutThresholdDynamicTheme = (themeColor: string, themeVariant:
};
// Returns static donut threshold theme
-export const getDonutThresholdStaticTheme = (themeColor: string, themeVariant: string, invert?: boolean
+export const getDonutThresholdStaticTheme = (
+ themeColor: string,
+ themeVariant: string,
+ invert?: boolean
): ChartThemeDefinition => {
const staticTheme = cloneDeep(ChartDonutThresholdStaticTheme);
if (invert) {
@@ -120,8 +127,7 @@ export const getDonutUtilizationTheme = (themeColor: string, themeVariant: strin
// Merge just the first color of dynamic (blue, green, etc.) with static (grey) for expected colorScale
theme.pie.colorScale = [theme.pie.colorScale[0], ...ChartDonutUtilizationStaticTheme.pie.colorScale];
- theme.legend.colorScale = [theme.legend.colorScale[0],
- ...ChartDonutUtilizationStaticTheme.legend.colorScale];
+ theme.legend.colorScale = [theme.legend.colorScale[0], ...ChartDonutUtilizationStaticTheme.legend.colorScale];
return theme;
};
diff --git a/packages/patternfly-4/react-charts/src/components/ChartVoronoiContainer/ChartVoronoContainer.test.tsx b/packages/patternfly-4/react-charts/src/components/ChartVoronoiContainer/ChartVoronoContainer.test.tsx
index 08625ba985f..b3748e0d696 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartVoronoiContainer/ChartVoronoContainer.test.tsx
+++ b/packages/patternfly-4/react-charts/src/components/ChartVoronoiContainer/ChartVoronoContainer.test.tsx
@@ -4,7 +4,7 @@ import { ChartArea } from '../ChartArea';
import { ChartGroup } from '../ChartGroup';
import { ChartVoronoiContainer } from './ChartVoronoiContainer';
-Object.values([true, false]).forEach((isRead) => {
+Object.values([true, false]).forEach(isRead => {
test('ChartVoronoiContainer', () => {
const view = shallow();
expect(view).toMatchSnapshot();
diff --git a/packages/patternfly-4/react-charts/src/components/ChartVoronoiContainer/ChartVoronoiContainer.tsx b/packages/patternfly-4/react-charts/src/components/ChartVoronoiContainer/ChartVoronoiContainer.tsx
index 841ee35c3ee..fe68e72d09d 100644
--- a/packages/patternfly-4/react-charts/src/components/ChartVoronoiContainer/ChartVoronoiContainer.tsx
+++ b/packages/patternfly-4/react-charts/src/components/ChartVoronoiContainer/ChartVoronoiContainer.tsx
@@ -1,9 +1,6 @@
import * as React from 'react';
import hoistNonReactStatics from 'hoist-non-react-statics';
-import {
- VictoryVoronoiContainer,
- VictoryVoronoiContainerProps
-} from 'victory';
+import { VictoryVoronoiContainer, VictoryVoronoiContainerProps } from 'victory';
import { ChartThemeDefinition } from '../ChartTheme';
import { ChartTooltip } from '../ChartTooltip';
import { getClassName, getTheme } from '../ChartUtils';
@@ -70,7 +67,7 @@ export interface ChartVoronoiContainerProps extends VictoryVoronoiContainerProps
* When the mouseFollowTooltip prop is set on VictoryVoronoiContainer, The position of the center of the tooltip
* follows the position of the mouse.
*/
- mouseFollowTooltips?: boolean,
+ mouseFollowTooltips?: boolean;
/**
* The onActivated prop accepts a function to be called whenever new data points are activated.
* The function is called with the parameters points (an array of active data objects) and props
@@ -158,16 +155,16 @@ export const ChartVoronoiContainer: React.FunctionComponent : undefined,
...rest
}: ChartVoronoiContainerProps) => {
- const chartClassName = getClassName({className});
+ const chartClassName = getClassName({ className });
const chartLabelComponent = React.cloneElement(labelComponent, {
constrainToVisibleArea,
theme,
- ...labelComponent.props,
+ ...labelComponent.props
});
// Note: theme is required by voronoiContainerMixin, but @types/victory is missing a prop type
// @ts-ignore
- return ;
+ return ; // prettier-ignore
};
ChartVoronoiContainer.defaultProps = (VictoryVoronoiContainer as any).defaultProps;
diff --git a/packages/patternfly-4/react-core/package.json b/packages/patternfly-4/react-core/package.json
index 9cb5ab76a70..ee2381ded15 100644
--- a/packages/patternfly-4/react-core/package.json
+++ b/packages/patternfly-4/react-core/package.json
@@ -67,9 +67,6 @@
"fs-extra": "^6.0.1",
"glob": "^7.1.2",
"rimraf": "^2.6.2",
- "tslint": "^5.12.0",
- "tslint-config-prettier": "^1.17.0",
- "tslint-react": "^3.6.0",
"typescript": "3.4.5"
},
"peerDependencies": {
diff --git a/packages/patternfly-4/react-core/src/components/AboutModal/AboutModal.test.tsx b/packages/patternfly-4/react-core/src/components/AboutModal/AboutModal.test.tsx
index d54cb7ef581..2fa6ede8f78 100644
--- a/packages/patternfly-4/react-core/src/components/AboutModal/AboutModal.test.tsx
+++ b/packages/patternfly-4/react-core/src/components/AboutModal/AboutModal.test.tsx
@@ -8,65 +8,65 @@ const mockListener = jest.spyOn(ReactDOM, 'createPortal');
jest.spyOn(document, 'createElement');
jest.spyOn(document, 'addEventListener');
-mockListener.mockImplementation((node) => node as React.ReactPortal);
+mockListener.mockImplementation(node => node as React.ReactPortal);
const props = {
- onClose: jest.fn(),
- children: 'modal content',
- productName: 'Product Name',
- trademark: 'Trademark and copyright information here',
- brandImageSrc: 'brandImg...',
- brandImageAlt: 'Brand Image',
- logoImageSrc: 'logoImg...',
- logoImageAlt: 'AboutModal Logo'
+ onClose: jest.fn(),
+ children: 'modal content',
+ productName: 'Product Name',
+ trademark: 'Trademark and copyright information here',
+ brandImageSrc: 'brandImg...',
+ brandImageAlt: 'Brand Image',
+ logoImageSrc: 'logoImg...',
+ logoImageAlt: 'AboutModal Logo'
};
test('AboutModal creates a container element once for div', () => {
- const view = shallow( Test About Modal );
- view.update();
- expect(document.createElement).toBeCalledWith('div');
- expect(document.createElement).toHaveBeenCalledTimes(1);
+ const view = shallow( Test About Modal );
+ view.update();
+ expect(document.createElement).toBeCalledWith('div');
+ expect(document.createElement).toHaveBeenCalledTimes(1);
});
test('About Modal closes with escape', () => {
- shallow(
-
- Test About Modal
-
- );
- const [event, handler] = (document.addEventListener as any).mock.calls[0];
- expect(event).toBe('keydown');
- handler({ keyCode: KEY_CODES.ESCAPE_KEY });
- expect(props.onClose).toBeCalled();
+ shallow(
+
+ Test About Modal
+
+ );
+ const [event, handler] = (document.addEventListener as any).mock.calls[0];
+ expect(event).toBe('keydown');
+ handler({ keyCode: KEY_CODES.ESCAPE_KEY });
+ expect(props.onClose).toBeCalled();
});
test('modal does not call onClose for esc key if it is not open', () => {
- shallow();
- const [event, handler] = (document.addEventListener as any).mock.calls[0];
- expect(event).toBe('keydown');
- handler({ keyCode: KEY_CODES.ESCAPE_KEY });
- expect(props.onClose).not.toBeCalled();
+ shallow();
+ const [event, handler] = (document.addEventListener as any).mock.calls[0];
+ expect(event).toBe('keydown');
+ handler({ keyCode: KEY_CODES.ESCAPE_KEY });
+ expect(props.onClose).not.toBeCalled();
});
test('Each modal is given new ariaDescribedById and ariaLabelledbyId', () => {
- const first = new AboutModal(props);
- const second = new AboutModal(props);
- expect(first.ariaLabelledBy).not.toBe(second.ariaLabelledBy);
- expect(first.ariaDescribedBy).not.toBe(second.ariaDescribedBy);
+ const first = new AboutModal(props);
+ const second = new AboutModal(props);
+ expect(first.ariaLabelledBy).not.toBe(second.ariaLabelledBy);
+ expect(first.ariaDescribedBy).not.toBe(second.ariaDescribedBy);
});
test('Console error is generated when the logoImageSrc is provided without logoImageAlt', () => {
- const noImgAltrops = {
- onClose: jest.fn(),
- children: 'modal content',
- productName: 'Product Name',
- trademark: 'Trademark and copyright information here',
- brandImageSrc: 'brandImg...',
- logoImageSrc: 'logoImg...'
- };
- const myMock = jest.fn() as any;
- global.console = { error: myMock } as any;
- const JSAboutModal = AboutModal as any;
- shallow( Test About Modal );
- expect(myMock).toBeCalled();
+ const noImgAltrops = {
+ onClose: jest.fn(),
+ children: 'modal content',
+ productName: 'Product Name',
+ trademark: 'Trademark and copyright information here',
+ brandImageSrc: 'brandImg...',
+ logoImageSrc: 'logoImg...'
+ };
+ const myMock = jest.fn() as any;
+ global.console = { error: myMock } as any;
+ const JSAboutModal = AboutModal as any;
+ shallow( Test About Modal );
+ expect(myMock).toBeCalled();
});
diff --git a/packages/patternfly-4/react-core/src/components/AboutModal/AboutModal.tsx b/packages/patternfly-4/react-core/src/components/AboutModal/AboutModal.tsx
index 1f0efbef6c7..710d4e375ee 100644
--- a/packages/patternfly-4/react-core/src/components/AboutModal/AboutModal.tsx
+++ b/packages/patternfly-4/react-core/src/components/AboutModal/AboutModal.tsx
@@ -65,7 +65,7 @@ export class AboutModal extends React.Component {
if (event.keyCode === KEY_CODES.ESCAPE_KEY && this.props.isOpen) {
this.props.onClose();
}
- }
+ };
toggleSiblingsFromScreenReaders = (hide: boolean) => {
const bodyChildren = document.body.children;
@@ -74,20 +74,20 @@ export class AboutModal extends React.Component {
hide ? child.setAttribute('aria-hidden', '' + hide) : child.removeAttribute('aria-hidden');
}
}
- }
+ };
componentDidMount() {
- const container = document.createElement('div');
- this.setState({ container });
- document.body.appendChild(container);
- document.addEventListener('keydown', this.handleEscKeyClick, false);
+ const container = document.createElement('div');
+ this.setState({ container });
+ document.body.appendChild(container);
+ document.addEventListener('keydown', this.handleEscKeyClick, false);
- if (this.props.isOpen) {
- document.body.classList.add(css(styles.backdropOpen));
- } else {
- document.body.classList.remove(css(styles.backdropOpen));
- }
+ if (this.props.isOpen) {
+ document.body.classList.add(css(styles.backdropOpen));
+ } else {
+ document.body.classList.remove(css(styles.backdropOpen));
}
+ }
componentDidUpdate() {
if (this.props.isOpen) {
@@ -107,7 +107,6 @@ export class AboutModal extends React.Component {
}
render() {
-
const { ...props } = this.props;
const { container } = this.state;
diff --git a/packages/patternfly-4/react-core/src/components/AboutModal/AboutModalBoxCloseButton.tsx b/packages/patternfly-4/react-core/src/components/AboutModal/AboutModalBoxCloseButton.tsx
index 7049709da3f..72bca454af2 100644
--- a/packages/patternfly-4/react-core/src/components/AboutModal/AboutModalBoxCloseButton.tsx
+++ b/packages/patternfly-4/react-core/src/components/AboutModal/AboutModalBoxCloseButton.tsx
@@ -16,9 +16,9 @@ export const AboutModalBoxCloseButton: React.SFC
onClose = () => undefined as any,
...props
}: AboutModalBoxCloseButtonProps) => (
-
-
-
+
+
+
);
diff --git a/packages/patternfly-4/react-core/src/components/AboutModal/AboutModalBoxContent.tsx b/packages/patternfly-4/react-core/src/components/AboutModal/AboutModalBoxContent.tsx
index 4201d246d6c..2a8b7977584 100644
--- a/packages/patternfly-4/react-core/src/components/AboutModal/AboutModalBoxContent.tsx
+++ b/packages/patternfly-4/react-core/src/components/AboutModal/AboutModalBoxContent.tsx
@@ -28,8 +28,6 @@ export const AboutModalBoxContent: React.SFC = ({
{noAboutModalBoxContentContainer ? children :
{children}
}
-
- {trademark}
-
+ {trademark}
);
diff --git a/packages/patternfly-4/react-core/src/components/AboutModal/AboutModalBoxHero.tsx b/packages/patternfly-4/react-core/src/components/AboutModal/AboutModalBoxHero.tsx
index f185ac5d9bc..d3366f5a3c9 100644
--- a/packages/patternfly-4/react-core/src/components/AboutModal/AboutModalBoxHero.tsx
+++ b/packages/patternfly-4/react-core/src/components/AboutModal/AboutModalBoxHero.tsx
@@ -16,9 +16,12 @@ export const AboutModalBoxHero: React.SFC