carbon-react 104.54.3 → 104.56.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.
Files changed (21) hide show
  1. package/esm/__internal__/checkable-input/hidden-checkable-input.component.d.ts +4 -1
  2. package/esm/__internal__/checkable-input/hidden-checkable-input.component.js +5 -1
  3. package/esm/__internal__/checkable-input/hidden-checkable-input.d.ts +2 -0
  4. package/esm/components/modal/__internal__/modal-manager.d.ts +2 -2
  5. package/esm/components/modal/__internal__/modal-manager.js +18 -7
  6. package/esm/components/select/filterable-select/filterable-select.component.js +0 -2
  7. package/esm/components/select/multi-select/multi-select.component.js +0 -2
  8. package/esm/components/select/select-textbox/select-textbox.component.js +1 -1
  9. package/esm/components/select/simple-select/simple-select.component.js +0 -2
  10. package/esm/components/switch/switch.component.js +1 -0
  11. package/lib/__internal__/checkable-input/hidden-checkable-input.component.d.ts +4 -1
  12. package/lib/__internal__/checkable-input/hidden-checkable-input.component.js +5 -1
  13. package/lib/__internal__/checkable-input/hidden-checkable-input.d.ts +2 -0
  14. package/lib/components/modal/__internal__/modal-manager.d.ts +2 -2
  15. package/lib/components/modal/__internal__/modal-manager.js +20 -8
  16. package/lib/components/select/filterable-select/filterable-select.component.js +0 -2
  17. package/lib/components/select/multi-select/multi-select.component.js +0 -2
  18. package/lib/components/select/select-textbox/select-textbox.component.js +1 -1
  19. package/lib/components/select/simple-select/simple-select.component.js +0 -2
  20. package/lib/components/switch/switch.component.js +1 -0
  21. package/package.json +5 -5
