carbon-react 141.0.4 → 141.0.6

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, Omit<TagProps, "data-component"> {
13
+ export interface DialogProps extends ModalProps, TagProps {
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,7 @@ 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-component": dataComponent = "dialog",
19
20
  "data-element": dataElement = "dialog",
20
21
  "data-role": dataRole,
21
22
  children,
@@ -166,7 +167,7 @@ const Dialog = /*#__PURE__*/forwardRef(({
166
167
  isOpen: open,
167
168
  additionalWrapperRefs: focusableContainers
168
169
  }, /*#__PURE__*/React.createElement(StyledDialog, _extends({
169
- "data-component": "dialog",
170
+ "data-component": dataComponent,
170
171
  "data-element": dataElement,
171
172
  "data-role": dataRole,
172
173
  "aria-modal": isTopModal ? true : undefined,
@@ -202,6 +203,7 @@ if (process.env.NODE_ENV !== "production") {
202
203
  "px": PropTypes.oneOf([0, 1, 2, 3, 4, 5, 6, 7, 8]),
203
204
  "py": PropTypes.oneOf([0, 1, 2, 3, 4, 5, 6, 7, 8])
204
205
  }),
206
+ "data-component": PropTypes.string,
205
207
  "data-element": PropTypes.string,
206
208
  "data-role": PropTypes.string,
207
209
  "disableAutoFocus": PropTypes.bool,
@@ -149,7 +149,7 @@ export const NumeralDate = ({
149
149
  }
150
150
  });
151
151
  const onKeyDown = event => {
152
- const isValidKey = Events.isNumberKey(event) || Events.isTabKey(event) || event.key === "Delete" || event.key === "Backspace";
152
+ const isValidKey = Events.isNumberKey(event) || Events.isTabKey(event) || Events.isEnterKey(event) || event.key === "Delete" || event.key === "Backspace";
153
153
  if (!isValidKey) {
154
154
  event.preventDefault();
155
155
  }
@@ -8,9 +8,9 @@ function highlightPartOfText(text, partToHighlight) {
8
8
  if (indexOfFirstMatch === -1) {
9
9
  return text;
10
10
  }
11
- const precedingText = text.substr(0, indexOfFirstMatch);
12
- const matchingText = text.substr(indexOfFirstMatch, partToHighlight.length);
13
- const followingText = text.substr(indexOfFirstMatch + partToHighlight.length, text.length);
11
+ const precedingText = text.slice(0, indexOfFirstMatch);
12
+ const matchingText = text.slice(indexOfFirstMatch, indexOfFirstMatch + partToHighlight.length);
13
+ const followingText = text.slice(indexOfFirstMatch + partToHighlight.length, text.length);
14
14
  let followingTextNode = followingText;
15
15
  if (followingText.length >= partToHighlight.length) {
16
16
  followingTextNode = highlightPartOfText(followingText, partToHighlight);
@@ -18,7 +18,8 @@ function highlightPartOfText(text, partToHighlight) {
18
18
  const newValue = [/*#__PURE__*/React.createElement("span", {
19
19
  key: "preceding"
20
20
  }, precedingText), /*#__PURE__*/React.createElement(MatchingText, {
21
- key: "match"
21
+ key: "match",
22
+ "data-role": "matching-text"
22
23
  }, matchingText), /*#__PURE__*/React.createElement("span", {
23
24
  key: "following"
24
25
  }, followingTextNode)];
@@ -10,7 +10,7 @@ export interface ContentPaddingInterface {
10
10
  py?: PaddingValues;
11
11
  px?: PaddingValues;
12
12
  }
13
- export interface DialogProps extends ModalProps, Omit<TagProps, "data-component"> {
13
+ export interface DialogProps extends ModalProps, TagProps {
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,7 @@ 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-component": dataComponent = "dialog",
28
29
  "data-element": dataElement = "dialog",
29
30
  "data-role": dataRole,
30
31
  children,
@@ -175,7 +176,7 @@ const Dialog = exports.Dialog = /*#__PURE__*/(0, _react.forwardRef)(({
175
176
  isOpen: open,
176
177
  additionalWrapperRefs: focusableContainers
177
178
  }, /*#__PURE__*/_react.default.createElement(_dialog.StyledDialog, _extends({
178
- "data-component": "dialog",
179
+ "data-component": dataComponent,
179
180
  "data-element": dataElement,
180
181
  "data-role": dataRole,
181
182
  "aria-modal": isTopModal ? true : undefined,
@@ -211,6 +212,7 @@ if (process.env.NODE_ENV !== "production") {
211
212
  "px": _propTypes.default.oneOf([0, 1, 2, 3, 4, 5, 6, 7, 8]),
212
213
  "py": _propTypes.default.oneOf([0, 1, 2, 3, 4, 5, 6, 7, 8])
213
214
  }),
215
+ "data-component": _propTypes.default.string,
214
216
  "data-element": _propTypes.default.string,
215
217
  "data-role": _propTypes.default.string,
216
218
  "disableAutoFocus": _propTypes.default.bool,
@@ -158,7 +158,7 @@ const NumeralDate = ({
158
158
  }
159
159
  });
160
160
  const onKeyDown = event => {
161
- const isValidKey = _events.default.isNumberKey(event) || _events.default.isTabKey(event) || event.key === "Delete" || event.key === "Backspace";
161
+ const isValidKey = _events.default.isNumberKey(event) || _events.default.isTabKey(event) || _events.default.isEnterKey(event) || event.key === "Delete" || event.key === "Backspace";
162
162
  if (!isValidKey) {
163
163
  event.preventDefault();
164
164
  }
@@ -15,9 +15,9 @@ function highlightPartOfText(text, partToHighlight) {
15
15
  if (indexOfFirstMatch === -1) {
16
16
  return text;
17
17
  }
18
- const precedingText = text.substr(0, indexOfFirstMatch);
19
- const matchingText = text.substr(indexOfFirstMatch, partToHighlight.length);
20
- const followingText = text.substr(indexOfFirstMatch + partToHighlight.length, text.length);
18
+ const precedingText = text.slice(0, indexOfFirstMatch);
19
+ const matchingText = text.slice(indexOfFirstMatch, indexOfFirstMatch + partToHighlight.length);
20
+ const followingText = text.slice(indexOfFirstMatch + partToHighlight.length, text.length);
21
21
  let followingTextNode = followingText;
22
22
  if (followingText.length >= partToHighlight.length) {
23
23
  followingTextNode = highlightPartOfText(followingText, partToHighlight);
@@ -25,7 +25,8 @@ function highlightPartOfText(text, partToHighlight) {
25
25
  const newValue = [/*#__PURE__*/_react.default.createElement("span", {
26
26
  key: "preceding"
27
27
  }, precedingText), /*#__PURE__*/_react.default.createElement(_matchingText.default, {
28
- key: "match"
28
+ key: "match",
29
+ "data-role": "matching-text"
29
30
  }, matchingText), /*#__PURE__*/_react.default.createElement("span", {
30
31
  key: "following"
31
32
  }, followingTextNode)];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-react",
3
- "version": "141.0.4",
3
+ "version": "141.0.6",
4
4
  "description": "A library of reusable React components for easily building user interfaces.",
5
5
  "files": [
6
6
  "lib",