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
@@ -20,7 +20,8 @@ const HiddenCheckableInput = ({
20
20
  onBlur,
21
21
  onFocus,
22
22
  onMouseEnter,
23
- onMouseLeave
23
+ onMouseLeave,
24
+ ariaLabelledBy
24
25
  } = useContext(InputContext);
25
26
  const {
26
27
  onBlur: onBlurGroup,
@@ -61,7 +62,9 @@ const HiddenCheckableInput = ({
61
62
  role: role || type,
62
63
  type: type,
63
64
  value: value
64
- }, props, {
65
+ }, props, ariaLabelledBy && {
66
+ "aria-labelledby": ariaLabelledBy
67
+ }, {
65
68
  onFocus: handleFocus,
66
69
  onBlur: handleBlur,
67
70
  onMouseEnter: handleMouseEnter,
@@ -79,6 +79,7 @@ const Input = /*#__PURE__*/React.forwardRef(({
79
79
  };
80
80
 
81
81
  return /*#__PURE__*/React.createElement(StyledInput, _extends({}, rest, {
82
+ "aria-labelledby": context.ariaLabelledBy,
82
83
  align: align,
83
84
  placeholder: placeholder,
84
85
  disabled: disabled,
@@ -1,5 +1,6 @@
1
- import React from "react";
1
+ import React, { useContext } from "react";
2
2
  import PropTypes from "prop-types";
3
+ import { InlineInputsContext } from "../../components/inline-inputs/inline-inputs.component";
3
4
  import useInputBehaviour from "./useInputBehaviour";
4
5
  const defaultValue = {};
5
6
  const InputContext = /*#__PURE__*/React.createContext(defaultValue);
@@ -8,8 +9,13 @@ const InputBehaviour = ({
8
9
  children
9
10
  }) => {
10
11
  const contextValue = useInputBehaviour();
12
+ const {
13
+ ariaLabelledBy
14
+ } = useContext(InlineInputsContext);
11
15
  return /*#__PURE__*/React.createElement(InputContext.Provider, {
12
- value: contextValue
16
+ value: { ...contextValue,
17
+ ariaLabelledBy
18
+ }
13
19
  }, children);
14
20
  };
15
21
 
@@ -1,50 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { DialogProps } from "../dialog/dialog";
3
+ export declare const Alert: ({ children, size, ...rest }: DialogProps) => JSX.Element;
1
4
  export default Alert;
2
- declare function Alert({ children, ...rest }: {
3
- [x: string]: any;
4
- children: any;
5
- }): JSX.Element;
6
- declare namespace Alert {
7
- const propTypes: {
8
- /** Prop to specify the aria-describedby property of the component */
9
- "aria-describedby": PropTypes.Requireable<string>;
10
- /**
11
- * Prop to specify the aria-label of the component.
12
- * To be used only when the title prop is not defined, and the component is not labelled by any internal element.
13
- */
14
- "aria-label": PropTypes.Requireable<string>;
15
- /**
16
- * Prop to specify the aria-labeledby property of the component
17
- * To be used when the title prop is a custom React Node,
18
- * or the component is labelled by an internal element other than the title.
19
- */
20
- "aria-labelledby": PropTypes.Requireable<string>;
21
- /** Alert content */
22
- children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
23
- /** Controls the open state of the component */
24
- open: PropTypes.Validator<boolean>;
25
- /** A custom close event handler */
26
- onCancel: PropTypes.Requireable<(...args: any[]) => any>;
27
- /** Determines if the Esc Key closes the Alert */
28
- disableEscKey: PropTypes.Requireable<boolean>;
29
- /** Allows developers to specify a specific height for the dialog. */
30
- height: PropTypes.Requireable<string>;
31
- /** Title displayed at top of Alert */
32
- title: PropTypes.Requireable<PropTypes.ReactNodeLike>;
33
- /** Subtitle displayed at top of Alert */
34
- subtitle: PropTypes.Requireable<string>;
35
- /** Size of Alert */
36
- size: PropTypes.Requireable<string>;
37
- /** Determines if the close icon is shown */
38
- showCloseIcon: PropTypes.Requireable<boolean>;
39
- /** Optional reference to an element meant to be focused on open */
40
- focusFirstElement: PropTypes.Requireable<PropTypes.InferProps<{
41
- current: PropTypes.Requireable<any>;
42
- }>>;
43
- /** Disables auto focus functionality on child elements */
44
- disableAutoFocus: PropTypes.Requireable<boolean>;
45
- };
46
- namespace defaultProps {
47
- const size: string;
48
- }
49
- }
50
- import PropTypes from "prop-types";
@@ -1,70 +1,268 @@
1
- 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); }
1
+ function _extends() {
2
+ _extends =
3
+ Object.assign ||
4
+ function (target) {
5
+ for (var i = 1; i < arguments.length; i++) {
6
+ var source = arguments[i];
7
+ for (var key in source) {
8
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
9
+ target[key] = source[key];
10
+ }
11
+ }
12
+ }
13
+ return target;
14
+ };
15
+ return _extends.apply(this, arguments);
16
+ }
2
17
 
3
18
  import React from "react";
4
19
  import PropTypes from "prop-types";
5
20
  import Dialog from "../dialog";
6
-
7
- const Alert = ({
8
- children,
9
- ...rest
10
- }) => /*#__PURE__*/React.createElement(Dialog, _extends({
11
- "data-component": "alert",
12
- role: "alertdialog"
13
- }, rest), children);
21
+ const Alert = ({ children, size = "extra-small", ...rest }) =>
22
+ /*#__PURE__*/ React.createElement(
23
+ Dialog,
24
+ _extends(
25
+ {
26
+ "data-component": "alert",
27
+ role: "alertdialog",
28
+ size: size,
29
+ },
30
+ rest
31
+ ),
32
+ children
33
+ );
14
34
 
15
35
  Alert.propTypes = {
16
- /** Prop to specify the aria-describedby property of the component */
36
+ /**
37
+ * Prop to specify the aria-describedby property of the Dialog component
38
+ */
17
39
  "aria-describedby": PropTypes.string,
18
-
19
40
  /**
20
- * Prop to specify the aria-label of the component.
41
+ * Prop to specify the aria-label of the Dialog component.
21
42
  * To be used only when the title prop is not defined, and the component is not labelled by any internal element.
22
43
  */
23
44
  "aria-label": PropTypes.string,
24
-
25
45
  /**
26
- * Prop to specify the aria-labeledby property of the component
46
+ * Prop to specify the aria-labelledby property of the Dialog component
27
47
  * To be used when the title prop is a custom React Node,
28
48
  * or the component is labelled by an internal element other than the title.
29
49
  */
30
50
  "aria-labelledby": PropTypes.string,
31
-
32
- /** Alert content */
51
+ /**
52
+ * The ARIA role to be applied to the modal
53
+ */
54
+ ariaRole: PropTypes.string,
55
+ /**
56
+ * Modal content
57
+ */
33
58
  children: PropTypes.node,
34
-
35
- /** Controls the open state of the component */
36
- open: PropTypes.bool.isRequired,
37
-
38
- /** A custom close event handler */
39
- onCancel: PropTypes.func,
40
-
41
- /** Determines if the Esc Key closes the Alert */
59
+ /**
60
+ * Padding to be set on the Dialog content
61
+ */
62
+ contentPadding: PropTypes.shape({
63
+ p: PropTypes.oneOf([0, 1, 2, 3, 4, 5, 6, 7, 8]),
64
+ px: PropTypes.oneOf([0, 1, 2, 3, 4, 5, 6, 7, 8]),
65
+ py: PropTypes.oneOf([0, 1, 2, 3, 4, 5, 6, 7, 8]),
66
+ }),
67
+ disableAutoFocus: PropTypes.bool,
68
+ /**
69
+ * Determines if the Dialog can be closed
70
+ */
71
+ disableClose: PropTypes.bool,
72
+ /**
73
+ * Determines if the Esc Key closes the modal
74
+ */
42
75
  disableEscKey: PropTypes.bool,
43
-
44
- /** Allows developers to specify a specific height for the dialog. */
76
+ disableFocusTrap: PropTypes.bool,
77
+ /**
78
+ * Determines if the background is disabled when the modal is open
79
+ */
80
+ enableBackgroundUI: PropTypes.bool,
81
+ /**
82
+ * Optional reference to an element meant to be focused on open
83
+ */
84
+ focusFirstElement: PropTypes.shape({
85
+ current: function (props, propName) {
86
+ if (props[propName] == null) {
87
+ return new Error(
88
+ "Prop '" + propName + "' is required but wasn't specified"
89
+ );
90
+ } else if (
91
+ typeof props[propName] !== "object" ||
92
+ props[propName].nodeType !== 1
93
+ ) {
94
+ return new Error(
95
+ "Expected prop '" + propName + "' to be of type Element"
96
+ );
97
+ }
98
+ },
99
+ }),
100
+ /**
101
+ * Allows developers to specify a specific height for the dialog.
102
+ */
45
103
  height: PropTypes.string,
46
-
47
- /** Title displayed at top of Alert */
48
- title: PropTypes.node,
49
-
50
- /** Subtitle displayed at top of Alert */
51
- subtitle: PropTypes.string,
52
-
53
- /** Size of Alert */
54
- size: PropTypes.oneOf(["auto", "extra-small", "small", "medium-small", "medium", "medium-large", "large", "extra-large"]),
55
-
56
- /** Determines if the close icon is shown */
104
+ /**
105
+ * Adds Help tooltip to Header
106
+ */
107
+ help: PropTypes.string,
108
+ /**
109
+ * A custom close event handler
110
+ */
111
+ onCancel: PropTypes.func,
112
+ /**
113
+ * Sets the open state of the modal
114
+ */
115
+ open: PropTypes.bool.isRequired,
116
+ /**
117
+ * The ARIA role to be applied to the Dialog container
118
+ */
119
+ role: PropTypes.string,
120
+ /**
121
+ * Determines if the close icon is shown
122
+ */
57
123
  showCloseIcon: PropTypes.bool,
124
+ /**
125
+ * Size of dialog, default size is 750px
126
+ */
127
+ size: PropTypes.oneOf([
128
+ "auto",
129
+ "extra-large",
130
+ "extra-small",
131
+ "large",
132
+ "medium-large",
133
+ "medium-small",
134
+ "medium",
135
+ "small",
136
+ ]),
137
+ /**
138
+ * Subtitle displayed at top of dialog
139
+ */
140
+ subtitle: PropTypes.string,
141
+ /**
142
+ * Transition time
143
+ */
144
+ timeout: PropTypes.number,
145
+ /**
146
+ * Title displayed at top of dialog
147
+ */
148
+ title: PropTypes.node,
149
+ };
58
150
 
59
- /** Optional reference to an element meant to be focused on open */
151
+ Alert.propTypes = {
152
+ /**
153
+ * Prop to specify the aria-describedby property of the Dialog component
154
+ */
155
+ "aria-describedby": PropTypes.string,
156
+ /**
157
+ * Prop to specify the aria-label of the Dialog component.
158
+ * To be used only when the title prop is not defined, and the component is not labelled by any internal element.
159
+ */
160
+ "aria-label": PropTypes.string,
161
+ /**
162
+ * Prop to specify the aria-labelledby property of the Dialog component
163
+ * To be used when the title prop is a custom React Node,
164
+ * or the component is labelled by an internal element other than the title.
165
+ */
166
+ "aria-labelledby": PropTypes.string,
167
+ /**
168
+ * The ARIA role to be applied to the modal
169
+ */
170
+ ariaRole: PropTypes.string,
171
+ /**
172
+ * Modal content
173
+ */
174
+ children: PropTypes.node,
175
+ /**
176
+ * Padding to be set on the Dialog content
177
+ */
178
+ contentPadding: PropTypes.shape({
179
+ p: PropTypes.oneOf([0, 1, 2, 3, 4, 5, 6, 7, 8]),
180
+ px: PropTypes.oneOf([0, 1, 2, 3, 4, 5, 6, 7, 8]),
181
+ py: PropTypes.oneOf([0, 1, 2, 3, 4, 5, 6, 7, 8]),
182
+ }),
183
+ disableAutoFocus: PropTypes.bool,
184
+ /**
185
+ * Determines if the Dialog can be closed
186
+ */
187
+ disableClose: PropTypes.bool,
188
+ /**
189
+ * Determines if the Esc Key closes the modal
190
+ */
191
+ disableEscKey: PropTypes.bool,
192
+ disableFocusTrap: PropTypes.bool,
193
+ /**
194
+ * Determines if the background is disabled when the modal is open
195
+ */
196
+ enableBackgroundUI: PropTypes.bool,
197
+ /**
198
+ * Optional reference to an element meant to be focused on open
199
+ */
60
200
  focusFirstElement: PropTypes.shape({
61
- current: PropTypes.any
201
+ current: function (props, propName) {
202
+ if (props[propName] == null) {
203
+ return new Error(
204
+ "Prop '" + propName + "' is required but wasn't specified"
205
+ );
206
+ } else if (
207
+ typeof props[propName] !== "object" ||
208
+ props[propName].nodeType !== 1
209
+ ) {
210
+ return new Error(
211
+ "Expected prop '" + propName + "' to be of type Element"
212
+ );
213
+ }
214
+ },
62
215
  }),
63
-
64
- /** Disables auto focus functionality on child elements */
65
- disableAutoFocus: PropTypes.bool
66
- };
67
- Alert.defaultProps = {
68
- size: "extra-small"
216
+ /**
217
+ * Allows developers to specify a specific height for the dialog.
218
+ */
219
+ height: PropTypes.string,
220
+ /**
221
+ * Adds Help tooltip to Header
222
+ */
223
+ help: PropTypes.string,
224
+ /**
225
+ * A custom close event handler
226
+ */
227
+ onCancel: PropTypes.func,
228
+ /**
229
+ * Sets the open state of the modal
230
+ */
231
+ open: PropTypes.bool.isRequired,
232
+ /**
233
+ * The ARIA role to be applied to the Dialog container
234
+ */
235
+ role: PropTypes.string,
236
+ /**
237
+ * Determines if the close icon is shown
238
+ */
239
+ showCloseIcon: PropTypes.bool,
240
+ /**
241
+ * Size of dialog, default size is 750px
242
+ */
243
+ size: PropTypes.oneOf([
244
+ "auto",
245
+ "extra-large",
246
+ "extra-small",
247
+ "large",
248
+ "medium-large",
249
+ "medium-small",
250
+ "medium",
251
+ "small",
252
+ ]),
253
+ /**
254
+ * Subtitle displayed at top of dialog
255
+ */
256
+ subtitle: PropTypes.string,
257
+ /**
258
+ * Transition time
259
+ */
260
+ timeout: PropTypes.number,
261
+ /**
262
+ * Title displayed at top of dialog
263
+ */
264
+ title: PropTypes.node,
69
265
  };
70
- export default Alert;
266
+
267
+ export { Alert };
268
+ export default Alert;
@@ -1 +1 @@
1
- export { default } from "./alert";
1
+ export { default } from "./alert.component";
@@ -70,18 +70,6 @@ const BaseCarousel = ({
70
70
  handleSlideChange(newSlideSelection);
71
71
  }
72
72
 
73
- function visibleSlides() {
74
- const arrayWithKeys = React.Children.map(children, (element, key) => {
75
- return /*#__PURE__*/React.cloneElement(element, {
76
- key: `slide-${guid()}`,
77
- id: key,
78
- selectedIndex: selectedSlideIndex,
79
- ...element.props
80
- });
81
- });
82
- return arrayWithKeys;
83
- }
84
-
85
73
  function slideSelector() {
86
74
  if (!enableSlideSelector) return null;
87
75
  const buttons = [];
@@ -142,7 +130,7 @@ const BaseCarousel = ({
142
130
  className: "carbon-carousel__content"
143
131
  }, previousButton(), /*#__PURE__*/React.createElement(CarouselSliderWrapper, {
144
132
  elementIndex: selectedSlideIndex
145
- }, visibleSlides()), nextButton()), slideSelector());
133
+ }, children), nextButton()), slideSelector());
146
134
  };
147
135
 
148
136
  BaseCarousel.propTypes = {
@@ -1,6 +1,7 @@
1
1
  import styled, { css } from "styled-components";
2
2
  import Icon from "../icon";
3
3
  import { slideAnimation, fadeAnimation } from "./slide.config";
4
+ import { SlideStyle } from "./slide/slide.style";
4
5
  const CarouselNavigationStyle = styled.div`
5
6
  margin-top: -32.5px;
6
7
  position: absolute;
@@ -117,9 +118,17 @@ const CarouselSliderWrapper = styled.div`
117
118
  transition: 0.4s;
118
119
  display: flex;
119
120
  position: relative;
120
- left: ${({
121
+
122
+ ${({
121
123
  elementIndex
122
- }) => 10 - 80 * elementIndex}%;
124
+ }) => css`
125
+ left: ${10 - 80 * elementIndex}%;
126
+
127
+ ${SlideStyle}:nth-of-type(${elementIndex + 1}) {
128
+ transform: scale(1);
129
+ opacity: 1;
130
+ }
131
+ `}
123
132
  `;
124
133
  const CarouselWrapperStyle = styled.div`
125
134
  .carbon-carousel__content {
@@ -6,9 +6,7 @@ import tagComponent from "../../../__internal__/utils/helpers/tags/tags";
6
6
  import { SlideStyle } from "./slide.style";
7
7
  import baseTheme from "../../../style/themes/base";
8
8
 
9
- const Slide = props => {
10
- return /*#__PURE__*/React.createElement(SlideStyle, _extends({}, props, tagComponent("slide", props)));
11
- };
9
+ const Slide = props => /*#__PURE__*/React.createElement(SlideStyle, _extends({}, props, tagComponent("slide", props)));
12
10
 
13
11
  Slide.defaultProps = {
14
12
  theme: baseTheme
@@ -1,9 +1,7 @@
1
1
  import styled, { css } from "styled-components";
2
2
  const SlideStyle = styled.div`
3
3
  ${({
4
- onClick,
5
- id,
6
- selectedIndex
4
+ onClick
7
5
  }) => css`
8
6
  box-sizing: border-box;
9
7
  display: inline-block;
@@ -18,17 +16,12 @@ const SlideStyle = styled.div`
18
16
  box-shadow: var(--boxShadow200);
19
17
  background-color: var(--colorsUtilityYang100);
20
18
 
21
- ${id === selectedIndex && css`
22
- transform: scale(1);
23
- opacity: 1;
24
-
25
- ${onClick && css`
26
- :hover {
27
- transition: all 0.2s ease-in;
28
- transform: scale(1.02);
29
- cursor: pointer;
30
- }
31
- `}
19
+ ${onClick && css`
20
+ :hover {
21
+ transition: all 0.2s ease-in;
22
+ transform: scale(1.02);
23
+ cursor: pointer;
24
+ }
32
25
  `}
33
26
  `}
34
27
  `; // eslint-disable-next-line import/prefer-default-export
@@ -1,4 +1,6 @@
1
+ export const CheckboxGroupContext: React.Context<{}>;
1
2
  export default CheckboxGroup;
3
+ import React from "react";
2
4
  declare function CheckboxGroup(props: any): JSX.Element;
3
5
  declare namespace CheckboxGroup {
4
6
  namespace propTypes {
@@ -9,6 +9,7 @@ import Fieldset from "../../__internal__/fieldset";
9
9
  import { filterStyledSystemMarginProps } from "../../style/utils";
10
10
  import { TooltipProvider } from "../../__internal__/tooltip-provider";
11
11
  const marginPropTypes = filterStyledSystemMarginProps(styledSystemPropTypes.space);
12
+ export const CheckboxGroupContext = /*#__PURE__*/React.createContext({});
12
13
 
13
14
  const CheckboxGroup = props => {
14
15
  const {
@@ -42,13 +43,14 @@ const CheckboxGroup = props => {
42
43
  }, filterStyledSystemMarginProps(props)), /*#__PURE__*/React.createElement(StyledCheckboxGroup, {
43
44
  "data-component": "checkbox-group",
44
45
  legendInline: legendInline
45
- }, React.Children.map(children, child => /*#__PURE__*/React.cloneElement(child, {
46
- inputName: groupName,
47
- error: !!error,
48
- warning: !!warning,
49
- info: !!info,
50
- ...child.props
51
- })))));
46
+ }, /*#__PURE__*/React.createElement(CheckboxGroupContext.Provider, {
47
+ value: {
48
+ inputName: groupName,
49
+ error: !!error,
50
+ warning: !!warning,
51
+ info: !!info
52
+ }
53
+ }, children))));
52
54
  };
53
55
 
54
56
  CheckboxGroup.propTypes = {
@@ -1,6 +1,6 @@
1
1
  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); }
