carbon-react 111.4.2 → 111.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 (57) hide show
  1. package/esm/components/box/box.component.js +1 -0
  2. package/esm/components/card/card-column/card-column.component.d.ts +11 -0
  3. package/esm/components/card/card-column/card-column.component.js +7 -13
  4. package/esm/components/card/card-column/card-column.style.d.ts +7 -0
  5. package/esm/components/card/card-column/card-column.style.js +0 -7
  6. package/esm/components/card/card-column/index.d.ts +2 -1
  7. package/esm/components/card/card-footer/card-footer.component.d.ts +11 -0
  8. package/esm/components/card/card-footer/card-footer.component.js +320 -10
  9. package/esm/components/card/card-footer/card-footer.style.d.ts +10 -0
  10. package/esm/components/card/card-footer/card-footer.style.js +0 -10
  11. package/esm/components/card/card-footer/index.d.ts +2 -1
  12. package/esm/components/card/card-row/card-row.component.d.ts +11 -0
  13. package/esm/components/card/card-row/card-row.component.js +161 -17
  14. package/esm/components/card/card-row/card-row.style.d.ts +11 -0
  15. package/esm/components/card/card-row/card-row.style.js +16 -8
  16. package/esm/components/card/card-row/index.d.ts +2 -1
  17. package/esm/components/card/card.component.d.ts +31 -0
  18. package/esm/components/card/card.component.js +208 -69
  19. package/esm/components/card/card.config.d.ts +4 -0
  20. package/esm/components/card/card.config.js +2 -3
  21. package/esm/components/card/card.style.d.ts +10 -0
  22. package/esm/components/card/card.style.js +0 -11
  23. package/esm/components/card/index.d.ts +5 -1
  24. package/lib/components/box/box.component.js +1 -0
  25. package/lib/components/card/card-column/card-column.component.d.ts +11 -0
  26. package/lib/components/card/card-column/card-column.component.js +7 -13
  27. package/lib/components/card/card-column/card-column.style.d.ts +7 -0
  28. package/lib/components/card/card-column/card-column.style.js +0 -8
  29. package/lib/components/card/card-column/index.d.ts +2 -1
  30. package/lib/components/card/card-footer/card-footer.component.d.ts +11 -0
  31. package/lib/components/card/card-footer/card-footer.component.js +320 -10
  32. package/lib/components/card/card-footer/card-footer.style.d.ts +10 -0
  33. package/lib/components/card/card-footer/card-footer.style.js +0 -13
  34. package/lib/components/card/card-footer/index.d.ts +2 -1
  35. package/lib/components/card/card-row/card-row.component.d.ts +11 -0
  36. package/lib/components/card/card-row/card-row.component.js +162 -20
  37. package/lib/components/card/card-row/card-row.style.d.ts +11 -0
  38. package/lib/components/card/card-row/card-row.style.js +18 -7
  39. package/lib/components/card/card-row/index.d.ts +2 -1
  40. package/lib/components/card/card.component.d.ts +31 -0
  41. package/lib/components/card/card.component.js +213 -71
  42. package/lib/components/card/card.config.d.ts +4 -0
  43. package/lib/components/card/card.config.js +4 -5
  44. package/lib/components/card/card.style.d.ts +10 -0
  45. package/lib/components/card/card.style.js +0 -13
  46. package/lib/components/card/index.d.ts +5 -1
  47. package/package.json +1 -1
  48. package/esm/components/card/card-column/card-column.d.ts +0 -11
  49. package/esm/components/card/card-footer/card-footer.d.ts +0 -16
  50. package/esm/components/card/card-row/card-row.d.ts +0 -16
  51. package/esm/components/card/card-types.d.ts +0 -1
  52. package/esm/components/card/card.d.ts +0 -22
  53. package/lib/components/card/card-column/card-column.d.ts +0 -11
  54. package/lib/components/card/card-footer/card-footer.d.ts +0 -16
  55. package/lib/components/card/card-row/card-row.d.ts +0 -16
  56. package/lib/components/card/card-types.d.ts +0 -1
  57. package/lib/components/card/card.d.ts +0 -22
