carbon-react 104.58.2 → 104.58.5

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 (63) hide show
  1. package/esm/__internal__/checkable-input/hidden-checkable-input.component.js +5 -2
  2. package/esm/__internal__/input/input.component.js +1 -0
  3. package/esm/__internal__/input-behaviour/input-behaviour.component.js +8 -2
  4. package/esm/components/alert/alert.component.d.ts +3 -49
  5. package/esm/components/alert/alert.component.js +244 -46
  6. package/esm/components/alert/index.d.ts +1 -1
  7. package/esm/components/carousel/carousel.component.js +1 -13
  8. package/esm/components/carousel/carousel.style.js +11 -2
  9. package/esm/components/carousel/slide/slide.component.js +1 -3
  10. package/esm/components/carousel/slide/slide.style.js +7 -14
  11. package/esm/components/checkbox/checkbox-group.component.d.ts +2 -0
  12. package/esm/components/checkbox/checkbox-group.component.js +9 -7
  13. package/esm/components/checkbox/checkbox.component.js +15 -7
  14. package/esm/components/dialog/dialog.component.js +1 -10
  15. package/esm/components/form/form.component.d.ts +1 -2
  16. package/esm/components/form/form.component.js +0 -10
  17. package/esm/components/inline-inputs/inline-inputs.component.d.ts +2 -0
  18. package/esm/components/inline-inputs/inline-inputs.component.js +11 -23
  19. package/esm/components/menu/menu-item/menu-item.component.js +4 -2
  20. package/esm/components/step-sequence/step-sequence-item/step-sequence-item.component.js +7 -1
  21. package/esm/components/step-sequence/step-sequence.component.d.ts +2 -0
  22. package/esm/components/step-sequence/step-sequence.component.js +7 -4
  23. package/esm/components/typography/typography.component.d.ts +1 -1
  24. package/esm/hooks/__internal__/useScrollBlock/scroll-block-manager.d.ts +2 -0
  25. package/esm/hooks/__internal__/useScrollBlock/scroll-block-manager.js +18 -2
  26. package/esm/hooks/__internal__/useScrollBlock/useScrollBlock.js +30 -5
  27. package/esm/style/themes/aegean/aegean-theme.config.d.ts +2 -1
  28. package/esm/style/themes/aegean/aegean-theme.config.js +2 -1
  29. package/esm/style/themes/mint/mint-theme.config.d.ts +2 -1
  30. package/esm/style/themes/mint/mint-theme.config.js +2 -1
  31. package/lib/__internal__/checkable-input/hidden-checkable-input.component.js +5 -2
  32. package/lib/__internal__/input/input.component.js +1 -0
  33. package/lib/__internal__/input-behaviour/input-behaviour.component.js +13 -2
  34. package/lib/components/alert/alert.component.d.ts +3 -49
  35. package/lib/components/alert/alert.component.js +139 -54
  36. package/lib/components/alert/index.d.ts +1 -1
  37. package/lib/components/carousel/carousel.component.js +1 -14
  38. package/lib/components/carousel/carousel.style.js +12 -2
  39. package/lib/components/carousel/slide/slide.component.js +1 -3
  40. package/lib/components/carousel/slide/slide.style.js +7 -14
  41. package/lib/components/checkbox/checkbox-group.component.d.ts +2 -0
  42. package/lib/components/checkbox/checkbox-group.component.js +13 -8
  43. package/lib/components/checkbox/checkbox.component.js +20 -7
  44. package/lib/components/dialog/dialog.component.js +1 -11
  45. package/lib/components/form/form.component.d.ts +1 -2
  46. package/lib/components/form/form.component.js +0 -10
  47. package/lib/components/inline-inputs/inline-inputs.component.d.ts +2 -0
  48. package/lib/components/inline-inputs/inline-inputs.component.js +12 -21
  49. package/lib/components/menu/menu-item/menu-item.component.js +4 -2
  50. package/lib/components/step-sequence/step-sequence-item/step-sequence-item.component.js +13 -2
  51. package/lib/components/step-sequence/step-sequence.component.d.ts +2 -0
  52. package/lib/components/step-sequence/step-sequence.component.js +11 -6
  53. package/lib/components/typography/typography.component.d.ts +1 -1
  54. package/lib/hooks/__internal__/useScrollBlock/scroll-block-manager.d.ts +2 -0
  55. package/lib/hooks/__internal__/useScrollBlock/scroll-block-manager.js +18 -2
  56. package/lib/hooks/__internal__/useScrollBlock/useScrollBlock.js +29 -4
  57. package/lib/style/themes/aegean/aegean-theme.config.d.ts +2 -1
  58. package/lib/style/themes/aegean/aegean-theme.config.js +2 -1
  59. package/lib/style/themes/mint/mint-theme.config.d.ts +2 -1
  60. package/lib/style/themes/mint/mint-theme.config.js +2 -1
  61. package/package.json +1 -1
  62. package/esm/components/alert/alert.d.ts +0 -5
  63. package/lib/components/alert/alert.d.ts +0 -5
