carbon-react 125.11.1 → 125.12.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.
@@ -2,6 +2,7 @@ import React, { useContext, useEffect, useMemo, useState } from "react";
2
2
  import ReactDOM from "react-dom";
3
3
  import guid from "../../__internal__/utils/helpers/guid";
4
4
  import CarbonScopedTokensProvider from "../../style/design-tokens/carbon-scoped-tokens-provider/carbon-scoped-tokens-provider.component";
5
+ import StyledPortalEntrance from "./portal.style";
5
6
  export const PortalContext = /*#__PURE__*/React.createContext({});
6
7
  const Portal = ({
7
8
  children,
@@ -63,7 +64,7 @@ const Portal = ({
63
64
  }
64
65
  return node;
65
66
  };
66
- return /*#__PURE__*/React.createElement("span", {
67
+ return /*#__PURE__*/React.createElement(StyledPortalEntrance, {
67
68
  "data-portal-entrance": uniqueId
68
69
  }, /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/React.createElement(CarbonScopedTokensProvider, null, children), getPortalContainer()));
69
70
  };
@@ -0,0 +1,2 @@
1
+ declare const StyledPortalEntrance: import("styled-components").StyledComponent<"span", any, {}, never>;
2
+ export default StyledPortalEntrance;
@@ -0,0 +1,7 @@
1
+ import styled from "styled-components";
2
+ const StyledPortalEntrance = styled.span`
3
+ display: none;
4
+ height: 0;
5
+ width: 0;
6
+ `;
7
+ export default StyledPortalEntrance;
@@ -1,21 +1,17 @@
1
1
  import styled, { css } from "styled-components";
2
- import StyledIcon from "../../../../icon/icon.style";
3
2
  import { baseTheme } from "../../../../../style/themes";
4
3
  import addFocusStyling from "../../../../../style/utils/add-focus-styling";
5
4
  const StyledToolbarButton = styled.button.attrs({
6
5
  type: "button"
7
6
  })`
7
+ display: inline-flex;
8
+ justify-content: center;
9
+ align-items: center;
10
+ padding: 6px;
8
11
  background-color: inherit;
9
- border-radius: var(--borderRadius050);
12
+ border-radius: var(--borderRadius100);
10
13
  border: none;
11
14
  cursor: pointer;
12
- width: 32px;
13
- font-size: 14px;
14
- height: 32px;
15
-
16
- ${StyledIcon} {
17
- width: auto;
18
- }
19
15
 
20
16
  ${({
21
17
  isActive,
@@ -25,6 +21,7 @@ const StyledToolbarButton = styled.button.attrs({
25
21
  :active {
26
22
  z-index: 1;
27
23
  position: relative;
24
+
28
25
  ${theme.focusRedesignOptOut && /* istanbul ignore next */
29
26
  css`
30
27
  outline: 2px solid var(--colorsSemanticFocus500);
@@ -34,16 +31,14 @@ css`
34
31
  ${!theme.focusRedesignOptOut && css`
35
32
  ${addFocusStyling()}
36
33
  `}
37
- border-radius: var(--borderRadius050);
38
34
  }
39
35
 
40
36
  :hover {
41
- background-color: var(--colorsActionMinor200);
42
- border-radius: var(--borderRadius050);
37
+ background-color: ${!isActive && "var(--colorsActionMinor200)"};
43
38
  }
44
39
 
45
40
  ${isActive && css`
46
- background-color: var(--colorsActionMinor200);
41
+ background-color: var(--colorsActionMinor600);
47
42
  `}
48
43
  `}
49
44
  `;
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { InlineStyleType, BlockType } from "../../types";
2
+ import type { InlineStyleType, BlockType } from "../../types";
3
3
  export interface ToolbarProps {
4
4
  /** Used to override the active status of the inline controls */
5
5
  activeControls: Record<InlineStyleType | BlockType, boolean>;
@@ -97,6 +97,7 @@ const Toolbar = ({
97
97
  onFocus: () => setActiveTooltip("Bold"),
98
98
  onBlur: () => setActiveTooltip("")
99
99
  }, /*#__PURE__*/React.createElement(Icon, {
100
+ color: activeControls[BOLD] ? "var(--colorsActionMinorYang100)" : undefined,
100
101
  type: "bold"
101
102
  }))), /*#__PURE__*/React.createElement(Tooltip, {
102
103
  isVisible: activeTooltip === "Italic",
@@ -114,6 +115,7 @@ const Toolbar = ({
114
115
  onFocus: () => setActiveTooltip("Italic"),
115
116
  onBlur: () => setActiveTooltip("")
116
117
  }, /*#__PURE__*/React.createElement(Icon, {
118
+ color: activeControls[ITALIC] ? "var(--colorsActionMinorYang100)" : undefined,
117
119
  type: "italic"
118
120
  }))), /*#__PURE__*/React.createElement(Tooltip, {
119
121
  isVisible: activeTooltip === "Bulleted List",
@@ -131,6 +133,7 @@ const Toolbar = ({
131
133
  onFocus: () => setActiveTooltip("Bulleted List"),
132
134
  onBlur: () => setActiveTooltip("")
133
135
  }, /*#__PURE__*/React.createElement(Icon, {
136
+ color: activeControls[UNORDERED_LIST] ? "var(--colorsActionMinorYang100)" : undefined,
134
137
  type: "bullet_list_dotted"
135
138
  }))), /*#__PURE__*/React.createElement(Tooltip, {
136
139
  isVisible: activeTooltip === "Numbered List",
@@ -148,6 +151,7 @@ const Toolbar = ({
148
151
  onFocus: () => setActiveTooltip("Numbered List"),
149
152
  onBlur: () => setActiveTooltip("")
150
153
  }, /*#__PURE__*/React.createElement(Icon, {
154
+ color: activeControls[ORDERED_LIST] ? "var(--colorsActionMinorYang100)" : undefined,
151
155
  type: "bullet_list_numbers"
152
156
  })))), toolbarElements && /*#__PURE__*/React.createElement(StyledEditorActionControls, null, toolbarElements));
153
157
  };
@@ -1,36 +1,28 @@
1
1
  import styled from "styled-components";
2
- import StyledButton from "../../../button/button.style";
3
2
  const StyledToolbar = styled.div`
4
- padding: 8px;
5
- display: flex;
6
- justify-content: flex-start;
7
- background: white;
8
- flex-wrap: wrap;
9
- font-size: 14px;
10
- user-select: none;
11
- order: 2;
3
+ display: inline-flex;
4
+ justify-content: space-between;
5
+ flex-flow: row wrap;
6
+ gap: 8px;
7
+ padding: 12px;
8
+ height: fit-content;
9
+ width: 100%;
10
+ box-sizing: border-box;
12
11
  border: none;
13
12
  border-top: 1px solid var(--colorsUtilityMajor200);
14
13
  background-color: var(--colorsUtilityMajor025);
15
- min-width: 290px;
14
+ user-select: none;
16
15
  z-index: 10;
17
16
  `;
18
17
  const StyledEditorStyleControls = styled.div`
19
- display: inline-block;
20
- text-align: left;
21
- width: 50%;
22
- min-width: 60px;
23
- margin-left: -2px;
18
+ display: inline-flex;
19
+ gap: 8px;
24
20
  `;
25
21
  const StyledEditorActionControls = styled.div`
26
- display: inline-block;
27
- text-align: right;
28
- width: 50%;
29
- min-width: 60px;
30
-
31
- ${StyledButton} {
32
- width: 62px;
33
- min-height: 33px;
34
- }
22
+ flex-grow: 1;
23
+ display: inline-flex;
24
+ justify-content: flex-end;
25
+ flex-wrap: wrap;
26
+ gap: var(--spacing200);
35
27
  `;
36
28
  export { StyledToolbar, StyledEditorActionControls, StyledEditorStyleControls };
@@ -18,7 +18,6 @@ const StyledEditorContainer = styled.div`
18
18
  }) => css`
19
19
  border-radius: var(--borderRadius050);
20
20
  min-height: ${rows ? `${rows * lineHeight}` : `${hasPreview ? 125 : 220}`}px;
21
- min-width: 320px;
22
21
  position: relative;
23
22
 
24
23
  div.DraftEditor-root {
@@ -65,7 +64,6 @@ const StyledEditorOutline = styled.div`
65
64
  }) => css`
66
65
  border-radius: var(--borderRadius050);
67
66
  outline: none;
68
- min-width: 320px;
69
67
 
70
68
  ${isFocused && css`
