carbon-react 118.2.0 → 118.3.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.
Files changed (126) hide show
  1. package/esm/components/button-minor/button-minor.component.d.ts +5 -1
  2. package/esm/components/button-minor/button-minor.component.js +4 -1
  3. package/esm/components/button-minor/button-minor.style.d.ts +2 -1
  4. package/esm/components/button-minor/button-minor.style.js +17 -0
  5. package/esm/components/button-minor/index.d.ts +1 -1
  6. package/esm/components/i18n-provider/i18n-provider.component.js +4 -0
  7. package/esm/components/menu/menu-full-screen/menu-full-screen.component.js +18 -0
  8. package/esm/components/menu/menu-item/menu-item.component.js +1 -1
  9. package/esm/components/menu/menu-item/menu-item.style.js +13 -11
  10. package/esm/components/password/index.d.ts +2 -0
  11. package/esm/components/password/index.js +1 -0
  12. package/esm/components/password/password.component.d.ts +9 -0
  13. package/esm/components/password/password.component.js +580 -0
  14. package/esm/components/password/password.style.d.ts +5 -0
  15. package/esm/components/password/password.style.js +8 -0
  16. package/esm/components/text-editor/__internal__/decorators/index.d.ts +2 -2
  17. package/esm/components/text-editor/__internal__/decorators/link-decorator.d.ts +7 -6
  18. package/esm/components/text-editor/__internal__/editor-counter/editor-counter.component.d.ts +15 -0
  19. package/esm/components/text-editor/__internal__/editor-counter/editor-counter.component.js +5 -15
  20. package/esm/components/text-editor/__internal__/editor-counter/editor-counter.style.d.ts +5 -0
  21. package/esm/components/text-editor/__internal__/editor-counter/index.d.ts +2 -2
  22. package/esm/components/text-editor/__internal__/editor-link/editor-link.component.d.ts +9 -0
  23. package/esm/components/text-editor/__internal__/editor-link/editor-link.component.js +3 -4
  24. package/esm/components/text-editor/__internal__/editor-link/editor-link.style.d.ts +3 -0
  25. package/esm/components/text-editor/__internal__/editor-link/index.d.ts +2 -2
  26. package/esm/components/text-editor/__internal__/label-wrapper/index.d.ts +2 -2
  27. package/esm/components/text-editor/__internal__/label-wrapper/label-wrapper.component.d.ts +12 -0
  28. package/esm/components/text-editor/__internal__/label-wrapper/label-wrapper.component.js +4 -3
  29. package/esm/components/text-editor/__internal__/toolbar/index.d.ts +2 -2
  30. package/esm/components/text-editor/__internal__/toolbar/toolbar-button/index.d.ts +2 -2
  31. package/esm/components/text-editor/__internal__/toolbar/toolbar-button/toolbar-button.component.d.ts +25 -0
  32. package/esm/components/text-editor/__internal__/toolbar/toolbar-button/toolbar-button.component.js +12 -23
  33. package/esm/components/text-editor/__internal__/toolbar/toolbar-button/toolbar-button.style.d.ts +6 -0
  34. package/esm/components/text-editor/__internal__/toolbar/toolbar.component.d.ts +16 -0
  35. package/esm/components/text-editor/__internal__/toolbar/toolbar.component.js +40 -36
  36. package/esm/components/text-editor/__internal__/toolbar/toolbar.style.d.ts +4 -0
  37. package/esm/components/text-editor/__internal__/utils/index.d.ts +1 -1
  38. package/esm/components/text-editor/__internal__/utils/utils.d.ts +27 -26
  39. package/esm/components/text-editor/__internal__/utils/utils.js +9 -10
  40. package/esm/components/text-editor/index.d.ts +2 -2
  41. package/esm/components/text-editor/text-editor.component.d.ts +36 -7
  42. package/esm/components/text-editor/text-editor.component.js +230 -87
  43. package/esm/components/text-editor/text-editor.style.d.ts +11 -3
  44. package/esm/components/text-editor/text-editor.style.js +1 -2
  45. package/esm/components/text-editor/types.d.ts +6 -0
  46. package/esm/components/text-editor/types.js +4 -0
  47. package/esm/components/textbox/textbox.component.js +1 -1
  48. package/esm/{__internal__/utils/helpers → hooks/__internal__}/useUniqueId/index.js +1 -1
  49. package/esm/locales/en-gb.js +4 -0
  50. package/esm/locales/locale.d.ts +4 -0
  51. package/esm/locales/pl-pl.js +4 -0
  52. package/lib/components/button-minor/button-minor.component.d.ts +5 -1
  53. package/lib/components/button-minor/button-minor.component.js +4 -1
  54. package/lib/components/button-minor/button-minor.style.d.ts +2 -1
  55. package/lib/components/button-minor/button-minor.style.js +17 -0
  56. package/lib/components/button-minor/index.d.ts +1 -1
  57. package/lib/components/i18n-provider/i18n-provider.component.js +4 -0
  58. package/lib/components/menu/menu-full-screen/menu-full-screen.component.js +18 -0
  59. package/lib/components/menu/menu-item/menu-item.component.js +1 -1
  60. package/lib/components/menu/menu-item/menu-item.style.js +13 -11
  61. package/lib/components/password/index.d.ts +2 -0
  62. package/lib/components/password/index.js +15 -0
  63. package/lib/components/password/package.json +6 -0
  64. package/lib/components/password/password.component.d.ts +9 -0
  65. package/lib/components/password/password.component.js +600 -0
  66. package/lib/components/password/password.style.d.ts +5 -0
  67. package/lib/components/password/password.style.js +21 -0
  68. package/lib/components/text-editor/__internal__/decorators/index.d.ts +2 -2
  69. package/lib/components/text-editor/__internal__/decorators/link-decorator.d.ts +7 -6
  70. package/lib/components/text-editor/__internal__/editor-counter/editor-counter.component.d.ts +15 -0
  71. package/lib/components/text-editor/__internal__/editor-counter/editor-counter.component.js +5 -15
  72. package/lib/components/text-editor/__internal__/editor-counter/editor-counter.style.d.ts +5 -0
  73. package/lib/components/text-editor/__internal__/editor-counter/index.d.ts +2 -2
  74. package/lib/components/text-editor/__internal__/editor-link/editor-link.component.d.ts +9 -0
  75. package/lib/components/text-editor/__internal__/editor-link/editor-link.component.js +3 -4
  76. package/lib/components/text-editor/__internal__/editor-link/editor-link.style.d.ts +3 -0
  77. package/lib/components/text-editor/__internal__/editor-link/index.d.ts +2 -2
  78. package/lib/components/text-editor/__internal__/label-wrapper/index.d.ts +2 -2
  79. package/lib/components/text-editor/__internal__/label-wrapper/label-wrapper.component.d.ts +12 -0
  80. package/lib/components/text-editor/__internal__/label-wrapper/label-wrapper.component.js +2 -8
  81. package/lib/components/text-editor/__internal__/toolbar/index.d.ts +2 -2
  82. package/lib/components/text-editor/__internal__/toolbar/toolbar-button/index.d.ts +2 -2
  83. package/lib/components/text-editor/__internal__/toolbar/toolbar-button/toolbar-button.component.d.ts +25 -0
  84. package/lib/components/text-editor/__internal__/toolbar/toolbar-button/toolbar-button.component.js +13 -24
  85. package/lib/components/text-editor/__internal__/toolbar/toolbar-button/toolbar-button.style.d.ts +6 -0
  86. package/lib/components/text-editor/__internal__/toolbar/toolbar.component.d.ts +16 -0
  87. package/lib/components/text-editor/__internal__/toolbar/toolbar.component.js +50 -46
  88. package/lib/components/text-editor/__internal__/toolbar/toolbar.style.d.ts +4 -0
  89. package/lib/components/text-editor/__internal__/utils/index.d.ts +1 -1
  90. package/lib/components/text-editor/__internal__/utils/utils.d.ts +27 -26
  91. package/lib/components/text-editor/__internal__/utils/utils.js +10 -11
  92. package/lib/components/text-editor/index.d.ts +2 -2
  93. package/lib/components/text-editor/text-editor.component.d.ts +36 -7
  94. package/lib/components/text-editor/text-editor.component.js +231 -88
  95. package/lib/components/text-editor/text-editor.style.d.ts +11 -3
  96. package/lib/components/text-editor/text-editor.style.js +1 -2
  97. package/lib/components/text-editor/types.d.ts +6 -0
  98. package/lib/components/text-editor/types.js +14 -0
  99. package/lib/components/textbox/textbox.component.js +1 -1
  100. package/lib/{__internal__/utils/helpers → hooks/__internal__}/useUniqueId/index.js +1 -1
  101. package/lib/hooks/__internal__/useUniqueId/package.json +6 -0
  102. package/lib/locales/en-gb.js +4 -0
  103. package/lib/locales/locale.d.ts +4 -0
  104. package/lib/locales/pl-pl.js +4 -0
  105. package/package.json +4 -4
  106. package/esm/__internal__/DeprecationWarning.js +0 -20
  107. package/esm/__internal__/utils/storybook/partial-action.d.ts +0 -3
  108. package/esm/__internal__/utils/storybook/partial-action.js +0 -13
  109. package/esm/components/text-editor/__internal__/editor-counter/editor-counter.d.ts +0 -11
  110. package/esm/components/text-editor/__internal__/editor-link/editor-link.d.ts +0 -11
  111. package/esm/components/text-editor/__internal__/label-wrapper/label-wrapper.d.ts +0 -10
  112. package/esm/components/text-editor/__internal__/toolbar/toolbar-button/toolbar-button.d.ts +0 -20
  113. package/esm/components/text-editor/__internal__/toolbar/toolbar.d.ts +0 -13
  114. package/esm/components/text-editor/text-editor.d.ts +0 -40
  115. package/lib/__internal__/DeprecationWarning.js +0 -31
  116. package/lib/__internal__/utils/helpers/useUniqueId/package.json +0 -6
  117. package/lib/__internal__/utils/storybook/partial-action.d.ts +0 -3
  118. package/lib/__internal__/utils/storybook/partial-action.js +0 -21
  119. package/lib/components/text-editor/__internal__/editor-counter/editor-counter.d.ts +0 -11
  120. package/lib/components/text-editor/__internal__/editor-link/editor-link.d.ts +0 -11
  121. package/lib/components/text-editor/__internal__/label-wrapper/label-wrapper.d.ts +0 -10
  122. package/lib/components/text-editor/__internal__/toolbar/toolbar-button/toolbar-button.d.ts +0 -20
  123. package/lib/components/text-editor/__internal__/toolbar/toolbar.d.ts +0 -13
  124. package/lib/components/text-editor/text-editor.d.ts +0 -40
  125. /package/esm/{__internal__/utils/helpers → hooks/__internal__}/useUniqueId/index.d.ts +0 -0
  126. /package/lib/{__internal__/utils/helpers → hooks/__internal__}/useUniqueId/index.d.ts +0 -0