@@ -1,34 +1,178 @@
1
1
  function _extends() { _extends = Object.assign || 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
 
3
3
  import React from "react";
4
- import styledSystemPropTypes from "@styled-system/prop-types";
5
4
  import PropTypes from "prop-types";
6
- import StyledCardRow from "./card-row.style";
7
5
  import { filterStyledSystemPaddingProps } from "../../../style/utils";
8
- const paddingPropTypes = filterStyledSystemPaddingProps(styledSystemPropTypes.space);
9
- const paddingSizes = {
10
- small: 2,
11
- medium: 3,
12
- large: 4
13
- };
6
+ import StyledCardRow from "./card-row.style";
14
7
 
15
8
  const CardRow = ({
16
9
  children,
17
10
  spacing = "medium",
18
- ...props
11
+ ...rest
19
12
  }) => {
20
13
  return /*#__PURE__*/React.createElement(StyledCardRow, _extends({
21
14
  "data-element": "card-row",
22
- py: paddingSizes[spacing]
23
- }, props), children);
15
+ spacing: spacing
16
+ }, filterStyledSystemPaddingProps(rest)), children);
24
17
  };
25
18
 
26
19
  CardRow.propTypes = {
27
- /** Styled system padding props */
28
- ...paddingPropTypes,
29
- children: PropTypes.node.isRequired,
30
-
31
- /** Spacing prop is set in Card and defines the padding for the CardRow (the first CardRow has no padding by default). For more granular control of CardRow padding these can be over-ridden by Padding props from styled-system (see table below). */
32
- spacing: PropTypes.oneOf(["small", "medium", "large"])
20
+ "children": PropTypes.node,
21
+ "p": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
22
+ "__@toStringTag": PropTypes.string.isRequired,
23
+ "description": PropTypes.string,
24
+ "toString": PropTypes.func.isRequired,
25
+ "valueOf": PropTypes.func.isRequired
26
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
27
+ "__@toStringTag": PropTypes.string.isRequired,
28
+ "description": PropTypes.string,
29
+ "toString": PropTypes.func.isRequired,
30
+ "valueOf": PropTypes.func.isRequired
31
+ }), PropTypes.string]),
32
+ "padding": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
33
+ "__@toStringTag": PropTypes.string.isRequired,
34
+ "description": PropTypes.string,
35
+ "toString": PropTypes.func.isRequired,
36
+ "valueOf": PropTypes.func.isRequired
37
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
38
+ "__@toStringTag": PropTypes.string.isRequired,
39
+ "description": PropTypes.string,
40
+ "toString": PropTypes.func.isRequired,
41
+ "valueOf": PropTypes.func.isRequired
42
+ }), PropTypes.string]),
43
+ "paddingBottom": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
44
+ "__@toStringTag": PropTypes.string.isRequired,
45
+ "description": PropTypes.string,
46
+ "toString": PropTypes.func.isRequired,
47
+ "valueOf": PropTypes.func.isRequired
48
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
49
+ "__@toStringTag": PropTypes.string.isRequired,
50
+ "description": PropTypes.string,
51
+ "toString": PropTypes.func.isRequired,
52
+ "valueOf": PropTypes.func.isRequired
53
+ }), PropTypes.string]),
54
+ "paddingLeft": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
55
+ "__@toStringTag": PropTypes.string.isRequired,
56
+ "description": PropTypes.string,
57
+ "toString": PropTypes.func.isRequired,
58
+ "valueOf": PropTypes.func.isRequired
59
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
60
+ "__@toStringTag": PropTypes.string.isRequired,
61
+ "description": PropTypes.string,
62
+ "toString": PropTypes.func.isRequired,
63
+ "valueOf": PropTypes.func.isRequired
64
+ }), PropTypes.string]),
65
+ "paddingRight": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
66
+ "__@toStringTag": PropTypes.string.isRequired,
67
+ "description": PropTypes.string,
68
+ "toString": PropTypes.func.isRequired,
69
+ "valueOf": PropTypes.func.isRequired
70
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
71
+ "__@toStringTag": PropTypes.string.isRequired,
72
+ "description": PropTypes.string,
73
+ "toString": PropTypes.func.isRequired,
74
+ "valueOf": PropTypes.func.isRequired
75
+ }), PropTypes.string]),
76
+ "paddingTop": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
77
+ "__@toStringTag": PropTypes.string.isRequired,
78
+ "description": PropTypes.string,
79
+ "toString": PropTypes.func.isRequired,
80
+ "valueOf": PropTypes.func.isRequired
81
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
82
+ "__@toStringTag": PropTypes.string.isRequired,
83
+ "description": PropTypes.string,
84
+ "toString": PropTypes.func.isRequired,
85
+ "valueOf": PropTypes.func.isRequired
86
+ }), PropTypes.string]),
87
+ "paddingX": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
88
+ "__@toStringTag": PropTypes.string.isRequired,
89
+ "description": PropTypes.string,
90
+ "toString": PropTypes.func.isRequired,
91
+ "valueOf": PropTypes.func.isRequired
92
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
93
+ "__@toStringTag": PropTypes.string.isRequired,
94
+ "description": PropTypes.string,
95
+ "toString": PropTypes.func.isRequired,
96
+ "valueOf": PropTypes.func.isRequired
97
+ }), PropTypes.string]),
98
+ "paddingY": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
99
+ "__@toStringTag": PropTypes.string.isRequired,
100
+ "description": PropTypes.string,
101
+ "toString": PropTypes.func.isRequired,
102
+ "valueOf": PropTypes.func.isRequired
103
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
104
+ "__@toStringTag": PropTypes.string.isRequired,
105
+ "description": PropTypes.string,
106
+ "toString": PropTypes.func.isRequired,
107
+ "valueOf": PropTypes.func.isRequired
108
+ }), PropTypes.string]),
109
+ "pb": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
110
+ "__@toStringTag": PropTypes.string.isRequired,
111
+ "description": PropTypes.string,
112
+ "toString": PropTypes.func.isRequired,
113
+ "valueOf": PropTypes.func.isRequired
114
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
115
+ "__@toStringTag": PropTypes.string.isRequired,
116
+ "description": PropTypes.string,
117
+ "toString": PropTypes.func.isRequired,
118
+ "valueOf": PropTypes.func.isRequired
119
+ }), PropTypes.string]),
120
+ "pl": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
121
+ "__@toStringTag": PropTypes.string.isRequired,
122
+ "description": PropTypes.string,
123
+ "toString": PropTypes.func.isRequired,
124
+ "valueOf": PropTypes.func.isRequired
125
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
126
+ "__@toStringTag": PropTypes.string.isRequired,
127
+ "description": PropTypes.string,
128
+ "toString": PropTypes.func.isRequired,
129
+ "valueOf": PropTypes.func.isRequired
130
+ }), PropTypes.string]),
131
+ "pr": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
132
+ "__@toStringTag": PropTypes.string.isRequired,
133
+ "description": PropTypes.string,
134
+ "toString": PropTypes.func.isRequired,
135
+ "valueOf": PropTypes.func.isRequired
136
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
137
+ "__@toStringTag": PropTypes.string.isRequired,
138
+ "description": PropTypes.string,
139
+ "toString": PropTypes.func.isRequired,
140
+ "valueOf": PropTypes.func.isRequired
141
+ }), PropTypes.string]),
142
+ "pt": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
143
+ "__@toStringTag": PropTypes.string.isRequired,
144
+ "description": PropTypes.string,
145
+ "toString": PropTypes.func.isRequired,
146
+ "valueOf": PropTypes.func.isRequired
147
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
148
+ "__@toStringTag": PropTypes.string.isRequired,
149
+ "description": PropTypes.string,
150
+ "toString": PropTypes.func.isRequired,
151
+ "valueOf": PropTypes.func.isRequired
152
+ }), PropTypes.string]),
153
+ "px": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
154
+ "__@toStringTag": PropTypes.string.isRequired,
155
+ "description": PropTypes.string,
156
+ "toString": PropTypes.func.isRequired,
157
+ "valueOf": PropTypes.func.isRequired
158
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
159
+ "__@toStringTag": PropTypes.string.isRequired,
160
+ "description": PropTypes.string,
161
+ "toString": PropTypes.func.isRequired,
162
+ "valueOf": PropTypes.func.isRequired
163
+ }), PropTypes.string]),
164
+ "py": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
165
+ "__@toStringTag": PropTypes.string.isRequired,
166
+ "description": PropTypes.string,
167
+ "toString": PropTypes.func.isRequired,
168
+ "valueOf": PropTypes.func.isRequired
169
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
170
+ "__@toStringTag": PropTypes.string.isRequired,
171
+ "description": PropTypes.string,
172
+ "toString": PropTypes.func.isRequired,
173
+ "valueOf": PropTypes.func.isRequired
174
+ }), PropTypes.string]),
175
+ "spacing": PropTypes.oneOf(["large", "medium", "small"])
33
176
  };
