carbon-react 119.12.1 → 120.0.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/__internal__/input/input-presentation.style.d.ts +1 -1
  2. package/esm/__spec_helper__/test-utils.d.ts +3 -2
  3. package/esm/__spec_helper__/test-utils.js +15 -1
  4. package/esm/components/box/box.component.d.ts +23 -6
  5. package/esm/components/box/box.component.js +3570 -103
  6. package/esm/components/box/box.style.d.ts +3 -0
  7. package/esm/components/box/box.style.js +112 -0
  8. package/esm/components/dismissible-box/dismissible-box.style.d.ts +2 -1
  9. package/esm/components/drawer/drawer.style.d.ts +2 -1
  10. package/esm/components/duelling-picklist/picklist/picklist.style.js +4 -2
  11. package/esm/components/flat-table/flat-table.style.js +2 -2
  12. package/esm/components/heading/heading.style.d.ts +4 -9
  13. package/esm/components/menu/menu-full-screen/menu-full-screen.style.js +2 -2
  14. package/esm/components/menu/scrollable-block/scrollable-block.style.js +2 -2
  15. package/esm/components/text-editor/__internal__/toolbar/toolbar-button/toolbar-button.style.js +1 -1
  16. package/esm/components/typography/typography.component.d.ts +25 -15
  17. package/esm/components/typography/typography.component.js +37 -184
  18. package/esm/components/typography/typography.style.d.ts +12 -0
  19. package/esm/components/typography/typography.style.js +190 -0
  20. package/esm/components/vertical-menu/vertical-menu.style.js +3 -3
  21. package/esm/style/utils/filter-styled-system-flexbox-props.d.ts +3 -0
  22. package/esm/style/utils/filter-styled-system-flexbox-props.js +5 -0
  23. package/esm/style/utils/filter-styled-system-grid-props.d.ts +3 -0
  24. package/esm/style/utils/filter-styled-system-grid-props.js +5 -0
  25. package/esm/style/utils/filter-styled-system-layout-props.d.ts +3 -0
  26. package/esm/style/utils/filter-styled-system-layout-props.js +5 -0
  27. package/esm/style/utils/index.d.ts +4 -1
  28. package/esm/style/utils/index.js +4 -1
  29. package/lib/__internal__/input/input-presentation.style.d.ts +1 -1
  30. package/lib/__spec_helper__/test-utils.d.ts +3 -2
  31. package/lib/__spec_helper__/test-utils.js +16 -1
  32. package/lib/components/box/box.component.d.ts +23 -6
  33. package/lib/components/box/box.component.js +3569 -105
  34. package/lib/components/box/box.style.d.ts +3 -0
  35. package/lib/components/box/box.style.js +122 -0
  36. package/lib/components/dismissible-box/dismissible-box.style.d.ts +2 -1
  37. package/lib/components/drawer/drawer.style.d.ts +2 -1
  38. package/lib/components/duelling-picklist/picklist/picklist.style.js +2 -1
  39. package/lib/components/flat-table/flat-table.style.js +1 -1
  40. package/lib/components/heading/heading.style.d.ts +4 -9
  41. package/lib/components/menu/menu-full-screen/menu-full-screen.style.js +1 -1
  42. package/lib/components/menu/scrollable-block/scrollable-block.style.js +1 -1
  43. package/lib/components/text-editor/__internal__/toolbar/toolbar-button/toolbar-button.style.js +1 -1
  44. package/lib/components/typography/typography.component.d.ts +25 -15
  45. package/lib/components/typography/typography.component.js +39 -187
  46. package/lib/components/typography/typography.style.d.ts +12 -0
  47. package/lib/components/typography/typography.style.js +200 -0
  48. package/lib/components/vertical-menu/vertical-menu.style.js +1 -1
  49. package/lib/style/utils/filter-styled-system-flexbox-props.d.ts +3 -0
  50. package/lib/style/utils/filter-styled-system-flexbox-props.js +14 -0
  51. package/lib/style/utils/filter-styled-system-grid-props.d.ts +3 -0
  52. package/lib/style/utils/filter-styled-system-grid-props.js +14 -0
  53. package/lib/style/utils/filter-styled-system-layout-props.d.ts +3 -0
  54. package/lib/style/utils/filter-styled-system-layout-props.js +14 -0
  55. package/lib/style/utils/index.d.ts +4 -1
  56. package/lib/style/utils/index.js +21 -0
  57. package/package.json +1 -1