@@ -1,7 +1,6 @@
1
1
  import React, { useCallback, useEffect, useRef, useState } from "react";
2
2
  import PropTypes from "prop-types";
3
- import styledSystemPropTypes from "@styled-system/prop-types";
4
- import { ContentState, EditorState, Editor, RichUtils, getDefaultKeyBinding, Modifier } from "draft-js";
3
+ import { ContentState, EditorState, RichUtils, getDefaultKeyBinding, Modifier, Editor } from "draft-js";
5
4
  import { computeBlockType, getContent, getContentInfo, getDecoratedValue, getSelectedLength, moveSelectionToEnd, resetBlockType, isASCIIChar, replaceText, hasInlineStyle, hasBlockStyle, blockStyleFn } from "./__internal__/utils";
6
5
  import { StyledEditorWrapper, StyledEditorOutline, StyledEditorContainer } from "./text-editor.style";
7
6
  import Counter from "./__internal__/editor-counter";
@@ -10,11 +9,9 @@ import Label from "../../__internal__/label";
10
9
  import Events from "../../__internal__/utils/helpers/events";
11
10
  import createGuid from "../../__internal__/utils/helpers/guid";
12
11
  import LabelWrapper from "./__internal__/label-wrapper";
13
- import { filterStyledSystemMarginProps } from "../../style/utils";
14
- const marginPropTypes = filterStyledSystemMarginProps(styledSystemPropTypes.space);
12
+ import { BOLD, ITALIC, UNORDERED_LIST, ORDERED_LIST } from "./types";
15
13
  const NUMBERS = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"];
