carbon-react 110.9.1 → 110.10.1

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 (66) hide show
  1. package/esm/components/advanced-color-picker/advanced-color-picker.style.js +3 -3
  2. package/esm/components/carousel/carousel.component.d.ts +25 -0
  3. package/esm/components/carousel/carousel.component.js +18 -34
  4. package/esm/components/carousel/carousel.style.d.ts +20 -0
  5. package/esm/components/carousel/index.d.ts +4 -1
  6. package/esm/components/carousel/index.js +2 -1
  7. package/esm/components/carousel/slide/index.d.ts +2 -1
  8. package/esm/components/carousel/slide/slide.component.d.ts +7 -0
  9. package/esm/components/carousel/slide/slide.component.js +4 -3
  10. package/esm/components/carousel/slide/slide.style.d.ts +2 -0
  11. package/esm/components/carousel/slide.config.d.ts +3 -0
  12. package/esm/components/dialog/dialog.component.js +9 -5
  13. package/esm/components/dialog/dialog.style.d.ts +9 -7
  14. package/esm/components/dialog/dialog.style.js +12 -14
  15. package/esm/components/dialog-full-screen/content.style.js +5 -1
  16. package/esm/components/dialog-full-screen/dialog-full-screen.component.js +5 -2
  17. package/esm/components/form/__internal__/form-summary.component.d.ts +14 -0
  18. package/esm/components/form/__internal__/form-summary.style.d.ts +3 -0
  19. package/esm/components/form/form.component.d.ts +21 -0
  20. package/esm/components/form/form.component.js +6 -3
  21. package/esm/components/form/form.style.js +14 -4
  22. package/esm/components/sidebar/sidebar.component.js +3 -1
  23. package/esm/components/tile/tile.component.js +2 -2
  24. package/esm/components/tile/tile.config.js +1 -1
  25. package/esm/components/tile/tile.d.ts +2 -2
  26. package/esm/components/tile/tile.style.js +14 -1
  27. package/esm/hooks/__internal__/useIsStickyFooterForm/index.d.ts +1 -0
  28. package/esm/hooks/__internal__/useIsStickyFooterForm/index.js +1 -0
  29. package/esm/hooks/__internal__/useIsStickyFooterForm/useIsStickyFooterForm.d.ts +3 -0
  30. package/esm/hooks/__internal__/useIsStickyFooterForm/useIsStickyFooterForm.js +10 -0
  31. package/lib/components/advanced-color-picker/advanced-color-picker.style.js +2 -2
  32. package/lib/components/carousel/carousel.component.d.ts +25 -0
  33. package/lib/components/carousel/carousel.component.js +19 -44
  34. package/lib/components/carousel/carousel.style.d.ts +20 -0
  35. package/lib/components/carousel/index.d.ts +4 -1
  36. package/lib/components/carousel/index.js +6 -2
  37. package/lib/components/carousel/slide/index.d.ts +2 -1
  38. package/lib/components/carousel/slide/slide.component.d.ts +7 -0
  39. package/lib/components/carousel/slide/slide.component.js +5 -4
  40. package/lib/components/carousel/slide/slide.style.d.ts +2 -0
  41. package/lib/components/carousel/slide.config.d.ts +3 -0
  42. package/lib/components/dialog/dialog.component.js +8 -3
  43. package/lib/components/dialog/dialog.style.d.ts +9 -7
  44. package/lib/components/dialog/dialog.style.js +16 -18
  45. package/lib/components/dialog-full-screen/content.style.js +5 -1
  46. package/lib/components/dialog-full-screen/dialog-full-screen.component.js +6 -2
  47. package/lib/components/form/__internal__/form-summary.component.d.ts +14 -0
  48. package/lib/components/form/__internal__/form-summary.style.d.ts +3 -0
  49. package/lib/components/form/form.component.d.ts +21 -0
  50. package/lib/components/form/form.component.js +7 -4
  51. package/lib/components/form/form.style.js +14 -4
  52. package/lib/components/sidebar/sidebar.component.js +4 -1
  53. package/lib/components/tile/tile.component.js +2 -2
  54. package/lib/components/tile/tile.config.js +1 -1
  55. package/lib/components/tile/tile.d.ts +2 -2
  56. package/lib/components/tile/tile.style.js +14 -1
  57. package/lib/hooks/__internal__/useIsStickyFooterForm/index.d.ts +1 -0
  58. package/lib/hooks/__internal__/useIsStickyFooterForm/index.js +15 -0
  59. package/lib/hooks/__internal__/useIsStickyFooterForm/package.json +6 -0
  60. package/lib/hooks/__internal__/useIsStickyFooterForm/useIsStickyFooterForm.d.ts +3 -0
  61. package/lib/hooks/__internal__/useIsStickyFooterForm/useIsStickyFooterForm.js +27 -0
  62. package/package.json +2 -4
  63. package/esm/components/carousel/carousel.d.ts +0 -28
  64. package/esm/components/carousel/slide/slide.d.ts +0 -9
  65. package/lib/components/carousel/carousel.d.ts +0 -28
  66. package/lib/components/carousel/slide/slide.d.ts +0 -9
