@carbon/ibm-products 2.57.0 → 2.57.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/components/APIKeyModal/APIKeyModal.js +4 -5
- package/es/components/APIKeyModal/APIKeyModal.types.d.ts +0 -5
- package/es/components/ConditionBuilder/ConditionBuilder.js +14 -2
- package/es/components/ConditionBuilder/ConditionBuilder.types.d.ts +14 -5
- package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +2 -1
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +12 -6
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.d.ts +4 -2
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js +1 -1
- package/es/components/ConditionBuilder/utils/useDataConfigs.d.ts +3 -4
- package/es/components/ConditionBuilder/utils/useDataConfigs.js +14 -14
- package/es/components/CreateTearsheet/CreateTearsheet.d.ts +20 -6
- package/es/components/CreateTearsheet/CreateTearsheet.js +32 -11
- package/es/components/EmptyStates/EmptyState.d.ts +6 -1
- package/es/components/EmptyStates/EmptyState.js +12 -3
- package/es/components/EmptyStates/EmptyStateContent.d.ts +3 -1
- package/es/components/EmptyStates/EmptyStateContent.js +8 -2
- package/es/components/EmptyStates/EmptyStateIllustration.js +4 -2
- package/es/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.d.ts +5 -1
- package/es/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +8 -1
- package/es/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.d.ts +5 -1
- package/es/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +8 -1
- package/es/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.d.ts +5 -1
- package/es/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +8 -1
- package/es/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.d.ts +5 -1
- package/es/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +8 -1
- package/es/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.d.ts +5 -1
- package/es/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +8 -1
- package/es/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.d.ts +5 -1
- package/es/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +8 -1
- package/es/components/EmptyStates/assets/ErrorIllustration.js +2 -1
- package/es/components/EmptyStates/assets/NoDataIllustration.js +2 -1
- package/es/components/EmptyStates/assets/NoTagsIllustration.js +2 -1
- package/es/components/EmptyStates/assets/NotFoundIllustration.js +2 -1
- package/es/components/EmptyStates/assets/NotificationsIllustration.js +2 -1
- package/es/components/EmptyStates/assets/UnauthorizedIllustration.js +2 -1
- package/es/components/FilterSummary/FilterSummary.js +1 -1
- package/es/components/Tearsheet/TearsheetShell.d.ts +11 -7
- package/es/components/Tearsheet/TearsheetShell.js +14 -14
- package/es/global/js/hooks/useFocus.js +21 -19
- package/lib/components/APIKeyModal/APIKeyModal.js +4 -5
- package/lib/components/APIKeyModal/APIKeyModal.types.d.ts +0 -5
- package/lib/components/ConditionBuilder/ConditionBuilder.js +14 -2
- package/lib/components/ConditionBuilder/ConditionBuilder.types.d.ts +14 -5
- package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +2 -1
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +12 -6
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.d.ts +4 -2
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js +1 -1
- package/lib/components/ConditionBuilder/utils/useDataConfigs.d.ts +3 -4
- package/lib/components/ConditionBuilder/utils/useDataConfigs.js +14 -14
- package/lib/components/CreateTearsheet/CreateTearsheet.d.ts +20 -6
- package/lib/components/CreateTearsheet/CreateTearsheet.js +31 -10
- package/lib/components/EmptyStates/EmptyState.d.ts +6 -1
- package/lib/components/EmptyStates/EmptyState.js +12 -3
- package/lib/components/EmptyStates/EmptyStateContent.d.ts +3 -1
- package/lib/components/EmptyStates/EmptyStateContent.js +7 -1
- package/lib/components/EmptyStates/EmptyStateIllustration.js +3 -1
- package/lib/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.d.ts +5 -1
- package/lib/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +8 -1
- package/lib/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.d.ts +5 -1
- package/lib/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +8 -1
- package/lib/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.d.ts +5 -1
- package/lib/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +8 -1
- package/lib/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.d.ts +5 -1
- package/lib/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +8 -1
- package/lib/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.d.ts +5 -1
- package/lib/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +8 -1
- package/lib/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.d.ts +5 -1
- package/lib/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +8 -1
- package/lib/components/EmptyStates/assets/ErrorIllustration.js +2 -1
- package/lib/components/EmptyStates/assets/NoDataIllustration.js +2 -1
- package/lib/components/EmptyStates/assets/NoTagsIllustration.js +2 -1
- package/lib/components/EmptyStates/assets/NotFoundIllustration.js +2 -1
- package/lib/components/EmptyStates/assets/NotificationsIllustration.js +2 -1
- package/lib/components/EmptyStates/assets/UnauthorizedIllustration.js +2 -1
- package/lib/components/FilterSummary/FilterSummary.js +1 -1
- package/lib/components/Tearsheet/TearsheetShell.d.ts +11 -7
- package/lib/components/Tearsheet/TearsheetShell.js +14 -14
- package/lib/global/js/hooks/useFocus.js +21 -19
- package/package.json +6 -6
- package/telemetry.yml +3 -0
@@ -18,7 +18,7 @@ var EmptyStateContent = require('../EmptyStateContent.js');
|
|
18
18
|
var ErrorIllustration = require('../assets/ErrorIllustration.js');
|
19
19
|
var EmptyState = require('../EmptyState.js');
|
20
20
|
|
21
|
-
var _excluded = ["action", "className", "illustrationPosition", "illustrationDescription", "illustrationTheme", "link", "size", "subtitle", "title"];
|
21
|
+
var _excluded = ["action", "className", "illustrationPosition", "illustrationDescription", "illustrationTheme", "link", "size", "headingAs", "subtitle", "title"];
|
22
22
|
// The block part of our conventional BEM class names (blockClass__E--M).
|
23
23
|
var blockClass = "".concat(settings.pkg.prefix, "--empty-state");
|
24
24
|
var componentName = 'ErrorEmptyState';
|
@@ -35,6 +35,8 @@ exports.ErrorEmptyState = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
35
35
|
link = _ref.link,
|
36
36
|
_ref$size = _ref.size,
|
37
37
|
size = _ref$size === void 0 ? EmptyState.defaults.size : _ref$size,
|
38
|
+
_ref$headingAs = _ref.headingAs,
|
39
|
+
headingAs = _ref$headingAs === void 0 ? EmptyState.defaults.headingAs : _ref$headingAs,
|
38
40
|
subtitle = _ref.subtitle,
|
39
41
|
title = _ref.title,
|
40
42
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
@@ -49,6 +51,7 @@ exports.ErrorEmptyState = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
49
51
|
action: action,
|
50
52
|
link: link,
|
51
53
|
size: size,
|
54
|
+
headingAs: headingAs,
|
52
55
|
subtitle: subtitle,
|
53
56
|
title: title || ''
|
54
57
|
}));
|
@@ -79,6 +82,10 @@ exports.ErrorEmptyState.propTypes = {
|
|
79
82
|
* Provide an optional class to be applied to the containing node.
|
80
83
|
*/
|
81
84
|
className: index.default.string,
|
85
|
+
/**
|
86
|
+
* Empty state headingAs allows you to customize the type of heading element
|
87
|
+
*/
|
88
|
+
headingAs: index.default.elementType,
|
82
89
|
/**
|
83
90
|
* The alt text for empty state svg images. If not provided , title will be used.
|
84
91
|
*/
|
@@ -5,7 +5,7 @@
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*/
|
7
7
|
/// <reference path="../../../../src/custom-typings/index.d.ts" />
|
8
|
-
import React, { ReactNode } from 'react';
|
8
|
+
import React, { ElementType, ReactNode } from 'react';
|
9
9
|
import { ButtonProps } from '@carbon/react';
|
10
10
|
import { CarbonIconType } from '@carbon/icons-react/lib/CarbonIcon';
|
11
11
|
export interface NoDataEmptyStateProps {
|
@@ -44,6 +44,10 @@ export interface NoDataEmptyStateProps {
|
|
44
44
|
text?: string | ReactNode;
|
45
45
|
href?: string;
|
46
46
|
};
|
47
|
+
/**
|
48
|
+
* Empty state headingAs allows you to customize the type of heading element
|
49
|
+
*/
|
50
|
+
headingAs?: (() => ReactNode) | string | ElementType;
|
47
51
|
/**
|
48
52
|
* Empty state size
|
49
53
|
*/
|
@@ -18,7 +18,7 @@ var EmptyStateContent = require('../EmptyStateContent.js');
|
|
18
18
|
var NoDataIllustration = require('../assets/NoDataIllustration.js');
|
19
19
|
var EmptyState = require('../EmptyState.js');
|
20
20
|
|
21
|
-
var _excluded = ["action", "className", "illustrationPosition", "illustrationTheme", "illustrationDescription", "link", "size", "subtitle", "title"];
|
21
|
+
var _excluded = ["action", "className", "illustrationPosition", "illustrationTheme", "illustrationDescription", "link", "size", "headingAs", "subtitle", "title"];
|
22
22
|
|
23
23
|
// The block part of our conventional BEM class names (blockClass__E--M).
|
24
24
|
var blockClass = "".concat(settings.pkg.prefix, "--empty-state");
|
@@ -36,6 +36,8 @@ exports.NoDataEmptyState = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
36
36
|
link = _ref.link,
|
37
37
|
_ref$size = _ref.size,
|
38
38
|
size = _ref$size === void 0 ? EmptyState.defaults.size : _ref$size,
|
39
|
+
_ref$headingAs = _ref.headingAs,
|
40
|
+
headingAs = _ref$headingAs === void 0 ? EmptyState.defaults.headingAs : _ref$headingAs,
|
39
41
|
subtitle = _ref.subtitle,
|
40
42
|
title = _ref.title,
|
41
43
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
@@ -50,6 +52,7 @@ exports.NoDataEmptyState = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
50
52
|
action: action,
|
51
53
|
link: link,
|
52
54
|
size: size,
|
55
|
+
headingAs: headingAs,
|
53
56
|
subtitle: subtitle,
|
54
57
|
title: title || ''
|
55
58
|
}));
|
@@ -80,6 +83,10 @@ exports.NoDataEmptyState.propTypes = {
|
|
80
83
|
* Provide an optional class to be applied to the containing node.
|
81
84
|
*/
|
82
85
|
className: index.default.string,
|
86
|
+
/**
|
87
|
+
* Empty state headingAs allows you to customize the type of heading element
|
88
|
+
*/
|
89
|
+
headingAs: index.default.elementType,
|
83
90
|
/**
|
84
91
|
* The alt text for empty state svg images. If not provided , title will be used.
|
85
92
|
*/
|
@@ -5,7 +5,7 @@
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*/
|
7
7
|
/// <reference path="../../../../src/custom-typings/index.d.ts" />
|
8
|
-
import React, { ReactNode } from 'react';
|
8
|
+
import React, { ElementType, ReactNode } from 'react';
|
9
9
|
import { ButtonProps } from '@carbon/react';
|
10
10
|
import { CarbonIconType } from '@carbon/icons-react/lib/CarbonIcon';
|
11
11
|
export interface NoTagsEmptyStateProps {
|
@@ -44,6 +44,10 @@ export interface NoTagsEmptyStateProps {
|
|
44
44
|
text?: string | ReactNode;
|
45
45
|
href?: string;
|
46
46
|
};
|
47
|
+
/**
|
48
|
+
* Empty state headingAs allows you to customize the type of heading element
|
49
|
+
*/
|
50
|
+
headingAs?: (() => ReactNode) | string | ElementType;
|
47
51
|
/**
|
48
52
|
* Empty state size
|
49
53
|
*/
|
@@ -18,7 +18,7 @@ var EmptyStateContent = require('../EmptyStateContent.js');
|
|
18
18
|
var NoTagsIllustration = require('../assets/NoTagsIllustration.js');
|
19
19
|
var EmptyState = require('../EmptyState.js');
|
20
20
|
|
21
|
-
var _excluded = ["action", "className", "illustrationPosition", "illustrationTheme", "illustrationDescription", "link", "size", "subtitle", "title"];
|
21
|
+
var _excluded = ["action", "className", "illustrationPosition", "illustrationTheme", "illustrationDescription", "link", "size", "headingAs", "subtitle", "title"];
|
22
22
|
// The block part of our conventional BEM class names (blockClass__E--M).
|
23
23
|
var blockClass = "".concat(settings.pkg.prefix, "--empty-state");
|
24
24
|
var componentName = 'NoTagsEmptyState';
|
@@ -35,6 +35,8 @@ exports.NoTagsEmptyState = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
35
35
|
link = _ref.link,
|
36
36
|
_ref$size = _ref.size,
|
37
37
|
size = _ref$size === void 0 ? EmptyState.defaults.size : _ref$size,
|
38
|
+
_ref$headingAs = _ref.headingAs,
|
39
|
+
headingAs = _ref$headingAs === void 0 ? EmptyState.defaults.headingAs : _ref$headingAs,
|
38
40
|
subtitle = _ref.subtitle,
|
39
41
|
title = _ref.title,
|
40
42
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
@@ -49,6 +51,7 @@ exports.NoTagsEmptyState = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
49
51
|
action: action,
|
50
52
|
link: link,
|
51
53
|
size: size,
|
54
|
+
headingAs: headingAs,
|
52
55
|
subtitle: subtitle,
|
53
56
|
title: title = ''
|
54
57
|
}));
|
@@ -79,6 +82,10 @@ exports.NoTagsEmptyState.propTypes = {
|
|
79
82
|
* Provide an optional class to be applied to the containing node.
|
80
83
|
*/
|
81
84
|
className: index.default.string,
|
85
|
+
/**
|
86
|
+
* Empty state headingAs allows you to customize the type of heading element
|
87
|
+
*/
|
88
|
+
headingAs: index.default.elementType,
|
82
89
|
/**
|
83
90
|
* The alt text for empty state svg images. If not provided , title will be used.
|
84
91
|
*/
|
@@ -5,7 +5,7 @@
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*/
|
7
7
|
/// <reference path="../../../../src/custom-typings/index.d.ts" />
|
8
|
-
import React, { ReactNode } from 'react';
|
8
|
+
import React, { ElementType, ReactNode } from 'react';
|
9
9
|
import { ButtonProps } from '@carbon/react';
|
10
10
|
import { CarbonIconType } from '@carbon/icons-react/lib/CarbonIcon';
|
11
11
|
export interface NotFoundEmptyStateProps {
|
@@ -44,6 +44,10 @@ export interface NotFoundEmptyStateProps {
|
|
44
44
|
text?: string | ReactNode;
|
45
45
|
href?: string;
|
46
46
|
};
|
47
|
+
/**
|
48
|
+
* Empty state headingAs allows you to customize the type of heading element
|
49
|
+
*/
|
50
|
+
headingAs?: (() => ReactNode) | string | ElementType;
|
47
51
|
/**
|
48
52
|
* Empty state size
|
49
53
|
*/
|
@@ -18,7 +18,7 @@ var EmptyStateContent = require('../EmptyStateContent.js');
|
|
18
18
|
var NotFoundIllustration = require('../assets/NotFoundIllustration.js');
|
19
19
|
var EmptyState = require('../EmptyState.js');
|
20
20
|
|
21
|
-
var _excluded = ["action", "className", "illustrationPosition", "illustrationTheme", "illustrationDescription", "link", "size", "subtitle", "title"];
|
21
|
+
var _excluded = ["action", "className", "illustrationPosition", "illustrationTheme", "illustrationDescription", "link", "size", "headingAs", "subtitle", "title"];
|
22
22
|
// The block part of our conventional BEM class names (blockClass__E--M).
|
23
23
|
var blockClass = "".concat(settings.pkg.prefix, "--empty-state");
|
24
24
|
var componentName = 'NotFoundEmptyState';
|
@@ -35,6 +35,8 @@ exports.NotFoundEmptyState = /*#__PURE__*/React.forwardRef(function (_ref, ref)
|
|
35
35
|
link = _ref.link,
|
36
36
|
_ref$size = _ref.size,
|
37
37
|
size = _ref$size === void 0 ? EmptyState.defaults.size : _ref$size,
|
38
|
+
_ref$headingAs = _ref.headingAs,
|
39
|
+
headingAs = _ref$headingAs === void 0 ? EmptyState.defaults.headingAs : _ref$headingAs,
|
38
40
|
subtitle = _ref.subtitle,
|
39
41
|
title = _ref.title,
|
40
42
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
@@ -49,6 +51,7 @@ exports.NotFoundEmptyState = /*#__PURE__*/React.forwardRef(function (_ref, ref)
|
|
49
51
|
action: action,
|
50
52
|
link: link,
|
51
53
|
size: size,
|
54
|
+
headingAs: headingAs,
|
52
55
|
subtitle: subtitle,
|
53
56
|
title: title || ''
|
54
57
|
}));
|
@@ -79,6 +82,10 @@ exports.NotFoundEmptyState.propTypes = {
|
|
79
82
|
* Provide an optional class to be applied to the containing node.
|
80
83
|
*/
|
81
84
|
className: index.default.string,
|
85
|
+
/**
|
86
|
+
* Empty state headingAs allows you to customize the type of heading element
|
87
|
+
*/
|
88
|
+
headingAs: index.default.elementType,
|
82
89
|
/**
|
83
90
|
* The alt text for empty state svg images. If not provided , title will be used.
|
84
91
|
*/
|
@@ -5,7 +5,7 @@
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*/
|
7
7
|
/// <reference path="../../../../src/custom-typings/index.d.ts" />
|
8
|
-
import React, { ReactNode } from 'react';
|
8
|
+
import React, { ElementType, ReactNode } from 'react';
|
9
9
|
import { ButtonProps } from '@carbon/react';
|
10
10
|
import { CarbonIconType } from '@carbon/icons-react/lib/CarbonIcon';
|
11
11
|
export interface NotificationsEmptyStateProps {
|
@@ -44,6 +44,10 @@ export interface NotificationsEmptyStateProps {
|
|
44
44
|
text?: string | ReactNode;
|
45
45
|
href?: string;
|
46
46
|
};
|
47
|
+
/**
|
48
|
+
* Empty state headingAs allows you to customize the type of heading element
|
49
|
+
*/
|
50
|
+
headingAs?: (() => ReactNode) | string | ElementType;
|
47
51
|
/**
|
48
52
|
* Empty state size
|
49
53
|
*/
|
@@ -18,7 +18,7 @@ var EmptyStateContent = require('../EmptyStateContent.js');
|
|
18
18
|
var NotificationsIllustration = require('../assets/NotificationsIllustration.js');
|
19
19
|
var EmptyState = require('../EmptyState.js');
|
20
20
|
|
21
|
-
var _excluded = ["action", "className", "illustrationPosition", "illustrationTheme", "illustrationDescription", "link", "size", "subtitle", "title"];
|
21
|
+
var _excluded = ["action", "className", "illustrationPosition", "illustrationTheme", "illustrationDescription", "link", "size", "headingAs", "subtitle", "title"];
|
22
22
|
// The block part of our conventional BEM class names (blockClass__E--M).
|
23
23
|
var blockClass = "".concat(settings.pkg.prefix, "--empty-state");
|
24
24
|
var componentName = 'NotificationsEmptyState';
|
@@ -35,6 +35,8 @@ exports.NotificationsEmptyState = /*#__PURE__*/React.forwardRef(function (_ref,
|
|
35
35
|
link = _ref.link,
|
36
36
|
_ref$size = _ref.size,
|
37
37
|
size = _ref$size === void 0 ? EmptyState.defaults.size : _ref$size,
|
38
|
+
_ref$headingAs = _ref.headingAs,
|
39
|
+
headingAs = _ref$headingAs === void 0 ? EmptyState.defaults.headingAs : _ref$headingAs,
|
38
40
|
subtitle = _ref.subtitle,
|
39
41
|
title = _ref.title,
|
40
42
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
@@ -49,6 +51,7 @@ exports.NotificationsEmptyState = /*#__PURE__*/React.forwardRef(function (_ref,
|
|
49
51
|
action: action,
|
50
52
|
link: link,
|
51
53
|
size: size,
|
54
|
+
headingAs: headingAs,
|
52
55
|
subtitle: subtitle,
|
53
56
|
title: title || ''
|
54
57
|
}));
|
@@ -79,6 +82,10 @@ exports.NotificationsEmptyState.propTypes = {
|
|
79
82
|
* Provide an optional class to be applied to the containing node.
|
80
83
|
*/
|
81
84
|
className: index.default.string,
|
85
|
+
/**
|
86
|
+
* Empty state headingAs allows you to customize the type of heading element
|
87
|
+
*/
|
88
|
+
headingAs: index.default.elementType,
|
82
89
|
/**
|
83
90
|
* The alt text for empty state svg images. If not provided , title will be used.
|
84
91
|
*/
|
@@ -5,7 +5,7 @@
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*/
|
7
7
|
/// <reference path="../../../../src/custom-typings/index.d.ts" />
|
8
|
-
import React, { ReactNode } from 'react';
|
8
|
+
import React, { ElementType, ReactNode } from 'react';
|
9
9
|
import { ButtonProps } from '@carbon/react';
|
10
10
|
import { CarbonIconType } from '@carbon/icons-react/lib/CarbonIcon';
|
11
11
|
export interface UnauthorizedEmptyStateProps {
|
@@ -44,6 +44,10 @@ export interface UnauthorizedEmptyStateProps {
|
|
44
44
|
text?: string | ReactNode;
|
45
45
|
href?: string;
|
46
46
|
};
|
47
|
+
/**
|
48
|
+
* Empty state headingAs allows you to customize the type of heading element
|
49
|
+
*/
|
50
|
+
headingAs?: (() => ReactNode) | string | ElementType;
|
47
51
|
/**
|
48
52
|
* Empty state size
|
49
53
|
*/
|
@@ -18,7 +18,7 @@ var EmptyStateContent = require('../EmptyStateContent.js');
|
|
18
18
|
var UnauthorizedIllustration = require('../assets/UnauthorizedIllustration.js');
|
19
19
|
var EmptyState = require('../EmptyState.js');
|
20
20
|
|
21
|
-
var _excluded = ["action", "className", "illustrationPosition", "illustrationTheme", "illustrationDescription", "link", "size", "subtitle", "title"];
|
21
|
+
var _excluded = ["action", "className", "illustrationPosition", "illustrationTheme", "illustrationDescription", "link", "size", "headingAs", "subtitle", "title"];
|
22
22
|
|
23
23
|
// The block part of our conventional BEM class names (blockClass__E--M).
|
24
24
|
var blockClass = "".concat(settings.pkg.prefix, "--empty-state");
|
@@ -36,6 +36,8 @@ exports.UnauthorizedEmptyState = /*#__PURE__*/React.forwardRef(function (_ref, r
|
|
36
36
|
link = _ref.link,
|
37
37
|
_ref$size = _ref.size,
|
38
38
|
size = _ref$size === void 0 ? EmptyState.defaults.size : _ref$size,
|
39
|
+
_ref$headingAs = _ref.headingAs,
|
40
|
+
headingAs = _ref$headingAs === void 0 ? EmptyState.defaults.headingAs : _ref$headingAs,
|
39
41
|
subtitle = _ref.subtitle,
|
40
42
|
title = _ref.title,
|
41
43
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
@@ -50,6 +52,7 @@ exports.UnauthorizedEmptyState = /*#__PURE__*/React.forwardRef(function (_ref, r
|
|
50
52
|
action: action,
|
51
53
|
link: link,
|
52
54
|
size: size,
|
55
|
+
headingAs: headingAs,
|
53
56
|
subtitle: subtitle,
|
54
57
|
title: title || ''
|
55
58
|
}));
|
@@ -80,6 +83,10 @@ exports.UnauthorizedEmptyState.propTypes = {
|
|
80
83
|
* Provide an optional class to be applied to the containing node.
|
81
84
|
*/
|
82
85
|
className: index.default.string,
|
86
|
+
/**
|
87
|
+
* Empty state headingAs allows you to customize the type of heading element
|
88
|
+
*/
|
89
|
+
headingAs: index.default.elementType,
|
83
90
|
/**
|
84
91
|
* The alt text for empty state svg images. If not provided , title will be used.
|
85
92
|
*/
|
@@ -33,7 +33,8 @@ var ErrorIllustration = function ErrorIllustration(_ref) {
|
|
33
33
|
height: 80,
|
34
34
|
viewBox: "0 0 80 80",
|
35
35
|
className: cx(["".concat(blockClass, "__illustration"), "".concat(blockClass, "__illustration-error"), "".concat(blockClass, "__illustration--").concat(size)]),
|
36
|
-
role: "img"
|
36
|
+
role: "img",
|
37
|
+
"aria-hidden": "true"
|
37
38
|
}), /*#__PURE__*/React.createElement("title", null, alt), theme === 'dark' ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
|
38
39
|
id: "prefix__a_dark_".concat(svgId),
|
39
40
|
x1: 38.9,
|
@@ -33,7 +33,8 @@ var NoDataIllustration = function NoDataIllustration(_ref) {
|
|
33
33
|
height: 80,
|
34
34
|
viewBox: "0 0 80 80",
|
35
35
|
className: cx(["".concat(blockClass, "__illustration"), "".concat(blockClass, "__illustration-noData"), "".concat(blockClass, "__illustration--").concat(size)]),
|
36
|
-
role: "img"
|
36
|
+
role: "img",
|
37
|
+
"aria-hidden": "true"
|
37
38
|
}), /*#__PURE__*/React.createElement("title", null, alt), theme === 'dark' ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
|
38
39
|
id: "prefix__a_dark_".concat(svgId),
|
39
40
|
x1: 11.12,
|
@@ -34,7 +34,8 @@ var NoTagsIllustration = function NoTagsIllustration(_ref) {
|
|
34
34
|
height: 80,
|
35
35
|
viewBox: "0 0 80 80",
|
36
36
|
className: cx(["".concat(blockClass, "__illustration"), "".concat(blockClass, "__illustration-noTags"), "".concat(blockClass, "__illustration--").concat(size)]),
|
37
|
-
role: "img"
|
37
|
+
role: "img",
|
38
|
+
"aria-hidden": "true"
|
38
39
|
}), /*#__PURE__*/React.createElement("title", null, alt), theme === 'dark' ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
|
39
40
|
id: "prefix__c_dark_".concat(svgId),
|
40
41
|
x1: 34.96,
|
@@ -33,7 +33,8 @@ var NotFoundIllustration = function NotFoundIllustration(_ref) {
|
|
33
33
|
height: 80,
|
34
34
|
viewBox: "0 0 80 80",
|
35
35
|
className: cx(["".concat(blockClass, "__illustration"), "".concat(blockClass, "__illustration-notFound"), "".concat(blockClass, "__illustration--").concat(size)]),
|
36
|
-
role: "img"
|
36
|
+
role: "img",
|
37
|
+
"aria-hidden": "true"
|
37
38
|
}), /*#__PURE__*/React.createElement("title", null, alt), theme === 'dark' ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
|
38
39
|
id: "prefix__a_dark_".concat(svgId),
|
39
40
|
x1: 2.6,
|
@@ -32,7 +32,8 @@ var NotificationsIllustration = function NotificationsIllustration(_ref) {
|
|
32
32
|
width: 80,
|
33
33
|
height: 80,
|
34
34
|
viewBox: "0 0 80 80",
|
35
|
-
className: cx(["".concat(blockClass, "__illustration"), "".concat(blockClass, "__illustration-notification"), "".concat(blockClass, "__illustration--").concat(size)])
|
35
|
+
className: cx(["".concat(blockClass, "__illustration"), "".concat(blockClass, "__illustration-notification"), "".concat(blockClass, "__illustration--").concat(size)]),
|
36
|
+
"aria-hidden": "true"
|
36
37
|
}), /*#__PURE__*/React.createElement("title", null, alt), theme === 'dark' ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
|
37
38
|
id: "prefix__a_dark_".concat(svgId),
|
38
39
|
x1: 30.05,
|
@@ -34,7 +34,8 @@ var UnauthorizedIllustration = function UnauthorizedIllustration(_ref) {
|
|
34
34
|
height: 80,
|
35
35
|
viewBox: "0 0 80 80",
|
36
36
|
className: cx(["".concat(blockClass, "__illustration"), "".concat(blockClass, "__illustration-unauthorized"), "".concat(blockClass, "__illustration--").concat(size)]),
|
37
|
-
role: "img"
|
37
|
+
role: "img",
|
38
|
+
"aria-hidden": "true"
|
38
39
|
}), /*#__PURE__*/React.createElement("title", null, alt), theme === 'dark' ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
|
39
40
|
id: "prefix__b_dark_".concat(svgId),
|
40
41
|
x1: 17.33,
|
@@ -130,7 +130,7 @@ var FilterSummary = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
130
130
|
ref: localRef,
|
131
131
|
className: cx([blockClass, className], _rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__expanded"), multiline))
|
132
132
|
}), /*#__PURE__*/React.createElement(framerMotion.AnimatePresence, {
|
133
|
-
|
133
|
+
exitBeforeEnter: true
|
134
134
|
}, !multiline && renderTagSet('single'), multiline && renderTagSet('multiline')), /*#__PURE__*/React.createElement(react.Button, {
|
135
135
|
kind: "ghost",
|
136
136
|
size: "sm",
|
@@ -9,11 +9,6 @@ import PropTypes from 'prop-types';
|
|
9
9
|
import { TearsheetAction } from './Tearsheet';
|
10
10
|
interface TearsheetShellProps extends PropsWithChildren {
|
11
11
|
actions?: TearsheetAction[];
|
12
|
-
/**
|
13
|
-
* Optional prop that is intended for any scenario where something is being generated by AI to reinforce AI transparency,
|
14
|
-
* accountability, and explainability at the UI level.
|
15
|
-
*/
|
16
|
-
aiLabel?: ReactNode;
|
17
12
|
ariaLabel?: string;
|
18
13
|
/**
|
19
14
|
* An optional class or classes to be added to the outermost element.
|
@@ -23,6 +18,10 @@ interface TearsheetShellProps extends PropsWithChildren {
|
|
23
18
|
* Used to track the current step on components which use `StepsContext` and `TearsheetShell`
|
24
19
|
*/
|
25
20
|
currentStep?: number;
|
21
|
+
/**
|
22
|
+
* Optional prop that allows you to pass any component.
|
23
|
+
*/
|
24
|
+
decorator?: ReactNode;
|
26
25
|
/**
|
27
26
|
* A description of the flow, displayed in the header area of the tearsheet.
|
28
27
|
*/
|
@@ -36,6 +35,11 @@ interface TearsheetShellProps extends PropsWithChildren {
|
|
36
35
|
* this prop to either true or false.
|
37
36
|
*/
|
38
37
|
hasCloseIcon?: boolean;
|
38
|
+
/**
|
39
|
+
* To indicate an error occurred in the Tearsheet step
|
40
|
+
* Mainly used by CreateTearsheet component to pass error state
|
41
|
+
*/
|
42
|
+
hasError?: boolean;
|
39
43
|
/**
|
40
44
|
* The content for the header actions area, displayed alongside the title in
|
41
45
|
* the header area of the tearsheet. This is typically a drop-down, or a set
|
@@ -110,7 +114,7 @@ interface TearsheetShellProps extends PropsWithChildren {
|
|
110
114
|
title?: ReactNode;
|
111
115
|
verticalPosition?: 'normal' | 'lower';
|
112
116
|
/**
|
113
|
-
* @deprecated Property replaced by `
|
117
|
+
* @deprecated Property replaced by `decorator`
|
114
118
|
*/
|
115
119
|
slug?: ReactNode;
|
116
120
|
}
|
@@ -135,7 +139,7 @@ export declare const TearsheetShell: React.ForwardRefExoticComponent<(TearsheetS
|
|
135
139
|
export declare const portalType: PropTypes.Requireable<object>;
|
136
140
|
export declare const deprecatedProps: {
|
137
141
|
/**
|
138
|
-
* @deprecated Property replaced by `
|
142
|
+
* @deprecated Property replaced by `decorator`
|
139
143
|
*/
|
140
144
|
slug: (props: any, propName: any, comp: any, loc: any, propFullName: any, secret: any) => any;
|
141
145
|
/**
|
@@ -23,7 +23,7 @@ var usePortalTarget = require('../../global/js/hooks/usePortalTarget.js');
|
|
23
23
|
var useFocus = require('../../global/js/hooks/useFocus.js');
|
24
24
|
var usePreviousValue = require('../../global/js/hooks/usePreviousValue.js');
|
25
25
|
|
26
|
-
var _excluded = ["actions", "
|
26
|
+
var _excluded = ["actions", "decorator", "ariaLabel", "children", "className", "closeIconDescription", "currentStep", "description", "hasCloseIcon", "hasError", "headerActions", "influencer", "influencerPosition", "influencerWidth", "label", "navigation", "onClose", "open", "portalTarget", "selectorPrimaryFocus", "selectorsFloatingMenus", "size", "slug", "title", "verticalPosition", "launcherButtonRef"];
|
27
27
|
// The block part of our conventional BEM class names (bc__E--M).
|
28
28
|
var bc = "".concat(settings.pkg.prefix, "--tearsheet");
|
29
29
|
var componentName = 'TearsheetShell';
|
@@ -65,7 +65,7 @@ var tearsheetHasCloseIcon = function tearsheetHasCloseIcon(actions, hasCloseIcon
|
|
65
65
|
* */
|
66
66
|
var TearsheetShell = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
67
67
|
var actions = _ref.actions,
|
68
|
-
|
68
|
+
decorator = _ref.decorator,
|
69
69
|
ariaLabel = _ref.ariaLabel,
|
70
70
|
children = _ref.children,
|
71
71
|
className = _ref.className,
|
@@ -73,6 +73,7 @@ var TearsheetShell = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
73
73
|
currentStep = _ref.currentStep,
|
74
74
|
description = _ref.description,
|
75
75
|
hasCloseIcon = _ref.hasCloseIcon,
|
76
|
+
hasError = _ref.hasError,
|
76
77
|
headerActions = _ref.headerActions,
|
77
78
|
influencer = _ref.influencer,
|
78
79
|
influencerPosition = _ref.influencerPosition,
|
@@ -144,7 +145,7 @@ var TearsheetShell = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
144
145
|
// Focusing the first element or selectorPrimaryFocus element
|
145
146
|
useFocus.claimFocus(firstElement, modalRef, selectorPrimaryFocus);
|
146
147
|
}
|
147
|
-
}, [currentStep, depth, firstElement, modalRef, modalRefValue, open, position, selectorPrimaryFocus]);
|
148
|
+
}, [currentStep, depth, firstElement, modalRef, modalRefValue, open, position, selectorPrimaryFocus, hasError]);
|
148
149
|
React.useEffect(function () {
|
149
150
|
if (prevOpen && !open && launcherButtonRef) {
|
150
151
|
setTimeout(function () {
|
@@ -191,7 +192,7 @@ var TearsheetShell = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
191
192
|
};
|
192
193
|
}, [open, size]);
|
193
194
|
if (position <= depth) {
|
194
|
-
var _prevDepth$current;
|
195
|
+
var _prevDepth$current, _decorator$type, _decorator$type2;
|
195
196
|
// Include a modal header if and only if one or more of these is given.
|
196
197
|
// We can't use a Wrap for the ModalHeader because ComposedModal requires
|
197
198
|
// the direct child to be the ModalHeader instance.
|
@@ -212,10 +213,10 @@ var TearsheetShell = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
212
213
|
enableExperimentalFocusWrapWithoutSentinels: true
|
213
214
|
}, /*#__PURE__*/React.createElement(react.ComposedModal, _rollupPluginBabelHelpers.extends({}, rest, {
|
214
215
|
"aria-label": ariaLabel || getNodeTextContent.getNodeTextContent(title),
|
215
|
-
className: cx(bc, className, _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "".concat(bc, "--stacked-").concat(position, "-of-").concat(depth),
|
216
|
+
className: cx(bc, className, _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "".concat(bc, "--stacked-").concat(position, "-of-").concat(depth),
|
216
217
|
// Don't apply this on the initial open of a single tearsheet.
|
217
|
-
depth > 1 || depth === 1 && ((_prevDepth$current = prevDepth === null || prevDepth === void 0 ? void 0 : prevDepth.current) !== null && _prevDepth$current !== void 0 ? _prevDepth$current : 0) > 1), "".concat(bc, "--wide"), wide), "".concat(bc, "--narrow"), !wide), "".concat(bc, "--has-slug"), deprecated_slug), "".concat(bc, "--has-ai-label"),
|
218
|
-
|
218
|
+
depth > 1 || depth === 1 && ((_prevDepth$current = prevDepth === null || prevDepth === void 0 ? void 0 : prevDepth.current) !== null && _prevDepth$current !== void 0 ? _prevDepth$current : 0) > 1), "".concat(bc, "--wide"), wide), "".concat(bc, "--narrow"), !wide), "".concat(bc, "--has-slug"), deprecated_slug), "".concat(bc, "--has-ai-label"), !!decorator && ((_decorator$type = decorator['type']) === null || _decorator$type === void 0 ? void 0 : _decorator$type.displayName) === 'AILabel'), "".concat(bc, "--has-decorator"), !!decorator && ((_decorator$type2 = decorator['type']) === null || _decorator$type2 === void 0 ? void 0 : _decorator$type2.displayName) !== 'AILabel'), "".concat(bc, "--has-close"), effectiveHasCloseIcon)),
|
219
|
+
decorator: decorator || deprecated_slug,
|
219
220
|
style: setScaleValues(),
|
220
221
|
containerClassName: cx("".concat(bc, "__container"), _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "".concat(bc, "__container--lower"), verticalPosition === 'lower'), "".concat(bc, "__container--mixed-size-stacking"), !areAllSameSizeVariant())),
|
221
222
|
onClose: onClose,
|
@@ -293,9 +294,9 @@ var portalType = typeof Element === 'undefined' ? index.default.object :
|
|
293
294
|
index.default.instanceOf(Element);
|
294
295
|
var deprecatedProps = {
|
295
296
|
/**
|
296
|
-
* @deprecated Property replaced by `
|
297
|
+
* @deprecated Property replaced by `decorator`
|
297
298
|
*/
|
298
|
-
slug: propsHelper.deprecateProp(index.default.node, 'Property replaced by `
|
299
|
+
slug: propsHelper.deprecateProp(index.default.node, 'Property replaced by `decorator`'),
|
299
300
|
/**
|
300
301
|
* **Deprecated**
|
301
302
|
*
|
@@ -340,11 +341,6 @@ TearsheetShell.propTypes = _rollupPluginBabelHelpers.objectSpread2({
|
|
340
341
|
/**@ts-ignore*/
|
341
342
|
onClick: react.Button.propTypes.onClick
|
342
343
|
}))),
|
343
|
-
/**
|
344
|
-
* Optional prop that is intended for any scenario where something is being generated by AI to reinforce AI transparency,
|
345
|
-
* accountability, and explainability at the UI level.
|
346
|
-
*/
|
347
|
-
aiLabel: index.default.oneOfType([index.default.node, index.default.bool]),
|
348
344
|
/**
|
349
345
|
* The main content of the tearsheet.
|
350
346
|
*/
|
@@ -365,6 +361,10 @@ TearsheetShell.propTypes = _rollupPluginBabelHelpers.objectSpread2({
|
|
365
361
|
hasCloseIcon = _ref4.hasCloseIcon;
|
366
362
|
return tearsheetHasCloseIcon(actions, hasCloseIcon);
|
367
363
|
}),
|
364
|
+
/**
|
365
|
+
* Optional prop that allows you to pass any component.
|
366
|
+
*/
|
367
|
+
decorator: index.default.oneOfType([index.default.node, index.default.bool]),
|
368
368
|
/**
|
369
369
|
* A description of the flow, displayed in the header area of the tearsheet.
|
370
370
|
*/
|
@@ -18,6 +18,7 @@ var getSpecificElement = function getSpecificElement(parentEl, elementId) {
|
|
18
18
|
return elementId && !(element !== null && element !== void 0 && element.disabled) ? element : null;
|
19
19
|
};
|
20
20
|
var useFocus = function useFocus(modalRef, selectorPrimaryFocus) {
|
21
|
+
var _getFocusable2, _getFocusable3, _getFocusable4, _getFocusable5;
|
21
22
|
var carbonPrefix = react.usePrefix();
|
22
23
|
var tearsheetBaseClass = "".concat(settings.pkg.prefix, "--tearsheet");
|
23
24
|
var sidePanelBaseClass = "".concat(settings.pkg.prefix, "--side-panel");
|
@@ -31,15 +32,15 @@ var useFocus = function useFocus(modalRef, selectorPrimaryFocus) {
|
|
31
32
|
var querySelect = "select".concat(notQuery);
|
32
33
|
var queryTextarea = "textarea".concat(notQuery);
|
33
34
|
var queryLink = "[href]".concat(notQuery);
|
35
|
+
var queryAnchor = "a".concat(notQuery);
|
34
36
|
var queryTabIndex = "[tabindex=\"0\"]".concat(notQuery);
|
35
37
|
var querySidePanelScroll = ".".concat(sidePanelBaseClass, "--scrolls");
|
36
38
|
// Final query
|
37
|
-
var query = "".concat(queryButton, ",").concat(queryLink, ",").concat(queryInput, ",").concat(querySelect, ",").concat(queryTextarea, ",").concat(queryTabIndex, ",").concat(querySidePanelScroll);
|
38
|
-
var modalEl = modalRef === null || modalRef === void 0 ? void 0 : modalRef.current;
|
39
|
+
var query = "".concat(queryButton, ",").concat(queryLink, ",").concat(queryAnchor, ",").concat(queryInput, ",").concat(querySelect, ",").concat(queryTextarea, ",").concat(queryTabIndex, ",").concat(querySidePanelScroll);
|
39
40
|
var getFocusable = React.useCallback(function () {
|
40
|
-
var _focusableElements, _focusableElements2, _focusableElements3, _focusableElements4;
|
41
|
+
var _modalRef$current, _focusableElements, _focusableElements2, _focusableElements3, _focusableElements4;
|
41
42
|
// Selecting all focusable elements based on the above conditions
|
42
|
-
var focusableElements =
|
43
|
+
var focusableElements = modalRef === null || modalRef === void 0 || (_modalRef$current = modalRef.current) === null || _modalRef$current === void 0 ? void 0 : _modalRef$current.querySelectorAll("".concat(query));
|
43
44
|
if ((_focusableElements = focusableElements) !== null && _focusableElements !== void 0 && _focusableElements.length) {
|
44
45
|
focusableElements = Array.prototype.filter.call(focusableElements, function (el) {
|
45
46
|
var _window;
|
@@ -49,17 +50,17 @@ var useFocus = function useFocus(modalRef, selectorPrimaryFocus) {
|
|
49
50
|
var first = (_focusableElements2 = focusableElements) === null || _focusableElements2 === void 0 ? void 0 : _focusableElements2[0];
|
50
51
|
var last = (_focusableElements3 = focusableElements) === null || _focusableElements3 === void 0 ? void 0 : _focusableElements3[((_focusableElements4 = focusableElements) === null || _focusableElements4 === void 0 ? void 0 : _focusableElements4.length) - 1];
|
51
52
|
var all = focusableElements;
|
52
|
-
var specified = getSpecificElement(
|
53
|
+
var specified = getSpecificElement(modalRef === null || modalRef === void 0 ? void 0 : modalRef.current, selectorPrimaryFocus);
|
53
54
|
return {
|
54
55
|
first: first,
|
55
56
|
last: last,
|
56
57
|
all: all,
|
57
58
|
specified: specified
|
58
59
|
};
|
59
|
-
}, [
|
60
|
+
}, [modalRef, query, selectorPrimaryFocus]);
|
60
61
|
React.useEffect(function () {
|
61
62
|
getFocusable();
|
62
|
-
}, [getFocusable]);
|
63
|
+
}, [getFocusable, modalRef]);
|
63
64
|
var handleKeyDown = /*#__PURE__*/function () {
|
64
65
|
var _ref = _rollupPluginBabelHelpers.asyncToGenerator( /*#__PURE__*/_rollupPluginBabelHelpers.regeneratorRuntime().mark(function _callee(event) {
|
65
66
|
var _document, _document2, _getFocusable, first, last, all;
|
@@ -97,10 +98,10 @@ var useFocus = function useFocus(modalRef, selectorPrimaryFocus) {
|
|
97
98
|
};
|
98
99
|
}();
|
99
100
|
return {
|
100
|
-
firstElement: getFocusable().first,
|
101
|
-
lastElement: getFocusable().last,
|
102
|
-
allElements: getFocusable().all,
|
103
|
-
specifiedElement: getFocusable().specified,
|
101
|
+
firstElement: (_getFocusable2 = getFocusable()) === null || _getFocusable2 === void 0 ? void 0 : _getFocusable2.first,
|
102
|
+
lastElement: (_getFocusable3 = getFocusable()) === null || _getFocusable3 === void 0 ? void 0 : _getFocusable3.last,
|
103
|
+
allElements: (_getFocusable4 = getFocusable()) === null || _getFocusable4 === void 0 ? void 0 : _getFocusable4.all,
|
104
|
+
specifiedElement: (_getFocusable5 = getFocusable()) === null || _getFocusable5 === void 0 ? void 0 : _getFocusable5.specified,
|
104
105
|
keyDownListener: handleKeyDown,
|
105
106
|
getFocusable: getFocusable
|
106
107
|
};
|
@@ -113,15 +114,16 @@ var useFocus = function useFocus(modalRef, selectorPrimaryFocus) {
|
|
113
114
|
* @param {string | undefined} selectorPrimaryFocus
|
114
115
|
*/
|
115
116
|
var claimFocus = function claimFocus(firstElement, modalRef) {
|
117
|
+
var _window2, _specifiedEl;
|
116
118
|
var selectorPrimaryFocus = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
}
|
119
|
+
var specifiedEl;
|
120
|
+
if (selectorPrimaryFocus) {
|
121
|
+
specifiedEl = getSpecificElement(modalRef === null || modalRef === void 0 ? void 0 : modalRef.current, selectorPrimaryFocus);
|
122
|
+
}
|
123
|
+
if (specifiedEl && ((_window2 = window) === null || _window2 === void 0 || (_window2 = _window2.getComputedStyle(specifiedEl)) === null || _window2 === void 0 ? void 0 : _window2.display) !== 'none' && ((_specifiedEl = specifiedEl) === null || _specifiedEl === void 0 ? void 0 : _specifiedEl.tabIndex) !== -1) {
|
124
|
+
setTimeout(function () {
|
125
|
+
return specifiedEl.focus();
|
126
|
+
}, 0);
|
125
127
|
} else {
|
126
128
|
setTimeout(function () {
|
127
129
|
return firstElement === null || firstElement === void 0 ? void 0 : firstElement.focus();
|