carbon-react 142.11.5 → 142.11.7

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 (27) hide show
  1. package/esm/__internal__/checkable-input/checkable-input.component.js +3 -1
  2. package/esm/__internal__/utils/helpers/tags/tags-specs/index.d.ts +1 -1
  3. package/esm/__internal__/utils/helpers/tags/tags-specs/index.js +1 -1
  4. package/esm/__internal__/utils/helpers/tags/tags-specs/tags-specs.d.ts +2 -2
  5. package/esm/__internal__/utils/helpers/tags/tags-specs/tags-specs.js +3 -11
  6. package/esm/__internal__/validation-message/validation-message.component.js +2 -1
  7. package/esm/components/accordion/accordion.component.js +4 -1
  8. package/esm/components/content/content.component.js +2 -0
  9. package/esm/components/date/date.component.js +36 -17
  10. package/esm/components/detail/detail.component.js +1 -0
  11. package/esm/components/switch/__internal__/switch-slider.component.js +5 -2
  12. package/esm/components/switch/switch.component.js +7 -1
  13. package/esm/locales/fr-fr.js +3 -3
  14. package/lib/__internal__/checkable-input/checkable-input.component.js +3 -1
  15. package/lib/__internal__/utils/helpers/tags/tags-specs/index.d.ts +1 -1
  16. package/lib/__internal__/utils/helpers/tags/tags-specs/index.js +4 -9
  17. package/lib/__internal__/utils/helpers/tags/tags-specs/tags-specs.d.ts +2 -2
  18. package/lib/__internal__/utils/helpers/tags/tags-specs/tags-specs.js +2 -12
  19. package/lib/__internal__/validation-message/validation-message.component.js +2 -1
  20. package/lib/components/accordion/accordion.component.js +4 -1
  21. package/lib/components/content/content.component.js +2 -0
  22. package/lib/components/date/date.component.js +36 -17
  23. package/lib/components/detail/detail.component.js +1 -0
  24. package/lib/components/switch/__internal__/switch-slider.component.js +5 -2
  25. package/lib/components/switch/switch.component.js +7 -1
  26. package/lib/locales/fr-fr.js +3 -3
  27. package/package.json +1 -1
@@ -106,7 +106,9 @@ const CheckableInput = /*#__PURE__*/React.forwardRef(({
106
106
  reverse: reverse
107
107
  }, /*#__PURE__*/React.createElement(InputBehaviour, null, /*#__PURE__*/React.createElement(FormField, _extends({}, formFieldProps, {
108
108
  my: 0
109
- }), /*#__PURE__*/React.createElement(StyledCheckableInput, null, /*#__PURE__*/React.createElement(HiddenCheckableInput, inputProps), children))));
109
+ }), /*#__PURE__*/React.createElement(StyledCheckableInput, {
110
+ "data-role": "checkable-input"
111
+ }, /*#__PURE__*/React.createElement(HiddenCheckableInput, inputProps), children))));
110
112
  });
