@carbon/ibm-products 1.69.0 → 1.71.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +8 -4
- package/css/index-full-carbon.css +17 -12
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +4 -4
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon-released-only.css +16 -12
- package/css/index-without-carbon-released-only.css.map +1 -1
- package/css/index-without-carbon-released-only.min.css +3 -3
- package/css/index-without-carbon-released-only.min.css.map +1 -1
- package/css/index-without-carbon.css +17 -12
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +4 -4
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +17 -12
- package/css/index.css.map +1 -1
- package/css/index.min.css +4 -4
- package/css/index.min.css.map +1 -1
- package/es/components/ButtonMenu/ButtonMenu.js +11 -1
- package/es/components/CreateTearsheet/preview-components/MultiStepWithIntro.js +6 -3
- package/es/components/Datagrid/Datagrid/DatagridContent.js +9 -8
- package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +6 -1
- package/es/components/Datagrid/Datagrid/DatagridRow.js +6 -1
- package/es/components/Datagrid/Datagrid/DatagridSelectAll.js +9 -4
- package/es/components/Datagrid/Datagrid/DatagridToolbar.js +11 -4
- package/es/components/Datagrid/Datagrid/DraggableElement.js +1 -1
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +4 -1
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js +1 -1
- package/es/components/Datagrid/Datagrid/addons/Filtering/FilterFlyout.js +18 -6
- package/es/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +21 -11
- package/es/components/Datagrid/Datagrid/addons/Filtering/FilterProvider.js +34 -10
- package/es/components/Datagrid/Datagrid/addons/Filtering/constants.js +6 -2
- package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilterContext.js +7 -0
- package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +42 -11
- package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useShouldDisableButtons.js +3 -3
- package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useSubscribeToEventEmitter.js +1 -0
- package/es/components/Datagrid/Datagrid/addons/Filtering/index.js +1 -0
- package/es/components/Datagrid/Datagrid/addons/Filtering/utils.js +2 -6
- package/es/components/Datagrid/Datagrid/addons/stateReducer.js +4 -7
- package/es/components/Datagrid/useActionsColumn.js +18 -14
- package/es/components/Datagrid/useFiltering.js +3 -6
- package/es/components/Datagrid/useInfiniteScroll.js +7 -3
- package/es/components/Datagrid/useNestedRowExpander.js +2 -2
- package/es/components/Datagrid/useRowIsMouseOver.js +3 -1
- package/es/components/Datagrid/useSelectAllToggle.js +11 -10
- package/es/components/Datagrid/useSelectRows.js +2 -2
- package/es/components/Datagrid/utils/filterPropsForTesting.js +150 -0
- package/es/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +9 -3
- package/es/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +8 -3
- package/es/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +8 -3
- package/es/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +8 -3
- package/es/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +8 -3
- package/es/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +8 -3
- package/es/components/EmptyStates/assets/ErrorIllustration.js +6 -6
- package/es/components/EmptyStates/assets/NoDataIllustration.js +6 -6
- package/es/components/EmptyStates/assets/NoTagsIllustration.js +6 -6
- package/es/components/EmptyStates/assets/NotFoundIllustration.js +6 -6
- package/es/components/EmptyStates/assets/NotificationsIllustration.js +6 -6
- package/es/components/EmptyStates/assets/UnauthorizedIllustration.js +6 -6
- package/es/components/FilterSummary/FilterSummary.js +19 -15
- package/es/components/InterstitialScreen/InterstitialScreen.js +8 -7
- package/es/components/Tearsheet/TearsheetShell.js +6 -4
- package/es/global/js/hooks/index.js +3 -2
- package/es/global/js/hooks/useFocus.js +72 -0
- package/es/global/js/hooks/useIsomorphicEffect.js +12 -0
- package/es/global/js/package-settings.js +0 -1
- package/lib/components/ButtonMenu/ButtonMenu.js +11 -1
- package/lib/components/CreateTearsheet/preview-components/MultiStepWithIntro.js +6 -3
- package/lib/components/Datagrid/Datagrid/DatagridContent.js +9 -8
- package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +6 -1
- package/lib/components/Datagrid/Datagrid/DatagridRow.js +6 -1
- package/lib/components/Datagrid/Datagrid/DatagridSelectAll.js +8 -3
- package/lib/components/Datagrid/Datagrid/DatagridToolbar.js +11 -4
- package/lib/components/Datagrid/Datagrid/DraggableElement.js +1 -1
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +4 -1
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js +1 -1
- package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterFlyout.js +18 -6
- package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +21 -11
- package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterProvider.js +30 -7
- package/lib/components/Datagrid/Datagrid/addons/Filtering/constants.js +8 -3
- package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilterContext.js +7 -0
- package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +34 -3
- package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useShouldDisableButtons.js +3 -3
- package/lib/components/Datagrid/Datagrid/addons/Filtering/utils.js +2 -6
- package/lib/components/Datagrid/Datagrid/addons/stateReducer.js +4 -7
- package/lib/components/Datagrid/useActionsColumn.js +17 -13
- package/lib/components/Datagrid/useFiltering.js +1 -4
- package/lib/components/Datagrid/useInfiniteScroll.js +7 -3
- package/lib/components/Datagrid/useNestedRowExpander.js +1 -1
- package/lib/components/Datagrid/useRowIsMouseOver.js +3 -1
- package/lib/components/Datagrid/useSelectAllToggle.js +9 -9
- package/lib/components/Datagrid/useSelectRows.js +1 -1
- package/lib/components/Datagrid/utils/filterPropsForTesting.js +159 -0
- package/lib/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +9 -3
- package/lib/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +8 -3
- package/lib/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +8 -3
- package/lib/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +8 -3
- package/lib/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +8 -3
- package/lib/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +8 -3
- package/lib/components/EmptyStates/assets/ErrorIllustration.js +6 -6
- package/lib/components/EmptyStates/assets/NoDataIllustration.js +6 -6
- package/lib/components/EmptyStates/assets/NoTagsIllustration.js +6 -6
- package/lib/components/EmptyStates/assets/NotFoundIllustration.js +6 -6
- package/lib/components/EmptyStates/assets/NotificationsIllustration.js +6 -6
- package/lib/components/EmptyStates/assets/UnauthorizedIllustration.js +6 -6
- package/lib/components/FilterSummary/FilterSummary.js +18 -14
- package/lib/components/InterstitialScreen/InterstitialScreen.js +8 -6
- package/lib/components/Tearsheet/TearsheetShell.js +6 -4
- package/lib/global/js/hooks/index.js +8 -1
- package/lib/global/js/hooks/useFocus.js +79 -0
- package/lib/global/js/hooks/useIsomorphicEffect.js +18 -0
- package/lib/global/js/package-settings.js +0 -1
- package/package.json +6 -5
- package/scss/components/Datagrid/_datagrid.scss +9 -1
- package/scss/components/Datagrid/styles/_datagrid.scss +10 -4
- package/scss/components/Datagrid/styles/addons/_FilterPanel.scss +6 -7
- package/scss/components/InterstitialScreen/_interstitial-screen.scss +1 -0
- package/scss/components/SidePanel/_side-panel.scss +5 -1
- package/telemetry.yml +816 -0
@@ -1,7 +1,7 @@
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
2
2
|
import _extends from "@babel/runtime/helpers/extends";
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
4
|
-
var _excluded = ["action", "className", "illustrationTheme", "link", "size", "subtitle", "title"];
|
4
|
+
var _excluded = ["action", "className", "illustrationTheme", "illustrationDescription", "link", "size", "subtitle", "title"];
|
5
5
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
6
6
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
7
7
|
/**
|
@@ -31,6 +31,7 @@ export var NotificationsEmptyState = /*#__PURE__*/React.forwardRef(function (_re
|
|
31
31
|
var action = _ref.action,
|
32
32
|
className = _ref.className,
|
33
33
|
illustrationTheme = _ref.illustrationTheme,
|
34
|
+
illustrationDescription = _ref.illustrationDescription,
|
34
35
|
link = _ref.link,
|
35
36
|
_ref$size = _ref.size,
|
36
37
|
size = _ref$size === void 0 ? defaults.size : _ref$size,
|
@@ -42,8 +43,8 @@ export var NotificationsEmptyState = /*#__PURE__*/React.forwardRef(function (_re
|
|
42
43
|
ref: ref
|
43
44
|
}, getDevtoolsProps(componentName)), /*#__PURE__*/React.createElement(NotificationsIllustration, {
|
44
45
|
size: size,
|
45
|
-
|
46
|
-
|
46
|
+
theme: illustrationTheme,
|
47
|
+
alt: illustrationDescription || title
|
47
48
|
}), /*#__PURE__*/React.createElement(EmptyStateContent, {
|
48
49
|
action: action,
|
49
50
|
link: link,
|
@@ -77,6 +78,10 @@ NotificationsEmptyState.propTypes = {
|
|
77
78
|
* Provide an optional class to be applied to the containing node.
|
78
79
|
*/
|
79
80
|
className: PropTypes.string,
|
81
|
+
/**
|
82
|
+
* The alt text for empty state svg images.If not provided , title will be used.
|
83
|
+
*/
|
84
|
+
illustrationDescription: PropTypes.string,
|
80
85
|
/**
|
81
86
|
* Empty state illustration theme variations.
|
82
87
|
* To ensure you use the correct themed illustrations, you can conditionally specify light or dark
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
2
2
|
import _extends from "@babel/runtime/helpers/extends";
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
4
|
-
var _excluded = ["action", "className", "illustrationTheme", "link", "size", "subtitle", "title"];
|
4
|
+
var _excluded = ["action", "className", "illustrationTheme", "illustrationDescription", "link", "size", "subtitle", "title"];
|
5
5
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
6
6
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
7
7
|
/**
|
@@ -31,6 +31,7 @@ export var UnauthorizedEmptyState = /*#__PURE__*/React.forwardRef(function (_ref
|
|
31
31
|
var action = _ref.action,
|
32
32
|
className = _ref.className,
|
33
33
|
illustrationTheme = _ref.illustrationTheme,
|
34
|
+
illustrationDescription = _ref.illustrationDescription,
|
34
35
|
link = _ref.link,
|
35
36
|
_ref$size = _ref.size,
|
36
37
|
size = _ref$size === void 0 ? defaults.size : _ref$size,
|
@@ -42,8 +43,8 @@ export var UnauthorizedEmptyState = /*#__PURE__*/React.forwardRef(function (_ref
|
|
42
43
|
ref: ref
|
43
44
|
}, getDevtoolsProps(componentName)), /*#__PURE__*/React.createElement(UnauthorizedIllustration, {
|
44
45
|
size: size,
|
45
|
-
|
46
|
-
|
46
|
+
theme: illustrationTheme,
|
47
|
+
alt: illustrationDescription || title
|
47
48
|
}), /*#__PURE__*/React.createElement(EmptyStateContent, {
|
48
49
|
action: action,
|
49
50
|
link: link,
|
@@ -77,6 +78,10 @@ UnauthorizedEmptyState.propTypes = {
|
|
77
78
|
* Provide an optional class to be applied to the containing node.
|
78
79
|
*/
|
79
80
|
className: PropTypes.string,
|
81
|
+
/**
|
82
|
+
* The alt text for empty state svg images.If not provided , title will be used.
|
83
|
+
*/
|
84
|
+
illustrationDescription: PropTypes.string,
|
80
85
|
/**
|
81
86
|
* Empty state illustration theme variations.
|
82
87
|
* To ensure you use the correct themed illustrations, you can conditionally specify light or dark
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
3
|
-
var _excluded = ["
|
3
|
+
var _excluded = ["theme", "size", "alt"];
|
4
4
|
/**
|
5
5
|
* Copyright IBM Corp. 2020, 2021
|
6
6
|
*
|
@@ -20,9 +20,9 @@ import uuidv4 from '../../../global/js/utils/uuidv4';
|
|
20
20
|
// The block part of our conventional BEM class names (blockClass__E--M).
|
21
21
|
var blockClass = "".concat(pkg.prefix, "--empty-state");
|
22
22
|
export var ErrorIllustration = function ErrorIllustration(_ref) {
|
23
|
-
var
|
24
|
-
theme = _ref.theme,
|
23
|
+
var theme = _ref.theme,
|
25
24
|
size = _ref.size,
|
25
|
+
alt = _ref.alt,
|
26
26
|
rest = _objectWithoutProperties(_ref, _excluded);
|
27
27
|
var svgId = uuidv4();
|
28
28
|
return /*#__PURE__*/React.createElement("svg", _extends({}, rest, {
|
@@ -32,7 +32,7 @@ export var ErrorIllustration = function ErrorIllustration(_ref) {
|
|
32
32
|
viewBox: "0 0 80 80",
|
33
33
|
className: cx(["".concat(blockClass, "__illustration"), "".concat(blockClass, "__illustration-error"), "".concat(blockClass, "__illustration--").concat(size)]),
|
34
34
|
role: "img"
|
35
|
-
}), /*#__PURE__*/React.createElement("title", null,
|
35
|
+
}), /*#__PURE__*/React.createElement("title", null, alt), theme === 'dark' ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
|
36
36
|
id: "prefix__a_dark_".concat(svgId),
|
37
37
|
x1: 38.9,
|
38
38
|
y1: 77.08,
|
@@ -209,7 +209,7 @@ export var ErrorIllustration = function ErrorIllustration(_ref) {
|
|
209
209
|
})));
|
210
210
|
};
|
211
211
|
ErrorIllustration.propTypes = {
|
212
|
+
alt: PropTypes.string.isRequired,
|
212
213
|
size: PropTypes.oneOf(['lg', 'sm']),
|
213
|
-
theme: PropTypes.oneOf(['light', 'dark'])
|
214
|
-
title: PropTypes.string
|
214
|
+
theme: PropTypes.oneOf(['light', 'dark'])
|
215
215
|
};
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
3
|
-
var _excluded = ["
|
3
|
+
var _excluded = ["theme", "size", "alt"];
|
4
4
|
/**
|
5
5
|
* Copyright IBM Corp. 2020, 2021
|
6
6
|
*
|
@@ -20,9 +20,9 @@ import uuidv4 from '../../../global/js/utils/uuidv4';
|
|
20
20
|
// The block part of our conventional BEM class names (blockClass__E--M).
|
21
21
|
var blockClass = "".concat(pkg.prefix, "--empty-state");
|
22
22
|
export var NoDataIllustration = function NoDataIllustration(_ref) {
|
23
|
-
var
|
24
|
-
theme = _ref.theme,
|
23
|
+
var theme = _ref.theme,
|
25
24
|
size = _ref.size,
|
25
|
+
alt = _ref.alt,
|
26
26
|
rest = _objectWithoutProperties(_ref, _excluded);
|
27
27
|
var svgId = uuidv4();
|
28
28
|
return /*#__PURE__*/React.createElement("svg", _extends({}, rest, {
|
@@ -32,7 +32,7 @@ export var NoDataIllustration = function NoDataIllustration(_ref) {
|
|
32
32
|
viewBox: "0 0 80 80",
|
33
33
|
className: cx(["".concat(blockClass, "__illustration"), "".concat(blockClass, "__illustration-noData"), "".concat(blockClass, "__illustration--").concat(size)]),
|
34
34
|
role: "img"
|
35
|
-
}), /*#__PURE__*/React.createElement("title", null,
|
35
|
+
}), /*#__PURE__*/React.createElement("title", null, alt), theme === 'dark' ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
|
36
36
|
id: "prefix__a_dark_".concat(svgId),
|
37
37
|
x1: 11.12,
|
38
38
|
y1: 43.34,
|
@@ -172,7 +172,7 @@ export var NoDataIllustration = function NoDataIllustration(_ref) {
|
|
172
172
|
})));
|
173
173
|
};
|
174
174
|
NoDataIllustration.propTypes = {
|
175
|
+
alt: PropTypes.string.isRequired,
|
175
176
|
size: PropTypes.oneOf(['lg', 'sm']),
|
176
|
-
theme: PropTypes.oneOf(['light', 'dark'])
|
177
|
-
title: PropTypes.string
|
177
|
+
theme: PropTypes.oneOf(['light', 'dark'])
|
178
178
|
};
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
3
|
-
var _excluded = ["
|
3
|
+
var _excluded = ["theme", "size", "alt"];
|
4
4
|
/**
|
5
5
|
* Copyright IBM Corp. 2020, 2021
|
6
6
|
*
|
@@ -20,9 +20,9 @@ import uuidv4 from '../../../global/js/utils/uuidv4';
|
|
20
20
|
// The block part of our conventional BEM class names (blockClass__E--M).
|
21
21
|
var blockClass = "".concat(pkg.prefix, "--empty-state");
|
22
22
|
export var NoTagsIllustration = function NoTagsIllustration(_ref) {
|
23
|
-
var
|
24
|
-
theme = _ref.theme,
|
23
|
+
var theme = _ref.theme,
|
25
24
|
size = _ref.size,
|
25
|
+
alt = _ref.alt,
|
26
26
|
rest = _objectWithoutProperties(_ref, _excluded);
|
27
27
|
var svgId = uuidv4();
|
28
28
|
return /*#__PURE__*/React.createElement("svg", _extends({}, rest, {
|
@@ -33,7 +33,7 @@ export var NoTagsIllustration = function NoTagsIllustration(_ref) {
|
|
33
33
|
viewBox: "0 0 80 80",
|
34
34
|
className: cx(["".concat(blockClass, "__illustration"), "".concat(blockClass, "__illustration-noTags"), "".concat(blockClass, "__illustration--").concat(size)]),
|
35
35
|
role: "img"
|
36
|
-
}), /*#__PURE__*/React.createElement("title", null,
|
36
|
+
}), /*#__PURE__*/React.createElement("title", null, alt), theme === 'dark' ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
|
37
37
|
id: "prefix__c_dark_".concat(svgId),
|
38
38
|
x1: 34.96,
|
39
39
|
y1: 5.37,
|
@@ -479,7 +479,7 @@ export var NoTagsIllustration = function NoTagsIllustration(_ref) {
|
|
479
479
|
})));
|
480
480
|
};
|
481
481
|
NoTagsIllustration.propTypes = {
|
482
|
+
alt: PropTypes.string.isRequired,
|
482
483
|
size: PropTypes.oneOf(['lg', 'sm']),
|
483
|
-
theme: PropTypes.oneOf(['light', 'dark'])
|
484
|
-
title: PropTypes.string
|
484
|
+
theme: PropTypes.oneOf(['light', 'dark'])
|
485
485
|
};
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
3
|
-
var _excluded = ["
|
3
|
+
var _excluded = ["theme", "size", "alt"];
|
4
4
|
/**
|
5
5
|
* Copyright IBM Corp. 2020, 2021
|
6
6
|
*
|
@@ -20,9 +20,9 @@ import uuidv4 from '../../../global/js/utils/uuidv4';
|
|
20
20
|
// The block part of our conventional BEM class names (blockClass__E--M).
|
21
21
|
var blockClass = "".concat(pkg.prefix, "--empty-state");
|
22
22
|
export var NotFoundIllustration = function NotFoundIllustration(_ref) {
|
23
|
-
var
|
24
|
-
theme = _ref.theme,
|
23
|
+
var theme = _ref.theme,
|
25
24
|
size = _ref.size,
|
25
|
+
alt = _ref.alt,
|
26
26
|
rest = _objectWithoutProperties(_ref, _excluded);
|
27
27
|
var svgId = uuidv4();
|
28
28
|
return /*#__PURE__*/React.createElement("svg", _extends({}, rest, {
|
@@ -32,7 +32,7 @@ export var NotFoundIllustration = function NotFoundIllustration(_ref) {
|
|
32
32
|
viewBox: "0 0 80 80",
|
33
33
|
className: cx(["".concat(blockClass, "__illustration"), "".concat(blockClass, "__illustration-notFound"), "".concat(blockClass, "__illustration--").concat(size)]),
|
34
34
|
role: "img"
|
35
|
-
}), /*#__PURE__*/React.createElement("title", null,
|
35
|
+
}), /*#__PURE__*/React.createElement("title", null, alt), theme === 'dark' ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
|
36
36
|
id: "prefix__a_dark_".concat(svgId),
|
37
37
|
x1: 2.6,
|
38
38
|
y1: -12.81,
|
@@ -356,7 +356,7 @@ export var NotFoundIllustration = function NotFoundIllustration(_ref) {
|
|
356
356
|
})));
|
357
357
|
};
|
358
358
|
NotFoundIllustration.propTypes = {
|
359
|
+
alt: PropTypes.string.isRequired,
|
359
360
|
size: PropTypes.oneOf(['lg', 'sm']),
|
360
|
-
theme: PropTypes.oneOf(['light', 'dark'])
|
361
|
-
title: PropTypes.string
|
361
|
+
theme: PropTypes.oneOf(['light', 'dark'])
|
362
362
|
};
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
3
|
-
var _excluded = ["
|
3
|
+
var _excluded = ["theme", "size", "alt"];
|
4
4
|
/**
|
5
5
|
* Copyright IBM Corp. 2020, 2021
|
6
6
|
*
|
@@ -20,9 +20,9 @@ import uuidv4 from '../../../global/js/utils/uuidv4';
|
|
20
20
|
// The block part of our conventional BEM class names (blockClass__E--M).
|
21
21
|
var blockClass = "".concat(pkg.prefix, "--empty-state");
|
22
22
|
export var NotificationsIllustration = function NotificationsIllustration(_ref) {
|
23
|
-
var
|
24
|
-
theme = _ref.theme,
|
23
|
+
var theme = _ref.theme,
|
25
24
|
size = _ref.size,
|
25
|
+
alt = _ref.alt,
|
26
26
|
rest = _objectWithoutProperties(_ref, _excluded);
|
27
27
|
var svgId = uuidv4();
|
28
28
|
return /*#__PURE__*/React.createElement("svg", _extends({}, rest, {
|
@@ -32,7 +32,7 @@ export var NotificationsIllustration = function NotificationsIllustration(_ref)
|
|
32
32
|
viewBox: "0 0 80 80",
|
33
33
|
className: cx(["".concat(blockClass, "__illustration"), "".concat(blockClass, "__illustration-notification"), "".concat(blockClass, "__illustration--").concat(size)]),
|
34
34
|
role: "img"
|
35
|
-
}), /*#__PURE__*/React.createElement("title", null,
|
35
|
+
}), /*#__PURE__*/React.createElement("title", null, alt), theme === 'dark' ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
|
36
36
|
id: "prefix__a_dark_".concat(svgId),
|
37
37
|
x1: 30.05,
|
38
38
|
y1: 54.31,
|
@@ -327,7 +327,7 @@ export var NotificationsIllustration = function NotificationsIllustration(_ref)
|
|
327
327
|
})));
|
328
328
|
};
|
329
329
|
NotificationsIllustration.propTypes = {
|
330
|
+
alt: PropTypes.string.isRequired,
|
330
331
|
size: PropTypes.oneOf(['lg', 'sm']),
|
331
|
-
theme: PropTypes.oneOf(['light', 'dark'])
|
332
|
-
title: PropTypes.string
|
332
|
+
theme: PropTypes.oneOf(['light', 'dark'])
|
333
333
|
};
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
3
|
-
var _excluded = ["
|
3
|
+
var _excluded = ["theme", "size", "alt"];
|
4
4
|
/**
|
5
5
|
* Copyright IBM Corp. 2020, 2021
|
6
6
|
*
|
@@ -20,9 +20,9 @@ import uuidv4 from '../../../global/js/utils/uuidv4';
|
|
20
20
|
// The block part of our conventional BEM class names (blockClass__E--M).
|
21
21
|
var blockClass = "".concat(pkg.prefix, "--empty-state");
|
22
22
|
export var UnauthorizedIllustration = function UnauthorizedIllustration(_ref) {
|
23
|
-
var
|
24
|
-
theme = _ref.theme,
|
23
|
+
var theme = _ref.theme,
|
25
24
|
size = _ref.size,
|
25
|
+
alt = _ref.alt,
|
26
26
|
rest = _objectWithoutProperties(_ref, _excluded);
|
27
27
|
var svgId = uuidv4();
|
28
28
|
return /*#__PURE__*/React.createElement("svg", _extends({}, rest, {
|
@@ -33,7 +33,7 @@ export var UnauthorizedIllustration = function UnauthorizedIllustration(_ref) {
|
|
33
33
|
viewBox: "0 0 80 80",
|
34
34
|
className: cx(["".concat(blockClass, "__illustration"), "".concat(blockClass, "__illustration-unauthorized"), "".concat(blockClass, "__illustration--").concat(size)]),
|
35
35
|
role: "img"
|
36
|
-
}), /*#__PURE__*/React.createElement("title", null,
|
36
|
+
}), /*#__PURE__*/React.createElement("title", null, alt), theme === 'dark' ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
|
37
37
|
id: "prefix__b_dark_".concat(svgId),
|
38
38
|
x1: 17.33,
|
39
39
|
y1: 40.68,
|
@@ -300,7 +300,7 @@ export var UnauthorizedIllustration = function UnauthorizedIllustration(_ref) {
|
|
300
300
|
})));
|
301
301
|
};
|
302
302
|
UnauthorizedIllustration.propTypes = {
|
303
|
+
alt: PropTypes.string.isRequired,
|
303
304
|
size: PropTypes.oneOf(['lg', 'sm']),
|
304
|
-
theme: PropTypes.oneOf(['light', 'dark'])
|
305
|
-
title: PropTypes.string
|
305
|
+
theme: PropTypes.oneOf(['light', 'dark'])
|
306
306
|
};
|
@@ -1,10 +1,12 @@
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
1
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
2
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
3
|
-
var _excluded = ["
|
4
|
+
var _excluded = ["className", "clearFiltersText", "clearFilters", "filters", "renderLabel", "overflowType", "clearButtonInline"],
|
5
|
+
_excluded2 = ["key", "value"];
|
4
6
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
5
7
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
6
8
|
/**
|
7
|
-
* Copyright IBM Corp. 2022,
|
9
|
+
* Copyright IBM Corp. 2022, 2024
|
8
10
|
*
|
9
11
|
* This source code is licensed under the Apache-2.0 license found in the
|
10
12
|
* LICENSE file in the root directory of this source tree.
|
@@ -16,6 +18,7 @@ import cx from 'classnames';
|
|
16
18
|
import { TagSet } from '../TagSet';
|
17
19
|
import { pkg } from '../../settings';
|
18
20
|
import uuidv4 from '../../global/js/utils/uuidv4';
|
21
|
+
import { getDevtoolsProps } from '../../global/js/utils/devtools';
|
19
22
|
var blockClass = "".concat(pkg.prefix, "--filter-summary");
|
20
23
|
var FilterSummary = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
21
24
|
var _filterSummaryClearBu;
|
@@ -23,35 +26,36 @@ var FilterSummary = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
23
26
|
className = _ref$className === void 0 ? '' : _ref$className,
|
24
27
|
_ref$clearFiltersText = _ref.clearFiltersText,
|
25
28
|
clearFiltersText = _ref$clearFiltersText === void 0 ? 'Clear filters' : _ref$clearFiltersText,
|
26
|
-
|
27
|
-
|
28
|
-
_ref$filters = _ref.filters,
|
29
|
-
filters = _ref$filters === void 0 ? [] : _ref$filters,
|
29
|
+
clearFilters = _ref.clearFilters,
|
30
|
+
filters = _ref.filters,
|
30
31
|
_ref$renderLabel = _ref.renderLabel,
|
31
32
|
renderLabel = _ref$renderLabel === void 0 ? null : _ref$renderLabel,
|
32
33
|
_ref$overflowType = _ref.overflowType,
|
33
34
|
overflowType = _ref$overflowType === void 0 ? 'default' : _ref$overflowType,
|
34
35
|
_ref$clearButtonInlin = _ref.clearButtonInline,
|
35
|
-
clearButtonInline = _ref$clearButtonInlin === void 0 ? true : _ref$clearButtonInlin
|
36
|
+
clearButtonInline = _ref$clearButtonInlin === void 0 ? true : _ref$clearButtonInlin,
|
37
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
36
38
|
var filterSummaryId = "".concat(blockClass, "__").concat(uuidv4());
|
37
39
|
var tagFilters = filters.map(function (_ref2) {
|
38
40
|
var _renderLabel;
|
39
41
|
var key = _ref2.key,
|
40
42
|
value = _ref2.value,
|
41
|
-
rest = _objectWithoutProperties(_ref2,
|
43
|
+
rest = _objectWithoutProperties(_ref2, _excluded2);
|
42
44
|
return _objectSpread(_objectSpread({}, rest), {}, {
|
43
45
|
type: 'gray',
|
44
|
-
label: (_renderLabel = renderLabel === null || renderLabel === void 0 ? void 0 : renderLabel(key, value)) !== null && _renderLabel !== void 0 ? _renderLabel : "".concat(key, ": ").concat(value)
|
46
|
+
label: (_renderLabel = renderLabel === null || renderLabel === void 0 ? void 0 : renderLabel(key, value)) !== null && _renderLabel !== void 0 ? _renderLabel : "".concat(key, ": ").concat(value),
|
47
|
+
title: clearFiltersText
|
45
48
|
});
|
46
49
|
});
|
47
50
|
var filterSummaryClearButton = useRef();
|
48
51
|
var filterSummaryRef = useRef();
|
49
|
-
var localRef =
|
50
|
-
return /*#__PURE__*/React.createElement("div", {
|
51
|
-
ref: localRef,
|
52
|
-
className: cx([blockClass, className]),
|
52
|
+
var localRef = ref || filterSummaryRef;
|
53
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, getDevtoolsProps(componentName), {
|
53
54
|
id: filterSummaryId
|
54
|
-
},
|
55
|
+
}, rest, {
|
56
|
+
ref: localRef,
|
57
|
+
className: cx([blockClass, className])
|
58
|
+
}), /*#__PURE__*/React.createElement(TagSet, {
|
55
59
|
allTagsModalSearchLabel: "Search all tags",
|
56
60
|
allTagsModalSearchPlaceholderText: "Search all tags",
|
57
61
|
allTagsModalTitle: "All tags",
|
@@ -72,7 +76,7 @@ var componentName = 'FilterSummary';
|
|
72
76
|
FilterSummary.displayName = componentName;
|
73
77
|
FilterSummary.propTypes = {
|
74
78
|
className: PropTypes.string,
|
75
|
-
clearButtonInline: PropTypes.
|
79
|
+
clearButtonInline: PropTypes.bool,
|
76
80
|
clearFilters: PropTypes.func.isRequired,
|
77
81
|
clearFiltersText: PropTypes.string,
|
78
82
|
filters: PropTypes.arrayOf(PropTypes.object).isRequired,
|
@@ -13,7 +13,6 @@ var _excluded = ["children", "className", "closeIconDescription", "domainName",
|
|
13
13
|
// Import portions of React that are needed.
|
14
14
|
import React, { Children, useCallback, useEffect, useRef, useState } from 'react';
|
15
15
|
import { clamp } from 'lodash';
|
16
|
-
// Other standard imports.
|
17
16
|
import PropTypes from 'prop-types';
|
18
17
|
import cx from 'classnames';
|
19
18
|
import { getDevtoolsProps } from '../../global/js/utils/devtools';
|
@@ -57,7 +56,10 @@ var defaults = {
|
|
57
56
|
};
|
58
57
|
|
59
58
|
/**
|
60
|
-
*
|
59
|
+
* InterstitialScreen can be a full page or an overlay, and are
|
60
|
+
* shown on the first time a user accesses a new experience
|
61
|
+
* (e.g. upon first login or first time opening a page where a
|
62
|
+
* newly purchased capability is presented).
|
61
63
|
*/
|
62
64
|
export var InterstitialScreen = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
63
65
|
var _media$breakpoints, _media$breakpoints2;
|
@@ -151,7 +153,7 @@ export var InterstitialScreen = /*#__PURE__*/React.forwardRef(function (_ref, re
|
|
151
153
|
}, [isOpen, progStep]);
|
152
154
|
useEffect(function () {
|
153
155
|
var _nextButtonRef$curren;
|
154
|
-
//for modal only, "is-visible" triggers animation
|
156
|
+
// for modal only, "is-visible" triggers animation
|
155
157
|
setIsVisibleClass(!isFullScreen && isOpen ? 'is-visible' : null);
|
156
158
|
nextButtonRef === null || nextButtonRef === void 0 ? void 0 : (_nextButtonRef$curren = nextButtonRef.current) === null || _nextButtonRef$curren === void 0 ? void 0 : _nextButtonRef$curren.focus();
|
157
159
|
}, [isFullScreen, isOpen]);
|
@@ -175,11 +177,10 @@ export var InterstitialScreen = /*#__PURE__*/React.forwardRef(function (_ref, re
|
|
175
177
|
var domainProductDelimiter = domainName !== '' && productName !== '' ? ' | ' : '';
|
176
178
|
var renderModal = function renderModal(childElements) {
|
177
179
|
return /*#__PURE__*/React.createElement(ComposedModal, _extends({}, rest, {
|
178
|
-
|
179
|
-
|
180
|
+
preventCloseOnClickOutside: true,
|
181
|
+
className: cx(blockClass,
|
182
|
+
// Apply the block class to the main HTML element
|
180
183
|
className // Apply any supplied class names to the main HTML element.
|
181
|
-
// variantClass,
|
182
|
-
// isVisibleClass
|
183
184
|
),
|
184
185
|
|
185
186
|
size: "lg",
|
@@ -27,6 +27,7 @@ import pconsole from '../../global/js/utils/pconsole';
|
|
27
27
|
import { Button, ComposedModal, ModalHeader, ModalBody } from 'carbon-components-react';
|
28
28
|
import { ActionSet } from '../ActionSet';
|
29
29
|
import { Wrap } from '../../global/js/utils/Wrap';
|
30
|
+
import { useFocus } from '../../global/js/hooks/useFocus';
|
30
31
|
|
31
32
|
// The block part of our conventional BEM class names (bc__E--M).
|
32
33
|
var bc = "".concat(pkg.prefix, "--tearsheet");
|
@@ -97,6 +98,9 @@ export var TearsheetShell = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
97
98
|
var modalRef = ref || localRef;
|
98
99
|
var _useResizeObserver = useResizeObserver(resizer),
|
99
100
|
width = _useResizeObserver.width;
|
101
|
+
var _useFocus = useFocus(modalRef),
|
102
|
+
firstElement = _useFocus.firstElement,
|
103
|
+
keyDownListener = _useFocus.keyDownListener;
|
100
104
|
|
101
105
|
// Keep track of the stack depth and our position in it (1-based, 0=closed)
|
102
106
|
var _useState3 = useState(0),
|
@@ -133,10 +137,7 @@ export var TearsheetShell = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
133
137
|
|
134
138
|
// Callback to give the tearsheet the opportunity to claim focus
|
135
139
|
handleStackChange.claimFocus = function () {
|
136
|
-
|
137
|
-
setTimeout(function () {
|
138
|
-
return element.focus();
|
139
|
-
}, 1);
|
140
|
+
firstElement === null || firstElement === void 0 ? void 0 : firstElement.focus();
|
140
141
|
};
|
141
142
|
useEffect(function () {
|
142
143
|
var notify = function notify() {
|
@@ -204,6 +205,7 @@ export var TearsheetShell = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
204
205
|
open: open,
|
205
206
|
selectorPrimaryFocus: selectorPrimaryFocus,
|
206
207
|
onFocus: handleFocus,
|
208
|
+
onKeyDown: keyDownListener,
|
207
209
|
preventCloseOnClickOutside: !isPassive,
|
208
210
|
ref: modalRef,
|
209
211
|
selectorsFloatingMenus: [".".concat(carbon.prefix, "--overflow-menu-options"), ".".concat(carbon.prefix, "--tooltip"), '.flatpickr-calendar', ".".concat(bc, "__container")],
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* Copyright IBM Corp. 2020,
|
2
|
+
* Copyright IBM Corp. 2020, 2024
|
3
3
|
*
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
@@ -16,4 +16,5 @@ export { useResetCreateComponent } from './useResetCreateComponent';
|
|
16
16
|
export { useRetrieveStepData } from './useRetrieveStepData';
|
17
17
|
export { useValidCreateStepCount } from './useValidCreateStepCount';
|
18
18
|
export { useControllableState } from './useControllableState';
|
19
|
-
export { usePrefix } from './usePrefix';
|
19
|
+
export { usePrefix } from './usePrefix';
|
20
|
+
export { useIsomorphicEffect } from './useIsomorphicEffect';
|
@@ -0,0 +1,72 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2024, 2024
|
3
|
+
*
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
7
|
+
|
8
|
+
import { pkg, carbon } from '../../../settings';
|
9
|
+
import { useCallback, useEffect } from 'react';
|
10
|
+
export var useFocus = function useFocus(modalRef) {
|
11
|
+
var tearsheetBaseClass = "".concat(pkg.prefix, "--tearsheet");
|
12
|
+
// Querying focusable element in the modal
|
13
|
+
// Query to exclude hidden elements in the modal from querySelectorAll() method
|
14
|
+
// feel free to include more if needed :)
|
15
|
+
var notQuery = ":not(.".concat(carbon.prefix, "--visually-hidden,.").concat(tearsheetBaseClass, "__header--no-close-icon,.").concat(carbon.prefix, "--btn--disabled,[aria-hidden=\"true\"],[tabindex=\"-1\"])");
|
16
|
+
// Queries to include element types button, input, select, textarea
|
17
|
+
var queryButton = "button".concat(notQuery);
|
18
|
+
var queryInput = "input".concat(notQuery);
|
19
|
+
var querySelect = "select".concat(notQuery);
|
20
|
+
var queryTextarea = "textarea".concat(notQuery);
|
21
|
+
var queryLink = "[href]".concat(notQuery);
|
22
|
+
// Final query
|
23
|
+
var query = "".concat(queryButton, ",").concat(queryLink, ",").concat(queryInput, ",").concat(querySelect, ",").concat(queryTextarea);
|
24
|
+
var getFocusable = useCallback(function () {
|
25
|
+
var _modalRef$current, _modalRef$current$inn, _modalRef$current$inn2;
|
26
|
+
// Selecting all focusable elements based on the above conditions
|
27
|
+
var focusableElements = modalRef === null || modalRef === void 0 ? void 0 : (_modalRef$current = modalRef.current) === null || _modalRef$current === void 0 ? void 0 : (_modalRef$current$inn = _modalRef$current.innerModal) === null || _modalRef$current$inn === void 0 ? void 0 : (_modalRef$current$inn2 = _modalRef$current$inn.current) === null || _modalRef$current$inn2 === void 0 ? void 0 : _modalRef$current$inn2.querySelectorAll("".concat(query));
|
28
|
+
var first = focusableElements === null || focusableElements === void 0 ? void 0 : focusableElements[0];
|
29
|
+
var last = focusableElements === null || focusableElements === void 0 ? void 0 : focusableElements[(focusableElements === null || focusableElements === void 0 ? void 0 : focusableElements.length) - 1];
|
30
|
+
var all = focusableElements;
|
31
|
+
return {
|
32
|
+
first: first,
|
33
|
+
last: last,
|
34
|
+
all: all
|
35
|
+
};
|
36
|
+
}, [modalRef, query]);
|
37
|
+
useEffect(function () {
|
38
|
+
getFocusable();
|
39
|
+
}, [getFocusable]);
|
40
|
+
var handleKeyDown = function handleKeyDown(event) {
|
41
|
+
// Checking whether the key is tab or not
|
42
|
+
if (event.key === 'Tab') {
|
43
|
+
// updating the focusable elements list
|
44
|
+
var _getFocusable = getFocusable(),
|
45
|
+
first = _getFocusable.first,
|
46
|
+
last = _getFocusable.last,
|
47
|
+
all = _getFocusable.all;
|
48
|
+
event.persist();
|
49
|
+
setTimeout(function () {
|
50
|
+
var _document, _document2;
|
51
|
+
if (event.shiftKey && !Array.prototype.includes.call(all, (_document = document) === null || _document === void 0 ? void 0 : _document.activeElement)) {
|
52
|
+
// Prevents the default "Tab" behavior
|
53
|
+
event.preventDefault();
|
54
|
+
// if the user press shift+tab and the current element not in focusable items
|
55
|
+
last === null || last === void 0 ? void 0 : last.focus();
|
56
|
+
} else if (!Array.prototype.includes.call(all, (_document2 = document) === null || _document2 === void 0 ? void 0 : _document2.activeElement)) {
|
57
|
+
event.preventDefault();
|
58
|
+
// user pressing tab key only then
|
59
|
+
// focusing the first element if the current element is not in focusable items
|
60
|
+
first === null || first === void 0 ? void 0 : first.focus();
|
61
|
+
}
|
62
|
+
}, 0);
|
63
|
+
}
|
64
|
+
};
|
65
|
+
return {
|
66
|
+
firstElement: getFocusable().first,
|
67
|
+
lastElement: getFocusable().last,
|
68
|
+
allElements: getFocusable().all,
|
69
|
+
keyDownListener: handleKeyDown,
|
70
|
+
getFocusable: getFocusable
|
71
|
+
};
|
72
|
+
};
|
@@ -0,0 +1,12 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2024, 2024
|
3
|
+
*
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
7
|
+
|
8
|
+
import { useEffect, useLayoutEffect } from 'react';
|
9
|
+
|
10
|
+
// Originally from `@carbon/react`, https://github.com/carbon-design-system/carbon/blob/main/packages/react/src/internal/useIsomorphicEffect.js
|
11
|
+
// useLayoutEffect on the client, useEffect on the server
|
12
|
+
export var useIsomorphicEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
|
@@ -101,7 +101,6 @@ var defaults = {
|
|
101
101
|
'a-new-feature': false,
|
102
102
|
'default-portal-target-body': true,
|
103
103
|
'Datagrid.useInlineEdit': false,
|
104
|
-
'Datagrid.useFiltering': false,
|
105
104
|
'Datagrid.useCustomizeColumns': false,
|
106
105
|
'ExampleComponent.secondaryIcon': false,
|
107
106
|
'ExampleComponent.useExample': false
|
@@ -12,7 +12,8 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
12
|
var _classnames = _interopRequireDefault(require("classnames"));
|
13
13
|
var _settings = require("../../settings");
|
14
14
|
var _carbonComponentsReact = require("carbon-components-react");
|
15
|
-
var
|
15
|
+
var _getNodeTextContent = require("../../global/js/utils/getNodeTextContent");
|
16
|
+
var _excluded = ["children", "className", "iconDescription", "kind", "label", "menuAriaLabel", "menuOptionsClass", "renderIcon", "size"];
|
16
17
|
// The block part of our conventional BEM class names (blockClass__E--M).
|
17
18
|
var blockClass = "".concat(_settings.pkg.prefix, "--button-menu");
|
18
19
|
var componentName = 'ButtonMenu';
|
@@ -33,12 +34,14 @@ var defaults = {
|
|
33
34
|
* OverflowMenuItem component.
|
34
35
|
*/
|
35
36
|
var ButtonMenu = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
37
|
+
var _ref2;
|
36
38
|
var children = _ref.children,
|
37
39
|
className = _ref.className,
|
38
40
|
iconDescription = _ref.iconDescription,
|
39
41
|
_ref$kind = _ref.kind,
|
40
42
|
kind = _ref$kind === void 0 ? defaults.kind : _ref$kind,
|
41
43
|
label = _ref.label,
|
44
|
+
menuAriaLabel = _ref.menuAriaLabel,
|
42
45
|
menuOptionsClass = _ref.menuOptionsClass,
|
43
46
|
Icon = _ref.renderIcon,
|
44
47
|
_ref$size = _ref.size,
|
@@ -53,6 +56,7 @@ var ButtonMenu = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
53
56
|
|
54
57
|
menuOptionsClass: (0, _classnames.default)("".concat(blockClass, "__options"), menuOptionsClass),
|
55
58
|
size: size,
|
59
|
+
ariaLabel: (_ref2 = menuAriaLabel !== null && menuAriaLabel !== void 0 ? menuAriaLabel : (0, _getNodeTextContent.getNodeTextContent)(label)) !== null && _ref2 !== void 0 ? _ref2 : undefined,
|
56
60
|
renderIcon: function renderIcon() {
|
57
61
|
return /*#__PURE__*/_react.default.createElement("div", {
|
58
62
|
className: (0, _classnames.default)(["".concat(blockClass, "__trigger"), "".concat(_settings.carbon.prefix, "--btn"), "".concat(_settings.carbon.prefix, "--btn--").concat(kind), "".concat(_settings.carbon.prefix, "--btn--").concat(buttonSize)])
|
@@ -100,6 +104,12 @@ ButtonMenu.propTypes = {
|
|
100
104
|
* The button label for the menu trigger.
|
101
105
|
*/
|
102
106
|
label: _propTypes.default.node,
|
107
|
+
/**
|
108
|
+
* Provide the menuAriaLabel prop to be passed to the ButtonMenu component.
|
109
|
+
* This optional label should contain or match the visible labels or
|
110
|
+
* it will automatically take button label
|
111
|
+
*/
|
112
|
+
menuAriaLabel: _propTypes.default.string,
|
103
113
|
/**
|
104
114
|
* class name applied to the overflow options
|
105
115
|
*/
|