carbon-react 142.11.6 → 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 (25) 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/detail/detail.component.js +1 -0
  10. package/esm/components/switch/__internal__/switch-slider.component.js +5 -2
  11. package/esm/components/switch/switch.component.js +7 -1
  12. package/esm/locales/fr-fr.js +3 -3
  13. package/lib/__internal__/checkable-input/checkable-input.component.js +3 -1
  14. package/lib/__internal__/utils/helpers/tags/tags-specs/index.d.ts +1 -1
  15. package/lib/__internal__/utils/helpers/tags/tags-specs/index.js +4 -9
  16. package/lib/__internal__/utils/helpers/tags/tags-specs/tags-specs.d.ts +2 -2
  17. package/lib/__internal__/utils/helpers/tags/tags-specs/tags-specs.js +2 -12
  18. package/lib/__internal__/validation-message/validation-message.component.js +2 -1
  19. package/lib/components/accordion/accordion.component.js +4 -1
  20. package/lib/components/content/content.component.js +2 -0
  21. package/lib/components/detail/detail.component.js +1 -0
  22. package/lib/components/switch/__internal__/switch-slider.component.js +5 -2
  23. package/lib/components/switch/switch.component.js +7 -1
  24. package/lib/locales/fr-fr.js +3 -3
  25. 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
@@ -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
@@ -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.6",
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",