carbon-react 123.10.1 → 123.10.3

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.
@@ -3,7 +3,7 @@ import React from "react";
3
3
  import PropTypes from "prop-types";
4
4
  import { Editor } from "draft-js";
5
5
  import invariant from "invariant";
6
- import { StyledNote, StyledNoteContent, StyledInlineControl, StyledTitle, StyledFooter, StyledFooterContent } from "./note.style";
6
+ import { StyledNote, StyledNoteContent, StyledNoteMain, StyledInlineControl, StyledTitle, StyledFooter, StyledFooterContent } from "./note.style";
7
7
  import StatusIcon from "./__internal__/status-icon";
8
8
  import { ActionPopover } from "../action-popover";
9
9
  import { getDecoratedValue } from "../text-editor/__internal__/utils";
@@ -54,20 +54,15 @@ export const Note = ({
54
54
  width: width
55
55
  }, rest, {
56
56
  "data-component": "note"
57
- }), title && /*#__PURE__*/React.createElement(StyledTitle, {
58
- hasInlineControl: !!inlineControl
59
- }, title), inlineControl && /*#__PURE__*/React.createElement(StyledInlineControl, null, inlineControl), /*#__PURE__*/React.createElement(StyledNoteContent, {
60
- hasInlineControl: !!inlineControl
61
- }, /*#__PURE__*/React.createElement(Editor, {
57
+ }), /*#__PURE__*/React.createElement(StyledNoteMain, null, /*#__PURE__*/React.createElement(StyledNoteContent, null, title && /*#__PURE__*/React.createElement(StyledTitle, null, title), /*#__PURE__*/React.createElement(Editor, {
62
58
  readOnly: true,
63
59
  editorState: getDecoratedValue(noteContent),
64
60
  onChange: /* istanbul ignore next */() => {}
65
- })), React.Children.map(previews, preview => /*#__PURE__*/React.isValidElement(preview) && hasExpectedDisplayName(preview, LinkPreview.displayName) ? /*#__PURE__*/React.cloneElement(preview, {
61
+ })), inlineControl && /*#__PURE__*/React.createElement(StyledInlineControl, null, inlineControl)), /*#__PURE__*/React.createElement(StyledNoteContent, null, React.Children.map(previews, preview => /*#__PURE__*/React.isValidElement(preview) && hasExpectedDisplayName(preview, LinkPreview.displayName) ? /*#__PURE__*/React.cloneElement(preview, {
66
62
  as: "a",
67
63
  onClose: undefined
68
- }) : preview), createdDate && /*#__PURE__*/React.createElement(StyledNoteContent, {
69
- hasPreview: !!React.Children.count(previews),
70
- hasInlineControl: !!inlineControl
64
+ }) : preview)), createdDate && /*#__PURE__*/React.createElement(StyledNoteContent, {
65
+ hasPreview: !!React.Children.count(previews)
71
66
  }, /*#__PURE__*/React.createElement(StyledFooter, {
72
67
  "data-element": "note-footer"
73
68
  }, name && /*#__PURE__*/React.createElement(StyledFooterContent, {
@@ -1,11 +1,9 @@
1
1
  declare const StyledNoteContent: import("styled-components").StyledComponent<"div", any, {
2
- hasInlineControl: boolean;
3
2
  hasPreview?: boolean | undefined;
4
3
  }, never>;
4
+ declare const StyledNoteMain: import("styled-components").StyledComponent<"div", any, {}, never>;
5
5
  declare const StyledInlineControl: import("styled-components").StyledComponent<"div", any, {}, never>;
6
- declare const StyledTitle: import("styled-components").StyledComponent<"header", any, {
7
- hasInlineControl: boolean;
8
- }, never>;
6
+ declare const StyledTitle: import("styled-components").StyledComponent<"header", any, {}, never>;
9
7
  declare const StyledFooterContent: import("styled-components").StyledComponent<"div", any, {
10
8
  hasName: boolean;
11
9
  }, never>;
@@ -13,4 +11,4 @@ declare const StyledFooter: import("styled-components").StyledComponent<"div", a
13
11
  declare const StyledNote: import("styled-components").StyledComponent<"div", any, {
14
12
  width: number;
15
13
  }, never>;
16
- export { StyledNote, StyledNoteContent, StyledInlineControl, StyledTitle, StyledFooter, StyledFooterContent, };
14
+ export { StyledNote, StyledNoteContent, StyledNoteMain, StyledInlineControl, StyledTitle, StyledFooter, StyledFooterContent, };
@@ -9,10 +9,6 @@ const StyledNoteContent = styled.div`
9
9
  ${({
10
10
  hasPreview
11
11
  }) => css`
12
- &:not(:last-of-type) {
13
- padding-bottom: 24px;
14
- }
15
-
16
12
  div.DraftEditor-root {
17
13
  min-height: inherit;
18
14
  height: 100%;
@@ -34,26 +30,21 @@ const StyledNoteContent = styled.div`
34
30
  margin-top: var(--spacing200);
35
31
  `}
36
32
  `}
37
-
38
- ${({
39
- hasInlineControl
40
- }) => hasInlineControl && "margin-right: 24px;"}
33
+ `;
34
+ const StyledNoteMain = styled.div`
35
+ display: flex;
36
+ justify-content: space-between;
37
+ padding-bottom: var(--spacing300);
41
38
  `;
42
39
  const StyledInlineControl = styled.div`
43
- position: absolute;
44
- top: 24px;
45
- right: 16px;
46
- z-index: 100;
40
+ display: inline-block;
41
+ min-width: fit-content;
47
42
  `;
48
43
  const StyledTitle = styled.header`
49
44
  font-weight: 900;
50
45
  font-size: 16px;
51
46
  line-height: 21px;
52
47
  padding-bottom: 16px;
53
-
54
- ${({
55
- hasInlineControl
56
- }) => hasInlineControl && "margin-right: 24px;"}
57
48
  `;
58
49
  const StyledFooterContent = styled.div`
59
50
  line-height: 21px;
@@ -137,4 +128,4 @@ const StyledNote = styled.div`
137
128
  StyledNote.defaultProps = {
138
129
  theme: baseTheme
139
130
  };
140
- export { StyledNote, StyledNoteContent, StyledInlineControl, StyledTitle, StyledFooter, StyledFooterContent };
131
+ export { StyledNote, StyledNoteContent, StyledNoteMain, StyledInlineControl, StyledTitle, StyledFooter, StyledFooterContent };
@@ -10,6 +10,7 @@ const StyledTitleContent = styled.span`
10
10
  display: inline-block;
11
11
  line-height: 20px;
12
12
  margin: 0;
13
+ position: relative;
13
14
 
14
15
  ${({
15
16
  hasCustomLayout,
@@ -109,6 +110,7 @@ const StyledTitleContent = styled.span`
109
110
  ${(warning || info) && css`
110
111
  outline: 1px solid;
111
112
  outline-offset: -1px;
113
+ z-index: 2;
112
114
 
113
115
  ${info && !warning && css`
114
116
  outline-color: var(--colorsSemanticInfo500);
@@ -157,6 +159,7 @@ const StyledTitleContent = styled.span`
157
159
  ${error && css`
158
160
  outline: 2px solid var(--colorsSemanticNegative500);
159
161
  outline-offset: -2px;
162
+ z-index: 2;
160
163
 
161
164
  ${position === "top" && css`
162
165
  border-bottom-color: transparent;
@@ -319,7 +322,7 @@ const tabTitleStyles = css`
319
322
  ${({
320
323
  theme
321
324
  }) => `${!theme.focusRedesignOptOut ? addFocusStyling() : /* istanbul ignore next */oldFocusStyling}`}
322
- z-index: 2;
325
+ z-index: 3;
323
326
 
324
327
  ${isInSidebar && css`
325
328
  outline-offset: -3px;
@@ -61,20 +61,15 @@ const Note = ({
61
61
  width: width
62
62
  }, rest, {
63
63
  "data-component": "note"
64
- }), title && /*#__PURE__*/_react.default.createElement(_note.StyledTitle, {
65
- hasInlineControl: !!inlineControl
66
- }, title), inlineControl && /*#__PURE__*/_react.default.createElement(_note.StyledInlineControl, null, inlineControl), /*#__PURE__*/_react.default.createElement(_note.StyledNoteContent, {
67
- hasInlineControl: !!inlineControl
68
- }, /*#__PURE__*/_react.default.createElement(_draftJs.Editor, {
64
+ }), /*#__PURE__*/_react.default.createElement(_note.StyledNoteMain, null, /*#__PURE__*/_react.default.createElement(_note.StyledNoteContent, null, title && /*#__PURE__*/_react.default.createElement(_note.StyledTitle, null, title), /*#__PURE__*/_react.default.createElement(_draftJs.Editor, {
69
65
  readOnly: true,
70
66
  editorState: (0, _utils.getDecoratedValue)(noteContent),
71
67
  onChange: /* istanbul ignore next */() => {}
72
- })), _react.default.Children.map(previews, preview => /*#__PURE__*/_react.default.isValidElement(preview) && hasExpectedDisplayName(preview, _linkPreview.default.displayName) ? /*#__PURE__*/_react.default.cloneElement(preview, {
68
+ })), inlineControl && /*#__PURE__*/_react.default.createElement(_note.StyledInlineControl, null, inlineControl)), /*#__PURE__*/_react.default.createElement(_note.StyledNoteContent, null, _react.default.Children.map(previews, preview => /*#__PURE__*/_react.default.isValidElement(preview) && hasExpectedDisplayName(preview, _linkPreview.default.displayName) ? /*#__PURE__*/_react.default.cloneElement(preview, {
73
69
  as: "a",
74
70
  onClose: undefined
75
- }) : preview), createdDate && /*#__PURE__*/_react.default.createElement(_note.StyledNoteContent, {
76
- hasPreview: !!_react.default.Children.count(previews),
77
- hasInlineControl: !!inlineControl
71
+ }) : preview)), createdDate && /*#__PURE__*/_react.default.createElement(_note.StyledNoteContent, {
72
+ hasPreview: !!_react.default.Children.count(previews)
78
73
  }, /*#__PURE__*/_react.default.createElement(_note.StyledFooter, {
79
74
  "data-element": "note-footer"
80
75
  }, name && /*#__PURE__*/_react.default.createElement(_note.StyledFooterContent, {
@@ -1,11 +1,9 @@
1
1
  declare const StyledNoteContent: import("styled-components").StyledComponent<"div", any, {
2
- hasInlineControl: boolean;
3
2
  hasPreview?: boolean | undefined;
4
3
  }, never>;
4
+ declare const StyledNoteMain: import("styled-components").StyledComponent<"div", any, {}, never>;
5
5
  declare const StyledInlineControl: import("styled-components").StyledComponent<"div", any, {}, never>;
6
- declare const StyledTitle: import("styled-components").StyledComponent<"header", any, {
7
- hasInlineControl: boolean;
8
- }, never>;
6
+ declare const StyledTitle: import("styled-components").StyledComponent<"header", any, {}, never>;
9
7
  declare const StyledFooterContent: import("styled-components").StyledComponent<"div", any, {
10
8
  hasName: boolean;
11
9
  }, never>;
@@ -13,4 +11,4 @@ declare const StyledFooter: import("styled-components").StyledComponent<"div", a
13
11
  declare const StyledNote: import("styled-components").StyledComponent<"div", any, {
14
12
  width: number;
15
13
  }, never>;
16
- export { StyledNote, StyledNoteContent, StyledInlineControl, StyledTitle, StyledFooter, StyledFooterContent, };
14
+ export { StyledNote, StyledNoteContent, StyledNoteMain, StyledInlineControl, StyledTitle, StyledFooter, StyledFooterContent, };
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.StyledTitle = exports.StyledNoteContent = exports.StyledNote = exports.StyledInlineControl = exports.StyledFooterContent = exports.StyledFooter = void 0;
6
+ exports.StyledTitle = exports.StyledNoteMain = exports.StyledNoteContent = exports.StyledNote = exports.StyledInlineControl = exports.StyledFooterContent = exports.StyledFooter = 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"));
@@ -18,10 +18,6 @@ const StyledNoteContent = _styledComponents.default.div`
18
18
  ${({
19
19
  hasPreview
20
20
  }) => (0, _styledComponents.css)`
21
- &:not(:last-of-type) {
22
- padding-bottom: 24px;
23
- }
24
-
25
21
  div.DraftEditor-root {
26
22
  min-height: inherit;
27
23
  height: 100%;
@@ -43,17 +39,17 @@ const StyledNoteContent = _styledComponents.default.div`
43
39
  margin-top: var(--spacing200);
44
40
  `}
45
41
  `}
46
-
47
- ${({
48
- hasInlineControl
49
- }) => hasInlineControl && "margin-right: 24px;"}
50
42
  `;
51
43
  exports.StyledNoteContent = StyledNoteContent;
44
+ const StyledNoteMain = _styledComponents.default.div`
45
+ display: flex;
46
+ justify-content: space-between;
47
+ padding-bottom: var(--spacing300);
48
+ `;
49
+ exports.StyledNoteMain = StyledNoteMain;
52
50
  const StyledInlineControl = _styledComponents.default.div`
53
- position: absolute;
54
- top: 24px;
55
- right: 16px;
56
- z-index: 100;
51
+ display: inline-block;
52
+ min-width: fit-content;
57
53
  `;
58
54
  exports.StyledInlineControl = StyledInlineControl;
59
55
  const StyledTitle = _styledComponents.default.header`
@@ -61,10 +57,6 @@ const StyledTitle = _styledComponents.default.header`
61
57
  font-size: 16px;
62
58
  line-height: 21px;
63
59
  padding-bottom: 16px;
64
-
65
- ${({
66
- hasInlineControl
67
- }) => hasInlineControl && "margin-right: 24px;"}
68
60
  `;
69
61
  exports.StyledTitle = StyledTitle;
70
62
  const StyledFooterContent = _styledComponents.default.div`
@@ -19,6 +19,7 @@ const StyledTitleContent = _styledComponents.default.span`
19
19
  display: inline-block;
20
20
  line-height: 20px;
21
21
  margin: 0;
22
+ position: relative;
22
23
 
23
24
  ${({
24
25
  hasCustomLayout,
@@ -118,6 +119,7 @@ const StyledTitleContent = _styledComponents.default.span`
118
119
  ${(warning || info) && (0, _styledComponents.css)`
119
120
  outline: 1px solid;
120
121
  outline-offset: -1px;
122
+ z-index: 2;
121
123
 
122
124
  ${info && !warning && (0, _styledComponents.css)`
123
125
  outline-color: var(--colorsSemanticInfo500);
@@ -166,6 +168,7 @@ const StyledTitleContent = _styledComponents.default.span`
166
168
  ${error && (0, _styledComponents.css)`
167
169
  outline: 2px solid var(--colorsSemanticNegative500);
168
170
  outline-offset: -2px;
171
+ z-index: 2;
169
172
 
170
173
  ${position === "top" && (0, _styledComponents.css)`
171
174
  border-bottom-color: transparent;
@@ -329,7 +332,7 @@ const tabTitleStyles = (0, _styledComponents.css)`
329
332
  ${({
330
333
  theme
331
334
  }) => `${!theme.focusRedesignOptOut ? (0, _addFocusStyling.default)() : /* istanbul ignore next */oldFocusStyling}`}
332
- z-index: 2;
335
+ z-index: 3;
333
336
 
334
337
  ${isInSidebar && (0, _styledComponents.css)`
335
338
  outline-offset: -3px;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-react",
3
- "version": "123.10.1",
3
+ "version": "123.10.3",
4
4
  "description": "A library of reusable React components for easily building user interfaces.",
5
5
  "files": [
6
6
  "lib",