@@ -0,0 +1,3 @@
1
+ import { BoxProps } from "./box.component";
2
+ declare const StyledBox: import("styled-components").StyledComponent<"div", any, BoxProps, never>;
3
+ export default StyledBox;
@@ -0,0 +1,122 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _styledComponents = _interopRequireWildcard(require("styled-components"));
8
+ var _styledSystem = require("styled-system");
9
+ var _base = _interopRequireDefault(require("../../style/themes/base"));
10
+ var _color = _interopRequireDefault(require("../../style/utils/color"));
11
+ var _box = _interopRequireDefault(require("./box.config"));
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
14
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
15
+ const calculatePosition = props => {
16
+ const {
17
+ position,
18
+ ...rest
19
+ } = (0, _styledSystem.position)(props);
20
+ return {
21
+ position,
22
+ zIndex: ["sticky", "fixed"].includes(position) ? 1 : undefined,
23
+ ...rest
24
+ };
25
+ };
26
+ const StyledBox = _styledComponents.default.div`
27
+ ${_styledSystem.space}
28
+ ${_styledSystem.layout}
29
+ ${_styledSystem.flexbox}
30
+ ${_styledSystem.grid}
31
+ ${calculatePosition}
32
+
33
+ ${({
34
+ theme,
35
+ borderRadius = "borderRadius000"
36
+ }) => !theme.roundedCornersOptOut && (0, _styledComponents.css)`
37
+ border-radius: var(--${borderRadius});
38
+ `}
39
+
40
+ ${({
41
+ color,
42
+ bg,
43
+ backgroundColor,
44
+ ...rest
45
+ }) => (0, _color.default)({
46
+ color,
47
+ bg,
48
+ backgroundColor,
49
+ ...rest
50
+ })}
51
+
52
+ ${({
53
+ overflowWrap
54
+ }) => overflowWrap && (0, _styledComponents.css)`
55
+ overflow-wrap: ${overflowWrap};
56
+ `}
57
+
58
+ ${({
59
+ height
60
+ }) => height && (0, _styledComponents.css)`
61
+ height: ${height};
62
+ `}
63
+
64
+ ${({
65
+ width
66
+ }) => width && (0, _styledComponents.css)`
67
+ width: ${width};
68
+ `}
69
+
70
+ ${({
71
+ scrollVariant
72
+ }) => scrollVariant && (0, _styledComponents.css)`
73
+ scrollbar-color: ${_box.default[scrollVariant].thumb}
74
+ ${_box.default[scrollVariant].track};
75
+
76
+ &::-webkit-scrollbar {
77
+ width: 8px;
78
+ }
79
+ &::-webkit-scrollbar-track {
80
+ background-color: ${_box.default[scrollVariant].track};
81
+ }
82
+ &::-webkit-scrollbar-thumb {
83
+ background-color: ${_box.default[scrollVariant].thumb};
84
+ }
85
+ `}
86
+
87
+ ${({
88
+ boxSizing
89
+ }) => boxSizing && (0, _styledComponents.css)`
90
+ box-sizing: ${boxSizing};
91
+ `}
92
+
93
+ ${({
94
+ display,
95
+ gap,
96
+ columnGap,
97
+ rowGap
98
+ }) => (display === "flex" || display === "inline-flex" || display === "grid" || display === "inline-grid") && (0, _styledComponents.css)`
99
+ ${gap !== undefined && (0, _styledComponents.css)`
100
+ gap: ${_box.default.gap(gap)};
101
+ `}
102
+
103
+ ${columnGap !== undefined && (0, _styledComponents.css)`
104
+ column-gap: ${_box.default.gap(columnGap)};
105
+ `}
106
+
107
+ ${rowGap !== undefined && (0, _styledComponents.css)`
108
+ row-gap: ${_box.default.gap(rowGap)};
109
+ `}
110
+ `};
111
+
112
+ ${({
113
+ boxShadow
114
+ }) => boxShadow && (0, _styledComponents.css)`
115
+ box-shadow: var(--${boxShadow});
116
+ `}
117
+ `;
118
+ StyledBox.defaultProps = {
119
+ theme: _base.default
120
+ };
121
+ var _default = StyledBox;
122
+ exports.default = _default;
@@ -1,8 +1,9 @@
1
+ /// <reference types="react" />
1
2
  export interface StyledDismissibleBoxProps {
2
3
  /** Flag to control whether the thicker left border highlight should be rendered */
3
4
  hasBorderLeftHighlight?: boolean;
4
5
  /** Set the base color variant */
5
6
  variant?: "light" | "dark";
6
7
  }
