carbon-react 144.3.0 → 144.4.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.
- package/esm/components/note/note.component.d.ts +1 -1
- package/esm/components/note/note.component.js +10 -2
- package/esm/components/note/note.style.d.ts +2 -2
- package/esm/components/note/note.style.js +7 -4
- package/lib/components/note/note.component.d.ts +1 -1
- package/lib/components/note/note.component.js +9 -1
- package/lib/components/note/note.style.d.ts +2 -2
- package/lib/components/note/note.style.js +7 -4
- package/package.json +1 -1
|
@@ -20,7 +20,7 @@ export interface NoteProps extends MarginProps {
|
|
|
20
20
|
timeStamp: string;
|
|
21
21
|
};
|
|
22
22
|
/** Adds a Title to the Note */
|
|
23
|
-
title?:
|
|
23
|
+
title?: React.ReactNode;
|
|
24
24
|
/** Set a percentage-based width for the whole Note component, relative to its parent. */
|
|
25
25
|
width?: number;
|
|
26
26
|
}
|
|
@@ -3,12 +3,13 @@ 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, StyledNoteMain, StyledInlineControl,
|
|
6
|
+
import { StyledNote, StyledNoteContent, StyledNoteMain, StyledInlineControl, StyledTitleWrapper, 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";
|
|
10
10
|
import EditorContext from "../text-editor/__internal__/editor.context";
|
|
11
11
|
import LinkPreview from "../link-preview";
|
|
12
|
+
import Typography from "../typography";
|
|
12
13
|
function hasExpectedDisplayName(child, displayName) {
|
|
13
14
|
return child.type.displayName === displayName;
|
|
14
15
|
}
|
|
@@ -50,7 +51,14 @@ export const Note = ({
|
|
|
50
51
|
width: width
|
|
51
52
|
}, rest, {
|
|
52
53
|
"data-component": "note"
|
|
53
|
-
}), /*#__PURE__*/React.createElement(StyledNoteMain, null, /*#__PURE__*/React.createElement(StyledNoteContent, null, title &&
|
|
54
|
+
}), /*#__PURE__*/React.createElement(StyledNoteMain, null, /*#__PURE__*/React.createElement(StyledNoteContent, null, title && (typeof title === "string" ? /*#__PURE__*/React.createElement(Typography, {
|
|
55
|
+
"data-role": "note-title",
|
|
56
|
+
fontWeight: "700",
|
|
57
|
+
fontSize: "16px",
|
|
58
|
+
lineHeight: "21px",
|
|
59
|
+
paddingBottom: "16px",
|
|
60
|
+
variant: "h2"
|
|
61
|
+
}, title) : /*#__PURE__*/React.createElement(StyledTitleWrapper, null, title)), /*#__PURE__*/React.createElement(Editor, {
|
|
54
62
|
readOnly: true,
|
|
55
63
|
editorState: getDecoratedValue(noteContent),
|
|
56
64
|
onChange: /* istanbul ignore next */() => {}
|
|
@@ -3,7 +3,7 @@ declare const StyledNoteContent: import("styled-components").StyledComponent<"di
|
|
|
3
3
|
}, never>;
|
|
4
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
|
|
6
|
+
declare const StyledTitleWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
7
7
|
declare const StyledFooterContent: import("styled-components").StyledComponent<"div", any, {
|
|
8
8
|
hasName: boolean;
|
|
9
9
|
}, never>;
|
|
@@ -11,4 +11,4 @@ declare const StyledFooter: import("styled-components").StyledComponent<"div", a
|
|
|
11
11
|
declare const StyledNote: import("styled-components").StyledComponent<"div", any, {
|
|
12
12
|
width: number;
|
|
13
13
|
}, never>;
|
|
14
|
-
export { StyledNote, StyledNoteContent, StyledNoteMain, StyledInlineControl,
|
|
14
|
+
export { StyledNote, StyledNoteContent, StyledNoteMain, StyledInlineControl, StyledTitleWrapper, StyledFooter, StyledFooterContent, };
|
|
@@ -2,6 +2,7 @@ import styled, { css } from "styled-components";
|
|
|
2
2
|
import { margin } from "styled-system";
|
|
3
3
|
import baseTheme from "../../style/themes/base";
|
|
4
4
|
import { StyledLinkPreview } from "../link-preview/link-preview.style";
|
|
5
|
+
import { VARIANT_TYPES } from "../typography/typography.component";
|
|
5
6
|
const StyledNoteContent = styled.div`
|
|
6
7
|
position: relative;
|
|
7
8
|
width: 100%;
|
|
@@ -11,13 +12,11 @@ const StyledNoteContent = styled.div`
|
|
|
11
12
|
}) => css`
|
|
12
13
|
div.DraftEditor-root {
|
|
13
14
|
min-height: inherit;
|
|
14
|
-
height: 100%;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
div.DraftEditor-editorContainer,
|
|
18
18
|
div.public-DraftEditor-content {
|
|
19
19
|
min-height: inherit;
|
|
20
|
-
height: 100%;
|
|
21
20
|
background-color: var(--colorsUtilityYang100);
|
|
22
21
|
line-height: 21px;
|
|
23
22
|
}
|
|
@@ -40,11 +39,15 @@ const StyledInlineControl = styled.div`
|
|
|
40
39
|
display: inline-block;
|
|
41
40
|
min-width: fit-content;
|
|
42
41
|
`;
|
|
43
|
-
const
|
|
42
|
+
const StyledTitleWrapper = styled.div`
|
|
43
|
+
${VARIANT_TYPES.map(variant => `
|
|
44
|
+
${variant}{
|
|
44
45
|
font-weight: 700;
|
|
45
46
|
font-size: 16px;
|
|
46
47
|
line-height: 21px;
|
|
47
48
|
padding-bottom: 16px;
|
|
49
|
+
}
|
|
50
|
+
`)}
|
|
48
51
|
`;
|
|
49
52
|
const StyledFooterContent = styled.div`
|
|
50
53
|
line-height: 21px;
|
|
@@ -128,4 +131,4 @@ const StyledNote = styled.div`
|
|
|
128
131
|
StyledNote.defaultProps = {
|
|
129
132
|
theme: baseTheme
|
|
130
133
|
};
|
|
131
|
-
export { StyledNote, StyledNoteContent, StyledNoteMain, StyledInlineControl,
|
|
134
|
+
export { StyledNote, StyledNoteContent, StyledNoteMain, StyledInlineControl, StyledTitleWrapper, StyledFooter, StyledFooterContent };
|
|
@@ -20,7 +20,7 @@ export interface NoteProps extends MarginProps {
|
|
|
20
20
|
timeStamp: string;
|
|
21
21
|
};
|
|
22
22
|
/** Adds a Title to the Note */
|
|
23
|
-
title?:
|
|
23
|
+
title?: React.ReactNode;
|
|
24
24
|
/** Set a percentage-based width for the whole Note component, relative to its parent. */
|
|
25
25
|
width?: number;
|
|
26
26
|
}
|
|
@@ -14,6 +14,7 @@ var _actionPopover = require("../action-popover");
|
|
|
14
14
|
var _utils = require("../text-editor/__internal__/utils");
|
|
15
15
|
var _editor = _interopRequireDefault(require("../text-editor/__internal__/editor.context"));
|
|
16
16
|
var _linkPreview = _interopRequireDefault(require("../link-preview"));
|
|
17
|
+
var _typography = _interopRequireDefault(require("../typography"));
|
|
17
18
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
19
|
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); }
|
|
19
20
|
function hasExpectedDisplayName(child, displayName) {
|
|
@@ -57,7 +58,14 @@ const Note = ({
|
|
|
57
58
|
width: width
|
|
58
59
|
}, rest, {
|
|
59
60
|
"data-component": "note"
|
|
60
|
-
}), /*#__PURE__*/_react.default.createElement(_note.StyledNoteMain, null, /*#__PURE__*/_react.default.createElement(_note.StyledNoteContent, null, title &&
|
|
61
|
+
}), /*#__PURE__*/_react.default.createElement(_note.StyledNoteMain, null, /*#__PURE__*/_react.default.createElement(_note.StyledNoteContent, null, title && (typeof title === "string" ? /*#__PURE__*/_react.default.createElement(_typography.default, {
|
|
62
|
+
"data-role": "note-title",
|
|
63
|
+
fontWeight: "700",
|
|
64
|
+
fontSize: "16px",
|
|
65
|
+
lineHeight: "21px",
|
|
66
|
+
paddingBottom: "16px",
|
|
67
|
+
variant: "h2"
|
|
68
|
+
}, title) : /*#__PURE__*/_react.default.createElement(_note.StyledTitleWrapper, null, title)), /*#__PURE__*/_react.default.createElement(_draftJs.Editor, {
|
|
61
69
|
readOnly: true,
|
|
62
70
|
editorState: (0, _utils.getDecoratedValue)(noteContent),
|
|
63
71
|
onChange: /* istanbul ignore next */() => {}
|
|
@@ -3,7 +3,7 @@ declare const StyledNoteContent: import("styled-components").StyledComponent<"di
|
|
|
3
3
|
}, never>;
|
|
4
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
|
|
6
|
+
declare const StyledTitleWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
7
7
|
declare const StyledFooterContent: import("styled-components").StyledComponent<"div", any, {
|
|
8
8
|
hasName: boolean;
|
|
9
9
|
}, never>;
|
|
@@ -11,4 +11,4 @@ declare const StyledFooter: import("styled-components").StyledComponent<"div", a
|
|
|
11
11
|
declare const StyledNote: import("styled-components").StyledComponent<"div", any, {
|
|
12
12
|
width: number;
|
|
13
13
|
}, never>;
|
|
14
|
-
export { StyledNote, StyledNoteContent, StyledNoteMain, StyledInlineControl,
|
|
14
|
+
export { StyledNote, StyledNoteContent, StyledNoteMain, StyledInlineControl, StyledTitleWrapper, StyledFooter, StyledFooterContent, };
|
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.StyledTitleWrapper = 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"));
|
|
10
10
|
var _linkPreview = require("../link-preview/link-preview.style");
|
|
11
|
+
var _typography = require("../typography/typography.component");
|
|
11
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
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 && {}.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,13 +21,11 @@ const StyledNoteContent = exports.StyledNoteContent = _styledComponents.default.
|
|
|
20
21
|
}) => (0, _styledComponents.css)`
|
|
21
22
|
div.DraftEditor-root {
|
|
22
23
|
min-height: inherit;
|
|
23
|
-
height: 100%;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
div.DraftEditor-editorContainer,
|
|
27
27
|
div.public-DraftEditor-content {
|
|
28
28
|
min-height: inherit;
|
|
29
|
-
height: 100%;
|
|
30
29
|
background-color: var(--colorsUtilityYang100);
|
|
31
30
|
line-height: 21px;
|
|
32
31
|
}
|
|
@@ -49,11 +48,15 @@ const StyledInlineControl = exports.StyledInlineControl = _styledComponents.defa
|
|
|
49
48
|
display: inline-block;
|
|
50
49
|
min-width: fit-content;
|
|
51
50
|
`;
|
|
52
|
-
const
|
|
51
|
+
const StyledTitleWrapper = exports.StyledTitleWrapper = _styledComponents.default.div`
|
|
52
|
+
${_typography.VARIANT_TYPES.map(variant => `
|
|
53
|
+
${variant}{
|
|
53
54
|
font-weight: 700;
|
|
54
55
|
font-size: 16px;
|
|
55
56
|
line-height: 21px;
|
|
56
57
|
padding-bottom: 16px;
|
|
58
|
+
}
|
|
59
|
+
`)}
|
|
57
60
|
`;
|
|
58
61
|
const StyledFooterContent = exports.StyledFooterContent = _styledComponents.default.div`
|
|
59
62
|
line-height: 21px;
|