carbon-react 110.4.0 → 110.4.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 (27) hide show
  1. package/esm/__internal__/i18n-context/index.d.ts +2 -1
  2. package/esm/__internal__/popover/popover.component.d.ts +2 -1
  3. package/esm/__internal__/popover/popover.component.js +15 -4
  4. package/esm/__internal__/popover/popover.style.d.ts +6 -2
  5. package/esm/__internal__/popover/popover.style.js +6 -2
  6. package/esm/components/i18n-provider/i18n-provider.component.d.ts +8 -0
  7. package/esm/components/i18n-provider/i18n-provider.component.js +100 -80
  8. package/esm/components/i18n-provider/index.d.ts +2 -1
  9. package/esm/components/select/filterable-select/filterable-select.component.js +7 -5
  10. package/esm/components/select/multi-select/multi-select.component.js +4 -3
  11. package/esm/components/select/select-list/select-list.component.js +34 -18
  12. package/esm/components/select/simple-select/simple-select.component.js +4 -3
  13. package/lib/__internal__/i18n-context/index.d.ts +2 -1
  14. package/lib/__internal__/popover/popover.component.d.ts +2 -1
  15. package/lib/__internal__/popover/popover.component.js +16 -5
  16. package/lib/__internal__/popover/popover.style.d.ts +6 -2
  17. package/lib/__internal__/popover/popover.style.js +8 -3
  18. package/lib/components/i18n-provider/i18n-provider.component.d.ts +8 -0
  19. package/lib/components/i18n-provider/i18n-provider.component.js +102 -82
  20. package/lib/components/i18n-provider/index.d.ts +2 -1
  21. package/lib/components/select/filterable-select/filterable-select.component.js +7 -5
  22. package/lib/components/select/multi-select/multi-select.component.js +4 -3
  23. package/lib/components/select/select-list/select-list.component.js +34 -18
  24. package/lib/components/select/simple-select/simple-select.component.js +4 -3
  25. package/package.json +1 -1
  26. package/esm/components/i18n-provider/i18n-provider.d.ts +0 -11
  27. package/lib/components/i18n-provider/i18n-provider.d.ts +0 -11
@@ -1,2 +1,3 @@
1
- declare var _default: import("react").Context<import("../../locales/locale").default>;
1
+ /// <reference types="react" />
2
+ declare const _default: import("react").Context<import("../../locales/locale").default>;
2
3
  export default _default;
@@ -13,6 +13,7 @@ export interface PopoverProps {
13
13
  onFirstUpdate?: (state: Partial<State>) => void;
14
14
  disablePortal?: boolean;
15
15
  reference: React.RefObject<HTMLElement>;
16
+ isOpen?: boolean;
16
17
  }
17
- declare const Popover: ({ children, placement, disablePortal, reference, onFirstUpdate, modifiers, disableBackgroundUI, }: PopoverProps) => JSX.Element;
18
+ declare const Popover: ({ children, placement, disablePortal, reference, onFirstUpdate, modifiers, disableBackgroundUI, isOpen, }: PopoverProps) => JSX.Element;
18
19
  export default Popover;
@@ -3,7 +3,7 @@ import PropTypes from "prop-types";
3
3
  import ReactDOM from "react-dom";
4
4
  import { createPopper } from "@popperjs/core";
5
5
  import useResizeObserver from "../../hooks/__internal__/useResizeObserver";
6
- import StyledBackdrop from "./popover.style";
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
9
 
