carbon-react 110.11.1 → 111.0.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 (56) hide show
  1. package/esm/__internal__/popover/popover.component.d.ts +5 -10
  2. package/esm/__internal__/popover/popover.component.js +34 -55
  3. package/esm/components/action-popover/action-popover.style.js +1 -1
  4. package/esm/components/date/__internal__/date-picker/date-picker.component.js +5 -12
  5. package/esm/components/date/__internal__/date-picker/day-picker.style.js +1 -1
  6. package/esm/components/heading/heading.component.d.ts +31 -0
  7. package/esm/components/heading/heading.component.js +174 -43
  8. package/esm/components/heading/heading.style.d.ts +26 -12
  9. package/esm/components/heading/index.d.ts +2 -1
  10. package/esm/components/popover-container/popover-container.component.js +9 -14
  11. package/esm/components/select/filterable-select/filterable-select.component.js +2 -2
  12. package/esm/components/select/filterable-select/filterable-select.d.ts +2 -16
  13. package/esm/components/select/list-action-button/list-action-button.style.js +0 -14
  14. package/esm/components/select/multi-select/multi-select.component.js +2 -2
  15. package/esm/components/select/multi-select/multi-select.d.ts +2 -16
  16. package/esm/components/select/option/option.style.js +1 -1
  17. package/esm/components/select/option-row/option-row.style.js +1 -1
  18. package/esm/components/select/select-list/select-list-container.style.js +0 -4
  19. package/esm/components/select/select-list/select-list.component.js +11 -26
  20. package/esm/components/select/select-textbox/select-textbox.component.js +28 -59
  21. package/esm/components/select/simple-select/simple-select.component.js +2 -2
  22. package/esm/components/select/simple-select/simple-select.d.ts +2 -16
  23. package/esm/hooks/__internal__/useFloating/index.d.ts +1 -0
  24. package/esm/hooks/__internal__/useFloating/index.js +1 -0
  25. package/esm/hooks/__internal__/useFloating/useFloating.d.ts +13 -0
  26. package/esm/hooks/__internal__/useFloating/useFloating.js +71 -0
  27. package/lib/__internal__/popover/popover.component.d.ts +5 -10
  28. package/lib/__internal__/popover/popover.component.js +35 -55
  29. package/lib/components/action-popover/action-popover.style.js +1 -1
  30. package/lib/components/date/__internal__/date-picker/date-picker.component.js +7 -12
  31. package/lib/components/date/__internal__/date-picker/day-picker.style.js +1 -1
  32. package/lib/components/heading/heading.component.d.ts +31 -0
  33. package/lib/components/heading/heading.component.js +175 -46
  34. package/lib/components/heading/heading.style.d.ts +26 -12
  35. package/lib/components/heading/index.d.ts +2 -1
  36. package/lib/components/popover-container/popover-container.component.js +10 -14
  37. package/lib/components/select/filterable-select/filterable-select.component.js +2 -2
  38. package/lib/components/select/filterable-select/filterable-select.d.ts +2 -16
  39. package/lib/components/select/list-action-button/list-action-button.style.js +0 -15
  40. package/lib/components/select/multi-select/multi-select.component.js +2 -2
  41. package/lib/components/select/multi-select/multi-select.d.ts +2 -16
  42. package/lib/components/select/option/option.style.js +1 -1
  43. package/lib/components/select/option-row/option-row.style.js +1 -1
  44. package/lib/components/select/select-list/select-list-container.style.js +0 -4
  45. package/lib/components/select/select-list/select-list.component.js +12 -27
  46. package/lib/components/select/select-textbox/select-textbox.component.js +28 -59
  47. package/lib/components/select/simple-select/simple-select.component.js +2 -2
  48. package/lib/components/select/simple-select/simple-select.d.ts +2 -16
  49. package/lib/hooks/__internal__/useFloating/index.d.ts +1 -0
  50. package/lib/hooks/__internal__/useFloating/index.js +15 -0
  51. package/lib/hooks/__internal__/useFloating/package.json +6 -0
  52. package/lib/hooks/__internal__/useFloating/useFloating.d.ts +13 -0
  53. package/lib/hooks/__internal__/useFloating/useFloating.js +80 -0
  54. package/package.json +2 -2
  55. package/esm/components/heading/heading.d.ts +0 -33
  56. package/lib/components/heading/heading.d.ts +0 -33
@@ -1,19 +1,14 @@
1
1
  import React from "react";
