carbon-react 119.4.1 → 119.4.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.
Files changed (119) hide show
  1. package/esm/__spec_helper__/test-utils.d.ts +1 -1
  2. package/esm/components/flat-table/cell-sizes.style.d.ts +28 -0
  3. package/esm/components/flat-table/flat-table-body/flat-table-body.component.d.ts +7 -0
  4. package/esm/components/flat-table/flat-table-body/flat-table-body.component.js +3 -2
  5. package/esm/components/flat-table/flat-table-body/index.d.ts +2 -2
  6. package/esm/components/flat-table/flat-table-body-draggable/flat-table-body-draggable.component.d.ts +9 -0
  7. package/esm/components/flat-table/flat-table-body-draggable/flat-table-body-draggable.component.js +6 -16
  8. package/esm/components/flat-table/flat-table-body-draggable/flat-table-body-draggable.style.d.ts +4 -0
  9. package/esm/components/flat-table/flat-table-body-draggable/index.d.ts +2 -2
  10. package/esm/components/flat-table/flat-table-cell/flat-table-cell.component.d.ts +69 -0
  11. package/esm/components/flat-table/flat-table-cell/flat-table-cell.component.js +7 -69
  12. package/esm/components/flat-table/flat-table-cell/flat-table-cell.style.d.ts +10 -0
  13. package/esm/components/flat-table/flat-table-cell/index.d.ts +2 -2
  14. package/esm/components/flat-table/flat-table-checkbox/flat-table-checkbox.component.d.ts +45 -0
  15. package/esm/components/flat-table/flat-table-checkbox/flat-table-checkbox.component.js +1 -39
  16. package/esm/components/flat-table/flat-table-checkbox/flat-table-checkbox.style.d.ts +6 -0
  17. package/esm/components/flat-table/flat-table-checkbox/index.d.ts +2 -2
  18. package/esm/components/flat-table/flat-table-head/flat-table-head.component.d.ts +7 -0
  19. package/esm/components/flat-table/flat-table-head/flat-table-head.component.js +8 -13
  20. package/esm/components/flat-table/flat-table-head/flat-table-head.style.d.ts +2 -0
  21. package/esm/components/flat-table/flat-table-head/index.d.ts +2 -2
  22. package/esm/components/flat-table/flat-table-header/flat-table-header-utils.d.ts +3 -0
  23. package/esm/components/flat-table/flat-table-header/flat-table-header.component.d.ts +55 -0
  24. package/esm/components/flat-table/flat-table-header/flat-table-header.component.js +7 -49
  25. package/esm/components/flat-table/flat-table-header/flat-table-header.style.d.ts +10 -0
  26. package/esm/components/flat-table/flat-table-header/index.d.ts +2 -2
  27. package/esm/components/flat-table/flat-table-row/__internal__/flat-table-row-draggable.component.d.ts +18 -0
  28. package/esm/components/flat-table/flat-table-row/__internal__/flat-table-row-draggable.component.js +13 -19
  29. package/esm/components/flat-table/flat-table-row/flat-table-row.component.d.ts +56 -0
  30. package/esm/components/flat-table/flat-table-row/flat-table-row.component.js +43 -67
  31. package/esm/components/flat-table/flat-table-row/flat-table-row.style.d.ts +18 -0
  32. package/esm/components/flat-table/flat-table-row/flat-table-row.style.js +2 -3
  33. package/esm/components/flat-table/flat-table-row/index.d.ts +2 -2
  34. package/esm/components/flat-table/flat-table-row-header/flat-table-row-header.component.d.ts +71 -0
  35. package/esm/components/flat-table/flat-table-row-header/flat-table-row-header.component.js +9 -51
  36. package/esm/components/flat-table/flat-table-row-header/flat-table-row-header.style.d.ts +6 -0
  37. package/esm/components/flat-table/flat-table-row-header/flat-table-row-header.style.js +7 -7
  38. package/esm/components/flat-table/flat-table-row-header/index.d.ts +2 -2
  39. package/esm/components/flat-table/flat-table.component.d.ts +42 -0
  40. package/esm/components/flat-table/flat-table.component.js +51 -92
  41. package/esm/components/flat-table/flat-table.config.d.ts +2 -0
  42. package/esm/components/flat-table/flat-table.style.d.ts +15 -0
  43. package/esm/components/flat-table/flat-table.style.js +36 -59
  44. package/esm/components/flat-table/index.d.ts +22 -13
  45. package/esm/components/flat-table/sort/index.d.ts +2 -2
  46. package/esm/components/flat-table/sort/sort.component.d.ts +11 -0
  47. package/esm/components/flat-table/sort/sort.component.js +1 -10
  48. package/esm/components/flat-table/sort/sort.style.d.ts +4 -0
  49. package/lib/__spec_helper__/test-utils.d.ts +1 -1
  50. package/lib/components/flat-table/cell-sizes.style.d.ts +28 -0
  51. package/lib/components/flat-table/flat-table-body/flat-table-body.component.d.ts +7 -0
  52. package/lib/components/flat-table/flat-table-body/flat-table-body.component.js +4 -3
  53. package/lib/components/flat-table/flat-table-body/index.d.ts +2 -2
  54. package/lib/components/flat-table/flat-table-body-draggable/flat-table-body-draggable.component.d.ts +9 -0
  55. package/lib/components/flat-table/flat-table-body-draggable/flat-table-body-draggable.component.js +7 -16
  56. package/lib/components/flat-table/flat-table-body-draggable/flat-table-body-draggable.style.d.ts +4 -0
  57. package/lib/components/flat-table/flat-table-body-draggable/index.d.ts +2 -2
  58. package/lib/components/flat-table/flat-table-cell/flat-table-cell.component.d.ts +69 -0
  59. package/lib/components/flat-table/flat-table-cell/flat-table-cell.component.js +8 -69
  60. package/lib/components/flat-table/flat-table-cell/flat-table-cell.style.d.ts +10 -0
  61. package/lib/components/flat-table/flat-table-cell/index.d.ts +2 -2
  62. package/lib/components/flat-table/flat-table-checkbox/flat-table-checkbox.component.d.ts +45 -0
  63. package/lib/components/flat-table/flat-table-checkbox/flat-table-checkbox.component.js +2 -39
  64. package/lib/components/flat-table/flat-table-checkbox/flat-table-checkbox.style.d.ts +6 -0
  65. package/lib/components/flat-table/flat-table-checkbox/index.d.ts +2 -2
  66. package/lib/components/flat-table/flat-table-head/flat-table-head.component.d.ts +7 -0
  67. package/lib/components/flat-table/flat-table-head/flat-table-head.component.js +8 -12
  68. package/lib/components/flat-table/flat-table-head/flat-table-head.style.d.ts +2 -0
  69. package/lib/components/flat-table/flat-table-head/index.d.ts +2 -2
  70. package/lib/components/flat-table/flat-table-header/flat-table-header-utils.d.ts +3 -0
  71. package/lib/components/flat-table/flat-table-header/flat-table-header.component.d.ts +55 -0
  72. package/lib/components/flat-table/flat-table-header/flat-table-header.component.js +8 -49
  73. package/lib/components/flat-table/flat-table-header/flat-table-header.style.d.ts +10 -0
  74. package/lib/components/flat-table/flat-table-header/index.d.ts +2 -2
  75. package/lib/components/flat-table/flat-table-row/__internal__/flat-table-row-draggable.component.d.ts +18 -0
  76. package/lib/components/flat-table/flat-table-row/__internal__/flat-table-row-draggable.component.js +14 -20
  77. package/lib/components/flat-table/flat-table-row/flat-table-row.component.d.ts +56 -0
  78. package/lib/components/flat-table/flat-table-row/flat-table-row.component.js +44 -68
  79. package/lib/components/flat-table/flat-table-row/flat-table-row.style.d.ts +18 -0
  80. package/lib/components/flat-table/flat-table-row/flat-table-row.style.js +2 -3
  81. package/lib/components/flat-table/flat-table-row/index.d.ts +2 -2
  82. package/lib/components/flat-table/flat-table-row-header/flat-table-row-header.component.d.ts +71 -0
  83. package/lib/components/flat-table/flat-table-row-header/flat-table-row-header.component.js +10 -51
  84. package/lib/components/flat-table/flat-table-row-header/flat-table-row-header.style.d.ts +6 -0
  85. package/lib/components/flat-table/flat-table-row-header/flat-table-row-header.style.js +7 -7
  86. package/lib/components/flat-table/flat-table-row-header/index.d.ts +2 -2
  87. package/lib/components/flat-table/flat-table.component.d.ts +42 -0
  88. package/lib/components/flat-table/flat-table.component.js +51 -91
  89. package/lib/components/flat-table/flat-table.config.d.ts +2 -0
  90. package/lib/components/flat-table/flat-table.style.d.ts +15 -0
  91. package/lib/components/flat-table/flat-table.style.js +36 -59
  92. package/lib/components/flat-table/index.d.ts +22 -13
  93. package/lib/components/flat-table/sort/index.d.ts +2 -2
  94. package/lib/components/flat-table/sort/sort.component.d.ts +11 -0
  95. package/lib/components/flat-table/sort/sort.component.js +1 -10
  96. package/lib/components/flat-table/sort/sort.style.d.ts +4 -0
  97. package/package.json +1 -1
  98. package/esm/components/flat-table/flat-table-body/flat-table-body.d.ts +0 -10
  99. package/esm/components/flat-table/flat-table-body-draggable/flat-table-body-draggable.d.ts +0 -14
  100. package/esm/components/flat-table/flat-table-cell/flat-table-cell.d.ts +0 -28
  101. package/esm/components/flat-table/flat-table-checkbox/flat-table-checkbox.d.ts +0 -20
  102. package/esm/components/flat-table/flat-table-head/flat-table-head.d.ts +0 -10
  103. package/esm/components/flat-table/flat-table-header/flat-table-header.d.ts +0 -27
  104. package/esm/components/flat-table/flat-table-row/__internal__/flat-table-row-draggable.d.ts +0 -20
  105. package/esm/components/flat-table/flat-table-row/flat-table-row.d.ts +0 -31
  106. package/esm/components/flat-table/flat-table-row-header/flat-table-row-header.d.ts +0 -28
  107. package/esm/components/flat-table/flat-table.d.ts +0 -37
  108. package/esm/components/flat-table/sort/sort.d.ts +0 -14
  109. package/lib/components/flat-table/flat-table-body/flat-table-body.d.ts +0 -10
  110. package/lib/components/flat-table/flat-table-body-draggable/flat-table-body-draggable.d.ts +0 -14
  111. package/lib/components/flat-table/flat-table-cell/flat-table-cell.d.ts +0 -28
  112. package/lib/components/flat-table/flat-table-checkbox/flat-table-checkbox.d.ts +0 -20
  113. package/lib/components/flat-table/flat-table-head/flat-table-head.d.ts +0 -10
  114. package/lib/components/flat-table/flat-table-header/flat-table-header.d.ts +0 -27
  115. package/lib/components/flat-table/flat-table-row/__internal__/flat-table-row-draggable.d.ts +0 -20
  116. package/lib/components/flat-table/flat-table-row/flat-table-row.d.ts +0 -31
  117. package/lib/components/flat-table/flat-table-row-header/flat-table-row-header.d.ts +0 -28
  118. package/lib/components/flat-table/flat-table.d.ts +0 -37
  119. package/lib/components/flat-table/sort/sort.d.ts +0 -14
