carbon-react 127.0.3 → 127.1.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 (53) hide show
  1. package/esm/__spec_helper__/mock-dom-rect.d.ts +2 -0
  2. package/esm/__spec_helper__/mock-dom-rect.js +20 -0
  3. package/esm/__spec_helper__/select-test-utils.js +1 -1
  4. package/esm/components/action-popover/action-popover-item/action-popover-item.component.js +2 -6
  5. package/esm/components/action-popover/action-popover-menu/action-popover-menu.component.d.ts +2 -2
  6. package/esm/components/action-popover/action-popover-menu/action-popover-menu.component.js +2 -2
  7. package/esm/components/action-popover/action-popover.component.d.ts +3 -1
  8. package/esm/components/action-popover/action-popover.component.js +3 -3
  9. package/esm/components/action-popover/action-popover.style.d.ts +3 -3
  10. package/esm/components/action-popover/action-popover.style.js +4 -3
  11. package/esm/components/button/button.component.js +0 -1
  12. package/esm/components/multi-action-button/multi-action-button.component.js +1 -2
  13. package/esm/components/multi-action-button/multi-action-button.style.d.ts +1 -1
  14. package/esm/components/multi-action-button/multi-action-button.style.js +4 -1
  15. package/esm/components/select/list-action-button/list-action-button.style.js +2 -0
  16. package/esm/components/select/option-row/option-row.style.js +1 -1
  17. package/esm/components/select/select-list/select-list.component.js +13 -13
  18. package/esm/components/select/select-list/select-list.style.d.ts +7 -1
  19. package/esm/components/select/select-list/select-list.style.js +46 -1
  20. package/esm/components/split-button/split-button-children.style.d.ts +2 -2
  21. package/esm/components/split-button/split-button-children.style.js +8 -5
  22. package/esm/components/split-button/split-button.component.js +1 -2
  23. package/esm/hooks/__internal__/useChildButtons/useChildButtons.d.ts +2 -2
  24. package/esm/hooks/__internal__/useChildButtons/useChildButtons.js +1 -1
  25. package/lib/__spec_helper__/mock-dom-rect.d.ts +2 -0
  26. package/lib/__spec_helper__/mock-dom-rect.js +26 -0
  27. package/lib/__spec_helper__/select-test-utils.js +3 -4
  28. package/lib/components/action-popover/action-popover-item/action-popover-item.component.js +2 -6
  29. package/lib/components/action-popover/action-popover-menu/action-popover-menu.component.d.ts +2 -2
  30. package/lib/components/action-popover/action-popover-menu/action-popover-menu.component.js +2 -2
  31. package/lib/components/action-popover/action-popover.component.d.ts +3 -1
  32. package/lib/components/action-popover/action-popover.component.js +3 -3
  33. package/lib/components/action-popover/action-popover.style.d.ts +3 -3
  34. package/lib/components/action-popover/action-popover.style.js +4 -3
  35. package/lib/components/button/button.component.js +0 -1
  36. package/lib/components/multi-action-button/multi-action-button.component.js +1 -2
  37. package/lib/components/multi-action-button/multi-action-button.style.d.ts +1 -1
  38. package/lib/components/multi-action-button/multi-action-button.style.js +4 -1
  39. package/lib/components/select/list-action-button/list-action-button.style.js +2 -0
  40. package/lib/components/select/option-row/option-row.style.js +1 -1
  41. package/lib/components/select/select-list/select-list.component.js +13 -13
  42. package/lib/components/select/select-list/select-list.style.d.ts +7 -1
  43. package/lib/components/select/select-list/select-list.style.js +47 -2
  44. package/lib/components/split-button/split-button-children.style.d.ts +2 -2
  45. package/lib/components/split-button/split-button-children.style.js +8 -5
  46. package/lib/components/split-button/split-button.component.js +1 -2
  47. package/lib/hooks/__internal__/useChildButtons/useChildButtons.d.ts +2 -2
  48. package/lib/hooks/__internal__/useChildButtons/useChildButtons.js +1 -1
  49. package/package.json +1 -1
  50. package/esm/components/select/select-list/select-list-container.style.d.ts +0 -6
  51. package/esm/components/select/select-list/select-list-container.style.js +0 -36
  52. package/lib/components/select/select-list/select-list-container.style.d.ts +0 -6
  53. package/lib/components/select/select-list/select-list-container.style.js +0 -43
@@ -0,0 +1,2 @@
1
+ declare const mockDOMRect: (width: number, height: number, elementIdentifier: string) => void;
2
+ export default mockDOMRect;
@@ -0,0 +1,20 @@
1
+ const getDOMRect = (width, height) => ({
2
+ width,
3
+ height,
4
+ top: 0,
5
+ left: 0,
6
+ bottom: 0,
7
+ right: 0,
8
+ x: 0,
9
+ y: 0,
10
+ toJSON: () => {}
11
+ });
12
+ const mockDOMRect = (width, height, elementIdentifier) => {
13
+ Element.prototype.getBoundingClientRect = jest.fn(function () {
14
+ if (this.getAttribute("data-component") === elementIdentifier) {
15
+ return getDOMRect(width, height);
16
+ }
17
+ return getDOMRect(0, 0);
18
+ });
19
+ };
20
+ export default mockDOMRect;
@@ -1,6 +1,6 @@
1
1
  import { act } from "react-dom/test-utils";
2
2
  import { mockResizeObserver } from "jsdom-testing-mocks";
3
- import StyledSelectListContainer from "../components/select/select-list/select-list-container.style";
3
+ import { StyledSelectListContainer } from "../components/select/select-list/select-list.style";
4
4
  const resizeObserver = mockResizeObserver();
