carbon-react 144.15.0 → 144.17.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 (53) hide show
  1. package/esm/components/button/button.component.js +6 -0
  2. package/esm/components/button-toggle/button-toggle-group/button-toggle-group.component.js +6 -0
  3. package/esm/components/detail/detail.component.js +21 -13
  4. package/esm/components/dialog/dialog.component.js +6 -0
  5. package/esm/components/help/help.component.js +6 -0
  6. package/esm/components/inline-inputs/inline-inputs.component.js +6 -0
  7. package/esm/components/link/link.component.js +6 -0
  8. package/esm/components/menu/menu-item/menu-item.component.d.ts +1 -4
  9. package/esm/components/menu/menu-item/menu-item.component.js +14 -1
  10. package/esm/components/menu/menu-segment-title/menu-segment-title.component.js +16 -4
  11. package/esm/components/menu/menu-segment-title/menu-segment-title.context.d.ts +7 -0
  12. package/esm/components/menu/menu-segment-title/menu-segment-title.context.js +6 -0
  13. package/esm/components/menu/menu-segment-title/menu-segment-title.style.d.ts +4 -1
  14. package/esm/components/menu/menu-segment-title/menu-segment-title.style.js +17 -9
  15. package/esm/components/message/message.component.js +6 -0
  16. package/esm/components/modal/modal.component.js +6 -0
  17. package/esm/components/pod/pod.component.js +6 -0
  18. package/esm/components/portal/portal.js +6 -0
  19. package/esm/components/profile/profile.component.js +6 -0
  20. package/esm/components/settings-row/settings-row.component.js +6 -0
  21. package/esm/components/simple-color-picker/simple-color/simple-color.component.js +6 -0
  22. package/esm/components/tabs/tab/tab.component.js +6 -0
  23. package/esm/components/tabs/tabs.component.js +6 -0
  24. package/esm/components/tile-select/tile-select.component.js +6 -0
  25. package/esm/components/toast/toast.component.js +6 -0
  26. package/esm/components/typography/typography.component.js +6 -0
  27. package/lib/components/button/button.component.js +6 -0
  28. package/lib/components/button-toggle/button-toggle-group/button-toggle-group.component.js +6 -0
  29. package/lib/components/detail/detail.component.js +21 -13
  30. package/lib/components/dialog/dialog.component.js +6 -0
  31. package/lib/components/help/help.component.js +6 -0
  32. package/lib/components/inline-inputs/inline-inputs.component.js +6 -0
  33. package/lib/components/link/link.component.js +6 -0
  34. package/lib/components/menu/menu-item/menu-item.component.d.ts +1 -4
  35. package/lib/components/menu/menu-item/menu-item.component.js +14 -1
  36. package/lib/components/menu/menu-segment-title/menu-segment-title.component.js +15 -3
  37. package/lib/components/menu/menu-segment-title/menu-segment-title.context.d.ts +7 -0
  38. package/lib/components/menu/menu-segment-title/menu-segment-title.context.js +13 -0
  39. package/lib/components/menu/menu-segment-title/menu-segment-title.style.d.ts +4 -1
  40. package/lib/components/menu/menu-segment-title/menu-segment-title.style.js +17 -9
  41. package/lib/components/message/message.component.js +6 -0
  42. package/lib/components/modal/modal.component.js +6 -0
  43. package/lib/components/pod/pod.component.js +6 -0
  44. package/lib/components/portal/portal.js +6 -0
  45. package/lib/components/profile/profile.component.js +6 -0
  46. package/lib/components/settings-row/settings-row.component.js +6 -0
  47. package/lib/components/simple-color-picker/simple-color/simple-color.component.js +6 -0
  48. package/lib/components/tabs/tab/tab.component.js +6 -0
  49. package/lib/components/tabs/tabs.component.js +6 -0
  50. package/lib/components/tile-select/tile-select.component.js +6 -0
  51. package/lib/components/toast/toast.component.js +6 -0
  52. package/lib/components/typography/typography.component.js +6 -0
  53. package/package.json +1 -1
@@ -9,6 +9,8 @@ import { TooltipProvider } from "../../__internal__/tooltip-provider";
9
9
  import ButtonBarContext from "../button-bar/__internal__/button-bar.context";
10
10
  import SplitButtonContext from "../split-button/__internal__/split-button.context";
11
11
  import BatchSelectionContext from "../batch-selection/__internal__/batch-selection.context";