@@ -3,12 +3,12 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = void 0;
7
-
8
- var _propTypes = _interopRequireDefault(require("prop-types"));
6
+ exports.default = exports.StepSequenceContext = void 0;
9
7
 
10
8
  var _react = _interopRequireDefault(require("react"));
11
9
 
10
+ var _propTypes = _interopRequireDefault(require("prop-types"));
11
+
12
12
  var _propTypes2 = _interopRequireDefault(require("@styled-system/prop-types"));
13
13
 
14
14
  var _stepSequence = _interopRequireDefault(require("./step-sequence.style"));
@@ -19,14 +19,19 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
19
19
 
20
20
  function _extends() { _extends = Object.assign || 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); }
21
21
 
22
+ const StepSequenceContext = /*#__PURE__*/_react.default.createContext({});
23
+
24
+ exports.StepSequenceContext = StepSequenceContext;
22
25
  const marginPropTypes = (0, _utils.filterStyledSystemMarginProps)(_propTypes2.default.space);
23
26
 
24
27
  const StepSequence = props => {
25
28
  return /*#__PURE__*/_react.default.createElement(_stepSequence.default, _extends({
26
29
  "data-component": "step-sequence"
27
- }, props), _react.default.Children.map(props.children, child => /*#__PURE__*/_react.default.cloneElement(child, { ...child.props,
28
- orientation: props.orientation
29
- }, child.props.children)));
30
+ }, props), /*#__PURE__*/_react.default.createElement(StepSequenceContext.Provider, {
31
+ value: {
32
+ orientation: props.orientation
33
+ }
34
+ }, props.children));
30
35
  };
31
36
 
32
37
  StepSequence.propTypes = { ...marginPropTypes,
@@ -12,4 +12,4 @@ declare const Typography: import("styled-components").StyledComponent<"span", an
12
12
  color: any;
13
13
  bg: any;
14
14
  backgroundColor: any;
15
- }, "as" | "textDecoration" | "size" | "lineHeight" | "textTransform" | "weight" | "defaultMargin">;
15
+ }, "as" | "size" | "textDecoration" | "lineHeight" | "textTransform" | "weight" | "defaultMargin">;
@@ -5,6 +5,8 @@ declare class ScrollBlockManager {
5
5
  registerComponent(id: any): void;
6
6
  unregisterComponent(id: any): void;
7
7
  saveOriginalValues(values: any): void;
8
+ saveRestoreValuesCallback(callback: any): void;
9
+ getRestoreValuesCallback(): any;
8
10
  getOriginalValues(): any;
9
11
  isBlocked(): boolean;
10
12
  }
@@ -11,6 +11,8 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
11
11
 
12
12
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
13
13
 
