carbon-react 151.2.0 → 151.2.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/date/date.component.d.ts +1 -1
- package/esm/components/text-editor/text-editor.component.d.ts +3 -2
- package/esm/components/text-editor/text-editor.component.js +10 -4
- package/esm/components/text-editor/text-editor.style.d.ts +3 -0
- package/esm/components/text-editor/text-editor.style.js +4 -0
- package/lib/components/date/date.component.d.ts +1 -1
- package/lib/components/text-editor/text-editor.component.d.ts +3 -2
- package/lib/components/text-editor/text-editor.component.js +9 -5
- package/lib/components/text-editor/text-editor.style.d.ts +3 -0
- package/lib/components/text-editor/text-editor.style.js +5 -1
- package/package.json +7 -2
|
@@ -29,7 +29,7 @@ export interface DateInputProps extends Omit<TextboxProps, "value" | "formattedV
|
|
|
29
29
|
value: string;
|
|
30
30
|
/**
|
|
31
31
|
* Pass any props that match the DayPickerProps interface to override default behaviors
|
|
32
|
-
* See [DayPickerProps](https://
|
|
32
|
+
* See [DayPickerProps](https://daypicker.dev/start) for a full list of available props
|
|
33
33
|
* */
|
|
34
34
|
pickerProps?: PickerProps;
|
|
35
35
|
/**
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { MarginProps } from "styled-system";
|
|
3
3
|
import { SaveCallbackProps } from "./__internal__/plugins/Toolbar/buttons/save.component";
|
|
4
|
-
|
|
4
|
+
import { TagProps } from "../../__internal__/utils/helpers/tags";
|
|
5
|
+
export interface TextEditorProps extends MarginProps, TagProps {
|
|
5
6
|
/** The maximum number of characters allowed in the editor */
|
|
6
7
|
characterLimit?: number;
|
|
7
8
|
/** The message to be shown when the editor is in an error state */
|
|
@@ -37,5 +38,5 @@ export interface TextEditorProps extends MarginProps {
|
|
|
37
38
|
/** The initial value of the editor, as a HTML string, or JSON */
|
|
38
39
|
value?: string | undefined;
|
|
39
40
|
}
|
|
40
|
-
export declare const TextEditor: ({ characterLimit, error, inputHint, isOptional, labelText, namespace, onCancel, onChange, onLinkAdded, onSave, placeholder, previews, readOnly, required, rows, warning, value, }: TextEditorProps) => React.JSX.Element;
|
|
41
|
+
export declare const TextEditor: ({ characterLimit, error, inputHint, isOptional, labelText, namespace, onCancel, onChange, onLinkAdded, onSave, placeholder, previews, readOnly, required, rows, warning, value, ...rest }: TextEditorProps) => React.JSX.Element;
|
|
41
42
|
export default TextEditor;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
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); }
|
|
1
2
|
/* eslint-disable no-console */
|
|
2
3
|
import { LexicalComposer } from "@lexical/react/LexicalComposer";
|
|
3
4
|
import { ClickableLinkPlugin } from "@lexical/react/LexicalClickableLinkPlugin";
|
|
@@ -17,9 +18,11 @@ import { COMPONENT_PREFIX, markdownNodes, theme } from "./__internal__/constants
|
|
|
17
18
|
import { validateUrl } from "./__internal__/helpers";
|
|
18
19
|
import { AutoLinkerPlugin, CharacterCounterPlugin, ContentEditor, LinkMonitorPlugin, OnChangePlugin, Placeholder, ToolbarPlugin } from "./__internal__/plugins";
|
|
19
20
|
import TextEditorContext from "./text-editor.context";
|
|
20
|
-
import StyledTextEditor, { StyledEditorToolbarWrapper, StyledValidationMessage, StyledWrapper } from "./text-editor.style";
|
|
21
|
+
import StyledTextEditor, { StyledEditorToolbarWrapper, StyledTextEditorWrapper, StyledValidationMessage, StyledWrapper } from "./text-editor.style";
|
|
21
22
|
import { createEmpty } from "./__internal__";
|
|
22
23
|
import HintText from "../../__internal__/hint-text";
|
|
24
|
+
import { filterStyledSystemMarginProps } from "../../style/utils";
|
|
25
|
+
import tagComponent from "../../__internal__/utils/helpers/tags";
|
|
23
26
|
export const TextEditor = ({
|
|
24
27
|
characterLimit = 3000,
|
|
25
28
|
error,
|
|
@@ -37,7 +40,8 @@ export const TextEditor = ({
|
|
|
37
40
|
required = false,
|
|
38
41
|
rows,
|
|
39
42
|
warning,
|
|
40
|
-
value
|
|
43
|
+
value,
|
|
44
|
+
...rest
|
|
41
45
|
}) => {
|
|
42
46
|
const editorRef = useRef(undefined);
|
|
43
47
|
const locale = useLocale();
|
|
@@ -101,7 +105,9 @@ export const TextEditor = ({
|
|
|
101
105
|
onCancel: onCancel ? handleCancel : undefined,
|
|
102
106
|
onSave
|
|
103
107
|
}), [handleCancel, namespace, onCancel, onSave]);
|
|
104
|
-
return /*#__PURE__*/React.createElement(
|
|
108
|
+
return /*#__PURE__*/React.createElement(StyledTextEditorWrapper, _extends({
|
|
109
|
+
"data-role": `${namespace}-editor-wrapper`
|
|
110
|
+
}, filterStyledSystemMarginProps(rest), tagComponent("text-editor", rest)), /*#__PURE__*/React.createElement(TextEditorContext.Provider, {
|
|
105
111
|
value: {
|
|
106
112
|
onLinkAdded,
|
|
107
113
|
readOnly
|
|
@@ -156,6 +162,6 @@ export const TextEditor = ({
|
|
|
156
162
|
}), /*#__PURE__*/React.createElement(AutoLinkerPlugin, null)), !readOnly && /*#__PURE__*/React.createElement(ToolbarPlugin, toolbarProps), /*#__PURE__*/React.createElement(LinkMonitorPlugin, null)), characterLimit > 0 && !readOnly && /*#__PURE__*/React.createElement(CharacterCounterPlugin, {
|
|
157
163
|
maxChars: characterLimit,
|
|
158
164
|
namespace: namespace
|
|
159
|
-
}))));
|
|
165
|
+
})))));
|
|
160
166
|
};
|
|
161
167
|
export default TextEditor;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { MarginProps } from "styled-system";
|
|
3
|
+
declare type StyledTextEditorWrapperProps = MarginProps;
|
|
2
4
|
interface StyledWrapperProps {
|
|
3
5
|
error?: string;
|
|
4
6
|
namespace: string;
|
|
@@ -11,6 +13,7 @@ interface StyledEditorToolbarWrapperProps {
|
|
|
11
13
|
focused?: boolean;
|
|
12
14
|
}
|
|
13
15
|
export declare const StyledTextEditor: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../box").BoxProps & import("react").RefAttributes<HTMLDivElement>>, any, {}, never>;
|
|
16
|
+
export declare const StyledTextEditorWrapper: import("styled-components").StyledComponent<"div", any, StyledTextEditorWrapperProps, never>;
|
|
14
17
|
export declare const StyledWrapper: import("styled-components").StyledComponent<"div", any, StyledWrapperProps, never>;
|
|
15
18
|
export declare const StyledEditorToolbarWrapper: import("styled-components").StyledComponent<"div", any, StyledEditorToolbarWrapperProps, never>;
|
|
16
19
|
export declare const StyledValidationMessage: import("styled-components").StyledComponent<"div", any, StyledValidationMessageProps, never>;
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import styled, { css } from "styled-components";
|
|
2
|
+
import { margin } from "styled-system";
|
|
2
3
|
import Box from "../box";
|
|
3
4
|
import addFocusStyling from "../../style/utils/add-focus-styling";
|
|
4
5
|
export const StyledTextEditor = styled(Box)`
|
|
5
6
|
position: relative;
|
|
6
7
|
`;
|
|
8
|
+
export const StyledTextEditorWrapper = styled.div`
|
|
9
|
+
${margin}
|
|
10
|
+
`;
|
|
7
11
|
export const StyledWrapper = styled.div`
|
|
8
12
|
${({
|
|
9
13
|
error,
|
|
@@ -29,7 +29,7 @@ export interface DateInputProps extends Omit<TextboxProps, "value" | "formattedV
|
|
|
29
29
|
value: string;
|
|
30
30
|
/**
|
|
31
31
|
* Pass any props that match the DayPickerProps interface to override default behaviors
|
|
32
|
-
* See [DayPickerProps](https://
|
|
32
|
+
* See [DayPickerProps](https://daypicker.dev/start) for a full list of available props
|
|
33
33
|
* */
|
|
34
34
|
pickerProps?: PickerProps;
|
|
35
35
|
/**
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { MarginProps } from "styled-system";
|
|
3
3
|
import { SaveCallbackProps } from "./__internal__/plugins/Toolbar/buttons/save.component";
|
|
4
|
-
|
|
4
|
+
import { TagProps } from "../../__internal__/utils/helpers/tags";
|
|
5
|
+
export interface TextEditorProps extends MarginProps, TagProps {
|
|
5
6
|
/** The maximum number of characters allowed in the editor */
|
|
6
7
|
characterLimit?: number;
|
|
7
8
|
/** The message to be shown when the editor is in an error state */
|
|
@@ -37,5 +38,5 @@ export interface TextEditorProps extends MarginProps {
|
|
|
37
38
|
/** The initial value of the editor, as a HTML string, or JSON */
|
|
38
39
|
value?: string | undefined;
|
|
39
40
|
}
|
|
40
|
-
export declare const TextEditor: ({ characterLimit, error, inputHint, isOptional, labelText, namespace, onCancel, onChange, onLinkAdded, onSave, placeholder, previews, readOnly, required, rows, warning, value, }: TextEditorProps) => React.JSX.Element;
|
|
41
|
+
export declare const TextEditor: ({ characterLimit, error, inputHint, isOptional, labelText, namespace, onCancel, onChange, onLinkAdded, onSave, placeholder, previews, readOnly, required, rows, warning, value, ...rest }: TextEditorProps) => React.JSX.Element;
|
|
41
42
|
export default TextEditor;
|
|
@@ -25,11 +25,12 @@ var _textEditor = _interopRequireDefault(require("./text-editor.context"));
|
|
|
25
25
|
var _textEditor2 = _interopRequireWildcard(require("./text-editor.style"));
|
|
26
26
|
var _internal__ = require("./__internal__");
|
|
27
27
|
var _hintText = _interopRequireDefault(require("../../__internal__/hint-text"));
|
|
28
|
+
var _utils = require("../../style/utils");
|
|
29
|
+
var _tags = _interopRequireDefault(require("../../__internal__/utils/helpers/tags"));
|
|
28
30
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
29
31
|
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); }
|
|
30
32
|
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; }
|
|
31
|
-
/* eslint-disable no-console */
|
|
32
|
-
|
|
33
|
+
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); } /* eslint-disable no-console */
|
|
33
34
|
const TextEditor = ({
|
|
34
35
|
characterLimit = 3000,
|
|
35
36
|
error,
|
|
@@ -47,7 +48,8 @@ const TextEditor = ({
|
|
|
47
48
|
required = false,
|
|
48
49
|
rows,
|
|
49
50
|
warning,
|
|
50
|
-
value
|
|
51
|
+
value,
|
|
52
|
+
...rest
|
|
51
53
|
}) => {
|
|
52
54
|
const editorRef = (0, _react.useRef)(undefined);
|
|
53
55
|
const locale = (0, _useLocale.default)();
|
|
@@ -111,7 +113,9 @@ const TextEditor = ({
|
|
|
111
113
|
onCancel: onCancel ? handleCancel : undefined,
|
|
112
114
|
onSave
|
|
113
115
|
}), [handleCancel, namespace, onCancel, onSave]);
|
|
114
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
116
|
+
return /*#__PURE__*/_react.default.createElement(_textEditor2.StyledTextEditorWrapper, _extends({
|
|
117
|
+
"data-role": `${namespace}-editor-wrapper`
|
|
118
|
+
}, (0, _utils.filterStyledSystemMarginProps)(rest), (0, _tags.default)("text-editor", rest)), /*#__PURE__*/_react.default.createElement(_textEditor.default.Provider, {
|
|
115
119
|
value: {
|
|
116
120
|
onLinkAdded,
|
|
117
121
|
readOnly
|
|
@@ -166,7 +170,7 @@ const TextEditor = ({
|
|
|
166
170
|
}), /*#__PURE__*/_react.default.createElement(_plugins.AutoLinkerPlugin, null)), !readOnly && /*#__PURE__*/_react.default.createElement(_plugins.ToolbarPlugin, toolbarProps), /*#__PURE__*/_react.default.createElement(_plugins.LinkMonitorPlugin, null)), characterLimit > 0 && !readOnly && /*#__PURE__*/_react.default.createElement(_plugins.CharacterCounterPlugin, {
|
|
167
171
|
maxChars: characterLimit,
|
|
168
172
|
namespace: namespace
|
|
169
|
-
}))));
|
|
173
|
+
})))));
|
|
170
174
|
};
|
|
171
175
|
exports.TextEditor = TextEditor;
|
|
172
176
|
var _default = exports.default = TextEditor;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { MarginProps } from "styled-system";
|
|
3
|
+
declare type StyledTextEditorWrapperProps = MarginProps;
|
|
2
4
|
interface StyledWrapperProps {
|
|
3
5
|
error?: string;
|
|
4
6
|
namespace: string;
|
|
@@ -11,6 +13,7 @@ interface StyledEditorToolbarWrapperProps {
|
|
|
11
13
|
focused?: boolean;
|
|
12
14
|
}
|
|
13
15
|
export declare const StyledTextEditor: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../box").BoxProps & import("react").RefAttributes<HTMLDivElement>>, any, {}, never>;
|
|
16
|
+
export declare const StyledTextEditorWrapper: import("styled-components").StyledComponent<"div", any, StyledTextEditorWrapperProps, never>;
|
|
14
17
|
export declare const StyledWrapper: import("styled-components").StyledComponent<"div", any, StyledWrapperProps, never>;
|
|
15
18
|
export declare const StyledEditorToolbarWrapper: import("styled-components").StyledComponent<"div", any, StyledEditorToolbarWrapperProps, never>;
|
|
16
19
|
export declare const StyledValidationMessage: import("styled-components").StyledComponent<"div", any, StyledValidationMessageProps, never>;
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = exports.StyledWrapper = exports.StyledValidationMessage = exports.StyledTextEditor = exports.StyledEditorToolbarWrapper = void 0;
|
|
6
|
+
exports.default = exports.StyledWrapper = exports.StyledValidationMessage = exports.StyledTextEditorWrapper = exports.StyledTextEditor = exports.StyledEditorToolbarWrapper = void 0;
|
|
7
7
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
8
|
+
var _styledSystem = require("styled-system");
|
|
8
9
|
var _box = _interopRequireDefault(require("../box"));
|
|
9
10
|
var _addFocusStyling = _interopRequireDefault(require("../../style/utils/add-focus-styling"));
|
|
10
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -13,6 +14,9 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
13
14
|
const StyledTextEditor = exports.StyledTextEditor = (0, _styledComponents.default)(_box.default)`
|
|
14
15
|
position: relative;
|
|
15
16
|
`;
|
|
17
|
+
const StyledTextEditorWrapper = exports.StyledTextEditorWrapper = _styledComponents.default.div`
|
|
18
|
+
${_styledSystem.margin}
|
|
19
|
+
`;
|
|
16
20
|
const StyledWrapper = exports.StyledWrapper = _styledComponents.default.div`
|
|
17
21
|
${({
|
|
18
22
|
error,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "carbon-react",
|
|
3
|
-
"version": "151.2.
|
|
3
|
+
"version": "151.2.2",
|
|
4
4
|
"description": "A library of reusable React components for easily building user interfaces.",
|
|
5
5
|
"files": [
|
|
6
6
|
"lib",
|
|
@@ -32,7 +32,10 @@
|
|
|
32
32
|
"test:ct": "playwright test -c playwright-ct.config.ts",
|
|
33
33
|
"test:ct:ui": "playwright test --ui -c playwright-ct.config.ts",
|
|
34
34
|
"test:ct:report": "npx playwright show-report",
|
|
35
|
-
"clear-playwright-cache": "rimraf ./playwright/.cache"
|
|
35
|
+
"clear-playwright-cache": "rimraf ./playwright/.cache",
|
|
36
|
+
"clear-playwright-coverage-json": "rimraf ./playwright/coverage/*.json",
|
|
37
|
+
"test:ct:coverage": "npm run clear-playwright-cache && npm run clear-playwright-coverage-json && rimraf ./playwright/coverage && playwright test -c playwright-ct.config.ts",
|
|
38
|
+
"pw:coverage:report": "nyc report --reporter=html --report-dir=./playwright/coverage --temp-dir=./playwright/coverage"
|
|
36
39
|
},
|
|
37
40
|
"repository": {
|
|
38
41
|
"type": "git",
|
|
@@ -181,6 +184,8 @@
|
|
|
181
184
|
"invariant": "^2.2.4",
|
|
182
185
|
"lexical": "^0.21.0",
|
|
183
186
|
"lodash": "^4.17.21",
|
|
187
|
+
"monocart-coverage-reports": "^2.11.4",
|
|
188
|
+
"nyc": "^17.1.0",
|
|
184
189
|
"polished": "^4.2.2",
|
|
185
190
|
"prop-types": "^15.8.1",
|
|
186
191
|
"react-day-picker": "^9.3.2",
|