12
+ import Logger from "../../__internal__/utils/logger";
13
+ let deprecatedClassNameWarningShown = false;
12
14
  function renderChildren({
13
15
  /* eslint-disable react/prop-types */
14
16
  iconType,
@@ -82,6 +84,10 @@ const Button = /*#__PURE__*/React.forwardRef(({
82
84
  target,
83
85
  ...rest
84
86
  }, ref) => {
87
+ if (!deprecatedClassNameWarningShown && rest.className) {
88
+ Logger.deprecate("The 'className' prop has been deprecated and will soon be removed from the 'Button' component.");
89
+ deprecatedClassNameWarningShown = true;
90
+ }
85
91
  const {
86
92
  buttonType: buttonTypeContext,
87
93
  size: sizeContext,
@@ -12,7 +12,9 @@ import { InputGroupBehaviour } from "../../../__internal__/input-behaviour";
12
12
  import Events from "../../../__internal__/utils/helpers/events";
13
13
  import NewValidationContext from "../../carbon-provider/__internal__/new-validation.context";
14
14
  import ButtonToggleGroupContext from "./__internal__/button-toggle-group.context";
15
+ import Logger from "../../../__internal__/utils/logger";
15
16
  const BUTTON_TOGGLE_SELECTOR = '[data-element="button-toggle-button"]';
17
+ let deprecatedClassNameWarningShown = false;
16
18
  const ButtonToggleGroup = ({
17
19
  children,
18
20
  fieldHelp,
@@ -38,6 +40,10 @@ const ButtonToggleGroup = ({
38
40
  className,
39
41
  ...props
40
42
  }) => {
43
+ if (!deprecatedClassNameWarningShown && className) {
44
+ Logger.deprecate("The 'className' prop has been deprecated and will soon be removed from the 'ButtonToggleGroup' component.");
45
+ deprecatedClassNameWarningShown = true;
46
+ }
41
47
  const hasCorrectItemStructure = useMemo(() => {
42
48
  const incorrectChild = React.Children.toArray(children).find(child => {
43
49
  return ! /*#__PURE__*/React.isValidElement(child) || child.type.displayName !== ButtonToggle.displayName;
@@ -4,24 +4,32 @@ import PropTypes from "prop-types";
4
4
  import { filterStyledSystemMarginProps } from "../../style/utils";
5
5
  import tagComponent from "../../__internal__/utils/helpers/tags/tags";
6
6
  import { StyledDetail, StyledDetailContent, StyledDetailIcon, StyledDetailFootnote } from "./detail.style";
7
+ import Logger from "../../__internal__/utils/logger";
8
+ let deprecatedClassNameWarningShown = false;
7
9
  export const Detail = ({
8
10
  className,
9
11
  icon,
10
12
  footnote,
11
13
  children,
12
14
  ...rest
13
- }) => /*#__PURE__*/React.createElement(StyledDetail, _extends({
14
- className: `carbon-detail ${className}`
15
- }, tagComponent("detail", rest), filterStyledSystemMarginProps(rest)), icon && /*#__PURE__*/React.createElement(StyledDetailIcon, {
16
- type: icon,
17
- "data-element": "icon"
18
- }), /*#__PURE__*/React.createElement(StyledDetailContent, {
19
- "data-element": "detail-content",
20
- hasIcon: !!icon
21
- }, children), footnote && /*#__PURE__*/React.createElement(StyledDetailFootnote, {
22
- "data-element": "footnote",
23
- "data-role": "footnote",
24
- hasIcon: !!icon
25
- }, footnote));
15
+ }) => {
16
+ if (!deprecatedClassNameWarningShown && className) {
17
+ Logger.deprecate("The 'className' prop has been deprecated and will soon be removed from the 'Detail' component.");
18
+ deprecatedClassNameWarningShown = true;
19
+ }
20
+ return /*#__PURE__*/React.createElement(StyledDetail, _extends({
21
+ className: `carbon-detail ${className}`
22
+ }, tagComponent("detail", rest), filterStyledSystemMarginProps(rest)), icon && /*#__PURE__*/React.createElement(StyledDetailIcon, {
23
+ type: icon,
24
+ "data-element": "icon"
25
+ }), /*#__PURE__*/React.createElement(StyledDetailContent, {
26
+ "data-element": "detail-content",
27
+ hasIcon: !!icon
28
+ }, children), footnote && /*#__PURE__*/React.createElement(StyledDetailFootnote, {
29
+ "data-element": "footnote",
30
+ "data-role": "footnote",
31
+ hasIcon: !!icon
32
+ }, footnote));
33
+ };
26
34
  Detail.displayName = "Detail";
27
35
  export default Detail;
@@ -5,6 +5,7 @@ import createGuid from "../../__internal__/utils/helpers/guid";
5
5
  import Modal from "../modal";
6
6
  import Heading from "../heading";
7
7
  import tagComponent from "../../__internal__/utils/helpers/tags";
8
+ import Logger from "../../__internal__/utils/logger";
8
9
  import { StyledDialog, StyledDialogTitle, StyledDialogContent, DialogPositioner } from "./dialog.style";
9
10
  import FocusTrap from "../../__internal__/focus-trap";
10
11
  import IconButton from "../icon-button";
@@ -12,6 +13,7 @@ import Icon from "../icon";
12
13
  import useLocale from "../../hooks/__internal__/useLocale";
13
14
  import useModalAria from "../../hooks/__internal__/useModalAria/useModalAria";
14
15
  const PADDING_VALUES = [0, 1, 2, 3, 4, 5, 6, 7, 8];
16
+ let deprecatedClassNameWarningShown = false;
15
17
  const Dialog = /*#__PURE__*/forwardRef(({
16
18
  className,
17
19
  "data-component": dataComponent = "dialog",
@@ -40,6 +42,10 @@ const Dialog = /*#__PURE__*/forwardRef(({
40
42
  closeButtonDataProps,
41
43
  ...rest
42
44
  }, ref) => {
45
+ if (!deprecatedClassNameWarningShown && className) {
46
+ Logger.deprecate("The 'className' prop has been deprecated and will soon be removed from the 'Dialog' component.");
47
+ deprecatedClassNameWarningShown = true;
48
+ }
43
49
  const locale = useLocale();
44
50
  const containerRef = useRef(null);
45
51
  const titleRef = useRef(null);
@@ -8,6 +8,8 @@ import Events from "../../__internal__/utils/helpers/events";
8
8
  import { TooltipContext } from "../../__internal__/tooltip-provider";
9
9
  import { filterStyledSystemMarginProps } from "../../style/utils";
10
10
  import guid from "../../__internal__/utils/helpers/guid";
11
+ import Logger from "../../__internal__/utils/logger";
12
+ let deprecatedClassNameWarningShown = false;
11
13
  const Help = ({
12
14
  as,
13
15
  ariaLabel = "help",
@@ -25,6 +27,10 @@ const Help = ({
25
27
  type = "help",
26
28
  ...rest
27
29
  }) => {
30
+ if (!deprecatedClassNameWarningShown && className) {
31
+ Logger.deprecate("The 'className' prop has been deprecated and will soon be removed from the 'Help' component.");
32
+ deprecatedClassNameWarningShown = true;
33
+ }
28
34
  const defaultTooltipId = useRef(guid());
29
35
  const helpElement = useRef(null);
30
36
  const [isTooltipVisible, updateTooltipVisible] = useState(false);
@@ -6,6 +6,8 @@ import StyledInlineInputs, { StyledContentContainer, StyledInlineInput } from ".
6
6
  import FormSpacingProvider from "../../__internal__/form-spacing-provider";
7
7
  import useIsAboveBreakpoint from "../../hooks/__internal__/useIsAboveBreakpoint";
8
8
  import useFormSpacing from "../../hooks/__internal__/useFormSpacing";
9
+ import Logger from "../../__internal__/utils/logger";
10
+ let deprecatedClassNameWarningShown = false;
9
11
  const columnWrapper = (children, gutter) => {
10
12
  return React.Children.map(children, input => {
11
13
  return /*#__PURE__*/React.createElement(StyledInlineInput, {
@@ -30,6 +32,10 @@ const InlineInputs = ({
30
32
  isOptional,
31
33
  ...rest
32
34
  }) => {
35
+ if (!deprecatedClassNameWarningShown && className) {
36
+ Logger.deprecate("The 'className' prop has been deprecated and will soon be removed from the 'InlineInputs' component.");
37
+ deprecatedClassNameWarningShown = true;
38
+ }
33
39
  const largeScreen = useIsAboveBreakpoint(adaptiveLabelBreakpoint);
34
40
  const ref = useRef(null);
35
41
  let inlineLabel = labelInline;
@@ -7,6 +7,8 @@ import { StyledLink, StyledContent } from "./link.style";
7
7
  import tagComponent from "../../__internal__/utils/helpers/tags/tags";
8
8
  import useLocale from "../../hooks/__internal__/useLocale";
9
9
  import BatchSelectionContext from "../batch-selection/__internal__/batch-selection.context";
10
+ import Logger from "../../__internal__/utils/logger";
11
+ let deprecatedClassNameWarningShown = false;
10
12
  const Link = /*#__PURE__*/React.forwardRef(({
11
13
  children,
12
14
  className,
@@ -29,6 +31,10 @@ const Link = /*#__PURE__*/React.forwardRef(({
29
31
  removeAriaLabelOnIcon,
30
32
  ...rest
31
33
  }, ref) => {
34
+ if (!deprecatedClassNameWarningShown && className) {
35
+ Logger.deprecate("The 'className' prop has been deprecated and will soon be removed from the 'Link' component.");
36
+ deprecatedClassNameWarningShown = true;
37
+ }
32
38
  const [hasFocus, setHasFocus] = useState(false);
33
39
  const l = useLocale();
34
40
  const {
@@ -63,8 +63,5 @@ export interface MenuWithIcon extends MenuItemBaseProps {
63
63
  icon: IconType;
64
64
  children?: React.ReactNode;
65
65
  }
66
- export declare const MenuItem: {
67
- ({ submenu, submenuMaxWidth, children, href, onClick, target, submenuDirection, icon, selected, onKeyDown, variant, showDropdownArrow, ariaLabel, clickToOpen, maxWidth, onSubmenuOpen, onSubmenuClose, overrideColor, rel, as, "data-element": dataElement, "data-role": dataRole, ...rest }: MenuWithChildren | MenuWithIcon): React.JSX.Element;
68
- displayName: string;
69
- };
66
+ export declare const MenuItem: ({ submenu, submenuMaxWidth, children, href, onClick, target, submenuDirection, icon, selected, onKeyDown, variant, showDropdownArrow, ariaLabel, clickToOpen, maxWidth, onSubmenuOpen, onSubmenuClose, overrideColor, rel, as, "data-element": dataElement, "data-role": dataRole, ...rest }: MenuWithChildren | MenuWithIcon) => React.JSX.Element;
70
67
  export default MenuItem;
@@ -8,8 +8,11 @@ import Events from "../../../__internal__/utils/helpers/events";
8
8
  import MenuContext from "../__internal__/menu.context";
9
9
  import Submenu from "../__internal__/submenu/submenu.component";
10
10
  import SubmenuContext from "../__internal__/submenu/submenu.context";
11
+ import MenuSegmentContext from "../menu-segment-title/menu-segment-title.context";
11
12
  import { StyledMenuItem } from "../menu.style";
12
13
  import guid from "../../../__internal__/utils/helpers/guid";
14
+ import Logger from "../../../__internal__/utils/logger";
15
+ let deprecatedClassNameWarningShown = false;
13
16
  export const MenuItem = ({
14
17
  submenu,
15
18
  submenuMaxWidth,
@@ -35,9 +38,17 @@ export const MenuItem = ({
35
38
  "data-role": dataRole,
36
39
  ...rest
37
40
  }) => {
41
+ if (!deprecatedClassNameWarningShown && rest.className) {
42
+ Logger.deprecate("The 'className' prop has been deprecated and will soon be removed from the 'MenuItem' component.");
43
+ deprecatedClassNameWarningShown = true;
44
+ }
38
45
  !(icon || children) ? process.env.NODE_ENV !== "production" ? invariant(false, "Either prop `icon` must be defined or this node must have `children`.") : invariant(false) : void 0;
39
46
  !(children || ariaLabel || typeof submenu === "string") ? process.env.NODE_ENV !== "production" ? invariant(false, "If no text is provided an `ariaLabel` should be given to facilitate accessibility.") : invariant(false) : void 0;
40
47
  !(typeof submenu === "boolean" || submenu === undefined || children && typeof submenu === "string" && submenu.length) ? process.env.NODE_ENV !== "production" ? invariant(false, "You should not pass `children` when `submenu` is an empty string") : invariant(false) : void 0;
48
+ const {
49
+ isChildOfSegment,
50
+ overriddenVariant
51
+ } = useContext(MenuSegmentContext);
41
52
  const {
42
53
  inFullscreenView,
43
54
  registerItem,
@@ -124,6 +135,9 @@ export const MenuItem = ({
124
135
  overrideColor,
125
136
  ref
126
137
  };
138
+ if (overriddenVariant === "alternate" && isChildOfSegment && variant === "alternate" && ["white", "black"].includes(menuType)) {
139
+ elementProps.overrideColor = true;
140
+ }
127
141
  const getTitle = title => maxWidth && typeof title === "string" ? title : undefined;
128
142
  const itemMaxWidth = !inFullscreenView ? maxWidth : undefined;
129
143
  const asPassiveItem = !(onClick || href);
@@ -187,5 +201,4 @@ export const MenuItem = ({
187
201
  inSubmenu: !!handleSubmenuKeyDown
188
202
  }), children));
189
203
  };
190
- MenuItem.displayName = "MenuItem";
191
204
  export default MenuItem;
@@ -1,11 +1,12 @@
1
1
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
- import React, { useContext } from "react";
2
+ import React, { useContext, useMemo } from "react";
3
3
  import PropTypes from "prop-types";
4
4
  import { StyledTitle, StyledSegmentChildren } from "./menu-segment-title.style";
5
5
  import MenuContext from "../__internal__/menu.context";
6
6
  import { StyledMenuItem } from "../menu.style";
7
7
  import tagComponent from "../../../__internal__/utils/helpers/tags";
8
8
  import SubmenuContext from "../__internal__/submenu/submenu.context";
9
+ import MenuSegmentContext from "./menu-segment-title.context";
9
10
  const AS_VALUES = ["h2", "h3", "h4", "h5", "h6"];
10
11
  const MenuSegmentTitle = /*#__PURE__*/React.forwardRef(({
11
12
  children,
@@ -18,6 +19,10 @@ const MenuSegmentTitle = /*#__PURE__*/React.forwardRef(({
18
19
  const {
19
20
  submenuHasMaxWidth
20
21
  } = useContext(SubmenuContext);
22
+ const isChildOfFullscreenMenu = menuContext?.inFullscreenView || false;
23
+ const overriddenVariant = useMemo(() => {
24
+ return isChildOfFullscreenMenu && variant === "alternate" && ["white", "black"].includes(menuContext.menuType) ? "default" : variant;
25
+ }, [isChildOfFullscreenMenu, menuContext.menuType, variant]);
21
26
  return /*#__PURE__*/React.createElement(StyledMenuItem, {
22
27
  inSubmenu: true
23
28
  }, /*#__PURE__*/React.createElement(StyledTitle, _extends({
@@ -25,11 +30,18 @@ const MenuSegmentTitle = /*#__PURE__*/React.forwardRef(({
25
30
  }, tagComponent("menu-segment-title", rest), {
26
31
  menuType: menuContext.menuType,
27
32
  ref: ref,
28
- variant: variant,
33
+ variant: overriddenVariant,
29
34
  shouldWrap: submenuHasMaxWidth
30
35
  }), text), children && /*#__PURE__*/React.createElement(StyledSegmentChildren, {
31
- "data-role": "menu-segment-children"
32
- }, children));
36
+ "data-role": "menu-segment-children",
37
+ menuType: menuContext.menuType,
38
+ variant: overriddenVariant
39
+ }, /*#__PURE__*/React.createElement(MenuSegmentContext.Provider, {
40
+ value: {
41
+ isChildOfSegment: true,
42
+ overriddenVariant
43
+ }
44
+ }, children)));
33
45
  });
34
46
  if (process.env.NODE_ENV !== "production") {
35
47
  MenuSegmentTitle.propTypes = {
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ export interface MenuSegmentContextProps {
3
+ isChildOfSegment: boolean;
4
+ overriddenVariant: string;
5
+ }
6
+ export declare const MenuSegmentContext: React.Context<MenuSegmentContextProps>;
7
+ export default MenuSegmentContext;
@@ -0,0 +1,6 @@
1
+ import React from "react";
2
+ export const MenuSegmentContext = /*#__PURE__*/React.createContext({
3
+ isChildOfSegment: false,
4
+ overriddenVariant: "default"
5
+ });
6
+ export default MenuSegmentContext;
@@ -6,5 +6,8 @@ interface StyledTitleProps {
6
6
  shouldWrap?: boolean;
7
7
  }
8
8
  declare const StyledTitle: import("styled-components").StyledComponent<"h2", any, StyledTitleProps, never>;
9
- declare const StyledSegmentChildren: import("styled-components").StyledComponent<"ul", any, {}, never>;
9
+ declare const StyledSegmentChildren: import("styled-components").StyledComponent<"ul", any, {
10
+ variant?: VariantType | undefined;
11
+ menuType: MenuType;
12
+ }, never>;
10
13
  export { StyledTitle, StyledSegmentChildren };
@@ -19,17 +19,25 @@ const StyledTitle = styled.h2`
19
19
  `}
20
20
  `;
21
21
  const StyledSegmentChildren = styled.ul`
22
- padding: 0;
22
+ ${({
23
+ menuType,
24
+ variant
25
+ }) => css`
26
+ padding: 0;
23
27
 
24
- li {
25
- list-style: none;
28
+ li {
29
+ list-style: none;
30
+ ${variant === "alternate" && css`
31
+ background-color: ${menuConfigVariants[menuType].alternate};
32
+ `}
26
33
 
27
- &:not(&:last-child) a,
28
- &:not(&:last-child) button,
29
- &:not(&:last-child) > span,
30
- &:not(&:last-child) > div {
31
- border-radius: var(--borderRadius000);
34
+ &:not(&:last-child) a,
35
+ &:not(&:last-child) button,
36
+ &:not(&:last-child) > span,
37
+ &:not(&:last-child) > div {
38
+ border-radius: var(--borderRadius000);
39
+ }
32
40
  }
33
- }
41
+ `}
34
42
  `;
35
43
  export { StyledTitle, StyledSegmentChildren };
@@ -10,6 +10,8 @@ import Icon from "../icon";
10
10
  import IconButton from "../icon-button";
11
11
  import { filterStyledSystemMarginProps } from "../../style/utils";
12
12
  import useLocale from "../../hooks/__internal__/useLocale";
13
+ import Logger from "../../__internal__/utils/logger";
14
+ let deprecatedClassNameWarningShown = false;
13
15
  const Message = /*#__PURE__*/React.forwardRef(({
14
16
  open = true,
15
17
  transparent = false,
@@ -23,6 +25,10 @@ const Message = /*#__PURE__*/React.forwardRef(({
23
25
  showCloseIcon = true,
24
26
  ...props
25
27
  }, ref) => {
28
+ if (!deprecatedClassNameWarningShown && className) {
29
+ Logger.deprecate("The 'className' prop has been deprecated and will soon be removed from the 'Message' component.");
30
+ deprecatedClassNameWarningShown = true;
31
+ }
26
32
  const messageRef = useRef(null);
27
33
  const refToPass = ref || messageRef;
28
34
  const marginProps = filterStyledSystemMarginProps(props);
@@ -8,6 +8,8 @@ import Events from "../../__internal__/utils/helpers/events";
8
8
  import useModalManager from "../../hooks/__internal__/useModalManager";
9
9
  import { StyledModal, StyledModalBackground } from "./modal.style";
10
10
  import ModalContext from "./__internal__/modal.context";
11
+ import Logger from "../../__internal__/utils/logger";
12
+ let deprecatedClassNameWarningShown = false;
11
13
  const Modal = ({
12
14
  children,
13
15
  "data-element": dataElement,
@@ -21,6 +23,10 @@ const Modal = ({
21
23
  topModalOverride,
22
24
  ...rest
23
25
  }) => {
26
+ if (!deprecatedClassNameWarningShown && rest.className) {
27
+ Logger.deprecate("The 'className' prop has been deprecated and will soon be removed from the 'Modal' component.");
28
+ deprecatedClassNameWarningShown = true;
29
+ }
24
30
  const ref = useRef(null);
25
31
  const backgroundNodeRef = useRef(null);
26
32
  const contentNodeRef = useRef(null);
@@ -2,9 +2,11 @@ function _extends() { return _extends = Object.assign ? Object.assign.bind() : f
2
2
  import React, { useState, useMemo } from "react";
3
3
  import PropTypes from "prop-types";
4
4
  import useLocale from "../../hooks/__internal__/useLocale";
5
+ import Logger from "../../__internal__/utils/logger";
5
6
  import { StyledBlock, StyledContent, StyledEditAction, StyledActionsContainer, StyledDeleteButton, StyledUndoButton, StyledFooter, StyledPod, StyledHeader, StyledSubtitle, StyledTitle } from "./pod.style";
6
7
  import Icon from "../icon";
7
8
  import Event from "../../__internal__/utils/helpers/events";
9
+ let deprecatedClassNameWarningShown = false;
8
10
  const Pod = /*#__PURE__*/React.forwardRef(({
9
11
  "data-element": dataElement,
10
12
  "data-role": dataRole,
@@ -28,6 +30,10 @@ const Pod = /*#__PURE__*/React.forwardRef(({
28
30
  variant = "primary",
29
31
  ...rest
30
32
  }, ref) => {
33
+ if (!deprecatedClassNameWarningShown && className) {
34
+ Logger.deprecate("The 'className' prop has been deprecated and will soon be removed from the 'Pod' component.");
35
+ deprecatedClassNameWarningShown = true;
36
+ }
31
37
  const [isEditFocused, setEditFocused] = useState(false);
32
38
  const [isEditHovered, setEditHovered] = useState(false);
33
39
  const [isDeleteFocused, setDeleteFocused] = useState(false);
@@ -5,6 +5,8 @@ import guid from "../../__internal__/utils/helpers/guid";
5
5
  import CarbonScopedTokensProvider from "../../style/design-tokens/carbon-scoped-tokens-provider/carbon-scoped-tokens-provider.component";
6
6
  import StyledPortalEntrance from "./portal.style";
7
7
  import PortalContext from "./__internal__/portal.context";
8
+ import Logger from "../../__internal__/utils/logger";
9
+ let deprecatedClassNameWarningShown = false;
8
10
  const Container = styled.div`
9
11
  ${({
10
12
  theme
@@ -22,6 +24,10 @@ export const Portal = ({
22
24
  onReposition,
23
25
  inertOptOut
24
26
  }) => {
27
+ if (!deprecatedClassNameWarningShown && className) {
28
+ Logger.deprecate("The 'className' prop has been deprecated and will soon be removed from the 'Portal' component.");
29
+ deprecatedClassNameWarningShown = true;
30
+ }
25
31
  const [portalNode, setPortalNode] = useState(null);
26
32
  const uniqueId = useMemo(() => guid(), []);
27
33
  const {
@@ -4,6 +4,8 @@ import PropTypes from "prop-types";
4
4
  import tagComponent from "../../__internal__/utils/helpers/tags/tags";
5
5
  import { ProfileStyle, ProfileNameStyle, ProfileDetailsStyle, ProfileAvatarStyle, ProfileEmailStyle, ProfileTextStyle } from "./profile.style";
6
6
  import { filterStyledSystemMarginProps } from "../../style/utils";
7
+ import Logger from "../../__internal__/utils/logger";
8
+ let deprecatedClassNameWarningShown = false;
7
9
  function acronymize(str) {
8
10
  if (!str) return "";
9
11
  const matches = str.match(/\b\w/g);
@@ -23,6 +25,10 @@ export const Profile = ({
23
25
  darkBackground,
24
26
  ...props
25
27
  }) => {
28
+ if (!deprecatedClassNameWarningShown && className) {
29
+ Logger.deprecate("The 'className' prop has been deprecated and will soon be removed from the 'Profile' component.");
30
+ deprecatedClassNameWarningShown = true;
31
+ }
26
32
  const getInitials = () => {
27
33
  if (initials) return initials;
28
34
  return acronymize(name).slice(0, 3).toUpperCase();
@@ -4,7 +4,9 @@ import PropTypes from "prop-types";
4
4
  import Heading from "../heading";
5
5
  import tagComponent from "../../__internal__/utils/helpers/tags/tags";
6
6
  import { filterStyledSystemMarginProps } from "../../style/utils";
7
+ import Logger from "../../__internal__/utils/logger";
7
8
  import { StyledSettingsRow, StyledSettingsRowHeader, StyledSettingsRowInput } from "./settings-row.style";
9
+ let deprecatedClassNameWarningShown = false;
8
10
  export const SettingsRow = ({
9
11
  title,
10
12
  headingType = "h3",
@@ -14,6 +16,10 @@ export const SettingsRow = ({
14
16
  className,
15
17
  ...rest
16
18
  }) => {
19
+ if (!deprecatedClassNameWarningShown && className) {
20
+ Logger.deprecate("The 'className' prop has been deprecated and will soon be removed from the 'SettingsRow' component.");
21
+ deprecatedClassNameWarningShown = true;
22
+ }
17
23
  const heading = () => {
18
24
  if (!title) return null;
19
25
  return /*#__PURE__*/React.createElement(Heading, {
@@ -4,7 +4,13 @@ import PropTypes from "prop-types";
4
4
  import guid from "../../../__internal__/utils/helpers/guid";
5
5
  import tagComponent from "../../../__internal__/utils/helpers/tags/tags";
6
6
  import { StyledSimpleColor, StyledColorSampleBox, StyledTickIcon, StyledSimpleColorInput } from "./simple-color.style";
7
+ import Logger from "../../../__internal__/utils/logger";
8
+ let deprecatedClassNameWarningShown = false;
7
9
  const SimpleColor = /*#__PURE__*/React.forwardRef((props, ref) => {
10
+ if (!deprecatedClassNameWarningShown && props.className) {
11
+ Logger.deprecate("The 'className' prop has been deprecated and will soon be removed from the 'SimpleColor' component.");
12
+ deprecatedClassNameWarningShown = true;
13
+ }
8
14
  const {
9
15
  onChange,
10
16
  onBlur,
@@ -4,6 +4,8 @@ import PropTypes from "prop-types";
4
4
  import StyledTab from "./tab.style";
5
5
  import tagComponent from "../../../__internal__/utils/helpers/tags/tags";
6
6
  import TabContext from "./__internal__/tab.context";
7
+ import Logger from "../../../__internal__/utils/logger";
8
+ let deprecatedClassNameWarningShown = false;
7
9
  export const Tab = ({
8
10
  ariaLabelledby,
9
11
  className,
@@ -24,6 +26,10 @@ export const Tab = ({
24
26
  titleProps,
25
27
  ...rest
26
28
  }) => {
29
+ if (!deprecatedClassNameWarningShown && className) {
30
+ Logger.deprecate("The 'className' prop has been deprecated and will soon be removed from the 'Tab' component.");
31
+ deprecatedClassNameWarningShown = true;
32
+ }
27
33
  const [tabErrors, setTabErrors] = useState({});
28
34
  const [tabWarnings, setTabWarnings] = useState({});
29
35
  const [tabInfos, setTabInfos] = useState({});
@@ -8,6 +8,8 @@ import StyledTabs from "./tabs.style";
8
8
  import TabsHeader from "./__internal__/tabs-header";
9
9
  import TabTitle from "./__internal__/tab-title";
10
10
  import DrawerSidebarContext from "../drawer/__internal__/drawer-sidebar.context";
11
+ import Logger from "../../__internal__/utils/logger";
12
+ let deprecatedClassNameWarningShown = false;
11
13
  const Tabs = ({
12
14
  align = "left",
13
15
  className,
@@ -25,6 +27,10 @@ const Tabs = ({
25
27
  showValidationsSummary,
26
28
  ...rest
27
29
  }) => {
30
+ if (!deprecatedClassNameWarningShown && className) {
31
+ Logger.deprecate("The 'className' prop has been deprecated and will soon be removed from the 'Tabs' component.");
32
+ deprecatedClassNameWarningShown = true;
33
+ }
28
34
  if (position !== "left" && headerWidth !== undefined) {
29
35
  // eslint-disable-next-line no-console
30
36
  console.error("Invalid usage of prop headerWidth in Tabs. The headerWidth can be used only if position is set to left");
@@ -7,8 +7,10 @@ import createGuid from "../../__internal__/utils/helpers/guid";
7
7
  import Button from "../button";
8
8
  import Box from "../box";
9
9
  import Accordion from "./__internal__/accordion";
10
+ import Logger from "../../__internal__/utils/logger";
10
11
  import { StyledTileSelectContainer, StyledTileSelect, StyledTileSelectInput, StyledTitleContainer, StyledTitle, StyledSubtitle, StyledAdornment, StyledDescription, StyledDeselectWrapper, StyledFooterWrapper, StyledFocusWrapper, StyledAccordionFooterWrapper } from "./tile-select.style";
11
12
  import { filterStyledSystemMarginProps } from "../../style/utils";
13
+ let deprecatedClassNameWarningShown = false;
12
14
  const checkPropTypeIsNode = prop => typeof prop !== "string";
13
15
  const TileSelect = /*#__PURE__*/React.forwardRef(({
14
16
  onChange,
@@ -35,6 +37,10 @@ const TileSelect = /*#__PURE__*/React.forwardRef(({
35
37
  accordionExpanded,
36
38
  ...rest
37
39
  }, ref) => {
40
+ if (!deprecatedClassNameWarningShown && className) {
41
+ Logger.deprecate("The 'className' prop has been deprecated and will soon be removed from the 'TileSelect' component.");
42
+ deprecatedClassNameWarningShown = true;
43
+ }
38
44
  const l = useLocale();
39
45
  const [hasFocus, setHasFocus] = useState(false);
40
46
  const handleDeselect = () => onChange?.({
@@ -2,6 +2,7 @@ function _extends() { return _extends = Object.assign ? Object.assign.bind() : f
2
2
  import React, { useCallback, useEffect, useRef, useState } from "react";
3
3
  import PropTypes from "prop-types";
4
4
  import { TransitionGroup, CSSTransition } from "react-transition-group";
5
+ import Logger from "../../__internal__/utils/logger";
5
6
  import Icon from "../icon";
6
7
  import tagComponent from "../../__internal__/utils/helpers/tags/tags";
7
8
  import { StyledToast, TypeIcon, StyledToastContent, ToastWrapper, StyledPortal } from "./toast.style";
@@ -11,6 +12,7 @@ import useLocale from "../../hooks/__internal__/useLocale";
11
12
  import useModalManager from "../../hooks/__internal__/useModalManager";
12
13
  import guid from "../../__internal__/utils/helpers/guid";
13
14
  import Typography from "../typography";
15
+ let deprecatedClassNameWarningShown = false;
14
16
  const Toast = /*#__PURE__*/React.forwardRef(({
15
17
  align = "center",
16
18
  alignY,
@@ -27,6 +29,10 @@ const Toast = /*#__PURE__*/React.forwardRef(({
27
29
  closeButtonDataProps,
28
30
  ...restProps
29
31
  }, ref) => {
32
+ if (!deprecatedClassNameWarningShown && className) {
33
+ Logger.deprecate("The 'className' prop has been deprecated and will soon be removed from the 'Toast' component.");
34
+ deprecatedClassNameWarningShown = true;
35
+ }
30
36
  const isNotice = variant === "notice";
31
37
  const isNotification = variant === "notification";
32
38
  const locale = useLocale();
@@ -4,6 +4,8 @@ import PropTypes from "prop-types";
4
4
  import tagComponent from "../../__internal__/utils/helpers/tags";
5
5
  import { filterStyledSystemMarginProps, filterStyledSystemPaddingProps } from "../../style/utils";
6
6
  import StyledTypography from "./typography.style";
7
+ import Logger from "../../__internal__/utils/logger";
8
+ let deprecatedClassNameWarningShown = false;
7
9
  export const VARIANT_TYPES = ["h1-large", "h1", "h2", "h3", "h4", "h5", "segment-header", "segment-header-small", "segment-subheader", "segment-subheader-alt", "p", "span", "small", "big", "sup", "sub", "strong", "b", "em", "ul", "ol"];
8
10
  export const Typography = ({
9
11
  "data-component": dataComponent,
@@ -34,6 +36,10 @@ export const Typography = ({
34
36
  "aria-hidden": ariaHidden,
35
37
  ...rest
36
38
  }) => {
39
+ if (!deprecatedClassNameWarningShown && className) {
40
+ Logger.deprecate("The 'className' prop has been deprecated and will soon be removed from the 'Typography' component.");
41
+ deprecatedClassNameWarningShown = true;
42
+ }
37
43
  return /*#__PURE__*/React.createElement(StyledTypography, _extends({
38
44
  variant: variant,
39
45
  as: as,
@@ -14,10 +14,12 @@ var _tooltipProvider = require("../../__internal__/tooltip-provider");
14
14
  var _buttonBar = _interopRequireDefault(require("../button-bar/__internal__/button-bar.context"));
15
15
  var _splitButton = _interopRequireDefault(require("../split-button/__internal__/split-button.context"));
16
16
  var _batchSelection = _interopRequireDefault(require("../batch-selection/__internal__/batch-selection.context"));
17
+ var _logger = _interopRequireDefault(require("../../__internal__/utils/logger"));
17
18
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
18
19
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
19
20
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
20
21
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
22
+ let deprecatedClassNameWarningShown = false;
21
23
  function renderChildren({
22
24
  /* eslint-disable react/prop-types */
23
25
  iconType,
@@ -91,6 +93,10 @@ const Button = /*#__PURE__*/_react.default.forwardRef(({
91
93
  target,
92
94
  ...rest
93
95
  }, ref) => {
96
+ if (!deprecatedClassNameWarningShown && rest.className) {
97
+ _logger.default.deprecate("The 'className' prop has been deprecated and will soon be removed from the 'Button' component.");
98
+ deprecatedClassNameWarningShown = true;
99
+ }
94
100
  const {
95
101
  buttonType: buttonTypeContext,
96
102
  size: sizeContext,