carbon-react 115.0.1 → 115.0.2
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/components/multi-action-button/multi-action-button.component.d.ts +1 -1
- package/esm/components/multi-action-button/multi-action-button.component.js +13 -3
- package/esm/components/pages/pages.component.d.ts +0 -2
- package/esm/components/pages/pages.component.js +0 -1
- package/esm/components/split-button/split-button.component.js +2 -2
- package/lib/components/multi-action-button/multi-action-button.component.d.ts +1 -1
- package/lib/components/multi-action-button/multi-action-button.component.js +13 -3
- package/lib/components/pages/pages.component.d.ts +0 -2
- package/lib/components/pages/pages.component.js +0 -1
- package/lib/components/split-button/split-button.component.js +2 -2
- package/package.json +1 -1
|
@@ -7,5 +7,5 @@ export interface MultiActionButtonProps extends WidthProps, Omit<SplitButtonProp
|
|
|
7
7
|
/** Second text child, renders under main text, only when size is "large" */
|
|
8
8
|
subtext?: string;
|
|
9
9
|
}
|
|
10
|
-
export declare const MultiActionButton: ({ align, disabled, buttonType, size, children, text, subtext, width, "data-element": dataElement, "data-role": dataRole, ...rest }: MultiActionButtonProps) => JSX.Element;
|
|
10
|
+
export declare const MultiActionButton: ({ align, disabled, buttonType, size, children, text, subtext, width, onClick, "data-element": dataElement, "data-role": dataRole, ...rest }: MultiActionButtonProps) => JSX.Element;
|
|
11
11
|
export default MultiActionButton;
|
|
@@ -19,6 +19,7 @@ const MultiActionButton = ({
|
|
|
19
19
|
text,
|
|
20
20
|
subtext,
|
|
21
21
|
width,
|
|
22
|
+
onClick,
|
|
22
23
|
"data-element": dataElement,
|
|
23
24
|
"data-role": dataRole,
|
|
24
25
|
...rest
|
|
@@ -85,11 +86,23 @@ const MultiActionButton = ({
|
|
|
85
86
|
}
|
|
86
87
|
};
|
|
87
88
|
|
|
89
|
+
const handleInsideClick = useClickAwayListener(hideButtons);
|
|
90
|
+
|
|
91
|
+
const handleClick = ev => {
|
|
92
|
+
showButtons();
|
|
93
|
+
handleInsideClick();
|
|
94
|
+
|
|
95
|
+
if (onClick) {
|
|
96
|
+
onClick(ev);
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
|
|
88
100
|
const mainButtonProps = {
|
|
89
101
|
disabled,
|
|
90
102
|
displayed: showAdditionalButtons,
|
|
91
103
|
onTouchStart: showButtons,
|
|
92
104
|
onKeyDown: handleMainButtonKeyDown,
|
|
105
|
+
onClick: handleClick,
|
|
93
106
|
buttonType,
|
|
94
107
|
size,
|
|
95
108
|
subtext,
|
|
@@ -112,16 +125,13 @@ const MultiActionButton = ({
|
|
|
112
125
|
onKeyDown: handleKeyDown
|
|
113
126
|
}, childrenWithProps()));
|
|
114
127
|
|
|
115
|
-
const handleClick = useClickAwayListener(hideButtons);
|
|
116
128
|
const hideButtonsIfTriggerNotFocused = useCallback(() => {
|
|
117
129
|
if (buttonRef.current === document.activeElement) return;
|
|
118
130
|
setShowAdditionalButtons(false);
|
|
119
131
|
}, []);
|
|
120
132
|
const marginProps = filterStyledSystemMarginProps(rest);
|
|
121
133
|
return /*#__PURE__*/React.createElement(StyledMultiActionButton, _extends({
|
|
122
|
-
"aria-haspopup": "true",
|
|
123
134
|
onMouseLeave: hideButtonsIfTriggerNotFocused,
|
|
124
|
-
onClick: handleClick,
|
|
125
135
|
ref: ref,
|
|
126
136
|
"data-component": "multi-action-button",
|
|
127
137
|
"data-element": dataElement,
|
|
@@ -2,8 +2,6 @@ import React from "react";
|
|
|
2
2
|
import Page from "./page";
|
|
3
3
|
import { ThemeObject } from "../../style/themes/base";
|
|
4
4
|
export interface PagesProps {
|
|
5
|
-
/** [legacy] Custom className */
|
|
6
|
-
className?: string;
|
|
7
5
|
/** The selected tab on page load */
|
|
8
6
|
initialpageIndex?: number | string;
|
|
9
7
|
/** The current page's index */
|
|
@@ -86,7 +86,6 @@ const Pages = ({
|
|
|
86
86
|
|
|
87
87
|
Pages.propTypes = {
|
|
88
88
|
"children": PropTypes.node,
|
|
89
|
-
"className": PropTypes.string,
|
|
90
89
|
"initialpageIndex": PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
91
90
|
"pageIndex": PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
92
91
|
"theme": PropTypes.shape({
|
|
@@ -95,7 +95,8 @@ const SplitButton = ({
|
|
|
95
95
|
buttonType,
|
|
96
96
|
size,
|
|
97
97
|
...(!disabled && {
|
|
98
|
-
onMouseEnter: showButtons
|
|
98
|
+
onMouseEnter: showButtons,
|
|
99
|
+
onClick: showButtons
|
|
99
100
|
})
|
|
100
101
|
};
|
|
101
102
|
|
|
@@ -175,7 +176,6 @@ const SplitButton = ({
|
|
|
175
176
|
const handleClick = useClickAwayListener(hideButtons);
|
|
176
177
|
const marginProps = filterStyledSystemMarginProps(rest);
|
|
177
178
|
return /*#__PURE__*/React.createElement(StyledSplitButton, _extends({
|
|
178
|
-
"aria-haspopup": "true",
|
|
179
179
|
onMouseLeave: hideButtonsIfTriggerNotFocused,
|
|
180
180
|
onClick: handleClick,
|
|
181
181
|
ref: splitButtonNode
|
|
@@ -7,5 +7,5 @@ export interface MultiActionButtonProps extends WidthProps, Omit<SplitButtonProp
|
|
|
7
7
|
/** Second text child, renders under main text, only when size is "large" */
|
|
8
8
|
subtext?: string;
|
|
9
9
|
}
|
|
10
|
-
export declare const MultiActionButton: ({ align, disabled, buttonType, size, children, text, subtext, width, "data-element": dataElement, "data-role": dataRole, ...rest }: MultiActionButtonProps) => JSX.Element;
|
|
10
|
+
export declare const MultiActionButton: ({ align, disabled, buttonType, size, children, text, subtext, width, onClick, "data-element": dataElement, "data-role": dataRole, ...rest }: MultiActionButtonProps) => JSX.Element;
|
|
11
11
|
export default MultiActionButton;
|
|
@@ -40,6 +40,7 @@ const MultiActionButton = ({
|
|
|
40
40
|
text,
|
|
41
41
|
subtext,
|
|
42
42
|
width,
|
|
43
|
+
onClick,
|
|
43
44
|
"data-element": dataElement,
|
|
44
45
|
"data-role": dataRole,
|
|
45
46
|
...rest
|
|
@@ -106,11 +107,23 @@ const MultiActionButton = ({
|
|
|
106
107
|
}
|
|
107
108
|
};
|
|
108
109
|
|
|
110
|
+
const handleInsideClick = (0, _useClickAwayListener.default)(hideButtons);
|
|
111
|
+
|
|
112
|
+
const handleClick = ev => {
|
|
113
|
+
showButtons();
|
|
114
|
+
handleInsideClick();
|
|
115
|
+
|
|
116
|
+
if (onClick) {
|
|
117
|
+
onClick(ev);
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
|
|
109
121
|
const mainButtonProps = {
|
|
110
122
|
disabled,
|
|
111
123
|
displayed: showAdditionalButtons,
|
|
112
124
|
onTouchStart: showButtons,
|
|
113
125
|
onKeyDown: handleMainButtonKeyDown,
|
|
126
|
+
onClick: handleClick,
|
|
114
127
|
buttonType,
|
|
115
128
|
size,
|
|
116
129
|
subtext,
|
|
@@ -133,16 +146,13 @@ const MultiActionButton = ({
|
|
|
133
146
|
onKeyDown: handleKeyDown
|
|
134
147
|
}, childrenWithProps()));
|
|
135
148
|
|
|
136
|
-
const handleClick = (0, _useClickAwayListener.default)(hideButtons);
|
|
137
149
|
const hideButtonsIfTriggerNotFocused = (0, _react.useCallback)(() => {
|
|
138
150
|
if (buttonRef.current === document.activeElement) return;
|
|
139
151
|
setShowAdditionalButtons(false);
|
|
140
152
|
}, []);
|
|
141
153
|
const marginProps = (0, _utils.filterStyledSystemMarginProps)(rest);
|
|
142
154
|
return /*#__PURE__*/_react.default.createElement(_multiActionButton.StyledMultiActionButton, _extends({
|
|
143
|
-
"aria-haspopup": "true",
|
|
144
155
|
onMouseLeave: hideButtonsIfTriggerNotFocused,
|
|
145
|
-
onClick: handleClick,
|
|
146
156
|
ref: ref,
|
|
147
157
|
"data-component": "multi-action-button",
|
|
148
158
|
"data-element": dataElement,
|
|
@@ -2,8 +2,6 @@ import React from "react";
|
|
|
2
2
|
import Page from "./page";
|
|
3
3
|
import { ThemeObject } from "../../style/themes/base";
|
|
4
4
|
export interface PagesProps {
|
|
5
|
-
/** [legacy] Custom className */
|
|
6
|
-
className?: string;
|
|
7
5
|
/** The selected tab on page load */
|
|
8
6
|
initialpageIndex?: number | string;
|
|
9
7
|
/** The current page's index */
|
|
@@ -113,7 +113,6 @@ const Pages = ({
|
|
|
113
113
|
|
|
114
114
|
Pages.propTypes = {
|
|
115
115
|
"children": _propTypes.default.node,
|
|
116
|
-
"className": _propTypes.default.string,
|
|
117
116
|
"initialpageIndex": _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
118
117
|
"pageIndex": _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
119
118
|
"theme": _propTypes.default.shape({
|
|
@@ -124,7 +124,8 @@ const SplitButton = ({
|
|
|
124
124
|
buttonType,
|
|
125
125
|
size,
|
|
126
126
|
...(!disabled && {
|
|
127
|
-
onMouseEnter: showButtons
|
|
127
|
+
onMouseEnter: showButtons,
|
|
128
|
+
onClick: showButtons
|
|
128
129
|
})
|
|
129
130
|
};
|
|
130
131
|
|
|
@@ -204,7 +205,6 @@ const SplitButton = ({
|
|
|
204
205
|
const handleClick = (0, _useClickAwayListener.default)(hideButtons);
|
|
205
206
|
const marginProps = (0, _utils.filterStyledSystemMarginProps)(rest);
|
|
206
207
|
return /*#__PURE__*/_react.default.createElement(_splitButton.default, _extends({
|
|
207
|
-
"aria-haspopup": "true",
|
|
208
208
|
onMouseLeave: hideButtonsIfTriggerNotFocused,
|
|
209
209
|
onClick: handleClick,
|
|
210
210
|
ref: splitButtonNode
|