16
- const INLINE_STYLES = ["BOLD", "ITALIC"];
17
- const BLOCK_TYPES = ["unordered-list-item", "ordered-list-item"];
14
+ const INLINE_STYLES = [BOLD, ITALIC];
18
15
  export const EditorContext = /*#__PURE__*/React.createContext({});
19
16
  const TextEditor = /*#__PURE__*/React.forwardRef(({
20
17
  characterLimit = 3000,
@@ -35,13 +32,18 @@ const TextEditor = /*#__PURE__*/React.forwardRef(({
35
32
  const [inlines, setInlines] = useState([]);
36
33
  const [activeInlines, setActiveInlines] = useState({});
37
34
  const [focusToolbar, setFocusToolbar] = useState(false);
38
- const editorRef = useRef();
35
+ const editorRef = useRef(null);
39
36
  const editor = ref || editorRef;
40
37
  const contentLength = getContent(value).getPlainText("").length;
41
38
  const moveCursor = useRef(contentLength > 0);
42
39
  const lastKeyPressed = useRef();
43
40
  const labelId = useRef(`text-editor-label-${createGuid()}`);
44
41
 
42
+ if (rows && (typeof rows !== "number" || rows < 2)) {
43
+ // eslint-disable-next-line no-console
44
+ console.warn(`Prop rows must be a number value that is 2 or greater to override the min-height of the \`${TextEditor.displayName}\``);
45
+ }
46
+
45
47
  const keyBindingFn = ev => {
46
48
  if (Events.isTabKey(ev) && !Events.isShiftKey(ev)) {
47
49
  setFocusToolbar(true);
@@ -50,6 +52,8 @@ const TextEditor = /*#__PURE__*/React.forwardRef(({
50
52
  return getDefaultKeyBinding(ev);
51
53
  };
52
54
 
55
+ const BLOCK_TYPES = ["unordered-list-item", "ordered-list-item"];
56
+
53
57
  const handleKeyCommand = command => {
54
58
  // bail out if the enter is pressed and limit has been reached
55
59
  if (command.includes("split-block") && contentLength === characterLimit) {
@@ -59,27 +63,31 @@ const TextEditor = /*#__PURE__*/React.forwardRef(({
59
63
 
60
64
  if (command.includes("backspace") || command.includes("split-block")) {
61
65
  const {
62
- blockType,
63
- blockLength
66
+ blockLength,
67
+ blockType
64
68
  } = getContentInfo(value); // if a block control is active and there is no text, deactivate it and reset the block
65
69
 
66
70
  if (BLOCK_TYPES.includes(blockType) && !blockLength) {
67
71
  onChange(resetBlockType(value, "unstyled"));
68
- return true;
72
+ return "handled";
69
73
  }
70
74
  }
71
75
 
72
76
  const style = command.toUpperCase(); // if formatting shortcut used eg. command is "bold" or "italic"
73
77
 
74
- if (INLINE_STYLES.includes(style)) {
75
- onChange(RichUtils.handleKeyCommand(value, command));
76
- setActiveInlines({ ...activeInlines,
77
- [style]: !hasInlineStyle(value, style)
78
- });
79
- return true;
78
+ if (style === BOLD || style === ITALIC) {
79
+ const update = RichUtils.handleKeyCommand(value, command); // istanbul ignore else
80
+
81
+ if (update) {
82
+ onChange(update);
83
+ setActiveInlines({ ...activeInlines,
84
+ [style]: !hasInlineStyle(value, style)
85
+ });
86
+ return "handled";
87
+ }
80
88
  }
81
89
 
82
- return false;
90
+ return "not-handled";
83
91
  };
84
92
 
85
93
  const handleBeforeInput = (str, newState) => {
@@ -93,19 +101,19 @@ const TextEditor = /*#__PURE__*/React.forwardRef(({
93
101
 
94
102
  if (lastKeyPressed.current === " " && !isASCIIChar(str)) {
95
103
  lastKeyPressed.current = null;
96
- onChange(replaceText(newState, " ", newState.getCurrentInlineStyle(), true));
104
+ onChange(replaceText(newState, " ", newState.getCurrentInlineStyle()));
97
105
  return "handled";
98
106
  }
99
107
 
100
108
  if (str === " ") {
101
109
  lastKeyPressed.current = str;
102
- return false;
110
+ return "not-handled";
103
111
  }
104
112
 
105
113
  lastKeyPressed.current = null; // short circuit if str does not match expected chars
106
114
 
107
115
  if (![".", "*"].includes(str)) {
108
- return false;
116
+ return "not-handled";
109
117
  }
110
118
 
111
119
  const {
@@ -116,21 +124,21 @@ const TextEditor = /*#__PURE__*/React.forwardRef(({
116
124
 
117
125
  if (blockLength === 1 && NUMBERS.includes(blockText) && str === "." || blockLength === 0 && str === "*") {
118
126
  const newBlockType = computeBlockType(str, blockType);
119
- const hasNumberList = hasBlockStyle(value, BLOCK_TYPES[0]);
120
- const hasBulletList = hasBlockStyle(value, BLOCK_TYPES[1]);
127
+ const hasNumberList = hasBlockStyle(value, ORDERED_LIST);
128
+ const hasBulletList = hasBlockStyle(value, UNORDERED_LIST);
121
129
 
122
130
  if (BLOCK_TYPES.includes(newBlockType) && !hasNumberList && !hasBulletList) {
123
131
  onChange(resetBlockType(value, newBlockType));
124
132
  setActiveInlines({
125
- BOLD: hasInlineStyle(value, INLINE_STYLES[0]),
126
- ITALIC: hasInlineStyle(value, INLINE_STYLES[1])
133
+ BOLD: hasInlineStyle(value, BOLD),
134
+ ITALIC: hasInlineStyle(value, ITALIC)
127
135
  });
128
- return true;
136
+ return "handled";
129
137
  }
130
138
  }
131
139
 
132
140
  onChange(value);
133
- return false;
141
+ return "not-handled";
134
142
  };
135
143
 
136
144
  const handlePastedText = pastedText => {
@@ -161,17 +169,19 @@ const TextEditor = /*#__PURE__*/React.forwardRef(({
161
169
 
162
170
  const editorState = getEditorState();
163
171
  const activeControls = {
164
- BOLD: activeInlines.BOLD !== undefined ? activeInlines.BOLD : hasInlineStyle(editorState, INLINE_STYLES[0]),
165
- ITALIC: activeInlines.ITALIC !== undefined ? activeInlines.ITALIC : hasInlineStyle(editorState, INLINE_STYLES[1]),
166
- "unordered-list-item": hasBlockStyle(editorState, BLOCK_TYPES[0]),
167
- "ordered-list-item": hasBlockStyle(editorState, BLOCK_TYPES[1])
172
+ BOLD: activeInlines.BOLD !== undefined ? activeInlines.BOLD : hasInlineStyle(editorState, BOLD),
173
+ ITALIC: activeInlines.ITALIC !== undefined ? activeInlines.ITALIC : hasInlineStyle(editorState, ITALIC),
174
+ "unordered-list-item": hasBlockStyle(editorState, UNORDERED_LIST),
175
+ "ordered-list-item": hasBlockStyle(editorState, ORDERED_LIST)
168
176
  };
169
177
  const handleEditorFocus = useCallback(focusValue => {
170
178
  moveCursor.current = true;
171
179
  setIsFocused(focusValue);
172
180
 
173
- if (!isFocused && focusValue && editor.current !== document.activeElement) {
174
- editor.current.focus();
181
+ if (!isFocused && focusValue && typeof editor === "object" && editor.current !== document.activeElement) {
182
+ var _editor$current;
183
+
184
+ (_editor$current = editor.current) === null || _editor$current === void 0 ? void 0 : _editor$current.focus();
175
185
  setFocusToolbar(false);
176
186
  }
177
187
  }, [editor, isFocused]);
@@ -218,8 +228,14 @@ const TextEditor = /*#__PURE__*/React.forwardRef(({
218
228
  }, [activeInlines, contentLength, editorState, inlines, isFocused, onChange, value]);
219
229
 
220
230
  const handlePreviewClose = (onClose, url) => {
221
- onClose(url);
222
- editor.current.focus();
231
+ // istanbul ignore else
232
+ if (url) onClose(url); // istanbul ignore else
233
+
234
+ if (typeof editor === "object") {
235
+ var _editor$current2;
236
+
237
+ (_editor$current2 = editor.current) === null || _editor$current2 === void 0 ? void 0 : _editor$current2.focus();
238
+ }
223
239
  };
224
240
 
225
241
  return /*#__PURE__*/React.createElement(EditorContext.Provider, {
@@ -237,7 +253,6 @@ const TextEditor = /*#__PURE__*/React.forwardRef(({
237
253
  hasError: !!error
238
254
  }, /*#__PURE__*/React.createElement(StyledEditorContainer, {
239
255
  "data-component": "text-editor-container",
240
- ariaLabelledBy: labelId.current,
241
256
  hasError: !!error,
242
257
  rows: rows,
243
258
  hasPreview: !!React.Children.count(previews)
@@ -262,66 +277,194 @@ const TextEditor = /*#__PURE__*/React.forwardRef(({
262
277
  keyBindingFn: keyBindingFn,
263
278
  tabIndex: 0
264
279
  }), React.Children.map(previews, preview => {
265
- const {
266
- onClose
267
- } = preview.props;
268
- return /*#__PURE__*/React.cloneElement(preview, {
269
- as: "div",
270
- onClose: onClose ? url => handlePreviewClose(onClose, url) : undefined
271
- });
280
+ if ( /*#__PURE__*/React.isValidElement(preview)) {
281
+ const {
282
+ onClose
283
+ } = preview === null || preview === void 0 ? void 0 : preview.props;
284
+ return /*#__PURE__*/React.cloneElement(preview, {
285
+ as: "div",
286
+ onClose: onClose ? url => handlePreviewClose(onClose, url) : undefined
287
+ });
288
+ }
289
+
290
+ return null;
272
291
  }), /*#__PURE__*/React.createElement(Toolbar, {
273
292
  setBlockStyle: (ev, newBlockType) => handleBlockStyleChange(ev, newBlockType),
274
- setInlineStyle: (ev, inlineStyle, keyboardUsed) => handleInlineStyleChange(ev, inlineStyle, keyboardUsed),
275
- editorState: editorState,
293
+ setInlineStyle: (ev, inlineStyle) => handleInlineStyleChange(ev, inlineStyle),
276
294
  activeControls: activeControls,
277
295
  canFocus: focusToolbar,
278
296
  toolbarElements: toolbarElements
279
297
  })))));
280
298
  });
281
- TextEditor.propTypes = { ...marginPropTypes,
282
-
283
- /** The maximum characters that the input will accept */
284
- characterLimit: PropTypes.number,
285
-
286
- /** The text for the editor's label */
287
- labelText: PropTypes.string.isRequired,
288
-
289
- /** onChange callback to control value updates */
290
- onChange: PropTypes.func.isRequired,
291
-
292
- /** The value of the input, this is an EditorState immutable object */
293
- value: PropTypes.object.isRequired,
294
-
295
- /** Flag to configure component as mandatory */
296
- required: PropTypes.bool,
297
-
298
- /** Message to be displayed when there is an error */
299
- error: PropTypes.string,
300
-
301
- /** Message to be displayed when there is a warning */
302
- warning: PropTypes.string,
303
-
304
- /** Message to be displayed when there is an info */
305
- info: PropTypes.string,
306
-
307
- /** Additional elements to be rendered in the Editor Toolbar, e.g. Save and Cancel Button */
308
- toolbarElements: PropTypes.node,
309
-
310
- /** Number greater than 2 multiplied by line-height (21px) to override the default min-height of the editor */
311
- rows: (props, propName, component) => {
312
- if (props[propName] && (typeof props[propName] !== "number" || props[propName] < 2)) {
313
- return new Error(`Prop \`${propName}\` must be a number value greater than 2 to override the min-height of the \`${component}\``);
314
- }
315
-
316
- return null;
317
- },
318
-
319
- /** The previews to display of any links added to the Editor */
320
- previews: PropTypes.arrayOf(PropTypes.node),
321
-
322
- /** Callback to report a url when a link is added */
323
- onLinkAdded: PropTypes.func
299
+ TextEditor.propTypes = {
300
+ "characterLimit": PropTypes.number,
301
+ "error": PropTypes.string,
302
+ "info": PropTypes.string,
303
+ "labelText": PropTypes.string.isRequired,
304
+ "m": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
305
+ "__@toStringTag": PropTypes.string.isRequired,
306
+ "description": PropTypes.string,
307
+ "toString": PropTypes.func.isRequired,
308
+ "valueOf": PropTypes.func.isRequired
309
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
310
+ "__@toStringTag": PropTypes.string.isRequired,
311
+ "description": PropTypes.string,
312
+ "toString": PropTypes.func.isRequired,
313
+ "valueOf": PropTypes.func.isRequired
314
+ }), PropTypes.string]),
315
+ "margin": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
316
+ "__@toStringTag": PropTypes.string.isRequired,
317
+ "description": PropTypes.string,
318
+ "toString": PropTypes.func.isRequired,
319
+ "valueOf": PropTypes.func.isRequired
320
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
321
+ "__@toStringTag": PropTypes.string.isRequired,
322
+ "description": PropTypes.string,
323
+ "toString": PropTypes.func.isRequired,
324
+ "valueOf": PropTypes.func.isRequired
325
+ }), PropTypes.string]),
326
+ "marginBottom": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
327
+ "__@toStringTag": PropTypes.string.isRequired,
328
+ "description": PropTypes.string,
329
+ "toString": PropTypes.func.isRequired,
330
+ "valueOf": PropTypes.func.isRequired
331
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
332
+ "__@toStringTag": PropTypes.string.isRequired,
333
+ "description": PropTypes.string,
334
+ "toString": PropTypes.func.isRequired,
335
+ "valueOf": PropTypes.func.isRequired
336
+ }), PropTypes.string]),
337
+ "marginLeft": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
338
+ "__@toStringTag": PropTypes.string.isRequired,
339
+ "description": PropTypes.string,
340
+ "toString": PropTypes.func.isRequired,
341
+ "valueOf": PropTypes.func.isRequired
342
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
343
+ "__@toStringTag": PropTypes.string.isRequired,
344
+ "description": PropTypes.string,
345
+ "toString": PropTypes.func.isRequired,
346
+ "valueOf": PropTypes.func.isRequired
347
+ }), PropTypes.string]),
348
+ "marginRight": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
349
+ "__@toStringTag": PropTypes.string.isRequired,
350
+ "description": PropTypes.string,
351
+ "toString": PropTypes.func.isRequired,
352
+ "valueOf": PropTypes.func.isRequired
353
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
354
+ "__@toStringTag": PropTypes.string.isRequired,
355
+ "description": PropTypes.string,
356
+ "toString": PropTypes.func.isRequired,
357
+ "valueOf": PropTypes.func.isRequired
358
+ }), PropTypes.string]),
359
+ "marginTop": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
360
+ "__@toStringTag": PropTypes.string.isRequired,
361
+ "description": PropTypes.string,
362
+ "toString": PropTypes.func.isRequired,
363
+ "valueOf": PropTypes.func.isRequired
364
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
365
+ "__@toStringTag": PropTypes.string.isRequired,
366
+ "description": PropTypes.string,
367
+ "toString": PropTypes.func.isRequired,
368
+ "valueOf": PropTypes.func.isRequired
369
+ }), PropTypes.string]),
370
+ "marginX": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
371
+ "__@toStringTag": PropTypes.string.isRequired,
372
+ "description": PropTypes.string,
373
+ "toString": PropTypes.func.isRequired,
374
+ "valueOf": PropTypes.func.isRequired
375
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
376
+ "__@toStringTag": PropTypes.string.isRequired,
377
+ "description": PropTypes.string,
378
+ "toString": PropTypes.func.isRequired,
379
+ "valueOf": PropTypes.func.isRequired
380
+ }), PropTypes.string]),
381
+ "marginY": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
382
+ "__@toStringTag": PropTypes.string.isRequired,
383
+ "description": PropTypes.string,
384
+ "toString": PropTypes.func.isRequired,
385
+ "valueOf": PropTypes.func.isRequired
386
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
387
+ "__@toStringTag": PropTypes.string.isRequired,
388
+ "description": PropTypes.string,
389
+ "toString": PropTypes.func.isRequired,
390
+ "valueOf": PropTypes.func.isRequired
391
+ }), PropTypes.string]),
392
+ "mb": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
393
+ "__@toStringTag": PropTypes.string.isRequired,
394
+ "description": PropTypes.string,
395
+ "toString": PropTypes.func.isRequired,
396
+ "valueOf": PropTypes.func.isRequired
397
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
398
+ "__@toStringTag": PropTypes.string.isRequired,
399
+ "description": PropTypes.string,
400
+ "toString": PropTypes.func.isRequired,
401
+ "valueOf": PropTypes.func.isRequired
402
+ }), PropTypes.string]),
403
+ "ml": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
404
+ "__@toStringTag": PropTypes.string.isRequired,
405
+ "description": PropTypes.string,
406
+ "toString": PropTypes.func.isRequired,
407
+ "valueOf": PropTypes.func.isRequired
408
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
409
+ "__@toStringTag": PropTypes.string.isRequired,
410
+ "description": PropTypes.string,
411
+ "toString": PropTypes.func.isRequired,
412
+ "valueOf": PropTypes.func.isRequired
413
+ }), PropTypes.string]),
414
+ "mr": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
415
+ "__@toStringTag": PropTypes.string.isRequired,
416
+ "description": PropTypes.string,
417
+ "toString": PropTypes.func.isRequired,
418
+ "valueOf": PropTypes.func.isRequired
419
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
420
+ "__@toStringTag": PropTypes.string.isRequired,
421
+ "description": PropTypes.string,
422
+ "toString": PropTypes.func.isRequired,
423
+ "valueOf": PropTypes.func.isRequired
424
+ }), PropTypes.string]),
425
+ "mt": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
426
+ "__@toStringTag": PropTypes.string.isRequired,
427
+ "description": PropTypes.string,
428
+ "toString": PropTypes.func.isRequired,
429
+ "valueOf": PropTypes.func.isRequired
430
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
431
+ "__@toStringTag": PropTypes.string.isRequired,
432
+ "description": PropTypes.string,
433
+ "toString": PropTypes.func.isRequired,
434
+ "valueOf": PropTypes.func.isRequired
435
+ }), PropTypes.string]),
436
+ "mx": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
437
+ "__@toStringTag": PropTypes.string.isRequired,
438
+ "description": PropTypes.string,
439
+ "toString": PropTypes.func.isRequired,
440
+ "valueOf": PropTypes.func.isRequired
441
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
442
+ "__@toStringTag": PropTypes.string.isRequired,
443
+ "description": PropTypes.string,
444
+ "toString": PropTypes.func.isRequired,
445
+ "valueOf": PropTypes.func.isRequired
446
+ }), PropTypes.string]),
447
+ "my": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
448
+ "__@toStringTag": PropTypes.string.isRequired,
449
+ "description": PropTypes.string,
450
+ "toString": PropTypes.func.isRequired,
451
+ "valueOf": PropTypes.func.isRequired
452
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
453
+ "__@toStringTag": PropTypes.string.isRequired,
454
+ "description": PropTypes.string,
455
+ "toString": PropTypes.func.isRequired,
456
+ "valueOf": PropTypes.func.isRequired
457
+ }), PropTypes.string]),
458
+ "onChange": PropTypes.func.isRequired,
459
+ "onLinkAdded": PropTypes.func,
460
+ "previews": PropTypes.node,
461
+ "required": PropTypes.bool,
462
+ "rows": PropTypes.number,
463
+ "toolbarElements": PropTypes.node,
464
+ "value": PropTypes.object.isRequired,
465
+ "warning": PropTypes.string
324
466
  };