5
5
  export function simulateSelectTextboxEvent(container, eventType,
6
6
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -6,7 +6,6 @@ import { MenuItemIcon, SubMenuItemIcon, StyledMenuItem, StyledMenuItemInnerText,
6
6
  import Events from "../../../__internal__/utils/helpers/events";
7
7
  import createGuid from "../../../__internal__/utils/helpers/guid";
8
8
  import ActionPopoverContext from "../action-popover-context";
9
- import useLocale from "../../../hooks/__internal__/useLocale";
10
9
  import ActionPopoverMenu from "../action-popover-menu/action-popover-menu.component";
11
10
  const INTERVAL = 150;
12
11
  function checkRef(ref) {
@@ -49,7 +48,6 @@ export const ActionPopoverItem = ({
49
48
  isASubmenu = false,
50
49
  ...rest
51
50
  }) => {
52
- const l = useLocale();
53
51
  const context = useContext(ActionPopoverContext);
54
52
  !context ? process.env.NODE_ENV !== "production" ? invariant(false, "ActionPopoverItem must be used within an ActionPopover component") : invariant(false) : void 0;
55
53
  !( /*#__PURE__*/React.isValidElement(submenu) ? submenu.type === ActionPopoverMenu : true) ? process.env.NODE_ENV !== "production" ? invariant(false, "ActionPopoverItem only accepts submenu of type `ActionPopoverMenu`") : invariant(false) : void 0;
@@ -198,11 +196,10 @@ export const ActionPopoverItem = ({
198
196
  }
199
197
  }),
200
198
  "aria-haspopup": "true",
201
- "aria-label": l.actionPopover.ariaLabel(),
202
199
  "aria-controls": `ActionPopoverMenu_${guid}`,
203
200
  "aria-expanded": isOpen
204
201
  };
205
- const wrapperDivProps = {
202
+ const wrapperProps = {
206
203
  ...(!disabled && {
207
204
  onMouseEnter: e => {
208
205
  if (mouseEnterTimer.current) clearTimeout(mouseEnterTimer.current);
@@ -234,14 +231,13 @@ export const ActionPopoverItem = ({
234
231
  isASubmenu: isASubmenu
235
232
  });
236
233
  };
237
- return /*#__PURE__*/React.createElement(StyledMenuItemWrapper, submenu && wrapperDivProps, /*#__PURE__*/React.createElement("div", {
234
+ return /*#__PURE__*/React.createElement(StyledMenuItemWrapper, submenu && wrapperProps, /*#__PURE__*/React.createElement("div", {
238
235
  onKeyDown: onKeyDown,
239
236
  role: "presentation"
240
237
  }, /*#__PURE__*/React.createElement(StyledMenuItem, _extends({}, rest, {
241
238
  ref: ref,
242
239
  onClick: onClick,
243
240
  type: "button",
244
- role: "menuitem",
245
241
  tabIndex: 0,
246
242
  isDisabled: disabled,
247
243
  horizontalAlignment: horizontalAlignment,
@@ -33,7 +33,7 @@ export interface ActionPopoverMenuBaseProps {
33
33
  right: string | number;
34
34
  };
35
35
  }
36
- export interface ActionPopoverMenuProps extends ActionPopoverMenuBaseProps, React.RefAttributes<HTMLDivElement> {
36
+ export interface ActionPopoverMenuProps extends ActionPopoverMenuBaseProps, React.RefAttributes<HTMLUListElement> {
37
37
  }
38
- declare const ActionPopoverMenu: React.ForwardRefExoticComponent<ActionPopoverMenuBaseProps & React.RefAttributes<HTMLDivElement>>;
38
+ declare const ActionPopoverMenu: React.ForwardRefExoticComponent<ActionPopoverMenuBaseProps & React.RefAttributes<HTMLUListElement>>;
39
39
  export default ActionPopoverMenu;
@@ -163,8 +163,8 @@ const ActionPopoverMenu = /*#__PURE__*/React.forwardRef(({
163
163
  onKeyDown: onKeyDown,
164
164
  id: menuID,
165
165
  "aria-labelledby": parentID,
166
- role: "menu",
167
- ref: ref
166
+ ref: ref,
167
+ role: "list"
168
168
  }, rest), clonedChildren);
169
169
  });
170
170
  if (process.env.NODE_ENV !== "production") {
@@ -30,6 +30,8 @@ export interface ActionPopoverProps extends MarginProps {
30
30
  renderButton?: (buttonProps: RenderButtonProps) => React.ReactNode;
31
31
  /** Boolean to control whether menu should align to right */
32
32
  rightAlignMenu?: boolean;
33
+ /** Prop to specify an aria-label for the component */
34
+ "aria-label"?: string;
33
35
  }
34
- export declare const ActionPopover: ({ children, id, onOpen, onClose, rightAlignMenu, renderButton, placement, horizontalAlignment, submenuPosition, ...rest }: ActionPopoverProps) => React.JSX.Element;
36
+ export declare const ActionPopover: ({ children, id, onOpen, onClose, rightAlignMenu, renderButton, placement, horizontalAlignment, submenuPosition, "aria-label": ariaLabel, ...rest }: ActionPopoverProps) => React.JSX.Element;
35
37
  export default ActionPopover;
@@ -24,6 +24,7 @@ export const ActionPopover = ({
24
24
  placement = "bottom",
25
25
  horizontalAlignment = "left",
26
26
  submenuPosition = "left",
27
+ "aria-label": ariaLabel,
27
28
  ...rest
28
29
  }) => {
29
30
  const l = useLocale();
@@ -141,7 +142,7 @@ export const ActionPopover = ({
141
142
  "data-element": "action-popover-button",
142
143
  ariaAttributes: {
143
144
  "aria-haspopup": "true",
144
- "aria-label": l.actionPopover.ariaLabel(),
145
+ "aria-label": ariaLabel || l.actionPopover.ariaLabel(),
145
146
  "aria-controls": menuID,
146
147
  "aria-expanded": `${isOpen}`
147
148
  }
@@ -150,7 +151,7 @@ export const ActionPopover = ({
150
151
  return /*#__PURE__*/React.createElement(StyledButtonIcon, {
151
152
  role: "button",
152
153
  "aria-haspopup": "true",
153
- "aria-label": l.actionPopover.ariaLabel(),
154
+ "aria-label": ariaLabel || l.actionPopover.ariaLabel(),
154
155
  "aria-controls": menuID,
155
156
  "aria-expanded": isOpen,
156
157
  tabIndex: isOpen ? -1 : 0,
@@ -192,7 +193,6 @@ export const ActionPopover = ({
192
193
  reference: buttonRef
193
194
  }, /*#__PURE__*/React.createElement(ActionPopoverMenu, _extends({
194
195
  "data-component": "action-popover",
195
- role: "menu",
196
196
  ref: menu
197
197
  }, menuProps), children))));
198
198
  };
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- declare const Menu: import("styled-components").StyledComponent<"div", any, {
2
+ declare const Menu: import("styled-components").StyledComponent<"ul", any, {
3
3
  isOpen?: boolean | undefined;
4
4
  }, never>;
5
5
  declare type StyledMenuItemProps = {
@@ -15,8 +15,8 @@ declare type StyledMenuItemProps = {
15
15
  declare const StyledMenuItemInnerText: import("styled-components").StyledComponent<"div", any, Omit<StyledMenuItemProps, "isDisabled">, never>;
16
16
  declare const StyledMenuItemOuterContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
17
17
  declare const StyledMenuItem: import("styled-components").StyledComponent<"button", any, Omit<StyledMenuItemProps, "variant">, never>;
18
- declare const StyledMenuItemWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
19
- declare const MenuItemDivider: import("styled-components").StyledComponent<"div", any, {
18
+ declare const StyledMenuItemWrapper: import("styled-components").StyledComponent<"li", any, {}, never>;
19
+ declare const MenuItemDivider: import("styled-components").StyledComponent<"li", any, {
20
20
  "data-element": string;
21
21
  }, "data-element">;
22
22
  declare const MenuButton: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -9,11 +9,12 @@ import baseTheme from "../../style/themes/base";
9
9
  const oldFocusStyling = `
10
10
  outline: solid 3px var(--colorsSemanticFocus500);
11
11
  `;
12
- const Menu = styled.div`
12
+ const Menu = styled.ul`
13
13
  ${({
14
14
  isOpen
15
15
  }) => isOpen ? "display: block;" : "visibility: hidden;"}
16
16
  margin: 0;
17
+ list-style: none;
17
18
  padding: var(--spacing100) 0;
18
19
  box-shadow: var(--boxShadow100);
19
20
  position: absolute;
@@ -156,10 +157,10 @@ const StyledMenuItem = styled.button`
156
157
  StyledMenuItem.defaultProps = {
157
158
  theme: baseTheme
158
159
  };
159
- const StyledMenuItemWrapper = styled.div`
160
+ const StyledMenuItemWrapper = styled.li`
160
161
  position: relative;
161
162
  `;
162
- const MenuItemDivider = styled.div.attrs({
163
+ const MenuItemDivider = styled.li.attrs({
163
164
  "data-element": "action-popover-divider"
164
165
  })`
165
166
  background-color: var(--colorsUtilityMajor050);
@@ -148,7 +148,6 @@ const Button = /*#__PURE__*/React.forwardRef(({
148
148
  buttonType: buttonType,
149
149
  disabled: disabled,
150
150
  destructive: destructive,
151
- role: inSplitButton ? "menuitem" : "button",
152
151
  type: href ? undefined : "button",
153
152
  iconType: iconType,
154
153
  size: size,
@@ -59,11 +59,10 @@ export const MultiActionButton = ({
59
59
  placement: "bottom-end",
60
60
  reference: buttonNode
61
61
  }, /*#__PURE__*/React.createElement(StyledButtonChildrenContainer, _extends({}, wrapperProps, {
62
- "aria-label": text,
63
62
  align: align
64
63
  }), /*#__PURE__*/React.createElement(SplitButtonContext.Provider, {
65
64
  value: contextValue
66
- }, children)));
65
+ }, React.Children.map(children, child => /*#__PURE__*/React.createElement("li", null, child)))));
67
66
  const marginProps = filterStyledSystemMarginProps(rest);
68
67
  return /*#__PURE__*/React.createElement(StyledMultiActionButton, _extends({
69
68
  onMouseLeave: hideButtonsIfTriggerNotFocused,
@@ -6,5 +6,5 @@ declare type StyledButtonChildrenContainerProps = {
6
6
  align: "left" | "right";
7
7
  minWidth: number;
8
8
  };
9
- declare const StyledButtonChildrenContainer: import("styled-components").StyledComponent<"div", any, StyledButtonChildrenContainerProps, never>;
9
+ declare const StyledButtonChildrenContainer: import("styled-components").StyledComponent<"ul", any, StyledButtonChildrenContainerProps, never>;
10
10
  export { StyledButtonChildrenContainer, StyledMultiActionButton };
@@ -69,7 +69,7 @@ theme.focusRedesignOptOut && css`
69
69
  `}
70
70
  }
71
71
  `;
72
- const StyledButtonChildrenContainer = styled.div`
72
+ const StyledButtonChildrenContainer = styled.ul`
73
73
  ${({
74
74
  theme,
75
75
  align,
@@ -81,6 +81,9 @@ const StyledButtonChildrenContainer = styled.div`
81
81
  z-index: ${theme.zIndex.popover};
82
82
  box-shadow: var(--boxShadow100);
83
83
  border-radius: var(--borderRadius100);
84
+ list-style: none;
85
+ padding: 0;
86
+ margin: 0;
84
87
 
85
88
  ${borderRadiusStyling}
86
89
 
@@ -9,6 +9,8 @@ const StyledListActionButtonWrapper = styled.div`
9
9
  position: sticky;
10
10
  bottom: 0;
11
11
  background-color: inherit;
12
+ border-bottom-left-radius: var(--borderRadius050);
13
+ border-bottom-right-radius: var(--borderRadius050);
12
14
 
13
15
  ${StyledButton} {
14
16
  border: none;
@@ -1,10 +1,10 @@
1
1
  import styled, { css } from "styled-components";
2
2
  const StyledOptionRow = styled.tr`
3
3
  cursor: pointer;
4
+ width: 100%;
4
5
  position: absolute;
5
6
  top: 0;
6
7
  left: 0;
7
- width: 100%;
8
8
 
9
9
  ${({
10
10
  hidden
@@ -7,14 +7,13 @@ import findLastIndex from "lodash/findLastIndex";
7
7
  import usePrevious from "../../../hooks/__internal__/usePrevious";
8
8
  import useScrollBlock from "../../../hooks/__internal__/useScrollBlock";
9
9
  import useModalManager from "../../../hooks/__internal__/useModalManager";
10
- import { StyledSelectList, StyledSelectLoaderContainer, StyledSelectListTable, StyledSelectListTableHeader, StyledSelectListTableBody } from "./select-list.style";
10
+ import { StyledSelectList, StyledSelectLoaderContainer, StyledSelectListTable, StyledSelectListTableHeader, StyledSelectListTableBody, StyledSelectListContainer, StyledScrollableContainer } from "./select-list.style";
11
11
  import Popover from "../../../__internal__/popover";
12
12
  import OptionRow from "../option-row/option-row.component";
13
13
  import getNextChildByText from "../utils/get-next-child-by-text";
14
14
  import getNextIndexByKey from "../utils/get-next-index-by-key";
15
15
  import isNavigationKey from "../utils/is-navigation-key";
16
16
  import ListActionButton from "../list-action-button";
17
- import StyledSelectListContainer from "./select-list-container.style";
18
17
  import Loader from "../../loader";
19
18
  import Option from "../option";
20
19
  import SelectListContext from "../__internal__/select-list-context";
@@ -363,13 +362,11 @@ const SelectList = /*#__PURE__*/React.forwardRef(({
363
362
  }), ...(flipEnabled ? [flip({
364
363
  fallbackStrategy: "initialPlacement"
365
364
  })] : [])], [flipEnabled]);
366
- const loader = () => {
367
- return /*#__PURE__*/React.createElement(StyledSelectLoaderContainer, {
368
- key: "loader"
369
- }, /*#__PURE__*/React.createElement(Loader, {
370
- "data-role": loaderDataRole
371
- }));
372
- };
365
+ const loader = isLoading ? /*#__PURE__*/React.createElement(StyledSelectLoaderContainer, {
366
+ key: "loader"
367
+ }, /*#__PURE__*/React.createElement(Loader, {
368
+ "data-role": loaderDataRole
369
+ })) : undefined;
373
370
  let selectListContent = renderedChildren;
374
371
  const listBoxProps = {
375
372
  role: "listbox",
@@ -406,17 +403,20 @@ const SelectList = /*#__PURE__*/React.forwardRef(({
406
403
  animationFrame: true
407
404
  }, /*#__PURE__*/React.createElement(StyledSelectListContainer, _extends({
408
405
  "data-element": "select-list-wrapper",
409
- ref: listContainerRef,
410
- maxHeight: listMaxHeight + actionButtonHeight.current,
411
406
  isLoading: isLoading
412
- }, listProps), /*#__PURE__*/React.createElement(StyledSelectList, _extends({
407
+ }, listProps), /*#__PURE__*/React.createElement(StyledScrollableContainer, {
408
+ ref: listContainerRef,
409
+ maxHeight: listMaxHeight,
410
+ "data-component": "select-list-scrollable-container",
411
+ hasActionButton: !!listActionButton
412
+ }, /*#__PURE__*/React.createElement(StyledSelectList, _extends({
413
413
  as: multiColumn ? "div" : "ul",
414
414
  "data-element": "select-list"
415
415
  }, multiColumn ? {} : listBoxProps, {
416
416
  ref: listRef,
417
417
  tabIndex: -1,
418
418
  listHeight: multiColumn ? undefined : listHeight
419
- }), selectListContent), isLoading && loader(), listActionButton && /*#__PURE__*/React.createElement(ListActionButton, {
419
+ }), selectListContent), loader), listActionButton && /*#__PURE__*/React.createElement(ListActionButton, {
420
420
  ref: listActionButtonRef,
421
421
  listActionButton: listActionButton,
422
422
  onListAction: onListAction
@@ -1,3 +1,4 @@
1
+ import { SelectListProps } from ".";
1
2
  interface StyledSelectListProps {
2
3
  listHeight?: number;
3
4
  }
@@ -9,4 +10,9 @@ interface StyledSelectListTableHeaderProps {
9
10
  }
10
11
  declare const StyledSelectListTableHeader: import("styled-components").StyledComponent<"thead", any, StyledSelectListTableHeaderProps, never>;
11
12
  declare const StyledSelectListTableBody: import("styled-components").StyledComponent<"tbody", any, StyledSelectListProps, never>;
12
- export { StyledSelectList, StyledSelectLoaderContainer, StyledSelectListTable, StyledSelectListTableHeader, StyledSelectListTableBody, };
13
+ declare const StyledSelectListContainer: import("styled-components").StyledComponent<"div", any, Pick<SelectListProps, "isLoading">, never>;
14
+ declare const StyledScrollableContainer: import("styled-components").StyledComponent<"div", any, {
15
+ maxHeight: number;
16
+ hasActionButton: boolean;
17
+ }, never>;
18
+ export { StyledSelectList, StyledSelectLoaderContainer, StyledSelectListTable, StyledSelectListTableHeader, StyledSelectListTableBody, StyledSelectListContainer, StyledScrollableContainer, };
@@ -1,4 +1,5 @@
1
1
  import styled, { css } from "styled-components";
2
+ import { baseTheme } from "../../../style/themes";
2
3
  const StyledSelectList = styled.ul`
3
4
  ${({
4
5
  listHeight
@@ -91,4 +92,48 @@ const StyledSelectListTableBody = styled.tbody`
91
92
  listHeight
92
93
  }) => `${listHeight}px`};
93
94
  `;
94
- export { StyledSelectList, StyledSelectLoaderContainer, StyledSelectListTable, StyledSelectListTableHeader, StyledSelectListTableBody };
95
+ const StyledSelectListContainer = styled.div`
96
+ background-color: white;
97
+ box-shadow: var(--boxShadow100);
98
+ animation: fadeIn 250ms ease-out;
99
+ position: absolute;
100
+ z-index: ${({
101
+ theme
102
+ }) => theme.zIndex.popover};
103
+ display: flex;
104
+ flex-wrap: wrap;
105
+ align-items: flex-start;
106
+ border-radius: var(--borderRadius050);
107
+ ${({
108
+ isLoading
109
+ }) => isLoading && "min-height: 150px"};
110
+
111
+ @keyframes fadeIn {
112
+ 0% {
113
+ opacity: 0;
114
+ }
115
+ 100% {
116
+ opacity: 1;
117
+ }
118
+ }
119
+ `;
120
+ const StyledScrollableContainer = styled.div`
121
+ max-height: ${({
122
+ maxHeight
123
+ }) => `${maxHeight}px`};
124
+ width: 100%;
125
+ border-top-left-radius: var(--borderRadius050);
126
+ border-top-right-radius: var(--borderRadius050);
127
+ overflow-y: auto;
128
+
129
+ ${({
130
+ hasActionButton
131
+ }) => !hasActionButton && css`
132
+ border-bottom-left-radius: var(--borderRadius050);
133
+ border-bottom-right-radius: var(--borderRadius050);
134
+ `}
135
+ `;
136
+ StyledSelectListContainer.defaultProps = {
137
+ theme: baseTheme
138
+ };
139
+ export { StyledSelectList, StyledSelectLoaderContainer, StyledSelectListTable, StyledSelectListTableHeader, StyledSelectListTableBody, StyledSelectListContainer, StyledScrollableContainer };
@@ -1,9 +1,9 @@
1
1
  import { ThemeObject } from "../../style/themes/base";
2
- export declare const borderRadiusStyling = "\n > {\n &:first-child:last-child {\n border-radius: var(--borderRadius100);\n }\n\n &:first-child:not(:last-child) {\n border-top-left-radius: var(--borderRadius100);\n border-top-right-radius: var(--borderRadius100);\n border-bottom-right-radius: var(--borderRadius000);\n border-bottom-left-radius: var(--borderRadius000);\n }\n\n &:not(:first-child):not(:last-child) {\n border-radius: var(--borderRadius000);\n }\n\n &:last-child:not(:first-child) {\n border-top-right-radius: var(--borderRadius000);\n border-top-left-radius: var(--borderRadius000);\n border-bottom-left-radius: var(--borderRadius100);\n border-bottom-right-radius: var(--borderRadius100);\n }\n }\n";
2
+ export declare const borderRadiusStyling = "\n > {\n &:first-child:last-child > * {\n border-radius: var(--borderRadius100);\n }\n\n &:first-child:not(:last-child) > * {\n border-top-left-radius: var(--borderRadius100);\n border-top-right-radius: var(--borderRadius100);\n border-bottom-right-radius: var(--borderRadius000);\n border-bottom-left-radius: var(--borderRadius000);\n }\n\n &:not(:first-child):not(:last-child) > * {\n border-radius: var(--borderRadius000);\n }\n\n &:last-child:not(:first-child) > * {\n border-top-right-radius: var(--borderRadius000);\n border-top-left-radius: var(--borderRadius000);\n border-bottom-left-radius: var(--borderRadius100);\n border-bottom-right-radius: var(--borderRadius100);\n }\n }\n";
3
3
  declare type StyledSplitButtonChildrenContainerProps = {
4
4
  theme: ThemeObject;
5
5
  align: "left" | "right";
6
6
  minWidth: number;
7
7
  };
8
- declare const StyledSplitButtonChildrenContainer: import("styled-components").StyledComponent<"div", any, StyledSplitButtonChildrenContainerProps, never>;
8
+ declare const StyledSplitButtonChildrenContainer: import("styled-components").StyledComponent<"ul", any, StyledSplitButtonChildrenContainerProps, never>;
9
9
  export default StyledSplitButtonChildrenContainer;
@@ -3,22 +3,22 @@ import BaseTheme from "../../style/themes/base";
3
3
  import StyledButton from "../button/button.style";
4
4
  export const borderRadiusStyling = `
5
5
  > {
6
- &:first-child:last-child {
6
+ &:first-child:last-child > * {
7
7
  border-radius: var(--borderRadius100);
8
8
  }
9
9
 
10
- &:first-child:not(:last-child) {
10
+ &:first-child:not(:last-child) > * {
11
11
  border-top-left-radius: var(--borderRadius100);
12
12
  border-top-right-radius: var(--borderRadius100);
13
13
  border-bottom-right-radius: var(--borderRadius000);
14
14
  border-bottom-left-radius: var(--borderRadius000);
15
15
  }
16
16
 
17
- &:not(:first-child):not(:last-child) {
17
+ &:not(:first-child):not(:last-child) > * {
18
18
  border-radius: var(--borderRadius000);
19
19
  }
20
20
 
21
- &:last-child:not(:first-child) {
21
+ &:last-child:not(:first-child) > * {
22
22
  border-top-right-radius: var(--borderRadius000);
23
23
  border-top-left-radius: var(--borderRadius000);
24
24
  border-bottom-left-radius: var(--borderRadius100);
@@ -26,7 +26,7 @@ export const borderRadiusStyling = `
26
26
  }
27
27
  }
28
28
  `;
29
- const StyledSplitButtonChildrenContainer = styled.div`
29
+ const StyledSplitButtonChildrenContainer = styled.ul`
30
30
  border-radius: var(--borderRadius100);
31
31
  ${({
32
32
  theme,
@@ -38,6 +38,9 @@ const StyledSplitButtonChildrenContainer = styled.div`
38
38
  white-space: nowrap;
39
39
  z-index: ${theme.zIndex.popover};
40
40
  box-shadow: var(--boxShadow100);
41
+ list-style: none;
42
+ padding: 0;
43
+ margin: 0;
41
44
 
42
45
  ${borderRadiusStyling}
43
46
 
@@ -111,11 +111,10 @@ export const SplitButton = ({
111
111
  placement: "bottom-end",
112
112
  reference: buttonNode
113
113
  }, /*#__PURE__*/React.createElement(StyledSplitButtonChildrenContainer, _extends({}, wrapperProps, {
114
- "aria-label": text,
115
114
  align: align
116
115
  }), /*#__PURE__*/React.createElement(SplitButtonContext.Provider, {
117
116
  value: contextValue
118
- }, children)));
117
+ }, React.Children.map(children, child => /*#__PURE__*/React.createElement("li", null, child)))));
119
118
  }
120
119
  const handleClick = useClickAwayListener(hideButtons);
121
120
  const marginProps = filterStyledSystemMarginProps(rest);
@@ -7,11 +7,11 @@ declare const useChildButtons: (toggleButtonRef: React.RefObject<HTMLButtonEleme
7
7
  hideButtonsIfTriggerNotFocused: () => void;
8
8
  handleToggleButtonKeyDown: (ev: React.KeyboardEvent<HTMLButtonElement>) => void;
9
9
  wrapperProps: {
10
- role: string;
11
10
  "data-element": string;
11
+ role: string;
12
12
  onKeyDown: (ev: any) => void;
13
13
  minWidth: number;
14
- ref: import("react").RefObject<HTMLDivElement>;
14
+ ref: import("react").RefObject<HTMLUListElement>;
15
15
  };
16
16
  contextValue: {
17
17
  inSplitButton: boolean;
@@ -46,8 +46,8 @@ const useChildButtons = (toggleButtonRef, widthRatio = 1) => {
46
46
  setShowAdditionalButtons(false);
47
47
  }, [toggleButtonRef]);
48
48
  const wrapperProps = {
49
- role: "menu",
50
49
  "data-element": "additional-buttons",
50
+ role: "list",
51
51
  onKeyDown: handleKeyDown,
52
52
  minWidth,
53
53
  ref: childrenContainer
@@ -0,0 +1,2 @@
1
+ declare const mockDOMRect: (width: number, height: number, elementIdentifier: string) => void;
2
+ export default mockDOMRect;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ const getDOMRect = (width, height) => ({
8
+ width,
9
+ height,
10
+ top: 0,
11
+ left: 0,
12
+ bottom: 0,
13
+ right: 0,
14
+ x: 0,
15
+ y: 0,
16
+ toJSON: () => {}
17
+ });
18
+ const mockDOMRect = (width, height, elementIdentifier) => {
19
+ Element.prototype.getBoundingClientRect = jest.fn(function () {
20
+ if (this.getAttribute("data-component") === elementIdentifier) {
21
+ return getDOMRect(width, height);
22
+ }
23
+ return getDOMRect(0, 0);
24
+ });
25
+ };
26
+ var _default = exports.default = mockDOMRect;
@@ -7,15 +7,14 @@ exports.simulateDropdownEvent = simulateDropdownEvent;
7
7
  exports.simulateSelectTextboxEvent = simulateSelectTextboxEvent;
8
8
  var _testUtils = require("react-dom/test-utils");
9
9
  var _jsdomTestingMocks = require("jsdom-testing-mocks");
10
- var _selectListContainer = _interopRequireDefault(require("../components/select/select-list/select-list-container.style"));
11
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
+ var _selectList = require("../components/select/select-list/select-list.style");
12
11
  const resizeObserver = (0, _jsdomTestingMocks.mockResizeObserver)();
13
12
  function simulateSelectTextboxEvent(container, eventType,
14
13
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
14
  ...eventArgs) {
16
15
  const selectText = container.find('input[type="text"]').first();
17
16
  selectText.simulate(eventType, ...eventArgs);
18
- const selectList = container.find(_selectListContainer.default).getDOMNode();
17
+ const selectList = container.find(_selectList.StyledSelectListContainer).getDOMNode();
19
18
  // need to manually trigger a resize to make react-virtual realise that child options should be rendered
20
19
  (0, _testUtils.act)(() => {
21
20
  resizeObserver.mockElementSize(selectList, {
@@ -32,7 +31,7 @@ function simulateSelectTextboxEvent(container, eventType,
32
31
  function simulateDropdownEvent(container, eventType) {
33
32
  const dropdown = container.find('[type="dropdown"]').first();
34
33
  dropdown.simulate(eventType);
35
- const selectList = container.find(_selectListContainer.default).getDOMNode();
34
+ const selectList = container.find(_selectList.StyledSelectListContainer).getDOMNode();
36
35
  // need to manually trigger a resize to make react-virtual realise that child options should be rendered
37
36
  (0, _testUtils.act)(() => {
38
37
  resizeObserver.mockElementSize(selectList, {
@@ -11,7 +11,6 @@ var _actionPopover = require("../action-popover.style");
11
11
  var _events = _interopRequireDefault(require("../../../__internal__/utils/helpers/events"));
12
12
  var _guid = _interopRequireDefault(require("../../../__internal__/utils/helpers/guid"));
13
13
  var _actionPopoverContext = _interopRequireDefault(require("../action-popover-context"));
14
- var _useLocale = _interopRequireDefault(require("../../../hooks/__internal__/useLocale"));
15
14
  var _actionPopoverMenu = _interopRequireDefault(require("../action-popover-menu/action-popover-menu.component"));
16
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
16
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
@@ -58,7 +57,6 @@ const ActionPopoverItem = ({
58
57
  isASubmenu = false,
59
58
  ...rest
60
59
  }) => {
61
- const l = (0, _useLocale.default)();
62
60
  const context = (0, _react.useContext)(_actionPopoverContext.default);
63
61
  !context ? process.env.NODE_ENV !== "production" ? (0, _invariant.default)(false, "ActionPopoverItem must be used within an ActionPopover component") : (0, _invariant.default)(false) : void 0;
64
62
  !( /*#__PURE__*/_react.default.isValidElement(submenu) ? submenu.type === _actionPopoverMenu.default : true) ? process.env.NODE_ENV !== "production" ? (0, _invariant.default)(false, "ActionPopoverItem only accepts submenu of type `ActionPopoverMenu`") : (0, _invariant.default)(false) : void 0;
@@ -207,11 +205,10 @@ const ActionPopoverItem = ({
207
205
  }
208
206
  }),
209
207
  "aria-haspopup": "true",
210
- "aria-label": l.actionPopover.ariaLabel(),
211
208
  "aria-controls": `ActionPopoverMenu_${guid}`,
212
209
  "aria-expanded": isOpen
213
210
  };
214
- const wrapperDivProps = {
211
+ const wrapperProps = {
215
212
  ...(!disabled && {
216
213
  onMouseEnter: e => {
217
214
  if (mouseEnterTimer.current) clearTimeout(mouseEnterTimer.current);
@@ -243,14 +240,13 @@ const ActionPopoverItem = ({
243
240
  isASubmenu: isASubmenu
244
241
  });
245
242
  };
246
- return /*#__PURE__*/_react.default.createElement(_actionPopover.StyledMenuItemWrapper, submenu && wrapperDivProps, /*#__PURE__*/_react.default.createElement("div", {
243
+ return /*#__PURE__*/_react.default.createElement(_actionPopover.StyledMenuItemWrapper, submenu && wrapperProps, /*#__PURE__*/_react.default.createElement("div", {
247
244
  onKeyDown: onKeyDown,
248
245
  role: "presentation"
249
246
  }, /*#__PURE__*/_react.default.createElement(_actionPopover.StyledMenuItem, _extends({}, rest, {
250
247
  ref: ref,
251
248
  onClick: onClick,
252
249
  type: "button",
253
- role: "menuitem",
254
250
  tabIndex: 0,
255
251
  isDisabled: disabled,
256
252
  horizontalAlignment: horizontalAlignment,
@@ -33,7 +33,7 @@ export interface ActionPopoverMenuBaseProps {
33
33
  right: string | number;
34
34
  };
35
35
  }
36
- export interface ActionPopoverMenuProps extends ActionPopoverMenuBaseProps, React.RefAttributes<HTMLDivElement> {
36
+ export interface ActionPopoverMenuProps extends ActionPopoverMenuBaseProps, React.RefAttributes<HTMLUListElement> {
37
37
  }
38
- declare const ActionPopoverMenu: React.ForwardRefExoticComponent<ActionPopoverMenuBaseProps & React.RefAttributes<HTMLDivElement>>;
38
+ declare const ActionPopoverMenu: React.ForwardRefExoticComponent<ActionPopoverMenuBaseProps & React.RefAttributes<HTMLUListElement>>;
39
39
  export default ActionPopoverMenu;
@@ -172,8 +172,8 @@ const ActionPopoverMenu = /*#__PURE__*/_react.default.forwardRef(({
172
172
  onKeyDown: onKeyDown,
173
173
  id: menuID,
174
174
  "aria-labelledby": parentID,
175
- role: "menu",
176
- ref: ref
175
+ ref: ref,
176
+ role: "list"
177
177
  }, rest), clonedChildren);
178
178
  });
179
179
  if (process.env.NODE_ENV !== "production") {
@@ -30,6 +30,8 @@ export interface ActionPopoverProps extends MarginProps {
30
30
  renderButton?: (buttonProps: RenderButtonProps) => React.ReactNode;
31
31
  /** Boolean to control whether menu should align to right */
32
32
  rightAlignMenu?: boolean;
33
+ /** Prop to specify an aria-label for the component */
34
+ "aria-label"?: string;
33
35
  }
34
- export declare const ActionPopover: ({ children, id, onOpen, onClose, rightAlignMenu, renderButton, placement, horizontalAlignment, submenuPosition, ...rest }: ActionPopoverProps) => React.JSX.Element;
36
+ export declare const ActionPopover: ({ children, id, onOpen, onClose, rightAlignMenu, renderButton, placement, horizontalAlignment, submenuPosition, "aria-label": ariaLabel, ...rest }: ActionPopoverProps) => React.JSX.Element;
35
37
  export default ActionPopover;
@@ -33,6 +33,7 @@ const ActionPopover = ({
33
33
  placement = "bottom",
34
34
  horizontalAlignment = "left",
35
35
  submenuPosition = "left",
36
+ "aria-label": ariaLabel,
36
37
  ...rest
37
38
  }) => {
38
39
  const l = (0, _useLocale.default)();
@@ -150,7 +151,7 @@ const ActionPopover = ({
150
151
  "data-element": "action-popover-button",
151
152
  ariaAttributes: {
152
153
  "aria-haspopup": "true",
153
- "aria-label": l.actionPopover.ariaLabel(),
154
+ "aria-label": ariaLabel || l.actionPopover.ariaLabel(),
154
155
  "aria-controls": menuID,
155
156
  "aria-expanded": `${isOpen}`
156
157
  }
@@ -159,7 +160,7 @@ const ActionPopover = ({
159
160
  return /*#__PURE__*/_react.default.createElement(_actionPopover.StyledButtonIcon, {
160
161
  role: "button",
161
162
  "aria-haspopup": "true",
162
- "aria-label": l.actionPopover.ariaLabel(),
163
+ "aria-label": ariaLabel || l.actionPopover.ariaLabel(),
163
164
  "aria-controls": menuID,
164
165
  "aria-expanded": isOpen,
165
166
  tabIndex: isOpen ? -1 : 0,
@@ -201,7 +202,6 @@ const ActionPopover = ({
201
202
  reference: buttonRef
202
203
  }, /*#__PURE__*/_react.default.createElement(_actionPopoverMenu.default, _extends({
203
204
  "data-component": "action-popover",
204
- role: "menu",
205
205
  ref: menu
206
206
  }, menuProps), children))));
207
207
  };
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- declare const Menu: import("styled-components").StyledComponent<"div", any, {
2
+ declare const Menu: import("styled-components").StyledComponent<"ul", any, {
3
3
  isOpen?: boolean | undefined;
4
4
  }, never>;
5
5
  declare type StyledMenuItemProps = {
@@ -15,8 +15,8 @@ declare type StyledMenuItemProps = {
15
15
  declare const StyledMenuItemInnerText: import("styled-components").StyledComponent<"div", any, Omit<StyledMenuItemProps, "isDisabled">, never>;
16
16
  declare const StyledMenuItemOuterContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
17
17
  declare const StyledMenuItem: import("styled-components").StyledComponent<"button", any, Omit<StyledMenuItemProps, "variant">, never>;
18
- declare const StyledMenuItemWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
19
- declare const MenuItemDivider: import("styled-components").StyledComponent<"div", any, {
18
+ declare const StyledMenuItemWrapper: import("styled-components").StyledComponent<"li", any, {}, never>;
19
+ declare const MenuItemDivider: import("styled-components").StyledComponent<"li", any, {
20
20
  "data-element": string;
21
21
  }, "data-element">;
22
22
  declare const MenuButton: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -18,11 +18,12 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
18
18
  const oldFocusStyling = `
19
19
  outline: solid 3px var(--colorsSemanticFocus500);
20
20
  `;
21
- const Menu = exports.Menu = _styledComponents.default.div`
21
+ const Menu = exports.Menu = _styledComponents.default.ul`
22
22
  ${({
23
23
  isOpen
24
24
  }) => isOpen ? "display: block;" : "visibility: hidden;"}
25
25
  margin: 0;
26
+ list-style: none;
26
27
  padding: var(--spacing100) 0;
27
28
  box-shadow: var(--boxShadow100);
28
29
  position: absolute;
@@ -165,10 +166,10 @@ const StyledMenuItem = exports.StyledMenuItem = _styledComponents.default.button
165
166
  StyledMenuItem.defaultProps = {
166
167
  theme: _base.default
167
168
  };
168
- const StyledMenuItemWrapper = exports.StyledMenuItemWrapper = _styledComponents.default.div`
169
+ const StyledMenuItemWrapper = exports.StyledMenuItemWrapper = _styledComponents.default.li`
169
170
  position: relative;
170
171
  `;
171
- const MenuItemDivider = exports.MenuItemDivider = _styledComponents.default.div.attrs({
172
+ const MenuItemDivider = exports.MenuItemDivider = _styledComponents.default.li.attrs({
172
173
  "data-element": "action-popover-divider"
173
174
  })`
174
175
  background-color: var(--colorsUtilityMajor050);
@@ -157,7 +157,6 @@ const Button = /*#__PURE__*/_react.default.forwardRef(({
157
157
  buttonType: buttonType,
158
158
  disabled: disabled,
159
159
  destructive: destructive,
160
- role: inSplitButton ? "menuitem" : "button",
161
160
  type: href ? undefined : "button",
162
161
  iconType: iconType,
163
162
  size: size,
@@ -68,11 +68,10 @@ const MultiActionButton = ({
68
68
  placement: "bottom-end",
69
69
  reference: buttonNode
70
70
  }, /*#__PURE__*/_react.default.createElement(_multiActionButton.StyledButtonChildrenContainer, _extends({}, wrapperProps, {
71
- "aria-label": text,
72
71
  align: align
73
72
  }), /*#__PURE__*/_react.default.createElement(_splitButton.default.Provider, {
74
73
  value: contextValue
75
- }, children)));
74
+ }, _react.default.Children.map(children, child => /*#__PURE__*/_react.default.createElement("li", null, child)))));
76
75
  const marginProps = (0, _utils.filterStyledSystemMarginProps)(rest);
77
76
  return /*#__PURE__*/_react.default.createElement(_multiActionButton.StyledMultiActionButton, _extends({
78
77
  onMouseLeave: hideButtonsIfTriggerNotFocused,
@@ -6,5 +6,5 @@ declare type StyledButtonChildrenContainerProps = {
6
6
  align: "left" | "right";
7
7
  minWidth: number;
8
8
  };
9
- declare const StyledButtonChildrenContainer: import("styled-components").StyledComponent<"div", any, StyledButtonChildrenContainerProps, never>;
9
+ declare const StyledButtonChildrenContainer: import("styled-components").StyledComponent<"ul", any, StyledButtonChildrenContainerProps, never>;
10
10
  export { StyledButtonChildrenContainer, StyledMultiActionButton };
@@ -78,7 +78,7 @@ theme.focusRedesignOptOut && (0, _styledComponents.css)`
78
78
  `}
79
79
  }
80
80
  `;
81
- const StyledButtonChildrenContainer = exports.StyledButtonChildrenContainer = _styledComponents.default.div`
81
+ const StyledButtonChildrenContainer = exports.StyledButtonChildrenContainer = _styledComponents.default.ul`
82
82
  ${({
83
83
  theme,
84
84
  align,
@@ -90,6 +90,9 @@ const StyledButtonChildrenContainer = exports.StyledButtonChildrenContainer = _s
90
90
  z-index: ${theme.zIndex.popover};
91
91
  box-shadow: var(--boxShadow100);
92
92
  border-radius: var(--borderRadius100);
93
+ list-style: none;
94
+ padding: 0;
95
+ margin: 0;
93
96
 
94
97
  ${_splitButtonChildren.borderRadiusStyling}
95
98
 
@@ -16,6 +16,8 @@ const StyledListActionButtonWrapper = _styledComponents.default.div`
16
16
  position: sticky;
17
17
  bottom: 0;
18
18
  background-color: inherit;
19
+ border-bottom-left-radius: var(--borderRadius050);
20
+ border-bottom-right-radius: var(--borderRadius050);
19
21
 
20
22
  ${_button.default} {
21
23
  border: none;
@@ -9,10 +9,10 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
9
9
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
10
10
  const StyledOptionRow = _styledComponents.default.tr`
11
11
  cursor: pointer;
12
+ width: 100%;
12
13
  position: absolute;
13
14
  top: 0;
14
15
  left: 0;
15
- width: 100%;
16
16
 
17
17
  ${({
18
18
  hidden
@@ -19,7 +19,6 @@ var _getNextChildByText = _interopRequireDefault(require("../utils/get-next-chil
19
19
  var _getNextIndexByKey = _interopRequireDefault(require("../utils/get-next-index-by-key"));
20
20
  var _isNavigationKey = _interopRequireDefault(require("../utils/is-navigation-key"));
21
21
  var _listActionButton = _interopRequireDefault(require("../list-action-button"));
22
- var _selectListContainer = _interopRequireDefault(require("./select-list-container.style"));
23
22
  var _loader = _interopRequireDefault(require("../../loader"));
24
23
  var _option = _interopRequireDefault(require("../option"));
25
24
  var _selectListContext = _interopRequireDefault(require("../__internal__/select-list-context"));
@@ -372,13 +371,11 @@ const SelectList = /*#__PURE__*/_react.default.forwardRef(({
372
371
  }), ...(flipEnabled ? [(0, _dom.flip)({
373
372
  fallbackStrategy: "initialPlacement"
374
373
  })] : [])], [flipEnabled]);
375
- const loader = () => {
376
- return /*#__PURE__*/_react.default.createElement(_selectList.StyledSelectLoaderContainer, {
377
- key: "loader"
378
- }, /*#__PURE__*/_react.default.createElement(_loader.default, {
379
- "data-role": loaderDataRole
380
- }));
381
- };
374
+ const loader = isLoading ? /*#__PURE__*/_react.default.createElement(_selectList.StyledSelectLoaderContainer, {
375
+ key: "loader"
376
+ }, /*#__PURE__*/_react.default.createElement(_loader.default, {
377
+ "data-role": loaderDataRole
378
+ })) : undefined;
382
379
  let selectListContent = renderedChildren;
383
380
  const listBoxProps = {
384
381
  role: "listbox",
@@ -413,19 +410,22 @@ const SelectList = /*#__PURE__*/_react.default.forwardRef(({
413
410
  isOpen: isOpen,
414
411
  disableBackgroundUI: true,
415
412
  animationFrame: true
416
- }, /*#__PURE__*/_react.default.createElement(_selectListContainer.default, _extends({
413
+ }, /*#__PURE__*/_react.default.createElement(_selectList.StyledSelectListContainer, _extends({
417
414
  "data-element": "select-list-wrapper",
418
- ref: listContainerRef,
419
- maxHeight: listMaxHeight + actionButtonHeight.current,
420
415
  isLoading: isLoading
421
- }, listProps), /*#__PURE__*/_react.default.createElement(_selectList.StyledSelectList, _extends({
416
+ }, listProps), /*#__PURE__*/_react.default.createElement(_selectList.StyledScrollableContainer, {
417
+ ref: listContainerRef,
418
+ maxHeight: listMaxHeight,
419
+ "data-component": "select-list-scrollable-container",
420
+ hasActionButton: !!listActionButton
421
+ }, /*#__PURE__*/_react.default.createElement(_selectList.StyledSelectList, _extends({
422
422
  as: multiColumn ? "div" : "ul",
423
423
  "data-element": "select-list"
424
424
  }, multiColumn ? {} : listBoxProps, {
425
425
  ref: listRef,
426
426
  tabIndex: -1,
427
427
  listHeight: multiColumn ? undefined : listHeight
428
- }), selectListContent), isLoading && loader(), listActionButton && /*#__PURE__*/_react.default.createElement(_listActionButton.default, {
428
+ }), selectListContent), loader), listActionButton && /*#__PURE__*/_react.default.createElement(_listActionButton.default, {
429
429
  ref: listActionButtonRef,
430
430
  listActionButton: listActionButton,
431
431
  onListAction: onListAction
@@ -1,3 +1,4 @@
1
+ import { SelectListProps } from ".";
1
2
  interface StyledSelectListProps {
2
3
  listHeight?: number;
3
4
  }
@@ -9,4 +10,9 @@ interface StyledSelectListTableHeaderProps {
9
10
  }
10
11
  declare const StyledSelectListTableHeader: import("styled-components").StyledComponent<"thead", any, StyledSelectListTableHeaderProps, never>;
11
12
  declare const StyledSelectListTableBody: import("styled-components").StyledComponent<"tbody", any, StyledSelectListProps, never>;
12
- export { StyledSelectList, StyledSelectLoaderContainer, StyledSelectListTable, StyledSelectListTableHeader, StyledSelectListTableBody, };
13
+ declare const StyledSelectListContainer: import("styled-components").StyledComponent<"div", any, Pick<SelectListProps, "isLoading">, never>;
14
+ declare const StyledScrollableContainer: import("styled-components").StyledComponent<"div", any, {
15
+ maxHeight: number;
16
+ hasActionButton: boolean;
17
+ }, never>;
18
+ export { StyledSelectList, StyledSelectLoaderContainer, StyledSelectListTable, StyledSelectListTableHeader, StyledSelectListTableBody, StyledSelectListContainer, StyledScrollableContainer, };
@@ -3,8 +3,9 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.StyledSelectLoaderContainer = exports.StyledSelectListTableHeader = exports.StyledSelectListTableBody = exports.StyledSelectListTable = exports.StyledSelectList = void 0;
6
+ exports.StyledSelectLoaderContainer = exports.StyledSelectListTableHeader = exports.StyledSelectListTableBody = exports.StyledSelectListTable = exports.StyledSelectListContainer = exports.StyledSelectList = exports.StyledScrollableContainer = void 0;
7
7
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
8
+ var _themes = require("../../../style/themes");
8
9
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
9
10
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
10
11
  const StyledSelectList = exports.StyledSelectList = _styledComponents.default.ul`
@@ -98,4 +99,48 @@ const StyledSelectListTableBody = exports.StyledSelectListTableBody = _styledCom
98
99
  height: ${({
99
100
  listHeight
100
101
  }) => `${listHeight}px`};
101
- `;
102
+ `;
103
+ const StyledSelectListContainer = exports.StyledSelectListContainer = _styledComponents.default.div`
104
+ background-color: white;
105
+ box-shadow: var(--boxShadow100);
106
+ animation: fadeIn 250ms ease-out;
107
+ position: absolute;
108
+ z-index: ${({
109
+ theme
110
+ }) => theme.zIndex.popover};
111
+ display: flex;
112
+ flex-wrap: wrap;
113
+ align-items: flex-start;
114
+ border-radius: var(--borderRadius050);
115
+ ${({
116
+ isLoading
117
+ }) => isLoading && "min-height: 150px"};
118
+
119
+ @keyframes fadeIn {
120
+ 0% {
121
+ opacity: 0;
122
+ }
123
+ 100% {
124
+ opacity: 1;
125
+ }
126
+ }
127
+ `;
128
+ const StyledScrollableContainer = exports.StyledScrollableContainer = _styledComponents.default.div`
129
+ max-height: ${({
130
+ maxHeight
131
+ }) => `${maxHeight}px`};
132
+ width: 100%;
133
+ border-top-left-radius: var(--borderRadius050);
134
+ border-top-right-radius: var(--borderRadius050);
135
+ overflow-y: auto;
136
+
137
+ ${({
138
+ hasActionButton
139
+ }) => !hasActionButton && (0, _styledComponents.css)`
140
+ border-bottom-left-radius: var(--borderRadius050);
141
+ border-bottom-right-radius: var(--borderRadius050);
142
+ `}
143
+ `;
144
+ StyledSelectListContainer.defaultProps = {
145
+ theme: _themes.baseTheme
146
+ };
@@ -1,9 +1,9 @@
1
1
  import { ThemeObject } from "../../style/themes/base";
2
- export declare const borderRadiusStyling = "\n > {\n &:first-child:last-child {\n border-radius: var(--borderRadius100);\n }\n\n &:first-child:not(:last-child) {\n border-top-left-radius: var(--borderRadius100);\n border-top-right-radius: var(--borderRadius100);\n border-bottom-right-radius: var(--borderRadius000);\n border-bottom-left-radius: var(--borderRadius000);\n }\n\n &:not(:first-child):not(:last-child) {\n border-radius: var(--borderRadius000);\n }\n\n &:last-child:not(:first-child) {\n border-top-right-radius: var(--borderRadius000);\n border-top-left-radius: var(--borderRadius000);\n border-bottom-left-radius: var(--borderRadius100);\n border-bottom-right-radius: var(--borderRadius100);\n }\n }\n";
2
+ export declare const borderRadiusStyling = "\n > {\n &:first-child:last-child > * {\n border-radius: var(--borderRadius100);\n }\n\n &:first-child:not(:last-child) > * {\n border-top-left-radius: var(--borderRadius100);\n border-top-right-radius: var(--borderRadius100);\n border-bottom-right-radius: var(--borderRadius000);\n border-bottom-left-radius: var(--borderRadius000);\n }\n\n &:not(:first-child):not(:last-child) > * {\n border-radius: var(--borderRadius000);\n }\n\n &:last-child:not(:first-child) > * {\n border-top-right-radius: var(--borderRadius000);\n border-top-left-radius: var(--borderRadius000);\n border-bottom-left-radius: var(--borderRadius100);\n border-bottom-right-radius: var(--borderRadius100);\n }\n }\n";
3
3
  declare type StyledSplitButtonChildrenContainerProps = {
4
4
  theme: ThemeObject;
5
5
  align: "left" | "right";
6
6
  minWidth: number;
7
7
  };
8
- declare const StyledSplitButtonChildrenContainer: import("styled-components").StyledComponent<"div", any, StyledSplitButtonChildrenContainerProps, never>;
8
+ declare const StyledSplitButtonChildrenContainer: import("styled-components").StyledComponent<"ul", any, StyledSplitButtonChildrenContainerProps, never>;
9
9
  export default StyledSplitButtonChildrenContainer;
@@ -12,22 +12,22 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
12
12
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
13
13
  const borderRadiusStyling = exports.borderRadiusStyling = `
14
14
  > {
15
- &:first-child:last-child {
15
+ &:first-child:last-child > * {
16
16
  border-radius: var(--borderRadius100);
17
17
  }
18
18
 
19
- &:first-child:not(:last-child) {
19
+ &:first-child:not(:last-child) > * {
20
20
  border-top-left-radius: var(--borderRadius100);
21
21
  border-top-right-radius: var(--borderRadius100);
22
22
  border-bottom-right-radius: var(--borderRadius000);
23
23
  border-bottom-left-radius: var(--borderRadius000);
24
24
  }
25
25
 
26
- &:not(:first-child):not(:last-child) {
26
+ &:not(:first-child):not(:last-child) > * {
27
27
  border-radius: var(--borderRadius000);
28
28
  }
29
29
 
30
- &:last-child:not(:first-child) {
30
+ &:last-child:not(:first-child) > * {
31
31
  border-top-right-radius: var(--borderRadius000);
32
32
  border-top-left-radius: var(--borderRadius000);
33
33
  border-bottom-left-radius: var(--borderRadius100);
@@ -35,7 +35,7 @@ const borderRadiusStyling = exports.borderRadiusStyling = `
35
35
  }
36
36
  }
37
37
  `;
38
- const StyledSplitButtonChildrenContainer = _styledComponents.default.div`
38
+ const StyledSplitButtonChildrenContainer = _styledComponents.default.ul`
39
39
  border-radius: var(--borderRadius100);
40
40
  ${({
41
41
  theme,
@@ -47,6 +47,9 @@ const StyledSplitButtonChildrenContainer = _styledComponents.default.div`
47
47
  white-space: nowrap;
48
48
  z-index: ${theme.zIndex.popover};
49
49
  box-shadow: var(--boxShadow100);
50
+ list-style: none;
51
+ padding: 0;
52
+ margin: 0;
50
53
 
51
54
  ${borderRadiusStyling}
52
55
 
@@ -120,11 +120,10 @@ const SplitButton = ({
120
120
  placement: "bottom-end",
121
121
  reference: buttonNode
122
122
  }, /*#__PURE__*/_react.default.createElement(_splitButtonChildren.default, _extends({}, wrapperProps, {
123
- "aria-label": text,
124
123
  align: align
125
124
  }), /*#__PURE__*/_react.default.createElement(_splitButton2.default.Provider, {
126
125
  value: contextValue
127
- }, children)));
126
+ }, _react.default.Children.map(children, child => /*#__PURE__*/_react.default.createElement("li", null, child)))));
128
127
  }
129
128
  const handleClick = (0, _useClickAwayListener.default)(hideButtons);
130
129
  const marginProps = (0, _utils.filterStyledSystemMarginProps)(rest);
@@ -7,11 +7,11 @@ declare const useChildButtons: (toggleButtonRef: React.RefObject<HTMLButtonEleme
7
7
  hideButtonsIfTriggerNotFocused: () => void;
8
8
  handleToggleButtonKeyDown: (ev: React.KeyboardEvent<HTMLButtonElement>) => void;
9
9
  wrapperProps: {
10
- role: string;
11
10
  "data-element": string;
11
+ role: string;
12
12
  onKeyDown: (ev: any) => void;
13
13
  minWidth: number;
14
- ref: import("react").RefObject<HTMLDivElement>;
14
+ ref: import("react").RefObject<HTMLUListElement>;
15
15
  };
16
16
  contextValue: {
17
17
  inSplitButton: boolean;
@@ -53,8 +53,8 @@ const useChildButtons = (toggleButtonRef, widthRatio = 1) => {
53
53
  setShowAdditionalButtons(false);
54
54
  }, [toggleButtonRef]);
55
55
  const wrapperProps = {
56
- role: "menu",
57
56
  "data-element": "additional-buttons",
57
+ role: "list",
58
58
  onKeyDown: handleKeyDown,
59
59
  minWidth,
60
60
  ref: childrenContainer
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-react",
3
- "version": "127.0.3",
3
+ "version": "127.1.0",
4
4
  "description": "A library of reusable React components for easily building user interfaces.",
5
5
  "files": [
6
6
  "lib",
@@ -1,6 +0,0 @@
1
- import { SelectListProps } from ".";
2
- interface StyledSelectListContainerProps extends Pick<SelectListProps, "isLoading"> {
3
- maxHeight: number;
4
- }
5
- declare const StyledSelectListContainer: import("styled-components").StyledComponent<"div", any, StyledSelectListContainerProps, never>;
6
- export default StyledSelectListContainer;
@@ -1,36 +0,0 @@
1
- import styled from "styled-components";
2
- import { baseTheme } from "../../../style/themes";
3
- const StyledSelectListContainer = styled.div`
4
- background-color: white;
5
- box-shadow: var(--boxShadow100);
6
- animation: fadeIn 250ms ease-out;
7
- position: absolute;
8
- z-index: ${({
9
- theme
10
- }) => theme.zIndex.popover};
11
- max-height: ${({
12
- maxHeight
13
- }) => `${maxHeight}px`};
14
- overflow-y: auto;
15
- display: flex;
16
- flex-wrap: wrap;
17
- align-items: flex-start;
18
- border-radius: var(--borderRadius050);
19
-
20
- ${({
21
- isLoading
22
- }) => isLoading && "min-height: 150px"};
23
-
24
- @keyframes fadeIn {
25
- 0% {
26
- opacity: 0;
27
- }
28
- 100% {
29
- opacity: 1;
30
- }
31
- }
32
- `;
33
- StyledSelectListContainer.defaultProps = {
34
- theme: baseTheme
35
- };
36
- export default StyledSelectListContainer;
@@ -1,6 +0,0 @@
1
- import { SelectListProps } from ".";
2
- interface StyledSelectListContainerProps extends Pick<SelectListProps, "isLoading"> {
3
- maxHeight: number;
4
- }
5
- declare const StyledSelectListContainer: import("styled-components").StyledComponent<"div", any, StyledSelectListContainerProps, never>;
6
- export default StyledSelectListContainer;
@@ -1,43 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _styledComponents = _interopRequireDefault(require("styled-components"));
8
- var _themes = require("../../../style/themes");
9
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
- const StyledSelectListContainer = _styledComponents.default.div`
11
- background-color: white;
12
- box-shadow: var(--boxShadow100);
13
- animation: fadeIn 250ms ease-out;
14
- position: absolute;
15
- z-index: ${({
16
- theme
17
- }) => theme.zIndex.popover};
18
- max-height: ${({
19
- maxHeight
20
- }) => `${maxHeight}px`};
21
- overflow-y: auto;
22
- display: flex;
23
- flex-wrap: wrap;
24
- align-items: flex-start;
25
- border-radius: var(--borderRadius050);
26
-
27
- ${({
28
- isLoading
29
- }) => isLoading && "min-height: 150px"};
30
-
31
- @keyframes fadeIn {
32
- 0% {
33
- opacity: 0;
34
- }
35
- 100% {
36
- opacity: 1;
37
- }
38
- }
39
- `;
40
- StyledSelectListContainer.defaultProps = {
41
- theme: _themes.baseTheme
42
- };
43
- var _default = exports.default = StyledSelectListContainer;