177
+ CardRow.displayName = "CardRow";
34
178
  export default CardRow;
@@ -0,0 +1,11 @@
1
+ import { PaddingProps } from "styled-system";
2
+ import { CardSpacing } from "../card.config";
3
+ export interface StyledCardRowProps extends PaddingProps {
4
+ /**
5
+ * Spacing prop is set in Card and defines the padding for the CardRow (the first CardRow has no padding by default).
6
+ * For more granular control of CardRow padding these can be over-ridden by Padding props from styled-system.
7
+ */
8
+ spacing: CardSpacing;
9
+ }
10
+ declare const StyledCardRow: import("styled-components").StyledComponent<"div", any, StyledCardRowProps, never>;
11
+ export default StyledCardRow;
@@ -1,15 +1,23 @@
1
- import styled from "styled-components";
1
+ import styled, { css } from "styled-components";
2
2
  import { padding } from "styled-system";
3
- import PropTypes from "prop-types";
4
- import BaseTheme from "../../../style/themes/base";
3
+ import baseTheme from "../../../style/themes/base";
4
+ const paddingSizes = {
5
+ small: "var(--spacing200)",
6
+ medium: "var(--spacing300)",
7
+ large: "var(--spacing400)"
8
+ };
5
9
  const StyledCardRow = styled.div`
6
- ${padding}
7
10
  display: flex;
11
+ ${({
12
+ spacing
13
+ }) => css`
14
+ padding-top: ${paddingSizes[spacing]};
15
+ padding-bottom: ${paddingSizes[spacing]};
16
+ `}
17
+
18
+ ${padding}
8
19
  `;