71
69
  ${!theme.focusRedesignOptOut ? addFocusStyling() : `
@@ -8,6 +8,7 @@ var _react = _interopRequireWildcard(require("react"));
8
8
  var _reactDom = _interopRequireDefault(require("react-dom"));
9
9
  var _guid = _interopRequireDefault(require("../../__internal__/utils/helpers/guid"));
10
10
  var _carbonScopedTokensProvider = _interopRequireDefault(require("../../style/design-tokens/carbon-scoped-tokens-provider/carbon-scoped-tokens-provider.component"));
11
+ var _portal = _interopRequireDefault(require("./portal.style"));
11
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
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); }
13
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 && Object.prototype.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; }
@@ -72,7 +73,7 @@ const Portal = ({
72
73
  }
73
74
  return node;
74
75
  };
75
- return /*#__PURE__*/_react.default.createElement("span", {
76
+ return /*#__PURE__*/_react.default.createElement(_portal.default, {
76
77
  "data-portal-entrance": uniqueId
77
78
  }, /*#__PURE__*/_reactDom.default.createPortal( /*#__PURE__*/_react.default.createElement(_carbonScopedTokensProvider.default, null, children), getPortalContainer()));
78
79
  };
@@ -0,0 +1,2 @@
1
+ declare const StyledPortalEntrance: import("styled-components").StyledComponent<"span", any, {}, never>;
2
+ export default StyledPortalEntrance;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
8
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
+ const StyledPortalEntrance = _styledComponents.default.span`
10
+ display: none;
11
+ height: 0;
12
+ width: 0;
13
+ `;
14
+ var _default = exports.default = StyledPortalEntrance;
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
8
- var _icon = _interopRequireDefault(require("../../../../icon/icon.style"));
9
8
  var _themes = require("../../../../../style/themes");
10
9
  var _addFocusStyling = _interopRequireDefault(require("../../../../../style/utils/add-focus-styling"));
11
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -14,17 +13,14 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
14
13
  const StyledToolbarButton = _styledComponents.default.button.attrs({
15
14
  type: "button"
16
15
  })`
16
+ display: inline-flex;
17
+ justify-content: center;
18
+ align-items: center;
19
+ padding: 6px;
17
20
  background-color: inherit;
18
- border-radius: var(--borderRadius050);
21
+ border-radius: var(--borderRadius100);
19
22
  border: none;
20
23
  cursor: pointer;
21
- width: 32px;
22
- font-size: 14px;
23
- height: 32px;
24
-
25
- ${_icon.default} {
26
- width: auto;
27
- }
28
24
 
29
25
  ${({
30
26
  isActive,
@@ -34,6 +30,7 @@ const StyledToolbarButton = _styledComponents.default.button.attrs({
34
30
  :active {
35
31
  z-index: 1;
36
32
  position: relative;
33
+
37
34
  ${theme.focusRedesignOptOut && /* istanbul ignore next */
38
35
  (0, _styledComponents.css)`
39
36
  outline: 2px solid var(--colorsSemanticFocus500);
@@ -43,16 +40,14 @@ const StyledToolbarButton = _styledComponents.default.button.attrs({
43
40
  ${!theme.focusRedesignOptOut && (0, _styledComponents.css)`
44
41
  ${(0, _addFocusStyling.default)()}
45
42
  `}
46
- border-radius: var(--borderRadius050);
47
43
  }
48
44
 
49
45
  :hover {
50
- background-color: var(--colorsActionMinor200);
51
- border-radius: var(--borderRadius050);
46
+ background-color: ${!isActive && "var(--colorsActionMinor200)"};
52
47
  }
53
48
 
54
49
  ${isActive && (0, _styledComponents.css)`
55
- background-color: var(--colorsActionMinor200);
50
+ background-color: var(--colorsActionMinor600);
56
51
  `}
57
52
  `}
58
53
  `;
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { InlineStyleType, BlockType } from "../../types";
2
+ import type { InlineStyleType, BlockType } from "../../types";
3
3
  export interface ToolbarProps {
4
4
  /** Used to override the active status of the inline controls */
5
5
  activeControls: Record<InlineStyleType | BlockType, boolean>;
@@ -106,6 +106,7 @@ const Toolbar = ({
106
106
  onFocus: () => setActiveTooltip("Bold"),
107
107
  onBlur: () => setActiveTooltip("")
108
108
  }, /*#__PURE__*/_react.default.createElement(_icon.default, {
109
+ color: activeControls[_types.BOLD] ? "var(--colorsActionMinorYang100)" : undefined,
109
110
  type: "bold"
110
111
  }))), /*#__PURE__*/_react.default.createElement(_tooltip.default, {
111
112
  isVisible: activeTooltip === "Italic",
@@ -123,6 +124,7 @@ const Toolbar = ({
123
124
  onFocus: () => setActiveTooltip("Italic"),
124
125
  onBlur: () => setActiveTooltip("")
125
126
  }, /*#__PURE__*/_react.default.createElement(_icon.default, {
127
+ color: activeControls[_types.ITALIC] ? "var(--colorsActionMinorYang100)" : undefined,
126
128
  type: "italic"
127
129
  }))), /*#__PURE__*/_react.default.createElement(_tooltip.default, {
128
130
  isVisible: activeTooltip === "Bulleted List",
@@ -140,6 +142,7 @@ const Toolbar = ({
140
142
  onFocus: () => setActiveTooltip("Bulleted List"),
141
143
  onBlur: () => setActiveTooltip("")
142
144
  }, /*#__PURE__*/_react.default.createElement(_icon.default, {
145
+ color: activeControls[_types.UNORDERED_LIST] ? "var(--colorsActionMinorYang100)" : undefined,
143
146
  type: "bullet_list_dotted"
144
147
  }))), /*#__PURE__*/_react.default.createElement(_tooltip.default, {
145
148
  isVisible: activeTooltip === "Numbered List",
@@ -157,6 +160,7 @@ const Toolbar = ({
157
160
  onFocus: () => setActiveTooltip("Numbered List"),
158
161
  onBlur: () => setActiveTooltip("")
159
162
  }, /*#__PURE__*/_react.default.createElement(_icon.default, {
163
+ color: activeControls[_types.ORDERED_LIST] ? "var(--colorsActionMinorYang100)" : undefined,
160
164
  type: "bullet_list_numbers"
161
165
  })))), toolbarElements && /*#__PURE__*/_react.default.createElement(_toolbar.StyledEditorActionControls, null, toolbarElements));
162
166
  };
@@ -5,38 +5,30 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.StyledToolbar = exports.StyledEditorStyleControls = exports.StyledEditorActionControls = void 0;
7
7
  var _styledComponents = _interopRequireDefault(require("styled-components"));
8
- var _button = _interopRequireDefault(require("../../../button/button.style"));
9
8
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
9
  const StyledToolbar = exports.StyledToolbar = _styledComponents.default.div`
11
- padding: 8px;
12
- display: flex;
13
- justify-content: flex-start;
14
- background: white;
15
- flex-wrap: wrap;
16
- font-size: 14px;
17
- user-select: none;
18
- order: 2;
10
+ display: inline-flex;
11
+ justify-content: space-between;
12
+ flex-flow: row wrap;
13
+ gap: 8px;
14
+ padding: 12px;
15
+ height: fit-content;
16
+ width: 100%;
17
+ box-sizing: border-box;
19
18
  border: none;
20
19
  border-top: 1px solid var(--colorsUtilityMajor200);
21
20
  background-color: var(--colorsUtilityMajor025);
22
- min-width: 290px;
21
+ user-select: none;
23
22
  z-index: 10;
24
23
  `;
25
24
  const StyledEditorStyleControls = exports.StyledEditorStyleControls = _styledComponents.default.div`
26
- display: inline-block;
27
- text-align: left;
28
- width: 50%;
29
- min-width: 60px;
30
- margin-left: -2px;
25
+ display: inline-flex;
26
+ gap: 8px;
31
27
  `;
32
28
  const StyledEditorActionControls = exports.StyledEditorActionControls = _styledComponents.default.div`
33
- display: inline-block;
34
- text-align: right;
35
- width: 50%;
36
- min-width: 60px;
37
-
38
- ${_button.default} {
39
- width: 62px;
40
- min-height: 33px;
41
- }
29
+ flex-grow: 1;
30
+ display: inline-flex;
31
+ justify-content: flex-end;
32
+ flex-wrap: wrap;
33
+ gap: var(--spacing200);
42
34
  `;
@@ -27,7 +27,6 @@ const StyledEditorContainer = exports.StyledEditorContainer = _styledComponents.
27
27
  }) => (0, _styledComponents.css)`
28
28
  border-radius: var(--borderRadius050);
29
29
  min-height: ${rows ? `${rows * lineHeight}` : `${hasPreview ? 125 : 220}`}px;
30
- min-width: 320px;
31
30
  position: relative;
32
31
 
33
32
  div.DraftEditor-root {
@@ -74,7 +73,6 @@ const StyledEditorOutline = exports.StyledEditorOutline = _styledComponents.defa
74
73
  }) => (0, _styledComponents.css)`
75
74
  border-radius: var(--borderRadius050);
76
75
  outline: none;
77
- min-width: 320px;
78
76
 
79
77
  ${isFocused && (0, _styledComponents.css)`
80
78
  ${!theme.focusRedesignOptOut ? (0, _addFocusStyling.default)() : `
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-react",
3
- "version": "125.11.1",
3
+ "version": "125.12.0",
4
4
  "description": "A library of reusable React components for easily building user interfaces.",
5
5
  "files": [
6
6
  "lib",