carbon-react 139.0.0 → 140.0.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.
@@ -10,7 +10,7 @@ export interface ContentPaddingInterface {
10
10
  py?: PaddingValues;
11
11
  px?: PaddingValues;
12
12
  }
13
- export interface DialogProps extends ModalProps, TagProps {
13
+ export interface DialogProps extends ModalProps, Omit<TagProps, "data-component"> {
14
14
  /** Custom class name */
15
15
  className?: string;
16
16
  /** Prop to specify the aria-describedby property of the Dialog component */
@@ -16,6 +16,8 @@ import useModalAria from "../../hooks/__internal__/useModalAria/useModalAria";
16
16
  const PADDING_VALUES = [0, 1, 2, 3, 4, 5, 6, 7, 8];
17
17
  const Dialog = /*#__PURE__*/forwardRef(({
18
18
  className,
19
+ "data-element": dataElement = "dialog",
20
+ "data-role": dataRole,
19
21
  children,
20
22
  open,
21
23
  height,
@@ -148,19 +150,14 @@ const Dialog = /*#__PURE__*/forwardRef(({
148
150
  "aria-describedby": subtitle && typeof subtitle === "string" ? subtitleId : rest["aria-describedby"],
149
151
  "aria-label": rest["aria-label"]
150
152
  };
151
- const componentTags = {
152
- "data-component": rest["data-component"] || "dialog",
153
- "data-element": rest["data-element"],
154
- "data-role": rest["data-role"]
155
- };
156
- return /*#__PURE__*/React.createElement(Modal, _extends({
153
+ return /*#__PURE__*/React.createElement(Modal, {
157
154
  open: open,
158
155
  onCancel: onCancel,
159
156
  disableEscKey: disableEscKey,
160
157
  disableClose: disableClose,
161
158
  className: className ? `${className} carbon-dialog` : "carbon-dialog",
162
159
  topModalOverride: topModalOverride
163
- }, componentTags), /*#__PURE__*/React.createElement(FocusTrap, {
160
+ }, /*#__PURE__*/React.createElement(FocusTrap, {
164
161
  autoFocus: !disableAutoFocus,
165
162
  focusFirstElement: focusFirstElement,
166
163
  bespokeTrap: bespokeFocusTrap,
@@ -169,18 +166,21 @@ const Dialog = /*#__PURE__*/forwardRef(({
169
166
  isOpen: open,
170
167
  additionalWrapperRefs: focusableContainers
171
168
  }, /*#__PURE__*/React.createElement(StyledDialog, _extends({
169
+ "data-component": "dialog",
170
+ "data-element": dataElement,
171
+ "data-role": dataRole,
172
172
  "aria-modal": isTopModal ? true : undefined,
173
173
  ref: containerRef,
174
174
  topMargin: TOP_MARGIN
175
175
  }, dialogProps, {
176
- "data-component": "dialog",
177
- "data-element": "dialog",
178
- "data-role": rest["data-role"],
179
176
  role: role,
180
177
  tabIndex: -1
181
178
  }, contentPadding, {
182
179
  backgroundColor: greyBackground ? "var(--colorsUtilityMajor025)" : "var(--colorsUtilityYang100)"
183
- }), dialogTitle(), closeIcon(), /*#__PURE__*/React.createElement(StyledDialogContent, contentPadding, /*#__PURE__*/React.createElement(StyledDialogInnerContent, _extends({
180
+ }), dialogTitle(), closeIcon(), /*#__PURE__*/React.createElement(StyledDialogContent, _extends({}, contentPadding, {
181
+ "data-role": "dialog-content"
182
+ }), /*#__PURE__*/React.createElement(StyledDialogInnerContent, _extends({
183
+ "data-role": "dialog-inner-content",
184
184
  ref: innerContentRef
185
185
  }, contentPadding), children)))));
186
186
  });
@@ -202,7 +202,6 @@ if (process.env.NODE_ENV !== "production") {
202
202
  "px": PropTypes.oneOf([0, 1, 2, 3, 4, 5, 6, 7, 8]),
203
203
  "py": PropTypes.oneOf([0, 1, 2, 3, 4, 5, 6, 7, 8])
204
204
  }),
205
- "data-component": PropTypes.string,
206
205
  "data-element": PropTypes.string,
207
206
  "data-role": PropTypes.string,
208
207
  "disableAutoFocus": PropTypes.bool,
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import { TagProps } from "../../__internal__/utils/helpers/tags";
3
- export interface ModalProps extends TagProps {
3
+ export interface ModalProps extends Omit<TagProps, "data-component"> {
4
4
  /** Custom class name */
5
5
  className?: string;
6
6
  /** Modal content */
@@ -22,5 +22,5 @@ export interface ModalProps extends TagProps {
22
22
  /** Manually override the internal modal stacking order to set this as top */
23
23
  topModalOverride?: boolean;
24
24
  }
25
- declare const Modal: ({ children, open, onCancel, disableEscKey, disableClose, enableBackgroundUI, timeout, topModalOverride, ...rest }: ModalProps) => React.JSX.Element;
25
+ declare const Modal: ({ children, "data-element": dataElement, "data-role": dataRole, open, onCancel, disableEscKey, disableClose, enableBackgroundUI, timeout, topModalOverride, ...rest }: ModalProps) => React.JSX.Element;
26
26
  export default Modal;
@@ -10,6 +10,8 @@ import { StyledModal, StyledModalBackground } from "./modal.style";
10
10
  import ModalContext from "./__internal__/modal.context";
11
11
  const Modal = ({
12
12
  children,
13
+ "data-element": dataElement,
14
+ "data-role": dataRole = "modal",
13
15
  open,
14
16
  onCancel,
15
17
  disableEscKey = false,
@@ -70,6 +72,9 @@ const Modal = ({
70
72
  content = children;
71
73
  }
72
74
  return /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement(StyledModal, _extends({
75
+ "data-component": "modal",
76
+ "data-element": dataElement,
77
+ "data-role": dataRole,
73
78
  "data-state": open ? "open" : "closed",
74
79
  transitionName: "modal",
75
80
  transitionTime: timeout,
@@ -10,7 +10,7 @@ export interface ContentPaddingInterface {
10
10
  py?: PaddingValues;
11
11
  px?: PaddingValues;
12
12
  }
13
- export interface DialogProps extends ModalProps, TagProps {
13
+ export interface DialogProps extends ModalProps, Omit<TagProps, "data-component"> {
14
14
  /** Custom class name */
15
15
  className?: string;
16
16
  /** Prop to specify the aria-describedby property of the Dialog component */
@@ -25,6 +25,8 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
25
25
  const PADDING_VALUES = [0, 1, 2, 3, 4, 5, 6, 7, 8];
26
26
  const Dialog = exports.Dialog = /*#__PURE__*/(0, _react.forwardRef)(({
27
27
  className,
28
+ "data-element": dataElement = "dialog",
29
+ "data-role": dataRole,
28
30
  children,
29
31
  open,
30
32
  height,
@@ -157,19 +159,14 @@ const Dialog = exports.Dialog = /*#__PURE__*/(0, _react.forwardRef)(({
157
159
  "aria-describedby": subtitle && typeof subtitle === "string" ? subtitleId : rest["aria-describedby"],
158
160
  "aria-label": rest["aria-label"]
159
161
  };
160
- const componentTags = {
161
- "data-component": rest["data-component"] || "dialog",
162
- "data-element": rest["data-element"],
163
- "data-role": rest["data-role"]
164
- };
165
- return /*#__PURE__*/_react.default.createElement(_modal.default, _extends({
162
+ return /*#__PURE__*/_react.default.createElement(_modal.default, {
166
163
  open: open,
167
164
  onCancel: onCancel,
168
165
  disableEscKey: disableEscKey,
169
166
  disableClose: disableClose,
170
167
  className: className ? `${className} carbon-dialog` : "carbon-dialog",
171
168
  topModalOverride: topModalOverride
172
- }, componentTags), /*#__PURE__*/_react.default.createElement(_focusTrap.default, {
169
+ }, /*#__PURE__*/_react.default.createElement(_focusTrap.default, {
173
170
  autoFocus: !disableAutoFocus,
174
171
  focusFirstElement: focusFirstElement,
175
172
  bespokeTrap: bespokeFocusTrap,
@@ -178,18 +175,21 @@ const Dialog = exports.Dialog = /*#__PURE__*/(0, _react.forwardRef)(({
178
175
  isOpen: open,
179
176
  additionalWrapperRefs: focusableContainers
180
177
  }, /*#__PURE__*/_react.default.createElement(_dialog.StyledDialog, _extends({
178
+ "data-component": "dialog",
179
+ "data-element": dataElement,
180
+ "data-role": dataRole,
181
181
  "aria-modal": isTopModal ? true : undefined,
182
182
  ref: containerRef,
183
183
  topMargin: _dialog2.TOP_MARGIN
184
184
  }, dialogProps, {
185
- "data-component": "dialog",
186
- "data-element": "dialog",
187
- "data-role": rest["data-role"],
188
185
  role: role,
189
186
  tabIndex: -1
190
187
  }, contentPadding, {
191
188
  backgroundColor: greyBackground ? "var(--colorsUtilityMajor025)" : "var(--colorsUtilityYang100)"
192
- }), dialogTitle(), closeIcon(), /*#__PURE__*/_react.default.createElement(_dialog.StyledDialogContent, contentPadding, /*#__PURE__*/_react.default.createElement(_dialog.StyledDialogInnerContent, _extends({
189
+ }), dialogTitle(), closeIcon(), /*#__PURE__*/_react.default.createElement(_dialog.StyledDialogContent, _extends({}, contentPadding, {
190
+ "data-role": "dialog-content"
191
+ }), /*#__PURE__*/_react.default.createElement(_dialog.StyledDialogInnerContent, _extends({
192
+ "data-role": "dialog-inner-content",
193
193
  ref: innerContentRef
194
194
  }, contentPadding), children)))));
195
195
  });
@@ -211,7 +211,6 @@ if (process.env.NODE_ENV !== "production") {
211
211
  "px": _propTypes.default.oneOf([0, 1, 2, 3, 4, 5, 6, 7, 8]),
212
212
  "py": _propTypes.default.oneOf([0, 1, 2, 3, 4, 5, 6, 7, 8])
213
213
  }),
214
- "data-component": _propTypes.default.string,
215
214
  "data-element": _propTypes.default.string,
216
215
  "data-role": _propTypes.default.string,
217
216
  "disableAutoFocus": _propTypes.default.bool,
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import { TagProps } from "../../__internal__/utils/helpers/tags";
3
- export interface ModalProps extends TagProps {
3
+ export interface ModalProps extends Omit<TagProps, "data-component"> {
4
4
  /** Custom class name */
5
5
  className?: string;
6
6
  /** Modal content */
@@ -22,5 +22,5 @@ export interface ModalProps extends TagProps {
22
22
  /** Manually override the internal modal stacking order to set this as top */
23
23
  topModalOverride?: boolean;
24
24
  }
25
- declare const Modal: ({ children, open, onCancel, disableEscKey, disableClose, enableBackgroundUI, timeout, topModalOverride, ...rest }: ModalProps) => React.JSX.Element;
25
+ declare const Modal: ({ children, "data-element": dataElement, "data-role": dataRole, open, onCancel, disableEscKey, disableClose, enableBackgroundUI, timeout, topModalOverride, ...rest }: ModalProps) => React.JSX.Element;
26
26
  export default Modal;
@@ -19,6 +19,8 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
19
19
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
20
20
  const Modal = ({
21
21
  children,
22
+ "data-element": dataElement,
23
+ "data-role": dataRole = "modal",
22
24
  open,
23
25
  onCancel,
24
26
  disableEscKey = false,
@@ -79,6 +81,9 @@ const Modal = ({
79
81
  content = children;
80
82
  }
81
83
  return /*#__PURE__*/_react.default.createElement(_portal.default, null, /*#__PURE__*/_react.default.createElement(_modal.StyledModal, _extends({
84
+ "data-component": "modal",
85
+ "data-element": dataElement,
86
+ "data-role": dataRole,
82
87
  "data-state": open ? "open" : "closed",
83
88
  transitionName: "modal",
84
89
  transitionTime: timeout,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-react",
3
- "version": "139.0.0",
3
+ "version": "140.0.0",
4
4
  "description": "A library of reusable React components for easily building user interfaces.",
5
5
  "files": [
6
6
  "lib",