467
+ export { TextEditor };
325
468
  export const TextEditorState = EditorState;
326
469
  export const TextEditorContentState = ContentState;
327
470
  export default TextEditor;
@@ -1,3 +1,11 @@
1
- export const StyledEditorWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
2
- export const StyledEditorContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
3
- export const StyledEditorOutline: import("styled-components").StyledComponent<"div", any, {}, never>;
1
+ declare const StyledEditorWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
2
+ declare const StyledEditorContainer: import("styled-components").StyledComponent<"div", any, {
3
+ hasError?: boolean | undefined;
4
+ rows?: number | undefined;
5
+ hasPreview?: boolean | undefined;
6
+ }, never>;
7
+ declare const StyledEditorOutline: import("styled-components").StyledComponent<"div", any, {
8
+ isFocused?: boolean | undefined;
9
+ hasError?: boolean | undefined;
10
+ }, never>;
11
+ export { StyledEditorWrapper, StyledEditorContainer, StyledEditorOutline };
@@ -10,13 +10,12 @@ StyledEditorWrapper.defaultProps = {
10
10
  theme: baseTheme
11
11
  };
12
12
  const StyledEditorContainer = styled.div`
13
- border-radius: var(--borderRadius050);
14
-
15
13
  ${({
16
14
  hasError,
17
15
  rows,
18
16
  hasPreview
19
17
  }) => css`