9
- StyledCardRow.propTypes = {
10
- theme: PropTypes.object
11
- };
12
20
  StyledCardRow.defaultProps = {
13
- theme: BaseTheme
21
+ theme: baseTheme
14
22
  };
15
23
  export default StyledCardRow;
@@ -1 +1,2 @@
1
- export { default } from "./card-row";
1
+ export { default } from "./card-row.component";
2
+ export type { CardRowProps } from "./card-row.component";
@@ -0,0 +1,31 @@
1
+ import React from "react";
2
+ import { MarginProps } from "styled-system";
3
+ import { CardSpacing } from "./card.config";
4
+ export interface CardProps extends MarginProps {
5
+ /** Identifier used for testing purposes, applied to the root element of the component. */
6
+ "data-element"?: string;
7
+ /** Identifier used for testing purposes, applied to the root element of the component. */
8
+ "data-role"?: string;
9
+ /**
10
+ * [DEPRECATED - use `data-role` instead]
11
+ * Identifier used for testing purposes, applied to the root element of the component.
12
+ * */
13
+ dataRole?: string;
14
+ /** Action to be executed when card is clicked or enter pressed */
15
+ action?: (event: React.MouseEvent<HTMLDivElement>) => void;
16
+ /** Style value for width of card */
17
+ cardWidth?: string;
18
+ /** Child nodes */
19
+ children: React.ReactNode;
20
+ /** Flag to indicate if card is draggable */
21
+ draggable?: boolean;
22
+ /** Flag to indicate if card is interactive */
23
+ interactive?: boolean;
24
+ /** Size of card for applying padding */
25
+ spacing?: CardSpacing;
26
+ }
27
+ declare const Card: {
28
+ ({ "data-element": dataElement, "data-role": dataRole, dataRole: oldDataRole, action, children, cardWidth, draggable, interactive, spacing, ...rest }: CardProps): JSX.Element;
29
+ displayName: string;
30
+ };
31
+ export default Card;
@@ -1,95 +1,234 @@
1
1
  function _extends() { _extends = Object.assign || 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
 
3
- import React from "react";
3
+ import React, { useCallback } from "react";
4
4
  import PropTypes from "prop-types";
5
- import styledSystemPropTypes from "@styled-system/prop-types";
6
5
  import { filterStyledSystemMarginProps } from "../../style/utils";
7
6
  import StyledCard from "./card.style";
8
7
  import Icon from "../icon";
9
- import CardRow from "./card-row/card-row.component";
10
- import CardFooter from "./card-footer/card-footer.component";
11
- const marginPropTypes = filterStyledSystemMarginProps(styledSystemPropTypes.space);
8
+ import { CardRow, CardFooter } from ".";
9
+ import Logger from "../../__internal__/utils/logger";
10
+
11
+ function hasDisplayName(child, displayName) {
12
+ return child.type.displayName === displayName;
13
+ }
14
+
15
+ let isDeprecationWarningTriggered = false;
12
16
 
13
17
  const Card = ({
18
+ "data-element": dataElement,
19
+ "data-role": dataRole,
20
+ dataRole: oldDataRole,
14
21
  action,
15
22
  children,
16
- cardWidth,
17
- interactive,
23
+ cardWidth = "500px",
18
24
  draggable,
19
- spacing,
20
- dataRole,
25
+ interactive,
26
+ spacing = "medium",
21
27
  ...rest
22
28
  }) => {
23
- const handleClick = ev => {
24
- if (!draggable && action) {
25
- action(ev);
26
- }
27
- };
28
-
29
- const renderChildren = () => {
30
- return React.Children.map(children, (child, index) => {
31
- if (child.type === CardRow || child.type === CardFooter) {
32
- if (index === 0) {
33
- const childProps = {
34
- spacing,
35
- ...child.props
36
- };
29
+ if (!isDeprecationWarningTriggered && oldDataRole) {
30
+ isDeprecationWarningTriggered = true;
31
+ Logger.deprecate("The `dataRole` prop of `Card` is now deprecated. Please use the kebab-case version `data-role` instead.");
32
+ }
37
33
 
38
- if (child.type !== CardFooter) {
39
- const pad = React.Children.toArray(children).filter(row => row.type === CardRow).length === 1 ? "pt" : "py";
40
- childProps[pad] = 0;
41
- }
42
-
43
- return /*#__PURE__*/React.cloneElement(child, childProps);
44
- }
45
-
46
- return /*#__PURE__*/React.cloneElement(child, {
47
- spacing
48
- });
49
- }
50
-
51
- return child;
34
+ const renderChildren = useCallback(() => React.Children.map(children, (child, index) => {
35
+ if (! /*#__PURE__*/React.isValidElement(child) || /*#__PURE__*/React.isValidElement(child) && !hasDisplayName(child, CardRow.displayName) && !hasDisplayName(child, CardFooter.displayName)) return child;
36
+ if (index !== 0) return /*#__PURE__*/React.cloneElement(child, {
37
+ spacing
52
38
  });
53
- };
39
+ const childProps = {
40
+ spacing,
41
+ ...child.props
42
+ };
54
43
 
55
- const onClickHandler = interactive ? handleClick : null;
56
- const interactiveProps = interactive ? {
57
- tabIndex: 0,
58
- type: "button"
59
- } : undefined;
44
+ if (hasDisplayName(child, CardRow.displayName)) {
45
+ const pad = React.Children.toArray(children).filter(row => /*#__PURE__*/React.isValidElement(row) && hasDisplayName(row, CardRow.displayName)).length === 1 ? "pt" : "py";
46
+ childProps[pad] = 0;
47
+ }
48
+
49
+ return /*#__PURE__*/React.cloneElement(child, childProps);
50
+ }), [children, spacing]);
60
51
  return /*#__PURE__*/React.createElement(StyledCard, _extends({
61
52
  "data-component": "card",
53
+ "data-element": dataElement,
54
+ "data-role": dataRole || oldDataRole,
62
55
  cardWidth: cardWidth,
63
- interactive: interactive,
64
- draggable: draggable,
56
+ interactive: !!interactive,
57
+ draggable: !!draggable,
65
58
  spacing: spacing,
66
- onClick: onClickHandler,
67
- "data-role": dataRole
68
- }, interactiveProps, rest), draggable && /*#__PURE__*/React.createElement(Icon, {
59
+ onClick: interactive && !draggable ? action : undefined
60
+ }, interactive && {
61
+ tabIndex: 0,
62
+ type: "button"
63
+ }, filterStyledSystemMarginProps(rest)), draggable && /*#__PURE__*/React.createElement(Icon, {
69
64
  type: "drag"
70
65
  }), renderChildren());
71
66
  };
72
67
 
73
- Card.defaultProps = {
74
- spacing: "medium"
75
- };
76
- Card.propTypes = { ...marginPropTypes,
77
-
78
- /** action to be executed when card is clicked or enter pressed */
79
- action: PropTypes.func,
80
- children: PropTypes.node.isRequired,
81
-
82
- /** style value for width of card */
83
- cardWidth: PropTypes.string,
84
-
85
- /** flag to indicate if card is interactive */
86
- interactive: PropTypes.bool,
87
-
88
- /** flag to indicate if card is draggable */
89
- draggable: PropTypes.bool,
90
-
91
- /** size of card for applying padding (small | medium | large) */
92
- spacing: PropTypes.oneOf(["small", "medium", "large"]),
93
- dataRole: PropTypes.string
68
+ Card.propTypes = {
69
+ "action": PropTypes.func,
70
+ "cardWidth": PropTypes.string,
71
+ "children": PropTypes.node,
72
+ "data-element": PropTypes.string,
73
+ "data-role": PropTypes.string,
74
+ "dataRole": PropTypes.string,
75
+ "draggable": PropTypes.bool,
76
+ "interactive": PropTypes.bool,
77
+ "m": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
78
+ "__@toStringTag": PropTypes.string.isRequired,
79
+ "description": PropTypes.string,
80
+ "toString": PropTypes.func.isRequired,
81
+ "valueOf": PropTypes.func.isRequired
82
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
83
+ "__@toStringTag": PropTypes.string.isRequired,
84
+ "description": PropTypes.string,
85
+ "toString": PropTypes.func.isRequired,
86
+ "valueOf": PropTypes.func.isRequired
87
+ }), PropTypes.string]),
88
+ "margin": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
89
+ "__@toStringTag": PropTypes.string.isRequired,
90
+ "description": PropTypes.string,
91
+ "toString": PropTypes.func.isRequired,
92
+ "valueOf": PropTypes.func.isRequired
93
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
94
+ "__@toStringTag": PropTypes.string.isRequired,
95
+ "description": PropTypes.string,
96
+ "toString": PropTypes.func.isRequired,
97
+ "valueOf": PropTypes.func.isRequired
98
+ }), PropTypes.string]),
99
+ "marginBottom": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
100
+ "__@toStringTag": PropTypes.string.isRequired,
101
+ "description": PropTypes.string,
102
+ "toString": PropTypes.func.isRequired,
103
+ "valueOf": PropTypes.func.isRequired
104
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
105
+ "__@toStringTag": PropTypes.string.isRequired,
106
+ "description": PropTypes.string,
107
+ "toString": PropTypes.func.isRequired,
108
+ "valueOf": PropTypes.func.isRequired
109
+ }), PropTypes.string]),
110
+ "marginLeft": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
111
+ "__@toStringTag": PropTypes.string.isRequired,
112
+ "description": PropTypes.string,
113
+ "toString": PropTypes.func.isRequired,
114
+ "valueOf": PropTypes.func.isRequired
115
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
116
+ "__@toStringTag": PropTypes.string.isRequired,
117
+ "description": PropTypes.string,
118
+ "toString": PropTypes.func.isRequired,
119
+ "valueOf": PropTypes.func.isRequired
120
+ }), PropTypes.string]),
121
+ "marginRight": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
122
+ "__@toStringTag": PropTypes.string.isRequired,
123
+ "description": PropTypes.string,
124
+ "toString": PropTypes.func.isRequired,
125
+ "valueOf": PropTypes.func.isRequired
126
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
127
+ "__@toStringTag": PropTypes.string.isRequired,
128
+ "description": PropTypes.string,
129
+ "toString": PropTypes.func.isRequired,
130
+ "valueOf": PropTypes.func.isRequired
131
+ }), PropTypes.string]),
132
+ "marginTop": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
133
+ "__@toStringTag": PropTypes.string.isRequired,
134
+ "description": PropTypes.string,
135
+ "toString": PropTypes.func.isRequired,
136
+ "valueOf": PropTypes.func.isRequired
137
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
138
+ "__@toStringTag": PropTypes.string.isRequired,
139
+ "description": PropTypes.string,
140
+ "toString": PropTypes.func.isRequired,
141
+ "valueOf": PropTypes.func.isRequired
142
+ }), PropTypes.string]),
143
+ "marginX": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
144
+ "__@toStringTag": PropTypes.string.isRequired,
145
+ "description": PropTypes.string,
146
+ "toString": PropTypes.func.isRequired,
147
+ "valueOf": PropTypes.func.isRequired
148
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
149
+ "__@toStringTag": PropTypes.string.isRequired,
150
+ "description": PropTypes.string,
151
+ "toString": PropTypes.func.isRequired,
152
+ "valueOf": PropTypes.func.isRequired
153
+ }), PropTypes.string]),
154
+ "marginY": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
155
+ "__@toStringTag": PropTypes.string.isRequired,
156
+ "description": PropTypes.string,
157
+ "toString": PropTypes.func.isRequired,
158
+ "valueOf": PropTypes.func.isRequired
159
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
160
+ "__@toStringTag": PropTypes.string.isRequired,
161
+ "description": PropTypes.string,
162
+ "toString": PropTypes.func.isRequired,
163
+ "valueOf": PropTypes.func.isRequired
164
+ }), PropTypes.string]),
165
+ "mb": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
166
+ "__@toStringTag": PropTypes.string.isRequired,
167
+ "description": PropTypes.string,
168
+ "toString": PropTypes.func.isRequired,
169
+ "valueOf": PropTypes.func.isRequired
170
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
171
+ "__@toStringTag": PropTypes.string.isRequired,
172
+ "description": PropTypes.string,
173
+ "toString": PropTypes.func.isRequired,
174
+ "valueOf": PropTypes.func.isRequired
175
+ }), PropTypes.string]),
176
+ "ml": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
177
+ "__@toStringTag": PropTypes.string.isRequired,
178
+ "description": PropTypes.string,
179
+ "toString": PropTypes.func.isRequired,
180
+ "valueOf": PropTypes.func.isRequired
181
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
182
+ "__@toStringTag": PropTypes.string.isRequired,
183
+ "description": PropTypes.string,
184
+ "toString": PropTypes.func.isRequired,
185
+ "valueOf": PropTypes.func.isRequired
186
+ }), PropTypes.string]),
187
+ "mr": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
188
+ "__@toStringTag": PropTypes.string.isRequired,
189
+ "description": PropTypes.string,
190
+ "toString": PropTypes.func.isRequired,
191
+ "valueOf": PropTypes.func.isRequired
192
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
193
+ "__@toStringTag": PropTypes.string.isRequired,
194
+ "description": PropTypes.string,
195
+ "toString": PropTypes.func.isRequired,
196
+ "valueOf": PropTypes.func.isRequired
197
+ }), PropTypes.string]),
198
+ "mt": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
199
+ "__@toStringTag": PropTypes.string.isRequired,
200
+ "description": PropTypes.string,
201
+ "toString": PropTypes.func.isRequired,
202
+ "valueOf": PropTypes.func.isRequired
203
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
204
+ "__@toStringTag": PropTypes.string.isRequired,
205
+ "description": PropTypes.string,
206
+ "toString": PropTypes.func.isRequired,
207
+ "valueOf": PropTypes.func.isRequired
208
+ }), PropTypes.string]),
209
+ "mx": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
210
+ "__@toStringTag": PropTypes.string.isRequired,
211
+ "description": PropTypes.string,
212
+ "toString": PropTypes.func.isRequired,
213
+ "valueOf": PropTypes.func.isRequired
214
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
215
+ "__@toStringTag": PropTypes.string.isRequired,
216
+ "description": PropTypes.string,
217
+ "toString": PropTypes.func.isRequired,
218
+ "valueOf": PropTypes.func.isRequired
219
+ }), PropTypes.string]),
220
+ "my": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
221
+ "__@toStringTag": PropTypes.string.isRequired,
222
+ "description": PropTypes.string,
223
+ "toString": PropTypes.func.isRequired,
224
+ "valueOf": PropTypes.func.isRequired
225
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
226
+ "__@toStringTag": PropTypes.string.isRequired,
227
+ "description": PropTypes.string,
228
+ "toString": PropTypes.func.isRequired,
229
+ "valueOf": PropTypes.func.isRequired
230
+ }), PropTypes.string]),
231
+ "spacing": PropTypes.oneOf(["large", "medium", "small"])
94
232
  };