2
- import { State } from "@popperjs/core";
3
- declare type PopoverModifier = {
4
- name: string;
5
- options?: Record<string, unknown>;
6
- enabled?: boolean;
7
- };
2
+ import { Placement, Middleware } from "@floating-ui/dom";
8
3
  export interface PopoverProps {
9
4
  children: React.ReactElement;
10
- placement?: "auto" | "auto-start" | "auto-end" | "top" | "top-start" | "top-end" | "bottom" | "bottom-start" | "bottom-end" | "right" | "right-start" | "right-end" | "left" | "left-start" | "left-end";
5
+ placement?: Placement;
11
6
  disableBackgroundUI?: boolean;
12
- modifiers?: PopoverModifier[];
13
- onFirstUpdate?: (state: Partial<State>) => void;
7
+ middleware?: Middleware[];
14
8
  disablePortal?: boolean;
15
9
  reference: React.RefObject<HTMLElement>;
16
10
  isOpen?: boolean;
11
+ animationFrame?: boolean;
17
12
  }
18
- declare const Popover: ({ children, placement, disablePortal, reference, onFirstUpdate, modifiers, disableBackgroundUI, isOpen, }: PopoverProps) => JSX.Element;
13
+ declare const Popover: ({ children, placement, disablePortal, reference, middleware, disableBackgroundUI, isOpen, animationFrame, }: PopoverProps) => JSX.Element;
19
14
  export default Popover;
@@ -1,21 +1,24 @@
1
- import React, { useContext, useEffect, useLayoutEffect, useRef } from "react";
1
+ import React, { useContext, useEffect, useRef } from "react";
2
2
  import PropTypes from "prop-types";
3
3
  import ReactDOM from "react-dom";
4
- import { createPopper } from "@popperjs/core";
5
- import useResizeObserver from "../../hooks/__internal__/useResizeObserver";
4
+ import { flip } from "@floating-ui/dom";
5
+ import useFloating from "../../hooks/__internal__/useFloating";
6
6
  import { StyledBackdrop, StyledPopoverContent } from "./popover.style";
7
7
  import CarbonScopedTokensProvider from "../../style/design-tokens/carbon-scoped-tokens-provider/carbon-scoped-tokens-provider.component";
8
8
  import { ModalContext } from "../../components/modal/modal.component";
9
+ const defaultMiddleware = [flip({
10
+ fallbackStrategy: "initialPlacement"
11
+ })];
9
12
 
