carbon-react 111.5.0 → 111.5.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.
@@ -1,16 +1,16 @@
1
- interface DataProps {
1
+ interface RestProps {
2
+ [restKeys: string]: any;
3
+ }
4
+ export interface TagProps {
5
+ /** @private @ignore Identifier used for testing purposes, applied to the root element of the component. */
6
+ "data-component"?: string;
2
7
  /** Identifier used for testing purposes, applied to the root element of the component. */
3
8
  "data-element"?: string;
4
9
  /** Identifier used for testing purposes, applied to the root element of the component. */
5
10
  "data-role"?: string;
6
- [restKeys: string]: any;
7
- }
8
- export interface TagProps extends DataProps {
9
- /** Identifier used for testing purposes, applied to the root element of the component. */
10
- "data-component"?: string;
11
11
  }
12
12
  /**
13
13
  * Builds props object containing top level data tags
14
14
  */
15
- declare function tagComponent(componentName: string | undefined, props: DataProps): TagProps;
15
+ declare function tagComponent(componentName: string | undefined, props: TagProps & RestProps): TagProps;
16
16
  export default tagComponent;
@@ -36,13 +36,13 @@ Alert.propTypes = {
36
36
  "disableFocusTrap": PropTypes.bool,
37
37
  "enableBackgroundUI": PropTypes.bool,
38
38
  "focusableContainers": PropTypes.arrayOf(PropTypes.shape({
39
- "current": PropTypes.oneOfType([PropTypes.oneOf([null]), function (props, propName) {
39
+ "current": function (props, propName) {
40
40
  if (props[propName] == null) {
41
- return new Error("Prop '" + propName + "' is required but wasn't specified");
41
+ return null;
42
42
  } else if (typeof props[propName] !== 'object' || props[propName].nodeType !== 1) {
43
43
  return new Error("Expected prop '" + propName + "' to be of type Element");
44
44
  }
45
- }]).isRequired
45
+ }
46
46
  })),
47
47
  "focusFirstElement": PropTypes.shape({
48
48
  "current": PropTypes.oneOfType([PropTypes.oneOf([null]), function (props, propName) {
@@ -4,6 +4,9 @@ import { TagProps } from "../../__internal__/utils/helpers/tags/tags";
4
4
  import { DialogSizes } from "./dialog.config";
5
5
  declare const PADDING_VALUES: readonly [0, 1, 2, 3, 4, 5, 6, 7, 8];
6
6
  declare type PaddingValues = typeof PADDING_VALUES[number];
7
+ declare type CustomRefObject<T> = {
8
+ current?: T | null;
9
+ };
7
10
  export interface ContentPaddingInterface {
8
11
  p?: PaddingValues;
9
12
  py?: PaddingValues;
@@ -54,7 +57,7 @@ export interface DialogProps extends ModalProps, TagProps {
54
57
  /** Padding to be set on the Dialog content */
55
58
  contentPadding?: ContentPaddingInterface;
56
59
  /** an optional array of refs to containers whose content should also be reachable by tabbing from the dialog */
57
- focusableContainers?: React.MutableRefObject<HTMLElement | null>[];
60
+ focusableContainers?: CustomRefObject<HTMLElement>[];
58
61
  }
59
62
  export declare const Dialog: ({ className, children, open, height, size, title, disableEscKey, subtitle, disableAutoFocus, focusFirstElement, onCancel, showCloseIcon, bespokeFocusTrap, disableClose, help, role, contentPadding, focusableContainers, ...rest }: DialogProps) => JSX.Element;
60
63
  export default Dialog;
@@ -205,13 +205,13 @@ Dialog.propTypes = {
205
205
  "disableFocusTrap": PropTypes.bool,
206
206
  "enableBackgroundUI": PropTypes.bool,
207
207
  "focusableContainers": PropTypes.arrayOf(PropTypes.shape({
208
- "current": PropTypes.oneOfType([PropTypes.oneOf([null]), function (props, propName) {
208
+ "current": function (props, propName) {
209
209
  if (props[propName] == null) {
210
- return new Error("Prop '" + propName + "' is required but wasn't specified");
210
+ return null;
211
211
  } else if (typeof props[propName] !== 'object' || props[propName].nodeType !== 1) {
212
212
  return new Error("Expected prop '" + propName + "' to be of type Element");
213
213
  }
214
- }]).isRequired
214
+ }
215
215
  })),
216
216
  "focusFirstElement": PropTypes.shape({
217
217
  "current": PropTypes.oneOfType([PropTypes.oneOf([null]), function (props, propName) {
@@ -42,7 +42,7 @@ export interface DialogFullScreenProps extends ModalProps {
42
42
  /** The ARIA role to be applied to the DialogFullscreen container */
43
43
  role?: string;
44
44
  /** an optional array of refs to containers whose content should also be reachable by tabbing from the dialog */
45
- focusableContainers?: React.MutableRefObject<HTMLElement>[];
45
+ focusableContainers?: React.MutableRefObject<HTMLElement | null>[];
46
46
  }
47
47
 
48
48
  declare function DialogFullScreen(props: DialogFullScreenProps): JSX.Element;
@@ -1,6 +1,9 @@
1
1
  import React from "react";
2
2
  import { PaddingProps } from "styled-system";
3
3
  import { TagProps } from "../../__internal__/utils/helpers/tags/tags";
4
+ declare type CustomRefObject<T> = {
5
+ current?: T | null;
6
+ };
4
7
  export interface SidebarContextProps {
5
8
  isInSidebar?: boolean;
6
9
  }
@@ -10,13 +13,13 @@ export interface SidebarProps extends PaddingProps, TagProps {
10
13
  "aria-describedby"?: string;
11
14
  /**
12
15
  * Prop to specify the aria-label of the component.
13
- * To be used only when the title prop is not defined, and the component is not labelled by any internal element.
16
+ * To be used only when the header prop is not defined, and the component is not labelled by any internal element.
14
17
  */
15
18
  "aria-label"?: string;
16
19
  /**
17
20
  * Prop to specify the aria-labeledby property of the component
18
- * To be used when the title prop is a custom React Node,
19
- * or the component is labelled by an internal element other than the title.
21
+ * To be used when the header prop is a custom React Node,
22
+ * or the component is labelled by an internal element other than the header.
20
23
  */
21
24
  "aria-labelledby"?: string;
22
25
  /** Modal content */
@@ -38,7 +41,7 @@ export interface SidebarProps extends PaddingProps, TagProps {
38
41
  /** Sets the size of the sidebar when open. */
39
42
  size?: "extra-small" | "small" | "medium-small" | "medium" | "medium-large" | "large" | "extra-large";
40
43
  /** an optional array of refs to containers whose content should also be reachable by tabbing from the sidebar */
41
- focusableContainers?: React.MutableRefObject<HTMLElement>[];
44
+ focusableContainers?: CustomRefObject<HTMLElement>[];
42
45
  }
43
- export declare const Sidebar: React.ForwardRefExoticComponent<Pick<SidebarProps, keyof SidebarProps> & React.RefAttributes<HTMLDivElement>>;
46
+ export declare const Sidebar: React.ForwardRefExoticComponent<SidebarProps & React.RefAttributes<HTMLDivElement>>;
44
47
  export default Sidebar;
@@ -32,7 +32,7 @@ const Sidebar = /*#__PURE__*/React.forwardRef(({
32
32
  }, ref) => {
33
33
  const locale = useLocale();
34
34
  const {
35
- current: titleId
35
+ current: headerId
36
36
  } = useRef(createGuid());
37
37
  const hasStickyFooter = useIsStickyFooterForm(children);
38
38
  const sidebarRef = useRef(null);
@@ -63,7 +63,7 @@ const Sidebar = /*#__PURE__*/React.forwardRef(({
63
63
  "aria-modal": !enableBackgroundUI,
64
64
  "aria-describedby": ariaDescribedBy,
65
65
  "aria-label": ariaLabel,
66
- "aria-labelledby": !ariaLabelledBy && !ariaLabel ? titleId : ariaLabelledBy,
66
+ "aria-labelledby": !ariaLabelledBy && !ariaLabel ? headerId : ariaLabelledBy,
67
67
  ref: setRefs,
68
68
  position: position,
69
69
  size: size,
@@ -71,7 +71,7 @@ const Sidebar = /*#__PURE__*/React.forwardRef(({
71
71
  onCancel: onCancel,
72
72
  role: role
73
73
  }, header && /*#__PURE__*/React.createElement(SidebarHeader, {
74
- id: titleId
74
+ id: headerId
75
75
  }, header), closeIcon(), /*#__PURE__*/React.createElement(Box, _extends({
76
76
  "data-element": "sidebar-content",
77
77
  pt: "var(--spacing300)",
@@ -110,7 +110,7 @@ Sidebar.propTypes = {
110
110
  "focusableContainers": PropTypes.arrayOf(PropTypes.shape({
111
111
  "current": function (props, propName) {
112
112
  if (props[propName] == null) {
113
- return new Error("Prop '" + propName + "' is required but wasn't specified");
113
+ return null;
114
114
  } else if (typeof props[propName] !== 'object' || props[propName].nodeType !== 1) {
115
115
  return new Error("Expected prop '" + propName + "' to be of type Element");
116
116
  }
@@ -125,9 +125,7 @@ const Textbox = ({
125
125
  "data-role": dataRole,
126
126
  "data-element": dataElement,
127
127
  validationIconId: validationRedesignOptIn ? undefined : validationIconId,
128
- validationRedesignOptIn: validationRedesignOptIn,
129
- size: size,
130
- readOnly: readOnly
128
+ validationRedesignOptIn: validationRedesignOptIn
131
129
  }, filterStyledSystemMarginProps(props)), validationRedesignOptIn && labelHelp && /*#__PURE__*/React.createElement(StyledHintText, null, labelHelp), validationRedesignOptIn && /*#__PURE__*/React.createElement(ValidationMessage, {
132
130
  error: error,
133
131
  warning: warning
@@ -1,16 +1,16 @@
1
- interface DataProps {
1
+ interface RestProps {
2
+ [restKeys: string]: any;
3
+ }
4
+ export interface TagProps {
5
+ /** @private @ignore Identifier used for testing purposes, applied to the root element of the component. */
6
+ "data-component"?: string;
2
7
  /** Identifier used for testing purposes, applied to the root element of the component. */
3
8
  "data-element"?: string;
4
9
  /** Identifier used for testing purposes, applied to the root element of the component. */
5
10
  "data-role"?: string;
6
- [restKeys: string]: any;
7
- }
8
- export interface TagProps extends DataProps {
9
- /** Identifier used for testing purposes, applied to the root element of the component. */
10
- "data-component"?: string;
11
11
  }
12
12
  /**
13
13
  * Builds props object containing top level data tags
14
14
  */
15
- declare function tagComponent(componentName: string | undefined, props: DataProps): TagProps;
15
+ declare function tagComponent(componentName: string | undefined, props: TagProps & RestProps): TagProps;
16
16
  export default tagComponent;
@@ -48,13 +48,13 @@ Alert.propTypes = {
48
48
  "disableFocusTrap": _propTypes.default.bool,
49
49
  "enableBackgroundUI": _propTypes.default.bool,
50
50
  "focusableContainers": _propTypes.default.arrayOf(_propTypes.default.shape({
51
- "current": _propTypes.default.oneOfType([_propTypes.default.oneOf([null]), function (props, propName) {
51
+ "current": function (props, propName) {
52
52
  if (props[propName] == null) {
53
- return new Error("Prop '" + propName + "' is required but wasn't specified");
53
+ return null;
54
54
  } else if (typeof props[propName] !== 'object' || props[propName].nodeType !== 1) {
55
55
  return new Error("Expected prop '" + propName + "' to be of type Element");
56
56
  }
57
- }]).isRequired
57
+ }
58
58
  })),
59
59
  "focusFirstElement": _propTypes.default.shape({
60
60
  "current": _propTypes.default.oneOfType([_propTypes.default.oneOf([null]), function (props, propName) {
@@ -4,6 +4,9 @@ import { TagProps } from "../../__internal__/utils/helpers/tags/tags";
4
4
  import { DialogSizes } from "./dialog.config";
5
5
  declare const PADDING_VALUES: readonly [0, 1, 2, 3, 4, 5, 6, 7, 8];
6
6
  declare type PaddingValues = typeof PADDING_VALUES[number];
7
+ declare type CustomRefObject<T> = {
8
+ current?: T | null;
9
+ };
7
10
  export interface ContentPaddingInterface {
8
11
  p?: PaddingValues;
9
12
  py?: PaddingValues;
@@ -54,7 +57,7 @@ export interface DialogProps extends ModalProps, TagProps {
54
57
  /** Padding to be set on the Dialog content */
55
58
  contentPadding?: ContentPaddingInterface;
56
59
  /** an optional array of refs to containers whose content should also be reachable by tabbing from the dialog */
57
- focusableContainers?: React.MutableRefObject<HTMLElement | null>[];
60
+ focusableContainers?: CustomRefObject<HTMLElement>[];
58
61
  }
59
62
  export declare const Dialog: ({ className, children, open, height, size, title, disableEscKey, subtitle, disableAutoFocus, focusFirstElement, onCancel, showCloseIcon, bespokeFocusTrap, disableClose, help, role, contentPadding, focusableContainers, ...rest }: DialogProps) => JSX.Element;
60
63
  export default Dialog;
@@ -232,13 +232,13 @@ Dialog.propTypes = {
232
232
  "disableFocusTrap": _propTypes.default.bool,
233
233
  "enableBackgroundUI": _propTypes.default.bool,
234
234
  "focusableContainers": _propTypes.default.arrayOf(_propTypes.default.shape({
235
- "current": _propTypes.default.oneOfType([_propTypes.default.oneOf([null]), function (props, propName) {
235
+ "current": function (props, propName) {
236
236
  if (props[propName] == null) {
237
- return new Error("Prop '" + propName + "' is required but wasn't specified");
237
+ return null;
238
238
  } else if (typeof props[propName] !== 'object' || props[propName].nodeType !== 1) {
239
239
  return new Error("Expected prop '" + propName + "' to be of type Element");
240
240
  }
241
- }]).isRequired
241
+ }
242
242
  })),
243
243
  "focusFirstElement": _propTypes.default.shape({
244
244
  "current": _propTypes.default.oneOfType([_propTypes.default.oneOf([null]), function (props, propName) {
@@ -42,7 +42,7 @@ export interface DialogFullScreenProps extends ModalProps {
42
42
  /** The ARIA role to be applied to the DialogFullscreen container */
43
43
  role?: string;
44
44
  /** an optional array of refs to containers whose content should also be reachable by tabbing from the dialog */
45
- focusableContainers?: React.MutableRefObject<HTMLElement>[];
45
+ focusableContainers?: React.MutableRefObject<HTMLElement | null>[];
46
46
  }
47
47
 
48
48
  declare function DialogFullScreen(props: DialogFullScreenProps): JSX.Element;
@@ -1,6 +1,9 @@
1
1
  import React from "react";
2
2
  import { PaddingProps } from "styled-system";
3
3
  import { TagProps } from "../../__internal__/utils/helpers/tags/tags";
4
+ declare type CustomRefObject<T> = {
5
+ current?: T | null;
6
+ };
4
7
  export interface SidebarContextProps {
5
8
  isInSidebar?: boolean;
6
9
  }
@@ -10,13 +13,13 @@ export interface SidebarProps extends PaddingProps, TagProps {
10
13
  "aria-describedby"?: string;
11
14
  /**
12
15
  * Prop to specify the aria-label of the component.
13
- * To be used only when the title prop is not defined, and the component is not labelled by any internal element.
16
+ * To be used only when the header prop is not defined, and the component is not labelled by any internal element.
14
17
  */
15
18
  "aria-label"?: string;
16
19
  /**
17
20
  * Prop to specify the aria-labeledby property of the component
18
- * To be used when the title prop is a custom React Node,
19
- * or the component is labelled by an internal element other than the title.
21
+ * To be used when the header prop is a custom React Node,
22
+ * or the component is labelled by an internal element other than the header.
20
23
  */
21
24
  "aria-labelledby"?: string;
22
25
  /** Modal content */
@@ -38,7 +41,7 @@ export interface SidebarProps extends PaddingProps, TagProps {
38
41
  /** Sets the size of the sidebar when open. */
39
42
  size?: "extra-small" | "small" | "medium-small" | "medium" | "medium-large" | "large" | "extra-large";
40
43
  /** an optional array of refs to containers whose content should also be reachable by tabbing from the sidebar */
41
- focusableContainers?: React.MutableRefObject<HTMLElement>[];
44
+ focusableContainers?: CustomRefObject<HTMLElement>[];
42
45
  }
43
- export declare const Sidebar: React.ForwardRefExoticComponent<Pick<SidebarProps, keyof SidebarProps> & React.RefAttributes<HTMLDivElement>>;
46
+ export declare const Sidebar: React.ForwardRefExoticComponent<SidebarProps & React.RefAttributes<HTMLDivElement>>;
44
47
  export default Sidebar;
@@ -61,7 +61,7 @@ const Sidebar = /*#__PURE__*/_react.default.forwardRef(({
61
61
  }, ref) => {
62
62
  const locale = (0, _useLocale.default)();
63
63
  const {
64
- current: titleId
64
+ current: headerId
65
65
  } = (0, _react.useRef)((0, _guid.default)());
66
66
  const hasStickyFooter = (0, _useIsStickyFooterForm.default)(children);
67
67
  const sidebarRef = (0, _react.useRef)(null);
@@ -93,7 +93,7 @@ const Sidebar = /*#__PURE__*/_react.default.forwardRef(({
93
93
  "aria-modal": !enableBackgroundUI,
94
94
  "aria-describedby": ariaDescribedBy,
95
95
  "aria-label": ariaLabel,
96
- "aria-labelledby": !ariaLabelledBy && !ariaLabel ? titleId : ariaLabelledBy,
96
+ "aria-labelledby": !ariaLabelledBy && !ariaLabel ? headerId : ariaLabelledBy,
97
97
  ref: setRefs,
98
98
  position: position,
99
99
  size: size,
@@ -101,7 +101,7 @@ const Sidebar = /*#__PURE__*/_react.default.forwardRef(({
101
101
  onCancel: onCancel,
102
102
  role: role
103
103
  }, header && /*#__PURE__*/_react.default.createElement(_sidebarHeader.default, {
104
- id: titleId
104
+ id: headerId
105
105
  }, header), closeIcon(), /*#__PURE__*/_react.default.createElement(_box.default, _extends({
106
106
  "data-element": "sidebar-content",
107
107
  pt: "var(--spacing300)",
@@ -143,7 +143,7 @@ Sidebar.propTypes = {
143
143
  "focusableContainers": _propTypes.default.arrayOf(_propTypes.default.shape({
144
144
  "current": function (props, propName) {
145
145
  if (props[propName] == null) {
146
- return new Error("Prop '" + propName + "' is required but wasn't specified");
146
+ return null;
147
147
  } else if (typeof props[propName] !== 'object' || props[propName].nodeType !== 1) {
148
148
  return new Error("Expected prop '" + propName + "' to be of type Element");
149
149
  }
@@ -153,9 +153,7 @@ const Textbox = ({
153
153
  "data-role": dataRole,
154
154
  "data-element": dataElement,
155
155
  validationIconId: validationRedesignOptIn ? undefined : validationIconId,
156
- validationRedesignOptIn: validationRedesignOptIn,
157
- size: size,
158
- readOnly: readOnly
156
+ validationRedesignOptIn: validationRedesignOptIn
159
157
  }, (0, _utils.filterStyledSystemMarginProps)(props)), validationRedesignOptIn && labelHelp && /*#__PURE__*/_react.default.createElement(_textbox.StyledHintText, null, labelHelp), validationRedesignOptIn && /*#__PURE__*/_react.default.createElement(_validationMessage.default, {
160
158
  error: error,
161
159
  warning: warning
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-react",
3
- "version": "111.5.0",
3
+ "version": "111.5.1",
4
4
  "description": "A library of reusable React components for easily building user interfaces.",
5
5
  "files": [
6
6
  "lib",