carbon-react 104.53.4 → 104.54.0
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/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/package.json +1 -1
|
@@ -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 };
|
|
@@ -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;
|