7
- declare const StyledDismissibleBox: import("styled-components").StyledComponent<"div", any, import("../box").BoxProps & StyledDismissibleBoxProps, never>;
8
+ declare const StyledDismissibleBox: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../box").BoxProps & import("react").RefAttributes<HTMLDivElement>>, any, StyledDismissibleBoxProps, never>;
8
9
  export { StyledDismissibleBox };
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  declare const StyledSidebarHeader: import("styled-components").StyledComponent<"div", any, {
2
3
  isExpanded?: boolean | undefined;
3
4
  }, never>;
@@ -7,7 +8,7 @@ interface StyledDrawerSidebarProps {
7
8
  isExpanded?: boolean;
8
9
  hasControls: boolean;
9
10
  }
10
- declare const StyledDrawerSidebar: import("styled-components").StyledComponent<"div", any, import("../box").BoxProps & StyledDrawerSidebarProps, never>;
11
+ declare const StyledDrawerSidebar: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../box").BoxProps & import("react").RefAttributes<HTMLDivElement>>, any, StyledDrawerSidebarProps, never>;
11
12
  interface StyledDrawerContentProps {
12
13
  animationDuration?: string;
13
14
  backgroundColor?: string;
@@ -5,8 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.StyledPicklist = exports.StyledEmptyContainer = void 0;
7
7
  var _styledComponents = _interopRequireDefault(require("styled-components"));
8
- var _box = _interopRequireDefault(require("../../box"));
8
+ var _box = _interopRequireDefault(require("../../box/box.style"));
9
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
+ // TODO: remove polymorphism when we revisit as part of ticket FE-6177
10
11
  const StyledPicklist = (0, _styledComponents.default)(_box.default).attrs({
11
12
  as: "ul"
12
13
  })`
@@ -13,7 +13,7 @@ var _flatTableCheckbox = _interopRequireDefault(require("./flat-table-checkbox/f
13
13
  var _themes = require("../../style/themes");
14
14
  var _flatTableCell = require("./flat-table-cell/flat-table-cell.style");
15
15
  var _cellSizes = _interopRequireDefault(require("./cell-sizes.style"));
16
- var _box = _interopRequireDefault(require("../box"));
16
+ var _box = _interopRequireDefault(require("../box/box.style"));
17
17
  var _pager = require("../pager/pager.style");
18
18
  var _addFocusStyling = _interopRequireDefault(require("../../style/utils/add-focus-styling"));
19
19
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -11,15 +11,10 @@ declare const StyledHeadingBackButton: import("styled-components").StyledCompone
11
11
  declare type StyledHeadingTitleProps = {
12
12
  withMargin?: boolean;
13
13
  };
14
- declare const StyledHeadingTitle: import("styled-components").StyledComponent<"span", any, {
15
- as: import("react").ElementType<any> | undefined;
16
- size: string;
17
- weight: string;
18
- textTransform: string;
19
- textDecoration: string;
20
- lineHeight: string;
21
- defaultMargin: string;
22
- } & import("../typography").TypographyProps & StyledHeadingTitleProps, "as" | "textDecoration" | "size" | "lineHeight" | "textTransform" | "weight" | "defaultMargin">;
14
+ declare const StyledHeadingTitle: import("styled-components").StyledComponent<{
15
+ ({ "data-component": dataComponent, variant, as, id, fontSize, fontWeight, textTransform, lineHeight, textDecoration, display, listStyleType, whiteSpace, wordWrap, textOverflow, truncate, color, backgroundColor, bg, opacity, children, className, ...rest }: import("../typography").TypographyProps): import("react").JSX.Element;
16
+ displayName: string;
17
+ }, any, StyledHeadingTitleProps, never>;
23
18
  declare const StyledHeadingPills: import("styled-components").StyledComponent<"span", any, {}, never>;
24
19
  declare type StyledSubHeaderProps = {
25
20
  hasBackLink?: boolean;
@@ -7,7 +7,7 @@ exports.StyledMenuFullscreenHeader = exports.StyledMenuFullscreen = void 0;
7
7
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
8
8
  var _themes = require("../../../style/themes");
9
9
  var _iconButton = _interopRequireDefault(require("../../icon-button/icon-button.style"));
10
- var _box = _interopRequireDefault(require("../../box"));
10
+ var _box = _interopRequireDefault(require("../../box/box.style"));
11
11
  var _search = _interopRequireDefault(require("../../search/search.style"));
12
12
  var _icon = _interopRequireDefault(require("../../icon/icon.style"));
13
13
  var _button = _interopRequireDefault(require("../../button/button.style"));
@@ -7,7 +7,7 @@ exports.default = void 0;
7
7
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
8
8
  var _menuItem = _interopRequireDefault(require("../menu-item/menu-item.style"));
9
9
  var _menu = _interopRequireDefault(require("../menu.config"));
10
- var _box = _interopRequireDefault(require("../../box/box.component"));
10
+ var _box = _interopRequireDefault(require("../../box/box.style"));
11
11
  var _menu2 = require("../menu.style");
12
12
  var _link = require("../../link/link.style");
13
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -33,7 +33,7 @@ const StyledToolbarButton = _styledComponents.default.button.attrs({
33
33
  :focus,
34
34
  :active {
35
35
  z-index: 1;
36
- postion: relative;
36
+ position: relative;
37
37
  ${theme.focusRedesignOptOut && /* istanbul ignore next */
38
38
  (0, _styledComponents.css)`
39
39
  outline: 2px solid var(--colorsSemanticFocus500);
@@ -1,10 +1,15 @@
1
- /// <reference types="react" />
2
- import { ColorProps, SpaceProps } from "styled-system";
1
+ import React from "react";
2
+ import { SpaceProps } from "styled-system";
3
+ import { TagProps } from "../../__internal__/utils/helpers/tags";
3
4
  declare const VARIANT_TYPES: readonly ["h1-large", "h1", "h2", "h3", "h4", "h5", "segment-header", "segment-header-small", "segment-subheader", "segment-subheader-alt", "p", "small", "big", "sup", "sub", "strong", "b", "em", "ul", "ol"];
4
5
  export declare type VariantTypes = typeof VARIANT_TYPES[number];
5
- export interface TypographyProps extends SpaceProps, ColorProps {
6
+ export interface TypographyProps extends SpaceProps, TagProps {
6
7
  /** Override the variant component */
7
8
  as?: React.ElementType;
9
+ /** Set the ID attribute of the Typography component */
10
+ id?: string;
11
+ /** Content to be rendered inside the Typography component */
12
+ children?: React.ReactNode;
8
13
  /** The visual style to apply to the component */
9
14
  variant?: VariantTypes;
10
15
  /** Override the variant font-size */
@@ -21,22 +26,27 @@ export interface TypographyProps extends SpaceProps, ColorProps {
21
26
  display?: string;
22
27
  /** Override the list-style-type */
23
28
  listStyleType?: string;
24
- /** Override the white-space type */
29
+ /** Override the white-space */
25
30
  whiteSpace?: string;
26
- /** Override the word-wrap type */
31
+ /** Override the word-wrap */
27
32
  wordWrap?: string;
28
- /** Override the text-overflow type */
33
+ /** Override the text-overflow */
29
34
  textOverflow?: string;
30
35
  /** Apply truncation */
31
36
  truncate?: boolean;
37
+ /** Override the color style */
38
+ color?: string;
39
+ /** Override the backgroundColor style */
40
+ backgroundColor?: string;
41
+ /** Override the bg value shorthand for backgroundColor */
42
+ bg?: string;
43
+ /** Override the opacity value */
44
+ opacity?: string | number;
45
+ /** @private @ignore */
46
+ className?: string;
32
47
  }
33
- declare const Typography: import("styled-components").StyledComponent<"span", any, {
34
- as: import("react").ElementType<any> | undefined;
35
- size: string;
36
- weight: string;
37
- textTransform: string;
38
- textDecoration: string;
39
- lineHeight: string;
40
- defaultMargin: string;
41
- } & TypographyProps, "as" | "textDecoration" | "size" | "lineHeight" | "textTransform" | "weight" | "defaultMargin">;
48
+ export declare const Typography: {
49
+ ({ "data-component": dataComponent, variant, as, id, fontSize, fontWeight, textTransform, lineHeight, textDecoration, display, listStyleType, whiteSpace, wordWrap, textOverflow, truncate, color, backgroundColor, bg, opacity, children, className, ...rest }: TypographyProps): React.JSX.Element;
50
+ displayName: string;
51
+ };
42
52
  export default Typography;
@@ -3,210 +3,62 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = void 0;
7
- var _styledComponents = _interopRequireWildcard(require("styled-components"));
8
- var _styledSystem = require("styled-system");
9
- var _color = _interopRequireDefault(require("../../style/utils/color"));
10
- var _base = _interopRequireDefault(require("../../style/themes/base"));
11
- var _logger = _interopRequireDefault(require("../../__internal__/utils/logger"));
6
+ exports.default = exports.Typography = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _propTypes = _interopRequireDefault(require("prop-types"));
9
+ var _tags = _interopRequireDefault(require("../../__internal__/utils/helpers/tags"));
10
+ var _utils = require("../../style/utils");
11
+ var _typography = _interopRequireDefault(require("./typography.style"));
12
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
14
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
13
+ 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); }
15
14
  const VARIANT_TYPES = ["h1-large", "h1", "h2", "h3", "h4", "h5", "segment-header", "segment-header-small", "segment-subheader", "segment-subheader-alt", "p", "small", "big", "sup", "sub", "strong", "b", "em", "ul", "ol"];
16
- const getAs = variant => {
17
- switch (variant) {
18
- case "h1-large":
19
- return "h1";
20
- case "segment-header":
21
- case "segment-header-small":
22
- case "segment-subheader":
23
- case "segment-subheader-alt":
24
- return "h5";
25
- case "big":
26
- return "p";
27
- default:
28
- return variant;
29
- }
30
- };
31
- const getSize = variant => {
32
- switch (variant) {
33
- case "h1-large":
34
- return "32px";
35
- case "h1":
36
- return "24px";
37
- case "h2":
38
- return "22px";
39
- case "h3":
40
- case "segment-header":
41
- return "20px";
42
- case "h4":
43
- case "segment-header-small":
44
- return "18px";
45
- case "h5":
46
- case "segment-subheader":
47
- case "big":
48
- return "16px";
49
- case "small":
50
- case "sub":
51
- case "sup":
52
- return "13px";
53
- case "segment-subheader-alt":
54
- case "p":
55
- case "b":
56
- case "strong":
57
- case "em":
58
- default:
59
- return "14px";
60
- }
61
- };
62
- const getLineHeight = variant => {
63
- switch (variant) {
64
- case "h1-large":
65
- return "40px";
66
- case "h1":
67
- case "segment-subheader":
68
- return "31px";
69
- case "h2":
70
- return "29px";
71
- case "h3":
72
- case "segment-header":
73
- return "26px";
74
- case "big":
75
- return "24px";
76
- case "h4":
77
- case "segment-header-small":
78
- return "23px";
79
- case "small":
80
- case "sub":
81
- case "sup":
82
- return "20px";
83
- case "h5":
84
- case "segment-subheader-alt":
85
- case "p":
86
- case "b":
87
- case "strong":
88
- case "em":
89
- default:
90
- return "21px";
91
- }
92
- };
93
- const getWeight = variant => {
94
- switch (variant) {
95
- case "h1-large":
96
- case "h1":
97
- case "segment-header":
98
- case "segment-header-small":
99
- return "900";
100
- case "h2":
101
- case "h3":
102
- case "segment-subheader":
103
- case "segment-subheader-alt":
104
- case "b":
105
- case "em":
106
- case "strong":
107
- return "700";
108
- case "h4":
109
- case "h5":
110
- case "p":
111
- case "small":
112
- case "big":
113
- case "sub":
114
- case "sup":
115
- default:
116
- return "400";
117
- }
118
- };
119
- const getTransform = variant => {
120
- if (variant === "segment-subheader-alt") {
121
- return "uppercase";
122
- }
123
- return "none";
124
- };
125
- const getDecoration = variant => {
126
- if (variant === "em") {
127
- return "underline";
128
- }
129
- return "none";
130
- };
131
- let isDeprecationWarningTriggered = false;
132
- const Typography = _styledComponents.default.span.attrs(({
133
- variant,
15
+ const Typography = ({
16
+ "data-component": dataComponent,
17
+ variant = "p",
134
18
  as,
19
+ id,
135
20
  fontSize,
136
21
  fontWeight,
137
22
  textTransform,
138
23
  lineHeight,
139
- textDecoration
140
- }) => {
141
- return {
142
- as: as || getAs(variant),
143
- size: fontSize || getSize(variant),
144
- weight: fontWeight || getWeight(variant),
145
- textTransform: textTransform || getTransform(variant),
146
- textDecoration: textDecoration || getDecoration(variant),
147
- lineHeight: lineHeight || getLineHeight(variant),
148
- defaultMargin: variant === "p" ? "0 0 16px" : "0"
149
- };
150
- })`
151
- ${() => {
152
- if (!isDeprecationWarningTriggered) {
153
- isDeprecationWarningTriggered = true;
154
- _logger.default.deprecate("Previous props that could be spread to the `Typography` component are being removed. Only props documented in the intefaces will be supported.");
155
- }
156
- return (0, _styledComponents.css)``;
157
- }}
158
- ${({
159
- size,
160
- weight,
161
- textTransform,
162
- lineHeight,
163
- defaultMargin,
164
24
  textDecoration,
165
25
  display,
166
- variant,
167
26
  listStyleType,
168
27
  whiteSpace,
169
28
  wordWrap,
170
29
  textOverflow,
171
- truncate
172
- }) => (0, _styledComponents.css)`
173
- font-style: normal;
174
- font-size: ${size};
175
- font-weight: ${weight};
176
- text-transform: ${textTransform};
177
- text-decoration: ${textDecoration};
178
- line-height: ${lineHeight};
179
- margin: ${defaultMargin};
180
- padding: 0;
181
- white-space: ${truncate ? "nowrap" : whiteSpace};
182
- word-wrap: ${wordWrap};
183
- text-overflow: ${truncate ? "ellipsis" : textOverflow};
184
- ${truncate && (0, _styledComponents.css)`
185
- overflow: hidden;
186
- `};
187
- ${variant === "sup" && "vertical-align: super;"};
188
- ${variant === "sub" && "vertical-align: sub;"};
189
- ${display && `display: ${display};`};
190
- ${listStyleType && `list-style-type: ${listStyleType};`}; ;
191
- `}
192
- ${_styledSystem.space}
193
- ${({
194
- color,
195
- bg,
30
+ truncate,
31
+ color = "blackOpacity90",
196
32
  backgroundColor,
197
- ...rest
198
- }) => (0, _color.default)({
199
- color,
200
33
  bg,
201
- backgroundColor,
34
+ opacity,
35
+ children,
36
+ className,
202
37
  ...rest
203
- })}
204
- `;
205
- Typography.defaultProps = {
206
- color: "blackOpacity90",
207
- variant: "p",
208
- theme: _base.default
38
+ }) => {
39
+ return /*#__PURE__*/_react.default.createElement(_typography.default, _extends({
40
+ variant: variant,
41
+ as: as,
42
+ id: id,
43
+ fontSize: fontSize,
44
+ fontWeight: fontWeight,
45
+ textTransform: textTransform,
46
+ lineHeight: lineHeight,
47
+ textDecoration: textDecoration,
48
+ display: display,
49
+ listStyleType: listStyleType,
50
+ whiteSpace: whiteSpace,
51
+ wordWrap: wordWrap,
52
+ textOverflow: textOverflow,
53
+ truncate: truncate,
54
+ color: color,
55
+ backgroundColor: backgroundColor,
56
+ bg: bg,
57
+ opacity: opacity,
58
+ className: className
59
+ }, (0, _tags.default)(dataComponent, rest), (0, _utils.filterStyledSystemMarginProps)(rest), (0, _utils.filterStyledSystemPaddingProps)(rest)), children);
209
60
  };
61
+ exports.Typography = Typography;
210
62
  Typography.displayName = "Typography";
211
63
  var _default = Typography;
212
64
  exports.default = _default;
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ import { TypographyProps } from "./typography.component";
3
+ declare const StyledTypography: import("styled-components").StyledComponent<"span", any, {
4
+ as: import("react").ElementType<any> | undefined;
5
+ size: string;
6
+ weight: string;
7
+ textTransform: string;
8
+ textDecoration: string;
9
+ lineHeight: string;
10
+ defaultMargin: string;
11
+ } & TypographyProps, "as" | "textDecoration" | "size" | "weight" | "textTransform" | "lineHeight" | "defaultMargin">;
12
+ export default StyledTypography;