oolib 2.17.9 → 2.17.10
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.
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
export function ActionMenu({ icon, invert, actions, align, sideEffect }: {
|
|
1
|
+
export function ActionMenu({ icon, invert, actions, align, iconSize, sideEffect }: {
|
|
2
2
|
icon?: string;
|
|
3
3
|
invert: any;
|
|
4
4
|
actions: any;
|
|
5
5
|
align?: string;
|
|
6
|
+
iconSize?: string;
|
|
6
7
|
sideEffect: any;
|
|
7
8
|
}): JSX.Element;
|
|
@@ -43,11 +43,11 @@ var styled_1 = require("./styled");
|
|
|
43
43
|
var ActionMenu = function (_a) {
|
|
44
44
|
var _b, _c;
|
|
45
45
|
var _d = _a.icon, icon = _d === void 0 ? 'DotsThree' : _d, //most likely will never change
|
|
46
|
-
invert = _a.invert, actions = _a.actions, _e = _a.align, align = _e === void 0 ? 'right' : _e, sideEffect = _a.sideEffect // if you want this click to trigger a sideeffect in parent. e.g in table elem we set table overflow to unset when action menu is open
|
|
46
|
+
invert = _a.invert, actions = _a.actions, _e = _a.align, align = _e === void 0 ? 'right' : _e, _f = _a.iconSize, iconSize = _f === void 0 ? 'S' : _f, sideEffect = _a.sideEffect // if you want this click to trigger a sideeffect in parent. e.g in table elem we set table overflow to unset when action menu is open
|
|
47
47
|
;
|
|
48
48
|
var actionMenuRef = (0, react_1.useRef)(null);
|
|
49
49
|
var optionsWrapperRef = (0, react_1.useRef)(null);
|
|
50
|
-
var
|
|
50
|
+
var _g = (0, react_1.useState)(false), showActions = _g[0], setShowActions = _g[1];
|
|
51
51
|
(0, utils_1.useTrackFocus)(actionMenuRef, setShowActions);
|
|
52
52
|
(0, react_1.useEffect)(function () {
|
|
53
53
|
sideEffect && sideEffect(showActions);
|
|
@@ -56,7 +56,7 @@ var ActionMenu = function (_a) {
|
|
|
56
56
|
return null;
|
|
57
57
|
var getOpsRect = function () { var _a; return (_a = optionsWrapperRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect(); };
|
|
58
58
|
return (react_1.default.createElement(styled_1.StyledActionMenu, { ref: actionMenuRef },
|
|
59
|
-
react_1.default.createElement(Buttons_1.ButtonGhost, { icon: icon, iconSize:
|
|
59
|
+
react_1.default.createElement(Buttons_1.ButtonGhost, { icon: icon, iconSize: iconSize, invert: invert, onClick: function (e) {
|
|
60
60
|
e.stopPropagation();
|
|
61
61
|
setShowActions(!showActions);
|
|
62
62
|
}, active: showActions }),
|
|
@@ -51,8 +51,10 @@ var ButtonStyledWrapper = function (_a) {
|
|
|
51
51
|
var displayText = (link === null || link === void 0 ? void 0 : link.displayText) || children || value;
|
|
52
52
|
var composition = (icon || iconAfter) && displayText
|
|
53
53
|
? "icon+text"
|
|
54
|
-
: !displayText
|
|
55
|
-
|
|
54
|
+
: !displayText
|
|
55
|
+
? "iconOnly"
|
|
56
|
+
: "textOnly";
|
|
57
|
+
var size = ['icon+text', 'textOnly'].indexOf(composition) !== -1
|
|
56
58
|
? (S && 'S') || 'M' //icon+text defaults to 'M'
|
|
57
59
|
: (M && 'M') || 'S'; //iconOnly defaults to 'S'
|
|
58
60
|
/**
|