111
113
  if (process.env.NODE_ENV !== "production") {
112
114
  CheckableInput.propTypes = {
@@ -1 +1 @@
1
- export { elementsTagTest, rootTagTest } from "./tags-specs";
1
+ export { default } from "./tags-specs";
@@ -1 +1 @@
1
- export { elementsTagTest, rootTagTest } from "./tags-specs";
1
+ export { default } from "./tags-specs";
@@ -1,3 +1,3 @@
1
1
  import { ReactWrapper, ShallowWrapper } from "enzyme";
2
- export declare const elementsTagTest: (wrapper: ReactWrapper | ShallowWrapper, elements: string[]) => void;
3
- export declare const rootTagTest: (rootNode: ReactWrapper | ShallowWrapper, comp: string, elem?: string, role?: string) => void;
2
+ declare const rootTagTest: (rootNode: ReactWrapper | ShallowWrapper, comp: string, elem?: string, role?: string) => void;
3
+ export default rootTagTest;
@@ -1,14 +1,6 @@
1
- export const elementsTagTest = (wrapper, elements) => {
2
- elements.forEach(element => {
3
- it(`include 'data-element="${element}"'`, () => {
4
- expect(wrapper.find({
5
- "data-element": element
6
- }).length).toEqual(1);
7
- });
8
- });
9
- };
10
- export const rootTagTest = (rootNode, comp, elem, role) => {
1
+ const rootTagTest = (rootNode, comp, elem, role) => {
11
2
  expect(rootNode.prop("data-component")).toEqual(comp);
12
3
  expect(rootNode.prop("data-element")).toEqual(elem);
13
4
  expect(rootNode.prop("data-role")).toEqual(role);
14
- };
5
+ };
6
+ export default rootTagTest;
@@ -10,7 +10,8 @@ const ValidationMessage = ({
10
10
  const isStringValidation = typeof validation === "string";
11
11
  return isStringValidation ? /*#__PURE__*/React.createElement(StyledValidationMessage, {
12
12
  id: validationId,
13
- isWarning: !!(!error && warning)
13
+ isWarning: !!(!error && warning),
14
+ "data-role": "validation-message"
14
15
  }, validation) : null;
15
16
  };
16
17
  export default ValidationMessage;
@@ -79,6 +79,7 @@ const Accordion = /*#__PURE__*/React.forwardRef(({
79
79
  return /*#__PURE__*/React.createElement(StyledAccordionContainer, _extends({
80
80
  id: accordionId,
81
81
  "data-component": "accordion",
82
+ "data-role": "accordion-container",
82
83
  width: width,
83
84
  borders: variant === "subtle" ? "none" : borders,
84
85
  scheme: scheme,
@@ -125,10 +126,12 @@ const Accordion = /*#__PURE__*/React.forwardRef(({
125
126
  iconAlign: iconAlign || (variant === "standard" ? "right" : "left")
126
127
  })), /*#__PURE__*/React.createElement(StyledAccordionContentContainer, {
127
128
  isExpanded: isExpanded,
128
- maxHeight: contentHeight
129
+ maxHeight: contentHeight,
130
+ "data-role": "accordion-content-container"
129
131
  }, /*#__PURE__*/React.createElement(StyledAccordionContent, {
130
132
  role: "region",
131
133
  "data-element": "accordion-content",
134
+ "data-role": "accordion-content",
132
135
  id: contentId,
133
136
  "aria-labelledby": headerId,
134
137
  ref: accordionContent,
@@ -21,12 +21,14 @@ export const Content = ({
21
21
  variant: variant,
22
22
  inline: inline,
23
23
  "data-element": "content-title",
24
+ "data-role": "content-title",
24
25
  titleWidth: titleWidth,
25
26
  align: align
26
27
  }, title), /*#__PURE__*/React.createElement(StyledContentBody, {
27
28
  variant: variant,
28
29
  inline: inline,
29
30
  "data-element": "content-body",
31
+ "data-role": "content-body",
30
32
  bodyFullWidth: bodyFullWidth,
31
33
  titleWidth: titleWidth,
32
34
  align: align
@@ -10,7 +10,6 @@ import StyledDateInput from "./date.style";
10
10
  import Textbox from "../textbox";
11
11
  import DatePicker from "./__internal__/date-picker";
12
12
  import DateRangeContext from "../date-range/__internal__/date-range.context";
13
- import useClickAwayListener from "../../hooks/__internal__/useClickAwayListener";
14
13
  import useFormSpacing from "../../hooks/__internal__/useFormSpacing";
15
14
  import guid from "../../__internal__/utils/helpers/guid";
16
15
  const DateInput = /*#__PURE__*/React.forwardRef(({
@@ -48,6 +47,7 @@ const DateInput = /*#__PURE__*/React.forwardRef(({
48
47
  const alreadyFocused = useRef(false);
49
48
  const isBlurBlocked = useRef(false);
50
49
  const focusedViaPicker = useRef(false);
50
+ const blockClose = useRef(false);
51
51
  const locale = useLocale();
52
52
  const {
53
53
  dateFnsLocale
@@ -89,17 +89,30 @@ const DateInput = /*#__PURE__*/React.forwardRef(({
89
89
  };
90
90
  return customEvent;
91
91
  };
92
- const handleClickAway = () => {
93
- if (open) {
94
- alreadyFocused.current = true;
95
- internalInputRef.current?.focus();
96
- isBlurBlocked.current = false;
97
- internalInputRef.current?.blur();
98
- setOpen(false);
99
- alreadyFocused.current = false;
100
- }
101
- };
102
- const handleClickInside = useClickAwayListener(handleClickAway, "mousedown");
92
+
93
+ // Add custom listener to prevent issues with regards to double calls within the Date component
94
+ // This is a temporary fix until the Date component is refactored more info can be found:
95
+ // TODO: FE-6757
96
+ useEffect(() => {
97
+ const handleClick = () => {
98
+ if (!blockClose.current) {
99
+ if (open) {
100
+ alreadyFocused.current = true;
101
+ internalInputRef.current?.focus();
102
+ isBlurBlocked.current = false;
103
+ internalInputRef.current?.blur();
104
+ setOpen(false);
105
+ alreadyFocused.current = false;
106
+ }
107
+ } else {
108
+ blockClose.current = false;
109
+ }
110
+ };
111
+ document.addEventListener("mousedown", handleClick);
112
+ return function cleanup() {
113
+ document.removeEventListener("mousedown", handleClick);
114
+ };
115
+ }, [open]);
103
116
  const handleChange = ev => {
104
117
  isInitialValue.current = false;
105
118
  onChange(buildCustomEvent(ev));
@@ -165,7 +178,9 @@ const DateInput = /*#__PURE__*/React.forwardRef(({
165
178
  }
166
179
  isBlurBlocked.current = false;
167
180
  if (!open && !alreadyFocused.current) {
168
- setOpen(true);
181
+ setTimeout(() => {
182
+ setOpen(true);
183
+ }, 0);
169
184
  } else {
170
185
  alreadyFocused.current = false;
171
186
  }
@@ -200,7 +215,7 @@ const DateInput = /*#__PURE__*/React.forwardRef(({
200
215
  }
201
216
  };
202
217
  const handleMouseDown = ev => {
203
- handleClickInside();
218
+ blockClose.current = true;
204
219
  if (setInputRefMap) {
205
220
  isBlurBlocked.current = true;
206
221
  }
@@ -209,9 +224,13 @@ const DateInput = /*#__PURE__*/React.forwardRef(({
209
224
  } = ev.target;
210
225
  if (type !== "text") {
211
226
  alreadyFocused.current = true;
212
- setOpen(prev => !prev);
227
+ setTimeout(() => {
228
+ setOpen(prev => !prev);
229
+ }, 0);
213
230
  } else if (!open) {
214
- setOpen(true);
231
+ setTimeout(() => {
232
+ setOpen(true);
233
+ }, 0);
215
234
  }
216
235
  };
217
236
  const handleIconMouseDown = ev => {
@@ -220,7 +239,7 @@ const DateInput = /*#__PURE__*/React.forwardRef(({
220
239
  };
221
240
  const handlePickerMouseDown = () => {
222
241
  isBlurBlocked.current = true;
223
- handleClickInside();
242
+ blockClose.current = true;
224
243
  };
225
244
  const assignInput = useCallback(inputElement => {
226
245
  internalInputRef.current = inputElement;
@@ -20,6 +20,7 @@ export const Detail = ({
20
20
  hasIcon: !!icon
21
21
  }, children), footnote && /*#__PURE__*/React.createElement(StyledDetailFootnote, {
22
22
  "data-element": "footnote",
23
+ "data-role": "footnote",
23
24
  hasIcon: !!icon
24
25
  }, footnote));
25
26
  Detail.displayName = "Detail";
@@ -44,12 +44,15 @@ const SwitchSlider = ({
44
44
  isActive: checked,
45
45
  size
46
46
  };
47
- const sliderContent = /*#__PURE__*/React.createElement(SwitchSliderPanel, sliderPanelStyleProps, loading ? /*#__PURE__*/React.createElement(Loader, loaderProps) : panelContent);
47
+ const sliderContent = /*#__PURE__*/React.createElement(SwitchSliderPanel, _extends({
48
+ "data-role": "slider-panel"
49
+ }, sliderPanelStyleProps), loading ? /*#__PURE__*/React.createElement(Loader, loaderProps) : panelContent);
48
50
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(HiddenContent, {
49
51
  size: size,
50
52
  "aria-hidden": true
51
53
  }, longestText), /*#__PURE__*/React.createElement(StyledSwitchSlider, _extends({
52
- "data-component": "slider"
54
+ "data-component": "slider",
55
+ "data-role": "slider"
53
56
  }, switchSliderStyleProps), sliderContent, useValidationIcon && /*#__PURE__*/React.createElement(ValidationIcon, {
54
57
  error: error,
55
58
  warning: warning,
@@ -58,6 +58,8 @@ const Switch = /*#__PURE__*/React.forwardRef(({
58
58
  }, [setCheckedInternal, onChange]);
59
59
  const largeScreen = useIsAboveBreakpoint(adaptiveLabelBreakpoint);
60
60
  let shouldLabelBeInline = labelInline;
61
+ // Coverage has been ignored here as this functionality is covered in a Playwright test.
62
+ /* istanbul ignore next */
61
63
  if (adaptiveLabelBreakpoint) {
62
64
  shouldLabelBeInline = largeScreen;
63
65
  }
@@ -152,13 +154,17 @@ const Switch = /*#__PURE__*/React.forwardRef(({
152
154
  };
153
155
  const applyValidation = error || warning;
154
156
  return /*#__PURE__*/React.createElement(React.Fragment, null, validationRedesignOptIn ? /*#__PURE__*/React.createElement(StyledSwitch, switchStylePropsForNewValidation, /*#__PURE__*/React.createElement(Label, null, /*#__PURE__*/React.createElement(Box, {
157
+ "data-role": "hint-text-wrapper",
155
158
  mb: labelHelp ? 0 : 1
156
- }, label, labelHelp && /*#__PURE__*/React.createElement(StyledHintText, null, labelHelp)), /*#__PURE__*/React.createElement(Box, {
159
+ }, label, labelHelp && /*#__PURE__*/React.createElement(StyledHintText, {
160
+ "data-role": "hint-text"
161
+ }, labelHelp)), /*#__PURE__*/React.createElement(Box, {
157
162
  position: "relative"
158
163
  }, /*#__PURE__*/React.createElement(ValidationMessage, {
159
164
  error: error,
160
165
  warning: warning
161
166
  }), applyValidation && /*#__PURE__*/React.createElement(ErrorBorder, {
167
+ "data-role": "error-border",
162
168
  warning: !!(!error && warning)
163
169
  }), /*#__PURE__*/React.createElement(CheckableInput, inputPropsForNewValidation, /*#__PURE__*/React.createElement(SwitchSlider, switchSliderPropsForNewValidation))))) : /*#__PURE__*/React.createElement(TooltipProvider, {
164
170
  helpAriaLabel: helpAriaLabel,
@@ -87,13 +87,13 @@ const frFR = {
87
87
  skipLinkLabel: () => "Passer au contenu principal"
88
88
  },
89
89
  loader: {
90
- loading: () => "Téléhargement"
90
+ loading: () => "Chargement en cours"
91
91
  },
92
92
  loaderSpinner: {
93
- loading: () => "Téléhargement..."
93
+ loading: () => "Chargement en cours..."
94
94
  },
95
95
  loaderStar: {
96
- loading: () => "Téléhargement..."
96
+ loading: () => "Chargement en cours..."
97
97
  },
98
98
  menuFullscreen: {
99
99
  ariaLabels: {
@@ -115,7 +115,9 @@ const CheckableInput = /*#__PURE__*/_react.default.forwardRef(({
115
115
  reverse: reverse
116
116
  }, /*#__PURE__*/_react.default.createElement(_inputBehaviour.InputBehaviour, null, /*#__PURE__*/_react.default.createElement(_formField.default, _extends({}, formFieldProps, {
117
117
  my: 0
118
- }), /*#__PURE__*/_react.default.createElement(_checkableInput.StyledCheckableInput, null, /*#__PURE__*/_react.default.createElement(_hiddenCheckableInput.default, inputProps), children))));
118
+ }), /*#__PURE__*/_react.default.createElement(_checkableInput.StyledCheckableInput, {
119
+ "data-role": "checkable-input"
120
+ }, /*#__PURE__*/_react.default.createElement(_hiddenCheckableInput.default, inputProps), children))));
119
121
  });
120
122
  if (process.env.NODE_ENV !== "production") {
121
123
  CheckableInput.propTypes = {
@@ -1 +1 @@
1
- export { elementsTagTest, rootTagTest } from "./tags-specs";
1
+ export { default } from "./tags-specs";
@@ -3,16 +3,11 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- Object.defineProperty(exports, "elementsTagTest", {
6
+ Object.defineProperty(exports, "default", {
7
7
  enumerable: true,
8
8
  get: function () {
9
- return _tagsSpecs.elementsTagTest;
9
+ return _tagsSpecs.default;
10
10
  }
11
11
  });
12
- Object.defineProperty(exports, "rootTagTest", {
13
- enumerable: true,
14
- get: function () {
15
- return _tagsSpecs.rootTagTest;
16
- }
17
- });
18
- var _tagsSpecs = require("./tags-specs");
12
+ var _tagsSpecs = _interopRequireDefault(require("./tags-specs"));
13
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
@@ -1,3 +1,3 @@
1
1
  import { ReactWrapper, ShallowWrapper } from "enzyme";
2
- export declare const elementsTagTest: (wrapper: ReactWrapper | ShallowWrapper, elements: string[]) => void;
3
- export declare const rootTagTest: (rootNode: ReactWrapper | ShallowWrapper, comp: string, elem?: string, role?: string) => void;
2
+ declare const rootTagTest: (rootNode: ReactWrapper | ShallowWrapper, comp: string, elem?: string, role?: string) => void;
3
+ export default rootTagTest;
@@ -3,20 +3,10 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.rootTagTest = exports.elementsTagTest = void 0;
7
- const elementsTagTest = (wrapper, elements) => {
8
- elements.forEach(element => {
9
- it(`include 'data-element="${element}"'`, () => {
10
- expect(wrapper.find({
11
- "data-element": element
12
- }).length).toEqual(1);
13
- });
14
- });
15
- };
16
- exports.elementsTagTest = elementsTagTest;
6
+ exports.default = void 0;
17
7
  const rootTagTest = (rootNode, comp, elem, role) => {
18
8
  expect(rootNode.prop("data-component")).toEqual(comp);
19
9
  expect(rootNode.prop("data-element")).toEqual(elem);
20
10
  expect(rootNode.prop("data-role")).toEqual(role);
21
11
  };
22
- exports.rootTagTest = rootTagTest;
12
+ var _default = exports.default = rootTagTest;
@@ -17,7 +17,8 @@ const ValidationMessage = ({
17
17
  const isStringValidation = typeof validation === "string";
18
18
  return isStringValidation ? /*#__PURE__*/_react.default.createElement(_validationMessage.default, {
19
19
  id: validationId,
20
- isWarning: !!(!error && warning)
20
+ isWarning: !!(!error && warning),
21
+ "data-role": "validation-message"
21
22
  }, validation) : null;
22
23
  };
23
24
  var _default = exports.default = ValidationMessage;
@@ -88,6 +88,7 @@ const Accordion = exports.Accordion = /*#__PURE__*/_react.default.forwardRef(({
88
88
  return /*#__PURE__*/_react.default.createElement(_accordion.StyledAccordionContainer, _extends({
89
89
  id: accordionId,
90
90
  "data-component": "accordion",
91
+ "data-role": "accordion-container",
91
92
  width: width,
92
93
  borders: variant === "subtle" ? "none" : borders,
93
94
  scheme: scheme,
@@ -134,10 +135,12 @@ const Accordion = exports.Accordion = /*#__PURE__*/_react.default.forwardRef(({
134
135
  iconAlign: iconAlign || (variant === "standard" ? "right" : "left")
135
136
  })), /*#__PURE__*/_react.default.createElement(_accordion.StyledAccordionContentContainer, {
136
137
  isExpanded: isExpanded,
137
- maxHeight: contentHeight
138
+ maxHeight: contentHeight,
139
+ "data-role": "accordion-content-container"
138
140
  }, /*#__PURE__*/_react.default.createElement(_accordion.StyledAccordionContent, {
139
141
  role: "region",
140
142
  "data-element": "accordion-content",
143
+ "data-role": "accordion-content",
141
144
  id: contentId,
142
145
  "aria-labelledby": headerId,
143
146
  ref: accordionContent,
@@ -28,12 +28,14 @@ const Content = ({
28
28
  variant: variant,
29
29
  inline: inline,
30
30
  "data-element": "content-title",
31
+ "data-role": "content-title",
31
32
  titleWidth: titleWidth,
32
33
  align: align
33
34
  }, title), /*#__PURE__*/_react.default.createElement(_content.StyledContentBody, {
34
35
  variant: variant,
35
36
  inline: inline,
36
37
  "data-element": "content-body",
38
+ "data-role": "content-body",
37
39
  bodyFullWidth: bodyFullWidth,
38
40
  titleWidth: titleWidth,
39
41
  align: align
@@ -15,7 +15,6 @@ var _date = _interopRequireDefault(require("./date.style"));
15
15
  var _textbox = _interopRequireDefault(require("../textbox"));
16
16
  var _datePicker = _interopRequireDefault(require("./__internal__/date-picker"));
17
17
  var _dateRange = _interopRequireDefault(require("../date-range/__internal__/date-range.context"));
18
- var _useClickAwayListener = _interopRequireDefault(require("../../hooks/__internal__/useClickAwayListener"));
19
18
  var _useFormSpacing = _interopRequireDefault(require("../../hooks/__internal__/useFormSpacing"));
20
19
  var _guid = _interopRequireDefault(require("../../__internal__/utils/helpers/guid"));
21
20
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
@@ -57,6 +56,7 @@ const DateInput = exports.DateInput = /*#__PURE__*/_react.default.forwardRef(({
57
56
  const alreadyFocused = (0, _react.useRef)(false);
58
57
  const isBlurBlocked = (0, _react.useRef)(false);
59
58
  const focusedViaPicker = (0, _react.useRef)(false);
59
+ const blockClose = (0, _react.useRef)(false);
60
60
  const locale = (0, _useLocale.default)();
61
61
  const {
62
62
  dateFnsLocale
@@ -98,17 +98,30 @@ const DateInput = exports.DateInput = /*#__PURE__*/_react.default.forwardRef(({
98
98
  };
99
99
  return customEvent;
100
100
  };
101
- const handleClickAway = () => {
102
- if (open) {
103
- alreadyFocused.current = true;
104
- internalInputRef.current?.focus();
105
- isBlurBlocked.current = false;
106
- internalInputRef.current?.blur();
107
- setOpen(false);
108
- alreadyFocused.current = false;
109
- }
110
- };
111
- const handleClickInside = (0, _useClickAwayListener.default)(handleClickAway, "mousedown");
101
+
102
+ // Add custom listener to prevent issues with regards to double calls within the Date component
103
+ // This is a temporary fix until the Date component is refactored more info can be found:
104
+ // TODO: FE-6757
105
+ (0, _react.useEffect)(() => {
106
+ const handleClick = () => {
107
+ if (!blockClose.current) {
108
+ if (open) {
109
+ alreadyFocused.current = true;
110
+ internalInputRef.current?.focus();
111
+ isBlurBlocked.current = false;
112
+ internalInputRef.current?.blur();
113
+ setOpen(false);
114
+ alreadyFocused.current = false;
115
+ }
116
+ } else {
117
+ blockClose.current = false;
118
+ }
119
+ };
120
+ document.addEventListener("mousedown", handleClick);
121
+ return function cleanup() {
122
+ document.removeEventListener("mousedown", handleClick);
123
+ };
124
+ }, [open]);
112
125
  const handleChange = ev => {
113
126
  isInitialValue.current = false;
114
127
  onChange(buildCustomEvent(ev));
@@ -174,7 +187,9 @@ const DateInput = exports.DateInput = /*#__PURE__*/_react.default.forwardRef(({
174
187
  }
175
188
  isBlurBlocked.current = false;
176
189
  if (!open && !alreadyFocused.current) {
177
- setOpen(true);
190
+ setTimeout(() => {
191
+ setOpen(true);
192
+ }, 0);
178
193
  } else {
179
194
  alreadyFocused.current = false;
180
195
  }
@@ -209,7 +224,7 @@ const DateInput = exports.DateInput = /*#__PURE__*/_react.default.forwardRef(({
209
224
  }
210
225
  };
211
226
  const handleMouseDown = ev => {
212
- handleClickInside();
227
+ blockClose.current = true;
213
228
  if (setInputRefMap) {
214
229
  isBlurBlocked.current = true;
215
230
  }
@@ -218,9 +233,13 @@ const DateInput = exports.DateInput = /*#__PURE__*/_react.default.forwardRef(({
218
233
  } = ev.target;
219
234
  if (type !== "text") {
220
235
  alreadyFocused.current = true;
221
- setOpen(prev => !prev);
236
+ setTimeout(() => {
237
+ setOpen(prev => !prev);
238
+ }, 0);
222
239
  } else if (!open) {
223
- setOpen(true);
240
+ setTimeout(() => {
241
+ setOpen(true);
242
+ }, 0);
224
243
  }
225
244
  };
226
245
  const handleIconMouseDown = ev => {
@@ -229,7 +248,7 @@ const DateInput = exports.DateInput = /*#__PURE__*/_react.default.forwardRef(({
229
248
  };
230
249
  const handlePickerMouseDown = () => {
231
250
  isBlurBlocked.current = true;
232
- handleClickInside();
251
+ blockClose.current = true;
233
252
  };
234
253
  const assignInput = (0, _react.useCallback)(inputElement => {
235
254
  internalInputRef.current = inputElement;
@@ -27,6 +27,7 @@ const Detail = ({
27
27
  hasIcon: !!icon
28
28
  }, children), footnote && /*#__PURE__*/_react.default.createElement(_detail.StyledDetailFootnote, {
29
29
  "data-element": "footnote",
30
+ "data-role": "footnote",
30
31
  hasIcon: !!icon
31
32
  }, footnote));
32
33
  exports.Detail = Detail;
@@ -51,12 +51,15 @@ const SwitchSlider = ({
51
51
  isActive: checked,
52
52
  size
53
53
  };
54
- const sliderContent = /*#__PURE__*/_react.default.createElement(_switchSliderPanel.default, sliderPanelStyleProps, loading ? /*#__PURE__*/_react.default.createElement(_loader.default, loaderProps) : panelContent);
54
+ const sliderContent = /*#__PURE__*/_react.default.createElement(_switchSliderPanel.default, _extends({
55
+ "data-role": "slider-panel"
56
+ }, sliderPanelStyleProps), loading ? /*#__PURE__*/_react.default.createElement(_loader.default, loaderProps) : panelContent);
55
57
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_switchSlider.HiddenContent, {
56
58
  size: size,
57
59
  "aria-hidden": true
58
60
  }, longestText), /*#__PURE__*/_react.default.createElement(_switchSlider.StyledSwitchSlider, _extends({
59
- "data-component": "slider"
61
+ "data-component": "slider",
62
+ "data-role": "slider"
60
63
  }, switchSliderStyleProps), sliderContent, useValidationIcon && /*#__PURE__*/_react.default.createElement(_validationIcon.default, {
61
64
  error: error,
62
65
  warning: warning,
@@ -67,6 +67,8 @@ const Switch = exports.Switch = /*#__PURE__*/_react.default.forwardRef(({
67
67
  }, [setCheckedInternal, onChange]);
68
68
  const largeScreen = (0, _useIsAboveBreakpoint.default)(adaptiveLabelBreakpoint);
69
69
  let shouldLabelBeInline = labelInline;
70
+ // Coverage has been ignored here as this functionality is covered in a Playwright test.
71
+ /* istanbul ignore next */
70
72
  if (adaptiveLabelBreakpoint) {
71
73
  shouldLabelBeInline = largeScreen;
72
74
  }
@@ -161,13 +163,17 @@ const Switch = exports.Switch = /*#__PURE__*/_react.default.forwardRef(({
161
163
  };
162
164
  const applyValidation = error || warning;
163
165
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, validationRedesignOptIn ? /*#__PURE__*/_react.default.createElement(_switch.default, switchStylePropsForNewValidation, /*#__PURE__*/_react.default.createElement(_label.default, null, /*#__PURE__*/_react.default.createElement(_box.default, {
166
+ "data-role": "hint-text-wrapper",
164
167
  mb: labelHelp ? 0 : 1
165
- }, label, labelHelp && /*#__PURE__*/_react.default.createElement(_switch.StyledHintText, null, labelHelp)), /*#__PURE__*/_react.default.createElement(_box.default, {
168
+ }, label, labelHelp && /*#__PURE__*/_react.default.createElement(_switch.StyledHintText, {
169
+ "data-role": "hint-text"
170
+ }, labelHelp)), /*#__PURE__*/_react.default.createElement(_box.default, {
166
171
  position: "relative"
167
172
  }, /*#__PURE__*/_react.default.createElement(_validationMessage.default, {
168
173
  error: error,
169
174
  warning: warning
170
175
  }), applyValidation && /*#__PURE__*/_react.default.createElement(_switch.ErrorBorder, {
176
+ "data-role": "error-border",
171
177
  warning: !!(!error && warning)
172
178
  }), /*#__PURE__*/_react.default.createElement(_checkableInput.default, inputPropsForNewValidation, /*#__PURE__*/_react.default.createElement(_switchSlider.default, switchSliderPropsForNewValidation))))) : /*#__PURE__*/_react.default.createElement(_tooltipProvider.TooltipProvider, {
173
179
  helpAriaLabel: helpAriaLabel,
@@ -94,13 +94,13 @@ const frFR = {
94
94
  skipLinkLabel: () => "Passer au contenu principal"
95
95
  },
96
96
  loader: {
97
- loading: () => "Téléhargement"
97
+ loading: () => "Chargement en cours"
98
98
  },
99
99
  loaderSpinner: {
100
- loading: () => "Téléhargement..."
100
+ loading: () => "Chargement en cours..."
101
101
  },
102
102
  loaderStar: {
103
- loading: () => "Téléhargement..."
103
+ loading: () => "Chargement en cours..."
104
104
  },
105
105
  menuFullscreen: {
106
106
  ariaLabels: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-react",
3
- "version": "142.11.5",
3
+ "version": "142.11.7",
4
4
  "description": "A library of reusable React components for easily building user interfaces.",
5
5
  "files": [
6
6
  "lib",