@@ -3,7 +3,7 @@ import { margin } from "styled-system";
3
3
  import StyledAdvancedColorPickerCell from "./advanced-color-picker-cell.style";
4
4
  import { StyledColorOptions } from "../simple-color-picker/simple-color-picker.style";
5
5
  import StyledSimpleColor from "../simple-color-picker/simple-color/simple-color.style";
6
- import { DialogContentStyle, DialogInnerContentStyle } from "../dialog/dialog.style";
6
+ import { StyledDialogContent, StyledDialogInnerContent } from "../dialog/dialog.style";
7
7
  import Dialog from "../dialog/dialog.component";
8
8
  import StyledIconButton from "../icon-button/icon-button.style";
9
9
  import checkerBoardSvg from "../simple-color-picker/color-sample-box/checker-board.svg";
@@ -40,11 +40,11 @@ const StyledAdvancedColorPickerPreview = styled.div`
40
40
  }
41
41
  `;
42
42
  const DialogStyle = styled(Dialog)`
43
- ${DialogContentStyle} {
43
+ ${StyledDialogContent} {
44
44
  padding: var(--spacing200);
45
45
  }
46
46
 
47
- ${DialogInnerContentStyle} {
47
+ ${StyledDialogInnerContent} {
48
48
  padding: 0;
49
49
  }
50
50
 
@@ -0,0 +1,25 @@
1
+ import React from "react";
2
+ import { TagProps } from "../../__internal__/utils/helpers/tags/tags";
3
+ export interface CarouselProps extends TagProps {
4
+ /** Individual tabs */
5
+ children?: React.ReactNode;
6
+ /** [legacy] Custom className */
7
+ className?: string;
8
+ /** Enables the next button */
9
+ enableNextButton?: boolean;
10
+ /** Enables the previous button */
11
+ enablePreviousButton?: boolean;
12
+ /** Enables the slide selector */
13
+ enableSlideSelector?: boolean;
14
+ /** The selected tab on page load */
15
+ initialSlideIndex?: number | string;
16
+ /** Action to be called on slide change */
17
+ onSlideChange?: (index: number, transitionDirection: string) => void;
18
+ /** The selected slide */
19
+ slideIndex?: number | string;
20
+ }
21
+ export declare const Carousel: {
22
+ ({ children, className, enableSlideSelector, enablePreviousButton, enableNextButton, initialSlideIndex, onSlideChange, slideIndex, ...props }: CarouselProps): JSX.Element;
23
+ displayName: string;
24
+ };
25
+ export default Carousel;
@@ -2,16 +2,13 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
2
2
 
3
3
  import React, { useCallback, useEffect, useRef, useState, useMemo } from "react";
4
4
  import PropTypes from "prop-types";
5
- import { compact } from "lodash";
6
- import { withTheme } from "styled-components";
7
5
  import tagComponent from "../../__internal__/utils/helpers/tags/tags";
8
- import Slide from "./slide/slide.component";
9
6
  import { CarouselPreviousButtonWrapperStyle, CarouselNextButtonWrapperStyle, CarouselButtonStyle, CarouselStyledIconRight, CarouselStyledIconLeft, CarouselSelectorWrapperStyle, CarouselSelectorInputWrapperStyle, CarouselSelectorInputStyle, CarouselSelectorLabelStyle, CarouselWrapperStyle, CarouselSliderWrapper } from "./carousel.style";
10
7
  import guid from "../../__internal__/utils/helpers/guid";
11
8
  const NEXT = "next";
12
9
  const PREVIOUS = "previous";
13
10
 
14
- const BaseCarousel = ({
11
+ const Carousel = ({
15
12
  children,
16
13
  className,
17
14
  enableSlideSelector = true,
@@ -24,10 +21,10 @@ const BaseCarousel = ({
24
21
  }) => {
25
22
  const [selectedSlideIndex, setSelectedSlideIndex] = useState(Number(slideIndex) || Number(initialSlideIndex));
26
23
  const transitionDirection = useRef(NEXT);
27
- const lastSlideIndexProp = useRef(props.slideIndex);
28
- const id = guid();
24
+ const lastSlideIndexProp = useRef(slideIndex);
25
+ const id = useMemo(() => guid(), []);
29
26
  const numOfSlides = useMemo(() => {
30
- return Array.isArray(children) ? compact(children).length : 1;
27
+ return React.Children.toArray(children).filter(child => /*#__PURE__*/React.isValidElement(child)).length;
31
28
  }, [children]);
32
29
  const handleSlideChange = useCallback(newIndex => {
33
30
  setSelectedSlideIndex(newIndex);
@@ -133,32 +130,19 @@ const BaseCarousel = ({
133
130
  }, children), nextButton()), slideSelector());
134
131
  };
135
132
 
136
- BaseCarousel.propTypes = {
137
- /** [legacy] Custom className */
138
- className: PropTypes.string,
139
-
140
- /** The selected tab on page load */
141
- initialSlideIndex: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
142
-
143
- /** The selected slide */
144
- slideIndex: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
145
-
146
- /** Individual tabs */
147
- children: PropTypes.oneOfType([PropTypes.array, PropTypes.object]),
148
-
149
- /** Enables the slide selector */
150
- enableSlideSelector: PropTypes.bool,
151
-
152
- /** Enables the previous button */
153
- enablePreviousButton: PropTypes.bool,
154
-
155
- /** Enables the next button */
156
- enableNextButton: PropTypes.bool,
157
-
158
- /** Action to be called on slide change */
159
- onSlideChange: PropTypes.func
133
+ Carousel.propTypes = {
134
+ "children": PropTypes.node,
135
+ "className": PropTypes.string,
136
+ "data-component": PropTypes.string,
137
+ "data-element": PropTypes.string,
138
+ "data-role": PropTypes.string,
139
+ "enableNextButton": PropTypes.bool,
140
+ "enablePreviousButton": PropTypes.bool,
141
+ "enableSlideSelector": PropTypes.bool,
142
+ "initialSlideIndex": PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
143
+ "onSlideChange": PropTypes.func,
144
+ "slideIndex": PropTypes.oneOfType([PropTypes.number, PropTypes.string])
160
145
  };
161
- const Carousel = withTheme(BaseCarousel);
146
+ export { Carousel };
162
147
  Carousel.displayName = "Carousel";
163
- export default BaseCarousel;
164
- export { Carousel, Slide };
148
+ export default Carousel;
@@ -0,0 +1,20 @@
1
+ /// <reference types="react" />
2
+ declare const CarouselNavigationStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
3
+ declare const CarouselPreviousButtonWrapperStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
4
+ declare const CarouselNextButtonWrapperStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
5
+ declare const CarouselStyledIcon: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../icon").IconProps & import("react").RefAttributes<HTMLSpanElement>>, any, {}, never>;
6
+ declare const CarouselStyledIconLeft: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../icon").IconProps & import("react").RefAttributes<HTMLSpanElement>>, any, {}, never>;
7
+ declare const CarouselStyledIconRight: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../icon").IconProps & import("react").RefAttributes<HTMLSpanElement>>, any, {}, never>;
8
+ declare const CarouselButtonStyle: import("styled-components").StyledComponent<"button", any, {
9
+ type: "button";
10
+ }, "type">;
11
+ declare const CarouselSelectorInputStyle: import("styled-components").StyledComponent<"input", any, {}, never>;
12
+ declare const CarouselSelectorLabelStyle: import("styled-components").StyledComponent<"label", any, {}, never>;
13
+ declare const CarouselSelectorWrapperStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
14
+ declare const CarouselSelectorInputWrapperStyle: import("styled-components").StyledComponent<"span", any, {}, never>;
15
+ interface CarouselSliderWrapperProps {
16
+ elementIndex: number;
17
+ }
18
+ declare const CarouselSliderWrapper: import("styled-components").StyledComponent<"div", any, CarouselSliderWrapperProps, never>;
19
+ declare const CarouselWrapperStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
20
+ export { CarouselNavigationStyle, CarouselNextButtonWrapperStyle, CarouselPreviousButtonWrapperStyle, CarouselButtonStyle, CarouselStyledIcon, CarouselStyledIconLeft, CarouselStyledIconRight, CarouselSelectorWrapperStyle, CarouselSelectorInputWrapperStyle, CarouselSelectorInputStyle, CarouselSelectorLabelStyle, CarouselWrapperStyle, CarouselSliderWrapper, };
@@ -1 +1,4 @@
1
- export { Carousel, Slide } from "./carousel";
1
+ export { Carousel } from "./carousel.component";
2
+ export { default as Slide } from "./slide";
3
+ export type { CarouselProps } from "./carousel.component";
4
+ export type { SlideProps } from "./slide";
@@ -1 +1,2 @@
1
- export { Carousel, Slide } from "./carousel.component";
1
+ export { Carousel } from "./carousel.component";
2
+ export { default as Slide } from "./slide";
@@ -1 +1,2 @@
1
- export { default } from "./slide";
1
+ export { default } from "./slide.component";
2
+ export type { SlideProps } from "./slide.component";
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ export interface SlideProps {
3
+ children?: React.ReactNode;
4
+ onClick?: (ev: React.MouseEvent<HTMLDivElement>) => void;
5
+ }
6
+ declare const Slide: (props: SlideProps) => JSX.Element;
7
+ export default Slide;
@@ -2,13 +2,14 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
2
2
 
3
3
  /* eslint-disable react/prop-types */
4
4
  import React from "react";
5
+ import PropTypes from "prop-types";
5
6
  import tagComponent from "../../../__internal__/utils/helpers/tags/tags";
6
7
  import { SlideStyle } from "./slide.style";
7
- import baseTheme from "../../../style/themes/base";
8
8
 
9
9
  const Slide = props => /*#__PURE__*/React.createElement(SlideStyle, _extends({}, props, tagComponent("slide", props)));
10
10
 
11
- Slide.defaultProps = {
12
- theme: baseTheme
11
+ Slide.propTypes = {
12
+ "children": PropTypes.node,
13
+ "onClick": PropTypes.func
13
14
  };
14
15
  export default Slide;
@@ -0,0 +1,2 @@
1
+ declare const SlideStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
2
+ export { SlideStyle };
@@ -0,0 +1,3 @@
1
+ declare const slideAnimation: import("styled-components").FlattenSimpleInterpolation;
2
+ declare const fadeAnimation: import("styled-components").FlattenSimpleInterpolation;
3
+ export { slideAnimation, fadeAnimation };
@@ -1,17 +1,18 @@
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, { useRef, useEffect, useLayoutEffect, useCallback } from "react";
3
+ import React, { useCallback, useEffect, useLayoutEffect, useRef } from "react";
4
4
  import PropTypes from "prop-types";
5
5
  import createGuid from "../../__internal__/utils/helpers/guid";
6
6
  import Modal from "../modal";
7
7
  import Heading from "../heading";
8
8
  import useResizeObserver from "../../hooks/__internal__/useResizeObserver";
9
- import { DialogStyle, DialogTitleStyle, DialogContentStyle, DialogInnerContentStyle } from "./dialog.style";
9
+ import { StyledDialog, StyledDialogTitle, StyledDialogContent, StyledDialogInnerContent } from "./dialog.style";
10
10
  import FocusTrap from "../../__internal__/focus-trap";
11
11
  import IconButton from "../icon-button";
12
12
  import Icon from "../icon";
13
13
  import { TOP_MARGIN } from "./dialog.config";
14
14
  import useLocale from "../../hooks/__internal__/useLocale";
15
+ import useIsStickyFooterForm from "../../hooks/__internal__/useIsStickyFooterForm";
15
16
 
16
17
  const Dialog = ({
17
18
  className,
@@ -45,6 +46,7 @@ const Dialog = ({
45
46
  const {
46
47
  current: subtitleId
47
48
  } = useRef(createGuid());
49
+ const hasStickyFooter = useIsStickyFooterForm(children);
48
50
  const centerDialog = useCallback(() => {
49
51
  /* istanbul ignore if */
50
52
  if (!dialogRef.current) {
@@ -118,7 +120,7 @@ const Dialog = ({
118
120
 
119
121
  const dialogTitle = () => {
120
122
  if (!title) return null;
121
- return /*#__PURE__*/React.createElement(DialogTitleStyle, {
123
+ return /*#__PURE__*/React.createElement(StyledDialogTitle, {
122
124
  showCloseIcon: showCloseIcon,
123
125
  hasSubtitle: !!subtitle,
124
126
  ref: titleRef
@@ -164,7 +166,7 @@ const Dialog = ({
164
166
  wrapperRef: dialogRef,
165
167
  isOpen: open,
166
168
  additionalWrapperRefs: focusableContainers
167
- }, /*#__PURE__*/React.createElement(DialogStyle, _extends({
169
+ }, /*#__PURE__*/React.createElement(StyledDialog, _extends({
168
170
  "aria-modal": true,
169
171
  ref: dialogRef,
170
172
  topMargin: TOP_MARGIN
@@ -173,7 +175,9 @@ const Dialog = ({
173
175
  "data-element": "dialog",
174
176
  "data-role": rest["data-role"],
175
177
  role: role
176
- }, contentPadding), dialogTitle(), closeIcon(), /*#__PURE__*/React.createElement(DialogContentStyle, contentPadding, /*#__PURE__*/React.createElement(DialogInnerContentStyle, _extends({
178
+ }, contentPadding), dialogTitle(), closeIcon(), /*#__PURE__*/React.createElement(StyledDialogContent, _extends({}, contentPadding, {
179
+ hasStickyFooter: hasStickyFooter
180
+ }), /*#__PURE__*/React.createElement(StyledDialogInnerContent, _extends({
177
181
  ref: innerContentRef
178
182
  }, contentPadding), children)))));
179
183
  };
@@ -9,17 +9,19 @@ declare const dialogSizes: {
9
9
  large: string;
10
10
  "extra-large": string;
11
11
  };
12
- declare type DialogStyleProps = {
12
+ declare type StyledDialogProps = {
13
13
  topMargin: number;
14
14
  size?: keyof typeof dialogSizes;
15
15
  dialogHeight?: string;
16
16
  };
17
- declare const DialogStyle: import("styled-components").StyledComponent<"div", any, DialogStyleProps & ContentPaddingInterface, never>;
18
- declare type DialogTitleStyleProps = {
17
+ declare const StyledDialog: import("styled-components").StyledComponent<"div", any, StyledDialogProps & ContentPaddingInterface, never>;
18
+ declare type StyledDialogTitleProps = {
19
19
  showCloseIcon?: boolean;
20
20
  hasSubtitle?: boolean;
21
21
  };
22
- declare const DialogTitleStyle: import("styled-components").StyledComponent<"div", any, DialogTitleStyleProps, never>;
23
- declare const DialogContentStyle: import("styled-components").StyledComponent<"div", any, ContentPaddingInterface, never>;
24
- declare const DialogInnerContentStyle: import("styled-components").StyledComponent<"div", any, ContentPaddingInterface, never>;
25
- export { DialogStyle, DialogTitleStyle, DialogContentStyle, DialogInnerContentStyle, };
22
+ declare const StyledDialogTitle: import("styled-components").StyledComponent<"div", any, StyledDialogTitleProps, never>;
23
+ declare const StyledDialogContent: import("styled-components").StyledComponent<"div", any, ContentPaddingInterface & {
24
+ hasStickyFooter: boolean;
25
+ }, never>;
26
+ declare const StyledDialogInnerContent: import("styled-components").StyledComponent<"div", any, ContentPaddingInterface, never>;
27
+ export { StyledDialog, StyledDialogTitle, StyledDialogContent, StyledDialogInnerContent, };
@@ -63,7 +63,7 @@ const calculatePaddingTopInnerContent = ({
63
63
  p
64
64
  }) => [py, p].some(padding => padding !== undefined) ? 0 : `${CONTENT_TOP_PADDING}px`;
65
65
 
66
- const DialogStyle = styled.div`
66
+ const StyledDialog = styled.div`
67
67
  background-color: var(--colorsUtilityMajor025);
68
68
  box-shadow: var(--boxShadow300);
69
69
  display: flex;
@@ -85,12 +85,6 @@ const DialogStyle = styled.div`
85
85
  size