@@ -14,12 +14,12 @@ const Popover = ({
14
14
  reference,
15
15
  onFirstUpdate,
16
16
  modifiers,
17
- disableBackgroundUI
17
+ disableBackgroundUI,
18
+ isOpen = true
18
19
  }) => {
19
20
  var _reference$current;
20
21
 
21
- const elementDOM = useRef(null); // TODO: Remove TempModalContext after modal has been converted to TS
22
-
22
+ const elementDOM = useRef(null);
23
23
  const {
24
24
  isInModal
25
25
  } = useContext(ModalContext);
@@ -52,6 +52,13 @@ const Popover = ({
52
52
 
53
53
  popperInstance === null || popperInstance === void 0 ? void 0 : (_popperInstance$curre = popperInstance.current) === null || _popperInstance$curre === void 0 ? void 0 : _popperInstance$curre.update();
54
54
  });
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]);
55
62
  useLayoutEffect(() => {
56
63
  if (reference.current) {
57
64
  popperInstance.current = createPopper(reference.current, popperElementRef.current, {
@@ -82,6 +89,9 @@ const Popover = ({
82
89
  }
83
90
  };
84
91
  }, [disablePortal, mountNode]);
92
+ content = /*#__PURE__*/React.createElement(StyledPopoverContent, {
93
+ isOpen: isOpen
94
+ }, content);
85
95
 
86
96
  if (disableBackgroundUI) {
87
97
  content = /*#__PURE__*/React.createElement(StyledBackdrop, null, content);
@@ -98,6 +108,7 @@ Popover.propTypes = {
98
108
  "children": PropTypes.element.isRequired,
99
109
  "disableBackgroundUI": PropTypes.bool,
100
110
  "disablePortal": PropTypes.bool,
111
+ "isOpen": PropTypes.bool,
101
112
  "modifiers": PropTypes.arrayOf(PropTypes.shape({
102
113
  "enabled": PropTypes.bool,
103
114
  "name": PropTypes.string.isRequired,
@@ -1,2 +1,6 @@
1
- declare const StyledBackdrop: import("styled-components").StyledComponent<"div", any, {}, never>;
2
- export default StyledBackdrop;
1
+ export declare const StyledBackdrop: import("styled-components").StyledComponent<"div", any, {}, never>;
2
+ declare type StyledPopoverContentProps = {
3
+ isOpen?: boolean;
4
+ };
5
+ export declare const StyledPopoverContent: import("styled-components").StyledComponent<"div", any, StyledPopoverContentProps, never>;
6
+ export {};
@@ -1,6 +1,6 @@
1
1
  import styled from "styled-components";
2
2
  import baseTheme from "../../style/themes/base";
3
- const StyledBackdrop = styled.div`
3
+ export const StyledBackdrop = styled.div`
4
4
  bottom: 0;
5
5
  left: 0;
6
6
  position: fixed;
@@ -14,4 +14,8 @@ const StyledBackdrop = styled.div`
14
14
  StyledBackdrop.defaultProps = {
15
15
  theme: baseTheme
16
16
  };
17
- export default StyledBackdrop;
17
+ export const StyledPopoverContent = styled.div`
18
+ ${({
19
+ isOpen
20
+ }) => !isOpen && "display: none;"}
21
+ `;
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ import Locale from "../../locales";
3
+ export interface I18nProviderProps {
4
+ locale?: Partial<Locale>;
5
+ children: React.ReactNode;
6
+ }
7
+ export declare const I18nProvider: ({ locale, children }: I18nProviderProps) => JSX.Element;
8
+ export default I18nProvider;
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
- import merge from "lodash/merge";
3
2
  import PropTypes from "prop-types";
3
+ import merge from "lodash/merge";
4
4
  import Context from "../../__internal__/i18n-context";
5
5
  import enGB from "../../locales/en-gb";
6
6
 
@@ -9,87 +9,107 @@ const I18nProvider = ({
9
9
  children
10
10
  }) => locale ? /*#__PURE__*/React.createElement(Context.Provider, {
11
11
  value: merge({}, enGB, locale)
12
- }, children) : children;
12
+ }, children) : /*#__PURE__*/React.createElement(React.Fragment, null, children);
13
13
 
14
- I18nProvider.defaultProps = {
15
- locale: undefined
16
- };
17
14
  I18nProvider.propTypes = {
18
- locale: PropTypes.shape({
19
- locale: PropTypes.func,
20
- actions: PropTypes.shape({
21
- edit: PropTypes.func,
22
- delete: PropTypes.func,
23
- reset: PropTypes.func
24
- }),
25
- actionPopover: PropTypes.shape({
26
- ariaLabel: PropTypes.func
27
- }),
28
- batchSelection: PropTypes.shape({
29
- selected: PropTypes.func
30
- }),
31
- confirm: PropTypes.shape({
32
- no: PropTypes.func,
33
- yes: PropTypes.func
34
- }),
35
- date: PropTypes.shape({
36
- dateFnsLocale: PropTypes.func
37
- }),
38
- errors: PropTypes.shape({
39
- messages: PropTypes.shape({
40
- formSummary: PropTypes.func
41
- })
42
- }),
43
- message: PropTypes.shape({
44
- closeButtonAriaLabel: PropTypes.func
45
- }),
46
- numeralDate: PropTypes.shape({
47
- validation: PropTypes.shape({
48
- day: PropTypes.func,
49
- month: PropTypes.func,
50
- year: PropTypes.func
51
- })
52
- }),
53
- pager: PropTypes.shape({
54
- show: PropTypes.func,
55
- records: PropTypes.func,
56
- first: PropTypes.func,
57
- last: PropTypes.func,
58
- next: PropTypes.func,
59
- previous: PropTypes.func,
60
- pageX: PropTypes.func,
61
- ofY: PropTypes.func
62
- }),
63
- select: PropTypes.shape({
64
- actionButtonText: PropTypes.func,
65
- placeholder: PropTypes.func,
66
- noResultsForTerm: PropTypes.func
67
- }),
68
- switch: PropTypes.shape({
69
- on: PropTypes.func,
70
- off: PropTypes.func
71
- }),
72
- table: PropTypes.shape({
73
- noData: PropTypes.func
74
- }),
75
- textEditor: PropTypes.shape({
76
- tooltipMessages: PropTypes.shape({
77
- bold: PropTypes.func,
78
- italic: PropTypes.func,
79
- bulletList: PropTypes.func,
80
- numberList: PropTypes.func
81
- }),
82
- ariaLabels: PropTypes.shape({
83
- bold: PropTypes.func,
84
- italic: PropTypes.func,
85
- bulletList: PropTypes.func,
86
- numberList: PropTypes.func
87
- })
88
- }),
89
- titleSelect: PropTypes.shape({
90
- deselect: PropTypes.func
15
+ "children": PropTypes.node,
16
+ "locale": PropTypes.shape({
17
+ "actionPopover": PropTypes.shape({
18
+ "ariaLabel": PropTypes.func.isRequired
19
+ }),
20
+ "actions": PropTypes.shape({
21
+ "delete": PropTypes.func.isRequired,
22
+ "edit": PropTypes.func.isRequired
23
+ }),
24
+ "batchSelection": PropTypes.shape({
25
+ "selected": PropTypes.func.isRequired
26
+ }),
27
+ "confirm": PropTypes.shape({
28
+ "no": PropTypes.func.isRequired,
29
+ "yes": PropTypes.func.isRequired
30
+ }),
31
+ "date": PropTypes.shape({
32
+ "dateFnsLocale": PropTypes.func.isRequired
33
+ }),
34
+ "dialog": PropTypes.shape({
35
+ "ariaLabels": PropTypes.shape({
36
+ "close": PropTypes.func.isRequired
37
+ }).isRequired
38
+ }),
39
+ "dialogFullScreen": PropTypes.shape({
40
+ "ariaLabels": PropTypes.shape({
41
+ "close": PropTypes.func.isRequired
42
+ }).isRequired
43
+ }),
44
+ "errors": PropTypes.shape({
45
+ "messages": PropTypes.shape({
46
+ "formSummary": PropTypes.func.isRequired
47
+ }).isRequired
48
+ }),
49
+ "heading": PropTypes.shape({
50
+ "backLinkAriaLabel": PropTypes.func.isRequired
51
+ }),
52
+ "link": PropTypes.shape({
53
+ "skipLinkLabel": PropTypes.func.isRequired
54
+ }),
55
+ "locale": PropTypes.func,
56
+ "message": PropTypes.shape({
57
+ "closeButtonAriaLabel": PropTypes.func.isRequired
58
+ }),
59
+ "numeralDate": PropTypes.shape({
60
+ "validation": PropTypes.shape({
61
+ "day": PropTypes.func.isRequired,
62
+ "month": PropTypes.func.isRequired,
63
+ "year": PropTypes.func.isRequired
64
+ }).isRequired
65
+ }),
66
+ "pager": PropTypes.shape({
67
+ "first": PropTypes.func.isRequired,
68
+ "last": PropTypes.func.isRequired,
69
+ "next": PropTypes.func.isRequired,
70
+ "ofY": PropTypes.func.isRequired,
71
+ "pageX": PropTypes.func.isRequired,
72
+ "previous": PropTypes.func.isRequired,
73
+ "records": PropTypes.func.isRequired,
74
+ "show": PropTypes.func.isRequired
75
+ }),
76
+ "select": PropTypes.shape({
77
+ "actionButtonText": PropTypes.func.isRequired,
78
+ "noResultsForTerm": PropTypes.func.isRequired,
79
+ "placeholder": PropTypes.func.isRequired
80
+ }),
81
+ "sidebar": PropTypes.shape({
82
+ "ariaLabels": PropTypes.shape({
83
+ "close": PropTypes.func.isRequired
84
+ }).isRequired
85
+ }),
86
+ "switch": PropTypes.shape({
87
+ "off": PropTypes.func.isRequired,
88
+ "on": PropTypes.func.isRequired
89
+ }),
90
+ "textEditor": PropTypes.shape({
91
+ "ariaLabels": PropTypes.shape({
92
+ "bold": PropTypes.func.isRequired,
93
+ "bulletList": PropTypes.func.isRequired,
94
+ "italic": PropTypes.func.isRequired,
95
+ "numberList": PropTypes.func.isRequired
96
+ }).isRequired,
97
+ "tooltipMessages": PropTypes.shape({
98
+ "bold": PropTypes.func.isRequired,
99
+ "bulletList": PropTypes.func.isRequired,
100
+ "italic": PropTypes.func.isRequired,
101
+ "numberList": PropTypes.func.isRequired
102
+ }).isRequired
103
+ }),
104
+ "tileSelect": PropTypes.shape({
105
+ "deselect": PropTypes.func.isRequired
106
+ }),
107
+ "toast": PropTypes.shape({
108
+ "ariaLabels": PropTypes.shape({
109
+ "close": PropTypes.func.isRequired
110
+ }).isRequired
91
111
  })
92
- }),
93
- children: PropTypes.node.isRequired
112
+ })
94
113
  };
114
+ export { I18nProvider };
95
115
  export default I18nProvider;
@@ -1 +1,2 @@
1
- export { default } from "./i18n-provider";
1
+ export { default } from "./i18n-provider.component";
2
+ export type { I18nProviderProps } from "./i18n-provider.component";
@@ -155,16 +155,17 @@ const FilterableSelect = /*#__PURE__*/React.forwardRef(({
155
155
 
156
156
  fillLastFilterCharacter(key);
157
157
  }, [fillLastFilterCharacter, onKeyDown, readOnly]);
158
+ const valueToUse = isControlled.current ? value : selectedValue;
158
159
  const handleGlobalClick = useCallback(event => {
159
160
  const notInContainer = containerRef.current && !containerRef.current.contains(event.target);
160
161
  const notInList = listboxRef.current && !listboxRef.current.contains(event.target);
161
162
  isMouseDownReported.current = false;
162
163
 
163
164
  if (notInContainer && notInList) {
164
- setMatchingText(selectedValue, true);
165
+ setMatchingText(valueToUse, true);
165
166
  setOpen(false);
166
167
  }
167
- }, [setMatchingText, selectedValue]);
168
+ }, [setMatchingText, valueToUse]);
168
169
  useEffect(() => {
169
170
  const modeSwitchedMessage = "Input elements should not switch from uncontrolled to controlled (or vice versa). " + "Decide between using a controlled or uncontrolled input element for the lifetime of the component";
170
171
  const onChangeMissingMessage = "onChange prop required when using a controlled input element";
@@ -408,7 +409,8 @@ const FilterableSelect = /*#__PURE__*/React.forwardRef(({
408
409
  multiColumn: multiColumn,
409
410
  loaderDataRole: "filterable-select-list-loader",
410
411
  listPlacement: listPlacement,
411
- flipEnabled: flipEnabled
412
+ flipEnabled: flipEnabled,
413
+ isOpen: isOpen
412
414
  }, children);
413
415
  return /*#__PURE__*/React.createElement(StyledSelect, _extends({
414
416
  ref: containerRef,
@@ -424,11 +426,11 @@ const FilterableSelect = /*#__PURE__*/React.forwardRef(({
424
426
  }, /*#__PURE__*/React.createElement(SelectTextbox, _extends({
425
427
  activeDescendantId: activeDescendantId,
426
428
  labelId: label ? labelId.current : undefined,
427
- "aria-controls": isOpen ? selectListId.current : undefined,
429
+ "aria-controls": selectListId.current,
428
430
  isOpen: isOpen,
429
431
  hasTextCursor: true,
430
432
  textboxRef: textboxRef
431
- }, getTextboxProps()))), isOpen && selectList);
433
+ }, getTextboxProps()))), selectList);
432
434
  });
433
435
  FilterableSelect.propTypes = { ...formInputPropTypes,
434
436
 
@@ -425,7 +425,8 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
425
425
  listPlacement: listPlacement,
426
426
  flipEnabled: flipEnabled,
427
427
  loaderDataRole: "multi-select-list-loader",
428
- multiselectValues: actualValue
428
+ multiselectValues: actualValue,
429
+ isOpen: isOpen
429
430
  }, children);
430
431
  return /*#__PURE__*/React.createElement(StyledSelectMultiSelect, _extends({
431
432
  disabled: disabled,
@@ -444,12 +445,12 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
444
445
  }, accessibilityLabel), /*#__PURE__*/React.createElement(SelectTextbox, _extends({
445
446
  accessibilityLabelId: accessibilityLabelId.current,
446
447
  activeDescendantId: activeDescendantId,
447
- "aria-controls": isOpen ? selectListId.current : undefined,
448
+ "aria-controls": selectListId.current,
448
449
  hasTextCursor: true,
449
450
  isOpen: isOpen,
450
451
  labelId: labelId.current,
451
452
  textboxRef: textboxRef
452
- }, getTextboxProps()))), isOpen && selectList);
453
+ }, getTextboxProps()))), selectList);
453
454
  });
454
455
  MultiSelect.propTypes = { ...formInputPropTypes,
455
456
 
@@ -46,6 +46,7 @@ const SelectList = /*#__PURE__*/React.forwardRef(({
46
46
  loaderDataRole,
47
47
  listPlacement = "bottom-start",
48
48
  flipEnabled = true,
49
+ isOpen,
49
50
  ...listProps
50
51
  }, listContainerRef) => {
51
52
  const [currentOptionsListIndex, setCurrentOptionsListIndex] = useState(-1);
@@ -61,30 +62,35 @@ const SelectList = /*#__PURE__*/React.forwardRef(({
61
62
  blockScroll,
62
63
  allowScroll
63
64
  } = useScrollBlock();
65
+ const updateListHeight = useCallback(() => {
66
+ if (isOpen) {
67
+ let newHeight = listRef.current.clientHeight;
64
68
 
65
- const updateListHeight = () => {
66
- let newHeight = listRef.current.clientHeight;
69
+ if (listActionButtonRef.current) {
70
+ newHeight += listActionButtonRef.current.parentElement.clientHeight;
71
+ }
67
72
 
68
- if (listActionButtonRef.current) {
69
- newHeight += listActionButtonRef.current.parentElement.clientHeight;
73
+ setListHeight(`${newHeight}px`);
70
74
  }
71
-
72
- setListHeight(`${newHeight}px`);
73
- };
74
-
75
+ }, [isOpen]);
75
76
  const listCallbackRef = useCallback(element => {
76
77
  listRef.current = element;
77
78
 
78
79
  if (element) {
79
80
  setTimeout(updateListHeight, 0);
80
81
  }
81
- }, []);
82
+ }, [updateListHeight]);
82
83
  useEffect(() => {
83
- blockScroll();
84
+ if (isOpen) {
85
+ blockScroll();
86
+ }
87
+
84
88
  return () => {
85
- allowScroll();
89
+ if (isOpen) {
90
+ allowScroll();
91
+ }
86
92
  };
87
- }, [allowScroll, blockScroll]);
93
+ }, [allowScroll, blockScroll, isOpen]);
88
94
  useLayoutEffect(() => {
89
95
  if (multiColumn) {
90
96
  setScrollbarWidth(tableRef.current.offsetWidth - tableRef.current.clientWidth);
@@ -108,6 +114,7 @@ const SelectList = /*#__PURE__*/React.forwardRef(({
108
114
  selectionType: "click"
109
115
  });
110
116
  }, [onSelect]);
117
+ const childIds = useMemo(() => React.Children.map(children, () => guid()), [children]);
111
118
  const childrenWithListProps = useMemo(() => React.Children.map(children, (child, index) => {
112
119
  if (!child || child.type !== Option && child.type !== OptionRow) {
113
120
  return child;
@@ -115,13 +122,13 @@ const SelectList = /*#__PURE__*/React.forwardRef(({
115
122
 
116
123
  const newProps = {
117
124
  index,
118
- id: guid(),
125
+ id: childIds[index],
119
126
  onSelect: handleSelect,
120
127
  hidden: isLoading && React.Children.count(children) === 1,
121
128
  ref: optionRefList[index]
122
129
  };
123
130
  return /*#__PURE__*/React.cloneElement(child, newProps);
124
- }), [children, handleSelect, isLoading, optionRefList]);
131
+ }), [children, handleSelect, isLoading, optionRefList, childIds]);
125
132
  const childrenList = useMemo(() => React.Children.toArray(childrenWithListProps), [childrenWithListProps]);
126
133
  const lastOptionIndex = useMemo(() => {
127
134
  let lastIndex = 0;
@@ -188,6 +195,10 @@ const SelectList = /*#__PURE__*/React.forwardRef(({
188
195
  }
189
196
  }, [anchorElement]);
190
197
  const handleGlobalKeydown = useCallback(event => {
198
+ if (!isOpen) {
199
+ return;
200
+ }
201
+
191
202
  const {
192
203
  key
193
204
  } = event;
@@ -221,7 +232,7 @@ const SelectList = /*#__PURE__*/React.forwardRef(({
221
232
  focusOnAnchor();
222
233
  highlightNextItem(key);
223
234
  }
224
- }, [childrenList, listActionButton, handleActionButtonTab, onSelectListClose, currentOptionsListIndex, onSelect, highlightNextItem, focusOnAnchor]);
235
+ }, [childrenList, listActionButton, handleActionButtonTab, onSelectListClose, currentOptionsListIndex, onSelect, highlightNextItem, focusOnAnchor, isOpen]);
225
236
  const handleListScroll = useCallback(event => {
226
237
  const element = event.target;
227
238
 
@@ -243,7 +254,7 @@ const SelectList = /*#__PURE__*/React.forwardRef(({
243
254
  window.removeEventListener("resize", assignListWidth);
244
255
  };
245
256
  }, [assignListWidth]);
246
- useLayoutEffect(updateListHeight, [children]);
257
+ useLayoutEffect(updateListHeight, [children, updateListHeight]);
247
258
  useEffect(() => {
248
259
  const keyboardEvent = "keydown";
249
260
  const listElement = listRef.current;
@@ -315,7 +326,7 @@ const SelectList = /*#__PURE__*/React.forwardRef(({
315
326
  reference: anchorRef,
316
327
  onFirstUpdate: setPlacementCallback,
317
328
  modifiers: popoverModifiers,
318
- disableBackgroundUI: true
329
+ isOpen: isOpen
319
330
  }, /*#__PURE__*/React.createElement(StyledPopoverContainer, {
320
331
  height: listHeight,
321
332
  width: listWidth,
@@ -397,6 +408,11 @@ SelectList.propTypes = {
397
408
  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"]),
398
409
 
399
410
  /** Use the opposite list placement if the set placement does not fit */
400
- flipEnabled: PropTypes.bool
411
+ flipEnabled: PropTypes.bool,
412
+
413
+ /** @private @ignore
414
+ * Hides the list (with CSS display: none) if not set
415
+ */
416
+ isOpen: PropTypes.bool
401
417
  };
402
418
  export default SelectList;
@@ -331,7 +331,8 @@ const SimpleSelect = /*#__PURE__*/React.forwardRef(({
331
331
  multiColumn: multiColumn,
332
332
  loaderDataRole: "simple-select-list-loader",
333
333
  listPlacement: listPlacement,
334
- flipEnabled: flipEnabled
334
+ flipEnabled: flipEnabled,
335
+ isOpen: isOpen
335
336
  }, children);
336
337
  return /*#__PURE__*/React.createElement(StyledSelect, _extends({
337
338
  transparent: transparent,
@@ -344,12 +345,12 @@ const SimpleSelect = /*#__PURE__*/React.forwardRef(({
344
345
  }, filterStyledSystemMarginProps(props)), /*#__PURE__*/React.createElement("div", {
345
346
  ref: containerRef
346
347
  }, /*#__PURE__*/React.createElement(SelectTextbox, _extends({
347
- "aria-controls": isOpen ? selectListId.current : undefined,
348
+ "aria-controls": selectListId.current,
348
349
  activeDescendantId: activeDescendantId,
349
350
  labelId: labelId.current,
350
351
  isOpen: isOpen,
351
352
  textboxRef: textboxRef
352
- }, getTextboxProps()))), isOpen && selectList);
353
+ }, getTextboxProps()))), selectList);
353
354
  });
354
355
  SimpleSelect.propTypes = {
355
356
  /** Styled system spacing props */
@@ -1,2 +1,3 @@
1
- declare var _default: import("react").Context<import("../../locales/locale").default>;
1
+ /// <reference types="react" />
2
+ declare const _default: import("react").Context<import("../../locales/locale").default>;
2
3
  export default _default;
@@ -13,6 +13,7 @@ export interface PopoverProps {
13
13
  onFirstUpdate?: (state: Partial<State>) => void;
14
14
  disablePortal?: boolean;
15
15
  reference: React.RefObject<HTMLElement>;
16
+ isOpen?: boolean;
16
17
  }
17
- declare const Popover: ({ children, placement, disablePortal, reference, onFirstUpdate, modifiers, disableBackgroundUI, }: PopoverProps) => JSX.Element;
18
+ declare const Popover: ({ children, placement, disablePortal, reference, onFirstUpdate, modifiers, disableBackgroundUI, isOpen, }: PopoverProps) => JSX.Element;
18
19
  export default Popover;
@@ -15,7 +15,7 @@ var _core = require("@popperjs/core");
15
15
 
16
16
  var _useResizeObserver = _interopRequireDefault(require("../../hooks/__internal__/useResizeObserver"));
17
17
 
18
- var _popover = _interopRequireDefault(require("./popover.style"));
18
+ var _popover = require("./popover.style");
19
19
 
20
20
  var _carbonScopedTokensProvider = _interopRequireDefault(require("../../style/design-tokens/carbon-scoped-tokens-provider/carbon-scoped-tokens-provider.component"));
21
21
 
@@ -34,12 +34,12 @@ const Popover = ({
34
34
  reference,
35
35
  onFirstUpdate,
36
36
  modifiers,
37
- disableBackgroundUI
37
+ disableBackgroundUI,
38
+ isOpen = true
38
39
  }) => {
39
40
  var _reference$current;
40
41
 
41
- const elementDOM = (0, _react.useRef)(null); // TODO: Remove TempModalContext after modal has been converted to TS
42
-
42
+ const elementDOM = (0, _react.useRef)(null);
43
43
  const {
44
44
  isInModal
45
45
  } = (0, _react.useContext)(_modal.ModalContext);
@@ -73,6 +73,13 @@ const Popover = ({
73
73
 
74
74
  popperInstance === null || popperInstance === void 0 ? void 0 : (_popperInstance$curre = popperInstance.current) === null || _popperInstance$curre === void 0 ? void 0 : _popperInstance$curre.update();
75
75
  });
76
+ (0, _react.useEffect)(() => {
77
+ if (isOpen) {
78
+ var _popperInstance$curre2;
79
+
80
+ popperInstance === null || popperInstance === void 0 ? void 0 : (_popperInstance$curre2 = popperInstance.current) === null || _popperInstance$curre2 === void 0 ? void 0 : _popperInstance$curre2.update();
81
+ }
82
+ }, [isOpen]);
76
83
  (0, _react.useLayoutEffect)(() => {
77
84
  if (reference.current) {
78
85
  popperInstance.current = (0, _core.createPopper)(reference.current, popperElementRef.current, {
@@ -103,9 +110,12 @@ const Popover = ({
103
110
  }
104
111
  };
105
112
  }, [disablePortal, mountNode]);
113
+ content = /*#__PURE__*/_react.default.createElement(_popover.StyledPopoverContent, {
114
+ isOpen: isOpen
115
+ }, content);
106
116
 
107
117
  if (disableBackgroundUI) {
108
- content = /*#__PURE__*/_react.default.createElement(_popover.default, null, content);
118
+ content = /*#__PURE__*/_react.default.createElement(_popover.StyledBackdrop, null, content);
109
119
  }
110
120
 
111
121
  if (disablePortal) {
@@ -119,6 +129,7 @@ Popover.propTypes = {
119
129
  "children": _propTypes.default.element.isRequired,
120
130
  "disableBackgroundUI": _propTypes.default.bool,
121
131
  "disablePortal": _propTypes.default.bool,
132
+ "isOpen": _propTypes.default.bool,
122
133
  "modifiers": _propTypes.default.arrayOf(_propTypes.default.shape({
123
134
  "enabled": _propTypes.default.bool,
124
135
  "name": _propTypes.default.string.isRequired,
@@ -1,2 +1,6 @@
1
- declare const StyledBackdrop: import("styled-components").StyledComponent<"div", any, {}, never>;
2
- export default StyledBackdrop;
1
+ export declare const StyledBackdrop: import("styled-components").StyledComponent<"div", any, {}, never>;
2
+ declare type StyledPopoverContentProps = {
3
+ isOpen?: boolean;
4
+ };
5
+ export declare const StyledPopoverContent: import("styled-components").StyledComponent<"div", any, StyledPopoverContentProps, never>;
6
+ export {};
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = void 0;
6
+ exports.StyledPopoverContent = exports.StyledBackdrop = void 0;
7
7
 
8
8
  var _styledComponents = _interopRequireDefault(require("styled-components"));
9
9
 
@@ -22,8 +22,13 @@ const StyledBackdrop = _styledComponents.default.div`
22
22
  }) => theme.zIndex.popover};
23
23
  background: transparent;
24
24
  `;
25
+ exports.StyledBackdrop = StyledBackdrop;
25
26
  StyledBackdrop.defaultProps = {
26
27
  theme: _base.default
27
28
  };
28
- var _default = StyledBackdrop;
29
- exports.default = _default;
29
+ const StyledPopoverContent = _styledComponents.default.div`
30
+ ${({
31
+ isOpen
32
+ }) => !isOpen && "display: none;"}
33
+ `;
34
+ exports.StyledPopoverContent = StyledPopoverContent;
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ import Locale from "../../locales";
3
+ export interface I18nProviderProps {
4
+ locale?: Partial<Locale>;
5
+ children: React.ReactNode;
6
+ }
7
+ export declare const I18nProvider: ({ locale, children }: I18nProviderProps) => JSX.Element;
8
+ export default I18nProvider;
@@ -3,14 +3,14 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = void 0;
6
+ exports.default = exports.I18nProvider = void 0;
7
7
 
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
 
10
- var _merge = _interopRequireDefault(require("lodash/merge"));
11
-
12
10
  var _propTypes = _interopRequireDefault(require("prop-types"));
13
11
 
12
+ var _merge = _interopRequireDefault(require("lodash/merge"));
13
+
14
14
  var _i18nContext = _interopRequireDefault(require("../../__internal__/i18n-context"));
15
15
 
16
16
  var _enGb = _interopRequireDefault(require("../../locales/en-gb"));
@@ -22,88 +22,108 @@ const I18nProvider = ({
22
22
  children
23
23
  }) => locale ? /*#__PURE__*/_react.default.createElement(_i18nContext.default.Provider, {
24
24
  value: (0, _merge.default)({}, _enGb.default, locale)
25
- }, children) : children;
25
+ }, children) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children);
26
26
 
27
- I18nProvider.defaultProps = {
28
- locale: undefined
29
- };
27
+ exports.I18nProvider = I18nProvider;
30
28
  I18nProvider.propTypes = {
31
- locale: _propTypes.default.shape({
32
- locale: _propTypes.default.func,
33
- actions: _propTypes.default.shape({
34
- edit: _propTypes.default.func,
35
- delete: _propTypes.default.func,
36
- reset: _propTypes.default.func
37
- }),
38
- actionPopover: _propTypes.default.shape({
39
- ariaLabel: _propTypes.default.func
40
- }),
41
- batchSelection: _propTypes.default.shape({
42
- selected: _propTypes.default.func
43
- }),
44
- confirm: _propTypes.default.shape({
45
- no: _propTypes.default.func,
46
- yes: _propTypes.default.func
47
- }),
48
- date: _propTypes.default.shape({
49
- dateFnsLocale: _propTypes.default.func
50
- }),
51
- errors: _propTypes.default.shape({
52
- messages: _propTypes.default.shape({
53
- formSummary: _propTypes.default.func
54
- })
55
- }),
56
- message: _propTypes.default.shape({
57
- closeButtonAriaLabel: _propTypes.default.func
58
- }),
59
- numeralDate: _propTypes.default.shape({
60
- validation: _propTypes.default.shape({
61
- day: _propTypes.default.func,
62
- month: _propTypes.default.func,
63
- year: _propTypes.default.func
64
- })
65
- }),
66
- pager: _propTypes.default.shape({
67
- show: _propTypes.default.func,
68
- records: _propTypes.default.func,
69
- first: _propTypes.default.func,
70
- last: _propTypes.default.func,
71
- next: _propTypes.default.func,
72
- previous: _propTypes.default.func,
73
- pageX: _propTypes.default.func,
74
- ofY: _propTypes.default.func
75
- }),
76
- select: _propTypes.default.shape({
77
- actionButtonText: _propTypes.default.func,
78
- placeholder: _propTypes.default.func,
79
- noResultsForTerm: _propTypes.default.func
80
- }),
81
- switch: _propTypes.default.shape({
82
- on: _propTypes.default.func,
83
- off: _propTypes.default.func
84
- }),
85
- table: _propTypes.default.shape({
86
- noData: _propTypes.default.func
87
- }),
88
- textEditor: _propTypes.default.shape({
89
- tooltipMessages: _propTypes.default.shape({
90
- bold: _propTypes.default.func,
91
- italic: _propTypes.default.func,
92
- bulletList: _propTypes.default.func,
93
- numberList: _propTypes.default.func
94
- }),
95
- ariaLabels: _propTypes.default.shape({
96
- bold: _propTypes.default.func,
97
- italic: _propTypes.default.func,
98
- bulletList: _propTypes.default.func,
99
- numberList: _propTypes.default.func
100
- })
101
- }),
102
- titleSelect: _propTypes.default.shape({
103
- deselect: _propTypes.default.func
29
+ "children": _propTypes.default.node,
30
+ "locale": _propTypes.default.shape({
31
+ "actionPopover": _propTypes.default.shape({
32
+ "ariaLabel": _propTypes.default.func.isRequired
33
+ }),
34
+ "actions": _propTypes.default.shape({
35
+ "delete": _propTypes.default.func.isRequired,
36
+ "edit": _propTypes.default.func.isRequired
37
+ }),
38
+ "batchSelection": _propTypes.default.shape({
39
+ "selected": _propTypes.default.func.isRequired
40
+ }),
41
+ "confirm": _propTypes.default.shape({
42
+ "no": _propTypes.default.func.isRequired,
43
+ "yes": _propTypes.default.func.isRequired
44
+ }),
45
+ "date": _propTypes.default.shape({
46
+ "dateFnsLocale": _propTypes.default.func.isRequired
47
+ }),
48
+ "dialog": _propTypes.default.shape({
49
+ "ariaLabels": _propTypes.default.shape({
50
+ "close": _propTypes.default.func.isRequired
51
+ }).isRequired
52
+ }),
53
+ "dialogFullScreen": _propTypes.default.shape({
54
+ "ariaLabels": _propTypes.default.shape({
55
+ "close": _propTypes.default.func.isRequired
56
+ }).isRequired
57
+ }),
58
+ "errors": _propTypes.default.shape({
59
+ "messages": _propTypes.default.shape({
60
+ "formSummary": _propTypes.default.func.isRequired
61
+ }).isRequired
62
+ }),
63
+ "heading": _propTypes.default.shape({
64
+ "backLinkAriaLabel": _propTypes.default.func.isRequired
65
+ }),
66
+ "link": _propTypes.default.shape({
67
+ "skipLinkLabel": _propTypes.default.func.isRequired
68
+ }),
69
+ "locale": _propTypes.default.func,
70
+ "message": _propTypes.default.shape({
71
+ "closeButtonAriaLabel": _propTypes.default.func.isRequired
72
+ }),
73
+ "numeralDate": _propTypes.default.shape({
74
+ "validation": _propTypes.default.shape({
75
+ "day": _propTypes.default.func.isRequired,
76
+ "month": _propTypes.default.func.isRequired,
77
+ "year": _propTypes.default.func.isRequired
78
+ }).isRequired
79
+ }),
80
+ "pager": _propTypes.default.shape({
81
+ "first": _propTypes.default.func.isRequired,
82
+ "last": _propTypes.default.func.isRequired,
83
+ "next": _propTypes.default.func.isRequired,
84
+ "ofY": _propTypes.default.func.isRequired,
85
+ "pageX": _propTypes.default.func.isRequired,
86
+ "previous": _propTypes.default.func.isRequired,
87
+ "records": _propTypes.default.func.isRequired,
88
+ "show": _propTypes.default.func.isRequired
89
+ }),
90
+ "select": _propTypes.default.shape({
91
+ "actionButtonText": _propTypes.default.func.isRequired,
92
+ "noResultsForTerm": _propTypes.default.func.isRequired,
93
+ "placeholder": _propTypes.default.func.isRequired
94
+ }),
95
+ "sidebar": _propTypes.default.shape({
96
+ "ariaLabels": _propTypes.default.shape({
97
+ "close": _propTypes.default.func.isRequired
98
+ }).isRequired
99
+ }),
100
+ "switch": _propTypes.default.shape({
101
+ "off": _propTypes.default.func.isRequired,
102
+ "on": _propTypes.default.func.isRequired
103
+ }),
104
+ "textEditor": _propTypes.default.shape({
105
+ "ariaLabels": _propTypes.default.shape({
106
+ "bold": _propTypes.default.func.isRequired,
107
+ "bulletList": _propTypes.default.func.isRequired,
108
+ "italic": _propTypes.default.func.isRequired,
109
+ "numberList": _propTypes.default.func.isRequired
110
+ }).isRequired,
111
+ "tooltipMessages": _propTypes.default.shape({
112
+ "bold": _propTypes.default.func.isRequired,
113
+ "bulletList": _propTypes.default.func.isRequired,
114
+ "italic": _propTypes.default.func.isRequired,
115
+ "numberList": _propTypes.default.func.isRequired
116
+ }).isRequired
117
+ }),
118
+ "tileSelect": _propTypes.default.shape({
119
+ "deselect": _propTypes.default.func.isRequired
120
+ }),
121
+ "toast": _propTypes.default.shape({
122
+ "ariaLabels": _propTypes.default.shape({
123
+ "close": _propTypes.default.func.isRequired
124
+ }).isRequired
104
125
  })
105
- }),
106
- children: _propTypes.default.node.isRequired
126
+ })
107
127
  };
108
128
  var _default = I18nProvider;
109
129
  exports.default = _default;
@@ -1 +1,2 @@
1
- export { default } from "./i18n-provider";
1
+ export { default } from "./i18n-provider.component";
2
+ export type { I18nProviderProps } from "./i18n-provider.component";
@@ -180,16 +180,17 @@ const FilterableSelect = /*#__PURE__*/_react.default.forwardRef(({
180
180
 
181
181
  fillLastFilterCharacter(key);
182
182
  }, [fillLastFilterCharacter, onKeyDown, readOnly]);
183
+ const valueToUse = isControlled.current ? value : selectedValue;
183
184
  const handleGlobalClick = (0, _react.useCallback)(event => {
184
185
  const notInContainer = containerRef.current && !containerRef.current.contains(event.target);
185
186
  const notInList = listboxRef.current && !listboxRef.current.contains(event.target);
186
187
  isMouseDownReported.current = false;
187
188
 
188
189
  if (notInContainer && notInList) {
189
- setMatchingText(selectedValue, true);
190
+ setMatchingText(valueToUse, true);
190
191
  setOpen(false);
191
192
  }
192
- }, [setMatchingText, selectedValue]);
193
+ }, [setMatchingText, valueToUse]);
193
194
  (0, _react.useEffect)(() => {
194
195
  const modeSwitchedMessage = "Input elements should not switch from uncontrolled to controlled (or vice versa). " + "Decide between using a controlled or uncontrolled input element for the lifetime of the component";
195
196
  const onChangeMissingMessage = "onChange prop required when using a controlled input element";
@@ -433,7 +434,8 @@ const FilterableSelect = /*#__PURE__*/_react.default.forwardRef(({
433
434
  multiColumn: multiColumn,
434
435
  loaderDataRole: "filterable-select-list-loader",
435
436
  listPlacement: listPlacement,
436
- flipEnabled: flipEnabled
437
+ flipEnabled: flipEnabled,
438
+ isOpen: isOpen
437
439
  }, children);
438
440
 
439
441
  return /*#__PURE__*/_react.default.createElement(_select.default, _extends({
@@ -450,11 +452,11 @@ const FilterableSelect = /*#__PURE__*/_react.default.forwardRef(({
450
452
  }, /*#__PURE__*/_react.default.createElement(_selectTextbox.default, _extends({
451
453
  activeDescendantId: activeDescendantId,
452
454
  labelId: label ? labelId.current : undefined,
453
- "aria-controls": isOpen ? selectListId.current : undefined,
455
+ "aria-controls": selectListId.current,
454
456
  isOpen: isOpen,
455
457
  hasTextCursor: true,
456
458
  textboxRef: textboxRef
457
- }, getTextboxProps()))), isOpen && selectList);
459
+ }, getTextboxProps()))), selectList);
458
460
  });
459
461
 
460
462
  FilterableSelect.propTypes = { ..._selectTextbox.formInputPropTypes,
@@ -453,7 +453,8 @@ const MultiSelect = /*#__PURE__*/_react.default.forwardRef(({
453
453
  listPlacement: listPlacement,
454
454
  flipEnabled: flipEnabled,
455
455
  loaderDataRole: "multi-select-list-loader",
456
- multiselectValues: actualValue
456
+ multiselectValues: actualValue,
457
+ isOpen: isOpen
457
458
  }, children);
458
459
 
459
460
  return /*#__PURE__*/_react.default.createElement(_multiSelect.StyledSelectMultiSelect, _extends({
@@ -473,12 +474,12 @@ const MultiSelect = /*#__PURE__*/_react.default.forwardRef(({
473
474
  }, accessibilityLabel), /*#__PURE__*/_react.default.createElement(_selectTextbox.default, _extends({
474
475
  accessibilityLabelId: accessibilityLabelId.current,
475
476
  activeDescendantId: activeDescendantId,
476
- "aria-controls": isOpen ? selectListId.current : undefined,
477
+ "aria-controls": selectListId.current,
477
478
  hasTextCursor: true,
478
479
  isOpen: isOpen,
479
480
  labelId: labelId.current,
480
481
  textboxRef: textboxRef
481
- }, getTextboxProps()))), isOpen && selectList);
482
+ }, getTextboxProps()))), selectList);
482
483
  });
483
484
 
484
485
  MultiSelect.propTypes = { ..._selectTextbox.formInputPropTypes,
@@ -76,6 +76,7 @@ const SelectList = /*#__PURE__*/_react.default.forwardRef(({
76
76
  loaderDataRole,
77
77
  listPlacement = "bottom-start",
78
78
  flipEnabled = true,
79
+ isOpen,
79
80
  ...listProps
80
81
  }, listContainerRef) => {
81
82
  const [currentOptionsListIndex, setCurrentOptionsListIndex] = (0, _react.useState)(-1);
@@ -91,30 +92,35 @@ const SelectList = /*#__PURE__*/_react.default.forwardRef(({
91
92
  blockScroll,
92
93
  allowScroll
93
94
  } = (0, _useScrollBlock.default)();
95
+ const updateListHeight = (0, _react.useCallback)(() => {
96
+ if (isOpen) {
97
+ let newHeight = listRef.current.clientHeight;
94
98
 
95
- const updateListHeight = () => {
96
- let newHeight = listRef.current.clientHeight;
99
+ if (listActionButtonRef.current) {
100
+ newHeight += listActionButtonRef.current.parentElement.clientHeight;
101
+ }
97
102
 
98
- if (listActionButtonRef.current) {
99
- newHeight += listActionButtonRef.current.parentElement.clientHeight;
103
+ setListHeight(`${newHeight}px`);
100
104
  }
101
-
102
- setListHeight(`${newHeight}px`);
103
- };
104
-
105
+ }, [isOpen]);
105
106
  const listCallbackRef = (0, _react.useCallback)(element => {
106
107
  listRef.current = element;
107
108
 
108
109
  if (element) {
109
110
  setTimeout(updateListHeight, 0);
110
111
  }
111
- }, []);
112
+ }, [updateListHeight]);
112
113
  (0, _react.useEffect)(() => {
113
- blockScroll();
114
+ if (isOpen) {
115
+ blockScroll();
116
+ }
117
+
114
118
  return () => {
115
- allowScroll();
119
+ if (isOpen) {
120
+ allowScroll();
121
+ }
116
122
  };
117
- }, [allowScroll, blockScroll]);
123
+ }, [allowScroll, blockScroll, isOpen]);
118
124
  (0, _react.useLayoutEffect)(() => {
119
125
  if (multiColumn) {
120
126
  setScrollbarWidth(tableRef.current.offsetWidth - tableRef.current.clientWidth);
@@ -138,6 +144,7 @@ const SelectList = /*#__PURE__*/_react.default.forwardRef(({
138
144
  selectionType: "click"
139
145
  });
140
146
  }, [onSelect]);
147
+ const childIds = (0, _react.useMemo)(() => _react.default.Children.map(children, () => (0, _guid.default)()), [children]);
141
148
  const childrenWithListProps = (0, _react.useMemo)(() => _react.default.Children.map(children, (child, index) => {
142
149
  if (!child || child.type !== _option.default && child.type !== _optionRow.default) {
143
150
  return child;
@@ -145,13 +152,13 @@ const SelectList = /*#__PURE__*/_react.default.forwardRef(({
145
152
 
146
153
  const newProps = {
147
154
  index,
148
- id: (0, _guid.default)(),
155
+ id: childIds[index],
149
156
  onSelect: handleSelect,
150
157
  hidden: isLoading && _react.default.Children.count(children) === 1,
151
158
  ref: optionRefList[index]
152
159
  };
153
160
  return /*#__PURE__*/_react.default.cloneElement(child, newProps);
154
- }), [children, handleSelect, isLoading, optionRefList]);
161
+ }), [children, handleSelect, isLoading, optionRefList, childIds]);
155
162
  const childrenList = (0, _react.useMemo)(() => _react.default.Children.toArray(childrenWithListProps), [childrenWithListProps]);
156
163
  const lastOptionIndex = (0, _react.useMemo)(() => {
157
164
  let lastIndex = 0;
@@ -218,6 +225,10 @@ const SelectList = /*#__PURE__*/_react.default.forwardRef(({
218
225
  }
219
226
  }, [anchorElement]);
220
227
  const handleGlobalKeydown = (0, _react.useCallback)(event => {
228
+ if (!isOpen) {
229
+ return;
230
+ }
231
+
221
232
  const {
222
233
  key
223
234
  } = event;
@@ -251,7 +262,7 @@ const SelectList = /*#__PURE__*/_react.default.forwardRef(({
251
262
  focusOnAnchor();
252
263
  highlightNextItem(key);
253
264
  }
254
- }, [childrenList, listActionButton, handleActionButtonTab, onSelectListClose, currentOptionsListIndex, onSelect, highlightNextItem, focusOnAnchor]);
265
+ }, [childrenList, listActionButton, handleActionButtonTab, onSelectListClose, currentOptionsListIndex, onSelect, highlightNextItem, focusOnAnchor, isOpen]);
255
266
  const handleListScroll = (0, _react.useCallback)(event => {
256
267
  const element = event.target;
257
268
 
@@ -273,7 +284,7 @@ const SelectList = /*#__PURE__*/_react.default.forwardRef(({
273
284
  window.removeEventListener("resize", assignListWidth);
274
285
  };
275
286
  }, [assignListWidth]);
276
- (0, _react.useLayoutEffect)(updateListHeight, [children]);
287
+ (0, _react.useLayoutEffect)(updateListHeight, [children, updateListHeight]);
277
288
  (0, _react.useEffect)(() => {
278
289
  const keyboardEvent = "keydown";
279
290
  const listElement = listRef.current;
@@ -345,7 +356,7 @@ const SelectList = /*#__PURE__*/_react.default.forwardRef(({
345
356
  reference: anchorRef,
346
357
  onFirstUpdate: setPlacementCallback,
347
358
  modifiers: popoverModifiers,
348
- disableBackgroundUI: true
359
+ isOpen: isOpen
349
360
  }, /*#__PURE__*/_react.default.createElement(_selectList.StyledPopoverContainer, {
350
361
  height: listHeight,
351
362
  width: listWidth,
@@ -428,7 +439,12 @@ SelectList.propTypes = {
428
439
  listPlacement: _propTypes.default.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"]),
429
440
 
430
441
  /** Use the opposite list placement if the set placement does not fit */
431
- flipEnabled: _propTypes.default.bool
442
+ flipEnabled: _propTypes.default.bool,
443
+
444
+ /** @private @ignore
445
+ * Hides the list (with CSS display: none) if not set
446
+ */
447
+ isOpen: _propTypes.default.bool
432
448
  };
433
449
  var _default = SelectList;
434
450
  exports.default = _default;
@@ -356,7 +356,8 @@ const SimpleSelect = /*#__PURE__*/_react.default.forwardRef(({
356
356
  multiColumn: multiColumn,
357
357
  loaderDataRole: "simple-select-list-loader",
358
358
  listPlacement: listPlacement,
359
- flipEnabled: flipEnabled
359
+ flipEnabled: flipEnabled,
360
+ isOpen: isOpen
360
361
  }, children);
361
362
 
362
363
  return /*#__PURE__*/_react.default.createElement(_select.default, _extends({
@@ -370,12 +371,12 @@ const SimpleSelect = /*#__PURE__*/_react.default.forwardRef(({
370
371
  }, (0, _utils.filterStyledSystemMarginProps)(props)), /*#__PURE__*/_react.default.createElement("div", {
371
372
  ref: containerRef
372
373
  }, /*#__PURE__*/_react.default.createElement(_selectTextbox.default, _extends({
373
- "aria-controls": isOpen ? selectListId.current : undefined,
374
+ "aria-controls": selectListId.current,
374
375
  activeDescendantId: activeDescendantId,
375
376
  labelId: labelId.current,
376
377
  isOpen: isOpen,
377
378
  textboxRef: textboxRef
378
- }, getTextboxProps()))), isOpen && selectList);
379
+ }, getTextboxProps()))), selectList);
379
380
  });
380
381
 
381
382
  SimpleSelect.propTypes = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-react",
3
- "version": "110.4.0",
3
+ "version": "110.4.1",
4
4
  "description": "A library of reusable React components for easily building user interfaces.",
5
5
  "engineStrict": true,
6
6
  "engines": {
@@ -1,11 +0,0 @@
1
- import * as React from "react";
2
-
3
- import Locale from "../../locales";
4
-
5
- export interface I18nProviderProps {
6
- locale: Partial<Locale>;
7
- children: React.ReactNode;
8
- }
9
-
10
- declare const I18nProvider: React.FunctionComponent<I18nProviderProps>;
11
- export default I18nProvider;
@@ -1,11 +0,0 @@
1
- import * as React from "react";
2
-
3
- import Locale from "../../locales";
4
-
5
- export interface I18nProviderProps {
6
- locale: Partial<Locale>;
7
- children: React.ReactNode;
8
- }
9
-
10
- declare const I18nProvider: React.FunctionComponent<I18nProviderProps>;
11
- export default I18nProvider;