carbon-react 119.4.1 → 119.5.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.
Files changed (129) hide show
  1. package/esm/__spec_helper__/test-utils.d.ts +1 -1
  2. package/esm/components/button-bar/button-bar.style.js +43 -5
  3. package/esm/components/button-minor/button-minor.component.d.ts +1 -1
  4. package/esm/components/button-minor/button-minor.component.js +20 -6
  5. package/esm/components/button-minor/button-minor.style.js +1 -1
  6. package/esm/components/flat-table/cell-sizes.style.d.ts +28 -0
  7. package/esm/components/flat-table/flat-table-body/flat-table-body.component.d.ts +7 -0
  8. package/esm/components/flat-table/flat-table-body/flat-table-body.component.js +3 -2
  9. package/esm/components/flat-table/flat-table-body/index.d.ts +2 -2
  10. package/esm/components/flat-table/flat-table-body-draggable/flat-table-body-draggable.component.d.ts +9 -0
  11. package/esm/components/flat-table/flat-table-body-draggable/flat-table-body-draggable.component.js +6 -16
  12. package/esm/components/flat-table/flat-table-body-draggable/flat-table-body-draggable.style.d.ts +4 -0
  13. package/esm/components/flat-table/flat-table-body-draggable/index.d.ts +2 -2
  14. package/esm/components/flat-table/flat-table-cell/flat-table-cell.component.d.ts +69 -0
  15. package/esm/components/flat-table/flat-table-cell/flat-table-cell.component.js +7 -69
  16. package/esm/components/flat-table/flat-table-cell/flat-table-cell.style.d.ts +10 -0
  17. package/esm/components/flat-table/flat-table-cell/index.d.ts +2 -2
  18. package/esm/components/flat-table/flat-table-checkbox/flat-table-checkbox.component.d.ts +45 -0
  19. package/esm/components/flat-table/flat-table-checkbox/flat-table-checkbox.component.js +1 -39
  20. package/esm/components/flat-table/flat-table-checkbox/flat-table-checkbox.style.d.ts +6 -0
  21. package/esm/components/flat-table/flat-table-checkbox/index.d.ts +2 -2
  22. package/esm/components/flat-table/flat-table-head/flat-table-head.component.d.ts +7 -0
  23. package/esm/components/flat-table/flat-table-head/flat-table-head.component.js +8 -13
  24. package/esm/components/flat-table/flat-table-head/flat-table-head.style.d.ts +2 -0
  25. package/esm/components/flat-table/flat-table-head/index.d.ts +2 -2
  26. package/esm/components/flat-table/flat-table-header/flat-table-header-utils.d.ts +3 -0
  27. package/esm/components/flat-table/flat-table-header/flat-table-header.component.d.ts +55 -0
  28. package/esm/components/flat-table/flat-table-header/flat-table-header.component.js +7 -49
  29. package/esm/components/flat-table/flat-table-header/flat-table-header.style.d.ts +10 -0
  30. package/esm/components/flat-table/flat-table-header/index.d.ts +2 -2
  31. package/esm/components/flat-table/flat-table-row/__internal__/flat-table-row-draggable.component.d.ts +18 -0
  32. package/esm/components/flat-table/flat-table-row/__internal__/flat-table-row-draggable.component.js +13 -19
  33. package/esm/components/flat-table/flat-table-row/flat-table-row.component.d.ts +56 -0
  34. package/esm/components/flat-table/flat-table-row/flat-table-row.component.js +43 -67
  35. package/esm/components/flat-table/flat-table-row/flat-table-row.style.d.ts +18 -0
  36. package/esm/components/flat-table/flat-table-row/flat-table-row.style.js +2 -3
  37. package/esm/components/flat-table/flat-table-row/index.d.ts +2 -2
  38. package/esm/components/flat-table/flat-table-row-header/flat-table-row-header.component.d.ts +71 -0
  39. package/esm/components/flat-table/flat-table-row-header/flat-table-row-header.component.js +9 -51
  40. package/esm/components/flat-table/flat-table-row-header/flat-table-row-header.style.d.ts +6 -0
  41. package/esm/components/flat-table/flat-table-row-header/flat-table-row-header.style.js +7 -7
  42. package/esm/components/flat-table/flat-table-row-header/index.d.ts +2 -2
  43. package/esm/components/flat-table/flat-table.component.d.ts +42 -0
  44. package/esm/components/flat-table/flat-table.component.js +51 -92
  45. package/esm/components/flat-table/flat-table.config.d.ts +2 -0
  46. package/esm/components/flat-table/flat-table.style.d.ts +15 -0
  47. package/esm/components/flat-table/flat-table.style.js +36 -59
  48. package/esm/components/flat-table/index.d.ts +22 -13
  49. package/esm/components/flat-table/sort/index.d.ts +2 -2
  50. package/esm/components/flat-table/sort/sort.component.d.ts +11 -0
  51. package/esm/components/flat-table/sort/sort.component.js +1 -10
  52. package/esm/components/flat-table/sort/sort.style.d.ts +4 -0
  53. package/esm/components/icon/icon-config.js +4 -4
  54. package/lib/__spec_helper__/test-utils.d.ts +1 -1
  55. package/lib/components/button-bar/button-bar.style.js +43 -5
  56. package/lib/components/button-minor/button-minor.component.d.ts +1 -1
  57. package/lib/components/button-minor/button-minor.component.js +22 -6
  58. package/lib/components/button-minor/button-minor.style.js +1 -1
  59. package/lib/components/flat-table/cell-sizes.style.d.ts +28 -0
  60. package/lib/components/flat-table/flat-table-body/flat-table-body.component.d.ts +7 -0
  61. package/lib/components/flat-table/flat-table-body/flat-table-body.component.js +4 -3
  62. package/lib/components/flat-table/flat-table-body/index.d.ts +2 -2
  63. package/lib/components/flat-table/flat-table-body-draggable/flat-table-body-draggable.component.d.ts +9 -0
  64. package/lib/components/flat-table/flat-table-body-draggable/flat-table-body-draggable.component.js +7 -16
  65. package/lib/components/flat-table/flat-table-body-draggable/flat-table-body-draggable.style.d.ts +4 -0
  66. package/lib/components/flat-table/flat-table-body-draggable/index.d.ts +2 -2
  67. package/lib/components/flat-table/flat-table-cell/flat-table-cell.component.d.ts +69 -0
  68. package/lib/components/flat-table/flat-table-cell/flat-table-cell.component.js +8 -69
  69. package/lib/components/flat-table/flat-table-cell/flat-table-cell.style.d.ts +10 -0
  70. package/lib/components/flat-table/flat-table-cell/index.d.ts +2 -2
  71. package/lib/components/flat-table/flat-table-checkbox/flat-table-checkbox.component.d.ts +45 -0
  72. package/lib/components/flat-table/flat-table-checkbox/flat-table-checkbox.component.js +2 -39
  73. package/lib/components/flat-table/flat-table-checkbox/flat-table-checkbox.style.d.ts +6 -0
  74. package/lib/components/flat-table/flat-table-checkbox/index.d.ts +2 -2
  75. package/lib/components/flat-table/flat-table-head/flat-table-head.component.d.ts +7 -0
  76. package/lib/components/flat-table/flat-table-head/flat-table-head.component.js +8 -12
  77. package/lib/components/flat-table/flat-table-head/flat-table-head.style.d.ts +2 -0
  78. package/lib/components/flat-table/flat-table-head/index.d.ts +2 -2
  79. package/lib/components/flat-table/flat-table-header/flat-table-header-utils.d.ts +3 -0
  80. package/lib/components/flat-table/flat-table-header/flat-table-header.component.d.ts +55 -0
  81. package/lib/components/flat-table/flat-table-header/flat-table-header.component.js +8 -49
  82. package/lib/components/flat-table/flat-table-header/flat-table-header.style.d.ts +10 -0
  83. package/lib/components/flat-table/flat-table-header/index.d.ts +2 -2
  84. package/lib/components/flat-table/flat-table-row/__internal__/flat-table-row-draggable.component.d.ts +18 -0
  85. package/lib/components/flat-table/flat-table-row/__internal__/flat-table-row-draggable.component.js +14 -20
  86. package/lib/components/flat-table/flat-table-row/flat-table-row.component.d.ts +56 -0
  87. package/lib/components/flat-table/flat-table-row/flat-table-row.component.js +44 -68
  88. package/lib/components/flat-table/flat-table-row/flat-table-row.style.d.ts +18 -0
  89. package/lib/components/flat-table/flat-table-row/flat-table-row.style.js +2 -3
  90. package/lib/components/flat-table/flat-table-row/index.d.ts +2 -2
  91. package/lib/components/flat-table/flat-table-row-header/flat-table-row-header.component.d.ts +71 -0
  92. package/lib/components/flat-table/flat-table-row-header/flat-table-row-header.component.js +10 -51
  93. package/lib/components/flat-table/flat-table-row-header/flat-table-row-header.style.d.ts +6 -0
  94. package/lib/components/flat-table/flat-table-row-header/flat-table-row-header.style.js +7 -7
  95. package/lib/components/flat-table/flat-table-row-header/index.d.ts +2 -2
  96. package/lib/components/flat-table/flat-table.component.d.ts +42 -0
  97. package/lib/components/flat-table/flat-table.component.js +51 -91
  98. package/lib/components/flat-table/flat-table.config.d.ts +2 -0
  99. package/lib/components/flat-table/flat-table.style.d.ts +15 -0
  100. package/lib/components/flat-table/flat-table.style.js +36 -59
  101. package/lib/components/flat-table/index.d.ts +22 -13
  102. package/lib/components/flat-table/sort/index.d.ts +2 -2
  103. package/lib/components/flat-table/sort/sort.component.d.ts +11 -0
  104. package/lib/components/flat-table/sort/sort.component.js +1 -10
  105. package/lib/components/flat-table/sort/sort.style.d.ts +4 -0
  106. package/lib/components/icon/icon-config.js +4 -4
  107. package/package.json +1 -1
  108. package/esm/components/flat-table/flat-table-body/flat-table-body.d.ts +0 -10
  109. package/esm/components/flat-table/flat-table-body-draggable/flat-table-body-draggable.d.ts +0 -14
  110. package/esm/components/flat-table/flat-table-cell/flat-table-cell.d.ts +0 -28
  111. package/esm/components/flat-table/flat-table-checkbox/flat-table-checkbox.d.ts +0 -20
  112. package/esm/components/flat-table/flat-table-head/flat-table-head.d.ts +0 -10
  113. package/esm/components/flat-table/flat-table-header/flat-table-header.d.ts +0 -27
  114. package/esm/components/flat-table/flat-table-row/__internal__/flat-table-row-draggable.d.ts +0 -20
  115. package/esm/components/flat-table/flat-table-row/flat-table-row.d.ts +0 -31
  116. package/esm/components/flat-table/flat-table-row-header/flat-table-row-header.d.ts +0 -28
  117. package/esm/components/flat-table/flat-table.d.ts +0 -37
  118. package/esm/components/flat-table/sort/sort.d.ts +0 -14
  119. package/lib/components/flat-table/flat-table-body/flat-table-body.d.ts +0 -10
  120. package/lib/components/flat-table/flat-table-body-draggable/flat-table-body-draggable.d.ts +0 -14
  121. package/lib/components/flat-table/flat-table-cell/flat-table-cell.d.ts +0 -28
  122. package/lib/components/flat-table/flat-table-checkbox/flat-table-checkbox.d.ts +0 -20
  123. package/lib/components/flat-table/flat-table-head/flat-table-head.d.ts +0 -10
  124. package/lib/components/flat-table/flat-table-header/flat-table-header.d.ts +0 -27
  125. package/lib/components/flat-table/flat-table-row/__internal__/flat-table-row-draggable.d.ts +0 -20
  126. package/lib/components/flat-table/flat-table-row/flat-table-row.d.ts +0 -31
  127. package/lib/components/flat-table/flat-table-row-header/flat-table-row-header.d.ts +0 -28
  128. package/lib/components/flat-table/flat-table.d.ts +0 -37
  129. package/lib/components/flat-table/sort/sort.d.ts +0 -14
