carbon-react 128.3.1 → 128.4.1

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.
@@ -50,9 +50,9 @@ export interface DialogProps extends ModalProps, TagProps {
50
50
  closeButtonDataProps?: Pick<TagProps, "data-role" | "data-element">;
51
51
  /** Size of dialog, default size is 750px */
52
52
  size?: DialogSizes;
53
- /** Subtitle displayed at top of dialog */
54
- subtitle?: string;
55
- /** Title displayed at top of dialog */
53
+ /** Subtitle displayed at top of dialog. Its consumers' responsibility to set a suitable accessible name/description for the Dialog if they pass a node to subtitle prop. */
54
+ subtitle?: React.ReactNode;
55
+ /** Title displayed at top of dialog. Its consumers' responsibility to set a suitable accessible name/description for the Dialog if they pass a node to title prop. */
56
56
  title?: React.ReactNode;
57
57
  /** The ARIA role to be applied to the Dialog container */
58
58
  role?: string;
@@ -147,7 +147,7 @@ const Dialog = /*#__PURE__*/forwardRef(({
147
147
  size,
148
148
  dialogHeight,
149
149
  "aria-labelledby": title && typeof title === "string" ? titleId : rest["aria-labelledby"],
150
- "aria-describedby": subtitle ? subtitleId : rest["aria-describedby"],
150
+ "aria-describedby": subtitle && typeof subtitle === "string" ? subtitleId : rest["aria-describedby"],
151
151
  "aria-label": rest["aria-label"]
152
152
  };
153
153
  const componentTags = {
@@ -247,7 +247,7 @@ if (process.env.NODE_ENV !== "production") {
247
247
  "role": PropTypes.string,
248
248
  "showCloseIcon": PropTypes.bool,
249
249
  "size": PropTypes.oneOf(["auto", "extra-large", "extra-small", "large", "medium-large", "medium-small", "medium", "small"]),
250
- "subtitle": PropTypes.string,
250
+ "subtitle": PropTypes.node,
251
251
  "timeout": PropTypes.number,
252
252
  "title": PropTypes.node,
253
253
  "topModalOverride": PropTypes.bool
@@ -42,8 +42,8 @@ export interface DialogFullScreenProps extends ModalProps {
42
42
  showCloseIcon?: boolean;
43
43
  /** Data tag prop bag for close Button */
44
44
  closeButtonDataProps?: Pick<TagProps, "data-role" | "data-element">;
45
- /** Subtitle displayed at top of dialog */
46
- subtitle?: string;
45
+ /** Subtitle displayed at top of dialog. Its consumers' responsibility to set a suitable accessible name/description for the Dialog if they pass a node to subtitle prop. */
46
+ subtitle?: React.ReactNode;
47
47
  /** Title displayed at top of dialog */
48
48
  title?: React.ReactNode;
49
49
  /** The ARIA role to be applied to the DialogFullscreen container */
@@ -77,7 +77,7 @@ export const DialogFullScreen = ({
77
77
  }) : title, headerChildren);
78
78
  const ariaProps = {
79
79
  "aria-labelledby": title && typeof title === "string" ? titleId : ariaLabelledBy,
80
- "aria-describedby": subtitle ? subtitleId : ariaDescribedBy,
80
+ "aria-describedby": subtitle && typeof subtitle === "string" ? subtitleId : ariaDescribedBy,
81
81
  "aria-label": ariaLabel
82
82
  };
83
83
  const componentTags = {
@@ -192,12 +192,12 @@ const TextEditor = /*#__PURE__*/React.forwardRef(({
192
192
  };
193
193
  const handleEditorFocus = useCallback(focusValue => {
194
194
  moveCursor.current = true;
195
- setIsFocused(focusValue);
196
- if (!isFocused && focusValue && typeof editor === "object" && editor.current !== document.activeElement) {
195
+ if (focusValue && typeof editor === "object" && editor.current !== document.activeElement) {
197
196
  editor.current?.focus();
198
197
  setFocusToolbar(false);
199
198
  }
200
- }, [editor, isFocused]);
199
+ setIsFocused(focusValue);
200
+ }, [editor]);
201
201
  const handleInlineStyleChange = (ev, style) => {
202
202
  ev.preventDefault();
203
203
  setActiveInlines({
@@ -50,9 +50,9 @@ export interface DialogProps extends ModalProps, TagProps {
50
50
  closeButtonDataProps?: Pick<TagProps, "data-role" | "data-element">;
51
51
  /** Size of dialog, default size is 750px */
52
52
  size?: DialogSizes;
53
- /** Subtitle displayed at top of dialog */
54
- subtitle?: string;
55
- /** Title displayed at top of dialog */
53
+ /** Subtitle displayed at top of dialog. Its consumers' responsibility to set a suitable accessible name/description for the Dialog if they pass a node to subtitle prop. */
54
+ subtitle?: React.ReactNode;
55
+ /** Title displayed at top of dialog. Its consumers' responsibility to set a suitable accessible name/description for the Dialog if they pass a node to title prop. */
56
56
  title?: React.ReactNode;
57
57
  /** The ARIA role to be applied to the Dialog container */
58
58
  role?: string;
@@ -156,7 +156,7 @@ const Dialog = exports.Dialog = /*#__PURE__*/(0, _react.forwardRef)(({
156
156
  size,
157
157
  dialogHeight,
158
158
  "aria-labelledby": title && typeof title === "string" ? titleId : rest["aria-labelledby"],
159
- "aria-describedby": subtitle ? subtitleId : rest["aria-describedby"],
159
+ "aria-describedby": subtitle && typeof subtitle === "string" ? subtitleId : rest["aria-describedby"],
160
160
  "aria-label": rest["aria-label"]
161
161
  };
162
162
  const componentTags = {
@@ -256,7 +256,7 @@ if (process.env.NODE_ENV !== "production") {
256
256
  "role": _propTypes.default.string,
257
257
  "showCloseIcon": _propTypes.default.bool,
258
258
  "size": _propTypes.default.oneOf(["auto", "extra-large", "extra-small", "large", "medium-large", "medium-small", "medium", "small"]),
259
- "subtitle": _propTypes.default.string,
259
+ "subtitle": _propTypes.default.node,
260
260
  "timeout": _propTypes.default.number,
261
261
  "title": _propTypes.default.node,
262
262
  "topModalOverride": _propTypes.default.bool
@@ -42,8 +42,8 @@ export interface DialogFullScreenProps extends ModalProps {
42
42
  showCloseIcon?: boolean;
43
43
  /** Data tag prop bag for close Button */
44
44
  closeButtonDataProps?: Pick<TagProps, "data-role" | "data-element">;
45
- /** Subtitle displayed at top of dialog */
46
- subtitle?: string;
45
+ /** Subtitle displayed at top of dialog. Its consumers' responsibility to set a suitable accessible name/description for the Dialog if they pass a node to subtitle prop. */
46
+ subtitle?: React.ReactNode;
47
47
  /** Title displayed at top of dialog */
48
48
  title?: React.ReactNode;
49
49
  /** The ARIA role to be applied to the DialogFullscreen container */
@@ -86,7 +86,7 @@ const DialogFullScreen = ({
86
86
  }) : title, headerChildren);
87
87
  const ariaProps = {
88
88
  "aria-labelledby": title && typeof title === "string" ? titleId : ariaLabelledBy,
89
- "aria-describedby": subtitle ? subtitleId : ariaDescribedBy,
89
+ "aria-describedby": subtitle && typeof subtitle === "string" ? subtitleId : ariaDescribedBy,
90
90
  "aria-label": ariaLabel
91
91
  };
92
92
  const componentTags = {
@@ -201,12 +201,12 @@ const TextEditor = exports.TextEditor = /*#__PURE__*/_react.default.forwardRef((
201
201
  };
202
202
  const handleEditorFocus = (0, _react.useCallback)(focusValue => {
203
203
  moveCursor.current = true;
204
- setIsFocused(focusValue);
205
- if (!isFocused && focusValue && typeof editor === "object" && editor.current !== document.activeElement) {
204
+ if (focusValue && typeof editor === "object" && editor.current !== document.activeElement) {
206
205
  editor.current?.focus();
207
206
  setFocusToolbar(false);
208
207
  }
209
- }, [editor, isFocused]);
208
+ setIsFocused(focusValue);
209
+ }, [editor]);
210
210
  const handleInlineStyleChange = (ev, style) => {
211
211
  ev.preventDefault();
212
212
  setActiveInlines({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-react",
3
- "version": "128.3.1",
3
+ "version": "128.4.1",
4
4
  "description": "A library of reusable React components for easily building user interfaces.",
5
5
  "files": [
6
6
  "lib",