carbon-react 104.53.3 → 104.54.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.
@@ -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: overflowX
55
- }, rest), /*#__PURE__*/React.createElement(StyledFlatTable, _extends({
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 };
@@ -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 4px;
46
+ margin: 0px;
44
47
 
45
48
  ${StyledSelectText} {
46
49
  font-size: 14px;
@@ -7,7 +7,9 @@ export default function useInputAccessibility({
7
7
  fieldHelp
8
8
  }) {
9
9
  const labelId = label ? `${id}-label` : undefined;
10
- const validationIconId = [error, warning, info].filter(validation => typeof validation === "string").length ? `${id}-validation-icon` : undefined;
10
+ const validationIconId = [error, warning, info].filter(validation => {
11
+ return validation && typeof validation === "string";
12
+ }).length ? `${id}-validation-icon` : undefined;
11
13
  const fieldHelpId = fieldHelp ? `${id}-field-help` : undefined;
12
14
  const ariaDescribedBy = [fieldHelpId, validationIconId].filter(Boolean).join(" ");
13
15
  const ariaLabelledBy = labelId;
@@ -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: overflowX
72
- }, rest), /*#__PURE__*/_react.default.createElement(_flatTable.StyledFlatTable, _extends({
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;
@@ -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 4px;
67
+ margin: 0px;
65
68
 
66
69
  ${_selectText.default} {
67
70
  font-size: 14px;
@@ -14,7 +14,9 @@ function useInputAccessibility({
14
14
  fieldHelp
15
15
  }) {
16
16
  const labelId = label ? `${id}-label` : undefined;
17
- const validationIconId = [error, warning, info].filter(validation => typeof validation === "string").length ? `${id}-validation-icon` : undefined;
17
+ const validationIconId = [error, warning, info].filter(validation => {
18
+ return validation && typeof validation === "string";
19
+ }).length ? `${id}-validation-icon` : undefined;
18
20
  const fieldHelpId = fieldHelp ? `${id}-field-help` : undefined;
19
21
  const ariaDescribedBy = [fieldHelpId, validationIconId].filter(Boolean).join(" ");
20
22
  const ariaLabelledBy = labelId;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-react",
3
- "version": "104.53.3",
3
+ "version": "104.54.1",
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.9.0",
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",