carbon-react 153.0.0-beta.1 → 153.0.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.
Files changed (117) hide show
  1. package/README.md +1 -1
  2. package/esm/__internal__/ai-icon/ai-icon.component.d.ts +4 -0
  3. package/esm/__internal__/ai-icon/ai-icon.component.js +28 -0
  4. package/esm/__internal__/ai-icon/index.d.ts +1 -0
  5. package/esm/__internal__/ai-icon/index.js +1 -0
  6. package/esm/__internal__/dom/globals.js +1 -1
  7. package/esm/__internal__/input/input.component.d.ts +6 -1
  8. package/esm/__internal__/input/input.component.js +3 -2
  9. package/esm/components/accordion/accordion-group/accordion-group.component.js +6 -0
  10. package/esm/components/button/button-types.style.js +11 -1
  11. package/esm/components/button/button.component.js +1 -1
  12. package/esm/components/button-bar/button-bar.style.js +25 -53
  13. package/esm/components/dialog/dialog.component.d.ts +1 -0
  14. package/esm/components/dialog/dialog.component.js +2 -0
  15. package/esm/components/dialog/dialog.style.d.ts +1 -0
  16. package/esm/components/dialog/dialog.style.js +14 -0
  17. package/esm/components/hr/hr.style.js +1 -1
  18. package/esm/components/link/link.component.js +8 -1
  19. package/esm/components/menu/menu-item/menu-item.component.js +13 -7
  20. package/esm/components/message/message.component.d.ts +5 -1
  21. package/esm/components/message/message.component.js +38 -24
  22. package/esm/components/message/message.style.d.ts +4 -1
  23. package/esm/components/message/message.style.js +39 -13
  24. package/esm/components/portrait/portrait.style.js +0 -1
  25. package/esm/components/preview/preview.style.js +1 -1
  26. package/esm/components/select/__internal__/select-textbox/select-textbox.component.js +1 -1
  27. package/esm/components/select/simple-select/simple-select.component.js +1 -1
  28. package/esm/components/split-button/split-button-toggle.style.d.ts +1 -0
  29. package/esm/components/split-button/split-button-toggle.style.js +30 -2
  30. package/esm/components/split-button/split-button.component.d.ts +2 -0
  31. package/esm/components/split-button/split-button.component.js +4 -0
  32. package/esm/components/textarea/textarea.component.js +10 -3
  33. package/esm/components/textbox/textbox.component.js +10 -3
  34. package/esm/components/tile/tile.style.d.ts +1 -1
  35. package/esm/components/time/index.d.ts +1 -1
  36. package/esm/components/time/time.component.js +16 -1
  37. package/esm/components/toast/toast.component.js +2 -1
  38. package/esm/components/toast/toast.style.d.ts +2 -3
  39. package/esm/components/toast/toast.style.js +1 -2
  40. package/esm/components/vertical-menu/vertical-menu-full-screen/vertical-menu-full-screen.component.d.ts +1 -1
  41. package/esm/components/vertical-menu/vertical-menu-full-screen/vertical-menu-full-screen.component.js +5 -6
  42. package/esm/components/vertical-menu/vertical-menu.style.d.ts +5 -1
  43. package/esm/components/vertical-menu/vertical-menu.style.js +20 -1
  44. package/esm/hooks/{__internal__/useCharacterCount → useCharacterCount}/useCharacterCount.js +3 -3
  45. package/esm/locales/en-gb.js +2 -1
  46. package/esm/locales/locale.d.ts +1 -0
  47. package/lib/__internal__/ai-icon/ai-icon.component.d.ts +4 -0
  48. package/lib/__internal__/ai-icon/ai-icon.component.js +36 -0
  49. package/lib/__internal__/ai-icon/index.d.ts +1 -0
  50. package/lib/__internal__/ai-icon/index.js +13 -0
  51. package/lib/__internal__/ai-icon/package.json +6 -0
  52. package/lib/__internal__/dom/globals.js +1 -1
  53. package/lib/__internal__/input/input.component.d.ts +6 -1
  54. package/lib/__internal__/input/input.component.js +3 -2
  55. package/lib/components/accordion/accordion-group/accordion-group.component.js +6 -0
  56. package/lib/components/button/button-types.style.js +11 -1
  57. package/lib/components/button/button.component.js +1 -1
  58. package/lib/components/button-bar/button-bar.style.js +25 -53
  59. package/lib/components/dialog/dialog.component.d.ts +1 -0
  60. package/lib/components/dialog/dialog.component.js +2 -0
  61. package/lib/components/dialog/dialog.style.d.ts +1 -0
  62. package/lib/components/dialog/dialog.style.js +14 -0
  63. package/lib/components/hr/hr.style.js +1 -1
  64. package/lib/components/link/link.component.js +8 -1
  65. package/lib/components/menu/menu-item/menu-item.component.js +12 -6
  66. package/lib/components/message/message.component.d.ts +5 -1
  67. package/lib/components/message/message.component.js +38 -24
  68. package/lib/components/message/message.style.d.ts +4 -1
  69. package/lib/components/message/message.style.js +38 -13
  70. package/lib/components/portrait/portrait.style.js +0 -1
  71. package/lib/components/preview/preview.style.js +1 -1
  72. package/lib/components/select/__internal__/select-textbox/select-textbox.component.js +1 -1
  73. package/lib/components/select/simple-select/simple-select.component.js +1 -1
  74. package/lib/components/split-button/split-button-toggle.style.d.ts +1 -0
  75. package/lib/components/split-button/split-button-toggle.style.js +30 -2
  76. package/lib/components/split-button/split-button.component.d.ts +2 -0
  77. package/lib/components/split-button/split-button.component.js +4 -0
  78. package/lib/components/textarea/textarea.component.js +10 -3
  79. package/lib/components/textbox/textbox.component.js +10 -3
  80. package/lib/components/tile/tile.style.d.ts +1 -1
  81. package/lib/components/time/index.d.ts +1 -1
  82. package/lib/components/time/time.component.js +15 -0
  83. package/lib/components/toast/toast.component.js +2 -1
  84. package/lib/components/toast/toast.style.d.ts +2 -3
  85. package/lib/components/toast/toast.style.js +0 -7
  86. package/lib/components/vertical-menu/vertical-menu-full-screen/vertical-menu-full-screen.component.d.ts +1 -1
  87. package/lib/components/vertical-menu/vertical-menu-full-screen/vertical-menu-full-screen.component.js +5 -6
  88. package/lib/components/vertical-menu/vertical-menu.style.d.ts +5 -1
  89. package/lib/components/vertical-menu/vertical-menu.style.js +20 -1
  90. package/lib/hooks/useCharacterCount/package.json +6 -0
  91. package/lib/hooks/{__internal__/useCharacterCount → useCharacterCount}/useCharacterCount.js +3 -3
  92. package/lib/locales/en-gb.js +2 -1
  93. package/lib/locales/locale.d.ts +1 -0
  94. package/package.json +15 -15
  95. package/esm/components/message/__internal__/message-content/message-content.component.d.ts +0 -9
  96. package/esm/components/message/__internal__/message-content/message-content.component.js +0 -19
  97. package/esm/components/message/__internal__/message-content/message-content.style.d.ts +0 -3
  98. package/esm/components/message/__internal__/message-content/message-content.style.js +0 -12
  99. package/esm/components/message/__internal__/type-icon/type-icon.component.d.ts +0 -8
  100. package/esm/components/message/__internal__/type-icon/type-icon.component.js +0 -20
  101. package/esm/components/message/__internal__/type-icon/type-icon.style.d.ts +0 -7
  102. package/esm/components/message/__internal__/type-icon/type-icon.style.js +0 -38
  103. package/lib/components/message/__internal__/message-content/message-content.component.d.ts +0 -9
  104. package/lib/components/message/__internal__/message-content/message-content.component.js +0 -26
  105. package/lib/components/message/__internal__/message-content/message-content.style.d.ts +0 -3
  106. package/lib/components/message/__internal__/message-content/message-content.style.js +0 -19
  107. package/lib/components/message/__internal__/type-icon/type-icon.component.d.ts +0 -8
  108. package/lib/components/message/__internal__/type-icon/type-icon.component.js +0 -27
  109. package/lib/components/message/__internal__/type-icon/type-icon.style.d.ts +0 -7
  110. package/lib/components/message/__internal__/type-icon/type-icon.style.js +0 -46
  111. package/lib/hooks/__internal__/useCharacterCount/package.json +0 -6
  112. /package/esm/hooks/{__internal__/useCharacterCount → useCharacterCount}/index.d.ts +0 -0
  113. /package/esm/hooks/{__internal__/useCharacterCount → useCharacterCount}/index.js +0 -0
  114. /package/esm/hooks/{__internal__/useCharacterCount → useCharacterCount}/useCharacterCount.d.ts +0 -0
  115. /package/lib/hooks/{__internal__/useCharacterCount → useCharacterCount}/index.d.ts +0 -0
  116. /package/lib/hooks/{__internal__/useCharacterCount → useCharacterCount}/index.js +0 -0
  117. /package/lib/hooks/{__internal__/useCharacterCount → useCharacterCount}/useCharacterCount.d.ts +0 -0