10
13
  const Popover = ({
11
14
  children,
12
15
  placement,
13
16
  disablePortal,
14
17
  reference,
15
- onFirstUpdate,
16
- modifiers,
18
+ middleware = defaultMiddleware,
17
19
  disableBackgroundUI,
18
- isOpen = true
20
+ isOpen = true,
21
+ animationFrame
19
22
  }) => {
20
23
  var _reference$current;
21
24
 
@@ -31,56 +34,27 @@ const Popover = ({
31
34
  mountNode.appendChild(elementDOM.current);
32
35
  }
33
36
 
34
- const popperInstance = useRef(null);
35
- const popperRef = useRef(null);
36
- let content;
37
- let popperElementRef;
38
37
  const childRef = React.Children.only(children).ref;
38
+ const innerRef = useRef(null);
39
+ const floatingReference = childRef || innerRef;
40
+ let content;
39
41
 
40
42
  if (childRef) {
41
43
  content = children;
42
- popperElementRef = childRef;
43
44
  } else {
44
45
  content = /*#__PURE__*/React.cloneElement(children, {
45
- ref: popperRef
46
+ ref: floatingReference
46
47
  });
47
- popperElementRef = popperRef;
48
48
  }
49
49
 
50
- useResizeObserver(reference, () => {
51
- var _popperInstance$curre;
52
-
53
- popperInstance === null || popperInstance === void 0 ? void 0 : (_popperInstance$curre = popperInstance.current) === null || _popperInstance$curre === void 0 ? void 0 : _popperInstance$curre.update();
50
+ useFloating({
51
+ isOpen,
52
+ reference,
53
+ floating: floatingReference,
54
+ placement,
55
+ middleware,
56
+ animationFrame
54
57
  });
55
- useEffect(() => {
56
- if (isOpen) {
57
- var _popperInstance$curre2;
58
-
59
- popperInstance === null || popperInstance === void 0 ? void 0 : (_popperInstance$curre2 = popperInstance.current) === null || _popperInstance$curre2 === void 0 ? void 0 : _popperInstance$curre2.update();
60
- }
61
- }, [isOpen]);
62
- useLayoutEffect(() => {
63
- if (reference.current) {
64
- popperInstance.current = createPopper(reference.current, popperElementRef.current, {
65
- placement,
66
- onFirstUpdate,
67
- modifiers: [{
68
- name: "computeStyles",
69
- options: {
70
- gpuAcceleration: false,
71
- roundOffsets: false
72
- }
73
- }, ...(modifiers || [])]
74
- });
75
- }
76
-
77
- return () => {
78
- if (popperInstance.current) {
79
- popperInstance.current.destroy();
80
- popperInstance.current = null;
81
- }
82
- };
83
- }, [modifiers, onFirstUpdate, placement, popperElementRef, reference]);
84
58
  useEffect(() => {
85
59
  return () => {
86
60
  if (!disablePortal) {
@@ -89,12 +63,17 @@ const Popover = ({
89
63
  }
90
64
  };
91
65
  }, [disablePortal, mountNode]);
92
- content = /*#__PURE__*/React.createElement(StyledPopoverContent, {
93
- isOpen: isOpen
94
- }, content);
66
+
67
+ if (!disableBackgroundUI) {
68
+ content = /*#__PURE__*/React.createElement(StyledPopoverContent, {
69
+ isOpen: isOpen
70
+ }, content);
71
+ }
95
72
 
96
73
  if (disableBackgroundUI) {
97
- content = /*#__PURE__*/React.createElement(StyledBackdrop, null, content);
74
+ content = /*#__PURE__*/React.createElement(StyledPopoverContent, {
75
+ isOpen: isOpen
76
+ }, /*#__PURE__*/React.createElement(StyledBackdrop, null, content));
98
77
  }
99
78
 
100
79
  if (disablePortal) {
@@ -105,17 +84,17 @@ const Popover = ({
105
84
  };
106
85
 
107
86
  Popover.propTypes = {
87
+ "animationFrame": PropTypes.bool,
108
88
  "children": PropTypes.element.isRequired,
109
89
  "disableBackgroundUI": PropTypes.bool,
110
90
  "disablePortal": PropTypes.bool,
111
91
  "isOpen": PropTypes.bool,
112
- "modifiers": PropTypes.arrayOf(PropTypes.shape({
113
- "enabled": PropTypes.bool,
92
+ "middleware": PropTypes.arrayOf(PropTypes.shape({
93
+ "fn": PropTypes.func.isRequired,
114
94
  "name": PropTypes.string.isRequired,
115
- "options": PropTypes.object
95
+ "options": PropTypes.any
116
96
  })),
117
- "onFirstUpdate": PropTypes.func,
118
- "placement": PropTypes.oneOf(["auto-end", "auto-start", "auto", "bottom-end", "bottom-start", "bottom", "left-end", "left-start", "left", "right-end", "right-start", "right", "top-end", "top-start", "top"]),
97
+ "placement": PropTypes.any,
119
98
  "reference": PropTypes.shape({
120
99
  "current": PropTypes.oneOfType([PropTypes.oneOf([null]), function (props, propName) {
121
100
  if (props[propName] == null) {
@@ -60,7 +60,7 @@ const StyledMenuItem = styled.button`
60
60
  }) => !isDisabled && css`
61
61
  &:focus,
62
62
  &:hover {
63
- background-color: var(--colorsUtilityMajor025);
63
+ background-color: var(--colorsUtilityMajor100);
64
64
  }
65
65
  && ${StyledIcon} {
66
66
  cursor: pointer;
@@ -3,12 +3,16 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
3
3
  import React, { useMemo } from "react";
4
4
  import PropTypes from "prop-types";
5
5
  import DayPicker from "react-day-picker";
6
+ import { flip, offset } from "@floating-ui/dom";
6
7
  import { getDisabledDays } from "../utils";
7
8
  import Popover from "../../../../__internal__/popover";
8
9
  import useLocale from "../../../../hooks/__internal__/useLocale";
9
10
  import Navbar from "../navbar";
10
11
  import Weekday from "../weekday";
11
12
  import StyledDayPicker from "./day-picker.style";
13
+ const popoverMiddleware = [offset(3), flip({
14
+ fallbackStrategy: "initialPlacement"
15
+ })];
12
16
  const DatePicker = /*#__PURE__*/React.forwardRef(({
13
17
  inputElement,
14
18
  minDate,
@@ -49,17 +53,6 @@ const DatePicker = /*#__PURE__*/React.forwardRef(({
49
53
  } : {
50
54
  width: "abbreviated"
51
55
  }).substring(0, 3)), [l, localize]);
52
- const popoverModifiers = useMemo(() => [{
53
- name: "offset",
54
- options: {
55
- offset: [0, 3]
56
- }
57
- }, {
58
- name: "preventOverflow",
59
- options: {
60
- mainAxis: false
61
- }
62
- }], []);
63
56
 
64
57
  const handleDayClick = (date, {
65
58
  disabled
@@ -88,7 +81,7 @@ const DatePicker = /*#__PURE__*/React.forwardRef(({
88
81
  return /*#__PURE__*/React.createElement(Popover, {
89
82
  placement: "bottom-start",
90
83
  reference: inputElement,
91
- modifiers: popoverModifiers,
84
+ middleware: popoverMiddleware,
92
85
  disablePortal: disablePortal
93
86
  }, /*#__PURE__*/React.createElement(StyledDayPicker, {
94
87
  ref: ref,
@@ -179,7 +179,7 @@ const StyledDayPicker = styled.div`
179
179
  ${addReactDayPickerStyles}
180
180
 
181
181
  position: absolute;
182
- height: 352px;
182
+ height: 346px;
183
183
  width: 352px;
184
184
  z-index: ${({
185
185
  theme
@@ -0,0 +1,31 @@
1
+ import React from "react";
2
+ import { MarginProps } from "styled-system";
3
+ import { TagProps } from "../../__internal__/utils/helpers/tags/tags";
4
+ export interface HeadingProps extends MarginProps, TagProps {
5
+ /** Child elements */
6
+ children?: React.ReactNode;
7
+ /** Defines the title for the heading. */
8
+ title?: React.ReactNode;
9
+ /** Defines the title id for the heading. */
10
+ titleId?: string;
11
+ /** Defines the subheader for the heading. */
12
+ subheader?: React.ReactNode;
13
+ /** Defines the subtitle id for the heading. */
14
+ subtitleId?: string;
15
+ /** Defines the help text for the heading. */
16
+ help?: string;
17
+ /** Defines the help link for the heading. */
18
+ helpLink?: string;
19
+ /** Defines the a href for the back link. */
20
+ backLink?: string | ((ev: React.MouseEvent<HTMLAnchorElement> | React.MouseEvent<HTMLButtonElement> | React.KeyboardEvent<HTMLAnchorElement> | React.KeyboardEvent<HTMLButtonElement>) => void);
21
+ /** Adds a divider below the heading and the content. */
22
+ divider?: boolean;
23
+ /** Adds a separator between the title and the subheader. */
24
+ separator?: boolean;
25
+ /** Pills that will be added after the title. */
26
+ pills?: React.ReactNode;
27
+ /** Aria label for rendered help component */
28
+ helpAriaLabel?: string;
29
+ }
30
+ export declare const Heading: ({ children, backLink, divider, help, helpAriaLabel, helpLink, pills, separator, subheader, subtitleId, title, titleId, ...rest }: HeadingProps) => JSX.Element | null;
31
+ export default Heading;
@@ -2,12 +2,10 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
2
2
 
3
3
  import React from "react";
4
4
  import PropTypes from "prop-types";
5
- import styledSystemPropTypes from "@styled-system/prop-types";
6
5
  import { filterStyledSystemMarginProps } from "../../style/utils";
7
6
  import tagComponent from "../../__internal__/utils/helpers/tags/tags";
8
7
  import { StyledHeading, StyledHeadingIcon, StyledSubHeader, StyledHeader, StyledSeparator, StyledHeaderHelp, StyledHeadingTitle, StyledDivider, StyledHeaderContent, StyledHeadingBackButton, StyledHeadingPills } from "./heading.style";
9
8
  import useLocale from "../../hooks/__internal__/useLocale";
10
- const marginPropTypes = filterStyledSystemMarginProps(styledSystemPropTypes.space);
11
9
 
12
10
  const Heading = ({
13
11
  children,
@@ -47,8 +45,7 @@ const Heading = ({
47
45
  "data-element": "back",
48
46
  onMouseDown: e => e.currentTarget.focus()
49
47
  }, backButtonProps), /*#__PURE__*/React.createElement(StyledHeadingIcon, {
50
- type: "chevron_left",
51
- divider: divider
48
+ type: "chevron_left"
52
49
  }));
53
50
  };
54
51
 
@@ -75,10 +72,10 @@ const Heading = ({
75
72
  return title ? /*#__PURE__*/React.createElement(StyledHeading, _extends({}, tagComponent("heading", dataAttributes), marginProps), /*#__PURE__*/React.createElement(StyledHeader, {
76
73
  "data-element": "header-container",
77
74
  divider: divider,
78
- subheader: subheader,
75
+ subheader: !!subheader,
79
76
  hasBackLink: !!backLink
80
77
  }, backLink && getBackButton(), /*#__PURE__*/React.createElement(StyledHeaderContent, null, /*#__PURE__*/React.createElement(StyledHeadingTitle, {
81
- withMargin: pills || help,
78
+ withMargin: !!pills || !!help,
82
79
  variant: "h1",
83
80
  "data-element": "title",
84
81
  id: titleId
@@ -87,42 +84,176 @@ const Heading = ({
87
84
  }), children) : null;
88
85
  };
89
86
 
90
- Heading.propTypes = { ...marginPropTypes,
91
-
92
- /** Child elements */
93
- children: PropTypes.node,
94
-
95
- /** Defines the title for the heading. */
96
- title: PropTypes.node,
97
-
98
- /** Defines the title id for the heading. */
99
- titleId: PropTypes.string,
100
-
101
- /** Defines the subheader for the heading. */
102
- subheader: PropTypes.node,
103
-
104
- /** Defines the subtitle id for the heading. */
105
- subtitleId: PropTypes.string,
106
-
107
- /** Defines the help text for the heading. */
108
- help: PropTypes.string,
109
-
110
- /** Defines the help link for the heading. */
111
- helpLink: PropTypes.string,
112
-
113
- /** Defines the a href for the back link. */
114
- backLink: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
115
-
116
- /** Adds a divider below the heading and the content. */
117
- divider: PropTypes.bool,
118
-
119
- /** Adds a separator between the title and the subheader. */
120
- separator: PropTypes.bool,
121
-
122
- /** Pills that will be added after the title. */
123
- pills: PropTypes.node,
124
-
125
- /** Aria label for rendered help component */
126
- helpAriaLabel: PropTypes.string
87
+ Heading.propTypes = {
88
+ "backLink": PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
89
+ "children": PropTypes.node,
90
+ "data-component": PropTypes.string,
91
+ "data-element": PropTypes.string,
92
+ "data-role": PropTypes.string,
93
+ "divider": PropTypes.bool,
94
+ "help": PropTypes.string,
95
+ "helpAriaLabel": PropTypes.string,
96
+ "helpLink": PropTypes.string,
97
+ "m": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
98
+ "__@toStringTag": PropTypes.string.isRequired,
99
+ "description": PropTypes.string,
100
+ "toString": PropTypes.func.isRequired,
101
+ "valueOf": PropTypes.func.isRequired
102
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
103
+ "__@toStringTag": PropTypes.string.isRequired,
104
+ "description": PropTypes.string,
105
+ "toString": PropTypes.func.isRequired,
106
+ "valueOf": PropTypes.func.isRequired
107
+ }), PropTypes.string]),
108
+ "margin": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
109
+ "__@toStringTag": PropTypes.string.isRequired,
110
+ "description": PropTypes.string,
111
+ "toString": PropTypes.func.isRequired,
112
+ "valueOf": PropTypes.func.isRequired
113
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
114
+ "__@toStringTag": PropTypes.string.isRequired,
115
+ "description": PropTypes.string,
116
+ "toString": PropTypes.func.isRequired,
117
+ "valueOf": PropTypes.func.isRequired
118
+ }), PropTypes.string]),
119
+ "marginBottom": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
120
+ "__@toStringTag": PropTypes.string.isRequired,
121
+ "description": PropTypes.string,
122
+ "toString": PropTypes.func.isRequired,
123
+ "valueOf": PropTypes.func.isRequired
124
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
125
+ "__@toStringTag": PropTypes.string.isRequired,
126
+ "description": PropTypes.string,
127
+ "toString": PropTypes.func.isRequired,
128
+ "valueOf": PropTypes.func.isRequired
129
+ }), PropTypes.string]),
130
+ "marginLeft": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
131
+ "__@toStringTag": PropTypes.string.isRequired,
132
+ "description": PropTypes.string,
133
+ "toString": PropTypes.func.isRequired,
134
+ "valueOf": PropTypes.func.isRequired
135
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
136
+ "__@toStringTag": PropTypes.string.isRequired,
137
+ "description": PropTypes.string,
138
+ "toString": PropTypes.func.isRequired,
139
+ "valueOf": PropTypes.func.isRequired
140
+ }), PropTypes.string]),
141
+ "marginRight": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
142
+ "__@toStringTag": PropTypes.string.isRequired,
143
+ "description": PropTypes.string,
144
+ "toString": PropTypes.func.isRequired,
145
+ "valueOf": PropTypes.func.isRequired
146
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
147
+ "__@toStringTag": PropTypes.string.isRequired,
148
+ "description": PropTypes.string,
149
+ "toString": PropTypes.func.isRequired,
150
+ "valueOf": PropTypes.func.isRequired
151
+ }), PropTypes.string]),
152
+ "marginTop": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
153
+ "__@toStringTag": PropTypes.string.isRequired,
154
+ "description": PropTypes.string,
155
+ "toString": PropTypes.func.isRequired,
156
+ "valueOf": PropTypes.func.isRequired
157
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
158
+ "__@toStringTag": PropTypes.string.isRequired,
159
+ "description": PropTypes.string,
160
+ "toString": PropTypes.func.isRequired,
161
+ "valueOf": PropTypes.func.isRequired
162
+ }), PropTypes.string]),
163
+ "marginX": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
164
+ "__@toStringTag": PropTypes.string.isRequired,
165
+ "description": PropTypes.string,
166
+ "toString": PropTypes.func.isRequired,
167
+ "valueOf": PropTypes.func.isRequired
168
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
169
+ "__@toStringTag": PropTypes.string.isRequired,
170
+ "description": PropTypes.string,
171
+ "toString": PropTypes.func.isRequired,
172
+ "valueOf": PropTypes.func.isRequired
173
+ }), PropTypes.string]),
174
+ "marginY": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
175
+ "__@toStringTag": PropTypes.string.isRequired,
176
+ "description": PropTypes.string,
177
+ "toString": PropTypes.func.isRequired,
178
+ "valueOf": PropTypes.func.isRequired
179
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
180
+ "__@toStringTag": PropTypes.string.isRequired,
181
+ "description": PropTypes.string,
182
+ "toString": PropTypes.func.isRequired,
183
+ "valueOf": PropTypes.func.isRequired
184
+ }), PropTypes.string]),
185
+ "mb": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
186
+ "__@toStringTag": PropTypes.string.isRequired,
187
+ "description": PropTypes.string,
188
+ "toString": PropTypes.func.isRequired,
189
+ "valueOf": PropTypes.func.isRequired
190
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
191
+ "__@toStringTag": PropTypes.string.isRequired,
192
+ "description": PropTypes.string,
193
+ "toString": PropTypes.func.isRequired,
194
+ "valueOf": PropTypes.func.isRequired
195
+ }), PropTypes.string]),
196
+ "ml": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
197
+ "__@toStringTag": PropTypes.string.isRequired,
198
+ "description": PropTypes.string,
199
+ "toString": PropTypes.func.isRequired,
200
+ "valueOf": PropTypes.func.isRequired
201
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
202
+ "__@toStringTag": PropTypes.string.isRequired,
203
+ "description": PropTypes.string,
204
+ "toString": PropTypes.func.isRequired,
205
+ "valueOf": PropTypes.func.isRequired
206
+ }), PropTypes.string]),
207
+ "mr": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
208
+ "__@toStringTag": PropTypes.string.isRequired,
209
+ "description": PropTypes.string,
210
+ "toString": PropTypes.func.isRequired,
211
+ "valueOf": PropTypes.func.isRequired
212
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
213
+ "__@toStringTag": PropTypes.string.isRequired,
214
+ "description": PropTypes.string,
215
+ "toString": PropTypes.func.isRequired,
216
+ "valueOf": PropTypes.func.isRequired
217
+ }), PropTypes.string]),
218
+ "mt": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
219
+ "__@toStringTag": PropTypes.string.isRequired,
220
+ "description": PropTypes.string,
221
+ "toString": PropTypes.func.isRequired,
222
+ "valueOf": PropTypes.func.isRequired
223
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
224
+ "__@toStringTag": PropTypes.string.isRequired,
225
+ "description": PropTypes.string,
226
+ "toString": PropTypes.func.isRequired,
227
+ "valueOf": PropTypes.func.isRequired
228
+ }), PropTypes.string]),
229
+ "mx": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
230
+ "__@toStringTag": PropTypes.string.isRequired,
231
+ "description": PropTypes.string,
232
+ "toString": PropTypes.func.isRequired,
233
+ "valueOf": PropTypes.func.isRequired
234
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
235
+ "__@toStringTag": PropTypes.string.isRequired,
236
+ "description": PropTypes.string,
237
+ "toString": PropTypes.func.isRequired,
238
+ "valueOf": PropTypes.func.isRequired
239
+ }), PropTypes.string]),
240
+ "my": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
241
+ "__@toStringTag": PropTypes.string.isRequired,
242
+ "description": PropTypes.string,
243
+ "toString": PropTypes.func.isRequired,
244
+ "valueOf": PropTypes.func.isRequired
245
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
246
+ "__@toStringTag": PropTypes.string.isRequired,
247
+ "description": PropTypes.string,
248
+ "toString": PropTypes.func.isRequired,
249
+ "valueOf": PropTypes.func.isRequired
250
+ }), PropTypes.string]),
251
+ "pills": PropTypes.node,
252
+ "separator": PropTypes.bool,
253
+ "subheader": PropTypes.node,
254
+ "subtitleId": PropTypes.string,
255
+ "title": PropTypes.node,
256
+ "titleId": PropTypes.string
127
257
  };
258
+ export { Heading };
128
259
  export default Heading;
@@ -1,15 +1,29 @@
1
- export const StyledHeadingIcon: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../icon").IconProps & import("react").RefAttributes<HTMLSpanElement>>, any, {}, never>;
2
- export const StyledHeading: import("styled-components").StyledComponent<"div", any, {}, never>;
3
- export const StyledSubHeader: import("styled-components").StyledComponent<"div", any, {}, never>;
4
- export const StyledHeader: import("styled-components").StyledComponent<"div", any, {}, never>;
5
- export const StyledSeparator: import("styled-components").StyledComponent<"hr", any, {}, never>;
6
- export const StyledHeaderHelp: import("styled-components").StyledComponent<{
1
+ /// <reference types="react" />
2
+ import Typography from "../typography";
3
+ declare const StyledHeading: import("styled-components").StyledComponent<"div", any, {}, never>;
4
+ declare const StyledHeaderContent: import("styled-components").StyledComponent<"div", any, {}, never>;
5
+ declare type StyledHeaderProps = {
6
+ divider?: boolean;
7
+ subheader?: boolean;
8
+ hasBackLink?: boolean;
9
+ };
10
+ declare const StyledHeader: import("styled-components").StyledComponent<"div", any, StyledHeaderProps, never>;
11
+ declare const StyledHeadingBackButton: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../link").LinkProps & import("react").RefAttributes<HTMLButtonElement | HTMLLinkElement>>, any, {}, never>;
12
+ declare type StyledHeadingTitleProps = {
13
+ withMargin?: boolean;
14
+ };
15
+ declare const StyledHeadingTitle: import("styled-components").StyledComponent<typeof Typography, any, StyledHeadingTitleProps, never>;
16
+ declare const StyledHeadingPills: import("styled-components").StyledComponent<"span", any, {}, never>;
17
+ declare type StyledSubHeaderProps = {
18
+ hasBackLink?: boolean;
19
+ hasSeparator?: boolean;
20
+ };
21
+ declare const StyledSubHeader: import("styled-components").StyledComponent<"div", any, StyledSubHeaderProps, never>;
22
+ declare const StyledHeadingIcon: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../icon").IconProps & import("react").RefAttributes<HTMLSpanElement>>, any, {}, never>;
23
+ declare const StyledSeparator: import("styled-components").StyledComponent<"hr", any, {}, never>;
24
+ declare const StyledDivider: import("styled-components").StyledComponent<({ adaptiveMxBreakpoint, ml, mr, ...rest }: import("../hr").HrProps) => JSX.Element, any, {}, never>;
25
+ declare const StyledHeaderHelp: import("styled-components").StyledComponent<{
7
26
  ({ as, ariaLabel, children, className, href, helpId, isFocused, tabIndex, tooltipBgColor, tooltipFontColor, tooltipFlipOverrides, tooltipId, tooltipPosition, type, ...rest }: import("../help").HelpProps): JSX.Element;
8
27
  displayName: string;
9
28
  }, any, {}, never>;
10
- export const StyledHeadingTitle: import("styled-components").StyledComponent<typeof Typography, any, {}, never>;
11
- export const StyledDivider: import("styled-components").StyledComponent<({ adaptiveMxBreakpoint, ml, mr, ...rest }: import("../hr").HrProps) => JSX.Element, any, {}, never>;
12
- export const StyledHeaderContent: import("styled-components").StyledComponent<"div", any, {}, never>;
13
- export const StyledHeadingBackButton: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../link").LinkProps & import("react").RefAttributes<HTMLButtonElement | HTMLLinkElement>>, any, {}, never>;
14
- export const StyledHeadingPills: import("styled-components").StyledComponent<"span", any, {}, never>;
15
- import Typography from "../typography";
29
+ export { StyledHeadingIcon, StyledHeading, StyledSubHeader, StyledHeader, StyledSeparator, StyledHeaderHelp, StyledHeadingTitle, StyledDivider, StyledHeaderContent, StyledHeadingBackButton, StyledHeadingPills, };
@@ -1 +1,2 @@
1
- export { default } from "./heading";
1
+ export { default } from "./heading.component";
2
+ export type { HeadingProps } from "./heading.component";
@@ -3,6 +3,7 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
3
3
  import React, { useEffect, useRef, useState } from "react";
4
4
  import PropTypes from "prop-types";
5
5
  import { Transition } from "react-transition-group";
6
+ import { flip, offset } from "@floating-ui/dom";
6
7
  import { PopoverContainerWrapperStyle, PopoverContainerHeaderStyle, PopoverContainerContentStyle, PopoverContainerCloseIcon, PopoverContainerTitleStyle, PopoverContainerOpenIcon } from "./popover-container.style";
7
8
  import Icon from "../icon";
8
9
  import Popover from "../../__internal__/popover";
@@ -67,19 +68,13 @@ renderClose.propTypes = {
67
68
  "tabIndex": PropTypes.number.isRequired
68
69
  };
69
70
  export { renderClose };
70
-
71
- const offset = ({
72
- reference
73
- }) => {
74
- return [0, -reference.height];
75
- };
76
-
77
- const popperModifiers = [{
78
- name: "offset",
79
- options: {
80
- offset
81
- }
82
- }];
71
+ const popoverMiddleware = [offset(({
72
+ rects
73
+ }) => ({
74
+ mainAxis: -rects.reference.height
75
+ })), flip({
76
+ fallbackStrategy: "initialPlacement"
77
+ })];
83
78
 
84
79
  const PopoverContainer = ({
85
80
  children,
@@ -171,7 +166,7 @@ const PopoverContainer = ({
171
166
  reference: popoverReference,
172
167
  placement: position === "right" ? "bottom-start" : "bottom-end"
173
168
  }, shouldCoverButton && {
174
- modifiers: popperModifiers
169
+ middleware: popoverMiddleware
175
170
  }), /*#__PURE__*/React.createElement(PopoverContainerContentStyle, _extends({
176
171
  "data-element": "popover-container-content",
177
172
  role: "dialog",
@@ -42,7 +42,7 @@ const FilterableSelect = /*#__PURE__*/React.forwardRef(({
42
42
  "data-element": dataElement,
43
43
  "data-role": dataRole,
44
44
  tooltipPosition,
45
- listPlacement = "bottom-start",
45
+ listPlacement = "bottom",
46
46
  flipEnabled = true,
47
47
  ...textboxProps
48
48
  }, inputRef) => {
@@ -496,7 +496,7 @@ FilterableSelect.propTypes = { ...formInputPropTypes,
496
496
  listMaxHeight: PropTypes.number,
497
497
 
498
498
  /** Placement of the select list in relation to the input element */
499
- listPlacement: PropTypes.oneOf(["auto", "auto-start", "auto-end", "top", "top-start", "top-end", "bottom", "bottom-start", "bottom-end", "right", "right-start", "right-end", "left", "left-start", "left-end"]),
499
+ listPlacement: PropTypes.oneOf(["top", "bottom", "right", "left"]),
500
500
 
501
501
  /** Use the opposite list placement if the set placement does not fit */
502
502
  flipEnabled: PropTypes.bool
@@ -1,4 +1,5 @@
1
1
  import * as React from "react";
2
+ import { Side } from "@floating-ui/dom";
2
3
  import Button from "../../button";
3
4
  import { FormInputPropTypes } from "../select-textbox/select-textbox";
4
5
 
@@ -47,22 +48,7 @@ export interface FilterableSelectProps
47
48
  /** Maximum list height - defaults to 180 */
48
49
  listMaxHeight?: number;
49
50
  /** Placement of the select list in relation to the input element */
50
- listPlacement?:
51
- | "auto"
52
- | "auto-start"
53
- | "auto-end"
54
- | "top"
55
- | "top-start"
56
- | "top-end"
57
- | "bottom"
58
- | "bottom-start"
59
- | "bottom-end"
60
- | "right"
61
- | "right-start"
62
- | "right-end"
63
- | "left"
64
- | "left-start"
65
- | "left-end";
51
+ listPlacement?: Side;
66
52
  /** Use the opposite list placement if the set placement does not fit */
67
53
  flipEnabled?: bool;
68
54
  }