18
+ border-radius: var(--borderRadius050);
20
19
  min-height: ${rows ? `${rows * lineHeight}` : `${hasPreview ? 125 : 220}`}px;
21
20
  min-width: 320px;
22
21
  position: relative;
@@ -0,0 +1,6 @@
1
+ export declare const BOLD = "BOLD";
2
+ export declare const ITALIC = "ITALIC";
3
+ export declare const UNORDERED_LIST = "unordered-list-item";
4
+ export declare const ORDERED_LIST = "ordered-list-item";
5
+ export declare type InlineStyleType = typeof BOLD | typeof ITALIC;
6
+ export declare type BlockType = typeof UNORDERED_LIST | typeof ORDERED_LIST;
@@ -0,0 +1,4 @@
1
+ export const BOLD = "BOLD";
2
+ export const ITALIC = "ITALIC";
3
+ export const UNORDERED_LIST = "unordered-list-item";
4
+ export const ORDERED_LIST = "ordered-list-item";
@@ -6,7 +6,7 @@ import { filterStyledSystemMarginProps } from "../../style/utils";
6
6
  import { Input, InputPresentation } from "../../__internal__/input";
7
7
  import InputIconToggle from "../../__internal__/input-icon-toggle";
8
8
  import FormField from "../../__internal__/form-field";