14
+ // TODO: This component can be refactored to remove redundant code after
15
+ // we can confirm that all Sage products use version 105.0.0^
14
16
  let ScrollBlockManager = /*#__PURE__*/function () {
15
17
  function ScrollBlockManager() {
16
18
  _classCallCheck(this, ScrollBlockManager);
@@ -20,11 +22,13 @@ let ScrollBlockManager = /*#__PURE__*/function () {
20
22
  if (!window.__CARBON_INTERNALS_SCROLL_BLOCKERS) {
21
23
  window.__CARBON_INTERNALS_SCROLL_BLOCKERS = {
22
24
  components: {},
25
+ // originalValues can be removed
23
26
  originalValues: []
24
27
  };
25
28
  }
26
29
 
27
- this.components = window.__CARBON_INTERNALS_SCROLL_BLOCKERS.components;
30
+ this.components = window.__CARBON_INTERNALS_SCROLL_BLOCKERS.components; // TODO: originalValues can be removed
31
+
28
32
  this.originalValues = window.__CARBON_INTERNALS_SCROLL_BLOCKERS.originalValues;
29
33
  }
30
34
 
@@ -37,13 +41,25 @@ let ScrollBlockManager = /*#__PURE__*/function () {
37
41
  key: "unregisterComponent",
38
42
  value: function unregisterComponent(id) {
39
43
  delete this.components[id];
40
- }
44
+ } // TODO: saveOriginalValues can be removed
45
+
41
46
  }, {
42
47
  key: "saveOriginalValues",
43
48
  value: function saveOriginalValues(values) {
44
49
  this.originalValues.length = 0;
45
50
  this.originalValues.push(...values);
46
51
  }
52
+ }, {
53
+ key: "saveRestoreValuesCallback",
54
+ value: function saveRestoreValuesCallback(callback) {
55
+ window.__CARBON_INTERNALS_SCROLL_BLOCKERS.restoreValues = callback;
56
+ }
57
+ }, {
58
+ key: "getRestoreValuesCallback",
59
+ value: function getRestoreValuesCallback() {
60
+ return window.__CARBON_INTERNALS_SCROLL_BLOCKERS.restoreValues;
61
+ } // TODO: getOriginalValues can be removed
62
+
47
63
  }, {
48
64
  key: "getOriginalValues",
49
65
  value: function getOriginalValues() {
@@ -13,6 +13,8 @@ var _scrollBlockManager = _interopRequireDefault(require("./scroll-block-manager
13
13
 
14
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
15
 
16
+ // TODO: This component can be refactored to remove redundant code after
17
+ // we can confirm that all Sage products use version 105.0.0^
16
18
  const scrollBlockManager = new _scrollBlockManager.default();
17
19
  /* istanbul ignore next */
18
20
 
@@ -22,6 +24,7 @@ const useScrollBlock = () => {
22
24
  const {
23
25
  current: containerGuid
24
26
  } = (0, _react.useRef)((0, _guid.default)());
27
+ const originalValuesRef = (0, _react.useRef)();
25
28
  const rules = (0, _react.useMemo)(() => {
26
29
  const {
27
30
  documentElement,
@@ -29,7 +32,8 @@ const useScrollBlock = () => {
29
32
  } = safeDocument;
30
33
  const scrollBarWidth = window.innerWidth - documentElement.clientWidth;
31
34
  const bodyPaddingRight = parseInt(window.getComputedStyle(body).getPropertyValue("padding-right")) || 0;
32
- return [{
35
+ return [// TODO: First two entries of this array with the documentElement can be removed
36
+ {
33
37
  element: documentElement,
34
38
  property: "position",
35
39
  blockingValue: "relative"
@@ -51,6 +55,14 @@ const useScrollBlock = () => {
51
55
  blockingValue: `${bodyPaddingRight + scrollBarWidth}px`
52
56
  }];
53
57
  }, []);
58
+ const restoreValues = (0, _react.useCallback)(() => {
59
+ rules.forEach(({
60
+ element,
61
+ property
62
+ }, index) => {
63
+ element.style[property] = originalValuesRef.current[index];
64
+ });
65
+ }, [rules]);
54
66
  const blockScroll = (0, _react.useCallback)(() => {
55
67
  const isBlocked = scrollBlockManager.isBlocked();
56
68
  scrollBlockManager.registerComponent(containerGuid);
@@ -63,19 +75,32 @@ const useScrollBlock = () => {
63
75
  element,
64
76
  property
65
77
  }) => element.style[property]);
66
- scrollBlockManager.saveOriginalValues(originalValues);
67
- rules.forEach(({
78
+ originalValuesRef.current = originalValues;
79
+ scrollBlockManager.saveRestoreValuesCallback(restoreValues); // TODO: saveOriginalValues can be removed
80
+
81
+ scrollBlockManager.saveOriginalValues(originalValues); // TODO: slice san be removed
82
+
83
+ rules.slice(-3).forEach(({
68
84
  element,
69
85
  property,
70
86
  blockingValue
71
87
  }) => {
72
88
  element.style[property] = blockingValue;
73
89
  });
74
- }, [containerGuid, rules]);
90
+ }, [restoreValues, containerGuid, rules]);
75
91
  const allowScroll = (0, _react.useCallback)(() => {
76
92
  scrollBlockManager.unregisterComponent(containerGuid);
77
93
  const isBlocked = scrollBlockManager.isBlocked();
78
94
  if (isBlocked) return;
95
+ const restoreValuesCallback = scrollBlockManager.getRestoreValuesCallback();
96
+
97
+ if (restoreValuesCallback) {
98
+ restoreValuesCallback();
99
+ scrollBlockManager.saveRestoreValuesCallback(null);
100
+ return;
101
+ } // TODO: all of the code below can be removed from this block
102
+
103
+
79
104
  const originalValues = scrollBlockManager.getOriginalValues();
80
105
  rules.forEach(({
81
106
  element,
@@ -7,9 +7,10 @@ declare function _default(palette: any): {
7
7
  loadingBarBackground: any;
8
8
  };
9
9
  readonly compatibility: {
10
+ colorsActionMajor150: any;
10
11
  colorsActionMajor500: any;
11
12
  colorsActionMajor600: any;
12
- colorsActionMajor150: any;
13
+ colorsActionMajor700: any;
13
14
  colorsComponentsMenuAutumnStandard600: any;
14
15
  colorsComponentsMenuSpringChild600: any;
15
16
  colorsComponentsMenuAutumnChild600: any;
@@ -17,9 +17,10 @@ var _default = palette => {
17
17
 
18
18
  get compatibility() {
19
19
  return {
20
+ colorsActionMajor150: this.colors.loadingBarBackground,
20
21
  colorsActionMajor500: this.colors.primary,
21
22
  colorsActionMajor600: this.colors.secondary,
22
- colorsActionMajor150: this.colors.loadingBarBackground,
23
+ colorsActionMajor700: this.colors.tertiary,
23
24
  colorsComponentsMenuAutumnStandard600: this.colors.primary,
24
25
  colorsComponentsMenuSpringChild600: this.colors.primary,
25
26
  colorsComponentsMenuAutumnChild600: this.colors.primary,
@@ -7,9 +7,10 @@ declare function _default(palette: any): {
7
7
  loadingBarBackground: any;
8
8
  };
9
9
  readonly compatibility: {
10
+ colorsActionMajor150: any;
10
11
  colorsActionMajor500: any;
11
12
  colorsActionMajor600: any;
12
- colorsActionMajor150: any;
13
+ colorsActionMajor700: any;
13
14
  colorsComponentsMenuAutumnStandard600: any;
14
15
  colorsComponentsMenuSpringChild600: any;
15
16
  colorsComponentsMenuAutumnChild600: any;
@@ -17,9 +17,10 @@ var _default = palette => {
17
17
 
18
18
  get compatibility() {
19
19
  return {
20
+ colorsActionMajor150: this.colors.loadingBarBackground,
20
21
  colorsActionMajor500: this.colors.primary,
21
22
  colorsActionMajor600: this.colors.secondary,
22
- colorsActionMajor150: this.colors.loadingBarBackground,
23
+ colorsActionMajor700: this.colors.tertiary,
23
24
  colorsComponentsMenuAutumnStandard600: this.colors.primary,
24
25
  colorsComponentsMenuSpringChild600: this.colors.primary,
25
26
  colorsComponentsMenuAutumnChild600: this.colors.primary,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-react",
3
- "version": "104.58.2",
3
+ "version": "104.58.5",
4
4
  "description": "A library of reusable React components for easily building user interfaces.",
5
5
  "engineStrict": true,
6
6
  "engines": {
@@ -1,5 +0,0 @@
1
- import { DialogProps } from "../dialog/dialog";
2
-
3
- declare function Alert(props: DialogProps): JSX.Element;
4
-
5
- export default Alert;
@@ -1,5 +0,0 @@
1
- import { DialogProps } from "../dialog/dialog";
2
-
3
- declare function Alert(props: DialogProps): JSX.Element;
4
-
5
- export default Alert;