@@ -12,10 +12,10 @@ const StyledFlatTableRowHeader = styled.th`
12
12
  let {
13
13
  align,
14
14
  theme,
15
- colWidth,
15
+ width,
16
16
  leftPosition,
17
17
  rightPosition,
18
- isTruncated,
18
+ truncate,
19
19
  expandable,
20
20
  verticalBorder,
21
21
  verticalBorderColor,
@@ -35,22 +35,22 @@ const StyledFlatTableRowHeader = styled.th`
35
35
  padding: 0;
36
36
  z-index: ${baseTheme.zIndex.overlay};
37
37
 
38
- ${colWidth && css`
39
- width: ${colWidth}px;
38
+ ${width && css`
39
+ width: ${width}px;
40
40
  `}
41
41
 
42
42
  &&&& {
43
43
  > div {
44
44
  box-sizing: border-box;
45
45
 
46
- ${isTruncated && css`
46
+ ${truncate && css`
47
47
  text-overflow: ellipsis;
48
48
  overflow: hidden;
49
49
  white-space: nowrap;
50
50
  `}
51
51
 
52
- ${colWidth && css`
53
- width: ${colWidth}px;
52
+ ${width && css`
53
+ width: ${width}px;
54
54
  `}
55
55
 
56
56
  ${padding}
@@ -1,2 +1,2 @@
1
- export { default } from "./flat-table-row-header";
2
- export * from "./flat-table-row-header";
1
+ export { default } from "./flat-table-row-header.component";
2
+ export type { FlatTableRowHeaderProps } from "./flat-table-row-header.component";
@@ -0,0 +1,42 @@
1
+ import React from "react";
2
+ import { MarginProps } from "styled-system";
3
+ export interface FlatTableProps extends MarginProps {
4
+ /** The HTML id of the element that contains a description of this table. */
5
+ ariaDescribedby?: string;
6
+ /** A string to render as the table's caption */
7
+ caption?: string;
8
+ /** FlatTableHead and FlatTableBody */
9
+ children: React.ReactNode;
10
+ /** `FlatTable` color theme */
11
+ colorTheme?: "light" | "transparent-base" | "transparent-white" | "dark";
12
+ /** Content to be rendered at the foot of the table */
13
+ footer?: React.ReactNode;
14
+ /** If true, the header does not scroll with the content */
15
+ hasStickyFooter?: boolean;
16
+ /** If true, the header does not scroll with the content */
17
+ hasStickyHead?: boolean;
18
+ /** Set the height of the table. String can be any valid CSS string, numbers will be converted to pixels. */
19
+ height?: string | number;
20
+ /** Set the min-height of the table. String can be any valid CSS string, numbers will be converted to pixels. */
21
+ minHeight?: string | number;
22
+ /** Toggles the zebra striping for the table rows */
23
+ isZebra?: boolean;
24
+ /** Used to define the tables size Renders as: 'compact', 'small', 'medium', 'large' and 'extraLarge' */
25
+ size?: "compact" | "small" | "medium" | "large" | "extraLarge";
26
+ /** Applies max-height of 100% to FlatTable if true */
27
+ hasMaxHeight?: boolean;
28
+ /** Set the overflow X of the table wrapper. Any valid CSS string */
29
+ overflowX?: string;
30
+ /** Width of the table. Any valid CSS string */
31
+ width?: string;
32
+ }
33
+ export interface FlatTableThemeContextProps extends Pick<FlatTableProps, "colorTheme" | "size"> {
34
+ selectedId?: string;
35
+ setSelectedId: (id: string) => void;
36
+ }
37
+ export declare const FlatTableThemeContext: React.Context<FlatTableThemeContextProps>;
38
+ export declare const FlatTable: {
39
+ ({ caption, children, hasStickyHead, colorTheme, footer, hasStickyFooter, height, isZebra, size, hasMaxHeight, ariaDescribedby, minHeight, overflowX, width, ...rest }: FlatTableProps): React.JSX.Element;
40
+ displayName: string;
41
+ };
42
+ export default FlatTable;
@@ -1,27 +1,24 @@
1
1
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
- import React, { useLayoutEffect, useRef, useState } from "react";
2
+ import React, { useLayoutEffect, useRef, useState, useContext } from "react";
3
3
  import PropTypes from "prop-types";
4
- import styledSystemPropTypes from "@styled-system/prop-types";
5
4
  import { StyledFlatTableWrapper, StyledFlatTable, StyledFlatTableFooter, StyledTableContainer } from "./flat-table.style";
6
5
  import { DrawerSidebarContext } from "../drawer";
7
- import { filterStyledSystemMarginProps } from "../../style/utils";
8
6
  import Events from "../../__internal__/utils/helpers/events/events";
9
7
  export const FlatTableThemeContext = /*#__PURE__*/React.createContext({
10
8
  setSelectedId: () => {}
11
9
  });
12
- const marginPropTypes = filterStyledSystemMarginProps(styledSystemPropTypes.space);
13
10
  const FOCUSABLE_ROW_AND_CELL_QUERY = "tbody tr, tbody tr td, tbody tr th";
14
- const FlatTable = _ref => {
11
+ export const FlatTable = _ref => {
15
12
  let {
16
13
  caption,
17
14
  children,
18
15
  hasStickyHead,
19
- colorTheme,
16
+ colorTheme = "dark",
20
17
  footer,
21
18
  hasStickyFooter = false,
22
19
  height,
23
20
  isZebra,
24
- size,
21
+ size = "medium",
25
22
  hasMaxHeight = false,
26
23
  ariaDescribedby,
27
24
  minHeight,
@@ -40,17 +37,18 @@ const FlatTable = _ref => {
40
37
  const tableStylingProps = {
41
38
  caption,
42
39
  isZebra,
43
- size
40
+ size,
41
+ "aria-describedby": ariaDescribedby
44
42
  };
45
- if (ariaDescribedby) {
46
- tableStylingProps["aria-describedby"] = ariaDescribedby;
47
- }
43
+ const {
44
+ isInSidebar
45
+ } = useContext(DrawerSidebarContext);
48
46
  useLayoutEffect(() => {
49
47
  const findRow = (rows, isFirstCol) => rows.find((row, index) => {
50
48
  const cells = Array.from(row.querySelectorAll("td, th"));
51
49
  const cell = isFirstCol ? cells.shift() : cells.pop();
52
50
  const rowSpan = cell?.getAttribute("rowspan");
53
- return rowSpan >= index + 1;
51
+ return rowSpan && Number(rowSpan) >= index + 1;
54
52
  });
55
53
 
56
54
  /* istanbul ignore else */
@@ -136,85 +134,46 @@ const FlatTable = _ref => {
136
134
  setSelectedId(focusableArray[0]?.getAttribute("id") || "");
137
135
  }
138
136
  }, [selectedId]);
139
- return /*#__PURE__*/React.createElement(DrawerSidebarContext.Consumer, null, _ref2 => {
140
- let {
141
- isInSidebar
142
- } = _ref2;
143
- return /*#__PURE__*/React.createElement(StyledFlatTableWrapper, _extends({
144
- ref: wrapperRef,
145
- "data-component": "flat-table-wrapper",
146
- isInSidebar: isInSidebar,
147
- hasStickyHead: hasStickyHead,
148
- colorTheme: colorTheme,
149
- minHeight: minHeight,
150
- overflowY: !isInSidebar && (hasStickyHead || hasStickyFooter) ? "auto" : undefined,
151
- height: addDefaultHeight && !hasMaxHeight ? "99%" : height,
152
- maxHeight: hasMaxHeight ? "100%" : undefined,
153
- display: "flex",
154
- flexDirection: "column",
155
- justifyContent: hasStickyFooter || height ? "space-between" : undefined,
156
- tabIndex: "0",
157
- role: "region",
158
- overflowX: width ? "hidden" : undefined,
159
- width: width,
160
- hasStickyFooter: hasStickyFooter,
161
- hasVerticalScrollbar: hasVerticalScrollbar,
162
- hasHorizontalScrollbar: hasHorizontalScrollbar,
163
- hasFooter: !!footer,
164
- firstColRowSpanIndex: firstColRowSpanIndex,
165
- lastColRowSpanIndex: lastColRowSpanIndex,
166
- onKeyDown: handleKeyDown
167
- }, rest), /*#__PURE__*/React.createElement(StyledTableContainer, {
168
- overflowX: overflowX,
169
- width: width
170
- }, /*#__PURE__*/React.createElement(StyledFlatTable, _extends({
171
- ref: tableRef,
172
- "data-component": "flat-table"
173
- }, tableStylingProps), caption ? /*#__PURE__*/React.createElement("caption", null, caption) : null, /*#__PURE__*/React.createElement(FlatTableThemeContext.Provider, {
174
- value: {
175
- colorTheme,
176
- size,
177
- setSelectedId,
178
- selectedId
179
- }
180
- }, children))), footer && /*#__PURE__*/React.createElement(StyledFlatTableFooter, {
181
- hasStickyFooter: hasStickyFooter
182
- }, footer));
183
- });
184
- };
185
- FlatTable.propTypes = {
186
- ...marginPropTypes,
187
- /** The HTML id of the element that contains a description of this table. */
188
- ariaDescribedby: PropTypes.string,
189
- /** A string to render as the table's caption */
190
- caption: PropTypes.string,
191
- /** FlatTableHead and FlatTableBody */
192
- children: PropTypes.node.isRequired,
193
- /** If true, the header does not scroll with the content */
194
- hasStickyHead: PropTypes.bool,
195
- /** `FlatTable` color theme */
196
- colorTheme: PropTypes.oneOf(["light", "transparent-base", "transparent-white", "dark"]),
197
- /** Content to be rendered at the foot of the table */
198
- footer: PropTypes.node,
199
- /** If true, the header does not scroll with the content */
200
- hasStickyFooter: PropTypes.bool,
201
- /** Set the height of the table. String can be any valid CSS string, numbers will be converted to pixels. */
202
- height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
203
- /** Set the min-height of the table. A string can be any valid CSS string, numbers will be converted to pixels. */
204
- minHeight: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
205
- /** Toggles the zebra striping for the table rows */
206
- isZebra: PropTypes.bool,
207
- /** Used to define the tables size Renders as: 'compact', 'small', 'medium', 'large' and 'extraLarge' */
208
- size: PropTypes.oneOf(["compact", "small", "medium", "large", "extraLarge"]),
209
- /** Applies max-height of 100% to FlatTable if true */
210
- hasMaxHeight: PropTypes.bool,
211
- /** Set the overflow X of the table wrapper. Any valid CSS string */
212
- overflowX: PropTypes.string,
213
- /** Width of the table. Any valid CSS string */
214
- width: PropTypes.string
215
- };
216
- FlatTable.defaultProps = {
217
- colorTheme: "dark",
218
- size: "medium"
137
+ return /*#__PURE__*/React.createElement(StyledFlatTableWrapper, _extends({
138
+ ref: wrapperRef,
139
+ "data-component": "flat-table-wrapper",
140
+ isInSidebar: isInSidebar,
141
+ hasStickyHead: hasStickyHead,
142
+ colorTheme: colorTheme,
143
+ minHeight: minHeight,
144
+ overflowY: !isInSidebar && (hasStickyHead || hasStickyFooter) ? "auto" : undefined,
145
+ height: addDefaultHeight && !hasMaxHeight ? "99%" : height,
146
+ maxHeight: hasMaxHeight ? "100%" : undefined,
147
+ display: "flex",
148
+ flexDirection: "column",
149
+ justifyContent: hasStickyFooter || height ? "space-between" : undefined,
150
+ tabIndex: 0,
151
+ role: "region",
152
+ overflowX: width ? "hidden" : undefined,
153
+ width: width,
154
+ hasStickyFooter: hasStickyFooter,
155
+ hasVerticalScrollbar: hasVerticalScrollbar,
156
+ hasHorizontalScrollbar: hasHorizontalScrollbar,
157
+ footer: !!footer,
158
+ firstColRowSpanIndex: firstColRowSpanIndex,
159
+ lastColRowSpanIndex: lastColRowSpanIndex,
160
+ onKeyDown: handleKeyDown
161
+ }, rest), /*#__PURE__*/React.createElement(StyledTableContainer, {
162
+ overflowX: overflowX,
163
+ width: width
164
+ }, /*#__PURE__*/React.createElement(StyledFlatTable, _extends({
165
+ ref: tableRef,
166
+ "data-component": "flat-table"
167
+ }, tableStylingProps), caption ? /*#__PURE__*/React.createElement("caption", null, caption) : null, /*#__PURE__*/React.createElement(FlatTableThemeContext.Provider, {
168
+ value: {
169
+ colorTheme,
170
+ size,
171
+ setSelectedId,
172
+ selectedId
173
+ }
174
+ }, children))), footer && /*#__PURE__*/React.createElement(StyledFlatTableFooter, {
175
+ hasStickyFooter: hasStickyFooter
176
+ }, footer));
219
177
  };
178
+ FlatTable.displayName = "FlatTable";
220
179
  export default FlatTable;
@@ -0,0 +1,2 @@
1
+ export declare const FLAT_TABLE_THEMES: readonly ["light", "dark", "transparent-base", "transparent-white"];
2
+ export declare const FLAT_TABLE_SIZES: readonly ["compact", "small", "medium", "large"];
@@ -0,0 +1,15 @@
1
+ import { FlatTableProps } from "./flat-table.component";
2
+ import { DrawerSidebarContextProps } from "../drawer";
3
+ declare const StyledTableContainer: import("styled-components").StyledComponent<"div", any, Pick<FlatTableProps, "width" | "overflowX">, never>;
4
+ declare const StyledFlatTable: import("styled-components").StyledComponent<"table", any, Pick<FlatTableProps, "caption" | "isZebra"> & {
5
+ size: NonNullable<FlatTableProps["size"]>;
6
+ }, never>;
7
+ interface StyledFlatTableWrapperProps extends Pick<FlatTableProps, "hasStickyFooter" | "colorTheme" | "hasStickyHead" | "footer">, Partial<DrawerSidebarContextProps> {
8
+ hasHorizontalScrollbar: boolean;
9
+ hasVerticalScrollbar: boolean;
10
+ lastColRowSpanIndex: number;
11
+ firstColRowSpanIndex: number;
12
+ }
13
+ declare const StyledFlatTableWrapper: import("styled-components").StyledComponent<"div", any, import("../box").BoxProps & StyledFlatTableWrapperProps, never>;
14
+ declare const StyledFlatTableFooter: import("styled-components").StyledComponent<"div", any, Pick<FlatTableProps, "hasStickyFooter">, never>;
15
+ export { StyledFlatTableWrapper, StyledFlatTable, StyledFlatTableFooter, StyledTableContainer, };
@@ -99,9 +99,6 @@ const StyledFlatTable = styled.table`
99
99
  `;
100
100
  }}
101
101
  `;
102
- StyledFlatTable.defaultProps = {
103
- size: "medium"
104
- };
105
102
  const StyledFlatTableWrapper = styled(Box)`
106
103
  border-top-left-radius: var(--borderRadius100);
107
104
  border-top-right-radius: var(--borderRadius100);
@@ -301,9 +298,9 @@ const StyledFlatTableWrapper = styled(Box)`
301
298
 
302
299
  ${_ref14 => {
303
300
  let {
304
- hasFooter
301
+ footer
305
302
  } = _ref14;
306
- return hasFooter && css`
303
+ return footer && css`
307
304
  tr:last-child:focus {
308
305
  :after {
309
306
  border-bottom-left-radius: var(--borderRadius000);
@@ -314,65 +311,45 @@ const StyledFlatTableWrapper = styled(Box)`
314
311
 
315
312
  ${_ref15 => {
316
313
  let {
317
- hasFooter
314
+ footer,
315
+ firstColRowSpanIndex,
316
+ lastColRowSpanIndex,
317
+ hasHorizontalScrollbar,
318
+ hasVerticalScrollbar
318
319
  } = _ref15;
319
- return !hasFooter && css`
320
+ return !footer && css`
320
321
  tbody {
321
- ${_ref16 => {
322
- let {
323
- firstColRowSpanIndex
324
- } = _ref16;
325
- return firstColRowSpanIndex >= 0 && css`
326
- ${StyledFlatTableRow}:nth-of-type(${firstColRowSpanIndex + 1}) {
327
- th:first-child,
328
- td:first-child {
329
- border-bottom-left-radius: var(--borderRadius100);
330
- }
322
+ ${firstColRowSpanIndex >= 0 && css`
323
+ ${StyledFlatTableRow}:nth-of-type(${firstColRowSpanIndex + 1}) {
324
+ th:first-child,
325
+ td:first-child {
326
+ border-bottom-left-radius: var(--borderRadius100);
331
327
  }
332
- `;
333
- }}
328
+ }
329
+ `}
334
330
 
335
- ${_ref17 => {
336
- let {
337
- lastColRowSpanIndex,
338
- hasHorizontalScrollbar
339
- } = _ref17;
340
- return lastColRowSpanIndex >= 0 && !hasHorizontalScrollbar && css`
341
- ${StyledFlatTableRow}:nth-of-type(${lastColRowSpanIndex + 1}) {
342
- th:last-child,
343
- td:last-child {
344
- border-bottom-right-radius: var(--borderRadius100);
345
- }
331
+ ${lastColRowSpanIndex >= 0 && !hasHorizontalScrollbar && css`
332
+ ${StyledFlatTableRow}:nth-of-type(${lastColRowSpanIndex + 1}) {
333
+ th:last-child,
334
+ td:last-child {
335
+ border-bottom-right-radius: var(--borderRadius100);
346
336
  }
347
- `;
348
- }}
337
+ }
338
+ `}
349
339
 
350
340
  ${StyledFlatTableRow}:last-of-type {
351
- ${_ref18 => {
352
- let {
353
- hasHorizontalScrollbar,
354
- firstColRowSpanIndex
355
- } = _ref18;
356
- return !hasHorizontalScrollbar && firstColRowSpanIndex === -1 && css`
357
- th:first-child,
358
- td:first-child {
359
- border-bottom-left-radius: var(--borderRadius100);
360
- }
361
- `;
362
- }}
363
- ${_ref19 => {
364
- let {
365
- hasVerticalScrollbar,
366
- hasHorizontalScrollbar,
367
- lastColRowSpanIndex
368
- } = _ref19;
369
- return !hasVerticalScrollbar && !hasHorizontalScrollbar && lastColRowSpanIndex === -1 && css`
370
- th:last-child,
371
- td:last-child {
372
- border-bottom-right-radius: var(--borderRadius100);
373
- }
374
- `;
375
- }}
341
+ ${!hasHorizontalScrollbar && firstColRowSpanIndex === -1 && css`
342
+ th:first-child,
343
+ td:first-child {
344
+ border-bottom-left-radius: var(--borderRadius100);
345
+ }
346
+ `}
347
+ ${!hasVerticalScrollbar && !hasHorizontalScrollbar && lastColRowSpanIndex === -1 && css`
348
+ th:last-child,
349
+ td:last-child {
350
+ border-bottom-right-radius: var(--borderRadius100);
351
+ }
352
+ `}
376
353
  }
377
354
  }
378
355
  `;
@@ -382,11 +359,11 @@ StyledFlatTableWrapper.defaultProps = {
382
359
  theme: baseTheme
383
360
  };
384
361
  const StyledFlatTableFooter = styled.div`
385
- ${_ref20 => {
362
+ ${_ref16 => {
386
363
  let {
387
364
  hasStickyFooter,
388
365
  theme
389
- } = _ref20;
366
+ } = _ref16;
390
367
  return hasStickyFooter && css`
391
368
  position: sticky;
392
369
  bottom: 0px;
@@ -1,13 +1,22 @@
1
- export type TableBorderSize = "small" | "medium" | "large";
2
-
3
- export { default as FlatTable } from "./flat-table";
4
- export { default as FlatTableHead } from "./flat-table-head";
5
- export { default as FlatTableHeader } from "./flat-table-header";
6
- export { default as FlatTableBody } from "./flat-table-body";
7
- export { default as FlatTableBodyDraggable } from "./flat-table-body-draggable";
8
- export { default as FlatTableRow } from "./flat-table-row";
9
- export { default as FlatTableRowHeader } from "./flat-table-row-header";
10
- export { default as FlatTableCell } from "./flat-table-cell";
11
- export { default as FlatTableCheckbox } from "./flat-table-checkbox";
12
- export { default as Sort } from "./sort";
13
- export * from "./flat-table";
1
+ export { default as FlatTable } from "./flat-table.component";
2
+ export { default as FlatTableHead } from "./flat-table-head/flat-table-head.component";
3
+ export { default as FlatTableHeader } from "./flat-table-header/flat-table-header.component";
4
+ export { default as FlatTableBody } from "./flat-table-body/flat-table-body.component";
5
+ export { default as FlatTableRow } from "./flat-table-row/flat-table-row.component";
6
+ export { default as FlatTableRowHeader } from "./flat-table-row-header/flat-table-row-header.component";
7
+ export { default as FlatTableCell } from "./flat-table-cell/flat-table-cell.component";
8
+ export { default as FlatTableCheckbox } from "./flat-table-checkbox/flat-table-checkbox.component";
9
+ export { default as FlatTableBodyDraggable } from "./flat-table-body-draggable/flat-table-body-draggable.component";
10
+ export { default as Sort } from "./sort/sort.component";
11
+ export declare type TableBorderSize = "small" | "medium" | "large";
12
+ export declare type TableCellAlign = "left" | "center" | "right";
13
+ export type { FlatTableProps } from "./flat-table.component";
14
+ export type { FlatTableHeadProps } from "./flat-table-head";
15
+ export type { FlatTableHeaderProps } from "./flat-table-header";
16
+ export type { FlatTableBodyProps } from "./flat-table-body";
17
+ export type { FlatTableBodyDraggableProps } from "./flat-table-body-draggable";
18
+ export type { FlatTableRowProps } from "./flat-table-row";
19
+ export type { FlatTableRowHeaderProps } from "./flat-table-row-header";
20
+ export type { FlatTableCellProps } from "./flat-table-cell";
21
+ export type { FlatTableCheckboxProps } from "./flat-table-checkbox";
22
+ export type { SortProps } from "./sort";
@@ -1,2 +1,2 @@
1
- export { default } from "./sort";
2
- export * from "./sort";
1
+ export { default } from "./sort.component";
2
+ export type { SortProps } from "./sort.component";
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ export interface SortProps {
3
+ /** if `asc` it will show `sort_up` icon, if `desc` it will show `sort_down` */
4
+ sortType?: "ascending" | "descending" | false;
5
+ /** Callback fired when the `FlatTableSortHeader` is clicked */
6
+ onClick?: () => void;
7
+ /** Sets the content of `FlatTableSortHeader` */
8
+ children?: React.ReactNode;
9
+ }
10
+ declare const Sort: ({ children, onClick, sortType }: SortProps) => React.JSX.Element;
11
+ export default Sort;
@@ -14,7 +14,7 @@ const Sort = _ref => {
14
14
  const onKeyDown = e => {
15
15
  if (Event.isEnterOrSpaceKey(e)) {
16
16
  e.preventDefault();
17
- return onClick();
17
+ return onClick?.();
18
18
  }
19
19
  return null;
20
20
  };
@@ -22,7 +22,6 @@ const Sort = _ref => {
22
22
  hidden: true,
23
23
  id: id.current
24
24
  }, children, sortType ? `, sort type ${sortType}` : ", sortable"), /*#__PURE__*/React.createElement(StyledSort, {
25
- type: "button",
26
25
  role: "button",
27
26
  onKeyDown: onKeyDown,
28
27
  tabIndex: 0,
@@ -34,12 +33,4 @@ const Sort = _ref => {
34
33
  color: "--colorsUtilityMajor200"
35
34
  })), !sortType && /*#__PURE__*/React.createElement(StyledSpaceHolder, null));
36
35
  };
37
- Sort.propTypes = {
38
- /** if `asc` it will show `sort_up` icon, if `desc` it will show `sort_down` */
39
- sortType: PropTypes.oneOf(["ascending", "descending", false]),
40
- /** Callback fired when the `FlatTableSortHeader` is clicked */
41
- onClick: PropTypes.func,
42
- /** The content of `FlatTableSortHeader` */
43
- children: PropTypes.node
44
- };
45
36
  export default Sort;
@@ -0,0 +1,4 @@
1
+ import { SortProps } from "./sort.component";
2
+ declare const StyledSort: import("styled-components").StyledComponent<"div", any, Pick<SortProps, "sortType">, never>;
3
+ declare const StyledSpaceHolder: import("styled-components").StyledComponent<"div", any, {}, never>;
4
+ export { StyledSort, StyledSpaceHolder };
@@ -6,7 +6,7 @@ import { mockMatchMedia } from "./mock-match-media";
6
6
  declare const toCSSCase: (str: string) => string;
7
7
  declare const assertStyleMatch: <Props>(styleSpec: {
8
8
  [key: string]: string | number | undefined;
9
- }, component: ReactWrapper<Props, {}, import("react").Component<{}, {}, any>> | ShallowWrapper<Props, {}, import("react").Component<{}, {}, any>> | ReactTestRendererJSON | ReactTestRendererJSON[] | null, opts?: jest.Options) => void;
9
+ }, component: HTMLElement | ReactWrapper<Props, {}, import("react").Component<{}, {}, any>> | ShallowWrapper<Props, {}, import("react").Component<{}, {}, any>> | ReactTestRendererJSON | ReactTestRendererJSON[] | null, opts?: jest.Options) => void;
10
10
  declare const makeArrayKeys: (n: number) => number[];
