diff --git a/CHANGELOG.md b/CHANGELOG.md
index 26a631cf9..353965a8e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+## react-components 5.33.9 (2022-07-28)
+
+- Adding optional tooltip to ButtonSelect component (by [@alex501212](https://github.com/alex501212) in [#591](https://github.com/puppetlabs/design-system/pull/591))
+
## data-grid 0.6.11 (2022-07-25)
- [TableFooter] Adding custom rows per page prop to TableFooter (by [@cathal41](https://github.com/cathal41) in [#403](https://github.com/puppetlabs/design-system/pull/589))
diff --git a/packages/data-grid/src/__test__/__snapshots__/quickFitler.test.jsx.snap b/packages/data-grid/src/__test__/__snapshots__/quickFitler.test.jsx.snap
index 9842b7f44..65dfcbb53 100644
--- a/packages/data-grid/src/__test__/__snapshots__/quickFitler.test.jsx.snap
+++ b/packages/data-grid/src/__test__/__snapshots__/quickFitler.test.jsx.snap
@@ -121,6 +121,8 @@ exports[`Snapshot test Check component matches previous HTML snapshot 1`] = `
}
placeholder="All Operating System"
style={Object {}}
+ tooltipAnchor="top"
+ tooltipDisabled={false}
type="tertiary"
value={null}
weight="bold"
@@ -473,6 +475,8 @@ exports[`Snapshot test Check component matches previous HTML snapshot 1`] = `
}
placeholder="Puppet installed"
style={Object {}}
+ tooltipAnchor="top"
+ tooltipDisabled={false}
type="tertiary"
value={null}
weight="bold"
@@ -805,6 +809,8 @@ exports[`Snapshot test Check component matches previous HTML snapshot 1`] = `
}
placeholder="Empty filter"
style={Object {}}
+ tooltipAnchor="top"
+ tooltipDisabled={false}
type="tertiary"
value={null}
weight="bold"
diff --git a/packages/react-components/package-lock.json b/packages/react-components/package-lock.json
index a8cdbee76..4818e89c8 100644
--- a/packages/react-components/package-lock.json
+++ b/packages/react-components/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "@puppet/react-components",
- "version": "5.33.8",
+ "version": "5.33.9",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/packages/react-components/package.json b/packages/react-components/package.json
index e7596acf2..10768afb1 100644
--- a/packages/react-components/package.json
+++ b/packages/react-components/package.json
@@ -1,6 +1,6 @@
{
"name": "@puppet/react-components",
- "version": "5.33.8",
+ "version": "5.33.9",
"author": "Puppet, Inc.",
"license": "Apache-2.0",
"main": "build/library.js",
diff --git a/packages/react-components/source/react/library/button-select/ButtonSelect.js b/packages/react-components/source/react/library/button-select/ButtonSelect.js
index d95f5c7b6..804543928 100644
--- a/packages/react-components/source/react/library/button-select/ButtonSelect.js
+++ b/packages/react-components/source/react/library/button-select/ButtonSelect.js
@@ -2,6 +2,7 @@ import React, { Component } from 'react';
import classNames from 'classnames';
import PropTypes from 'prop-types';
import Button from '../button/Button';
+import TooltipHoverArea from '../tooltips/TooltipHoverArea';
import OptionMenuList from '../../internal/option-menu-list';
import { anchorOrientation } from '../../helpers/customPropTypes';
import Icon from '../icon';
@@ -75,6 +76,12 @@ const propTypes = {
width: PropTypes.string,
/** Optional inline style passed to the outer element */
style: PropTypes.shape({}),
+ /** Optional tooltip that on hover displays the value of the currently selected option */
+ tooltip: PropTypes.string,
+ /** Anchor orientation of the button tooltip */
+ tooltipAnchor: PropTypes.string,
+ /** Allows for custom disablement of the button tooltip */
+ tooltipDisabled: PropTypes.bool,
};
const defaultProps = {
@@ -95,6 +102,9 @@ const defaultProps = {
className: '',
width: null,
style: {},
+ tooltip: undefined,
+ tooltipAnchor: 'top',
+ tooltipDisabled: false,
};
const isControlled = ({ multiple, applyImmediately }) =>
@@ -246,6 +256,9 @@ class ButtonSelect extends Component {
width,
style,
value,
+ tooltip,
+ tooltipAnchor,
+ tooltipDisabled,
} = this.props;
return (
@@ -264,29 +277,61 @@ class ButtonSelect extends Component {
this.container = container;
}}
>
-
+ {tooltip ? (
+
+
+
+ ) : (
+
+ )}
;
```
+### Tooltip
+
+Use the `tooltip` prop to add a tooltip to the button.
+
+```jsx
+const options = [
+ { value: 'one', label: 'One' },
+ { value: 'two', label: 'Two' },
+ { value: 'three', label: 'Three' },
+ { value: 'four', label: 'Four' },
+];
+
+ {
+ console.log('New Value:', value);
+ setState({ value });
+ }}
+/>;
+```
+
## Option properties
### Custom selected labels