233
+ Card.displayName = "Card";
95
234
  export default Card;
@@ -0,0 +1,4 @@
1
+ export declare const CARD_SPACING: readonly ["small", "medium", "large"];
2
+ export declare const CARD_ALIGNS: readonly ["left", "center", "right"];
3
+ export declare type CardAlign = typeof CARD_ALIGNS[number];
4
+ export declare type CardSpacing = typeof CARD_SPACING[number];
@@ -1,3 +1,2 @@
1
- // eslint-disable-next-line import/prefer-default-export
2
- export const CARD_SIZES = ["small", "medium", "large"];
3
- export const CARD_ALIGNS = ["center", "left", "right"];
1
+ export const CARD_SPACING = ["small", "medium", "large"];
2
+ export const CARD_ALIGNS = ["left", "center", "right"];
@@ -0,0 +1,10 @@
1
+ import { MarginProps } from "styled-system";
2
+ import { CardSpacing } from "./card.config";
3
+ export interface StyledCardProps extends MarginProps {
4
+ cardWidth: string;
5
+ interactive: boolean;
6
+ draggable: boolean;
7
+ spacing: CardSpacing;
8
+ }
9
+ declare const StyledCard: import("styled-components").StyledComponent<"div", any, StyledCardProps, never>;
10
+ export default StyledCard;
@@ -1,8 +1,6 @@
1
1
  import styled, { css } from "styled-components";