86
86
  }) => size && css`
87
87
  width: ${dialogSizes[size]};
88
-
89
- // IE10+ fix (caters for scrollbar width)
90
- @media screen and (-ms-high-contrast: active),
91
- screen and (-ms-high-contrast: none) {
92
- width: $size - 16;
93
- }
94
88
  `}
95
89
 
96
90
  ${({
@@ -125,7 +119,7 @@ const DialogStyle = styled.div`
125
119
  }
126
120
  }
127
121
  `;
128
- const DialogTitleStyle = styled.div`
122
+ const StyledDialogTitle = styled.div`
129
123
  padding: 23px ${HORIZONTAL_PADDING}px 0;
130
124
  border-bottom: 1px solid #ccd6db;
131
125
  ${({
@@ -150,25 +144,29 @@ const DialogTitleStyle = styled.div`
150
144
  }
151
145
  }
152
146
  `;
153
- const DialogContentStyle = styled.div`
147
+ const StyledDialogContent = styled.div`
154
148
  box-sizing: border-box;
155
149
  display: flex;
156
150
  flex-direction: column;
157
- overflow-y: auto;
151
+ ${({
152
+ hasStickyFooter
153
+ }) => !hasStickyFooter && css`
154
+ overflow-y: auto;
155
+ `}
158
156
  width: 100%;
159
157
  flex: 1;
160
158
  padding: 0px ${HORIZONTAL_PADDING}px ${CONTENT_BOTTOM_PADDING}px;
161
159
  ${paddingFn}
162
160
  `;
163
- const DialogInnerContentStyle = styled.div`
161
+ const StyledDialogInnerContent = styled.div`
164
162
  position: relative;
165
163
  flex: 1;
166
164
  padding-top: ${calculatePaddingTopInnerContent};
167
165
  `;
168
- DialogStyle.defaultProps = {
166
+ StyledDialog.defaultProps = {
169
167
  theme: baseTheme
170
168
  };
171
- DialogContentStyle.defaultProps = {
169
+ StyledDialogContent.defaultProps = {
172
170
  theme: baseTheme
173
171
  };
174
- export { DialogStyle, DialogTitleStyle, DialogContentStyle, DialogInnerContentStyle };
172
+ export { StyledDialog, StyledDialogTitle, StyledDialogContent, StyledDialogInnerContent };
@@ -1,7 +1,11 @@
1
1
  import styled, { css } from "styled-components";
2
2
  import { StyledFormFooter, StyledFormContent } from "../form/form.style";
3
3
  const StyledContent = styled.div`
4
- overflow-y: auto;
4
+ ${({
5
+ hasStickyFooter
6
+ }) => !hasStickyFooter && css`
7
+ overflow-y: auto;
8
+ `}
5
9
  padding: 0 16px;
6
10
  flex: 1;
7
11
 
@@ -12,6 +12,7 @@ import FocusTrap from "../../__internal__/focus-trap";
12
12
  import IconButton from "../icon-button";
13
13
  import Icon from "../icon";
14
14
  import useLocale from "../../hooks/__internal__/useLocale";
15
+ import useIsStickyFooterForm from "../../hooks/__internal__/useIsStickyFooterForm";
15
16
 
16
17
  const DialogFullScreen = ({
17
18
  "aria-describedby": ariaDescribedBy,
@@ -44,6 +45,7 @@ const DialogFullScreen = ({
44
45
  const {
45
46
  current: subtitleId
46
47
  } = useRef(createGuid());
48
+ const hasStickyFooter = useIsStickyFooterForm(children);
47
49
 
48
50
  const closeIcon = () => {
49
51
  if (!showCloseIcon || !onCancel) return null;
@@ -57,7 +59,7 @@ const DialogFullScreen = ({
57
59
  };
58
60
 
59
61
  const dialogTitle = () => /*#__PURE__*/React.createElement(FullScreenHeading, {
60
- hasContent: title,
62
+ hasContent: !!title,
61
63
  ref: headingRef
62
64
  }, typeof title === "string" ? /*#__PURE__*/React.createElement(Heading, {
63
65
  "data-element": "dialog-title",
@@ -100,7 +102,8 @@ const DialogFullScreen = ({
100
102
  hasHeader: title !== undefined,
101
103
  "data-element": "content",
102
104
  ref: contentRef,
103
- disableContentPadding: disableContentPadding
105
+ disableContentPadding: disableContentPadding,
106
+ hasStickyFooter: hasStickyFooter
104
107
  }, children))));
105
108
  };
106
109
 
@@ -0,0 +1,14 @@
1
+ export default FormSummary;
2
+ declare function FormSummary({ fullWidth, ...props }: {
3
+ [x: string]: any;
4
+ fullWidth: any;
5
+ }): JSX.Element;
6
+ declare namespace FormSummary {
7
+ namespace propTypes {
8
+ const children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
9
+ const errors: PropTypes.Requireable<number>;
10
+ const warnings: PropTypes.Requireable<number>;
11
+ const fullWidth: PropTypes.Requireable<boolean>;
12
+ }
13
+ }
14
+ import PropTypes from "prop-types";
@@ -0,0 +1,3 @@
1
+ export const StyledFormSummary: import("styled-components").StyledComponent<"div", any, {}, never>;
2
+ export const StyledMessagePrefix: import("styled-components").StyledComponent<"div", any, {}, never>;
3
+ export const StyledInternalSummary: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -0,0 +1,21 @@
1
+ export default Form;
2
+ declare function Form({ children, saveButton, leftSideButtons, rightSideButtons, errorCount, warningCount, onSubmit, buttonAlignment, stickyFooter, fieldSpacing, noValidate, height, fullWidthButtons, ...rest }: {
3
+ [x: string]: any;
4
+ children: any;
5
+ saveButton: any;
6
+ leftSideButtons: any;
7
+ rightSideButtons: any;
8
+ errorCount: any;
9
+ warningCount: any;
10
+ onSubmit: any;
11
+ buttonAlignment?: string | undefined;
12
+ stickyFooter: any;
13
+ fieldSpacing?: number | undefined;
14
+ noValidate?: boolean | undefined;
15
+ height: any;
16
+ fullWidthButtons?: boolean | undefined;
17
+ }): JSX.Element;
18
+ declare namespace Form {
19
+ const propTypes: any;
20
+ const displayName: string;
21
+ }
@@ -3,8 +3,8 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
3
3
  import React, { useRef, useContext } from "react";
4
4
  import PropTypes from "prop-types";
5
5
  import styledSystemPropTypes from "@styled-system/prop-types";
6
- import { ModalContext } from "../modal/modal.component";
7
6
  import { SidebarContext } from "../sidebar/sidebar.component";
7
+ import { ModalContext } from "../modal/modal.component";
8
8
  import FormSummary from "./__internal__/form-summary.component";
9
9
  import { StyledForm, StyledFormContent, StyledFormFooter, StyledLeftButtons, StyledRightButtons, StyledFullWidthButtons } from "./form.style";
10
10
 
@@ -41,7 +41,8 @@ const Form = ({
41
41
  fieldSpacing: fieldSpacing,
42
42
  noValidate: noValidate,
43
43
  isInSidebar: isInSidebar,
44
- height: height
44
+ height: height,
45
+ isInModal: isInModal
45
46
  }, rest), /*#__PURE__*/React.createElement(StyledFormContent, {
46
47
  "data-element": "form-content",
47
48
  className: stickyFooter ? "sticky" : "",
@@ -52,7 +53,8 @@ const Form = ({
52
53
  className: stickyFooter ? "sticky" : "",
53
54
  ref: formFooterRef,
54
55
  stickyFooter: stickyFooter,
55
- buttonAlignment: buttonAlignment
56
+ buttonAlignment: buttonAlignment,
57
+ isInModal: isInModal
56
58
  }, leftSideButtons && /*#__PURE__*/React.createElement(StyledLeftButtons, {
57
59
  buttonAlignment: buttonAlignment
58
60
  }, leftSideButtons), /*#__PURE__*/React.createElement(FormSummary, {
@@ -119,4 +121,5 @@ Form.propTypes = { ...styledSystemPropTypes.space,
119
121
  /** Applies styling for full width buttons. Please note that you will still need to pass the `fullWidth` prop to the button you compose */
120
122
  fullWidthButtons: PropTypes.bool
121
123
  };
124
+ Form.displayName = "Form";
122
125
  export default Form;
@@ -16,7 +16,7 @@ export const StyledFormContent = styled.div`
16
16
  isInModal
17
17
  }) => css`
18
18
  ${stickyFooter && css`
19
- overflow-y: ${isInModal ? "visible" : "inherit"};
19
+ overflow-y: ${isInModal ? "auto" : "inherit"};
20
20
  flex: 1;
21
21
  `}
22
22
  `}
@@ -33,7 +33,8 @@ export const StyledFormFooter = styled.div`
33
33
 
34
34
  ${({
35
35
  stickyFooter,
36
- fullWidthButtons
36
+ fullWidthButtons,
37
+ isInModal
37
38
  }) => css`
38
39
  ${!stickyFooter && css`
39
40
  margin-top: 48px;
@@ -46,7 +47,9 @@ export const StyledFormFooter = styled.div`
46
47
  padding: 16px 32px;
47
48
  width: 100%;
48
49
  z-index: 1000;
49
- position: sticky;
50
+ ${!isInModal && css`
51
+ position: sticky;
52
+ `}
50
53
  bottom: 0;
51
54
  `}
52
55
 
@@ -65,8 +68,10 @@ const formBottomMargins = fieldSpacing => ({
65
68
  4: "var(--spacing400)",
66
69
  5: "var(--spacing500)",
67
70
  7: "var(--spacing700)"
68
- })[fieldSpacing];
71
+ })[fieldSpacing]; // Accounts for height of the header of Modal parent, the height form footer and some additional spacing
69
72
 
73
+
74
+ const HEIGHT_SPACING = 216;
70
75
  export const StyledForm = styled.form`
71
76
  ${space}
72
77
 
@@ -109,12 +114,17 @@ export const StyledForm = styled.form`
109
114
 
110
115
  ${({
111
116
  stickyFooter,
117
+ isInModal,
112
118
  isInSidebar
113
119
  }) => stickyFooter && css`
114
120
  display: flex;
115
121
  flex-direction: column;
116
122
  position: relative;
117
123
 
124
+ ${isInModal && css`
125
+ max-height: calc(100vh - ${HEIGHT_SPACING}px);
126
+ `}
127
+
118
128
  ${isInSidebar && css`
119
129
  min-height: 100%;
120
130
  ${StyledFormContent}.sticky {
@@ -12,6 +12,7 @@ import Box from "../box";
12
12
  import createGuid from "../../__internal__/utils/helpers/guid";
13
13
  import useLocale from "../../hooks/__internal__/useLocale";
14
14
  import { filterStyledSystemPaddingProps } from "../../style/utils";
15
+ import useIsStickyFooterForm from "../../hooks/__internal__/useIsStickyFooterForm";
15
16
  export const SidebarContext = /*#__PURE__*/React.createContext({});
16
17
  const Sidebar = /*#__PURE__*/React.forwardRef(({
17
18
  "aria-describedby": ariaDescribedBy,
@@ -33,6 +34,7 @@ const Sidebar = /*#__PURE__*/React.forwardRef(({
33
34
  const {
34
35
  current: titleId
35
36
  } = useRef(createGuid());
37
+ const hasStickyFooter = useIsStickyFooterForm(children);
36
38
  const sidebarRef = useRef(null);
37
39
  const setRefs = useCallback(reference => {
38
40
  sidebarRef.current = reference;
@@ -77,7 +79,7 @@ const Sidebar = /*#__PURE__*/React.forwardRef(({
77
79
  px: "var(--spacing400)"
78
80
  }, filterStyledSystemPaddingProps(rest), {
79
81
  scrollVariant: "light",
80
- overflow: "auto",
82
+ overflow: hasStickyFooter ? undefined : "auto",
81
83
  flex: "1"
82
84
  }), /*#__PURE__*/React.createElement(SidebarContext.Provider, {
83
85
  value: {
@@ -53,8 +53,8 @@ Tile.propTypes = {
53
53
  /** Styled system spacing props */
54
54
  ...propTypes.space,
55
55
 
56
- /** Sets the theme of the tile - either 'tile' or 'transparent' */
57
- variant: PropTypes.oneOf(["tile", "transparent"]),
56
+ /** Sets the theme of the tile - either 'tile', 'transparent' or 'active' */
57
+ variant: PropTypes.oneOf(["tile", "transparent", "active"]),
58
58
 
59
59
  /**
60
60
  * The content to render within the tile. Each child will be wrapped with
@@ -1,2 +1,2 @@
1
1
  export const TILE_ORIENTATIONS = ["horizontal", "vertical"];
2
- export const TILE_THEMES = ["tile", "transparent"];
2
+ export const TILE_THEMES = ["tile", "transparent", "active"];
@@ -2,8 +2,8 @@ import * as React from "react";
2
2
  import { SpaceProps } from "styled-system";
3
3
 
4
4
  export interface TileProps extends SpaceProps {
5
- /** Sets the theme of the tile - either 'tile' or 'transparent' */
6
- variant?: "tile" | "transparent";
5
+ /** Sets the theme of the tile - either 'tile', 'transparent' or 'active' */
6
+ variant?: "tile" | "transparent" | "active";
7
7
  /**
8
8
  * The content to render within the tile. Each child will be wrapped with
9
9
  * a TileContent wrapper, which allows any individual child component to take a
@@ -64,8 +64,21 @@ const StyledTile = styled.div`
64
64
  ${space}
65
65
 
66
66
  box-sizing: border-box;
67
- background-color: ${tileTheme === "tile" ? "var(--colorsUtilityYang100)" : "transparent"};
68
67
  border: 1px solid var(--colorsUtilityMajor100);
68
+
69
+ ${tileTheme === "tile" && css`
70
+ background-color: var(--colorsUtilityYang100);
71
+ `}
72
+
73
+ ${tileTheme === "transparent" && css`
74
+ background-color: transparent;
75
+ `}
76
+
77
+ ${tileTheme === "active" && css`
78
+ background-color: var(--colorsActionMajor025);
79
+ border-color: var(--colorsActionMajor500);
80
+ `}
81
+
69
82
  display: flex;
70
83
  flex-direction: ${isHorizontal ? "row" : "column"};
71
84
  position: relative;
@@ -0,0 +1 @@
1
+ export { default } from "./useIsStickyFooterForm";
@@ -0,0 +1 @@
1
+ export { default } from "./useIsStickyFooterForm";
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ declare const _default: (children?: React.ReactNode) => boolean;
3
+ export default _default;
@@ -0,0 +1,10 @@
1
+ import React, { useMemo } from "react";
2
+ import Form from "../../../components/form/form.component";
3
+ export default (children => {
4
+ const isStickyFooterForm = useMemo(() => React.Children.toArray(children).some(child => {
5
+ var _child$type;
6
+
7
+ return /*#__PURE__*/React.isValidElement(child) && ((_child$type = child.type) === null || _child$type === void 0 ? void 0 : _child$type.displayName) === Form.displayName && child.props.stickyFooter;
8
+ }), [children]);
9
+ return isStickyFooterForm;
10
+ });