9
- import useUniqueId from "../../__internal__/utils/helpers/useUniqueId";
9
+ import useUniqueId from "../../hooks/__internal__/useUniqueId";
10
10
  import { InputBehaviour } from "../../__internal__/input-behaviour";
11
11
  import StyledPrefix from "./__internal__/prefix.style";
12
12
  import { TooltipProvider } from "../../__internal__/tooltip-provider";
@@ -1,5 +1,5 @@
1
1
  import { useRef } from "react";
2
- import createGuid from "../guid";
2
+ import createGuid from "../../../__internal__/utils/helpers/guid";
3
3
  export default ((id, name) => {
4
4
  const createdId = useRef(createGuid());
5
5
  const createdName = useRef(createGuid());
@@ -102,6 +102,10 @@ const enGB = {
102
102
  pageX: () => "Page",
103
103
  ofY: count => `of ${count}`
104
104
  },
105
+ password: {
106
+ ariaLiveShownMessage: () => "Your password has been shown. Focus on the password input to have it read to you, if it is safe to do so.",
107
+ ariaLiveHiddenMessage: () => "Your Password is currently hidden."
108
+ },
105
109
  progressTracker: {
106
110
  of: () => "of"
107
111
  },
@@ -75,6 +75,10 @@ interface Locale {
75
75
  pageX: () => string;
76
76
  ofY: (count: string | number) => string;
77
77
  };
78
+ password: {
79
+ ariaLiveShownMessage: () => string;
80
+ ariaLiveHiddenMessage: () => string;
81
+ };
78
82
  progressTracker: {
79
83
  of: () => string;
80
84
  };
@@ -152,6 +152,10 @@ const plPL = {
152
152
  pageX: () => "Strona",
153
153
  ofY: count => `z ${count}`
154
154
  },
155
+ password: {
156
+ ariaLiveShownMessage: () => "Zostało wyświetlone Twoje hasło. Skup się na haśle, aby je odczytać, jeśli jest to bezpieczne.",
157
+ ariaLiveHiddenMessage: () => "Twoje hasło jest obecnie ukryte."
158
+ },
155
159
  progressTracker: {
156
160
  of: () => "z"
157
161
  },
@@ -1,7 +1,11 @@
1
1
  /// <reference types="react" />
2
2
  import { ButtonProps } from "../button";
3
+ export interface ButtonMinorProps extends ButtonProps {
4
+ /** @private @ignore */
5
+ isInPassword?: boolean;
6
+ }
3
7
  export declare const ButtonMinor: {
4
- ({ buttonType, size, ...rest }: ButtonProps): JSX.Element;
8
+ ({ buttonType, size, isInPassword, ...rest }: ButtonMinorProps): JSX.Element;
5
9
  displayName: string;
6
10
  };
7
11
  export default ButtonMinor;
@@ -18,10 +18,12 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
18
18
  const ButtonMinor = ({
19
19
  buttonType = "secondary",
20
20
  size = "medium",
21
+ isInPassword,
21
22
  ...rest
22
23
  }) => /*#__PURE__*/_react.default.createElement(_buttonMinor.default, _extends({
23
24
  size: size,
24
- buttonType: buttonType
25
+ buttonType: buttonType,
26
+ isInPassword: isInPassword
25
27
  }, rest));
26
28
 
27
29
  exports.ButtonMinor = ButtonMinor;
@@ -41,6 +43,7 @@ ButtonMinor.propTypes = {
41
43
  "iconTooltipPosition": _propTypes.default.oneOf(["bottom", "left", "right", "top"]),
42
44
  "iconType": _propTypes.default.oneOf(["add", "admin", "alert_on", "alert", "analysis", "arrow_bottom_right_circle", "arrow_down", "arrow_left_boxed", "arrow_left_right_small", "arrow_left_small", "arrow_left", "arrow_right_small", "arrow_right", "arrow_top_left_circle", "arrow_up", "arrow", "arrows_left_right", "attach", "bank_with_card", "bank", "basket_with_squares", "basket", "bed", "bin", "block_arrow_right", "blocked_square", "blocked", "bold", "box_arrow_left", "boxed_shapes", "bulk_destroy", "bullet_list_dotted", "bullet_list_numbers", "bullet_list", "business", "calendar_today", "calendar", "call", "camera", "car_lock", "car_money", "car_repair", "card_view", "caret_down", "caret_large_down", "caret_large_left", "caret_large_right", "caret_large_up", "caret_left", "caret_right", "caret_up", "cart", "cash", "chart_bar", "chart_line", "chart_pie", "chat_notes", "chat", "chevron_down_thick", "chevron_down", "chevron_left_thick", "chevron_left", "chevron_right_thick", "chevron_right", "chevron_up_thick", "chevron_up", "circle_with_dots", "circles_connection", "clock", "close", "coins", "collaborate", "computer_clock", "connect", "construction", "contacts", "copy", "create", "credit_card_slash", "credit_card", "cross_circle", "cross", "csv", "dashboard", "delete", "delivery", "disconnect", "disputed", "document_right_align", "document_tick", "document_vertical_lines", "download", "draft", "drag_vertical", "drag", "drill", "dropdown", "duplicate", "edit", "edited", "ellipsis_horizontal", "ellipsis_vertical", "email_switch", "email", "entry", "envelope_dollar", "envelope_euro", "error_square", "error", "euro", "expand", "factory", "favourite_lined", "favourite", "fax", "feedback", "file_excel", "file_generic", "file_image", "file_pdf", "file_word", "files_leaning", "filter_new", "filter", "fit_height", "fit_width", "flag", "folder", "form_refresh", "gift", "go", "graduation_hat", "graph", "grid", "hand_cash_coins", "hand_cash_note", "help", "hide", "home", "image", "in_progress", "in_transit", "individual", "info", "italic", "key", "laptop", "ledger_arrow_left", "ledger_arrow_right", "ledger", "lightbulb_off", "lightbulb_on", "link", "list_view", "location", "locked", "logout", "lookup", "marker", "message", "minus_large", "minus", "mobile", "money_bag", "none", "old_warning", "palm_tree", "pause_circle", "pause", "pdf", "people_switch", "people", "percentage_boxed", "person_info", "person_tick", "person", "petrol_pump", "phone", "piggy_bank", "plane", "play_circle", "play", "plus_large", "plus", "pound", "print", "progress", "progressed", "question_hollow", "question_mark", "question", "refresh_clock", "refresh", "remove", "sage_coin", "save", "scan", "search", "services", "settings_old", "settings", "share", "shop", "sort_down", "sort_up", "spanner", "split_container", "split", "square_dot", "squares_nine", "stacked_boxes", "stacked_squares", "submitted", "sync", "tag", "talk", "theatre_masks", "three_boxes", "tick_circle", "tick_thick", "tick", "true_tick", "u_turn_left", "u_turn_right", "undo", "unlocked", "upload", "uploaded", "video", "view", "warning"]),
43
45
  "id": _propTypes.default.string,
46
+ "isInPassword": _propTypes.default.bool,
44
47
  "m": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
45
48
  "__@toStringTag": _propTypes.default.string.isRequired,
46
49
  "description": _propTypes.default.string,
@@ -1,3 +1,4 @@
1
1
  /// <reference types="react" />
2
- declare const StyledButtonMinor: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../button").ButtonProps & import("react").RefAttributes<HTMLButtonElement>>, any, {}, never>;
2
+ import { ButtonMinorProps } from "./button-minor.component";
3
+ declare const StyledButtonMinor: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../button").ButtonProps & import("react").RefAttributes<HTMLButtonElement>>, any, ButtonMinorProps, never>;
3
4
  export default StyledButtonMinor;
@@ -77,6 +77,23 @@ const StyledButtonMinor = (0, _styledComponents.default)(_button.default)`
77
77
  }
78
78
  `}
79
79
  `}
80
+
81
+ ${({
82
+ isInPassword,
83
+ disabled
84
+ }) => isInPassword && !disabled && (0, _styledComponents.css)`
85
+ ${_icon.default} {
86
+ color: var(--colorsUtilityMajor300);
87
+ }
88
+
89
+ &:hover {
90
+ ${_icon.default} {
91
+ color: var(--colorsUtilityMajor300);
92
+ }
93
+ color: var(--colorsActionMinor500);
94
+ background: transparent;
95
+ }
96
+ `}
80
97
 
81
98
  ${({
82
99
  size
@@ -1,2 +1,2 @@
1
1
  export { default } from "./button-minor.component";
2
- export type { ButtonProps as ButtonMinorProps } from "../button";
2
+ export type { ButtonMinorProps } from "./button-minor.component";
@@ -103,6 +103,10 @@ I18nProvider.propTypes = {
103
103
  "records": _propTypes.default.func.isRequired,
104
104
  "show": _propTypes.default.func.isRequired
105
105
  }),
106
+ "password": _propTypes.default.shape({
107
+ "ariaLiveHiddenMessage": _propTypes.default.func.isRequired,
108
+ "ariaLiveShownMessage": _propTypes.default.func.isRequired
109
+ }),
106
110
  "pod": _propTypes.default.shape({
107
111
  "undo": _propTypes.default.func.isRequired
108
112
  }),