carbon-react 134.0.4 → 134.1.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.
- package/esm/__internal__/input/input.component.js +5 -0
- package/esm/__internal__/input/input.style.d.ts +3 -1
- package/esm/__internal__/input/input.style.js +3 -0
- package/esm/components/button/button.style.d.ts +2 -1
- package/esm/components/button/button.style.js +1 -1
- package/esm/components/multi-action-button/multi-action-button.component.js +5 -6
- package/esm/components/pager/pager.style.js +1 -1
- package/esm/components/popover-container/popover-container.component.js +13 -13
- package/esm/components/select/__internal__/select-text/select-text.component.js +2 -2
- package/esm/components/select/__internal__/select-text/select-text.style.d.ts +2 -1
- package/esm/components/select/__internal__/select-text/select-text.style.js +7 -4
- package/esm/components/select/select-textbox/select-textbox-context.d.ts +5 -0
- package/esm/components/select/select-textbox/select-textbox-context.js +2 -0
- package/esm/components/select/select-textbox/select-textbox.component.js +7 -2
- package/esm/components/split-button/split-button-toggle.style.d.ts +2 -1
- package/esm/components/split-button/split-button-toggle.style.js +2 -1
- package/esm/components/split-button/split-button.component.js +10 -11
- package/esm/hooks/__internal__/useChildButtons/useChildButtons.d.ts +0 -1
- package/esm/hooks/__internal__/useChildButtons/useChildButtons.js +0 -5
- package/lib/__internal__/input/input.component.js +5 -0
- package/lib/__internal__/input/input.style.d.ts +3 -1
- package/lib/__internal__/input/input.style.js +3 -0
- package/lib/components/button/button.style.d.ts +2 -1
- package/lib/components/button/button.style.js +1 -1
- package/lib/components/multi-action-button/multi-action-button.component.js +5 -6
- package/lib/components/pager/pager.style.js +2 -2
- package/lib/components/popover-container/popover-container.component.js +13 -13
- package/lib/components/select/__internal__/select-text/select-text.component.js +3 -3
- package/lib/components/select/__internal__/select-text/select-text.style.d.ts +2 -1
- package/lib/components/select/__internal__/select-text/select-text.style.js +8 -6
- package/lib/components/select/select-textbox/select-textbox-context.d.ts +5 -0
- package/lib/components/select/select-textbox/select-textbox-context.js +9 -0
- package/lib/components/select/select-textbox/select-textbox.component.js +7 -2
- package/lib/components/split-button/split-button-toggle.style.d.ts +2 -1
- package/lib/components/split-button/split-button-toggle.style.js +2 -1
- package/lib/components/split-button/split-button.component.js +10 -11
- package/lib/hooks/__internal__/useChildButtons/useChildButtons.d.ts +0 -1
- package/lib/hooks/__internal__/useChildButtons/useChildButtons.js +0 -5
- package/package.json +1 -1
|
@@ -3,6 +3,7 @@ import React, { useEffect, useContext, useRef, useCallback } from "react";
|
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
4
|
import StyledInput from "./input.style";
|
|
5
5
|
import { InputContext, InputGroupContext } from "../input-behaviour";
|
|
6
|
+
import { SelectTextboxContext } from "../../components/select/select-textbox/select-textbox-context";
|
|
6
7
|
function selectTextOnFocus(input) {
|
|
7
8
|
// setTimeout is required so the dom has a chance to place the cursor in the input
|
|
8
9
|
setTimeout(() => {
|
|
@@ -48,6 +49,9 @@ const Input = /*#__PURE__*/React.forwardRef(({
|
|
|
48
49
|
}, ref) => {
|
|
49
50
|
const context = useContext(InputContext);
|
|
50
51
|
const groupContext = useContext(InputGroupContext);
|
|
52
|
+
const {
|
|
53
|
+
isInputInSelect
|
|
54
|
+
} = useContext(SelectTextboxContext);
|
|
51
55
|
const deferredTimeout = useRef(null);
|
|
52
56
|
let input = useRef(null);
|
|
53
57
|
if (ref && "current" in ref) {
|
|
@@ -129,6 +133,7 @@ const Input = /*#__PURE__*/React.forwardRef(({
|
|
|
129
133
|
}
|
|
130
134
|
const combinedDescription = descriptionList.length ? descriptionList.filter(Boolean).join(" ") : undefined;
|
|
131
135
|
return /*#__PURE__*/React.createElement(StyledInput, _extends({}, rest, {
|
|
136
|
+
isInputInSelect: isInputInSelect,
|
|
132
137
|
"data-has-autofocus": autoFocus ? true : undefined,
|
|
133
138
|
"aria-describedby": combinedDescription,
|
|
134
139
|
"aria-labelledby": ariaLabelledBy,
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import { CommonInputProps } from "./input.component";
|
|
2
|
-
declare const StyledInput: import("styled-components").StyledComponent<"input", any, Pick<CommonInputProps, "disabled" | "align" | "inputBorderRadius"
|
|
2
|
+
declare const StyledInput: import("styled-components").StyledComponent<"input", any, Pick<CommonInputProps, "disabled" | "align" | "inputBorderRadius"> & {
|
|
3
|
+
isInputInSelect: boolean;
|
|
4
|
+
}, never>;
|
|
3
5
|
export default StyledInput;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { SpaceProps } from "styled-system";
|
|
2
2
|
import { ButtonProps } from "./button.component";
|
|
3
|
-
declare const StyledButton: import("styled-components").StyledComponent<"button", any, SpaceProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol> & ButtonProps & {
|
|
3
|
+
declare const StyledButton: import("styled-components").StyledComponent<"button", any, SpaceProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol> & Omit<ButtonProps, "buttonType"> & {
|
|
4
4
|
iconOnly?: boolean | undefined;
|
|
5
|
+
buttonType: Required<ButtonProps>["buttonType"];
|
|
5
6
|
}, never>;
|
|
6
7
|
export declare const StyledButtonSubtext: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
7
8
|
export declare const StyledButtonMainText: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
2
|
import React, { useRef } from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
|
+
import { flip, offset } from "@floating-ui/dom";
|
|
4
5
|
import useClickAwayListener from "../../hooks/__internal__/useClickAwayListener";
|
|
5
6
|
import SplitButtonContext from "../split-button/__internal__/split-button.context";
|
|
6
7
|
import { StyledMultiActionButton, StyledButtonChildrenContainer } from "./multi-action-button.style";
|
|
@@ -28,7 +29,6 @@ export const MultiActionButton = ({
|
|
|
28
29
|
showButtons,
|
|
29
30
|
hideButtons,
|
|
30
31
|
buttonNode,
|
|
31
|
-
hideButtonsIfTriggerNotFocused,
|
|
32
32
|
handleToggleButtonKeyDown,
|
|
33
33
|
wrapperProps,
|
|
34
34
|
contextValue
|
|
@@ -50,14 +50,14 @@ export const MultiActionButton = ({
|
|
|
50
50
|
buttonType,
|
|
51
51
|
size,
|
|
52
52
|
subtext,
|
|
53
|
-
...(!disabled && {
|
|
54
|
-
onMouseEnter: showButtons
|
|
55
|
-
}),
|
|
56
53
|
...filterOutStyledSystemSpacingProps(rest)
|
|
57
54
|
};
|
|
58
55
|
const renderAdditionalButtons = () => /*#__PURE__*/React.createElement(Popover, {
|
|
59
56
|
placement: "bottom-end",
|
|
60
|
-
reference: buttonNode
|
|
57
|
+
reference: buttonNode,
|
|
58
|
+
middleware: [offset(6), flip({
|
|
59
|
+
fallbackStrategy: "initialPlacement"
|
|
60
|
+
})]
|
|
61
61
|
}, /*#__PURE__*/React.createElement(StyledButtonChildrenContainer, _extends({}, wrapperProps, {
|
|
62
62
|
align: align
|
|
63
63
|
}), /*#__PURE__*/React.createElement(SplitButtonContext.Provider, {
|
|
@@ -65,7 +65,6 @@ export const MultiActionButton = ({
|
|
|
65
65
|
}, React.Children.map(children, child => /*#__PURE__*/React.createElement("li", null, child)))));
|
|
66
66
|
const marginProps = filterStyledSystemMarginProps(rest);
|
|
67
67
|
return /*#__PURE__*/React.createElement(StyledMultiActionButton, _extends({
|
|
68
|
-
onMouseLeave: hideButtonsIfTriggerNotFocused,
|
|
69
68
|
ref: buttonNode,
|
|
70
69
|
"data-component": "multi-action-button",
|
|
71
70
|
"data-element": dataElement,
|
|
@@ -3,7 +3,7 @@ import StyledInput from "../../__internal__/input/input.style";
|
|
|
3
3
|
import StyledInputPresentation from "../../__internal__/input/input-presentation.style";
|
|
4
4
|
import StyledFormField from "../../__internal__/form-field/form-field.style";
|
|
5
5
|
import InputIconToggleStyle from "../../__internal__/input-icon-toggle/input-icon-toggle.style";
|
|
6
|
-
import StyledSelectText from "../select/__internal__/select-text/select-text.style";
|
|
6
|
+
import { StyledSelectText } from "../select/__internal__/select-text/select-text.style";
|
|
7
7
|
import Link from "../link";
|
|
8
8
|
const StyledSelectContainer = styled.div`
|
|
9
9
|
height: 26px;
|
|
@@ -56,13 +56,15 @@ export const renderClose = ({
|
|
|
56
56
|
})), /*#__PURE__*/React.createElement(Icon, {
|
|
57
57
|
type: "close"
|
|
58
58
|
}));
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
59
|
+
function getPopoverMiddleware(shouldCoverButton) {
|
|
60
|
+
return [offset(shouldCoverButton ? ({
|
|
61
|
+
rects
|
|
62
|
+
}) => ({
|
|
63
|
+
mainAxis: -rects.reference.height
|
|
64
|
+
}) : 6), flip({
|
|
65
|
+
fallbackStrategy: "initialPlacement"
|
|
66
|
+
})];
|
|
67
|
+
}
|
|
66
68
|
export const PopoverContainer = ({
|
|
67
69
|
children,
|
|
68
70
|
title,
|
|
@@ -192,14 +194,12 @@ export const PopoverContainer = ({
|
|
|
192
194
|
nodeRef: popoverContentNodeRef,
|
|
193
195
|
onEntered: shouldCoverButton ? /* istanbul ignore next */() => setIsAnimationComplete(true) : undefined,
|
|
194
196
|
onExiting: shouldCoverButton ? /* istanbul ignore next */() => setIsAnimationComplete(false) : undefined
|
|
195
|
-
}, state => isOpen && /*#__PURE__*/React.createElement(Popover,
|
|
197
|
+
}, state => isOpen && /*#__PURE__*/React.createElement(Popover, {
|
|
196
198
|
reference: popoverReference,
|
|
197
199
|
placement: position === "right" ? "bottom-start" : "bottom-end",
|
|
198
|
-
popoverStrategy: disableAnimation || reduceMotion ? "fixed" : "absolute"
|
|
199
|
-
|
|
200
|
-
middleware: popoverMiddleware
|
|
201
|
-
}, {
|
|
200
|
+
popoverStrategy: disableAnimation || reduceMotion ? "fixed" : "absolute",
|
|
201
|
+
middleware: getPopoverMiddleware(shouldCoverButton),
|
|
202
202
|
childRefOverride: popoverContentNodeRef
|
|
203
|
-
}
|
|
203
|
+
}, childrenToRender(state))));
|
|
204
204
|
};
|
|
205
205
|
export default PopoverContainer;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
|
-
import StyledSelectText from "./select-text.style";
|
|
3
|
+
import { StyledSelectText, StyledSelectTextChildrenWrapper } from "./select-text.style";
|
|
4
4
|
const SelectText = ({
|
|
5
5
|
disabled,
|
|
6
6
|
formattedValue = "",
|
|
@@ -22,6 +22,6 @@ const SelectText = ({
|
|
|
22
22
|
readOnly: readOnly,
|
|
23
23
|
transparent: transparent,
|
|
24
24
|
size: size
|
|
25
|
-
}, hasPlaceholder ? placeholder : formattedValue);
|
|
25
|
+
}, /*#__PURE__*/React.createElement(StyledSelectTextChildrenWrapper, null, hasPlaceholder ? placeholder : formattedValue));
|
|
26
26
|
};
|
|
27
27
|
export default SelectText;
|
|
@@ -4,4 +4,5 @@ interface StyledSelectTextProps extends Pick<SelectTextProps, "disabled" | "read
|
|
|
4
4
|
size: NonNullable<SelectTextProps["size"]>;
|
|
5
5
|
}
|
|
6
6
|
declare const StyledSelectText: import("styled-components").StyledComponent<"span", any, StyledSelectTextProps, never>;
|
|
7
|
-
|
|
7
|
+
declare const StyledSelectTextChildrenWrapper: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
8
|
+
export { StyledSelectText, StyledSelectTextChildrenWrapper };
|
|
@@ -13,10 +13,7 @@ const StyledSelectText = styled.span`
|
|
|
13
13
|
flex-grow: 1;
|
|
14
14
|
font-size: 14px;
|
|
15
15
|
height: auto;
|
|
16
|
-
overflow: hidden;
|
|
17
16
|
outline: none;
|
|
18
|
-
text-overflow: ellipsis;
|
|
19
|
-
white-space: nowrap;
|
|
20
17
|
width: 30px;
|
|
21
18
|
z-index: 1;
|
|
22
19
|
padding-left: ${sizes[size].horizontalPadding};
|
|
@@ -46,4 +43,10 @@ const StyledSelectText = styled.span`
|
|
|
46
43
|
`}
|
|
47
44
|
`}
|
|
48
45
|
`;
|
|
49
|
-
|
|
46
|
+
const StyledSelectTextChildrenWrapper = styled.span`
|
|
47
|
+
display: block;
|
|
48
|
+
white-space: nowrap;
|
|
49
|
+
overflow: hidden;
|
|
50
|
+
text-overflow: ellipsis;
|
|
51
|
+
`;
|
|
52
|
+
export { StyledSelectText, StyledSelectTextChildrenWrapper };
|
|
@@ -6,6 +6,7 @@ import useFloating from "../../../hooks/__internal__/useFloating";
|
|
|
6
6
|
import Textbox from "../../textbox";
|
|
7
7
|
import SelectText from "../__internal__/select-text";
|
|
8
8
|
import useLocale from "../../../hooks/__internal__/useLocale";
|
|
9
|
+
import { SelectTextboxContext } from "./select-textbox-context";
|
|
9
10
|
const floatingMiddleware = [offset(({
|
|
10
11
|
rects
|
|
11
12
|
}) => ({
|
|
@@ -100,7 +101,11 @@ const SelectTextbox = /*#__PURE__*/React.forwardRef(({
|
|
|
100
101
|
role: readOnly ? undefined : "combobox"
|
|
101
102
|
};
|
|
102
103
|
const hasStringValue = typeof selectedValue === "string" || Array.isArray(selectedValue) && typeof selectedValue[0] === "string";
|
|
103
|
-
return /*#__PURE__*/React.createElement(
|
|
104
|
+
return /*#__PURE__*/React.createElement(SelectTextboxContext.Provider, {
|
|
105
|
+
value: {
|
|
106
|
+
isInputInSelect: true
|
|
107
|
+
}
|
|
108
|
+
}, /*#__PURE__*/React.createElement(Textbox, _extends({
|
|
104
109
|
"aria-label": ariaLabel,
|
|
105
110
|
"data-element": "select-input",
|
|
106
111
|
inputIcon: "dropdown",
|
|
@@ -118,7 +123,7 @@ const SelectTextbox = /*#__PURE__*/React.forwardRef(({
|
|
|
118
123
|
disabled: disabled,
|
|
119
124
|
readOnly: readOnly,
|
|
120
125
|
size: size
|
|
121
|
-
}, restProps)));
|
|
126
|
+
}, restProps))));
|
|
122
127
|
});
|
|
123
128
|
if (process.env.NODE_ENV !== "production") {
|
|
124
129
|
SelectTextbox.propTypes = {
|
|
@@ -4,7 +4,8 @@ declare type StyledSplitButtonToggleProps = {
|
|
|
4
4
|
displayed: boolean;
|
|
5
5
|
size: "small" | "medium" | "large";
|
|
6
6
|
};
|
|
7
|
-
declare const StyledSplitButtonToggle: import("styled-components").StyledComponent<"button", any, import("styled-system").SpaceProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol> & import("../button").ButtonProps & {
|
|
7
|
+
declare const StyledSplitButtonToggle: import("styled-components").StyledComponent<"button", any, import("styled-system").SpaceProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol> & Omit<import("../button").ButtonProps, "buttonType"> & {
|
|
8
8
|
iconOnly?: boolean | undefined;
|
|
9
|
+
buttonType: import("../button/button.component").ButtonTypes;
|
|
9
10
|
} & StyledSplitButtonToggleProps, never>;
|
|
10
11
|
export default StyledSplitButtonToggle;
|
|
@@ -2,6 +2,7 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
2
2
|
import React, { useContext, useRef } from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
4
|
import { ThemeContext } from "styled-components";
|
|
5
|
+
import { flip, offset } from "@floating-ui/dom";
|
|
5
6
|
import useClickAwayListener from "../../hooks/__internal__/useClickAwayListener";
|
|
6
7
|
import Icon from "../icon";
|
|
7
8
|
import Button from "../button";
|
|
@@ -41,15 +42,14 @@ export const SplitButton = ({
|
|
|
41
42
|
showButtons,
|
|
42
43
|
hideButtons,
|
|
43
44
|
buttonNode,
|
|
44
|
-
hideButtonsIfTriggerNotFocused,
|
|
45
45
|
handleToggleButtonKeyDown,
|
|
46
46
|
wrapperProps,
|
|
47
47
|
contextValue
|
|
48
48
|
} = useChildButtons(toggleButton, CONTENT_WIDTH_RATIO);
|
|
49
49
|
const mainButtonProps = {
|
|
50
|
-
onMouseEnter:
|
|
51
|
-
onFocus:
|
|
52
|
-
onTouchStart:
|
|
50
|
+
onMouseEnter: hideButtons,
|
|
51
|
+
onFocus: hideButtons,
|
|
52
|
+
onTouchStart: hideButtons,
|
|
53
53
|
iconPosition,
|
|
54
54
|
buttonType,
|
|
55
55
|
disabled,
|
|
@@ -64,12 +64,9 @@ export const SplitButton = ({
|
|
|
64
64
|
displayed: showAdditionalButtons,
|
|
65
65
|
onTouchStart: showButtons,
|
|
66
66
|
onKeyDown: handleToggleButtonKeyDown,
|
|
67
|
+
onClick: showButtons,
|
|
67
68
|
buttonType,
|
|
68
|
-
size
|
|
69
|
-
...(!disabled && {
|
|
70
|
-
onMouseEnter: showButtons,
|
|
71
|
-
onClick: showButtons
|
|
72
|
-
})
|
|
69
|
+
size
|
|
73
70
|
};
|
|
74
71
|
function componentTags() {
|
|
75
72
|
return {
|
|
@@ -109,7 +106,10 @@ export const SplitButton = ({
|
|
|
109
106
|
if (!showAdditionalButtons) return null;
|
|
110
107
|
return /*#__PURE__*/React.createElement(Popover, {
|
|
111
108
|
placement: "bottom-end",
|
|
112
|
-
reference: buttonNode
|
|
109
|
+
reference: buttonNode,
|
|
110
|
+
middleware: [offset(6), flip({
|
|
111
|
+
fallbackStrategy: "initialPlacement"
|
|
112
|
+
})]
|
|
113
113
|
}, /*#__PURE__*/React.createElement(StyledSplitButtonChildrenContainer, _extends({}, wrapperProps, {
|
|
114
114
|
align: align
|
|
115
115
|
}), /*#__PURE__*/React.createElement(SplitButtonContext.Provider, {
|
|
@@ -119,7 +119,6 @@ export const SplitButton = ({
|
|
|
119
119
|
const handleClick = useClickAwayListener(hideButtons);
|
|
120
120
|
const marginProps = filterStyledSystemMarginProps(rest);
|
|
121
121
|
return /*#__PURE__*/React.createElement(StyledSplitButton, _extends({
|
|
122
|
-
onMouseLeave: hideButtonsIfTriggerNotFocused,
|
|
123
122
|
onClick: handleClick,
|
|
124
123
|
ref: buttonNode
|
|
125
124
|
}, componentTags(), marginProps), renderMainButton(), renderAdditionalButtons());
|
|
@@ -4,7 +4,6 @@ declare const useChildButtons: (toggleButtonRef: React.RefObject<HTMLButtonEleme
|
|
|
4
4
|
showButtons: () => void;
|
|
5
5
|
hideButtons: () => void;
|
|
6
6
|
buttonNode: import("react").RefObject<HTMLDivElement>;
|
|
7
|
-
hideButtonsIfTriggerNotFocused: () => void;
|
|
8
7
|
handleToggleButtonKeyDown: (ev: React.KeyboardEvent<HTMLButtonElement>) => void;
|
|
9
8
|
wrapperProps: {
|
|
10
9
|
"data-element": string;
|
|
@@ -41,10 +41,6 @@ const useChildButtons = (toggleButtonRef, widthRatio = 1) => {
|
|
|
41
41
|
hideButtons();
|
|
42
42
|
toggleButtonRef.current?.focus();
|
|
43
43
|
};
|
|
44
|
-
const hideButtonsIfTriggerNotFocused = useCallback(() => {
|
|
45
|
-
if (toggleButtonRef.current === document.activeElement) return;
|
|
46
|
-
setShowAdditionalButtons(false);
|
|
47
|
-
}, [toggleButtonRef]);
|
|
48
44
|
const wrapperProps = {
|
|
49
45
|
"data-element": "additional-buttons",
|
|
50
46
|
role: "list",
|
|
@@ -61,7 +57,6 @@ const useChildButtons = (toggleButtonRef, widthRatio = 1) => {
|
|
|
61
57
|
showButtons,
|
|
62
58
|
hideButtons,
|
|
63
59
|
buttonNode,
|
|
64
|
-
hideButtonsIfTriggerNotFocused,
|
|
65
60
|
handleToggleButtonKeyDown,
|
|
66
61
|
wrapperProps,
|
|
67
62
|
contextValue
|
|
@@ -8,6 +8,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _input = _interopRequireDefault(require("./input.style"));
|
|
10
10
|
var _inputBehaviour = require("../input-behaviour");
|
|
11
|
+
var _selectTextboxContext = require("../../components/select/select-textbox/select-textbox-context");
|
|
11
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
13
|
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); }
|
|
13
14
|
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 && {}.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; }
|
|
@@ -57,6 +58,9 @@ const Input = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
57
58
|
}, ref) => {
|
|
58
59
|
const context = (0, _react.useContext)(_inputBehaviour.InputContext);
|
|
59
60
|
const groupContext = (0, _react.useContext)(_inputBehaviour.InputGroupContext);
|
|
61
|
+
const {
|
|
62
|
+
isInputInSelect
|
|
63
|
+
} = (0, _react.useContext)(_selectTextboxContext.SelectTextboxContext);
|
|
60
64
|
const deferredTimeout = (0, _react.useRef)(null);
|
|
61
65
|
let input = (0, _react.useRef)(null);
|
|
62
66
|
if (ref && "current" in ref) {
|
|
@@ -138,6 +142,7 @@ const Input = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
138
142
|
}
|
|
139
143
|
const combinedDescription = descriptionList.length ? descriptionList.filter(Boolean).join(" ") : undefined;
|
|
140
144
|
return /*#__PURE__*/_react.default.createElement(_input.default, _extends({}, rest, {
|
|
145
|
+
isInputInSelect: isInputInSelect,
|
|
141
146
|
"data-has-autofocus": autoFocus ? true : undefined,
|
|
142
147
|
"aria-describedby": combinedDescription,
|
|
143
148
|
"aria-labelledby": ariaLabelledBy,
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import { CommonInputProps } from "./input.component";
|
|
2
|
-
declare const StyledInput: import("styled-components").StyledComponent<"input", any, Pick<CommonInputProps, "disabled" | "align" | "inputBorderRadius"
|
|
2
|
+
declare const StyledInput: import("styled-components").StyledComponent<"input", any, Pick<CommonInputProps, "disabled" | "align" | "inputBorderRadius"> & {
|
|
3
|
+
isInputInSelect: boolean;
|
|
4
|
+
}, never>;
|
|
3
5
|
export default StyledInput;
|
|
@@ -8,6 +8,9 @@ var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
|
8
8
|
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
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 && {}.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 StyledInput = _styledComponents.default.input`
|
|
11
|
+
${({
|
|
12
|
+
isInputInSelect
|
|
13
|
+
}) => isInputInSelect && "text-overflow: ellipsis"};
|
|
11
14
|
background: transparent;
|
|
12
15
|
border: none;
|
|
13
16
|
color: var(--colorsUtilityYin090);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { SpaceProps } from "styled-system";
|
|
2
2
|
import { ButtonProps } from "./button.component";
|
|
3
|
-
declare const StyledButton: import("styled-components").StyledComponent<"button", any, SpaceProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol> & ButtonProps & {
|
|
3
|
+
declare const StyledButton: import("styled-components").StyledComponent<"button", any, SpaceProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol> & Omit<ButtonProps, "buttonType"> & {
|
|
4
4
|
iconOnly?: boolean | undefined;
|
|
5
|
+
buttonType: Required<ButtonProps>["buttonType"];
|
|
5
6
|
}, never>;
|
|
6
7
|
export declare const StyledButtonSubtext: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
7
8
|
export declare const StyledButtonMainText: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = exports.MultiActionButton = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
var _dom = require("@floating-ui/dom");
|
|
9
10
|
var _useClickAwayListener = _interopRequireDefault(require("../../hooks/__internal__/useClickAwayListener"));
|
|
10
11
|
var _splitButton = _interopRequireDefault(require("../split-button/__internal__/split-button.context"));
|
|
11
12
|
var _multiActionButton = require("./multi-action-button.style");
|
|
@@ -37,7 +38,6 @@ const MultiActionButton = ({
|
|
|
37
38
|
showButtons,
|
|
38
39
|
hideButtons,
|
|
39
40
|
buttonNode,
|
|
40
|
-
hideButtonsIfTriggerNotFocused,
|
|
41
41
|
handleToggleButtonKeyDown,
|
|
42
42
|
wrapperProps,
|
|
43
43
|
contextValue
|
|
@@ -59,14 +59,14 @@ const MultiActionButton = ({
|
|
|
59
59
|
buttonType,
|
|
60
60
|
size,
|
|
61
61
|
subtext,
|
|
62
|
-
...(!disabled && {
|
|
63
|
-
onMouseEnter: showButtons
|
|
64
|
-
}),
|
|
65
62
|
...(0, _utils.filterOutStyledSystemSpacingProps)(rest)
|
|
66
63
|
};
|
|
67
64
|
const renderAdditionalButtons = () => /*#__PURE__*/_react.default.createElement(_popover.default, {
|
|
68
65
|
placement: "bottom-end",
|
|
69
|
-
reference: buttonNode
|
|
66
|
+
reference: buttonNode,
|
|
67
|
+
middleware: [(0, _dom.offset)(6), (0, _dom.flip)({
|
|
68
|
+
fallbackStrategy: "initialPlacement"
|
|
69
|
+
})]
|
|
70
70
|
}, /*#__PURE__*/_react.default.createElement(_multiActionButton.StyledButtonChildrenContainer, _extends({}, wrapperProps, {
|
|
71
71
|
align: align
|
|
72
72
|
}), /*#__PURE__*/_react.default.createElement(_splitButton.default.Provider, {
|
|
@@ -74,7 +74,6 @@ const MultiActionButton = ({
|
|
|
74
74
|
}, _react.default.Children.map(children, child => /*#__PURE__*/_react.default.createElement("li", null, child)))));
|
|
75
75
|
const marginProps = (0, _utils.filterStyledSystemMarginProps)(rest);
|
|
76
76
|
return /*#__PURE__*/_react.default.createElement(_multiActionButton.StyledMultiActionButton, _extends({
|
|
77
|
-
onMouseLeave: hideButtonsIfTriggerNotFocused,
|
|
78
77
|
ref: buttonNode,
|
|
79
78
|
"data-component": "multi-action-button",
|
|
80
79
|
"data-element": dataElement,
|
|
@@ -9,7 +9,7 @@ var _input = _interopRequireDefault(require("../../__internal__/input/input.styl
|
|
|
9
9
|
var _inputPresentation = _interopRequireDefault(require("../../__internal__/input/input-presentation.style"));
|
|
10
10
|
var _formField = _interopRequireDefault(require("../../__internal__/form-field/form-field.style"));
|
|
11
11
|
var _inputIconToggle = _interopRequireDefault(require("../../__internal__/input-icon-toggle/input-icon-toggle.style"));
|
|
12
|
-
var _selectText =
|
|
12
|
+
var _selectText = require("../select/__internal__/select-text/select-text.style");
|
|
13
13
|
var _link = _interopRequireDefault(require("../link"));
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
15
|
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); }
|
|
@@ -51,7 +51,7 @@ const StyledPagerSizeOptions = exports.StyledPagerSizeOptions = _styledComponent
|
|
|
51
51
|
min-width: 10px;
|
|
52
52
|
margin: 0px;
|
|
53
53
|
|
|
54
|
-
${_selectText.
|
|
54
|
+
${_selectText.StyledSelectText} {
|
|
55
55
|
font-size: 14px;
|
|
56
56
|
padding-right: 0px;
|
|
57
57
|
padding-left: 8px;
|
|
@@ -67,13 +67,15 @@ const renderClose = ({
|
|
|
67
67
|
type: "close"
|
|
68
68
|
}));
|
|
69
69
|
exports.renderClose = renderClose;
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
70
|
+
function getPopoverMiddleware(shouldCoverButton) {
|
|
71
|
+
return [(0, _dom.offset)(shouldCoverButton ? ({
|
|
72
|
+
rects
|
|
73
|
+
}) => ({
|
|
74
|
+
mainAxis: -rects.reference.height
|
|
75
|
+
}) : 6), (0, _dom.flip)({
|
|
76
|
+
fallbackStrategy: "initialPlacement"
|
|
77
|
+
})];
|
|
78
|
+
}
|
|
77
79
|
const PopoverContainer = ({
|
|
78
80
|
children,
|
|
79
81
|
title,
|
|
@@ -203,15 +205,13 @@ const PopoverContainer = ({
|
|
|
203
205
|
nodeRef: popoverContentNodeRef,
|
|
204
206
|
onEntered: shouldCoverButton ? /* istanbul ignore next */() => setIsAnimationComplete(true) : undefined,
|
|
205
207
|
onExiting: shouldCoverButton ? /* istanbul ignore next */() => setIsAnimationComplete(false) : undefined
|
|
206
|
-
}, state => isOpen && /*#__PURE__*/_react.default.createElement(_popover.default,
|
|
208
|
+
}, state => isOpen && /*#__PURE__*/_react.default.createElement(_popover.default, {
|
|
207
209
|
reference: popoverReference,
|
|
208
210
|
placement: position === "right" ? "bottom-start" : "bottom-end",
|
|
209
|
-
popoverStrategy: disableAnimation || reduceMotion ? "fixed" : "absolute"
|
|
210
|
-
|
|
211
|
-
middleware: popoverMiddleware
|
|
212
|
-
}, {
|
|
211
|
+
popoverStrategy: disableAnimation || reduceMotion ? "fixed" : "absolute",
|
|
212
|
+
middleware: getPopoverMiddleware(shouldCoverButton),
|
|
213
213
|
childRefOverride: popoverContentNodeRef
|
|
214
|
-
}
|
|
214
|
+
}, childrenToRender(state))));
|
|
215
215
|
};
|
|
216
216
|
exports.PopoverContainer = PopoverContainer;
|
|
217
217
|
var _default = exports.default = PopoverContainer;
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
var _selectText =
|
|
9
|
+
var _selectText = require("./select-text.style");
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
11
|
const SelectText = ({
|
|
12
12
|
disabled,
|
|
@@ -19,7 +19,7 @@ const SelectText = ({
|
|
|
19
19
|
size = "medium"
|
|
20
20
|
}) => {
|
|
21
21
|
const hasPlaceholder = !disabled && !readOnly && !formattedValue;
|
|
22
|
-
return /*#__PURE__*/_react.default.createElement(_selectText.
|
|
22
|
+
return /*#__PURE__*/_react.default.createElement(_selectText.StyledSelectText, {
|
|
23
23
|
"aria-hidden": true,
|
|
24
24
|
"data-element": "select-text",
|
|
25
25
|
disabled: disabled,
|
|
@@ -29,6 +29,6 @@ const SelectText = ({
|
|
|
29
29
|
readOnly: readOnly,
|
|
30
30
|
transparent: transparent,
|
|
31
31
|
size: size
|
|
32
|
-
}, hasPlaceholder ? placeholder : formattedValue);
|
|
32
|
+
}, /*#__PURE__*/_react.default.createElement(_selectText.StyledSelectTextChildrenWrapper, null, hasPlaceholder ? placeholder : formattedValue));
|
|
33
33
|
};
|
|
34
34
|
var _default = exports.default = SelectText;
|
|
@@ -4,4 +4,5 @@ interface StyledSelectTextProps extends Pick<SelectTextProps, "disabled" | "read
|
|
|
4
4
|
size: NonNullable<SelectTextProps["size"]>;
|
|
5
5
|
}
|
|
6
6
|
declare const StyledSelectText: import("styled-components").StyledComponent<"span", any, StyledSelectTextProps, never>;
|
|
7
|
-
|
|
7
|
+
declare const StyledSelectTextChildrenWrapper: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
8
|
+
export { StyledSelectText, StyledSelectTextChildrenWrapper };
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.StyledSelectTextChildrenWrapper = exports.StyledSelectText = void 0;
|
|
7
7
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
8
8
|
var _inputSizes = _interopRequireDefault(require("../../../../__internal__/input/input-sizes.style"));
|
|
9
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
10
|
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); }
|
|
11
11
|
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 && {}.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; }
|
|
12
|
-
const StyledSelectText = _styledComponents.default.span`
|
|
12
|
+
const StyledSelectText = exports.StyledSelectText = _styledComponents.default.span`
|
|
13
13
|
${({
|
|
14
14
|
disabled,
|
|
15
15
|
hasPlaceholder,
|
|
@@ -22,10 +22,7 @@ const StyledSelectText = _styledComponents.default.span`
|
|
|
22
22
|
flex-grow: 1;
|
|
23
23
|
font-size: 14px;
|
|
24
24
|
height: auto;
|
|
25
|
-
overflow: hidden;
|
|
26
25
|
outline: none;
|
|
27
|
-
text-overflow: ellipsis;
|
|
28
|
-
white-space: nowrap;
|
|
29
26
|
width: 30px;
|
|
30
27
|
z-index: 1;
|
|
31
28
|
padding-left: ${_inputSizes.default[size].horizontalPadding};
|
|
@@ -55,4 +52,9 @@ const StyledSelectText = _styledComponents.default.span`
|
|
|
55
52
|
`}
|
|
56
53
|
`}
|
|
57
54
|
`;
|
|
58
|
-
|
|
55
|
+
const StyledSelectTextChildrenWrapper = exports.StyledSelectTextChildrenWrapper = _styledComponents.default.span`
|
|
56
|
+
display: block;
|
|
57
|
+
white-space: nowrap;
|
|
58
|
+
overflow: hidden;
|
|
59
|
+
text-overflow: ellipsis;
|
|
60
|
+
`;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.SelectTextboxContext = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
+
const SelectTextboxContext = exports.SelectTextboxContext = /*#__PURE__*/_react.default.createContext({});
|
|
@@ -11,6 +11,7 @@ var _useFloating = _interopRequireDefault(require("../../../hooks/__internal__/u
|
|
|
11
11
|
var _textbox = _interopRequireDefault(require("../../textbox"));
|
|
12
12
|
var _selectText = _interopRequireDefault(require("../__internal__/select-text"));
|
|
13
13
|
var _useLocale = _interopRequireDefault(require("../../../hooks/__internal__/useLocale"));
|
|
14
|
+
var _selectTextboxContext = require("./select-textbox-context");
|
|
14
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
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); }
|
|
16
17
|
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 && {}.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; }
|
|
@@ -109,7 +110,11 @@ const SelectTextbox = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
109
110
|
role: readOnly ? undefined : "combobox"
|
|
110
111
|
};
|
|
111
112
|
const hasStringValue = typeof selectedValue === "string" || Array.isArray(selectedValue) && typeof selectedValue[0] === "string";
|
|
112
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
113
|
+
return /*#__PURE__*/_react.default.createElement(_selectTextboxContext.SelectTextboxContext.Provider, {
|
|
114
|
+
value: {
|
|
115
|
+
isInputInSelect: true
|
|
116
|
+
}
|
|
117
|
+
}, /*#__PURE__*/_react.default.createElement(_textbox.default, _extends({
|
|
113
118
|
"aria-label": ariaLabel,
|
|
114
119
|
"data-element": "select-input",
|
|
115
120
|
inputIcon: "dropdown",
|
|
@@ -127,7 +132,7 @@ const SelectTextbox = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
127
132
|
disabled: disabled,
|
|
128
133
|
readOnly: readOnly,
|
|
129
134
|
size: size
|
|
130
|
-
}, restProps)));
|
|
135
|
+
}, restProps))));
|
|
131
136
|
});
|
|
132
137
|
if (process.env.NODE_ENV !== "production") {
|
|
133
138
|
SelectTextbox.propTypes = {
|
|
@@ -4,7 +4,8 @@ declare type StyledSplitButtonToggleProps = {
|
|
|
4
4
|
displayed: boolean;
|
|
5
5
|
size: "small" | "medium" | "large";
|
|
6
6
|
};
|
|
7
|
-
declare const StyledSplitButtonToggle: import("styled-components").StyledComponent<"button", any, import("styled-system").SpaceProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol> & import("../button").ButtonProps & {
|
|
7
|
+
declare const StyledSplitButtonToggle: import("styled-components").StyledComponent<"button", any, import("styled-system").SpaceProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol> & Omit<import("../button").ButtonProps, "buttonType"> & {
|
|
8
8
|
iconOnly?: boolean | undefined;
|
|
9
|
+
buttonType: import("../button/button.component").ButtonTypes;
|
|
9
10
|
} & StyledSplitButtonToggleProps, never>;
|
|
10
11
|
export default StyledSplitButtonToggle;
|
|
@@ -7,6 +7,7 @@ exports.default = exports.SplitButton = void 0;
|
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _styledComponents = require("styled-components");
|
|
10
|
+
var _dom = require("@floating-ui/dom");
|
|
10
11
|
var _useClickAwayListener = _interopRequireDefault(require("../../hooks/__internal__/useClickAwayListener"));
|
|
11
12
|
var _icon = _interopRequireDefault(require("../icon"));
|
|
12
13
|
var _button = _interopRequireDefault(require("../button"));
|
|
@@ -50,15 +51,14 @@ const SplitButton = ({
|
|
|
50
51
|
showButtons,
|
|
51
52
|
hideButtons,
|
|
52
53
|
buttonNode,
|
|
53
|
-
hideButtonsIfTriggerNotFocused,
|
|
54
54
|
handleToggleButtonKeyDown,
|
|
55
55
|
wrapperProps,
|
|
56
56
|
contextValue
|
|
57
57
|
} = (0, _useChildButtons.default)(toggleButton, CONTENT_WIDTH_RATIO);
|
|
58
58
|
const mainButtonProps = {
|
|
59
|
-
onMouseEnter:
|
|
60
|
-
onFocus:
|
|
61
|
-
onTouchStart:
|
|
59
|
+
onMouseEnter: hideButtons,
|
|
60
|
+
onFocus: hideButtons,
|
|
61
|
+
onTouchStart: hideButtons,
|
|
62
62
|
iconPosition,
|
|
63
63
|
buttonType,
|
|
64
64
|
disabled,
|
|
@@ -73,12 +73,9 @@ const SplitButton = ({
|
|
|
73
73
|
displayed: showAdditionalButtons,
|
|
74
74
|
onTouchStart: showButtons,
|
|
75
75
|
onKeyDown: handleToggleButtonKeyDown,
|
|
76
|
+
onClick: showButtons,
|
|
76
77
|
buttonType,
|
|
77
|
-
size
|
|
78
|
-
...(!disabled && {
|
|
79
|
-
onMouseEnter: showButtons,
|
|
80
|
-
onClick: showButtons
|
|
81
|
-
})
|
|
78
|
+
size
|
|
82
79
|
};
|
|
83
80
|
function componentTags() {
|
|
84
81
|
return {
|
|
@@ -118,7 +115,10 @@ const SplitButton = ({
|
|
|
118
115
|
if (!showAdditionalButtons) return null;
|
|
119
116
|
return /*#__PURE__*/_react.default.createElement(_popover.default, {
|
|
120
117
|
placement: "bottom-end",
|
|
121
|
-
reference: buttonNode
|
|
118
|
+
reference: buttonNode,
|
|
119
|
+
middleware: [(0, _dom.offset)(6), (0, _dom.flip)({
|
|
120
|
+
fallbackStrategy: "initialPlacement"
|
|
121
|
+
})]
|
|
122
122
|
}, /*#__PURE__*/_react.default.createElement(_splitButtonChildren.default, _extends({}, wrapperProps, {
|
|
123
123
|
align: align
|
|
124
124
|
}), /*#__PURE__*/_react.default.createElement(_splitButton2.default.Provider, {
|
|
@@ -128,7 +128,6 @@ const SplitButton = ({
|
|
|
128
128
|
const handleClick = (0, _useClickAwayListener.default)(hideButtons);
|
|
129
129
|
const marginProps = (0, _utils.filterStyledSystemMarginProps)(rest);
|
|
130
130
|
return /*#__PURE__*/_react.default.createElement(_splitButton.default, _extends({
|
|
131
|
-
onMouseLeave: hideButtonsIfTriggerNotFocused,
|
|
132
131
|
onClick: handleClick,
|
|
133
132
|
ref: buttonNode
|
|
134
133
|
}, componentTags(), marginProps), renderMainButton(), renderAdditionalButtons());
|
|
@@ -4,7 +4,6 @@ declare const useChildButtons: (toggleButtonRef: React.RefObject<HTMLButtonEleme
|
|
|
4
4
|
showButtons: () => void;
|
|
5
5
|
hideButtons: () => void;
|
|
6
6
|
buttonNode: import("react").RefObject<HTMLDivElement>;
|
|
7
|
-
hideButtonsIfTriggerNotFocused: () => void;
|
|
8
7
|
handleToggleButtonKeyDown: (ev: React.KeyboardEvent<HTMLButtonElement>) => void;
|
|
9
8
|
wrapperProps: {
|
|
10
9
|
"data-element": string;
|
|
@@ -48,10 +48,6 @@ const useChildButtons = (toggleButtonRef, widthRatio = 1) => {
|
|
|
48
48
|
hideButtons();
|
|
49
49
|
toggleButtonRef.current?.focus();
|
|
50
50
|
};
|
|
51
|
-
const hideButtonsIfTriggerNotFocused = (0, _react.useCallback)(() => {
|
|
52
|
-
if (toggleButtonRef.current === document.activeElement) return;
|
|
53
|
-
setShowAdditionalButtons(false);
|
|
54
|
-
}, [toggleButtonRef]);
|
|
55
51
|
const wrapperProps = {
|
|
56
52
|
"data-element": "additional-buttons",
|
|
57
53
|
role: "list",
|
|
@@ -68,7 +64,6 @@ const useChildButtons = (toggleButtonRef, widthRatio = 1) => {
|
|
|
68
64
|
showButtons,
|
|
69
65
|
hideButtons,
|
|
70
66
|
buttonNode,
|
|
71
|
-
hideButtonsIfTriggerNotFocused,
|
|
72
67
|
handleToggleButtonKeyDown,
|
|
73
68
|
wrapperProps,
|
|
74
69
|
contextValue
|