@@ -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: {
@@ -1,10 +1,15 @@
1
1
  import styled, { css } from "styled-components";
2
2
  import { space } from "styled-system";
3
3
  import BaseTheme from "../../style/themes/base";
4
+ import StyledButton from "../button/button.style";
4
5
  import StyledIcon from "../icon/icon.style";
6
+ import StyledIconButton from "../icon-button/icon-button.style";
7
+ const commonHoverStyles = `
8
+ background-color: var(--colorsActionMajor600);
9
+ border-color: var(--colorsActionMajor600);
10
+ `;
5
11
  const StyledButtonBar = styled.div`
6
12
  ${space}
7
-
8
13
  ${_ref => {
9
14
  let {
10
15
  fullWidth,
@@ -26,17 +31,14 @@ const StyledButtonBar = styled.div`
26
31
 
27
32
  button {
28
33
  margin: 0;
29
- border: 2px solid var(--colorsActionMajor500);
30
34
 
31
35
  :not(:first-child):not(:last-child) {
32
36
  border-radius: var(--borderRadius000);
33
37
  }
34
-
35
38
  :first-child:not(:last-child) {
36
39
  border-top-right-radius: var(--borderRadius000);
37
40
  border-bottom-right-radius: var(--borderRadius000);
38
41
  }
39
-
40
42
  :last-child:not(:first-child) {
41
43
  border-top-left-radius: var(--borderRadius000);
42
44
  border-bottom-left-radius: var(--borderRadius000);
@@ -53,7 +55,6 @@ const StyledButtonBar = styled.div`
53
55
  &:focus {
54
56
  position: relative;
55
57
  z-index: 2;
56
- border-right-color: var(--colorsActionMajor500);
57
58
  }
58
59
 
59
60
  &:hover {
@@ -63,7 +64,9 @@ const StyledButtonBar = styled.div`
63
64
  & + button {
64
65
  border-left-color: var(--colorsActionMajor600);
65
66
  }
67
+
66
68
  & ${StyledIcon} {
69
+ ${commonHoverStyles}
67
70
  color: white;
68
71
  }
69
72
  }
@@ -72,6 +75,41 @@ const StyledButtonBar = styled.div`
72
75
  color: var(--colorsActionMajor500);
73
76
  }
74
77
  }
78
+
79
+ [data-component="button"] {
80
+ :hover {
81
+ ${commonHoverStyles}
82
+ & + ${StyledButton} {
83
+ border-left-color: var(--colorsActionMajor600);
84
+ }
85
+ }
86
+ }
87
+
88
+ [data-component="button-minor"] {
89
+ & ${StyledIcon} {
90
+ color: var(--colorsActionMinor500);
91
+ }
92
+ }
93
+
94
+ [data-component="button-minor"] {
95
+ :hover {
96
+ color: var(--colorsActionMinorYang100);
97
+ background-color: var(--colorsActionMinor500);
98
+ border-color: var(--colorsActionMinor500);
99
+
100
+ & + ${StyledButton} {
101
+ border-left-color: var(--colorsActionMinor500);
102
+ }
103
+ }
104
+ }
105
+
106
+ ${StyledIconButton} {
107
+ border: 2px solid var(--colorsActionMajor500);
108
+
109
+ :focus {
110
+ border-right-color: var(--colorsActionMajor500);
111
+ }
112
+ }
75
113
  `;
76
114
  }}