@@ -1,5 +1,5 @@
1
1
  declare var _default: React.MemoExoticComponent<{
2
- ({ name, checked, type, value, inputRef, onChange, autoFocus, ...props }: {
2
+ ({ name, checked, type, value, inputRef, onChange, autoFocus, role, ...props }: {
3
3
  [x: string]: any;
4
4
  name: any;
5
5
  checked: any;
@@ -8,6 +8,7 @@ declare var _default: React.MemoExoticComponent<{
8
8
  inputRef: any;
9
9
  onChange: any;
10
10
  autoFocus: any;
11
+ role: any;
11
12
  }): JSX.Element;
12
13
  propTypes: {
13
14
  /** Allows component to be focused on page load */
@@ -28,6 +29,8 @@ declare var _default: React.MemoExoticComponent<{
28
29
  onMouseEnter: PropTypes.Requireable<(...args: any[]) => any>;
29
30
  /** HTML type attribute of the input */
30
31
  type: PropTypes.Validator<string>;
32
+ /** Role attribute of the input */
33
+ role: PropTypes.Requireable<string>;
31
34
  /** Value of the input */
32
35
  value: PropTypes.Requireable<string>;
33
36
  /** A callback to retrieve the input reference */
@@ -13,6 +13,7 @@ const HiddenCheckableInput = ({
13
13
  inputRef,
14
14
  onChange,
15
15
  autoFocus,
16
+ role,
16
17
  ...props
17
18
  }) => {
18
19
  const {
@@ -57,7 +58,7 @@ const HiddenCheckableInput = ({
57
58
  "aria-checked": checked,
58
59
  checked: checked,
59
60
  name: name,
60
- role: type,
61
+ role: role || type,
61
62
  type: type,
62
63
  value: value
63
64
  }, props, {
@@ -98,6 +99,9 @@ HiddenCheckableInput.propTypes = {
98
99
  /** HTML type attribute of the input */
99
100
  type: PropTypes.string.isRequired,
100
101
 
102
+ /** Role attribute of the input */
103
+ role: PropTypes.string,
104
+
101
105
  /** Value of the input */
102
106
  value: PropTypes.string,
103
107
 
@@ -31,6 +31,8 @@ export interface HiddenCheckableInputProps
31
31
  extends CommonHiddenCheckableInputProps {
32
32
  /** HTML type attribute of the input */
33
33
  type: string;
34
+ /** Role attribute of the input */
35
+ role?: string;
34
36
  }
35
37
 
36
38
  declare function HiddenCheckableInput(
@@ -1,9 +1,9 @@
1
1
  export default ModalManager;
2
- declare const ModalManager: ModalManagerInstance;
3
- declare class ModalManagerInstance {
2
+ export class ModalManagerInstance {
4
3
  addModal: (modal: any, setTriggerRefocusFlag: any) => void;
5
4
  isTopmost(modal: any): boolean;
6
5
  removeModal(modal: any): void;
7
6
  clearList(): void;
8
7
  #private;
9
8
  }
9
+ declare const ModalManager: ModalManagerInstance;
@@ -6,17 +6,17 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
6
6
 
7
7
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
8
8
 
9
- function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
10
-
11
- function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } }
12
-
13
9
  function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
14
10
 
15
11
  function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
16
12
 
13
+ function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
14
+
15
+ function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
16
+
17
17
  function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
18
18
 
19
- function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
19
+ function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } }
20
20
 
21
21
  var _modalList = /*#__PURE__*/new WeakMap();
22
22
 
@@ -30,7 +30,7 @@ let ModalManagerInstance = /*#__PURE__*/function () {
30
30
 
31
31
  _modalList.set(this, {
32
32
  writable: true,
33
- value: []
33
+ value: void 0
34
34
  });
35
35
 
36
36
  _defineProperty(this, "addModal", (modal, setTriggerRefocusFlag) => {
@@ -48,6 +48,14 @@ let ModalManagerInstance = /*#__PURE__*/function () {
48
48
  setTriggerRefocusFlag
49
49
  });
50
50
  });
51
+
52
+ // Due to possibility of multiple carbon versions using it
53
+ // it is necessary to maintain same structure in this global variable
54
+ if (!window.__CARBON_INTERNALS_MODAL_LIST) {
55
+ window.__CARBON_INTERNALS_MODAL_LIST = [];
56
+ }
57
+
58
+ _classPrivateFieldSet(this, _modalList, window.__CARBON_INTERNALS_MODAL_LIST);
51
59
  }
52
60
 
53
61
  _createClass(ModalManagerInstance, [{
@@ -91,7 +99,9 @@ let ModalManagerInstance = /*#__PURE__*/function () {
91
99
  }, {
92
100
  key: "clearList",
93
101
  value: function clearList() {
94
- _classPrivateFieldSet(this, _modalList, []);
102
+ window.__CARBON_INTERNALS_MODAL_LIST = [];
103
+
104
+ _classPrivateFieldSet(this, _modalList, window.__CARBON_INTERNALS_MODAL_LIST);
95
105
  }
96
106
  }]);
97
107
 
@@ -107,4 +117,5 @@ function _getTopModal2() {
107
117
  }
108
118
 
109
119
  const ModalManager = new ModalManagerInstance();
120
+ export { ModalManagerInstance };
110
121
  export default ModalManager;
@@ -414,8 +414,6 @@ const FilterableSelect = /*#__PURE__*/React.forwardRef(({
414
414
  flipEnabled: flipEnabled
415
415
  }, children);
416
416
  return /*#__PURE__*/React.createElement(StyledSelect, _extends({
417
- "aria-expanded": isOpen,
418
- "aria-haspopup": "listbox",
419
417
  ref: containerRef,
420
418
  hasTextCursor: true,
421
419
  readOnly: readOnly,
@@ -427,8 +427,6 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
427
427
  multiselectValues: selectedValue
428
428
  }, children);
429
429
  return /*#__PURE__*/React.createElement(StyledSelectMultiSelect, _extends({
430
- "aria-expanded": isOpen,
431
- "aria-haspopup": "listbox",
432
430
  disabled: disabled,
433
431
  readOnly: readOnly,
434
432
  hasTextCursor: true,
@@ -137,7 +137,7 @@ const SelectTextbox = ({
137
137
 
138
138
  const ariaLabelledby = hasTextCursor ? joinIds(labelId, accessibilityLabelId) : joinIds(labelId, textId.current);
139
139
  return {
140
- "aria-expanded": isOpen,
140
+ "aria-expanded": readOnly ? undefined : isOpen,
141
141
  "aria-labelledby": ariaLabelledby || undefined,
142
142
  "aria-activedescendant": activeDescendantId,
143
143
  "aria-controls": ariaControls,
@@ -340,8 +340,6 @@ const SimpleSelect = /*#__PURE__*/React.forwardRef(({
340
340
  transparent: transparent,
341
341
  disabled: disabled,
342
342
  readOnly: readOnly,
343
- "aria-expanded": isOpen,
344
- "aria-haspopup": "listbox",
345
343
  "data-component": dataComponent,
346
344
  "data-role": dataRole,
347
345
  "data-element": dataElement,
@@ -96,6 +96,7 @@ const Switch = ({
96
96
  labelHelp,
97
97
  value,
98
98
  type: "checkbox",
99
+ role: "switch",
99
100
  reverse: !reverse,
100
101
  // switched to preserve backward compatibility
101
102
  validationOnLabel: shouldValidationBeOnLabel && !disabled,
@@ -1,5 +1,5 @@
1
1
  declare var _default: React.MemoExoticComponent<{
2
- ({ name, checked, type, value, inputRef, onChange, autoFocus, ...props }: {
2
+ ({ name, checked, type, value, inputRef, onChange, autoFocus, role, ...props }: {
3
3
  [x: string]: any;
4
4
  name: any;
5
5
  checked: any;
@@ -8,6 +8,7 @@ declare var _default: React.MemoExoticComponent<{
8
8
  inputRef: any;
9
9
  onChange: any;
10
10
  autoFocus: any;
11
+ role: any;
11
12
  }): JSX.Element;
12
13
  propTypes: {
13
14
  /** Allows component to be focused on page load */
@@ -28,6 +29,8 @@ declare var _default: React.MemoExoticComponent<{
28
29
  onMouseEnter: PropTypes.Requireable<(...args: any[]) => any>;
29
30
  /** HTML type attribute of the input */
30
31
  type: PropTypes.Validator<string>;
32
+ /** Role attribute of the input */
33
+ role: PropTypes.Requireable<string>;
31
34
  /** Value of the input */
32
35
  value: PropTypes.Requireable<string>;
33
36
  /** A callback to retrieve the input reference */
@@ -29,6 +29,7 @@ const HiddenCheckableInput = ({
29
29
  inputRef,
30
30
  onChange,
31
31
  autoFocus,
32
+ role,
32
33
  ...props
33
34
  }) => {
34
35
  const {
@@ -73,7 +74,7 @@ const HiddenCheckableInput = ({
73
74
  "aria-checked": checked,
74
75
  checked: checked,
75
76
  name: name,
76
- role: type,
77
+ role: role || type,
77
78
  type: type,
78
79
  value: value
79
80
  }, props, {
@@ -114,6 +115,9 @@ HiddenCheckableInput.propTypes = {
114
115
  /** HTML type attribute of the input */
115
116
  type: _propTypes.default.string.isRequired,
116
117
 
118
+ /** Role attribute of the input */
119
+ role: _propTypes.default.string,
120
+
117
121
  /** Value of the input */
118
122
  value: _propTypes.default.string,
119
123
 
@@ -31,6 +31,8 @@ export interface HiddenCheckableInputProps
31
31
  extends CommonHiddenCheckableInputProps {
32
32
  /** HTML type attribute of the input */
33
33
  type: string;
34
+ /** Role attribute of the input */
35
+ role?: string;
34
36
  }
35
37
 
36
38
  declare function HiddenCheckableInput(
@@ -1,9 +1,9 @@
1
1
  export default ModalManager;
2
- declare const ModalManager: ModalManagerInstance;
3
- declare class ModalManagerInstance {
2
+ export class ModalManagerInstance {
4
3
  addModal: (modal: any, setTriggerRefocusFlag: any) => void;
5
4
  isTopmost(modal: any): boolean;
6
5
  removeModal(modal: any): void;
7
6
  clearList(): void;
8
7
  #private;
9
8
  }
9
+ declare const ModalManager: ModalManagerInstance;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = void 0;
6
+ exports.default = exports.ModalManagerInstance = void 0;
7
7
 
8
8
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
9
9
 
@@ -13,17 +13,17 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
13
13
 
14
14
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
15
15
 
16
- function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
17
-
18
- function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } }
19
-
20
16
  function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
21
17
 
22
18
  function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
23
19
 
20
+ function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
21
+
22
+ function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
23
+
24
24
  function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
25
25
 
26
- function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
26
+ function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } }
27
27
 
28
28
  var _modalList = /*#__PURE__*/new WeakMap();
29
29
 
@@ -37,7 +37,7 @@ let ModalManagerInstance = /*#__PURE__*/function () {
37
37
 
38
38
  _modalList.set(this, {
39
39
  writable: true,
40
- value: []
40
+ value: void 0
41
41
  });
42
42
 
43
43
  _defineProperty(this, "addModal", (modal, setTriggerRefocusFlag) => {
@@ -55,6 +55,14 @@ let ModalManagerInstance = /*#__PURE__*/function () {
55
55
  setTriggerRefocusFlag
56
56
  });
57
57
  });
58
+
59
+ // Due to possibility of multiple carbon versions using it
60
+ // it is necessary to maintain same structure in this global variable
61
+ if (!window.__CARBON_INTERNALS_MODAL_LIST) {
62
+ window.__CARBON_INTERNALS_MODAL_LIST = [];
63
+ }
64
+
65
+ _classPrivateFieldSet(this, _modalList, window.__CARBON_INTERNALS_MODAL_LIST);
58
66
  }
59
67
 
60
68
  _createClass(ModalManagerInstance, [{
@@ -98,13 +106,17 @@ let ModalManagerInstance = /*#__PURE__*/function () {
98
106
  }, {
99
107
  key: "clearList",
100
108
  value: function clearList() {
101
- _classPrivateFieldSet(this, _modalList, []);
109
+ window.__CARBON_INTERNALS_MODAL_LIST = [];
110
+
111
+ _classPrivateFieldSet(this, _modalList, window.__CARBON_INTERNALS_MODAL_LIST);
102
112
  }
103
113
  }]);
104
114
 
105
115
  return ModalManagerInstance;
106
116
  }();
107
117
 
118
+ exports.ModalManagerInstance = ModalManagerInstance;
119
+
108
120
  function _getTopModal2() {
109
121
  if (!_classPrivateFieldGet(this, _modalList).length) {
110
122
  return {};
@@ -439,8 +439,6 @@ const FilterableSelect = /*#__PURE__*/_react.default.forwardRef(({
439
439
  }, children);
440
440
 
441
441
  return /*#__PURE__*/_react.default.createElement(_select.default, _extends({
442
- "aria-expanded": isOpen,
443
- "aria-haspopup": "listbox",
444
442
  ref: containerRef,
445
443
  hasTextCursor: true,
446
444
  readOnly: readOnly,
@@ -455,8 +455,6 @@ const MultiSelect = /*#__PURE__*/_react.default.forwardRef(({
455
455
  }, children);
456
456
 
457
457
  return /*#__PURE__*/_react.default.createElement(_multiSelect.StyledSelectMultiSelect, _extends({
458
- "aria-expanded": isOpen,
459
- "aria-haspopup": "listbox",
460
458
  disabled: disabled,
461
459
  readOnly: readOnly,
462
460
  hasTextCursor: true,
@@ -158,7 +158,7 @@ const SelectTextbox = ({
158
158
 
159
159
  const ariaLabelledby = hasTextCursor ? joinIds(labelId, accessibilityLabelId) : joinIds(labelId, textId.current);
160
160
  return {
161
- "aria-expanded": isOpen,
161
+ "aria-expanded": readOnly ? undefined : isOpen,
162
162
  "aria-labelledby": ariaLabelledby || undefined,
163
163
  "aria-activedescendant": activeDescendantId,
164
164
  "aria-controls": ariaControls,
@@ -365,8 +365,6 @@ const SimpleSelect = /*#__PURE__*/_react.default.forwardRef(({
365
365
  transparent: transparent,
366
366
  disabled: disabled,
367
367
  readOnly: readOnly,
368
- "aria-expanded": isOpen,
369
- "aria-haspopup": "listbox",
370
368
  "data-component": dataComponent,
371
369
  "data-role": dataRole,
372
370
  "data-element": dataElement,
@@ -118,6 +118,7 @@ const Switch = ({
118
118
  labelHelp,
119
119
  value,
120
120
  type: "checkbox",
121
+ role: "switch",
121
122
  reverse: !reverse,
122
123
  // switched to preserve backward compatibility
123
124
  validationOnLabel: shouldValidationBeOnLabel && !disabled,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-react",
3
- "version": "104.54.3",
3
+ "version": "104.56.0",
4
4
  "description": "A library of reusable React components for easily building user interfaces.",
5
5
  "engineStrict": true,
6
6
  "engines": {
@@ -104,12 +104,12 @@
104
104
  "conventional-changelog-conventionalcommits": "^4.5.0",
105
105
  "core-js": "^3.20.3",
106
106
  "cross-env": "^5.2.0",
107
- "cypress": "^9.2.0",
108
- "cypress-axe": "^0.13.0",
107
+ "cypress": "^9.5.2",
108
+ "cypress-axe": "^0.14.0",
109
109
  "cypress-cucumber-preprocessor": "^4.3.1",
110
- "cypress-each": "^1.10.0",
110
+ "cypress-each": "^1.11.0",
111
111
  "cypress-plugin-tab": "^1.0.5",
112
- "cypress-real-events": "^1.6.0",
112
+ "cypress-real-events": "^1.7.0",
113
113
  "cypress-storybook": "^0.5.1",
114
114
  "cz-conventional-changelog": "^3.3.0",
115
115
  "date-fns-tz": "^1.2.2",