2
- import PropTypes from "prop-types";
3
2
  import { margin } from "styled-system";
4
3
  import baseTheme from "../../style/themes/base";
5
- import { CARD_SIZES } from "./card.config";
6
4
  const paddingSizes = {
7
5
  small: "0 24px",
8
6
  medium: "0 32px",
@@ -46,15 +44,6 @@ const StyledCard = styled.div`
46
44
  `}
47
45
  `;
48
46
  StyledCard.defaultProps = {
49
- cardWidth: "500px",
50
- spacing: "medium",
51
47
  theme: baseTheme
52
48
  };
53
- StyledCard.propTypes = {
54
- cardWidth: PropTypes.string,
55
- interactive: PropTypes.bool,
56
- draggable: PropTypes.bool,
57
- spacing: PropTypes.oneOf(CARD_SIZES),
58
- theme: PropTypes.object
59
- };
60
49
  export default StyledCard;
@@ -1,4 +1,8 @@
1
- export { default, default as Card } from "./card";
1
+ export { default, default as Card } from "./card.component";
2
+ export type { CardProps } from "./card.component";
2
3
  export { default as CardColumn } from "./card-column";
4
+ export type { CardColumnProps } from "./card-column";
3
5
  export { default as CardFooter } from "./card-footer";
6
+ export type { CardFooterProps } from "./card-footer";
4
7
  export { default as CardRow } from "./card-row";
8
+ export type { CardRowProps } from "./card-row";
@@ -91,5 +91,6 @@ const Box = _styledComponents.default.div`
91
91
  Box.defaultProps = {
92
92
  theme: _base.default
93
93
  };
94
+ Box.displayName = "Box";
94
95
  var _default = Box;
95
96
  exports.default = _default;