11
11
  declare const keyboard: Record<string, () => void>;
12
12
  declare const simulate: {
@@ -0,0 +1,28 @@
1
+ declare const _default: {
2
+ compact: {
3
+ height: string;
4
+ fontSize: string;
5
+ paddingSize: string;
6
+ };
7
+ small: {
8
+ height: string;
9
+ fontSize: string;
10
+ paddingSize: string;
11
+ };
12
+ medium: {
13
+ height: string;
14
+ fontSize: string;
15
+ paddingSize: string;
16
+ };
17
+ large: {
18
+ height: string;
19
+ fontSize: string;
20
+ paddingSize: string;
21
+ };
22
+ extraLarge: {
23
+ height: string;
24
+ fontSize: string;
25
+ paddingSize: string;
26
+ };
27
+ };
28
+ export default _default;
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ export interface FlatTableBodyProps {
3
+ /** Array of FlatTableRow. */
4
+ children: React.ReactNode;
5
+ }
6
+ export declare const FlatTableBody: React.ForwardRefExoticComponent<FlatTableBodyProps & React.RefAttributes<HTMLTableSectionElement>>;
7
+ export default FlatTableBody;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = void 0;
6
+ exports.default = exports.FlatTableBody = void 0;
7
7
  var _react = _interopRequireDefault(require("react"));
8
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -17,9 +17,10 @@ const FlatTableBody = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
17
17
  ref: ref
18
18
  }, rest), children);
19
19
  });
20
+ exports.FlatTableBody = FlatTableBody;
20
21
  FlatTableBody.propTypes = {
21
- /** Array of FlatTableRow. */
22
- children: _propTypes.default.node.isRequired
22
+ "children": _propTypes.default.node
23
23
  };
24
+ FlatTableBody.displayName = "FlatTableBody";
24
25
  var _default = FlatTableBody;
25
26
  exports.default = _default;
@@ -1,2 +1,2 @@
1
- export { default } from "./flat-table-body";
2
- export * from "./flat-table-body";
1
+ export { default } from "./flat-table-body.component";
2
+ export type { FlatTableBodyProps } from "./flat-table-body.component";
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ export interface FlatTableBodyDraggableProps {
3
+ /** Array of FlatTableRow. */
4
+ children: React.ReactNode;
5
+ /** Callback fired when order is changed */
6
+ getOrder?: (draggableItemIds?: number[]) => void;
7
+ }
8
+ export declare const FlatTableBodyDraggable: ({ children, getOrder, ...rest }: FlatTableBodyDraggableProps) => React.JSX.Element;
9
+ export default FlatTableBodyDraggable;