carbon-react 104.53.4 → 104.54.2
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/esm/components/flat-table/flat-table.component.d.ts +3 -1
- package/esm/components/flat-table/flat-table.component.js +14 -5
- package/esm/components/flat-table/flat-table.d.ts +4 -0
- package/esm/components/flat-table/flat-table.style.d.ts +1 -0
- package/esm/components/flat-table/flat-table.style.js +11 -1
- package/esm/components/multi-action-button/multi-action-button.component.js +9 -1
- package/esm/components/pager/pager.style.js +4 -1
- package/esm/components/split-button/split-button.component.js +10 -2
- package/lib/components/flat-table/flat-table.component.d.ts +3 -1
- package/lib/components/flat-table/flat-table.component.js +13 -4
- package/lib/components/flat-table/flat-table.d.ts +4 -0
- package/lib/components/flat-table/flat-table.style.d.ts +1 -0
- package/lib/components/flat-table/flat-table.style.js +12 -1
- package/lib/components/multi-action-button/multi-action-button.component.js +10 -1
- package/lib/components/pager/pager.style.js +4 -1
- package/lib/components/split-button/split-button.component.js +11 -2
- package/package.json +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export const FlatTableThemeContext: React.Context<{}>;
|
|
2
2
|
export default FlatTable;
|
|
3
3
|
import React from "react";
|
|
4
|
-
declare function FlatTable({ caption, children, hasStickyHead, colorTheme, footer, hasStickyFooter, height, isZebra, size, hasMaxHeight, ariaDescribedby, minHeight, overflowX, ...rest }: {
|
|
4
|
+
declare function FlatTable({ caption, children, hasStickyHead, colorTheme, footer, hasStickyFooter, height, isZebra, size, hasMaxHeight, ariaDescribedby, minHeight, overflowX, width, ...rest }: {
|
|
5
5
|
[x: string]: any;
|
|
6
6
|
caption: any;
|
|
7
7
|
children: any;
|
|
@@ -16,6 +16,7 @@ declare function FlatTable({ caption, children, hasStickyHead, colorTheme, foote
|
|
|
16
16
|
ariaDescribedby: any;
|
|
17
17
|
minHeight: any;
|
|
18
18
|
overflowX: any;
|
|
19
|
+
width: any;
|
|
19
20
|
}): JSX.Element;
|
|
20
21
|
declare namespace FlatTable {
|
|
21
22
|
namespace propTypes {
|
|
@@ -32,6 +33,7 @@ declare namespace FlatTable {
|
|
|
32
33
|
const size: PropTypes.Requireable<string>;
|
|
33
34
|
const hasMaxHeight: PropTypes.Requireable<boolean>;
|
|
34
35
|
const overflowX: PropTypes.Requireable<string>;
|
|
36
|
+
const width: PropTypes.Requireable<string>;
|
|
35
37
|
}
|
|
36
38
|
namespace defaultProps {
|
|
37
39
|
const colorTheme_1: string;
|
|
@@ -3,7 +3,7 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
|
3
3
|
import React from "react";
|
|
4
4
|
import PropTypes from "prop-types";
|
|
5
5
|
import styledSystemPropTypes from "@styled-system/prop-types";
|
|
6
|
-
import { StyledFlatTableWrapper, StyledFlatTable, StyledFlatTableFooter } from "./flat-table.style";
|
|
6
|
+
import { StyledFlatTableWrapper, StyledFlatTable, StyledFlatTableFooter, StyledTableContainer } from "./flat-table.style";
|
|
7
7
|
import { DrawerSidebarContext } from "../drawer";
|
|
8
8
|
import { filterStyledSystemMarginProps } from "../../style/utils";
|
|
9
9
|
export const FlatTableThemeContext = /*#__PURE__*/React.createContext({});
|
|
@@ -23,6 +23,7 @@ const FlatTable = ({
|
|
|
23
23
|
ariaDescribedby,
|
|
24
24
|
minHeight,
|
|
25
25
|
overflowX,
|
|
26
|
+
width,
|
|
26
27
|
...rest
|
|
27
28
|
}) => {
|
|
28
29
|
const addDefaultHeight = !height && (hasStickyHead || hasStickyFooter);
|
|
@@ -39,6 +40,7 @@ const FlatTable = ({
|
|
|
39
40
|
return /*#__PURE__*/React.createElement(DrawerSidebarContext.Consumer, null, ({
|
|
40
41
|
isInSidebar
|
|
41
42
|
}) => /*#__PURE__*/React.createElement(StyledFlatTableWrapper, _extends({
|
|
43
|
+
"data-component": "flat-table-wrapper",
|
|
42
44
|
isInSidebar: isInSidebar,
|
|
43
45
|
hasStickyHead: hasStickyHead,
|
|
44
46
|
colorTheme: colorTheme,
|
|
@@ -51,15 +53,19 @@ const FlatTable = ({
|
|
|
51
53
|
justifyContent: hasStickyFooter || height ? "space-between" : undefined,
|
|
52
54
|
tabIndex: "0",
|
|
53
55
|
role: "region",
|
|
54
|
-
overflowX:
|
|
55
|
-
|
|
56
|
+
overflowX: width ? "hidden" : undefined,
|
|
57
|
+
width: width
|
|
58
|
+
}, rest), /*#__PURE__*/React.createElement(StyledTableContainer, {
|
|
59
|
+
overflowX: overflowX,
|
|
60
|
+
width: width
|
|
61
|
+
}, /*#__PURE__*/React.createElement(StyledFlatTable, _extends({
|
|
56
62
|
"data-component": "flat-table"
|
|
57
63
|
}, tableStylingProps), caption ? /*#__PURE__*/React.createElement("caption", null, caption) : null, /*#__PURE__*/React.createElement(FlatTableThemeContext.Provider, {
|
|
58
64
|
value: {
|
|
59
65
|
colorTheme,
|
|
60
66
|
size
|
|
61
67
|
}
|
|
62
|
-
}, children)), footer && /*#__PURE__*/React.createElement(StyledFlatTableFooter, {
|
|
68
|
+
}, children))), footer && /*#__PURE__*/React.createElement(StyledFlatTableFooter, {
|
|
63
69
|
hasStickyFooter: hasStickyFooter
|
|
64
70
|
}, footer)));
|
|
65
71
|
};
|
|
@@ -103,7 +109,10 @@ FlatTable.propTypes = { ...marginPropTypes,
|
|
|
103
109
|
hasMaxHeight: PropTypes.bool,
|
|
104
110
|
|
|
105
111
|
/** Set the overflow X of the table wrapper. Any valid CSS string */
|
|
106
|
-
overflowX: PropTypes.string
|
|
112
|
+
overflowX: PropTypes.string,
|
|
113
|
+
|
|
114
|
+
/** Width of the table. Any valid CSS string */
|
|
115
|
+
width: PropTypes.string
|
|
107
116
|
};
|
|
108
117
|
FlatTable.defaultProps = {
|
|
109
118
|
colorTheme: "dark",
|
|
@@ -26,6 +26,10 @@ export interface FlatTableProps extends MarginProps {
|
|
|
26
26
|
size?: "compact" | "small" | "medium" | "large" | "extraLarge";
|
|
27
27
|
/** Applies max-height of 100% to FlatTable if true */
|
|
28
28
|
hasMaxHeight?: boolean;
|
|
29
|
+
/** Set the overflow X of the table wrapper. Any valid CSS string */
|
|
30
|
+
overflowX?: string;
|
|
31
|
+
/** Width of the table. Any valid CSS string */
|
|
32
|
+
width?: string;
|
|
29
33
|
}
|
|
30
34
|
|
|
31
35
|
declare function FlatTable(props: FlatTableProps): JSX.Element;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export const StyledFlatTableWrapper: import("styled-components").StyledComponent<typeof Box, any, {}, never>;
|
|
2
2
|
export const StyledFlatTable: import("styled-components").StyledComponent<"table", any, {}, never>;
|
|
3
3
|
export const StyledFlatTableFooter: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
4
|
+
export const StyledTableContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
4
5
|
import Box from "../box";
|
|
@@ -8,6 +8,16 @@ import { baseTheme } from "../../style/themes";
|
|
|
8
8
|
import { StyledFlatTableCell } from "./flat-table-cell/flat-table-cell.style";
|
|
9
9
|
import cellSizes from "./cell-sizes.style";
|
|
10
10
|
import Box from "../box";
|
|
11
|
+
const StyledTableContainer = styled.div`
|
|
12
|
+
${({
|
|
13
|
+
width,
|
|
14
|
+
overflowX
|
|
15
|
+
}) => width && css`
|
|
16
|
+
width: ${width};
|
|
17
|
+
|
|
18
|
+
${overflowX && `overflow-x: ${overflowX}`}
|
|
19
|
+
`}
|
|
20
|
+
`;
|
|
11
21
|
const StyledFlatTable = styled.table`
|
|
12
22
|
border-collapse: separate;
|
|
13
23
|
border-radius: 0px;
|
|
@@ -190,4 +200,4 @@ const StyledFlatTableFooter = styled.div`
|
|
|
190
200
|
bottom: 0px;
|
|
191
201
|
`}
|
|
192
202
|
`;
|
|
193
|
-
export { StyledFlatTableWrapper, StyledFlatTable, StyledFlatTableFooter };
|
|
203
|
+
export { StyledFlatTableWrapper, StyledFlatTable, StyledFlatTableFooter, StyledTableContainer };
|
|
@@ -8,6 +8,7 @@ import Button, { ButtonWithForwardRef } from "../button";
|
|
|
8
8
|
import Events from "../../__internal__/utils/helpers/events";
|
|
9
9
|
import Popover from "../../__internal__/popover";
|
|
10
10
|
import { filterStyledSystemMarginProps } from "../../style/utils";
|
|
11
|
+
import { defaultFocusableSelectors } from "../../__internal__/focus-trap/focus-trap-utils";
|
|
11
12
|
const marginPropTypes = filterStyledSystemMarginProps(styledSystemPropTypes.space);
|
|
12
13
|
|
|
13
14
|
const MultiActionButton = ({
|
|
@@ -22,6 +23,7 @@ const MultiActionButton = ({
|
|
|
22
23
|
...rest
|
|
23
24
|
}) => {
|
|
24
25
|
const ref = useRef();
|
|
26
|
+
const buttonRef = useRef();
|
|
25
27
|
const buttonContainer = useRef();
|
|
26
28
|
const userInputType = "ontouchstart" in document.documentElement ? "touchstart" : "click";
|
|
27
29
|
const buttonChildren = React.Children.toArray(children);
|
|
@@ -74,7 +76,12 @@ const MultiActionButton = ({
|
|
|
74
76
|
nextIndex = currentIndex < children.length - 1 ? currentIndex + 1 : 0;
|
|
75
77
|
ev.preventDefault();
|
|
76
78
|
} else if (Events.isTabKey(ev)) {
|
|
77
|
-
|
|
79
|
+
var _elements$indexOf;
|
|
80
|
+
|
|
81
|
+
const elements = Array.from(document.querySelectorAll(defaultFocusableSelectors)).filter(el => Number(el.tabIndex) !== -1);
|
|
82
|
+
const indexOf = elements.indexOf(buttonRef.current);
|
|
83
|
+
(_elements$indexOf = elements[indexOf]) === null || _elements$indexOf === void 0 ? void 0 : _elements$indexOf.focus(); // timeout enforces that the "hideButtons" method will be run after browser focuses on the next element
|
|
84
|
+
|
|
78
85
|
setTimeout(hideButtons, 0);
|
|
79
86
|
}
|
|
80
87
|
|
|
@@ -182,6 +189,7 @@ const MultiActionButton = ({
|
|
|
182
189
|
key: "toggle-button",
|
|
183
190
|
onKeyDown: handleMainButtonKeyDown
|
|
184
191
|
}, mainButtonProps(), {
|
|
192
|
+
forwardRef: buttonRef,
|
|
185
193
|
iconPosition: "after",
|
|
186
194
|
iconType: "dropdown"
|
|
187
195
|
}), text), showAdditionalButtons && renderAdditionalButtons());
|
|
@@ -6,6 +6,9 @@ import StyledSelectText from "../select/__internal__/select-text/select-text.sty
|
|
|
6
6
|
import Link from "../link";
|
|
7
7
|
const StyledSelectContainer = styled.div`
|
|
8
8
|
height: 26px;
|
|
9
|
+
width: 55px;
|
|
10
|
+
margin-left: 4px;
|
|
11
|
+
margin-right: 4px;
|
|
9
12
|
|
|
10
13
|
${StyledInputPresentation} {
|
|
11
14
|
padding-left: 0;
|
|
@@ -40,7 +43,7 @@ const StyledPagerSizeOptions = styled.div`
|
|
|
40
43
|
height: 26px;
|
|
41
44
|
min-height: 26px;
|
|
42
45
|
min-width: 10px;
|
|
43
|
-
margin: 0px
|
|
46
|
+
margin: 0px;
|
|
44
47
|
|
|
45
48
|
${StyledSelectText} {
|
|
46
49
|
font-size: 14px;
|
|
@@ -14,6 +14,7 @@ import guid from "../../__internal__/utils/helpers/guid";
|
|
|
14
14
|
import Popover from "../../__internal__/popover";
|
|
15
15
|
import { filterStyledSystemMarginProps } from "../../style/utils";
|
|
16
16
|
import { baseTheme } from "../../style/themes";
|
|
17
|
+
import { defaultFocusableSelectors } from "../../__internal__/focus-trap/focus-trap-utils";
|
|
17
18
|
const marginPropTypes = filterStyledSystemMarginProps(styledSystemPropTypes.space);
|
|
18
19
|
const CONTENT_WIDTH_RATIO = 0.75;
|
|
19
20
|
|
|
@@ -36,6 +37,7 @@ const SplitButton = ({
|
|
|
36
37
|
const buttonLabelId = useRef(guid());
|
|
37
38
|
const additionalButtons = useRef([]);
|
|
38
39
|
const splitButtonNode = useRef();
|
|
40
|
+
const toggleButton = useRef();
|
|
39
41
|
const buttonContainer = useRef();
|
|
40
42
|
const [showAdditionalButtons, setShowAdditionalButtons] = useState(false);
|
|
41
43
|
const [minWidth, setMinWidth] = useState(0);
|
|
@@ -69,7 +71,12 @@ const SplitButton = ({
|
|
|
69
71
|
nextIndex = currentIndex < numOfChildren ? currentIndex + 1 : 0;
|
|
70
72
|
ev.preventDefault();
|
|
71
73
|
} else if (Events.isTabKey(ev)) {
|
|
72
|
-
|
|
74
|
+
var _elements$indexOf;
|
|
75
|
+
|
|
76
|
+
const elements = Array.from(document.querySelectorAll(defaultFocusableSelectors)).filter(el => Number(el.tabIndex) !== -1);
|
|
77
|
+
const indexOf = elements.indexOf(toggleButton.current);
|
|
78
|
+
(_elements$indexOf = elements[indexOf]) === null || _elements$indexOf === void 0 ? void 0 : _elements$indexOf.focus(); // timeout enforces that the "hideButtons" method will be run after browser focuses on the next element
|
|
79
|
+
|
|
73
80
|
setTimeout(hideButtons, 0);
|
|
74
81
|
}
|
|
75
82
|
|
|
@@ -156,7 +163,8 @@ const SplitButton = ({
|
|
|
156
163
|
"aria-label": "Show more",
|
|
157
164
|
"data-element": "toggle-button",
|
|
158
165
|
key: "toggle-button",
|
|
159
|
-
type: "button"
|
|
166
|
+
type: "button",
|
|
167
|
+
ref: toggleButton
|
|
160
168
|
}, toggleButtonProps()), /*#__PURE__*/React.createElement(Icon, {
|
|
161
169
|
type: "dropdown",
|
|
162
170
|
bgSize: "extra-small",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export const FlatTableThemeContext: React.Context<{}>;
|
|
2
2
|
export default FlatTable;
|
|
3
3
|
import React from "react";
|
|
4
|
-
declare function FlatTable({ caption, children, hasStickyHead, colorTheme, footer, hasStickyFooter, height, isZebra, size, hasMaxHeight, ariaDescribedby, minHeight, overflowX, ...rest }: {
|
|
4
|
+
declare function FlatTable({ caption, children, hasStickyHead, colorTheme, footer, hasStickyFooter, height, isZebra, size, hasMaxHeight, ariaDescribedby, minHeight, overflowX, width, ...rest }: {
|
|
5
5
|
[x: string]: any;
|
|
6
6
|
caption: any;
|
|
7
7
|
children: any;
|
|
@@ -16,6 +16,7 @@ declare function FlatTable({ caption, children, hasStickyHead, colorTheme, foote
|
|
|
16
16
|
ariaDescribedby: any;
|
|
17
17
|
minHeight: any;
|
|
18
18
|
overflowX: any;
|
|
19
|
+
width: any;
|
|
19
20
|
}): JSX.Element;
|
|
20
21
|
declare namespace FlatTable {
|
|
21
22
|
namespace propTypes {
|
|
@@ -32,6 +33,7 @@ declare namespace FlatTable {
|
|
|
32
33
|
const size: PropTypes.Requireable<string>;
|
|
33
34
|
const hasMaxHeight: PropTypes.Requireable<boolean>;
|
|
34
35
|
const overflowX: PropTypes.Requireable<string>;
|
|
36
|
+
const width: PropTypes.Requireable<string>;
|
|
35
37
|
}
|
|
36
38
|
namespace defaultProps {
|
|
37
39
|
const colorTheme_1: string;
|
|
@@ -40,6 +40,7 @@ const FlatTable = ({
|
|
|
40
40
|
ariaDescribedby,
|
|
41
41
|
minHeight,
|
|
42
42
|
overflowX,
|
|
43
|
+
width,
|
|
43
44
|
...rest
|
|
44
45
|
}) => {
|
|
45
46
|
const addDefaultHeight = !height && (hasStickyHead || hasStickyFooter);
|
|
@@ -56,6 +57,7 @@ const FlatTable = ({
|
|
|
56
57
|
return /*#__PURE__*/_react.default.createElement(_drawer.DrawerSidebarContext.Consumer, null, ({
|
|
57
58
|
isInSidebar
|
|
58
59
|
}) => /*#__PURE__*/_react.default.createElement(_flatTable.StyledFlatTableWrapper, _extends({
|
|
60
|
+
"data-component": "flat-table-wrapper",
|
|
59
61
|
isInSidebar: isInSidebar,
|
|
60
62
|
hasStickyHead: hasStickyHead,
|
|
61
63
|
colorTheme: colorTheme,
|
|
@@ -68,15 +70,19 @@ const FlatTable = ({
|
|
|
68
70
|
justifyContent: hasStickyFooter || height ? "space-between" : undefined,
|
|
69
71
|
tabIndex: "0",
|
|
70
72
|
role: "region",
|
|
71
|
-
overflowX:
|
|
72
|
-
|
|
73
|
+
overflowX: width ? "hidden" : undefined,
|
|
74
|
+
width: width
|
|
75
|
+
}, rest), /*#__PURE__*/_react.default.createElement(_flatTable.StyledTableContainer, {
|
|
76
|
+
overflowX: overflowX,
|
|
77
|
+
width: width
|
|
78
|
+
}, /*#__PURE__*/_react.default.createElement(_flatTable.StyledFlatTable, _extends({
|
|
73
79
|
"data-component": "flat-table"
|
|
74
80
|
}, tableStylingProps), caption ? /*#__PURE__*/_react.default.createElement("caption", null, caption) : null, /*#__PURE__*/_react.default.createElement(FlatTableThemeContext.Provider, {
|
|
75
81
|
value: {
|
|
76
82
|
colorTheme,
|
|
77
83
|
size
|
|
78
84
|
}
|
|
79
|
-
}, children)), footer && /*#__PURE__*/_react.default.createElement(_flatTable.StyledFlatTableFooter, {
|
|
85
|
+
}, children))), footer && /*#__PURE__*/_react.default.createElement(_flatTable.StyledFlatTableFooter, {
|
|
80
86
|
hasStickyFooter: hasStickyFooter
|
|
81
87
|
}, footer)));
|
|
82
88
|
};
|
|
@@ -120,7 +126,10 @@ FlatTable.propTypes = { ...marginPropTypes,
|
|
|
120
126
|
hasMaxHeight: _propTypes.default.bool,
|
|
121
127
|
|
|
122
128
|
/** Set the overflow X of the table wrapper. Any valid CSS string */
|
|
123
|
-
overflowX: _propTypes.default.string
|
|
129
|
+
overflowX: _propTypes.default.string,
|
|
130
|
+
|
|
131
|
+
/** Width of the table. Any valid CSS string */
|
|
132
|
+
width: _propTypes.default.string
|
|
124
133
|
};
|
|
125
134
|
FlatTable.defaultProps = {
|
|
126
135
|
colorTheme: "dark",
|
|
@@ -26,6 +26,10 @@ export interface FlatTableProps extends MarginProps {
|
|
|
26
26
|
size?: "compact" | "small" | "medium" | "large" | "extraLarge";
|
|
27
27
|
/** Applies max-height of 100% to FlatTable if true */
|
|
28
28
|
hasMaxHeight?: boolean;
|
|
29
|
+
/** Set the overflow X of the table wrapper. Any valid CSS string */
|
|
30
|
+
overflowX?: string;
|
|
31
|
+
/** Width of the table. Any valid CSS string */
|
|
32
|
+
width?: string;
|
|
29
33
|
}
|
|
30
34
|
|
|
31
35
|
declare function FlatTable(props: FlatTableProps): JSX.Element;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export const StyledFlatTableWrapper: import("styled-components").StyledComponent<typeof Box, any, {}, never>;
|
|
2
2
|
export const StyledFlatTable: import("styled-components").StyledComponent<"table", any, {}, never>;
|
|
3
3
|
export const StyledFlatTableFooter: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
4
|
+
export const StyledTableContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
4
5
|
import Box from "../box";
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.StyledFlatTableFooter = exports.StyledFlatTable = exports.StyledFlatTableWrapper = void 0;
|
|
6
|
+
exports.StyledTableContainer = exports.StyledFlatTableFooter = exports.StyledFlatTable = exports.StyledFlatTableWrapper = void 0;
|
|
7
7
|
|
|
8
8
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
9
9
|
|
|
@@ -31,6 +31,17 @@ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return
|
|
|
31
31
|
|
|
32
32
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
33
33
|
|
|
34
|
+
const StyledTableContainer = _styledComponents.default.div`
|
|
35
|
+
${({
|
|
36
|
+
width,
|
|
37
|
+
overflowX
|
|
38
|
+
}) => width && (0, _styledComponents.css)`
|
|
39
|
+
width: ${width};
|
|
40
|
+
|
|
41
|
+
${overflowX && `overflow-x: ${overflowX}`}
|
|
42
|
+
`}
|
|
43
|
+
`;
|
|
44
|
+
exports.StyledTableContainer = StyledTableContainer;
|
|
34
45
|
const StyledFlatTable = _styledComponents.default.table`
|
|
35
46
|
border-collapse: separate;
|
|
36
47
|
border-radius: 0px;
|
|
@@ -21,6 +21,8 @@ var _popover = _interopRequireDefault(require("../../__internal__/popover"));
|
|
|
21
21
|
|
|
22
22
|
var _utils = require("../../style/utils");
|
|
23
23
|
|
|
24
|
+
var _focusTrapUtils = require("../../__internal__/focus-trap/focus-trap-utils");
|
|
25
|
+
|
|
24
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
27
|
|
|
26
28
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
@@ -43,6 +45,7 @@ const MultiActionButton = ({
|
|
|
43
45
|
...rest
|
|
44
46
|
}) => {
|
|
45
47
|
const ref = (0, _react.useRef)();
|
|
48
|
+
const buttonRef = (0, _react.useRef)();
|
|
46
49
|
const buttonContainer = (0, _react.useRef)();
|
|
47
50
|
const userInputType = "ontouchstart" in document.documentElement ? "touchstart" : "click";
|
|
48
51
|
|
|
@@ -97,7 +100,12 @@ const MultiActionButton = ({
|
|
|
97
100
|
nextIndex = currentIndex < children.length - 1 ? currentIndex + 1 : 0;
|
|
98
101
|
ev.preventDefault();
|
|
99
102
|
} else if (_events.default.isTabKey(ev)) {
|
|
100
|
-
|
|
103
|
+
var _elements$indexOf;
|
|
104
|
+
|
|
105
|
+
const elements = Array.from(document.querySelectorAll(_focusTrapUtils.defaultFocusableSelectors)).filter(el => Number(el.tabIndex) !== -1);
|
|
106
|
+
const indexOf = elements.indexOf(buttonRef.current);
|
|
107
|
+
(_elements$indexOf = elements[indexOf]) === null || _elements$indexOf === void 0 ? void 0 : _elements$indexOf.focus(); // timeout enforces that the "hideButtons" method will be run after browser focuses on the next element
|
|
108
|
+
|
|
101
109
|
setTimeout(hideButtons, 0);
|
|
102
110
|
}
|
|
103
111
|
|
|
@@ -205,6 +213,7 @@ const MultiActionButton = ({
|
|
|
205
213
|
key: "toggle-button",
|
|
206
214
|
onKeyDown: handleMainButtonKeyDown
|
|
207
215
|
}, mainButtonProps(), {
|
|
216
|
+
forwardRef: buttonRef,
|
|
208
217
|
iconPosition: "after",
|
|
209
218
|
iconType: "dropdown"
|
|
210
219
|
}), text), showAdditionalButtons && renderAdditionalButtons());
|
|
@@ -25,6 +25,9 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
|
|
|
25
25
|
|
|
26
26
|
const StyledSelectContainer = _styledComponents.default.div`
|
|
27
27
|
height: 26px;
|
|
28
|
+
width: 55px;
|
|
29
|
+
margin-left: 4px;
|
|
30
|
+
margin-right: 4px;
|
|
28
31
|
|
|
29
32
|
${_inputPresentation.default} {
|
|
30
33
|
padding-left: 0;
|
|
@@ -61,7 +64,7 @@ const StyledPagerSizeOptions = _styledComponents.default.div`
|
|
|
61
64
|
height: 26px;
|
|
62
65
|
min-height: 26px;
|
|
63
66
|
min-width: 10px;
|
|
64
|
-
margin: 0px
|
|
67
|
+
margin: 0px;
|
|
65
68
|
|
|
66
69
|
${_selectText.default} {
|
|
67
70
|
font-size: 14px;
|
|
@@ -33,6 +33,8 @@ var _utils = require("../../style/utils");
|
|
|
33
33
|
|
|
34
34
|
var _themes = require("../../style/themes");
|
|
35
35
|
|
|
36
|
+
var _focusTrapUtils = require("../../__internal__/focus-trap/focus-trap-utils");
|
|
37
|
+
|
|
36
38
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
37
39
|
|
|
38
40
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
@@ -64,6 +66,7 @@ const SplitButton = ({
|
|
|
64
66
|
const buttonLabelId = (0, _react.useRef)((0, _guid.default)());
|
|
65
67
|
const additionalButtons = (0, _react.useRef)([]);
|
|
66
68
|
const splitButtonNode = (0, _react.useRef)();
|
|
69
|
+
const toggleButton = (0, _react.useRef)();
|
|
67
70
|
const buttonContainer = (0, _react.useRef)();
|
|
68
71
|
const [showAdditionalButtons, setShowAdditionalButtons] = (0, _react.useState)(false);
|
|
69
72
|
const [minWidth, setMinWidth] = (0, _react.useState)(0);
|
|
@@ -97,7 +100,12 @@ const SplitButton = ({
|
|
|
97
100
|
nextIndex = currentIndex < numOfChildren ? currentIndex + 1 : 0;
|
|
98
101
|
ev.preventDefault();
|
|
99
102
|
} else if (_events.default.isTabKey(ev)) {
|
|
100
|
-
|
|
103
|
+
var _elements$indexOf;
|
|
104
|
+
|
|
105
|
+
const elements = Array.from(document.querySelectorAll(_focusTrapUtils.defaultFocusableSelectors)).filter(el => Number(el.tabIndex) !== -1);
|
|
106
|
+
const indexOf = elements.indexOf(toggleButton.current);
|
|
107
|
+
(_elements$indexOf = elements[indexOf]) === null || _elements$indexOf === void 0 ? void 0 : _elements$indexOf.focus(); // timeout enforces that the "hideButtons" method will be run after browser focuses on the next element
|
|
108
|
+
|
|
101
109
|
setTimeout(hideButtons, 0);
|
|
102
110
|
}
|
|
103
111
|
|
|
@@ -184,7 +192,8 @@ const SplitButton = ({
|
|
|
184
192
|
"aria-label": "Show more",
|
|
185
193
|
"data-element": "toggle-button",
|
|
186
194
|
key: "toggle-button",
|
|
187
|
-
type: "button"
|
|
195
|
+
type: "button",
|
|
196
|
+
ref: toggleButton
|
|
188
197
|
}, toggleButtonProps()), /*#__PURE__*/_react.default.createElement(_icon.default, {
|
|
189
198
|
type: "dropdown",
|
|
190
199
|
bgSize: "extra-small",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "carbon-react",
|
|
3
|
-
"version": "104.
|
|
3
|
+
"version": "104.54.2",
|
|
4
4
|
"description": "A library of reusable React components for easily building user interfaces.",
|
|
5
5
|
"engineStrict": true,
|
|
6
6
|
"engines": {
|
|
@@ -156,7 +156,7 @@
|
|
|
156
156
|
},
|
|
157
157
|
"dependencies": {
|
|
158
158
|
"@octokit/rest": "^18.12.0",
|
|
159
|
-
"@popperjs/core": "^2.
|
|
159
|
+
"@popperjs/core": "^2.11.2",
|
|
160
160
|
"@sage/design-tokens": "^1.93.0",
|
|
161
161
|
"@styled-system/prop-types": "^5.1.5",
|
|
162
162
|
"@tippyjs/react": "^4.2.5",
|