@@ -7,16 +7,11 @@ exports.default = void 0;
7
7
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
8
8
  var _styledSystem = require("styled-system");
9
9
  var _base = _interopRequireDefault(require("../../style/themes/base"));
10
- var _button = _interopRequireDefault(require("../button/button.style"));
11
10
  var _icon = _interopRequireDefault(require("../icon/icon.style"));
12
11
  var _iconButton = _interopRequireDefault(require("../icon-button/icon-button.style"));
13
12
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
13
  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); }
15
14
  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; }
16
- const commonHoverStyles = `
17
- background-color: var(--colorsActionMajor600);
18
- border-color: var(--colorsActionMajor600);
19
- `;
20
15
  const StyledButtonBar = _styledComponents.default.div`
21
16
  ${_styledSystem.space}
22
17
  ${({
@@ -38,84 +33,61 @@ const StyledButtonBar = _styledComponents.default.div`
38
33
 
39
34
  button {
40
35
  margin: 0;
36
+ position: relative;
41
37
 
42
- :not(:first-child):not(:last-child) {
38
+ &:not(:first-child):not(:last-child) {
43
39
  border-radius: var(--borderRadius000);
44
40
  }
45
- :first-child:not(:last-child) {
41
+ &:first-child:not(:last-child) {
46
42
  border-top-right-radius: var(--borderRadius000);
47
43
  border-bottom-right-radius: var(--borderRadius000);
48
44
  }
49
- :last-child:not(:first-child) {
45
+ &:last-child:not(:first-child) {
50
46
  border-top-left-radius: var(--borderRadius000);
51
47
  border-bottom-left-radius: var(--borderRadius000);
52
48
  }
53
49
 
54
- &:not(:last-of-type) {
55
- border-right-color: transparent;
56
- }
57
-
58
50
  &:not(:first-of-type) {
59
51
  margin-left: -2px;
60
52
  }
61
53
 
62
- &:focus {
63
- position: relative;
64
- z-index: 2;
54
+ &:not(:disabled) {
55
+ z-index: 1;
65
56
  }
66
57
 
67
- &:hover {
68
- background-color: var(--colorsActionMajor600);
69
- border-color: var(--colorsActionMajor600);
70
-
71
- & + button {
72
- border-left-color: var(--colorsActionMajor600);
73
- }
74
-
75
- & ${_icon.default} {
76
- ${commonHoverStyles}
77
- color: white;
78
- }
58
+ &:hover:not(:disabled) {
59
+ z-index: 2;
79
60
  }
80
61
 
81
- & ${_icon.default} {
82
- color: var(--colorsActionMajor500);
62
+ &:focus {
63
+ z-index: 3;
83
64
  }
84
65
  }
85
66
 
86
- [data-component="button"] {
87
- :hover {
88
- ${commonHoverStyles}
89
- & + ${_button.default} {
90
- border-left-color: var(--colorsActionMajor600);
91
- }
67
+ ${_iconButton.default}:not(:disabled) {
68
+ border: 2px solid var(--colorsActionMajor500);
69
+
70
+ &:focus {
71
+ border-right-color: var(--colorsActionMajor500);
92
72
  }
93
- }
94
73
 
95
- [data-component="button-minor"] {
96
- & ${_icon.default} {
97
- color: var(--colorsActionMinor500);
74
+ &:hover {
75
+ background-color: var(--colorsActionMajor600);
76
+ border-color: var(--colorsActionMajor600);
77
+ color: var(--colorsActionMajorYang100);
98
78
  }
99
- }
100
79
 
101
- [data-component="button-minor"] {
102
- :hover {
103
- color: var(--colorsActionMinorYang100);
104
- background-color: var(--colorsActionMinor500);
105
- border-color: var(--colorsActionMinor500);
80
+ ${_icon.default} {
81
+ color: var(--colorsActionMajor500);
106
82
 
107
- & + ${_button.default} {
108
- border-left-color: var(--colorsActionMinor500);
83
+ &:hover {
84
+ color: var(--colorsActionMajorYang100);
109
85
  }
110
86
  }
111
87
  }
112
88
 
113
- ${_iconButton.default} {
114
- border: 2px solid var(--colorsActionMajor500);
115
-
116
- :focus {
117
- border-right-color: var(--colorsActionMajor500);
118
- }
89
+ ${_iconButton.default}:disabled {
90
+ border: 2px solid var(--colorsActionDisabled500);
119
91
  }
120
92
  `}
121
93
  `;
@@ -46,6 +46,7 @@ export interface DialogProps extends ModalProps, TagProps {
46
46
  height?: string;
47
47
  /** Adds Help tooltip to Header */
48
48
  help?: string;
49
+ highlightVariant?: string;
49
50
  /** A custom close event handler */
50
51
  onCancel?: (ev: React.KeyboardEvent<HTMLElement> | KeyboardEvent | React.MouseEvent<HTMLButtonElement>) => void;
51
52
  /** Determines if the close icon is shown */
@@ -40,6 +40,7 @@ const Dialog = exports.Dialog = /*#__PURE__*/(0, _react.forwardRef)(({
40
40
  bespokeFocusTrap,
41
41
  disableClose,
42
42
  help,
43
+ highlightVariant = "default",
43
44
  role = "dialog",
44
45
  contentPadding = {},
45
46
  greyBackground = false,
@@ -124,6 +125,7 @@ const Dialog = exports.Dialog = /*#__PURE__*/(0, _react.forwardRef)(({
124
125
  "aria-modal": isTopModal ? true : undefined,
125
126
  ref: containerRef
126
127
  }, dialogProps, {
128
+ highlightVariant: highlightVariant,
127
129
  role: role,
128
130
  tabIndex: -1
129
131
  }, contentPadding, {
@@ -3,6 +3,7 @@ declare const DialogPositioner: import("styled-components").StyledComponent<"div
3
3
  declare const StyledDialog: import("styled-components").StyledComponent<"div", any, Required<Pick<DialogProps, "size">> & {
4
4
  dialogHeight?: string | undefined;
5
5
  backgroundColor: string;
6
+ highlightVariant?: string | undefined;
6
7
  } & ContentPaddingInterface, never>;
7
8
  type StyledDialogTitleProps = {
8
9
  showCloseIcon?: boolean;
@@ -60,6 +60,20 @@ const StyledDialog = exports.StyledDialog = _styledComponents.default.div`
60
60
  outline: none;
61
61
  }
62
62
 
63
+ ${({
64
+ highlightVariant
65
+ }) => highlightVariant === "ai" && `
66
+ &::before {
67
+ content: "";
68
+ position: absolute;
69
+ top: -8px;
70
+ height: 100px;
71
+ width: 100%;
72
+ z-index: -1;
73
+ background: linear-gradient(90deg, #00D639 0%, #00D6DE 40%, #9D60FF 90%);
74
+ border-radius: var(--borderRadius200) var(--borderRadius200) 0 0;
75
+ }`}
76
+
63
77
  ${({
64
78
  backgroundColor
65
79
  }) => (0, _styledComponents.css)`
@@ -15,7 +15,7 @@ const heightMap = {
15
15
  };
16
16
  const StyledHr = _styledComponents.default.hr`
17
17
  ${_styledSystem.margin}
18
- width: inherit;
18
+ width: 100%;
19
19
  border: 0;
20
20
  height: ${({
21
21
  height
@@ -45,6 +45,13 @@ const Link = exports.Link = /*#__PURE__*/_react.default.forwardRef(({
45
45
  batchSelectionDisabled
46
46
  } = (0, _react.useContext)(_batchSelection.default);
47
47
  const isDisabled = disabled || batchSelectionDisabled;
48
+ const setRefs = _react.default.useCallback(reference => {
49
+ if (!ref) return;
50
+ if (typeof ref === "object") ref.current = reference;
51
+ if (typeof ref === "function") {
52
+ ref(reference);
53
+ }
54
+ }, [ref]);
48
55
  const renderLinkIcon = (currentAlignment = "left") => {
49
56
  const hasProperAlignment = icon && iconAlign === currentAlignment;
50
57
  return hasProperAlignment ? /*#__PURE__*/_react.default.createElement(_icon.default, {
@@ -68,7 +75,7 @@ const Link = exports.Link = /*#__PURE__*/_react.default.forwardRef(({
68
75
  onClick,
69
76
  disabled: isDisabled,
70
77
  target,
71
- ref,
78
+ ref: setRefs,
72
79
  href,
73
80
  rel,
74
81
  "aria-label": ariaLabel,
@@ -72,8 +72,14 @@ const MenuItem = ({
72
72
  } = submenuContext;
73
73
  const focusFromMenu = focusId === menuItemId.current;
74
74
  const focusFromSubmenu = submenuFocusId ? submenuFocusId === menuItemId.current : undefined;
75
- const ref = (0, _react.useRef)(null);
76
- const firstFocusableChild = ref.current?.querySelector(_focusTrapUtils.defaultFocusableSelectors) ?? null;
75
+ const [ref, setRef] = (0, _react.useState)(null);
76
+ const [firstFocusableChild, setFirstFocusableChild] = (0, _react.useState)(null);
77
+ (0, _react.useLayoutEffect)(() => {
78
+ const firstFocusable = ref?.querySelector(_focusTrapUtils.defaultFocusableSelectors) ?? null;
79
+ if (firstFocusable !== firstFocusableChild) {
80
+ setFirstFocusableChild(firstFocusable);
81
+ }
82
+ }, [ref]);
77
83
  (0, _react.useEffect)(() => {
78
84
  const id = menuItemId.current;
79
85
 
@@ -94,7 +100,7 @@ const MenuItem = ({
94
100
  firstFocusableChild.focus();
95
101
  return;
96
102
  }
97
- ref.current?.focus();
103
+ ref?.focus();
98
104
  }
99
105
  }, [firstFocusableChild, focusFromMenu, focusFromSubmenu]);
100
106
  const handleFocus = event => {
@@ -108,7 +114,7 @@ const MenuItem = ({
108
114
  const handleKeyDown = event => {
109
115
  onKeyDown?.(event);
110
116
  if (_events.default.isEscKey(event)) {
111
- ref.current?.focus();
117
+ ref?.focus();
112
118
  }
113
119
  handleSubmenuKeyDown?.(event);
114
120
  };
@@ -123,7 +129,7 @@ const MenuItem = ({
123
129
  selected,
124
130
  onKeyDown: !inFullscreenView ? handleKeyDown : undefined,
125
131
  overrideColor,
126
- ref
132
+ ref: setRef
127
133
  };
128
134
  if (overriddenVariant === "alternate" && isChildOfSegment && variant === "alternate" && ["white", "black"].includes(menuType)) {
129
135
  elementProps.overrideColor = true;
@@ -162,7 +168,7 @@ const MenuItem = ({
162
168
  }, rest), children));
163
169
  }
164
170
  const paddingProps = (0, _utils.filterStyledSystemPaddingProps)(rest);
165
- const hasInput = !!ref.current?.querySelector("[data-element='input']");
171
+ const hasInput = !!ref?.querySelector("[data-element='input']");
166
172
  return /*#__PURE__*/_react.default.createElement(_menu2.StyledMenuItem, _extends({
167
173
  "data-component": "menu-item",
168
174
  "data-element": dataElement,
@@ -1,7 +1,11 @@
1
1
  import React from "react";
2
2
  import { MarginProps } from "styled-system";
3
3
  import { TagProps } from "../../__internal__/utils/helpers/tags/tags";
4
- export type MessageVariant = "error" | "info" | "success" | "warning" | "neutral";
4
+ export interface TypeIconProps {
5
+ transparent?: boolean;
6
+ variant: MessageVariant;
7
+ }
8
+ export type MessageVariant = "error" | "info" | "success" | "warning" | "neutral" | "ai";
5
9
  export interface MessageProps extends MarginProps, TagProps {
6
10
  /** Set the component's content */
7
11
  children?: React.ReactNode;
@@ -6,12 +6,12 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = exports.Message = void 0;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
8
  var _typography = _interopRequireDefault(require("../typography"));
9
- var _message = _interopRequireDefault(require("./message.style"));
10
- var _typeIcon = _interopRequireDefault(require("./__internal__/type-icon/type-icon.component"));
11
- var _messageContent = _interopRequireDefault(require("./__internal__/message-content/message-content.component"));
9
+ var _content = _interopRequireDefault(require("../content"));
10
+ var _message = _interopRequireWildcard(require("./message.style"));
12
11
  var _tags = _interopRequireDefault(require("../../__internal__/utils/helpers/tags/tags"));
13
12
  var _icon = _interopRequireDefault(require("../icon"));
14
13
  var _iconButton = _interopRequireDefault(require("../icon-button"));
14
+ var _aiIcon = _interopRequireDefault(require("../../__internal__/ai-icon"));
15
15
  var _utils = require("../../style/utils");
16
16
  var _useLocale = _interopRequireDefault(require("../../hooks/__internal__/useLocale"));
17
17
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
@@ -31,38 +31,52 @@ const Message = exports.Message = /*#__PURE__*/_react.default.forwardRef(({
31
31
  width,
32
32
  ...props
33
33
  }, ref) => {
34
- const messageRef = (0, _react.useRef)(null);
35
- const refToPass = ref || messageRef;
34
+ const localRef = (0, _react.useRef)(null);
35
+ const messageRef = ref || localRef;
36
+ const locale = (0, _useLocale.default)();
36
37
  const marginProps = (0, _utils.filterStyledSystemMarginProps)(props);
37
- const l = (0, _useLocale.default)();
38
- const renderCloseIcon = () => {
39
- if (!showCloseIcon || !onDismiss) return null;
40
- return /*#__PURE__*/_react.default.createElement(_iconButton.default, {
41
- "data-element": "close",
42
- "aria-label": closeButtonAriaLabel || l.message.closeButtonAriaLabel(),
43
- onClick: onDismiss
44
- }, /*#__PURE__*/_react.default.createElement(_icon.default, {
45
- type: "close"
46
- }));
38
+ const VARIANT_ICON_MAP = {
39
+ neutral: "info",
40
+ success: "tick_circle",
41
+ error: "error",
42
+ warning: "warning",
43
+ info: "info"
47
44
  };
48
- return open ? /*#__PURE__*/_react.default.createElement(_message.default, _extends({}, (0, _tags.default)("Message", props), {
45
+ if (!open) {
46
+ return null;
47
+ }
48
+ return /*#__PURE__*/_react.default.createElement(_message.default, _extends({}, (0, _tags.default)("Message", props), {
49
49
  transparent: transparent,
50
50
  variant: variant,
51
51
  id: id,
52
52
  width: width,
53
- ref: refToPass
53
+ ref: messageRef
54
54
  }, marginProps, {
55
55
  tabIndex: -1
56
- }), /*#__PURE__*/_react.default.createElement(_typeIcon.default, {
56
+ }), /*#__PURE__*/_react.default.createElement(_message.TypeIconStyle, {
57
57
  variant: variant,
58
58
  transparent: transparent
59
- }), /*#__PURE__*/_react.default.createElement(_typography.default, {
59
+ }, variant === "ai" ? /*#__PURE__*/_react.default.createElement(_aiIcon.default, {
60
+ "data-role": "ai-icon"
61
+ }) : /*#__PURE__*/_react.default.createElement(_icon.default, {
62
+ "data-role": "category-icon",
63
+ type: VARIANT_ICON_MAP[variant]
64
+ })), /*#__PURE__*/_react.default.createElement(_typography.default, {
60
65
  screenReaderOnly: true
61
- }, l.message[variant]()), /*#__PURE__*/_react.default.createElement(_messageContent.default, {
62
- showCloseIcon: showCloseIcon,
63
- title: title,
64
- reduceLeftPadding: transparent
65
- }, children), renderCloseIcon()) : null;
66
+ }, locale.message?.[variant]?.()), /*#__PURE__*/_react.default.createElement(_message.MessageContent, {
67
+ "data-element": "message-content",
68
+ "data-role": "message-content"
69
+ }, !showCloseIcon || !onDismiss ? /*#__PURE__*/_react.default.createElement(_content.default, {
70
+ title: title
71
+ }, children) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_content.default, {
72
+ title: title
73
+ }, children), /*#__PURE__*/_react.default.createElement(_iconButton.default, {
74
+ "data-element": "close",
75
+ "aria-label": closeButtonAriaLabel || locale.message.closeButtonAriaLabel(),
76
+ onClick: onDismiss
77
+ }, /*#__PURE__*/_react.default.createElement(_icon.default, {
78
+ type: "close"
79
+ })))));
66
80
  });
67
81
  Message.displayName = "Message";
68
82
  var _default = exports.default = Message;
@@ -1,9 +1,12 @@
1
1
  import { MarginProps } from "styled-system";
2
- import { MessageVariant } from "./message.component";
2
+ import { MessageVariant, TypeIconProps } from "./message.component";
3
3
  type MessageStyleProps = {
4
4
  variant?: MessageVariant;
5
5
  transparent?: boolean;
6
6
  width?: string;
7
7
  };
8
8
  declare const MessageStyle: import("styled-components").StyledComponent<"div", any, MessageStyleProps & MarginProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>>, never>;
9
+ declare const MessageContent: import("styled-components").StyledComponent<"div", any, {}, never>;
10
+ declare const TypeIconStyle: import("styled-components").StyledComponent<"div", any, TypeIconProps, never>;
9
11
  export default MessageStyle;
12
+ export { MessageContent, TypeIconStyle };
@@ -3,11 +3,10 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = void 0;
6
+ exports.default = exports.TypeIconStyle = exports.MessageContent = void 0;
7
7
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
8
8
  var _styledSystem = require("styled-system");
9
9
  var _base = _interopRequireDefault(require("../../style/themes/base"));
10
- var _iconButton = _interopRequireDefault(require("../icon-button/icon-button.style"));
11
10
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
11
  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); }
13
12
  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; }
@@ -16,13 +15,12 @@ const messageVariants = {
16
15
  info: "var(--colorsSemanticInfo500)",
17
16
  success: "var(--colorsSemanticPositive500)",
18
17
  warning: "var(--colorsSemanticCaution500)",
19
- neutral: "var(--colorsSemanticNeutral500)"
18
+ neutral: "var(--colorsSemanticNeutral500)",
19
+ ai: "var(--colorsUtilityYin100)"
20
20
  };
21
21
  const MessageStyle = _styledComponents.default.div`
22
22
  position: relative;
23
23
  display: flex;
24
- justify-content: flex-start;
25
- align-content: center;
26
24
  border-radius: var(--borderRadius100);
27
25
  overflow: hidden;
28
26
  border: 1px solid ${({
@@ -42,19 +40,46 @@ const MessageStyle = _styledComponents.default.div`
42
40
  background: transparent;
43
41
  `}
44
42
 
45
- ${_iconButton.default} {
46
- position: absolute;
47
- right: 20px;
48
- top: 50%;
49
- transform: translateY(-50%);
50
- }
51
-
52
43
  ${({
53
44
  width
54
45
  }) => width && `width: ${width};`}
55
-
56
46
  ${_styledSystem.margin}
57
47
  `;
48
+ const MessageContent = exports.MessageContent = _styledComponents.default.div`
49
+ width: 100%;
50
+ display: flex;
51
+ justify-content: space-between;
52
+ align-items: center;
53
+ padding: var(--spacing200);
54
+ gap: var(--spacing300);
55
+ `;
56
+ const TypeIconStyle = exports.TypeIconStyle = _styledComponents.default.div`
57
+ display: flex;
58
+ justify-content: center;
59
+ align-items: center;
60
+ background-color: ${({
61
+ variant
62
+ }) => messageVariants[variant]};
63
+ min-width: 30px;
64
+
65
+ span {
66
+ &:before {
67
+ color: var(--colorsUtilityYang100);
68
+ }
69
+ }
70
+
71
+ ${({
72
+ transparent,
73
+ variant
74
+ }) => transparent && (0, _styledComponents.css)`
75
+ background-color: transparent;
76
+ span {
77
+ &:before {
78
+ color: ${messageVariants[variant]};
79
+ }
80
+ }
81
+ `}
82
+ `;
58
83
  MessageStyle.defaultProps = {
59
84
  theme: _base.default
60
85
  };
@@ -30,7 +30,6 @@ const StyledCustomImg = exports.StyledCustomImg = _styledComponents.default.img`
30
30
  `;
31
31
 
32
32
  // && is used here to increase the specificity
33
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
34
33
  const StyledIcon = exports.StyledIcon = (0, _styledComponents.default)(_icon.default)`
35
34
  && {
36
35
  color: inherit;
@@ -72,7 +72,7 @@ const StyledPreviewPlaceholder = exports.StyledPreviewPlaceholder = _styledCompo
72
72
  animation: ${shimmer} 2s ease infinite;
73
73
 
74
74
  ${isLastLine && shape === "text" && (0, _styledComponents.css)`
75
- width: calc(; ${width || getWidth(shape)}*0.8);
75
+ width: calc(${width || getWidth(shape)}*0.8);
76
76
  `}
77
77
 
78
78
  ${shape === "circle" && (0, _styledComponents.css)`
@@ -79,7 +79,7 @@ const SelectTextbox = /*#__PURE__*/_react.default.forwardRef(({
79
79
  isInputInSelect: true
80
80
  }
81
81
  }, /*#__PURE__*/_react.default.createElement(_textbox.default, _extends({
82
- ariaDescribedBy: ariaDescribedBy,
82
+ "aria-describedby": ariaDescribedBy,
83
83
  "aria-label": ariaLabel,
84
84
  "data-element": "select-input",
85
85
  "data-role": "select-textbox",
@@ -351,7 +351,7 @@ const SimpleSelect = exports.SimpleSelect = /*#__PURE__*/_react.default.forwardR
351
351
  "aria-controls": selectListId.current,
352
352
  activeDescendantId: activeDescendantId,
353
353
  ariaLabelledby: ariaLabelledby,
354
- ariaDescribedBy: ariaDescribedBy,
354
+ "aria-describedby": ariaDescribedBy,
355
355
  isOpen: isOpen
356
356
  }, getTextboxProps()))), selectList);
357
357
  });
@@ -3,6 +3,7 @@ type StyledSplitButtonToggleProps = {
3
3
  disabled: boolean;
4
4
  displayed: boolean;
5
5
  size: "small" | "medium" | "large";
6
+ isWhite?: boolean;
6
7
  };
7
8
  declare const StyledSplitButtonToggle: import("styled-components").StyledComponent<"button", any, import("styled-system").SpaceProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol> & Omit<import("../button").ButtonProps, "buttonType"> & {
8
9
  iconOnly?: boolean | undefined;
@@ -21,12 +21,13 @@ const StyledSplitButtonToggle = (0, _styledComponents.default)(_button.default)`
21
21
  buttonType,
22
22
  disabled,
23
23
  displayed,
24
- size
24
+ size,
25
+ isWhite
25
26
  }) => (0, _styledComponents.css)`
26
27
  border-top-left-radius: var(--borderRadius000);
27
28
  border-bottom-left-radius: var(--borderRadius000);
28
29
 
29
- ${!disabled && displayed ? (0, _styledComponents.css)`
30
+ ${!disabled && displayed && !isWhite ? (0, _styledComponents.css)`
30
31
  background-color: var(--colorsActionMajor500);
31
32
  border-color: var(--colorsActionMajor500);
32
33
 
@@ -39,6 +40,21 @@ const StyledSplitButtonToggle = (0, _styledComponents.default)(_button.default)`
39
40
  border-left-color: var(--colorsSemanticFocus500);
40
41
  }
41
42
  ` : ""}
43
+
44
+ ${!disabled && displayed && isWhite ? (0, _styledComponents.css)`
45
+ background-color: var(--colorsActionMajorYang100);
46
+ border-color: var(--colorsActionMajorYang100);
47
+
48
+ &,
49
+ ${_icon.default} {
50
+ color: var(--colorsYin100);
51
+ }
52
+
53
+ &:focus {
54
+ border-left-color: var(--colorsSemanticFocus500);
55
+ }
56
+ ` : ""}
57
+
42
58
  ${!disabled && buttonType === "primary" && `
43
59
  position: relative;
44
60
  &::before {
@@ -72,6 +88,18 @@ const StyledSplitButtonToggle = (0, _styledComponents.default)(_button.default)`
72
88
  color: var(--colorsActionMajorYang100);
73
89
  }
74
90
  }
91
+
92
+ ${!disabled && isWhite && `
93
+ &:focus {
94
+ background-color: var(--colorsActionMajorYang100);
95
+ border-color: var(--colorsActionMajorYang100);
96
+
97
+ &,
98
+ ${_icon.default} {
99
+ color: var(--colorsYin100);
100
+ }
101
+ }
102
+ `}
75
103
  `}
76
104
  `;
77
105
  StyledSplitButtonToggle.defaultProps = {
@@ -25,6 +25,8 @@ export interface SplitButtonProps extends React.ButtonHTMLAttributes<HTMLButtonE
25
25
  text: string;
26
26
  /** Sets rendering position of menu */
27
27
  position?: "left" | "right";
28
+ /** Renders the white variant of the secondary split button */
29
+ isWhite?: boolean;
28
30
  }
29
31
  export type SplitButtonHandle = {
30
32
  /** Programmatically focus the main button */
@@ -41,6 +41,7 @@ const SplitButton = exports.SplitButton = /*#__PURE__*/(0, _react.forwardRef)(({
41
41
  "data-element": dataElement,
42
42
  "data-role": dataRole,
43
43
  "aria-label": ariaLabel,
44
+ isWhite = false,
44
45
  ...rest
45
46
  }, ref) => {
46
47
  const locale = (0, _useLocale.default)();
@@ -51,6 +52,7 @@ const SplitButton = exports.SplitButton = /*#__PURE__*/(0, _react.forwardRef)(({
51
52
  const {
52
53
  isInFlatTable
53
54
  } = (0, _react.useContext)(_flatTable.default);
55
+ const shouldRenderIsWhiteVariant = buttonType === "secondary" && isWhite;
54
56
  (0, _react.useImperativeHandle)(ref, () => ({
55
57
  focusMainButton() {
56
58
  mainButtonRef.current?.focus();
@@ -85,12 +87,14 @@ const SplitButton = exports.SplitButton = /*#__PURE__*/(0, _react.forwardRef)(({
85
87
  onClick: handleMainClick,
86
88
  size,
87
89
  subtext,
90
+ isWhite: shouldRenderIsWhiteVariant,
88
91
  ...(0, _utils.filterOutStyledSystemSpacingProps)(rest)
89
92
  };
90
93
  const handleToggleClick = () => {
91
94
  showButtons();
92
95
  };
93
96
  const toggleButtonProps = {
97
+ isWhite: shouldRenderIsWhiteVariant,
94
98
  disabled,
95
99
  displayed: showAdditionalButtons,
96
100
  onTouchStart: showButtons,