77
115
  `;
@@ -5,7 +5,7 @@ export interface ButtonMinorProps extends ButtonProps {
5
5
  isInPassword?: boolean;
6
6
  }
7
7
  export declare const ButtonMinor: {
8
- ({ buttonType, size, isInPassword, ...rest }: ButtonMinorProps): React.JSX.Element;
8
+ ({ buttonType: buttonTypeProp, size: sizeProp, iconPosition: iconPositionProp, fullWidth: fullWidthProp, ...rest }: ButtonMinorProps): React.JSX.Element;
9
9
  displayName: string;
10
10
  };
11
11
  export default ButtonMinor;
@@ -1,18 +1,32 @@
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 from "react";
2
+ import React, { useContext } from "react";
3
3
  import PropTypes from "prop-types";
4
4
  import StyledButtonMinor from "./button-minor.style";
5
+ import { ButtonBarContext } from "../button-bar/button-bar.component";
5
6
  export const ButtonMinor = _ref => {
6
7
  let {
7
- buttonType = "secondary",
8
- size = "medium",
9
- isInPassword,
8
+ buttonType: buttonTypeProp = "secondary",
9
+ size: sizeProp = "medium",
10
+ iconPosition: iconPositionProp = "before",
11
+ fullWidth: fullWidthProp = false,
10
12
  ...rest
11
13
  } = _ref;
14
+ const {
15
+ buttonType: buttonTypeContext,
16
+ size: sizeContext,
17
+ iconPosition: iconPositionContext,
18
+ fullWidth: fullWidthContext
19
+ } = useContext(ButtonBarContext);
20
+ const buttonType = buttonTypeContext || buttonTypeProp;
21
+ const size = sizeContext || sizeProp;
22
+ const iconPosition = iconPositionContext || iconPositionProp;
23
+ const fullWidth = fullWidthContext || fullWidthProp;
12
24
  return /*#__PURE__*/React.createElement(StyledButtonMinor, _extends({
25
+ "data-component": "button-minor",
13
26
  size: size,
14
- buttonType: buttonType,
15
- isInPassword: isInPassword
27
+ fullWidth: fullWidth,
28
+ iconPosition: iconPosition,
29
+ buttonType: buttonType
16
30
  }, rest));
17
31
  };
18
32
  ButtonMinor.displayName = "ButtonMinor";
@@ -92,7 +92,7 @@ const StyledButtonMinor = styled(Button)`
92
92
  } = _ref4;
