@ansible/ansible-ui-framework 0.0.401 → 0.0.403

Sign up to get free protection for your applications and to get access to all the features.
@@ -18,7 +18,7 @@ export declare function PageActions<T extends object>(props: {
18
18
  */
19
19
  wrapper?: ComponentClass | FunctionComponent;
20
20
  /** When to collapse the primary and secondary items into the dropdown menu */
21
- collapse?: WindowSize | 'always';
21
+ collapse?: WindowSize | 'always' | 'never';
22
22
  /** The position for the dropdown */
23
23
  position?: DropdownPosition;
24
24
  /** Indicates if only to show the icon when not collapsed */
@@ -26,8 +26,8 @@ var PagePinnedActions_1 = require("./PagePinnedActions");
26
26
  function PageActions(props) {
27
27
  var _a;
28
28
  var actions = props.actions, selectedItem = props.selectedItem, selectedItems = props.selectedItems, iconOnly = props.iconOnly;
29
- var collapseBreakpoint = (0, useBreakPoint_1.useBreakpoint)(props.collapse !== 'always' ? (_a = props.collapse) !== null && _a !== void 0 ? _a : 'lg' : 'lg');
30
- var collapseButtons = props.collapse === 'always' || !collapseBreakpoint;
29
+ var collapseBreakpoint = (0, useBreakPoint_1.useBreakpoint)(props.collapse !== 'never' && props.collapse !== 'always' ? (_a = props.collapse) !== null && _a !== void 0 ? _a : 'lg' : 'lg');
30
+ var collapseButtons = props.collapse !== 'never' && (props.collapse === 'always' || !collapseBreakpoint);
31
31
  /** Actions that are visible */
32
32
  var visibleActions = (0, react_1.useMemo)(function () { return actions.filter(function (action) { return !isHiddenAction(action, selectedItem); }); }, [actions, selectedItem]);
33
33
  /** Actions that show up outside the dropdown */
@@ -5,4 +5,5 @@ export declare function PageButtonAction(props: {
5
5
  /** Turn primary buttons to secondary if there are items selected */
6
6
  isSecondary?: boolean;
7
7
  wrapper?: ComponentClass | FunctionComponent;
8
+ iconOnly?: boolean;
8
9
  }): JSX.Element;
@@ -16,19 +16,22 @@ var jsx_runtime_1 = require("react/jsx-runtime");
16
16
  var react_core_1 = require("@patternfly/react-core");
17
17
  var react_1 = require("react");
18
18
  function PageButtonAction(props) {
19
- var _a;
19
+ var _a, _b;
20
20
  var action = props.action, isSecondary = props.isSecondary, wrapper = props.wrapper;
21
21
  var Wrapper = wrapper !== null && wrapper !== void 0 ? wrapper : react_1.Fragment;
22
22
  var Icon = action.icon;
23
- var tooltip = action.tooltip;
23
+ var tooltip = ((_a = action.tooltip) !== null && _a !== void 0 ? _a : props.iconOnly) ? props.action.label : undefined;
24
24
  var isDisabled = false;
25
- var variant = (_a = action.variant) !== null && _a !== void 0 ? _a : react_core_1.ButtonVariant.secondary;
25
+ var variant = (_b = action.variant) !== null && _b !== void 0 ? _b : react_core_1.ButtonVariant.secondary;
26
26
  if (isSecondary && [react_core_1.ButtonVariant.primary, react_core_1.ButtonVariant.danger].includes(variant)) {
27
27
  variant = react_core_1.ButtonVariant.secondary;
28
28
  }
29
29
  if (variant === react_core_1.ButtonVariant.primary && action.isDanger) {
30
30
  variant = react_core_1.ButtonVariant.danger;
31
31
  }
32
- return ((0, jsx_runtime_1.jsx)(Wrapper, { children: (0, jsx_runtime_1.jsx)(react_core_1.Tooltip, __assign({ content: tooltip, trigger: tooltip ? undefined : 'manual' }, { children: (0, jsx_runtime_1.jsx)(react_core_1.Button, __assign({ variant: variant, isDanger: action.isDanger, icon: Icon ? ((0, jsx_runtime_1.jsx)("span", __assign({ style: { paddingRight: 4 } }, { children: (0, jsx_runtime_1.jsx)(Icon, {}) }))) : undefined, isAriaDisabled: isDisabled, onClick: action.onClick }, { children: action.shortLabel ? action.shortLabel : action.label })) })) }));
32
+ if (props.iconOnly) {
33
+ variant = react_core_1.ButtonVariant.plain;
34
+ }
35
+ return ((0, jsx_runtime_1.jsx)(Wrapper, { children: (0, jsx_runtime_1.jsx)(react_core_1.Tooltip, __assign({ content: tooltip, trigger: tooltip ? undefined : 'manual' }, { children: (0, jsx_runtime_1.jsx)(react_core_1.Button, __assign({ id: props.action.label.toLowerCase().split(' ').join('-'), variant: variant, isDanger: action.isDanger, icon: Icon ? ((0, jsx_runtime_1.jsx)("span", __assign({ style: { paddingRight: 4 } }, { children: (0, jsx_runtime_1.jsx)(Icon, {}) }))) : undefined, isAriaDisabled: isDisabled, onClick: action.onClick }, { children: props.iconOnly && Icon ? (0, jsx_runtime_1.jsx)(Icon, {}) : action.shortLabel ? action.shortLabel : action.label })) })) }));
33
36
  }
34
37
  exports.PageButtonAction = PageButtonAction;
@@ -42,9 +42,7 @@ function PagePinnedAction(props) {
42
42
  }
43
43
  case PageActionType_1.PageActionType.button: {
44
44
  return ((0, jsx_runtime_1.jsx)(PageButtonAction_1.PageButtonAction, { action: action, isSecondary: (selectedItems !== undefined && selectedItems.length !== 0) ||
45
- selectedItem !== undefined,
46
- // iconOnly={props.iconOnly}
47
- wrapper: wrapper }));
45
+ selectedItem !== undefined, iconOnly: props.iconOnly, wrapper: wrapper }));
48
46
  }
49
47
  case PageActionType_1.PageActionType.dropdown: {
50
48
  var tooltip = action.label;
@@ -13,5 +13,5 @@ import { ReactNode } from 'react';
13
13
  * <Page>
14
14
  */
15
15
  export declare function PageLayout(props: {
16
- children: ReactNode;
16
+ children?: ReactNode;
17
17
  }): JSX.Element;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ansible/ansible-ui-framework",
3
3
  "description": "A framework for building applications using PatternFly.",
4
- "version": "0.0.401",
4
+ "version": "0.0.403",
5
5
  "author": "Red Hat",
6
6
  "license": "MIT",
7
7
  "repository": {