carbon-react 123.10.1 → 123.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/components/note/note.component.js +5 -10
- package/esm/components/note/note.style.d.ts +3 -5
- package/esm/components/note/note.style.js +8 -17
- package/lib/components/note/note.component.js +4 -9
- package/lib/components/note/note.style.d.ts +3 -5
- package/lib/components/note/note.style.js +9 -17
- package/package.json +1 -1
|
@@ -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
|
-
|
|
40
|
-
|
|
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
|
-
|
|
44
|
-
|
|
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 };
|
|
@@ -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
|
-
|
|
54
|
-
|
|
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`
|