93
93
  return css`
94
94
  ${size === "small" && `
95
- min-height: 32px;
95
+ min-height: var(--sizing400);
96
96
  padding: var(--spacing000) var(--spacing100) var(--spacing000)
97
97
  var(--spacing100);
98
98
  `}
@@ -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;
@@ -11,7 +11,8 @@ const FlatTableBody = /*#__PURE__*/React.forwardRef((_ref, ref) => {
11
11
  }, rest), children);
12
12
  });
13
13
  FlatTableBody.propTypes = {
14
- /** Array of FlatTableRow. */
15
- children: PropTypes.node.isRequired
14
+ "children": PropTypes.node
16
15
  };
16
+ export { FlatTableBody };
17
+ FlatTableBody.displayName = "FlatTableBody";
17
18
  export default FlatTableBody;
@@ -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;
@@ -1,8 +1,8 @@
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
2
  import React, { useEffect, useState, useRef } from "react";
3
+ import PropTypes from "prop-types";
3
4
  import { useDrop, DndProvider } from "react-dnd";
4
5
  import { HTML5Backend } from "react-dnd-html5-backend";
5
- import PropTypes from "prop-types";
6
6
  import StyledIcon from "../../icon/icon.style";
7
7
  import StyledFlatTableBodyDraggable from "./flat-table-body-draggable.style";
8
8
  import FlatTableCell from "../flat-table-cell/flat-table-cell.component";
@@ -20,7 +20,7 @@ const DropTarget = _ref => {
20
20
  },
21
21
  drop() {
22
22
  setIsDragging(false);
23
- getOrder();
23
+ getOrder?.();
24
24
  }
25
25
  });
26
26
  return /*#__PURE__*/React.createElement(StyledFlatTableBodyDraggable, _extends({
@@ -29,11 +29,7 @@ const DropTarget = _ref => {
29
29
  isDragging: isDragging
30
30
  }, rest), children);
31
31
  };
32
- DropTarget.propTypes = {
33
- children: PropTypes.node.isRequired,
34
- getOrder: PropTypes.func
35
- };
36
- const FlatTableBodyDraggable = _ref2 => {
32
+ export const FlatTableBodyDraggable = _ref2 => {
37
33
  let {
38
34
  children,
39
35
  getOrder,
@@ -49,7 +45,7 @@ const FlatTableBodyDraggable = _ref2 => {
49
45
  }
50
46
  }, [children]);
51
47
  const findItem = id => {
52
- const draggableItem = draggableItems.filter(item => `${item.props.id}` === id)[0];
48
+ const draggableItem = draggableItems.filter(item => /*#__PURE__*/React.isValidElement(item) && `${item.props.id}` === id)[0];
53
49
  return {
54
50
  draggableItem,
55
51
  index: draggableItems.indexOf(draggableItem)
@@ -70,14 +66,14 @@ const FlatTableBodyDraggable = _ref2 => {
70
66
  if (!getOrder) {
71
67
  return;
72
68
  }
73
- const draggableItemIds = draggableItems.map(draggableItem => draggableItem.props.id);
69
+ const draggableItemIds = draggableItems.map(draggableItem => /*#__PURE__*/React.isValidElement(draggableItem) && draggableItem.props.id);
74
70
  getOrder(draggableItemIds);
75
71
  };
76
72
  return /*#__PURE__*/React.createElement(DndProvider, {
77
73
  backend: HTML5Backend
78
74
  }, /*#__PURE__*/React.createElement(DropTarget, _extends({
79
75
  getOrder: getItemsId
80
- }, rest), draggableItems.map(item => /*#__PURE__*/React.cloneElement(item, {
76
+ }, rest), draggableItems.map(item => /*#__PURE__*/React.isValidElement(item) && /*#__PURE__*/React.cloneElement(item, {
81
77
  id: `${item.props.id}`,
82
78
  moveItem,
83
79
  findItem,
@@ -88,10 +84,4 @@ const FlatTableBodyDraggable = _ref2 => {
88
84
  type: "drag"
89
85
  })), item.props.children]))));
90
86
  };
91
- FlatTableBodyDraggable.propTypes = {
92
- /** Callback fired when order is changed */
93
- getOrder: PropTypes.func,
94
- /** Array of FlatTableRow. */
95
- children: PropTypes.node.isRequired
96
- };
97
87
  export default FlatTableBodyDraggable;
@@ -0,0 +1,4 @@
1
+ declare const StyledFlatTableBodyDraggable: import("styled-components").StyledComponent<"tbody", any, {
2
+ isDragging: boolean;
3
+ }, never>;
4
+ export default StyledFlatTableBodyDraggable;
@@ -1,2 +1,2 @@
1
- export { default } from "./flat-table-body-draggable";
2
- export * from "./flat-table-body-draggable";
1
+ export { default } from "./flat-table-body-draggable.component";
2
+ export type { FlatTableBodyDraggableProps } from "./flat-table-body-draggable.component";
@@ -0,0 +1,69 @@
1
+ import React from "react";
2
+ import { PaddingProps } from "styled-system";
3
+ import { TableBorderSize, TableCellAlign } from "..";
4
+ export interface FlatTableCellProps extends PaddingProps {
5
+ /** Content alignment */
6
+ align?: TableCellAlign;
7
+ /** Cell content */
8
+ children?: React.ReactNode;
9
+ /** Number of columns that a cell should span */
10
+ colspan?: number | string;
11
+ /** Number of rows that a cell should span */
12
+ rowspan?: number | string;
13
+ /** Column width, pass a number to set a fixed width in pixels */
14
+ width?: number;
15
+ /** Truncate cell content and add ellipsis to any text that overflows */
16
+ truncate?: boolean;
17
+ /** Title text to display if cell content truncates */
18
+ title?: string;
19
+ /** Sets a custom vertical right border */
20
+ verticalBorder?: TableBorderSize;
21
+ /** Sets the color of the right border */
22
+ verticalBorderColor?: string;
23
+ /** Sets an id string on the DOM element */
24
+ id?: string;
25
+ /**
26
+ * @private
27
+ * @ignore
28
+ */
29
+ expandable?: boolean;
30
+ /**
31
+ * @private
32
+ * @ignore
33
+ */
34
+ onClick?: () => void;
35
+ /**
36
+ * @private
37
+ * @ignore
38
+ */
39
+ onKeyDown?: () => void;
40
+ /**
41
+ * @private
42
+ * @ignore
43
+ * Sets the left position when sticky column found
44
+ */
45
+ leftPosition?: number;
46
+ /**
47
+ * @private
48
+ * @ignore
49
+ * Sets the right position when sticky column found
50
+ */
51
+ rightPosition?: number;
52
+ /**
53
+ * @private
54
+ * @ignore
55
+ * Index of cell within row
56
+ */
57
+ cellIndex?: number;
58
+ /**
59
+ * @private
60
+ * @ignore
61
+ * Callback to report the offsetWidth
62
+ */
63
+ reportCellWidth?: (offset: number, index?: number) => void;
64
+ }
65
+ export declare const FlatTableCell: {
66
+ ({ align, children, pl, expandable, onClick, onKeyDown, reportCellWidth, cellIndex, leftPosition, rightPosition, width, truncate, title, colspan, rowspan, ...rest }: FlatTableCellProps): React.JSX.Element;
67
+ displayName: string;
68
+ };
69
+ export default FlatTableCell;
@@ -1,19 +1,14 @@
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
2
  import React, { useLayoutEffect, useRef, useState, useEffect, useContext } from "react";
3
3
  import PropTypes from "prop-types";
4
- import styledSystemPropTypes from "@styled-system/prop-types";
5
4
  import { StyledFlatTableCell, StyledCellContent } from "./flat-table-cell.style";
6
- import { filterStyledSystemPaddingProps } from "../../../style/utils";
7
5
  import Icon from "../../icon";
8
6
  import { FlatTableThemeContext } from "../flat-table.component";
9
7
  import guid from "../../../__internal__/utils/helpers/guid";
10
- const paddingPropTypes = filterStyledSystemPaddingProps(styledSystemPropTypes.space);
11
- const FlatTableCell = _ref => {
8
+ export const FlatTableCell = _ref => {
12
9
  let {
13
10
  align = "left",
14
11
  children,
15
- colspan,
16
- rowspan,
17
12
  pl,
18
13
  expandable = false,
19
14
  onClick,
@@ -25,6 +20,8 @@ const FlatTableCell = _ref => {
25
20
  width,
26
21
  truncate = false,
27
22
  title,
23
+ colspan,
24
+ rowspan,
28
25
  ...rest
29
26
  } = _ref;
30
27
  const ref = useRef(null);
@@ -49,8 +46,6 @@ const FlatTableCell = _ref => {
49
46
  ref: ref,
50
47
  align: align,
51
48
  "data-element": "flat-table-cell",
52
- colSpan: colspan,
53
- rowSpan: rowspan,
54
49
  pl: pl,
55
50
  onClick: expandable && onClick ? onClick : undefined,
56
51
  tabIndex: expandable && onClick ? tabIndex : undefined,
@@ -59,6 +54,10 @@ const FlatTableCell = _ref => {
59
54
  isTruncated: truncate,
60
55
  expandable: expandable,
61
56
  id: id.current
57
+ }, colspan !== undefined && {
58
+ colSpan: Number(colspan)
59
+ }, rowspan !== undefined && {
60
+ rowSpan: Number(rowspan)
62
61
  }, rest), /*#__PURE__*/React.createElement(StyledCellContent, {
63
62
  title: truncate && !title && typeof children === "string" ? children : title,
64
63
  expandable: expandable
@@ -68,66 +67,5 @@ const FlatTableCell = _ref => {
68
67
  mr: "8px"
69
68
  }), children));
70
69
  };
71
- FlatTableCell.propTypes = {
72
- /** Styled system padding props */
73
- ...paddingPropTypes,
74
- /** Content alignment */
75
- align: PropTypes.oneOf(["center", "left", "right"]),
76
- /** Cell content */
77
- children: PropTypes.oneOfType([PropTypes.node, PropTypes.string]),
78
- /** Number of columns that a cell should span */
79
- colspan: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
80
- /** Number of rows that a cell should span */
81
- rowspan: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
82
- /** Column width, pass a number to set a fixed width in pixels */
83
- width: PropTypes.number,
84
- /** Truncate cell content and add ellipsis to any text that overflows */
85
- truncate: PropTypes.bool,
86
- /** Title text to display if cell content truncates */
87
- title: PropTypes.string,
88
- /**
89
- * @private
90
- * @ignore
91
- */
92
- expandable: PropTypes.bool,
93
- /**
94
- * @private
95
- * @ignore
96
- */
97
- onClick: PropTypes.func,
98
- /**
99
- * @private
100
- * @ignore
101
- */
102
- onKeyDown: PropTypes.func,
103
- /**
104
- * @private
105
- * @ignore
106
- * Sets the left position when sticky column found
107
- */
108
- leftPosition: PropTypes.number,
109
- /**
110
- * @private
111
- * @ignore
112
- * Sets the right position when sticky column found
113
- */
114
- rightPosition: PropTypes.number,
115
- /**
116
- * @private
117
- * @ignore
118
- * Index of cell within row
119
- */
120
- cellIndex: PropTypes.number,
121
- /**
122
- * @private
123
- * @ignore
124
- * Callback to report the offsetWidth
125
- */
126
- reportCellWidth: PropTypes.func,
127
- /** Sets a custom vertical right border */
128
- verticalBorder: PropTypes.oneOf(["small", "medium", "large"]),
129
- /** Sets a vertical right border color, provide design token, any color from palette or any valid css color value. */
130
- verticalBorderColor: PropTypes.string
131
- };
132
70
  FlatTableCell.displayName = "FlatTableCell";
133
71
  export default FlatTableCell;
@@ -0,0 +1,10 @@
1
+ import { PaddingProps } from "styled-system";
2
+ import { FlatTableCellProps } from "./flat-table-cell.component";
3
+ interface StyledFlatTableCellProps extends Pick<FlatTableCellProps, "align" | "leftPosition" | "rightPosition" | "expandable" | "verticalBorder" | "verticalBorderColor">, PaddingProps {
4
+ makeCellSticky: boolean;
5
+ colWidth?: number;
6
+ isTruncated: boolean;
7
+ }
8
+ declare const StyledFlatTableCell: import("styled-components").StyledComponent<"td", any, StyledFlatTableCellProps, never>;
9
+ declare const StyledCellContent: import("styled-components").StyledComponent<"div", any, Pick<FlatTableCellProps, "expandable">, never>;
10
+ export { StyledFlatTableCell, StyledCellContent };
@@ -1,2 +1,2 @@
1
- export { default } from "./flat-table-cell";
2
- export * from "./flat-table-cell";
1
+ export { default } from "./flat-table-cell.component";
2
+ export type { FlatTableCellProps } from "./flat-table-cell.component";
@@ -0,0 +1,45 @@
1
+ import React from "react";
2
+ import { TagProps } from "../../../__internal__/utils/helpers/tags";
3
+ export interface FlatTableCheckboxProps extends TagProps {
4
+ /** Prop to polymorphically render either a 'th' or 'td' element */
5
+ as?: "td" | "th";
6
+ /** Prop to set checked prop on Checkbox */
7
+ checked?: boolean;
8
+ /** Callback to be called onChange in Checkbox */
9
+ onChange?: (ev: React.ChangeEvent<HTMLElement>) => void;
10
+ /** Whether to render the checkbox or not, defaults to true */
11
+ selectable?: boolean;
12
+ /** Callback function to be called when click event received */
13
+ onClick?: (ev: React.MouseEvent<HTMLElement>) => void;
14
+ /** The id of the element that labels the input */
15
+ ariaLabelledBy?: string;
16
+ /**
17
+ * @private
18
+ * @ignore
19
+ * Sets the left position when sticky column found
20
+ */
21
+ leftPosition?: number;
22
+ /**
23
+ * @private
24
+ * @ignore
25
+ * Sets the right position when sticky column found
26
+ */
27
+ rightPosition?: number;
28
+ /**
29
+ * @private
30
+ * @ignore
31
+ * Index of cell within row
32
+ */
33
+ cellIndex?: number;
34
+ /**
35
+ * @private
36
+ * @ignore
37
+ * Callback to report the offsetWidth
38
+ */
39
+ reportCellWidth?: (offset: number, index?: number) => void;
40
+ }
41
+ export declare const FlatTableCheckbox: {
42
+ ({ as, checked, onChange, selectable, onClick, leftPosition, rightPosition, cellIndex, reportCellWidth, ariaLabelledBy, ...rest }: FlatTableCheckboxProps): React.JSX.Element;
43
+ displayName: string;
44
+ };
45
+ export default FlatTableCheckbox;
@@ -4,7 +4,7 @@ import PropTypes from "prop-types";
4
4
  import StyledFlatTableCheckbox from "./flat-table-checkbox.style";
5
5
  import { Checkbox } from "../../checkbox";
6
6
  import Events from "../../../__internal__/utils/helpers/events/events";
7
- const FlatTableCheckbox = _ref => {
7
+ export const FlatTableCheckbox = _ref => {
8
8
  let {
9
9
  as = "td",
10
10
  checked,
@@ -52,43 +52,5 @@ const FlatTableCheckbox = _ref => {
52
52
  onKeyDown: handleKeyDown
53
53
  }));
54
54
  };
55
- FlatTableCheckbox.propTypes = {
56
- /** Prop to polymorphically render either a 'th' or 'td' element */
57
- as: PropTypes.oneOf(["td", "th"]),
58
- /** Prop to set checked prop on Checkbox */
59
- checked: PropTypes.bool,
60
- /** Callback to be called onChange in Checkbox */
61
- onChange: PropTypes.func,
62
- /** Callback function to be called when click event received */
63
- onClick: PropTypes.func,
64
- /** Whether to render the checkbox or not, defaults to true */
65
- selectable: PropTypes.bool,
66
- /** The id of the element that labels the input */
67
- ariaLabelledBy: PropTypes.string,
68
- /**
69
- * @private
70
- * @ignore
71
- * Sets the left position when sticky column found
72
- */
73
- leftPosition: PropTypes.number,
74
- /**
75
- * @private
76
- * @ignore
77
- * Sets the right position when sticky column found
78
- */
79
- rightPosition: PropTypes.number,
80
- /**
81
- * @private
82
- * @ignore
83
- * Index of cell within row
84
- */
85
- cellIndex: PropTypes.number,
86
- /**
87
- * @private
88
- * @ignore
89
- * Callback to report the offsetWidth
90
- */
91
- reportCellWidth: PropTypes.func
92
- };
93
55
  FlatTableCheckbox.displayName = "FlatTableCheckbox";
94
56
  export default FlatTableCheckbox;
@@ -0,0 +1,6 @@
1
+ import { FlatTableCheckboxProps } from "./flat-table-checkbox.component";
2
+ interface StyledFlatTableCheckboxProps extends Pick<FlatTableCheckboxProps, "as" | "leftPosition" | "rightPosition"> {
3
+ makeCellSticky: boolean;
4
+ }
5
+ declare const StyledFlatTableCheckbox: import("styled-components").StyledComponent<"td", any, StyledFlatTableCheckboxProps, never>;
6
+ export default StyledFlatTableCheckbox;
@@ -1,2 +1,2 @@
1
- export { default } from "./flat-table-checkbox";
2
- export * from "./flat-table-checkbox";
1
+ export { default } from "./flat-table-checkbox.component";
2
+ export type { FlatTableCheckboxProps } from "./flat-table-checkbox.component";
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ export interface FlatTableHeadProps {
3
+ /** Array of FlatTableRow. */
4
+ children: React.ReactNode;
5
+ }
6
+ export declare const FlatTableHead: ({ children, ...rest }: FlatTableHeadProps) => React.JSX.Element;
7
+ export default FlatTableHead;