2
2
 
3
- import React from "react";
3
+ import React, { useContext } from "react";
4
4
  import PropTypes from "prop-types";
5
5
  import styledSystemPropTypes from "@styled-system/prop-types";
6
6
  import CheckboxStyle from "./checkbox.style";
@@ -9,6 +9,7 @@ import CheckboxSvg from "./checkbox-svg.component";
9
9
  import useIsAboveBreakpoint from "../../hooks/__internal__/useIsAboveBreakpoint";
10
10
  import { filterStyledSystemMarginProps } from "../../style/utils";
11
11
  import { TooltipProvider } from "../../__internal__/tooltip-provider";
12
+ import { CheckboxGroupContext } from "./checkbox-group.component";
12
13
  const marginPropTypes = filterStyledSystemMarginProps(styledSystemPropTypes.space);
13
14
 
14
15
  const Checkbox = ({
@@ -47,6 +48,12 @@ const Checkbox = ({
47
48
  }) => {
48
49
  const largeScreen = useIsAboveBreakpoint(adaptiveSpacingBreakpoint);
49
50
  const adaptiveSpacingSmallScreen = !!(adaptiveSpacingBreakpoint && !largeScreen);
51
+ const {
52
+ error: contextError,
53
+ warning: contextWarning,
54
+ info: contextInfo,
55
+ inputName
56
+ } = useContext(CheckboxGroupContext);
50
57
  const inputProps = {
51
58
  onClick,
52
59
  onChange,
@@ -64,15 +71,16 @@ const Checkbox = ({
64
71
  labelHelp,
65
72
  labelSpacing,
66
73
  required,
67
- error,
68
- warning,
69
- info,
74
+ error: contextError || error,
75
+ warning: contextWarning || warning,
76
+ info: contextInfo || info,
70
77
  fieldHelpInline,
71
78
  checked,
72
79
  disabled,
73
80
  inputWidth,
74
81
  labelWidth,
75
82
  tooltipPosition,
83
+ inputName,
76
84
  ...props
77
85
  };
78
86
  return /*#__PURE__*/React.createElement(TooltipProvider, {
@@ -86,9 +94,9 @@ const Checkbox = ({
86
94
  labelSpacing: labelSpacing,
87
95
  inputWidth: inputWidth,
88
96
  adaptiveSpacingSmallScreen: adaptiveSpacingSmallScreen,
89
- error: error,
90
- warning: warning,
91
- info: info,
97
+ error: contextError || error,
98
+ warning: contextWarning || warning,
99
+ info: contextInfo || info,
92
100
  fieldHelpInline: fieldHelpInline,
93
101
  reverse: reverse,
94
102
  size: size
@@ -10,7 +10,6 @@ import { DialogStyle, DialogTitleStyle, DialogContentStyle, DialogInnerContentSt
10
10
  import FocusTrap from "../../__internal__/focus-trap";
11
11
  import IconButton from "../icon-button";
12
12
  import Icon from "../icon";
13
- import Form from "../form";
14
13
  import { TOP_MARGIN } from "./dialog.config";
15
14
  import useLocale from "../../hooks/__internal__/useLocale";
16
15
 
@@ -168,15 +167,7 @@ const Dialog = ({
168
167
  role: role
169
168
  }, contentPadding), dialogTitle(), /*#__PURE__*/React.createElement(DialogContentStyle, contentPadding, /*#__PURE__*/React.createElement(DialogInnerContentStyle, _extends({
170
169
  ref: innerContentRef
171
- }, contentPadding), React.Children.map(children, child => {
172
- if ((child === null || child === void 0 ? void 0 : child.type) === Form) {
173
- return /*#__PURE__*/React.cloneElement(child, {
174
- dialogRef
175
- });
176
- }
177
-
178
- return child;
179
- }))), closeIcon())));
170
+ }, contentPadding), children)), closeIcon())));
180
171
  };
181
172
 
182
173
  Dialog.propTypes = {
@@ -1,5 +1,5 @@
1
1
  export default Form;
2
- declare function Form({ children, saveButton, leftSideButtons, rightSideButtons, errorCount, warningCount, onSubmit, buttonAlignment, stickyFooter, dialogRef, fieldSpacing, noValidate, height, ...rest }: {
2
+ declare function Form({ children, saveButton, leftSideButtons, rightSideButtons, errorCount, warningCount, onSubmit, buttonAlignment, stickyFooter, fieldSpacing, noValidate, height, ...rest }: {
3
3
  [x: string]: any;
4
4
  children: any;
5
5
  saveButton: any;
@@ -10,7 +10,6 @@ declare function Form({ children, saveButton, leftSideButtons, rightSideButtons,
10
10
  onSubmit: any;
11
11
  buttonAlignment?: string | undefined;
12
12
  stickyFooter: any;
13
- dialogRef: any;
14
13
  fieldSpacing?: number | undefined;
15
14
  noValidate?: boolean | undefined;
16
15
  height: any;