carbon-react 119.11.0 → 119.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Carbon [![npm](https://img.shields.io/npm/v/carbon-react.svg)](https://www.npmjs.com/package/carbon-react) [![Cypress](https://github.com/Sage/carbon/actions/workflows/cypress.yml/badge.svg)](https://github.com/Sage/carbon/actions/workflows/cypress.yml)
1
+ # Carbon [![npm](https://img.shields.io/npm/v/carbon-react.svg)](https://www.npmjs.com/package/carbon-react) [![Cypress](https://github.com/Sage/carbon/actions/workflows/cypress.yml/badge.svg)](https://github.com/Sage/carbon/actions/workflows/cypress.yml) [![Playwright](https://github.com/Sage/carbon/actions/workflows/playwright.yml/badge.svg)](https://github.com/Sage/carbon/actions/workflows/playwright.yml)
2
2
 
3
3
  Carbon is a [React](https://facebook.github.io/react/) component library developed by Sage.
4
4
 
@@ -37,8 +37,9 @@ const StyledMenuItemWrapper = styled.a.attrs({
37
37
  asDiv,
38
38
  hasInput
39
39
  }) => css`
40
- ${padding}
41
-
40
+ ${!inFullscreenView && css`
41
+ ${padding}
42
+ `}
42
43
  display: inline-block;
43
44
  font-size: 14px;
44
45
  font-weight: 700;
@@ -1,10 +1,10 @@
1
- import { FlexboxProps, LayoutProps } from "styled-system";
1
+ import { FlexboxProps, LayoutProps, PaddingProps } from "styled-system";
2
2
  import { MenuProps } from "./menu.component";
3
3
  interface StyledMenuProps extends Pick<MenuProps, "menuType">, FlexboxProps, LayoutProps {
4
4
  inFullscreenView?: boolean;
5
5
  }
6
6
  declare const StyledMenuWrapper: import("styled-components").StyledComponent<"ul", any, StyledMenuProps, never>;
7
- interface StyledMenuItemProps extends Pick<MenuProps, "menuType" | "maxWidth"> {
7
+ interface StyledMenuItemProps extends Pick<MenuProps, "menuType" | "maxWidth">, PaddingProps {
8
8
  inFullscreenView?: boolean;
9
9
  inSubmenu?: boolean;
10
10
  }
@@ -1,8 +1,9 @@
1
1
  import styled, { css } from "styled-components";
2
- import { layout, flexbox } from "styled-system";
2
+ import { layout, flexbox, padding } from "styled-system";
3
3
  import menuConfigVariants from "./menu.config";
4
4
  import { StyledVerticalWrapper, StyledDivider } from "../vertical-divider/vertical-divider.style";
5
5
  import { StyledLink } from "../link/link.style";
6
+ import { baseTheme } from "../../style/themes";
6
7
  const StyledMenuWrapper = styled.ul`
7
8
  line-height: 40px;
8
9
  list-style: none;
@@ -54,8 +55,9 @@ const StyledMenuItem = styled.li`
54
55
  ${({
55
56
  inFullscreenView
56
57
  }) => inFullscreenView && css`
57
- padding-top: 16px;
58
- padding-bottom: 16px;
58
+ padding-top: var(--spacing200);
59
+ padding-bottom: var(--spacing200);
60
+ ${padding}
59
61
 
60
62
  > a,
61
63
  ${StyledLink} > a,
@@ -69,4 +71,7 @@ const StyledMenuItem = styled.li`
69
71
  }
70
72
  `}
71
73
  `;
74
+ StyledMenuItem.defaultProps = {
75
+ theme: baseTheme
76
+ };
72
77
  export { StyledMenuWrapper, StyledMenuItem };
@@ -18,10 +18,10 @@ export interface PodProps extends MarginProps {
18
18
  size?: PodSize;
19
19
  /** Prop to apply a theme to the Pod */
20
20
  variant?: PodVariant;
21
- /** Title for the pod h4 element always shown */
22
- title?: string | React.ReactNode;
21
+ /** Title for the pod */
22
+ title?: React.ReactNode;
23
23
  /** Optional subtitle for the pod */
24
- subtitle?: string;
24
+ subtitle?: React.ReactNode;
25
25
  /** A component to render as a Pod footer */
26
26
  footer?: string | React.ReactNode;
27
27
  /** Supplies an edit action to the pod */
@@ -93,11 +93,11 @@ const Pod = /*#__PURE__*/React.forwardRef(({
93
93
  alignTitle: alignTitle,
94
94
  internalEditButton: internalEditButton,
95
95
  size: size
96
- }, /*#__PURE__*/React.createElement(StyledTitle, {
96
+ }, typeof title === "string" ? /*#__PURE__*/React.createElement(StyledTitle, {
97
97
  "data-element": "title"
98
- }, title), subtitle && /*#__PURE__*/React.createElement(StyledSubtitle, {
98
+ }, title) : title, typeof subtitle === "string" ? /*#__PURE__*/React.createElement(StyledSubtitle, {
99
99
  "data-element": "subtitle"
100
- }, subtitle)), children), footer && /*#__PURE__*/React.createElement(StyledFooter, {
100
+ }, subtitle) : subtitle), children), footer && /*#__PURE__*/React.createElement(StyledFooter, {
101
101
  "data-element": "footer",
102
102
  size: size,
103
103
  variant: variant,
@@ -324,7 +324,7 @@ Pod.propTypes = {
324
324
  "onUndo": PropTypes.func,
325
325
  "size": PropTypes.oneOf(["extra-large", "extra-small", "large", "medium", "small"]),
326
326
  "softDelete": PropTypes.bool,
327
- "subtitle": PropTypes.string,
327
+ "subtitle": PropTypes.node,
328
328
  "title": PropTypes.node,
329
329
  "triggerEditOnContent": PropTypes.bool,
330
330
  "variant": PropTypes.oneOf(["primary", "secondary", "tertiary", "tile", "transparent"])
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { ColorProps, SpaceProps } from "styled-system";
3
3
  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
- declare type VariantTypes = typeof VARIANT_TYPES[number];
4
+ export declare type VariantTypes = typeof VARIANT_TYPES[number];
5
5
  export interface TypographyProps extends SpaceProps, ColorProps {
6
6
  /** Override the variant component */
7
7
  as?: React.ElementType;
@@ -46,8 +46,9 @@ const StyledMenuItemWrapper = _styledComponents.default.a.attrs({
46
46
  asDiv,
47
47
  hasInput
48
48
  }) => (0, _styledComponents.css)`
49
- ${_styledSystem.padding}
50
-
49
+ ${!inFullscreenView && (0, _styledComponents.css)`
50
+ ${_styledSystem.padding}
51
+ `}
51
52
  display: inline-block;
52
53
  font-size: 14px;
53
54
  font-weight: 700;
@@ -1,10 +1,10 @@
1
- import { FlexboxProps, LayoutProps } from "styled-system";
1
+ import { FlexboxProps, LayoutProps, PaddingProps } from "styled-system";
2
2
  import { MenuProps } from "./menu.component";
3
3
  interface StyledMenuProps extends Pick<MenuProps, "menuType">, FlexboxProps, LayoutProps {
4
4
  inFullscreenView?: boolean;
5
5
  }
6
6
  declare const StyledMenuWrapper: import("styled-components").StyledComponent<"ul", any, StyledMenuProps, never>;
7
- interface StyledMenuItemProps extends Pick<MenuProps, "menuType" | "maxWidth"> {
7
+ interface StyledMenuItemProps extends Pick<MenuProps, "menuType" | "maxWidth">, PaddingProps {
8
8
  inFullscreenView?: boolean;
9
9
  inSubmenu?: boolean;
10
10
  }
@@ -9,6 +9,7 @@ var _styledSystem = require("styled-system");
9
9
  var _menu = _interopRequireDefault(require("./menu.config"));
10
10
  var _verticalDivider = require("../vertical-divider/vertical-divider.style");
11
11
  var _link = require("../link/link.style");
12
+ var _themes = require("../../style/themes");
12
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
14
  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
15
  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; }
@@ -64,8 +65,9 @@ const StyledMenuItem = _styledComponents.default.li`
64
65
  ${({
65
66
  inFullscreenView
66
67
  }) => inFullscreenView && (0, _styledComponents.css)`
67
- padding-top: 16px;
68
- padding-bottom: 16px;
68
+ padding-top: var(--spacing200);
69
+ padding-bottom: var(--spacing200);
70
+ ${_styledSystem.padding}
69
71
 
70
72
  > a,
71
73
  ${_link.StyledLink} > a,
@@ -79,4 +81,7 @@ const StyledMenuItem = _styledComponents.default.li`
79
81
  }
80
82
  `}
81
83
  `;
82
- exports.StyledMenuItem = StyledMenuItem;
84
+ exports.StyledMenuItem = StyledMenuItem;
85
+ StyledMenuItem.defaultProps = {
86
+ theme: _themes.baseTheme
87
+ };
@@ -18,10 +18,10 @@ export interface PodProps extends MarginProps {
18
18
  size?: PodSize;
19
19
  /** Prop to apply a theme to the Pod */
20
20
  variant?: PodVariant;
21
- /** Title for the pod h4 element always shown */
22
- title?: string | React.ReactNode;
21
+ /** Title for the pod */
22
+ title?: React.ReactNode;
23
23
  /** Optional subtitle for the pod */
24
- subtitle?: string;
24
+ subtitle?: React.ReactNode;
25
25
  /** A component to render as a Pod footer */
26
26
  footer?: string | React.ReactNode;
27
27
  /** Supplies an edit action to the pod */
@@ -102,11 +102,11 @@ const Pod = /*#__PURE__*/_react.default.forwardRef(({
102
102
  alignTitle: alignTitle,
103
103
  internalEditButton: internalEditButton,
104
104
  size: size
105
- }, /*#__PURE__*/_react.default.createElement(_pod.StyledTitle, {
105
+ }, typeof title === "string" ? /*#__PURE__*/_react.default.createElement(_pod.StyledTitle, {
106
106
  "data-element": "title"
107
- }, title), subtitle && /*#__PURE__*/_react.default.createElement(_pod.StyledSubtitle, {
107
+ }, title) : title, typeof subtitle === "string" ? /*#__PURE__*/_react.default.createElement(_pod.StyledSubtitle, {
108
108
  "data-element": "subtitle"
109
- }, subtitle)), children), footer && /*#__PURE__*/_react.default.createElement(_pod.StyledFooter, {
109
+ }, subtitle) : subtitle), children), footer && /*#__PURE__*/_react.default.createElement(_pod.StyledFooter, {
110
110
  "data-element": "footer",
111
111
  size: size,
112
112
  variant: variant,
@@ -333,7 +333,7 @@ Pod.propTypes = {
333
333
  "onUndo": _propTypes.default.func,
334
334
  "size": _propTypes.default.oneOf(["extra-large", "extra-small", "large", "medium", "small"]),
335
335
  "softDelete": _propTypes.default.bool,
336
- "subtitle": _propTypes.default.string,
336
+ "subtitle": _propTypes.default.node,
337
337
  "title": _propTypes.default.node,
338
338
  "triggerEditOnContent": _propTypes.default.bool,
339
339
  "variant": _propTypes.default.oneOf(["primary", "secondary", "tertiary", "tile", "transparent"])
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { ColorProps, SpaceProps } from "styled-system";
3
3
  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
- declare type VariantTypes = typeof VARIANT_TYPES[number];
4
+ export declare type VariantTypes = typeof VARIANT_TYPES[number];
5
5
  export interface TypographyProps extends SpaceProps, ColorProps {
6
6
  /** Override the variant component */
7
7
  as?: React.ElementType;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-react",
3
- "version": "119.11.0",
3
+ "version": "119.12.1",
4
4
  "description": "A library of reusable React components for easily building user interfaces.",
5
5
  "files": [
6
6
  "lib",
@@ -93,8 +93,8 @@
93
93
  "@testing-library/react-hooks": "^8.0.1",
94
94
  "@testing-library/user-event": "^14.4.3",
95
95
  "@types/crypto-js": "^4.1.1",
96
- "@types/enzyme": "3.10.8",
97
96
  "@types/draft-js": "^0.11.10",
97
+ "@types/enzyme": "3.10.8",
98
98
  "@types/invariant": "^2.2.35",
99
99
  "@types/jest": "^27.5.0",
100
100
  "@types/lodash": "^4.14.194",
@@ -124,8 +124,10 @@
124
124
  "cypress": "^12.12.0",
125
125
  "cypress-axe": "^1.4.0",
126
126
  "cypress-each": "^1.13.3",
127
+ "cypress-mochawesome-reporter": "^3.5.1",
127
128
  "cypress-plugin-tab": "^1.0.5",
128
129
  "cypress-real-events": "^1.7.6",
130
+ "cypress-split": "^1.3.13",
129
131
  "cz-conventional-changelog": "^3.3.0",
130
132
  "date-fns-tz": "^1.3.8",
131
133
  "draft-js": "^0.11.7",