diff --git a/.yarn/offline-mirror/eslint-plugin-react-hooks-2.3.0.tgz b/.yarn/offline-mirror/eslint-plugin-react-hooks-2.3.0.tgz
deleted file mode 100644
index be1c1517de58..000000000000
Binary files a/.yarn/offline-mirror/eslint-plugin-react-hooks-2.3.0.tgz and /dev/null differ
diff --git a/.yarn/offline-mirror/eslint-plugin-react-hooks-4.0.4.tgz b/.yarn/offline-mirror/eslint-plugin-react-hooks-4.0.4.tgz
new file mode 100644
index 000000000000..ec6dfa2b2872
Binary files /dev/null and b/.yarn/offline-mirror/eslint-plugin-react-hooks-4.0.4.tgz differ
diff --git a/package.json b/package.json
index f401bb7fe07c..908d347b8b67 100644
--- a/package.json
+++ b/package.json
@@ -57,7 +57,7 @@
"enzyme-adapter-react-16": "^1.14.0",
"enzyme-to-json": "^3.3.5",
"eslint": "^6.8.0",
- "eslint-config-carbon": "10.7.0",
+ "eslint-config-carbon": "2.0.0",
"fs-extra": "^8.1.0",
"glob": "^7.1.4",
"husky": "^4.0.10",
diff --git a/packages/components/demo/js/components/ComponentExample/ComponentExample.js b/packages/components/demo/js/components/ComponentExample/ComponentExample.js
index 10d016a5aef7..7ee06db6ae2b 100644
--- a/packages/components/demo/js/components/ComponentExample/ComponentExample.js
+++ b/packages/components/demo/js/components/ComponentExample/ComponentExample.js
@@ -66,6 +66,7 @@ class ComponentExample extends Component {
this._instantiateComponents();
}
+ // eslint-disable-next-line react/no-deprecated
componentWillUpdate({ component, htmlFile }) {
const { component: prevComponent, htmlFile: prevHtmlFile } = this.props;
if (prevComponent !== component || prevHtmlFile !== htmlFile) {
diff --git a/packages/components/demo/js/components/RootPage.js b/packages/components/demo/js/components/RootPage.js
index 56d1270d2fa3..38210c689ae5 100644
--- a/packages/components/demo/js/components/RootPage.js
+++ b/packages/components/demo/js/components/RootPage.js
@@ -195,6 +195,7 @@ class RootPage extends Component {
currentTheme: themeSwitcherItems[0].id,
};
+ // eslint-disable-next-line react/prop-types
static getDerivedStateFromProps({ componentItems, isComponentsX }, state) {
const {
prevComponentItems,
@@ -517,6 +518,7 @@ class RootPage extends Component {
value={currentTheme}
onChange={this._handleChangeThemeSwitcherDropdown}>
{themeSwitcherItems.map(({ id, text }) => (
+ // eslint-disable-next-line react/jsx-key
))}
diff --git a/packages/eslint-config-carbon/base.js b/packages/eslint-config-carbon/base.js
new file mode 100644
index 000000000000..a8ea9199579b
--- /dev/null
+++ b/packages/eslint-config-carbon/base.js
@@ -0,0 +1,35 @@
+/**
+ * Copyright IBM Corp. 2018, 2018
+ *
+ * This source code is licensed under the Apache-2.0 license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+'use strict';
+
+module.exports = {
+ parser: 'babel-eslint',
+ extends: ['eslint:recommended', require.resolve('./plugins/jsdoc')],
+ rules: {
+ // Handle cases where we are destructuring but may not be using the initial
+ // variables
+ 'no-unused-vars': [
+ 'error',
+ {
+ args: 'after-used',
+ argsIgnorePattern: '^_',
+ varsIgnorePattern: '^_',
+ },
+ ],
+ },
+ env: {
+ node: true,
+ browser: true,
+ es6: true,
+ jest: true,
+ jasmine: true,
+ },
+ globals: {
+ __DEV__: true,
+ },
+};
diff --git a/packages/eslint-config-carbon/index.js b/packages/eslint-config-carbon/index.js
index f4b3d808275e..7693ab4c0e0f 100644
--- a/packages/eslint-config-carbon/index.js
+++ b/packages/eslint-config-carbon/index.js
@@ -8,68 +8,5 @@
'use strict';
module.exports = {
- parser: 'babel-eslint',
- extends: ['eslint:recommended', 'plugin:jsx-a11y/recommended'],
- plugins: ['react', 'jsdoc', 'jsx-a11y', 'react-hooks'],
- rules: {
- // Handle cases where we are destructuring but may not be using the initial
- // variables
- 'no-unused-vars': [
- 'error',
- {
- args: 'after-used',
- argsIgnorePattern: '^_',
- varsIgnorePattern: '^_',
- },
- ],
- 'react/jsx-uses-vars': 1,
- 'react/jsx-uses-react': 1,
- 'react/no-find-dom-node': 1,
- 'react/no-typos': 2,
- 'react-hooks/rules-of-hooks': 'error',
- 'react-hooks/exhaustive-deps': 'error',
- 'jsdoc/check-param-names': 2,
- 'jsdoc/check-tag-names': [
- 'error',
- {
- definedTags: ['jest-environment'],
- },
- ],
- 'jsdoc/check-types': 2,
- 'jsx-a11y/no-static-element-interactions': 1,
- 'jsx-a11y/no-noninteractive-element-interactions': 1,
- 'jsx-a11y/click-events-have-key-events': 1,
- 'jsx-a11y/anchor-is-valid': 1,
- 'jsx-a11y/interactive-supports-focus': 1,
- 'jsx-a11y/label-has-for': [
- 1,
- {
- components: ['Label'],
- required: {
- some: ['nesting', 'id'],
- },
- allowChildren: true,
- },
- ],
- },
- env: {
- node: true,
- browser: true,
- es6: true,
- jest: true,
- jasmine: true,
- },
- globals: {
- __DEV__: true,
- },
- settings: {
- jsdoc: {
- tagNamePreference: {
- augments: 'extends',
- },
- },
- react: {
- version: 'detect',
- },
- },
+ extends: [require.resolve('./base'), require.resolve('./plugins/react')],
};
diff --git a/packages/eslint-config-carbon/package.json b/packages/eslint-config-carbon/package.json
index 77b688bd323c..85ac16c36060 100644
--- a/packages/eslint-config-carbon/package.json
+++ b/packages/eslint-config-carbon/package.json
@@ -1,11 +1,17 @@
{
"name": "eslint-config-carbon",
"private": true,
- "version": "10.7.0",
+ "version": "2.0.0",
"license": "Apache-2.0",
"main": "index.js",
"repository": "https://github.com/carbon-design-system/carbon/tree/master/packages/eslint-config-carbon",
"bugs": "https://github.com/carbon-design-system/carbon/issues",
+ "files": [
+ "plugins",
+ "index.js",
+ "react.js",
+ "vanilla.js"
+ ],
"keywords": [
"ibm",
"carbon",
@@ -29,7 +35,7 @@
"eslint-plugin-jsx-a11y": "^6.2.1",
"eslint-plugin-prettier": "^3.1.2",
"eslint-plugin-react": "^7.18.0",
- "eslint-plugin-react-hooks": "^2.3.0",
+ "eslint-plugin-react-hooks": "^4.0.4",
"eslint-restricted-globals": "^0.2.0"
}
}
diff --git a/packages/eslint-config-carbon/plugins/jsdoc.js b/packages/eslint-config-carbon/plugins/jsdoc.js
new file mode 100644
index 000000000000..08a70be27054
--- /dev/null
+++ b/packages/eslint-config-carbon/plugins/jsdoc.js
@@ -0,0 +1,29 @@
+/**
+ * Copyright IBM Corp. 2018, 2018
+ *
+ * This source code is licensed under the Apache-2.0 license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+'use strict';
+
+module.exports = {
+ plugins: ['jsdoc'],
+ settings: {
+ jsdoc: {
+ tagNamePreference: {
+ augments: 'extends',
+ },
+ },
+ },
+ rules: {
+ 'jsdoc/check-param-names': 2,
+ 'jsdoc/check-tag-names': [
+ 'error',
+ {
+ definedTags: ['jest-environment'],
+ },
+ ],
+ 'jsdoc/check-types': 2,
+ },
+};
diff --git a/packages/eslint-config-carbon/plugins/react.js b/packages/eslint-config-carbon/plugins/react.js
new file mode 100644
index 000000000000..7b4bbc9b2615
--- /dev/null
+++ b/packages/eslint-config-carbon/plugins/react.js
@@ -0,0 +1,81 @@
+/**
+ * Copyright IBM Corp. 2018, 2018
+ *
+ * This source code is licensed under the Apache-2.0 license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+'use strict';
+
+module.exports = {
+ extends: [
+ 'plugin:react/recommended',
+ 'plugin:react-hooks/recommended',
+ 'plugin:jsx-a11y/recommended',
+ ],
+ plugins: ['react', 'react-hooks'],
+ settings: {
+ react: {
+ version: 'detect',
+ },
+ },
+ parserOptions: {
+ ecmaFeatures: {
+ jsx: true,
+ },
+ },
+ rules: {
+ // react
+ 'react/jsx-uses-vars': 1,
+ 'react/jsx-uses-react': 1,
+ 'react/no-find-dom-node': 1,
+ 'react/jsx-no-useless-fragment': 2,
+ 'react/no-typos': 2,
+
+ // react-hooks
+ 'react-hooks/rules-of-hooks': 2,
+ 'react-hooks/exhaustive-deps': 2,
+ },
+ overrides: [
+ // Sometimes we'll want to define a quick component in a story to use as a
+ // wrapper for a component we're documenting. For example:
+ //
+ // function DemoComponent({ children }) {
+ // return
{children}
;
+ // }
+ //
+ // In these cases, we don't need to handle prop type validation like we
+ // would for code we ship to users.
+ {
+ files: ['*-story.js'],
+ rules: {
+ 'react/prop-types': 0,
+ },
+ },
+
+ // When writing fixtures, we tend to focus on the specific component and
+ // don't require React in scope as we never end up executing the code. The
+ // fixtures are often used for asserting transformations on the file
+ {
+ files: ['**/fixtures/**/*.js'],
+ rules: {
+ 'react/react-in-jsx-scope': 0,
+ },
+ },
+
+ {
+ files: ['*-test.js'],
+ rules: {
+ // We often write inline functions for certain types of props, typically
+ // `render*` props. For example, `renderIcon={() => test
}`
+ 'react/display-name': 0,
+
+ // While writing tests, we often write helper components that are meant
+ // to emulate a specific situation or behavior. These do not require prop
+ // types as they are not shipped to end-users and are not valuable for
+ // test authors.
+ 'react/prop-types': 0,
+ },
+ },
+ ],
+};
diff --git a/packages/icon-build-helpers/src/builders/react/components/__tests__/Icon-test.js b/packages/icon-build-helpers/src/builders/react/components/__tests__/Icon-test.js
index d9283a8e0b60..fc00dd472fac 100644
--- a/packages/icon-build-helpers/src/builders/react/components/__tests__/Icon-test.js
+++ b/packages/icon-build-helpers/src/builders/react/components/__tests__/Icon-test.js
@@ -92,7 +92,6 @@ describe('Icon', () => {
width={16}
height={16}
viewBox="0 0 16 16"
- tabIndex="0"
aria-label="Mock icon"
tabIndex="0">
diff --git a/packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap b/packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap
index c3b48c579528..1207c8b83880 100644
--- a/packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap
+++ b/packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap
@@ -68,6 +68,19 @@ Map {
},
"BreadcrumbItem" => Object {
"propTypes": Object {
+ "aria-current": Object {
+ "args": Array [
+ Array [
+ Object {
+ "type": "string",
+ },
+ Object {
+ "type": "bool",
+ },
+ ],
+ ],
+ "type": "oneOfType",
+ },
"children": Object {
"type": "node",
},
@@ -449,6 +462,9 @@ Map {
],
"type": "shape",
},
+ "helperText": Object {
+ "type": "string",
+ },
"id": Object {
"isRequired": true,
"type": "string",
@@ -521,6 +537,9 @@ Map {
],
"type": "oneOf",
},
+ "titleText": Object {
+ "type": "string",
+ },
"translateWithId": Object {
"type": "func",
},
@@ -541,12 +560,18 @@ Map {
"selectorPrimaryFocus": "[data-modal-primary-focus]",
},
"propTypes": Object {
+ "children": Object {
+ "type": "node",
+ },
"className": Object {
"type": "string",
},
"containerClassName": Object {
"type": "string",
},
+ "danger": Object {
+ "type": "bool",
+ },
"onClose": Object {
"type": "func",
},
@@ -559,6 +584,9 @@ Map {
"selectorPrimaryFocus": Object {
"type": "string",
},
+ "selectorsFloatingMenus": Object {
+ "type": "string",
+ },
"size": Object {
"args": Array [
Array [
@@ -615,6 +643,9 @@ Map {
"ModalBody" => Object {
"propTypes": Object {
"aria-label": [Function],
+ "children": Object {
+ "type": "node",
+ },
"className": Object {
"type": "string",
},
@@ -644,6 +675,26 @@ Map {
"danger": Object {
"type": "bool",
},
+ "inputref": Object {
+ "args": Array [
+ Array [
+ Object {
+ "type": "func",
+ },
+ Object {
+ "args": Array [
+ Object {
+ "current": Object {
+ "type": "any",
+ },
+ },
+ ],
+ "type": "shape",
+ },
+ ],
+ ],
+ "type": "oneOfType",
+ },
"onRequestClose": Object {
"type": "func",
},
@@ -716,6 +767,9 @@ Map {
"feedbackTimeout": Object {
"type": "number",
},
+ "onAnimationEnd": Object {
+ "type": "func",
+ },
"onClick": Object {
"type": "func",
},
@@ -754,6 +808,9 @@ Map {
"overflowMenuOnHover": true,
},
"propTypes": Object {
+ "children": Object {
+ "type": "node",
+ },
"className": Object {
"type": "string",
},
@@ -897,6 +954,9 @@ Map {
"description": Object {
"type": "node",
},
+ "stickyHeader": Object {
+ "type": "bool",
+ },
"title": Object {
"type": "node",
},
@@ -911,6 +971,9 @@ Map {
"className": Object {
"type": "string",
},
+ "enableExpando": Object {
+ "type": "bool",
+ },
"expandIconDescription": Object {
"type": "string",
},
@@ -943,6 +1006,9 @@ Map {
"isRequired": true,
"type": "bool",
},
+ "isSelected": Object {
+ "type": "bool",
+ },
"onExpand": Object {
"isRequired": true,
"type": "func",
@@ -1026,6 +1092,9 @@ Map {
"className": Object {
"type": "string",
},
+ "isSelected": Object {
+ "type": "bool",
+ },
},
},
"TableSelectAll": Object {
@@ -1044,6 +1113,9 @@ Map {
"className": Object {
"type": "string",
},
+ "disabled": Object {
+ "type": "bool",
+ },
"id": Object {
"isRequired": true,
"type": "string",
@@ -1188,9 +1260,15 @@ Map {
"className": Object {
"type": "string",
},
+ "defaultExpanded": Object {
+ "type": "bool",
+ },
"defaultValue": Object {
"type": "string",
},
+ "expanded": Object {
+ "type": "bool",
+ },
"id": Object {
"type": "string",
},
@@ -1200,6 +1278,9 @@ Map {
"onChange": Object {
"type": "func",
},
+ "onExpand": Object {
+ "type": "func",
+ },
"persistant": [Function],
"persistent": Object {
"type": "bool",
@@ -1207,7 +1288,7 @@ Map {
"placeHolderText": Object {
"type": "string",
},
- "searchContainerClasses": Object {
+ "searchContainerClass": Object {
"type": "string",
},
"tabIndex": Object {
@@ -1300,6 +1381,9 @@ Map {
"isRequired": true,
"type": "arrayOf",
},
+ "shouldShowBorder": Object {
+ "type": "bool",
+ },
"size": Object {
"args": Array [
Array [
@@ -1320,6 +1404,12 @@ Map {
"translateWithId": Object {
"type": "func",
},
+ "useStaticWidth": Object {
+ "type": "bool",
+ },
+ "useZebraStyles": Object {
+ "type": "bool",
+ },
},
"translationKeys": Array [
"carbon.table.row.expand",
@@ -1338,6 +1428,9 @@ Map {
"overflowMenuOnHover": true,
},
"propTypes": Object {
+ "children": Object {
+ "type": "node",
+ },
"className": Object {
"type": "string",
},
@@ -1481,6 +1574,9 @@ Map {
"description": Object {
"type": "node",
},
+ "stickyHeader": Object {
+ "type": "bool",
+ },
"title": Object {
"type": "node",
},
@@ -1495,6 +1591,9 @@ Map {
"className": Object {
"type": "string",
},
+ "enableExpando": Object {
+ "type": "bool",
+ },
"expandIconDescription": Object {
"type": "string",
},
@@ -1527,6 +1626,9 @@ Map {
"isRequired": true,
"type": "bool",
},
+ "isSelected": Object {
+ "type": "bool",
+ },
"onExpand": Object {
"isRequired": true,
"type": "func",
@@ -1610,6 +1712,9 @@ Map {
"className": Object {
"type": "string",
},
+ "isSelected": Object {
+ "type": "bool",
+ },
},
},
"TableSelectAll" => Object {
@@ -1628,6 +1733,9 @@ Map {
"className": Object {
"type": "string",
},
+ "disabled": Object {
+ "type": "bool",
+ },
"id": Object {
"isRequired": true,
"type": "string",
@@ -1737,9 +1845,15 @@ Map {
"className": Object {
"type": "string",
},
+ "defaultExpanded": Object {
+ "type": "bool",
+ },
"defaultValue": Object {
"type": "string",
},
+ "expanded": Object {
+ "type": "bool",
+ },
"id": Object {
"type": "string",
},
@@ -1749,6 +1863,9 @@ Map {
"onChange": Object {
"type": "func",
},
+ "onExpand": Object {
+ "type": "func",
+ },
"persistant": [Function],
"persistent": Object {
"type": "bool",
@@ -1756,7 +1873,7 @@ Map {
"placeHolderText": Object {
"type": "string",
},
- "searchContainerClasses": Object {
+ "searchContainerClass": Object {
"type": "string",
},
"tabIndex": Object {
@@ -1968,9 +2085,22 @@ Map {
"type": "text",
},
"propTypes": Object {
+ "datePickerType": Object {
+ "args": Array [
+ Array [
+ "simple",
+ "single",
+ "range",
+ ],
+ ],
+ "type": "oneOf",
+ },
"disabled": Object {
"type": "bool",
},
+ "hideLabel": Object {
+ "type": "bool",
+ },
"iconDescription": Object {
"type": "string",
},
@@ -1981,6 +2111,9 @@ Map {
"invalid": Object {
"type": "bool",
},
+ "invalidText": Object {
+ "type": "string",
+ },
"labelText": Object {
"isRequired": true,
"type": "node",
@@ -1991,7 +2124,13 @@ Map {
"onClick": Object {
"type": "func",
},
+ "openCalendar": Object {
+ "type": "func",
+ },
"pattern": [Function],
+ "placeholder": Object {
+ "type": "string",
+ },
"size": Object {
"args": Array [
Array [
@@ -2021,6 +2160,9 @@ Map {
"ariaLabel": Object {
"type": "string",
},
+ "className": Object {
+ "type": "string",
+ },
"direction": Object {
"args": Array [
Array [
@@ -2276,6 +2418,9 @@ Map {
"iconDescription": Object {
"type": "string",
},
+ "invalid": Object {
+ "type": "bool",
+ },
"status": Object {
"args": Array [
Array [
@@ -2433,6 +2578,16 @@ Map {
"onDelete": Object {
"type": "func",
},
+ "size": Object {
+ "args": Array [
+ Array [
+ "default",
+ "field",
+ "small",
+ ],
+ ],
+ "type": "oneOf",
+ },
"status": Object {
"args": Array [
Array [
@@ -2776,6 +2931,9 @@ Map {
"iconTitle": Object {
"type": "string",
},
+ "name": Object {
+ "type": "string",
+ },
"role": Object {
"type": "string",
},
@@ -3027,6 +3185,9 @@ Map {
"modalText": Object {
"type": "string",
},
+ "onKeyDown": Object {
+ "type": "func",
+ },
"passiveModal": Object {
"type": "bool",
},
@@ -3049,6 +3210,9 @@ Map {
"secondaryButtonText": Object {
"type": "string",
},
+ "selectorPrimaryFocus": Object {
+ "type": "string",
+ },
"shouldCloseAfterSubmit": Object {
"type": "bool",
},
@@ -3793,12 +3957,18 @@ Map {
"disabled": Object {
"type": "bool",
},
+ "handleOverflowMenuItemFocus": Object {
+ "type": "func",
+ },
"hasDivider": Object {
"type": "bool",
},
"href": Object {
"type": "string",
},
+ "index": Object {
+ "type": "number",
+ },
"isDelete": Object {
"type": "bool",
},
@@ -4118,6 +4288,9 @@ Map {
"light": Object {
"type": "bool",
},
+ "onChange": Object {
+ "type": "func",
+ },
"placeHolderText": Object {
"type": "string",
},
@@ -4394,6 +4567,9 @@ Map {
"inputType": Object {
"type": "string",
},
+ "invalid": Object {
+ "type": "bool",
+ },
"labelText": Object {
"type": "node",
},
@@ -4423,6 +4599,9 @@ Map {
"onRelease": Object {
"type": "func",
},
+ "required": Object {
+ "type": "bool",
+ },
"step": Object {
"type": "number",
},
@@ -4740,6 +4919,9 @@ Map {
"filter": Object {
"type": "bool",
},
+ "id": Object {
+ "type": "string",
+ },
"onClose": Object {
"type": "func",
},
@@ -5192,6 +5374,12 @@ Map {
"className": Object {
"type": "string",
},
+ "handleClick": Object {
+ "type": "func",
+ },
+ "handleKeyDown": Object {
+ "type": "func",
+ },
"href": Object {
"type": "string",
},
@@ -5221,6 +5409,12 @@ Map {
"className": Object {
"type": "string",
},
+ "handleClick": Object {
+ "type": "func",
+ },
+ "handleKeyDown": Object {
+ "type": "func",
+ },
"iconDescription": [Function],
"id": Object {
"type": "string",
@@ -5281,6 +5475,9 @@ Map {
"expanded": Object {
"type": "bool",
},
+ "handleClick": Object {
+ "type": "func",
+ },
"id": Object {
"type": "string",
},
@@ -5325,6 +5522,9 @@ Map {
"checked": Object {
"type": "bool",
},
+ "children": Object {
+ "type": "node",
+ },
"className": Object {
"type": "string",
},
@@ -5556,6 +5756,9 @@ Map {
"labelText": Object {
"type": "string",
},
+ "onChange": Object {
+ "type": "func",
+ },
"onToggle": Object {
"type": "func",
},
@@ -5597,6 +5800,9 @@ Map {
"labelText": Object {
"type": "string",
},
+ "onChange": Object {
+ "type": "func",
+ },
"onToggle": Object {
"type": "func",
},
@@ -5672,12 +5878,18 @@ Map {
"id": Object {
"type": "string",
},
+ "labelId": Object {
+ "type": "string",
+ },
"labelText": Object {
"type": "node",
},
"placeHolderText": Object {
"type": "string",
},
+ "role": Object {
+ "type": "string",
+ },
"small": Object {
"type": "bool",
},
@@ -5710,6 +5922,9 @@ Map {
"isRequired": true,
"type": "string",
},
+ "className": Object {
+ "type": "string",
+ },
"direction": Object {
"args": Array [
Array [
@@ -5722,6 +5937,15 @@ Map {
"id": Object {
"type": "string",
},
+ "onFocus": Object {
+ "type": "func",
+ },
+ "onMouseEnter": Object {
+ "type": "func",
+ },
+ "onMouseLeave": Object {
+ "type": "func",
+ },
"tooltipText": Object {
"isRequired": true,
"type": "node",
@@ -5751,6 +5975,9 @@ Map {
"isRequired": true,
"type": "node",
},
+ "className": Object {
+ "type": "string",
+ },
"direction": Object {
"args": Array [
Array [
@@ -5765,6 +5992,12 @@ Map {
"id": Object {
"type": "string",
},
+ "onFocus": Object {
+ "type": "func",
+ },
+ "onMouseEnter": Object {
+ "type": "func",
+ },
"tooltipText": Object {
"isRequired": true,
"type": "string",
@@ -6137,6 +6370,9 @@ Map {
"className": Object {
"type": "string",
},
+ "id": Object {
+ "type": "string",
+ },
"range": Object {
"type": "bool",
},
@@ -6441,6 +6677,9 @@ Map {
"hasDivider": false,
},
"propTypes": Object {
+ "children": Object {
+ "type": "node",
+ },
"className": Object {
"type": "string",
},
@@ -6497,6 +6736,9 @@ Map {
"isRequired": true,
"type": "string",
},
+ "className": Object {
+ "type": "string",
+ },
"href": Object {
"isRequired": true,
"type": "string",
@@ -6579,6 +6821,9 @@ Map {
"isRequired": true,
"type": "string",
},
+ "className": Object {
+ "type": "string",
+ },
"expanded": Object {
"isRequired": true,
"type": "bool",
@@ -6594,6 +6839,9 @@ Map {
},
"SideNavHeader" => Object {
"propTypes": Object {
+ "children": Object {
+ "type": "node",
+ },
"className": Object {
"type": "string",
},
diff --git a/packages/react/src/components/Breadcrumb/BreadcrumbItem.js b/packages/react/src/components/Breadcrumb/BreadcrumbItem.js
index 6310cabad87b..3c01f1a22813 100644
--- a/packages/react/src/components/Breadcrumb/BreadcrumbItem.js
+++ b/packages/react/src/components/Breadcrumb/BreadcrumbItem.js
@@ -51,6 +51,8 @@ const BreadcrumbItem = ({
};
BreadcrumbItem.propTypes = {
+ 'aria-current': PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
+
/**
* Pass in content that will be inside of the BreadcrumbItem
*/
diff --git a/packages/react/src/components/Checkbox/Checkbox-story.js b/packages/react/src/components/Checkbox/Checkbox-story.js
index 87e8b1850777..60319cc474f5 100644
--- a/packages/react/src/components/Checkbox/Checkbox-story.js
+++ b/packages/react/src/components/Checkbox/Checkbox-story.js
@@ -79,7 +79,7 @@ storiesOf('Checkbox', module)
aria-label="loading checkbox"
aria-live="assertive"
role="status"
- tabindex="0" // eslint-disable-line jsx-a11y/no-noninteractive-tabindex
+ tabIndex="0" // eslint-disable-line jsx-a11y/no-noninteractive-tabindex
>
diff --git a/packages/react/src/components/ComboBox/ComboBox.js b/packages/react/src/components/ComboBox/ComboBox.js
index 11c6b28d02af..e71be91f083b 100644
--- a/packages/react/src/components/ComboBox/ComboBox.js
+++ b/packages/react/src/components/ComboBox/ComboBox.js
@@ -180,6 +180,9 @@ export default class ComboBox extends React.Component {
* Specify the direction of the combobox dropdown. Can be either top or bottom.
*/
direction: PropTypes.oneOf(['top', 'bottom']),
+
+ titleText: PropTypes.string,
+ helperText: PropTypes.string,
};
static defaultProps = {
diff --git a/packages/react/src/components/ComposedModal/ComposedModal-story.js b/packages/react/src/components/ComposedModal/ComposedModal-story.js
index b9619bc20e6f..65aeb6576a92 100644
--- a/packages/react/src/components/ComposedModal/ComposedModal-story.js
+++ b/packages/react/src/components/ComposedModal/ComposedModal-story.js
@@ -141,7 +141,7 @@ storiesOf('ComposedModal', module)
const { size, ...rest } = props.composedModal();
const { hasScrollingContent, ...bodyProps } = props.modalBody();
return (
-
+
+ ref={inputref}>
{primaryButtonText}
)}
diff --git a/packages/react/src/components/Copy/Copy.js b/packages/react/src/components/Copy/Copy.js
index 9c1ef3534b42..812e056c5f19 100644
--- a/packages/react/src/components/Copy/Copy.js
+++ b/packages/react/src/components/Copy/Copy.js
@@ -28,12 +28,14 @@ export default function Copy({
[`${prefix}--copy-btn--animating`]: animation,
[`${prefix}--copy-btn--${animation}`]: animation,
});
+ // eslint-disable-next-line react-hooks/exhaustive-deps
const handleFadeOut = useCallback(
debounce(() => {
setAnimation('fade-out');
}, feedbackTimeout),
[feedbackTimeout]
);
+
const handleClick = useCallback(() => {
setAnimation('fade-in');
handleFadeOut();
@@ -99,6 +101,12 @@ Copy.propTypes = {
* is clicked
*/
onClick: PropTypes.func,
+
+ /**
+ * Specify an optional `onAnimationEnd` handler that is called when the underlying
+ * animation ends
+ */
+ onAnimationEnd: PropTypes.func,
};
Copy.defaultProps = {
diff --git a/packages/react/src/components/DataTable/DataTable.js b/packages/react/src/components/DataTable/DataTable.js
index 754b81406654..8ab45b042f8a 100644
--- a/packages/react/src/components/DataTable/DataTable.js
+++ b/packages/react/src/components/DataTable/DataTable.js
@@ -130,6 +130,21 @@ export default class DataTable extends React.Component {
* Specify whether the overflow menu (if it exists) should be shown always, or only on hover
*/
overflowMenuOnHover: PropTypes.bool,
+
+ /**
+ * `true` to add useZebraStyles striping.
+ */
+ useZebraStyles: PropTypes.bool,
+
+ /**
+ * `false` If true, will use a width of 'auto' instead of 100%
+ */
+ useStaticWidth: PropTypes.bool,
+
+ /**
+ * `false` If true, will remove the table border
+ */
+ shouldShowBorder: PropTypes.bool,
};
static defaultProps = {
@@ -239,7 +254,9 @@ export default class DataTable extends React.Component {
onExpand: composeEventHandlers([
this.handleOnExpandAll,
onClick
- ? this.handleOnExpandHeaderClick(onClick, { isExpanded })
+ ? this.handleOnExpandHeaderClick(onClick, {
+ isExpanded,
+ })
: null,
]),
};
@@ -619,6 +636,7 @@ export default class DataTable extends React.Component {
};
render() {
+ // eslint-disable-next-line react/prop-types
const { children, filterRows, headers, render } = this.props;
const { filterInputValue, rowIds, rowsById, cellsById } = this.state;
const filteredRowIds =
diff --git a/packages/react/src/components/DataTable/Table.js b/packages/react/src/components/DataTable/Table.js
index c6c1ca81c637..a3c1398a546e 100644
--- a/packages/react/src/components/DataTable/Table.js
+++ b/packages/react/src/components/DataTable/Table.js
@@ -86,6 +86,11 @@ Table.propTypes = {
* Specify whether the overflow menu (if it exists) should be shown always, or only on hover
*/
overflowMenuOnHover: PropTypes.bool,
+
+ /**
+ * Pass in the children that will be rendered within the Table
+ */
+ children: PropTypes.node,
};
Table.defaultProps = {
diff --git a/packages/react/src/components/DataTable/TableContainer.js b/packages/react/src/components/DataTable/TableContainer.js
index 54bad0b7bf65..8c6da2f25f1a 100644
--- a/packages/react/src/components/DataTable/TableContainer.js
+++ b/packages/react/src/components/DataTable/TableContainer.js
@@ -55,6 +55,11 @@ TableContainer.propTypes = {
* Optional description text for the Table
*/
description: PropTypes.node,
+
+ /**
+ * Specify whether the table should have a sticky header
+ */
+ stickyHeader: PropTypes.bool,
};
export default TableContainer;
diff --git a/packages/react/src/components/DataTable/TableExpandHeader.js b/packages/react/src/components/DataTable/TableExpandHeader.js
index a1f37d6d0550..dcbb95f1eedd 100644
--- a/packages/react/src/components/DataTable/TableExpandHeader.js
+++ b/packages/react/src/components/DataTable/TableExpandHeader.js
@@ -54,6 +54,11 @@ TableExpandHeader.propTypes = {
className: PropTypes.string,
children: PropTypes.node,
+ /**
+ * Specify whether an expand all button should be displayed
+ */
+ enableExpando: PropTypes.bool,
+
/**
* Specify the string read by a voice reader when the expand trigger is
* focused
diff --git a/packages/react/src/components/DataTable/TableExpandRow.js b/packages/react/src/components/DataTable/TableExpandRow.js
index 29c6b36d7797..dcfe773da760 100644
--- a/packages/react/src/components/DataTable/TableExpandRow.js
+++ b/packages/react/src/components/DataTable/TableExpandRow.js
@@ -71,6 +71,11 @@ TableExpandRow.propTypes = {
*/
isExpanded: PropTypes.bool.isRequired,
+ /**
+ * Specify if the row is selected
+ */
+ isSelected: PropTypes.bool,
+
/**
* Hook for when a listener initiates a request to expand the given row
*/
diff --git a/packages/react/src/components/DataTable/TableRow.js b/packages/react/src/components/DataTable/TableRow.js
index 925709a05234..46fd1e54a07a 100644
--- a/packages/react/src/components/DataTable/TableRow.js
+++ b/packages/react/src/components/DataTable/TableRow.js
@@ -31,6 +31,11 @@ TableRow.propTypes = {
* Specify an optional className to be applied to the container node
*/
className: PropTypes.string,
+
+ /**
+ * Specify if the row is selected
+ */
+ isSelected: PropTypes.bool,
};
export default TableRow;
diff --git a/packages/react/src/components/DataTable/TableSelectAll.js b/packages/react/src/components/DataTable/TableSelectAll.js
index ff1b1af45e70..3e8272efaa7b 100644
--- a/packages/react/src/components/DataTable/TableSelectAll.js
+++ b/packages/react/src/components/DataTable/TableSelectAll.js
@@ -72,6 +72,11 @@ TableSelectAll.propTypes = {
* The CSS class names of the cell that wraps the underlying input control
*/
className: PropTypes.string,
+
+ /**
+ * Specify whether the checkbox input should be disabled
+ */
+ disabled: PropTypes.bool,
};
TableSelectAll.defaultProps = {
diff --git a/packages/react/src/components/DataTable/TableToolbarSearch.js b/packages/react/src/components/DataTable/TableToolbarSearch.js
index 6dc775556670..92b934f5165e 100644
--- a/packages/react/src/components/DataTable/TableToolbarSearch.js
+++ b/packages/react/src/components/DataTable/TableToolbarSearch.js
@@ -101,9 +101,11 @@ const TableToolbarSearch = ({
};
return (
+ // eslint-disable-next-line jsx-a11y/no-static-element-interactions
onClick(event)}
onClick={(event) => onClick(event)}
onFocus={(event) => handleExpand(event, true)}
onBlur={(event) => !value && handleExpand(event, false)}
@@ -142,7 +144,22 @@ TableToolbarSearch.propTypes = {
/**
* Provide an optional className for the overal container of the Search
*/
- searchContainerClasses: PropTypes.string,
+ searchContainerClass: PropTypes.string,
+
+ /**
+ * Specifies if the search should expand
+ */
+ expanded: PropTypes.bool,
+
+ /**
+ * Specifies if the search should initially render in an expanded state
+ */
+ defaultExpanded: PropTypes.bool,
+
+ /**
+ * Provide an optional hook that is called each time the input is expanded
+ */
+ onExpand: PropTypes.func,
/**
* Provide an optional hook that is called each time the input is updated
diff --git a/packages/react/src/components/DataTable/__tests__/DataTable-test.js b/packages/react/src/components/DataTable/__tests__/DataTable-test.js
index aabcbd2a0638..cb558fabac5c 100644
--- a/packages/react/src/components/DataTable/__tests__/DataTable-test.js
+++ b/packages/react/src/components/DataTable/__tests__/DataTable-test.js
@@ -121,8 +121,8 @@ describe('DataTable', () => {
- {headers.map((header) => (
-
+ {headers.map((header, i) => (
+
{header.header}
))}
@@ -254,8 +254,8 @@ describe('DataTable', () => {
- {headers.map((header) => (
-
+ {headers.map((header, i) => (
+
{header.header}
))}
@@ -409,8 +409,8 @@ describe('DataTable', () => {
- {headers.map((header) => (
-
+ {headers.map((header, i) => (
+
{header.header}
))}
@@ -555,8 +555,8 @@ describe('DataTable', () => {
- {headers.map((header) => (
-
+ {headers.map((header, i) => (
+
{header.header}
))}
@@ -707,8 +707,8 @@ describe('DataTable', () => {
- {headers.map((header) => (
-
+ {headers.map((header, i) => (
+
{header.header}
))}
diff --git a/packages/react/src/components/DataTable/__tests__/__snapshots__/DataTable-test.js.snap b/packages/react/src/components/DataTable/__tests__/__snapshots__/DataTable-test.js.snap
index f2d7d5787248..3989650e79b7 100644
--- a/packages/react/src/components/DataTable/__tests__/__snapshots__/DataTable-test.js.snap
+++ b/packages/react/src/components/DataTable/__tests__/__snapshots__/DataTable-test.js.snap
@@ -2261,6 +2261,7 @@ exports[`DataTable should render 1`] = `
onBlur={[Function]}
onClick={[Function]}
onFocus={[Function]}
+ onKeyDown={[Function]}
tabIndex="0"
>
(
+const DefaultStory = (props) => (
(
- {headers.map((header) => (
-
+ {headers.map((header, i) => (
+
{header.header}
))}
- {rows.map((row) => (
-
+ {rows.map((row, i) => (
+
{row.cells.map((cell) => (
{cell.value}
))}
@@ -59,3 +59,5 @@ export default (props) => (
)}
/>
);
+
+export default DefaultStory;
diff --git a/packages/react/src/components/DataTable/stories/with-batch-actions.js b/packages/react/src/components/DataTable/stories/with-batch-actions.js
index 2aad064732f7..bc148e40c0c2 100644
--- a/packages/react/src/components/DataTable/stories/with-batch-actions.js
+++ b/packages/react/src/components/DataTable/stories/with-batch-actions.js
@@ -35,7 +35,7 @@ import DataTable, {
import { batchActionClick, initialRows, headers } from './shared';
-export default (props) => (
+const TableBatchActionsStory = (props) => (
(
@@ -108,16 +109,16 @@ export default (props) => (
- {headers.map((header) => (
-
+ {headers.map((header, i) => (
+
{header.header}
))}
- {rows.map((row) => (
-
+ {rows.map((row, i) => (
+
{row.cells.map((cell) => (
{cell.value}
@@ -130,3 +131,5 @@ export default (props) => (
)}
/>
);
+
+export default TableBatchActionsStory;
diff --git a/packages/react/src/components/DataTable/stories/with-batch-expansion.js b/packages/react/src/components/DataTable/stories/with-batch-expansion.js
index ae948d5f4ddb..c6e9f0936102 100644
--- a/packages/react/src/components/DataTable/stories/with-batch-expansion.js
+++ b/packages/react/src/components/DataTable/stories/with-batch-expansion.js
@@ -21,7 +21,7 @@ import DataTable, {
import { initialRows, headers } from './shared';
import './with-expansion-story.scss';
-export default (props) => (
+const BatchExpansionStory = (props) => (
(
enableExpando={true}
{...getExpandHeaderProps()}
/>
- {headers.map((header) => (
-
+ {headers.map((header, i) => (
+
{header.header}
))}
@@ -75,3 +75,5 @@ export default (props) => (
)}
/>
);
+
+export default BatchExpansionStory;
diff --git a/packages/react/src/components/DataTable/stories/with-boolean-column.js b/packages/react/src/components/DataTable/stories/with-boolean-column.js
index ee8df1123268..89d6d50aa69f 100644
--- a/packages/react/src/components/DataTable/stories/with-boolean-column.js
+++ b/packages/react/src/components/DataTable/stories/with-boolean-column.js
@@ -81,7 +81,7 @@ export const headers = [
},
];
-export default (props) => (
+const BooleanColumnStory = (props) => (
(
- {headers.map((header) => (
-
+ {headers.map((header, i) => (
+
{header.header}
))}
- {rows.map((row) => (
-
+ {rows.map((row, i) => (
+
{row.cells.map((cell) => {
if (cell.info.header === 'enabled') {
return (
@@ -122,6 +122,7 @@ export default (props) => (
id={'check-' + cell.id}
checked={cell.value}
hideLabel
+ labelText="checkbox"
/>
);
@@ -137,3 +138,5 @@ export default (props) => (
)}
/>
);
+
+export default BooleanColumnStory;
diff --git a/packages/react/src/components/DataTable/stories/with-dynamic-content.js b/packages/react/src/components/DataTable/stories/with-dynamic-content.js
index 146b716b400f..b9f383bbc9cf 100644
--- a/packages/react/src/components/DataTable/stories/with-dynamic-content.js
+++ b/packages/react/src/components/DataTable/stories/with-dynamic-content.js
@@ -36,7 +36,7 @@ import DataTable, {
import { batchActionClick, initialRows, headers } from './shared';
import './with-dynamic-content-story.scss';
-export default (props) => {
+const DynamicContentStory = (props) => {
const insertInRandomPosition = (array, element) => {
const index = Math.floor(Math.random() * (array.length + 1));
return [...array.slice(0, index), element, ...array.slice(index)];
@@ -160,8 +160,8 @@ export default (props) => {
- {headers.map((header) => (
-
+ {headers.map((header, i) => (
+
{header.header}
))}
@@ -194,3 +194,5 @@ export default (props) => {
}
return ;
};
+
+export default DynamicContentStory;
diff --git a/packages/react/src/components/DataTable/stories/with-expansion.js b/packages/react/src/components/DataTable/stories/with-expansion.js
index 70962b7bd55c..0c9782b39dee 100644
--- a/packages/react/src/components/DataTable/stories/with-expansion.js
+++ b/packages/react/src/components/DataTable/stories/with-expansion.js
@@ -22,7 +22,7 @@ import DataTable, {
} from '../../DataTable';
import { initialRows, headers } from './shared';
-export default (props) => (
+const ExpansionStory = (props) => (
(
- {headers.map((header) => (
-
+ {headers.map((header, i) => (
+
{header.header}
))}
@@ -72,3 +72,5 @@ export default (props) => (
)}
/>
);
+
+export default ExpansionStory;
diff --git a/packages/react/src/components/DataTable/stories/with-options.js b/packages/react/src/components/DataTable/stories/with-options.js
index 0619f2ddf87c..2d3d17d11d94 100644
--- a/packages/react/src/components/DataTable/stories/with-options.js
+++ b/packages/react/src/components/DataTable/stories/with-options.js
@@ -23,7 +23,7 @@ import DataTable, {
import { headers, initialRows } from './shared';
import './with-expansion-story.scss';
-export default (props) => (
+const OptionsStory = (props) => (
(
- {headers.map((header) => (
-
+ {headers.map((header, i) => (
+
{header.header}
))}
@@ -80,3 +80,5 @@ export default (props) => (
)}
/>
);
+
+export default OptionsStory;
diff --git a/packages/react/src/components/DataTable/stories/with-overflow-menu.js b/packages/react/src/components/DataTable/stories/with-overflow-menu.js
index e0b61f4c3205..2831febe616a 100644
--- a/packages/react/src/components/DataTable/stories/with-overflow-menu.js
+++ b/packages/react/src/components/DataTable/stories/with-overflow-menu.js
@@ -20,7 +20,7 @@ import DataTable, {
} from '../../DataTable';
import { initialRows, headers } from './shared';
-export default (props) => (
+const OverflowMenuStory = (props) => (
(
- {headers.map((header) => (
-
+ {headers.map((header, i) => (
+
{header.header}
))}
@@ -47,8 +47,8 @@ export default (props) => (
- {rows.map((row) => (
-
+ {rows.map((row, i) => (
+
{row.cells.map((cell) => (
{cell.value}
@@ -68,3 +68,5 @@ export default (props) => (
)}
/>
);
+
+export default OverflowMenuStory;
diff --git a/packages/react/src/components/DataTable/stories/with-selection--radio.js b/packages/react/src/components/DataTable/stories/with-selection--radio.js
index c27b6433f8f8..0a557fb8ba87 100644
--- a/packages/react/src/components/DataTable/stories/with-selection--radio.js
+++ b/packages/react/src/components/DataTable/stories/with-selection--radio.js
@@ -18,7 +18,7 @@ import DataTable, {
} from '..';
import { initialRows, headers } from './shared';
-export default (props) => (
+const SelectionRadioStory = (props) => (
(
- {headers.map((header) => (
-
+ {headers.map((header, i) => (
+
{header.header}
))}
- {rows.map((row) => (
-
+ {rows.map((row, i) => (
+
{row.cells.map((cell) => (
{cell.value}
@@ -63,3 +63,5 @@ export default (props) => (
)}
/>
);
+
+export default SelectionRadioStory;
diff --git a/packages/react/src/components/DataTable/stories/with-selection.js b/packages/react/src/components/DataTable/stories/with-selection.js
index 447b0ff7d577..1c8dafe66eaa 100644
--- a/packages/react/src/components/DataTable/stories/with-selection.js
+++ b/packages/react/src/components/DataTable/stories/with-selection.js
@@ -19,7 +19,7 @@ import DataTable, {
} from '../../DataTable';
import { initialRows, headers } from './shared';
-export default (props) => (
+const SelectionStory = (props) => (
(
- {headers.map((header) => (
-
+ {headers.map((header, i) => (
+
{header.header}
))}
- {rows.map((row) => (
-
+ {rows.map((row, i) => (
+
{row.cells.map((cell) => (
{cell.value}
@@ -63,3 +63,5 @@ export default (props) => (
)}
/>
);
+
+export default SelectionStory;
diff --git a/packages/react/src/components/DataTable/stories/with-sorting.js b/packages/react/src/components/DataTable/stories/with-sorting.js
index 666a0597d836..ebf904b3931d 100644
--- a/packages/react/src/components/DataTable/stories/with-sorting.js
+++ b/packages/react/src/components/DataTable/stories/with-sorting.js
@@ -17,7 +17,7 @@ import DataTable, {
} from '../../DataTable';
import { initialRows, headers } from './shared';
-export default (props) => (
+const SortingStory = (props) => (
(
- {headers.map((header) => (
-
+ {headers.map((header, i) => (
+
{header.header}
))}
- {rows.map((row) => (
-
+ {rows.map((row, i) => (
+
{row.cells.map((cell) => (
{cell.value}
))}
@@ -59,3 +61,5 @@ export default (props) => (
)}
/>
);
+
+export default SortingStory;
diff --git a/packages/react/src/components/DataTable/stories/with-toolbar.js b/packages/react/src/components/DataTable/stories/with-toolbar.js
index 6bb56986ab78..08788d2fa4a8 100644
--- a/packages/react/src/components/DataTable/stories/with-toolbar.js
+++ b/packages/react/src/components/DataTable/stories/with-toolbar.js
@@ -25,7 +25,7 @@ import DataTable, {
import { initialRows, headers } from './shared';
-export default (props) => (
+const ToolbarStory = (props) => (
(
- {headers.map((header) => (
-
+ {headers.map((header, i) => (
+
{header.header}
))}
- {rows.map((row) => (
-
+ {rows.map((row, i) => (
+
{row.cells.map((cell) => (
{cell.value}
))}
@@ -87,3 +87,5 @@ export default (props) => (
)}
/>
);
+
+export default ToolbarStory;
diff --git a/packages/react/src/components/DatePicker/DatePicker-story.js b/packages/react/src/components/DatePicker/DatePicker-story.js
index 3d951d3f096a..86b6ecb9418f 100644
--- a/packages/react/src/components/DatePicker/DatePicker-story.js
+++ b/packages/react/src/components/DatePicker/DatePicker-story.js
@@ -103,7 +103,10 @@ storiesOf('DatePicker', module)
'The date format (dateFormat in )',
'm/d/Y'
)}>
-
+ console.log('click')}
+ {...props.datePickerInput()}
+ />
),
{
diff --git a/packages/react/src/components/DatePicker/DatePicker.Skeleton.js b/packages/react/src/components/DatePicker/DatePicker.Skeleton.js
index 9bba2a4df372..2b6ec619ac1c 100644
--- a/packages/react/src/components/DatePicker/DatePicker.Skeleton.js
+++ b/packages/react/src/components/DatePicker/DatePicker.Skeleton.js
@@ -68,6 +68,11 @@ DatePickerSkeleton.propTypes = {
* Specify an optional className to add.
*/
className: PropTypes.string,
+
+ /**
+ * Specify the id to add.
+ */
+ id: PropTypes.string,
};
export default DatePickerSkeleton;
diff --git a/packages/react/src/components/DatePickerInput/DatePickerInput.js b/packages/react/src/components/DatePickerInput/DatePickerInput.js
index 818ba3a8c82d..1cc7dde9d056 100644
--- a/packages/react/src/components/DatePickerInput/DatePickerInput.js
+++ b/packages/react/src/components/DatePickerInput/DatePickerInput.js
@@ -67,11 +67,40 @@ export default class DatePickerInput extends Component {
*/
invalid: PropTypes.bool,
+ /**
+ * Specify the text to be rendered when the input is invalid
+ */
+ invalidText: PropTypes.string,
+
+ /**
+ * Specify if the label should be hidden
+ */
+ hideLabel: PropTypes.bool,
+
+ /**
+ * Specify the placeholder text
+ */
+ placeholder: PropTypes.string,
+
+ /**
+ * The type of the date picker:
+ *
+ * * `simple` - Without calendar dropdown.
+ * * `single` - With calendar dropdown and single date.
+ * * `range` - With calendar dropdown and a date range.
+ */
+ datePickerType: PropTypes.oneOf(['simple', 'single', 'range']),
+
/**
* Provide a function to be called when the input field is clicked
*/
onClick: PropTypes.func,
+ /**
+ * Provide a function to be called when the input field is clicked
+ */
+ openCalendar: PropTypes.func,
+
/**
* Specify an `onChange` handler that is called whenever a change in the
* input field has occurred
diff --git a/packages/react/src/components/Dropdown/Dropdown.js b/packages/react/src/components/Dropdown/Dropdown.js
index 0d6614ce8dd9..312a37b69e65 100644
--- a/packages/react/src/components/Dropdown/Dropdown.js
+++ b/packages/react/src/components/Dropdown/Dropdown.js
@@ -181,6 +181,11 @@ Dropdown.propTypes = {
*/
disabled: PropTypes.bool,
+ /**
+ * Provide a custom className to be applied on the bx--dropdown node
+ */
+ className: PropTypes.string,
+
/**
* We try to stay as generic as possible here to allow individuals to pass
* in a collection of whatever kind of data structure they prefer
diff --git a/packages/react/src/components/FileUploader/FileUploaderButton.js b/packages/react/src/components/FileUploader/FileUploaderButton.js
index 5593cff83d53..4ae82cf2ba26 100644
--- a/packages/react/src/components/FileUploader/FileUploaderButton.js
+++ b/packages/react/src/components/FileUploader/FileUploaderButton.js
@@ -75,6 +75,7 @@ function FileUploaderButton({
return (
<>
+ {/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */}
+ {/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */}
*/
tabIndex: PropTypes.string,
+
+ /**
+ * Specify if the file is invalid
+ */
+ invalid: PropTypes.bool,
};
Filename.defaultProps = {
diff --git a/packages/react/src/components/FileUploader/stories/drop-container.js b/packages/react/src/components/FileUploader/stories/drop-container.js
index 147ceb95f532..164bf958dce7 100644
--- a/packages/react/src/components/FileUploader/stories/drop-container.js
+++ b/packages/react/src/components/FileUploader/stories/drop-container.js
@@ -14,7 +14,7 @@ import uid from '../../../tools/uniqueId';
const { prefix } = settings;
-function ExampleDropContainerApp(props) {
+const ExampleDropContainerApp = (props) => {
const [files, setFiles] = useState([]);
const handleDrop = (e) => {
e.preventDefault();
@@ -88,6 +88,7 @@ function ExampleDropContainerApp(props) {
status: 'uploading',
iconDescription: 'Uploading',
}));
+ // eslint-disable-next-line react/prop-types
if (props.multiple) {
setFiles([...files, ...newFiles]);
newFiles.forEach(uploadFile);
@@ -96,6 +97,7 @@ function ExampleDropContainerApp(props) {
uploadFile(newFiles[0]);
}
},
+ // eslint-disable-next-line react/prop-types
[files, props.multiple]
);
const handleFileUploaderItemClick = useCallback(
@@ -126,6 +128,7 @@ function ExampleDropContainerApp(props) {
uuid={uuid}
name={name}
filesize={filesize}
+ // eslint-disable-next-line react/prop-types
size={props.size}
status={status}
iconDescription={iconDescription}
@@ -138,6 +141,6 @@ function ExampleDropContainerApp(props) {
);
-}
+};
-export default (props) => ;
+export default ExampleDropContainerApp;
diff --git a/packages/react/src/components/Icon/Icon.js b/packages/react/src/components/Icon/Icon.js
index 019e4420f2a0..0221457dad10 100644
--- a/packages/react/src/components/Icon/Icon.js
+++ b/packages/react/src/components/Icon/Icon.js
@@ -81,7 +81,7 @@ export function svgShapes(svgData) {
key: `circle${index}`,
};
- return ;
+ return ;
});
} else if (svgProp === 'paths') {
return data.map((path, index) => (
@@ -158,6 +158,11 @@ Icon.propTypes = {
*/
className: PropTypes.string,
+ /**
+ * The name of the icon.
+ */
+ name: PropTypes.string,
+
/**
* The icon title.
*/
diff --git a/packages/react/src/components/InlineCheckbox/InlineCheckbox.js b/packages/react/src/components/InlineCheckbox/InlineCheckbox.js
index f9120d46dfee..b6010f0458bc 100644
--- a/packages/react/src/components/InlineCheckbox/InlineCheckbox.js
+++ b/packages/react/src/components/InlineCheckbox/InlineCheckbox.js
@@ -103,6 +103,7 @@ class InlineCheckbox extends React.Component {
onClick,
onKeyDown,
title = undefined,
+ // eslint-disable-next-line react/prop-types
innerRef: ref,
} = this.props;
const inputProps = {
diff --git a/packages/react/src/components/ListBox/ListBox.js b/packages/react/src/components/ListBox/ListBox.js
index 77bbd73a9392..01b461fa6924 100644
--- a/packages/react/src/components/ListBox/ListBox.js
+++ b/packages/react/src/components/ListBox/ListBox.js
@@ -54,6 +54,7 @@ const ListBox = React.forwardRef(function ListBox(
});
return (
<>
+ {/* eslint-disable-next-line jsx-a11y/no-static-element-interactions */}
{
const { size, ...rest } = titleOnlyProps();
- return (
- <>
-
- >
- );
+ return
;
},
{
info: {
@@ -207,25 +203,23 @@ storiesOf('Modal', module)
() => {
const { size, ...rest } = props();
return (
- <>
-
-
-
-
- >
+
+
+
+
);
},
{
diff --git a/packages/react/src/components/ModalWrapper/ModalWrapper-story.js b/packages/react/src/components/ModalWrapper/ModalWrapper-story.js
index c4c9df89e717..6d767c871060 100644
--- a/packages/react/src/components/ModalWrapper/ModalWrapper-story.js
+++ b/packages/react/src/components/ModalWrapper/ModalWrapper-story.js
@@ -31,9 +31,11 @@ const icons = {
const iconMap = {
iconAddSolid,
iconSearch,
+ // eslint-disable-next-line react/display-name
AddFilled16: (props) => (
),
+ // eslint-disable-next-line react/display-name
Search16: (props) => (
),
diff --git a/packages/react/src/components/ModalWrapper/ModalWrapper.js b/packages/react/src/components/ModalWrapper/ModalWrapper.js
index 6ef76f02d592..81cc0a08e7a7 100644
--- a/packages/react/src/components/ModalWrapper/ModalWrapper.js
+++ b/packages/react/src/components/ModalWrapper/ModalWrapper.js
@@ -36,6 +36,8 @@ export default class ModalWrapper extends React.Component {
triggerButtonIconDescription: PropTypes.string,
triggerButtonKind: PropTypes.oneOf(ButtonKinds),
shouldCloseAfterSubmit: PropTypes.bool,
+ onKeyDown: PropTypes.func,
+ selectorPrimaryFocus: PropTypes.string,
};
static defaultProps = {
diff --git a/packages/react/src/components/NumberInput/NumberInput-story.js b/packages/react/src/components/NumberInput/NumberInput-story.js
index 027ba0beed24..13d66f9346c0 100644
--- a/packages/react/src/components/NumberInput/NumberInput-story.js
+++ b/packages/react/src/components/NumberInput/NumberInput-story.js
@@ -89,7 +89,7 @@ storiesOf('NumberInput', module)
aria-label="loading number input"
aria-live="assertive"
role="status"
- tabindex="0" // eslint-disable-line jsx-a11y/no-noninteractive-tabindex
+ tabIndex="0" // eslint-disable-line jsx-a11y/no-noninteractive-tabindex
>
diff --git a/packages/react/src/components/NumberInput/NumberInput-test.js b/packages/react/src/components/NumberInput/NumberInput-test.js
index 92c4059010df..527445e48fbf 100644
--- a/packages/react/src/components/NumberInput/NumberInput-test.js
+++ b/packages/react/src/components/NumberInput/NumberInput-test.js
@@ -311,17 +311,11 @@ describe('NumberInput', () => {
it('renders children as expected', () => {
wrapper.setProps({
- helperText: (
-
- This helper text has a link .
-
- ),
+ helperText: This is helper text. ,
});
const renderedHelper = wrapper.find(`.${prefix}--form__helper-text`);
expect(renderedHelper.props().children).toEqual(
-
- This helper text has a link .
-
+ This is helper text.
);
});
diff --git a/packages/react/src/components/NumberInput/NumberInput.js b/packages/react/src/components/NumberInput/NumberInput.js
index fa8e9c0b0ebf..cb3db8deff52 100644
--- a/packages/react/src/components/NumberInput/NumberInput.js
+++ b/packages/react/src/components/NumberInput/NumberInput.js
@@ -282,6 +282,7 @@ class NumberInput extends Component {
ariaLabel,
light,
allowEmpty,
+ // eslint-disable-next-line react/prop-types
innerRef: ref,
translateWithId: t,
isMobile,
diff --git a/packages/react/src/components/OverflowMenu/OverflowMenu-story.js b/packages/react/src/components/OverflowMenu/OverflowMenu-story.js
index 4c2c7e9a7732..c6e64e169958 100644
--- a/packages/react/src/components/OverflowMenu/OverflowMenu-story.js
+++ b/packages/react/src/components/OverflowMenu/OverflowMenu-story.js
@@ -143,6 +143,7 @@ storiesOf('OverflowMenu', module)
...props.menu(),
ariaLabel: null,
style: { width: 'auto' },
+ // eslint-disable-next-line react/display-name
renderIcon: () => Menu
,
}}>
diff --git a/packages/react/src/components/OverflowMenu/OverflowMenu.js b/packages/react/src/components/OverflowMenu/OverflowMenu.js
index 5b83b9bd913f..764421ef0abb 100644
--- a/packages/react/src/components/OverflowMenu/OverflowMenu.js
+++ b/packages/react/src/components/OverflowMenu/OverflowMenu.js
@@ -448,6 +448,7 @@ class OverflowMenu extends Component {
onOpen, // eslint-disable-line
selectorPrimaryFocus = '[data-floating-menu-primary-focus]', // eslint-disable-line
renderIcon: IconElement,
+ // eslint-disable-next-line react/prop-types
innerRef: ref,
menuOptionsClass,
light,
diff --git a/packages/react/src/components/OverflowMenuItem/OverflowMenuItem.js b/packages/react/src/components/OverflowMenuItem/OverflowMenuItem.js
index c00cb5b838f3..15c156a08125 100644
--- a/packages/react/src/components/OverflowMenuItem/OverflowMenuItem.js
+++ b/packages/react/src/components/OverflowMenuItem/OverflowMenuItem.js
@@ -85,6 +85,8 @@ export default class OverflowMenuItem extends React.Component {
* `true` if this menu item has long text and requires a browser tooltip
*/
requireTitle: PropTypes.bool,
+ index: PropTypes.number,
+ handleOverflowMenuItemFocus: PropTypes.func,
};
static defaultProps = {
@@ -130,8 +132,10 @@ export default class OverflowMenuItem extends React.Component {
isDelete,
disabled,
closeMenu,
- onClick, // eslint-disable-line
- handleOverflowMenuItemFocus, // eslint-disable-line
+ // eslint-disable-next-line no-unused-vars
+ onClick,
+ // eslint-disable-next-line no-unused-vars
+ handleOverflowMenuItemFocus,
onKeyDown,
primaryFocus,
wrapperClassName,
@@ -177,7 +181,9 @@ export default class OverflowMenuItem extends React.Component {
)}
- <>
- {totalItems &&
- !pagesUnknown &&
- itemRangeText(
- Math.min(currentPageSize * (currentPage - 1) + 1, totalItems),
- Math.min(currentPage * currentPageSize, totalItems),
- totalItems
- )}
+ {totalItems &&
+ !pagesUnknown &&
+ itemRangeText(
+ Math.min(currentPageSize * (currentPage - 1) + 1, totalItems),
+ Math.min(currentPage * currentPageSize, totalItems),
+ totalItems
+ )}
- {totalItems &&
- pagesUnknown &&
- itemText(
- currentPageSize * (currentPage - 1) + 1,
- currentPage * currentPageSize
- )}
+ {totalItems &&
+ pagesUnknown &&
+ itemText(
+ currentPageSize * (currentPage - 1) + 1,
+ currentPage * currentPageSize
+ )}
- {!totalItems &&
- itemText(
- currentPageSize * (currentPage - 1) + 1,
- currentPage * currentPageSize
- )}
- >
+ {!totalItems &&
+ itemText(
+ currentPageSize * (currentPage - 1) + 1,
+ currentPage * currentPageSize
+ )}
- <>
- {children &&
- totalItems &&
- children({
- currentPage,
- currentPageSize,
- onSetPage,
- totalPages,
- })}
+ {children &&
+ totalItems &&
+ children({
+ currentPage,
+ currentPageSize,
+ onSetPage,
+ totalPages,
+ })}
- {children && totalItems && !pagesUnknown && (
-
- {pageRangeText('', totalPages)}
-
- )}
+ {children && totalItems && !pagesUnknown && (
+
+ {pageRangeText('', totalPages)}
+
+ )}
- {children && !totalItems && (
-
- {pageText(currentPage)}
-
- )}
+ {children && !totalItems && (
+ {pageText(currentPage)}
+ )}
- {!children && (
-
- {!totalItems
- ? pageText(currentPage)
- : pageRangeText(currentPage, totalPages)}
-
- )}
- >
+ {!children && (
+
+ {!totalItems
+ ? pageText(currentPage)
+ : pageRangeText(currentPage, totalPages)}
+
+ )}
{
if (invalid) {
return ;
diff --git a/packages/react/src/components/RadioButton/RadioButton.js b/packages/react/src/components/RadioButton/RadioButton.js
index 82a38d6d2510..82ab18acf62a 100644
--- a/packages/react/src/components/RadioButton/RadioButton.js
+++ b/packages/react/src/components/RadioButton/RadioButton.js
@@ -98,6 +98,7 @@ class RadioButton extends React.Component {
className,
labelText,
labelPosition,
+ // eslint-disable-next-line react/prop-types
innerRef: ref,
hideLabel,
...other
diff --git a/packages/react/src/components/RadioTile/RadioTile.js b/packages/react/src/components/RadioTile/RadioTile.js
index 4969aba75587..d3fcfcfdd987 100644
--- a/packages/react/src/components/RadioTile/RadioTile.js
+++ b/packages/react/src/components/RadioTile/RadioTile.js
@@ -64,6 +64,7 @@ function RadioTile({
onChange={handleOnChange}
id={inputId}
/>
+ {/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */}
*/
defaultValue: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
+
+ /**
+ * Optional callback called when the search value changes.
+ */
+ onChange: PropTypes.func,
};
static defaultProps = {
diff --git a/packages/react/src/components/Select/Select-story.js b/packages/react/src/components/Select/Select-story.js
index 96e848f4e75a..d1d2210c3313 100644
--- a/packages/react/src/components/Select/Select-story.js
+++ b/packages/react/src/components/Select/Select-story.js
@@ -93,7 +93,7 @@ storiesOf('Select', module)
aria-label="loading select"
aria-live="assertive"
role="status"
- tabindex="0" // eslint-disable-line jsx-a11y/no-noninteractive-tabindex
+ tabIndex="0" // eslint-disable-line jsx-a11y/no-noninteractive-tabindex
>
diff --git a/packages/react/src/components/Select/Select-test.js b/packages/react/src/components/Select/Select-test.js
index 2f539a12943f..1def5e29195e 100644
--- a/packages/react/src/components/Select/Select-test.js
+++ b/packages/react/src/components/Select/Select-test.js
@@ -111,17 +111,11 @@ describe('Select', () => {
it('renders children as expected', () => {
wrapper.setProps({
- helperText: (
-
- This helper text has a link .
-
- ),
+ helperText: This is helper text. ,
});
const renderedHelper = wrapper.find(`.${prefix}--form__helper-text`);
expect(renderedHelper.props().children).toEqual(
-
- This helper text has a link .
-
+ This is helper text.
);
});
diff --git a/packages/react/src/components/Select/Select.js b/packages/react/src/components/Select/Select.js
index 02d664ddb6c8..5c9307be31ab 100644
--- a/packages/react/src/components/Select/Select.js
+++ b/packages/react/src/components/Select/Select.js
@@ -97,16 +97,14 @@ const Select = React.forwardRef(function Select(
)}
{inline && (
- <>
-
-
- {input}
-
- {error}
+
+
+ {input}
- >
+ {error}
+
)}
{!inline && (
({
storiesOf('Slider', module)
.addDecorator(withKnobs)
- .add('default', () => , {
+ .add('default', () => , {
info: {
text: `
Sliders provide a visual indication of adjustable content, where the user can move the handle along a horizontal track to increase or decrease the value.
@@ -73,7 +73,7 @@ storiesOf('Slider', module)
aria-label="loading slider"
aria-live="assertive"
role="status"
- tabindex="0" // eslint-disable-line jsx-a11y/no-noninteractive-tabindex
+ tabIndex="0" // eslint-disable-line jsx-a11y/no-noninteractive-tabindex
>
diff --git a/packages/react/src/components/Slider/Slider.js b/packages/react/src/components/Slider/Slider.js
index 5e0a3fbbab28..80ac8bf210e8 100644
--- a/packages/react/src/components/Slider/Slider.js
+++ b/packages/react/src/components/Slider/Slider.js
@@ -147,6 +147,16 @@ export default class Slider extends PureComponent {
* `true` to use the light version.
*/
light: PropTypes.bool,
+
+ /**
+ * `true` to specify if the control is required.
+ */
+ required: PropTypes.bool,
+
+ /**
+ * `true` to specify if the control is invalid.
+ */
+ invalid: PropTypes.bool,
};
static defaultProps = {
@@ -172,7 +182,9 @@ export default class Slider extends PureComponent {
*/
componentDidMount() {
if (this.element) {
- const { value, left } = this.calcValue({ useRawValue: true });
+ const { value, left } = this.calcValue({
+ useRawValue: true,
+ });
this.setState({ value, left });
}
}
@@ -214,7 +226,10 @@ export default class Slider extends PureComponent {
return;
}
this.setState(
- this.calcValue({ value: this.props.value, useRawValue: true })
+ this.calcValue({
+ value: this.props.value,
+ useRawValue: true,
+ })
);
}
@@ -442,7 +457,10 @@ export default class Slider extends PureComponent {
if (useRawValue) {
// Adjusts only for min/max of thumb position
- return { value, left: Math.min(1, Math.max(0, leftPercent)) * 100 };
+ return {
+ value,
+ left: Math.min(1, Math.max(0, leftPercent)) * 100,
+ };
}
let steppedValue = Math.round(leftPercent * totalSteps) * this.props.step;
diff --git a/packages/react/src/components/StructuredList/StructuredList.js b/packages/react/src/components/StructuredList/StructuredList.js
index d26ef8668dc1..d5757b6b4e09 100644
--- a/packages/react/src/components/StructuredList/StructuredList.js
+++ b/packages/react/src/components/StructuredList/StructuredList.js
@@ -223,6 +223,7 @@ export class StructuredListRow extends Component {
});
return label ? (
+ // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
<>{text}>;
+const CustomLabel = ({ text }) => {
+ text;
+};
const CodeSnippetExample = () => (
diff --git a/packages/react/src/components/Tag/Tag.js b/packages/react/src/components/Tag/Tag.js
index 2889287d0dbe..990f1d06b7eb 100644
--- a/packages/react/src/components/Tag/Tag.js
+++ b/packages/react/src/components/Tag/Tag.js
@@ -120,6 +120,11 @@ Tag.propTypes = {
* Click handler for filter tag close button.
*/
onClose: PropTypes.func,
+
+ /**
+ * Specify the id for the tag.
+ */
+ id: PropTypes.string,
};
export const types = Object.keys(TYPES);
diff --git a/packages/react/src/components/TextArea/TextArea-story.js b/packages/react/src/components/TextArea/TextArea-story.js
index 0005a18f7a66..e90405b3b6b3 100644
--- a/packages/react/src/components/TextArea/TextArea-story.js
+++ b/packages/react/src/components/TextArea/TextArea-story.js
@@ -50,7 +50,7 @@ storiesOf('TextArea', module)
aria-label="loading text area"
aria-live="assertive"
role="status"
- tabindex="0" // eslint-disable-line jsx-a11y/no-noninteractive-tabindex
+ tabIndex="0" // eslint-disable-line jsx-a11y/no-noninteractive-tabindex
>
diff --git a/packages/react/src/components/TextArea/TextArea-test.js b/packages/react/src/components/TextArea/TextArea-test.js
index 3f4acbb21ab0..3338d4ad29df 100644
--- a/packages/react/src/components/TextArea/TextArea-test.js
+++ b/packages/react/src/components/TextArea/TextArea-test.js
@@ -103,17 +103,11 @@ describe('TextArea', () => {
it('renders children as expected', () => {
wrapper.setProps({
- helperText: (
-
- This helper text has a link .
-
- ),
+ helperText: This is helper text. ,
});
const renderedHelper = wrapper.find(`.${prefix}--form__helper-text`);
expect(renderedHelper.props().children).toEqual(
-
- This helper text has a link .
-
+ This is helper text.
);
});
diff --git a/packages/react/src/components/TextInput/ControlledPasswordInput.js b/packages/react/src/components/TextInput/ControlledPasswordInput.js
index 031fb0cd4435..aa5402d0c099 100644
--- a/packages/react/src/components/TextInput/ControlledPasswordInput.js
+++ b/packages/react/src/components/TextInput/ControlledPasswordInput.js
@@ -21,7 +21,9 @@ const ControlledPasswordInput = React.forwardRef(
invalidText,
helperText,
light,
+ // eslint-disable-next-line react/prop-types
type = 'password',
+ // eslint-disable-next-line react/prop-types
togglePasswordVisibility,
tooltipPosition = 'bottom',
tooltipAlignment = 'center',
diff --git a/packages/react/src/components/TextInput/TextInput-story.js b/packages/react/src/components/TextInput/TextInput-story.js
index 646b55cf6dd6..6315cf6ff539 100644
--- a/packages/react/src/components/TextInput/TextInput-story.js
+++ b/packages/react/src/components/TextInput/TextInput-story.js
@@ -186,7 +186,7 @@ storiesOf('TextInput', module)
aria-label="loading text input"
aria-live="assertive"
role="status"
- tabindex="0" // eslint-disable-line jsx-a11y/no-noninteractive-tabindex
+ tabIndex="0" // eslint-disable-line jsx-a11y/no-noninteractive-tabindex
>
diff --git a/packages/react/src/components/TextInput/TextInput-test.js b/packages/react/src/components/TextInput/TextInput-test.js
index a2bc48c7a35f..e50a0c28e03b 100644
--- a/packages/react/src/components/TextInput/TextInput-test.js
+++ b/packages/react/src/components/TextInput/TextInput-test.js
@@ -132,17 +132,11 @@ describe('TextInput', () => {
it('renders children as expected', () => {
wrapper.setProps({
- helperText: (
-
- This helper text has a link .
-
- ),
+ helperText: This is helper text. ,
});
const renderedHelper = wrapper.find(`.${prefix}--form__helper-text`);
expect(renderedHelper.props().children).toEqual(
-
- This helper text has a link .
-
+ This is helper text.
);
});
diff --git a/packages/react/src/components/Tile/Tile-story.js b/packages/react/src/components/Tile/Tile-story.js
index 6737a4300141..196346946184 100644
--- a/packages/react/src/components/Tile/Tile-story.js
+++ b/packages/react/src/components/Tile/Tile-story.js
@@ -65,7 +65,6 @@ const props = {
expandable: () => ({
tabIndex: number('Tab index (tabIndex)', 0),
expanded: boolean('Expanded (expanded)', false),
- tileMaxHeight: number('Max height (tileMaxHeight)', 0),
tileCollapsedIconText: text(
'Collapsed icon text (tileCollapsedIconText)',
'Interact to Expand tile'
diff --git a/packages/react/src/components/Tile/Tile.js b/packages/react/src/components/Tile/Tile.js
index d433613841e4..b60eb9e9f33d 100644
--- a/packages/react/src/components/Tile/Tile.js
+++ b/packages/react/src/components/Tile/Tile.js
@@ -87,6 +87,16 @@ export class ClickableTile extends Component {
* Don't use this to make tile background color same as container background color.
*/
light: PropTypes.bool,
+
+ /**
+ * Specify the function to run when the ClickableTile is clicked
+ */
+ handleClick: PropTypes.func,
+
+ /**
+ * Specify the function to run when the ClickableTile is interacted with via a keyboard
+ */
+ handleKeyDown: PropTypes.func,
};
static defaultProps = {
@@ -124,6 +134,7 @@ export class ClickableTile extends Component {
}
};
+ // eslint-disable-next-line react/prop-types
static getDerivedStateFromProps({ clicked }, state) {
const { prevClicked } = state;
return prevClicked === clicked
@@ -234,6 +245,16 @@ export class SelectableTile extends Component {
* Don't use this to make tile background color same as container background color.
*/
light: PropTypes.bool,
+
+ /**
+ * Specify the function to run when the SelectableTile is clicked
+ */
+ handleClick: PropTypes.func,
+
+ /**
+ * Specify the function to run when the SelectableTile is interacted with via a keyboard
+ */
+ handleKeyDown: PropTypes.func,
};
static defaultProps = {
@@ -339,6 +360,7 @@ export class SelectableTile extends Component {
title={title}
checked={this.state.selected}
/>
+ {/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */}
*/
diff --git a/packages/react/src/components/ToggleSmall/ToggleSmall.js b/packages/react/src/components/ToggleSmall/ToggleSmall.js
index 781f211050e9..a36b860cd107 100644
--- a/packages/react/src/components/ToggleSmall/ToggleSmall.js
+++ b/packages/react/src/components/ToggleSmall/ToggleSmall.js
@@ -104,6 +104,11 @@ ToggleSmall.propTypes = {
*/
onToggle: PropTypes.func,
+ /**
+ * Provide an optional hook that is called when the control is changed
+ */
+ onChange: PropTypes.func,
+
/**
* The `id` attribute for the toggle
*/
diff --git a/packages/react/src/components/Toolbar/Toolbar.js b/packages/react/src/components/Toolbar/Toolbar.js
index 36a12cdff31e..b1830b6b4625 100644
--- a/packages/react/src/components/Toolbar/Toolbar.js
+++ b/packages/react/src/components/Toolbar/Toolbar.js
@@ -79,6 +79,7 @@ ToolbarItem.defaultProps = {
placeHolderText: 'Provide placeHolderText',
};
+// eslint-disable-next-line react/display-name
export const ToolbarTitle = React.forwardRef(({ title }, ref) => (
{title}
@@ -92,6 +93,7 @@ ToolbarTitle.propTypes = {
title: PropTypes.string,
};
+// eslint-disable-next-line react/display-name
export const ToolbarOption = React.forwardRef(({ children }, ref) => (
{children}
@@ -105,6 +107,7 @@ ToolbarOption.propTypes = {
children: PropTypes.node,
};
+// eslint-disable-next-line react/display-name
export const ToolbarDivider = React.forwardRef((props, ref) => (
));
diff --git a/packages/react/src/components/ToolbarSearch/ToolbarSearch.js b/packages/react/src/components/ToolbarSearch/ToolbarSearch.js
index 6a09fb07b35a..fa80671a8f0e 100644
--- a/packages/react/src/components/ToolbarSearch/ToolbarSearch.js
+++ b/packages/react/src/components/ToolbarSearch/ToolbarSearch.js
@@ -53,6 +53,16 @@ export default class ToolbarSearch extends Component {
* The ID of the ` `.
*/
id: PropTypes.string,
+
+ /**
+ * Optional prop to specify the role of the ToolbarSearch
+ */
+ role: PropTypes.string,
+
+ /**
+ * The ID of the ``.
+ */
+ labelId: PropTypes.string,
};
static defaultProps = {
diff --git a/packages/react/src/components/Tooltip/Tooltip-story.js b/packages/react/src/components/Tooltip/Tooltip-story.js
index 433b16f71792..9337de5155b8 100644
--- a/packages/react/src/components/Tooltip/Tooltip-story.js
+++ b/packages/react/src/components/Tooltip/Tooltip-story.js
@@ -49,6 +49,7 @@ const props = {
'Primary focus element selector (selectorPrimaryFocus)',
''
),
+ // eslint-disable-next-line react/display-name
renderIcon: React.forwardRef((props, ref) => (
diff --git a/packages/react/src/components/TooltipDefinition/TooltipDefinition.js b/packages/react/src/components/TooltipDefinition/TooltipDefinition.js
index 079b47804dc9..09f7a91c67a6 100644
--- a/packages/react/src/components/TooltipDefinition/TooltipDefinition.js
+++ b/packages/react/src/components/TooltipDefinition/TooltipDefinition.js
@@ -96,6 +96,11 @@ TooltipDefinition.propTypes = {
*/
children: PropTypes.string.isRequired,
+ /**
+ * Specify an optional className to be applied to the container node
+ */
+ className: PropTypes.string,
+
/**
* The CSS class name of the trigger element
*/
@@ -123,6 +128,21 @@ TooltipDefinition.propTypes = {
* TODO: rename this prop (will be a breaking change)
*/
tooltipText: PropTypes.node.isRequired,
+
+ /**
+ * The event handler for the `focus` event.
+ */
+ onFocus: PropTypes.func,
+
+ /**
+ * The event handler for the `mouseenter` event.
+ */
+ onMouseEnter: PropTypes.func,
+
+ /**
+ * The event handler for the `mouseleave` event.
+ */
+ onMouseLeave: PropTypes.func,
};
TooltipDefinition.defaultProps = {
diff --git a/packages/react/src/components/TooltipIcon/TooltipIcon.js b/packages/react/src/components/TooltipIcon/TooltipIcon.js
index 4942c0fcf4b3..061a975a9306 100644
--- a/packages/react/src/components/TooltipIcon/TooltipIcon.js
+++ b/packages/react/src/components/TooltipIcon/TooltipIcon.js
@@ -72,6 +72,11 @@ TooltipIcon.propTypes = {
*/
children: PropTypes.node.isRequired,
+ /**
+ * Specify an optional className to be applied to the trigger node
+ */
+ className: PropTypes.string,
+
/**
* Specify the direction of the tooltip. Can be either top or bottom.
*/
@@ -94,6 +99,16 @@ TooltipIcon.propTypes = {
* TODO: rename this prop (will be a breaking change)
*/
tooltipText: PropTypes.string.isRequired,
+
+ /**
+ * The event handler for the `focus` event.
+ */
+ onFocus: PropTypes.func,
+
+ /**
+ * The event handler for the `mouseenter` event.
+ */
+ onMouseEnter: PropTypes.func,
};
TooltipIcon.defaultProps = {
diff --git a/packages/react/src/components/UIShell/HeaderContainer.js b/packages/react/src/components/UIShell/HeaderContainer.js
index c0e1c000873b..01ad54e96a1f 100644
--- a/packages/react/src/components/UIShell/HeaderContainer.js
+++ b/packages/react/src/components/UIShell/HeaderContainer.js
@@ -8,6 +8,7 @@
import PropTypes from 'prop-types';
import React, { useState, useCallback } from 'react';
+// eslint-disable-next-line react/prop-types
const HeaderContainer = ({ isSideNavExpanded, render: Children }) => {
//state for expandable sidenav
const [isSideNavExpandedState, setIsSideNavExpandedState] = useState(
diff --git a/packages/react/src/components/UIShell/HeaderSideNavItems.js b/packages/react/src/components/UIShell/HeaderSideNavItems.js
index 1113c722a891..921d11c672ba 100644
--- a/packages/react/src/components/UIShell/HeaderSideNavItems.js
+++ b/packages/react/src/components/UIShell/HeaderSideNavItems.js
@@ -39,6 +39,11 @@ HeaderSideNavItems.propTypes = {
* between original sidenav items and header menu items. False by default.
*/
hasDivider: PropTypes.bool,
+
+ /**
+ * The child nodes to be rendered
+ */
+ children: PropTypes.node,
};
HeaderSideNavItems.defaultProps = {
diff --git a/packages/react/src/components/UIShell/SideNavFooter.js b/packages/react/src/components/UIShell/SideNavFooter.js
index 45fa840cdddc..6d8cb6abe4bc 100644
--- a/packages/react/src/components/UIShell/SideNavFooter.js
+++ b/packages/react/src/components/UIShell/SideNavFooter.js
@@ -65,6 +65,7 @@ SideNavFooter.propTypes = {
* keep local state and styling in step with the SideNav expansion state.
*/
isSideNavExpanded: PropTypes.bool,
+ className: PropTypes.string,
};
SideNavFooter.defaultProps = {
diff --git a/packages/react/src/components/UIShell/SideNavHeader.js b/packages/react/src/components/UIShell/SideNavHeader.js
index 8718d3a8b541..1506d93dec2b 100644
--- a/packages/react/src/components/UIShell/SideNavHeader.js
+++ b/packages/react/src/components/UIShell/SideNavHeader.js
@@ -47,6 +47,11 @@ SideNavHeader.propTypes = {
* keep local state and styling in step with the SideNav expansion state.
*/
isSideNavExpanded: PropTypes.bool,
+
+ /**
+ * The child nodes to be rendered
+ */
+ children: PropTypes.node,
};
export default SideNavHeader;
diff --git a/packages/react/src/components/UIShell/SideNavMenu.js b/packages/react/src/components/UIShell/SideNavMenu.js
index dd3d1c613261..c5292dd31cab 100644
--- a/packages/react/src/components/UIShell/SideNavMenu.js
+++ b/packages/react/src/components/UIShell/SideNavMenu.js
@@ -17,6 +17,13 @@ const { prefix } = settings;
export class SideNavMenu extends React.Component {
static propTypes = {
+ buttonRef: PropTypes.oneOfType([
+ PropTypes.func,
+ PropTypes.shape({
+ current: PropTypes.any,
+ }),
+ ]),
+
/**
* Provide an optional class to be applied to the containing node
*/
diff --git a/packages/react/src/components/UIShell/SkipToContent.js b/packages/react/src/components/UIShell/SkipToContent.js
index 7b2fb3e49e83..a7a86a8b8717 100644
--- a/packages/react/src/components/UIShell/SkipToContent.js
+++ b/packages/react/src/components/UIShell/SkipToContent.js
@@ -28,6 +28,8 @@ const SkipToContent = ({
};
SkipToContent.propTypes = {
+ className: PropTypes.string,
+
/**
* Provide text to display in the SkipToContent `a` tag
*/
diff --git a/packages/react/src/components/UIShell/UIShell-story.js b/packages/react/src/components/UIShell/UIShell-story.js
index ab0395740cb0..1802ce29cf53 100644
--- a/packages/react/src/components/UIShell/UIShell-story.js
+++ b/packages/react/src/components/UIShell/UIShell-story.js
@@ -155,48 +155,46 @@ storiesOf('UI Shell', module)
withReadme(readme, () => (
(
- <>
-
-
-
-
- [Platform]
-
-
-
- Link 1
-
- Link 2
- Link 3
-
- Sub-link 1
- Sub-link 2
- Sub-link 3
-
-
-
-
-
- Link 1
- Link 2
- Link 3
-
- Sub-link 1
- Sub-link 2
- Sub-link 3
-
-
-
-
-
- >
+
+
+
+
+ [Platform]
+
+
+
+ Link 1
+
+ Link 2
+ Link 3
+
+ Sub-link 1
+ Sub-link 2
+ Sub-link 3
+
+
+
+
+
+ Link 1
+ Link 2
+ Link 3
+
+ Sub-link 1
+ Sub-link 2
+ Sub-link 3
+
+
+
+
+
)}
/>
))
@@ -264,63 +262,61 @@ storiesOf('UI Shell', module)
withReadme(readme, () => (
(
- <>
-
-
-
-
- [Platform]
-
-
- Link 1
- Link 2
- Link 3
-
- Sub-link 1
- Sub-link 2
- Sub-link 3
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Link 1
- Link 2
- Link 3
-
- Sub-link 1
- Sub-link 2
- Sub-link 3
-
-
-
-
-
- >
+
+
+
+
+ [Platform]
+
+
+ Link 1
+ Link 2
+ Link 3
+
+ Sub-link 1
+ Sub-link 2
+ Sub-link 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Link 1
+ Link 2
+ Link 3
+
+ Sub-link 1
+ Sub-link 2
+ Sub-link 3
+
+
+
+
+
)}
/>
))
diff --git a/packages/react/src/internal/FloatingMenu.js b/packages/react/src/internal/FloatingMenu.js
index 5023bc4125d0..0ddb31fbc8e0 100644
--- a/packages/react/src/internal/FloatingMenu.js
+++ b/packages/react/src/internal/FloatingMenu.js
@@ -196,6 +196,21 @@ class FloatingMenu extends React.Component {
* The callback called when the menu body has been mounted and positioned.
*/
onPlace: PropTypes.func,
+
+ /**
+ * `true` if the menu alignment should be flipped.
+ */
+ flipped: PropTypes.bool,
+
+ /**
+ * The element ref of the tooltip's trigger button.
+ */
+ triggerRef: PropTypes.oneOfType([
+ PropTypes.func,
+ PropTypes.shape({
+ current: PropTypes.any,
+ }),
+ ]),
};
static defaultProps = {
diff --git a/packages/react/src/internal/Selection.js b/packages/react/src/internal/Selection.js
index ed707acb146e..a3c1a3ce576f 100644
--- a/packages/react/src/internal/Selection.js
+++ b/packages/react/src/internal/Selection.js
@@ -75,7 +75,11 @@ export function useSelection({
export default class Selection extends React.Component {
static propTypes = {
+ children: PropTypes.func,
+ disabled: PropTypes.bool,
initialSelectedItems: PropTypes.array.isRequired,
+ onChange: PropTypes.func,
+ render: PropTypes.func,
};
static defaultProps = {
diff --git a/packages/react/src/internal/__tests__/ClickListener-test.js b/packages/react/src/internal/__tests__/ClickListener-test.js
index 85519ba12385..3c1d033f71a3 100644
--- a/packages/react/src/internal/__tests__/ClickListener-test.js
+++ b/packages/react/src/internal/__tests__/ClickListener-test.js
@@ -90,20 +90,4 @@ describe('ClickListener', () => {
expect(handleRefSpy).toHaveBeenCalledTimes(1);
expect(mockRef).toHaveBeenCalledTimes(1);
});
-
- it('should not call any string refs on children', () => {
- class Child extends React.Component {
- render() {
- return
;
- }
- }
- expect(() => {
- mount(
-
-
-
- );
- expect(handleRefSpy).toHaveBeenCalledTimes(1);
- }).not.toThrow();
- });
});
diff --git a/packages/react/src/tools/withState.js b/packages/react/src/tools/withState.js
index b42bfa6c81be..c0ce8e2bd390 100644
--- a/packages/react/src/tools/withState.js
+++ b/packages/react/src/tools/withState.js
@@ -10,6 +10,7 @@ import PropTypes from 'prop-types';
export default class WithState extends React.PureComponent {
static propTypes = {
+ children: PropTypes.func.isRequired,
initialState: PropTypes.object,
};
diff --git a/yarn.lock b/yarn.lock
index 095f949df42f..c563c83e5f8b 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -9618,10 +9618,10 @@ eslint-plugin-prettier@^3.1.2:
dependencies:
prettier-linter-helpers "^1.0.0"
-eslint-plugin-react-hooks@^2.3.0:
- version "2.3.0"
- resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-2.3.0.tgz#53e073961f1f5ccf8dd19558036c1fac8c29d99a"
- integrity sha512-gLKCa52G4ee7uXzdLiorca7JIQZPPXRAQDXV83J4bUEeUuc5pIEyZYAZ45Xnxe5IuupxEqHS+hUhSLIimK1EMw==
+eslint-plugin-react-hooks@^4.0.4:
+ version "4.0.4"
+ resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.0.4.tgz#aed33b4254a41b045818cacb047b81e6df27fa58"
+ integrity sha512-equAdEIsUETLFNCmmCkiCGq6rkSK5MoJhXFPFYeUebcjKgBmWWcgVOqZyQC8Bv1BwVCnTq9tBxgJFgAJTWoJtA==
eslint-plugin-react@^7.18.0:
version "7.18.0"