);
export const singleline = () => (
@@ -85,6 +112,7 @@ const props = () => ({
onClick: action('onClick'),
copyButtonDescription: text('Copy button title', 'Copy code snippet'),
ariaLabel: text('ARIA label', 'Container label'),
+ wrapText: boolean('Wrap text', true),
});
export const playground = () => (
diff --git a/packages/react/src/components/CodeSnippet/CodeSnippet.js b/packages/react/src/components/CodeSnippet/CodeSnippet.js
index 3317e0ab5d01..8f25a38f7f13 100644
--- a/packages/react/src/components/CodeSnippet/CodeSnippet.js
+++ b/packages/react/src/components/CodeSnippet/CodeSnippet.js
@@ -31,6 +31,7 @@ function CodeSnippet({
showMoreText,
showLessText,
hideCopyButton,
+ wrapText,
...rest
}) {
const [expandedCode, setExpandedCode] = useState(false);
@@ -54,6 +55,7 @@ function CodeSnippet({
[`${prefix}--snippet--expand`]: expandedCode,
[`${prefix}--snippet--light`]: light,
[`${prefix}--snippet--no-copy`]: hideCopyButton,
+ [`${prefix}--snippet--wraptext`]: wrapText,
});
const expandCodeBtnText = expandedCode ? showLessText : showMoreText;
@@ -185,12 +187,18 @@ CodeSnippet.propTypes = {
* Provide the type of Code Snippet
*/
type: PropTypes.oneOf(['single', 'inline', 'multi']),
+
+ /**
+ * Specify whether or not to wrap the text.
+ */
+ wrapText: PropTypes.bool,
};
CodeSnippet.defaultProps = {
type: 'single',
showMoreText: 'Show more',
showLessText: 'Show less',
+ wrapText: false,
};
export default CodeSnippet;
diff --git a/packages/react/src/components/CodeSnippet/CodeSnippet.mdx b/packages/react/src/components/CodeSnippet/CodeSnippet.mdx
index 8fe9cceef6ad..93ec8c44d15d 100644
--- a/packages/react/src/components/CodeSnippet/CodeSnippet.mdx
+++ b/packages/react/src/components/CodeSnippet/CodeSnippet.mdx
@@ -55,7 +55,8 @@ name or similar small piece of code from it's surrounding text.
Multiple line code snippets are used for displaying code with more than one
line. They're shown in a block and useful for showing classes, functions, blocks
-of styles and the like.
+of styles and the like. There is an option to wrap the lines displayed if the lines
+are longer than the container.
diff --git a/packages/react/src/components/OverflowMenu/OverflowMenu.js b/packages/react/src/components/OverflowMenu/OverflowMenu.js
index f6aac3c77b0a..19e4fc3963ff 100644
--- a/packages/react/src/components/OverflowMenu/OverflowMenu.js
+++ b/packages/react/src/components/OverflowMenu/OverflowMenu.js
@@ -506,6 +506,7 @@ class OverflowMenu extends Component {
const wrappedMenuBody = (
)', 1),
- role: text('ARIA role (role in )', 'navigation'),
// Disabling action logger for `` for now given it seems to be significantly slowing down Storybook
// onClick: action('onClick'),
// onKeyDown: action('onKeyDown'),
@@ -53,7 +52,6 @@ const props = {
tab: () => ({
disabled: boolean('Disabled (disabled in )', false),
href: text('The href for tab (href in )', '#'),
- role: text('ARIA role (role in )', 'presentation'),
tabIndex: number('Tab index (tabIndex in )', 0),
onClick: action('onClick'),
onKeyDown: action('onKeyDown'),
diff --git a/packages/react/src/components/Tabs/Tabs-test.js b/packages/react/src/components/Tabs/Tabs-test.js
index 4d84e5b599f7..dd216d048f73 100644
--- a/packages/react/src/components/Tabs/Tabs-test.js
+++ b/packages/react/src/components/Tabs/Tabs-test.js
@@ -26,16 +26,6 @@ describe('Tabs', () => {
);
- it('renders [role="navigation"] props on wrapping
by default', () => {
- expect(
- wrapper
- // TODO: uncomment and replace in next major version
- // .find(`.${prefix}--tabs`).props().role
- .find(`.${prefix}--tabs--scrollable .${prefix}--tabs--scrollable`)
- .props().role
- ).toEqual('navigation');
- });
-
it('renders [role="tablist"] props on
by default', () => {
expect(wrapper.find('ul').props().role).toEqual('tablist');
});
diff --git a/packages/react/src/components/Tabs/Tabs.js b/packages/react/src/components/Tabs/Tabs.js
index 61e37ec98c4b..0d8645a344ea 100644
--- a/packages/react/src/components/Tabs/Tabs.js
+++ b/packages/react/src/components/Tabs/Tabs.js
@@ -24,7 +24,7 @@ export default class Tabs extends React.Component {
children: PropTypes.node,
/**
- * Provide a className that is applied to the root