@ansible/ansible-ui-framework 0.0.276 → 0.0.278

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.
@@ -17,7 +17,12 @@ export declare function BulkActionDialog<T extends object>(props: {
17
17
  pendingText?: string;
18
18
  isDanger?: boolean;
19
19
  items: T[];
20
+ /** These are the columns shown when confirming the bulk actions. */
20
21
  columns: ITableColumn<T>[];
22
+ /**
23
+ * These are the columns shown when processing the bulk actions plus an error column.
24
+ * @note This is usually the name column, unless the name column is not unique enough to identify the item.
25
+ */
21
26
  errorColumns: ITableColumn<T>[];
22
27
  keyFn: (item: T) => string | number;
23
28
  action: (item: T) => Promise<void>;
@@ -1,4 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
- export declare function PageFrameworkProvider(props: {
2
+ export declare function PageFramework(props: {
3
3
  children: ReactNode;
4
+ navigate?: (to: string) => void;
4
5
  }): JSX.Element;
@@ -1,12 +1,24 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
2
13
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PageFrameworkProvider = void 0;
14
+ exports.PageFramework = void 0;
4
15
  var jsx_runtime_1 = require("react/jsx-runtime");
16
+ var usePageNavigate_1 = require("./components/usePageNavigate");
5
17
  var PageAlertToaster_1 = require("./PageAlertToaster");
6
18
  var PageDialog_1 = require("./PageDialog");
7
19
  var Settings_1 = require("./Settings");
8
20
  var useFrameworkTranslations_1 = require("./useFrameworkTranslations");
9
- function PageFrameworkProvider(props) {
10
- return ((0, jsx_runtime_1.jsx)(useFrameworkTranslations_1.FrameworkTranslationsProvider, { children: (0, jsx_runtime_1.jsx)(Settings_1.SettingsProvider, { children: (0, jsx_runtime_1.jsx)(PageDialog_1.PageDialogProvider, { children: (0, jsx_runtime_1.jsx)(PageAlertToaster_1.PageAlertToasterProvider, { children: props.children }) }) }) }));
21
+ function PageFramework(props) {
22
+ return ((0, jsx_runtime_1.jsx)(useFrameworkTranslations_1.FrameworkTranslationsProvider, { children: (0, jsx_runtime_1.jsx)(Settings_1.SettingsProvider, { children: (0, jsx_runtime_1.jsx)(PageDialog_1.PageDialogProvider, { children: (0, jsx_runtime_1.jsx)(PageAlertToaster_1.PageAlertToasterProvider, { children: (0, jsx_runtime_1.jsx)(usePageNavigate_1.PageNavigateCallbackContextProvider, __assign({ callback: props.navigate }, { children: props.children })) }) }) }) }));
11
23
  }
12
- exports.PageFrameworkProvider = PageFrameworkProvider;
24
+ exports.PageFramework = PageFramework;
@@ -73,5 +73,6 @@ export interface ITableColumn<T extends object> {
73
73
  card?: 'description' | 'hidden';
74
74
  list?: 'primary' | 'secondary';
75
75
  hideLabel?: boolean;
76
+ primary?: boolean;
76
77
  }
77
78
  export {};
package/cjs/PageTable.js CHANGED
@@ -148,12 +148,14 @@ function TableHead(props) {
148
148
  }, stickyMinWidth: "45px", hasRightBorder: props.scrollLeft }, { children: "\u00A0" }))), columns
149
149
  .filter(function (column) { return column.enabled !== false; })
150
150
  .map(function (column, index) {
151
+ var _a;
151
152
  return ((0, jsx_runtime_1.jsx)(react_table_1.Th, __assign({ modifier: "fitContent", style: {
152
- minWidth: column.minWidth,
153
+ minWidth: (_a = column.minWidth) !== null && _a !== void 0 ? _a : 0,
153
154
  maxWidth: column.maxWidth,
154
155
  backgroundColor: settings.theme === 'dark'
155
156
  ? 'var(--pf-global--BackgroundColor--300)'
156
157
  : undefined,
158
+ width: index === 0 ? '0%' : undefined,
157
159
  }, sort: getColumnSort(index, column) }, { children: column.header }), column.header));
158
160
  }), itemActions !== undefined && ((0, jsx_runtime_1.jsx)(react_table_1.Th, __assign({ style: {
159
161
  paddingRight: 8,
@@ -1,5 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
- import { LabelColor } from './components/patternfly-colors';
2
+ import { LabelColor } from './components/pfcolors';
3
3
  import { ITableColumn } from './PageTable';
4
4
  import { ITypedAction } from './TypedActions';
5
5
  export interface IPageTableCard {
@@ -59,8 +59,10 @@ function PageTableCard(props) {
59
59
  exports.PageTableCard = PageTableCard;
60
60
  function useColumnsToTableCardFn(columns, keyFn) {
61
61
  var cardData = (0, react_1.useMemo)(function () {
62
+ var _a;
62
63
  var cols = columns.filter(function (column) { return column.card !== 'hidden'; });
63
- var nameColumn = cols.shift();
64
+ var nameColumn = (_a = cols.find(function (column) { return column.primary; })) !== null && _a !== void 0 ? _a : cols[0];
65
+ cols = cols.filter(function (column) { return column !== nameColumn; });
64
66
  var descriptionColumn = cols.find(function (column) { return column.card === 'description'; });
65
67
  if (descriptionColumn) {
66
68
  cols = cols.filter(function (column) { return column !== descriptionColumn; });
@@ -24,8 +24,10 @@ function PageTableList(props) {
24
24
  exports.PageTableList = PageTableList;
25
25
  function useColumnsToDataList(tableColumns, keyFn, isSelected, selectItem, unselectItem, rowActions, defaultCardSubtitle, showSelect) {
26
26
  var data = (0, react_1.useMemo)(function () {
27
+ var _a;
27
28
  var cols = tableColumns.filter(function (column) { return column.card !== 'hidden'; });
28
- var nameColumn = cols.shift();
29
+ var nameColumn = (_a = cols.find(function (column) { return column.primary; })) !== null && _a !== void 0 ? _a : cols[0];
30
+ cols = cols.filter(function (column) { return column !== nameColumn; });
29
31
  var descriptionColumn = cols.find(function (column) { return column.card === 'description'; });
30
32
  if (descriptionColumn) {
31
33
  cols = cols.filter(function (column) { return column !== descriptionColumn; });
@@ -50,17 +52,17 @@ function useColumnsToDataList(tableColumns, keyFn, isSelected, selectItem, unsel
50
52
  var key = keyFn(item);
51
53
  var isItemSelected = isSelected === null || isSelected === void 0 ? void 0 : isSelected(item);
52
54
  return ((0, jsx_runtime_1.jsx)(react_core_1.DataListItem, __assign({ "aria-labelledby": "data-list-".concat(key), isExpanded: isItemSelected }, { children: (0, jsx_runtime_1.jsxs)(react_core_1.DataListItemRow, { children: [showSelect && ((0, jsx_runtime_1.jsx)(react_core_1.DataListCheck, { "aria-labelledby": "data-list-check-".concat(key), name: "data-list-check-".concat(key), isChecked: isSelected === null || isSelected === void 0 ? void 0 : isSelected(item), onClick: function () { return onSelectClick(item); } })), (0, jsx_runtime_1.jsx)(react_core_1.DataListItemCells, { dataListCells: [
53
- (0, jsx_runtime_1.jsx)(react_core_1.DataListCell, { children: (0, jsx_runtime_1.jsx)(react_core_1.Flex, { children: (0, jsx_runtime_1.jsxs)(react_core_1.Stack, __assign({ hasGutter: true }, { children: [(0, jsx_runtime_1.jsxs)(react_core_1.Stack, { children: [(0, jsx_runtime_1.jsx)(react_core_1.Title, __assign({ headingLevel: "h2", style: { marginTop: -4 } }, { children: (0, jsx_runtime_1.jsx)("span", __assign({ id: "data-list-".concat(key) }, { children: (_a = data.nameColumn) === null || _a === void 0 ? void 0 : _a.cell(item) })) })), data.descriptionColumn ? ((0, jsx_runtime_1.jsx)(react_core_1.Text, __assign({ component: "small", style: { opacity: 0.7 } }, { children: data.descriptionColumn.cell(item) }))) : (defaultCardSubtitle && ((0, jsx_runtime_1.jsx)(react_core_1.Text, __assign({ component: "small", style: { opacity: 0.7 } }, { children: defaultCardSubtitle }))))] }), (0, jsx_runtime_1.jsx)(react_core_1.DescriptionList, __assign({ isCompact: true }, { children: data.columns.map(function (column) {
55
+ (0, jsx_runtime_1.jsx)(react_core_1.DataListCell, __assign({ width: 5 }, { children: (0, jsx_runtime_1.jsx)(react_core_1.Flex, { children: (0, jsx_runtime_1.jsxs)(react_core_1.Stack, __assign({ hasGutter: true }, { children: [(0, jsx_runtime_1.jsxs)(react_core_1.Stack, { children: [(0, jsx_runtime_1.jsx)(react_core_1.Title, __assign({ headingLevel: "h2", style: { marginTop: -4 } }, { children: (0, jsx_runtime_1.jsx)("span", __assign({ id: "data-list-".concat(key) }, { children: (_a = data.nameColumn) === null || _a === void 0 ? void 0 : _a.cell(item) })) })), data.descriptionColumn ? ((0, jsx_runtime_1.jsx)(react_core_1.Text, __assign({ component: "small", style: { opacity: 0.7 } }, { children: data.descriptionColumn.cell(item) }))) : (defaultCardSubtitle && ((0, jsx_runtime_1.jsx)(react_core_1.Text, __assign({ component: "small", style: { opacity: 0.7 } }, { children: defaultCardSubtitle }))))] }), (0, jsx_runtime_1.jsx)(react_core_1.DescriptionList, __assign({ isCompact: true }, { children: data.columns.map(function (column) {
54
56
  var value = column.cell(item);
55
57
  if (!value)
56
58
  return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
57
- return ((0, jsx_runtime_1.jsxs)(react_core_1.DescriptionListGroup, { children: [!column.hideLabel && ((0, jsx_runtime_1.jsx)(react_core_1.DescriptionListTerm, { children: (0, jsx_runtime_1.jsx)(react_core_1.Text, __assign({ component: "small", style: { opacity: 0.7 } }, { children: column.header })) })), (0, jsx_runtime_1.jsx)(react_core_1.DescriptionListDescription, { children: column.cell(item) })] }, column.header));
58
- }) }))] })) }) }, "primary"),
59
+ return ((0, jsx_runtime_1.jsxs)(react_core_1.DescriptionListGroup, { children: [!column.hideLabel && ((0, jsx_runtime_1.jsx)(react_core_1.DescriptionListTerm, { children: (0, jsx_runtime_1.jsx)(react_core_1.Text, __assign({ component: "small", style: { opacity: 0.7, whiteSpace: 'nowrap' } }, { children: column.header })) })), (0, jsx_runtime_1.jsx)(react_core_1.DescriptionListDescription, { children: column.cell(item) })] }, column.header));
60
+ }) }))] })) }) }), "primary"),
59
61
  data.secondary.length > 0 ? ((0, jsx_runtime_1.jsx)(react_core_1.DataListCell, { children: (0, jsx_runtime_1.jsx)(react_core_1.Flex, { children: (0, jsx_runtime_1.jsx)(react_core_1.DescriptionList, __assign({ isCompact: true }, { children: data.secondary.map(function (column) {
60
62
  var value = column.cell(item);
61
63
  if (!value)
62
64
  return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
63
- return ((0, jsx_runtime_1.jsxs)(react_core_1.DescriptionListGroup, { children: [!column.hideLabel && ((0, jsx_runtime_1.jsx)(react_core_1.DescriptionListTerm, { children: (0, jsx_runtime_1.jsx)(react_core_1.Text, __assign({ component: "small", style: { opacity: 0.7 } }, { children: column.header })) })), (0, jsx_runtime_1.jsx)(react_core_1.DescriptionListDescription, { children: column.cell(item) })] }, column.header));
65
+ return ((0, jsx_runtime_1.jsxs)(react_core_1.DescriptionListGroup, { children: [!column.hideLabel && ((0, jsx_runtime_1.jsx)(react_core_1.DescriptionListTerm, { children: (0, jsx_runtime_1.jsx)(react_core_1.Text, __assign({ component: "small", style: { opacity: 0.7, whiteSpace: 'nowrap' } }, { children: column.header })) })), (0, jsx_runtime_1.jsx)(react_core_1.DescriptionListDescription, { children: column.cell(item) })] }, column.header));
64
66
  }) })) }) }, "secondary")) : null,
65
67
  ] }), rowActions && ((0, jsx_runtime_1.jsx)(react_core_1.DataListAction, __assign({ "aria-labelledby": "check-action-item1 check-action-action1", id: "check-action-action1", "aria-label": "Actions", isPlainButtonAction: true, style: { whiteSpace: 'nowrap' } }, { children: (0, jsx_runtime_1.jsx)(TypedActions_1.TypedActions, { actions: rowActions, position: react_core_1.DropdownPosition.right, selectedItem: item }) })))] }) }), key));
66
68
  }, [
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ export declare function ElapsedTimeCell(props: {
3
+ start?: number | string;
4
+ finish?: number | string;
5
+ }): JSX.Element;
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ var __read = (this && this.__read) || function (o, n) {
3
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
4
+ if (!m) return o;
5
+ var i = m.call(o), r, ar = [], e;
6
+ try {
7
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
8
+ }
9
+ catch (error) { e = { error: error }; }
10
+ finally {
11
+ try {
12
+ if (r && !r.done && (m = i["return"])) m.call(i);
13
+ }
14
+ finally { if (e) throw e.error; }
15
+ }
16
+ return ar;
17
+ };
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.ElapsedTimeCell = void 0;
20
+ var jsx_runtime_1 = require("react/jsx-runtime");
21
+ var react_core_1 = require("@patternfly/react-core");
22
+ var react_1 = require("react");
23
+ var react_i18next_1 = require("react-i18next");
24
+ function ElapsedTimeCell(props) {
25
+ var t = (0, react_i18next_1.useTranslation)().t;
26
+ var start = (0, react_1.useMemo)(function () { var _a; return new Date((_a = props.start) !== null && _a !== void 0 ? _a : 0).valueOf(); }, [props.start]);
27
+ var finish = (0, react_1.useMemo)(function () { var _a; return new Date((_a = props.finish) !== null && _a !== void 0 ? _a : 0).valueOf(); }, [props.finish]);
28
+ var _a = __read((0, react_1.useState)(Math.max(0, finish - start.valueOf())), 2), elapsed = _a[0], setElapsed = _a[1];
29
+ (0, react_1.useEffect)(function () {
30
+ var timeout = setInterval(function () {
31
+ if (start) {
32
+ if (!props.finish)
33
+ setElapsed(Math.max(0, Date.now() - start));
34
+ else
35
+ setElapsed(Math.max(0, finish - start));
36
+ }
37
+ }, 1000);
38
+ return function () { return clearTimeout(timeout); };
39
+ }, [start, finish, props.finish]);
40
+ var totalSeconds = Math.floor(elapsed / 1000);
41
+ var seconds = Math.floor(totalSeconds % 60);
42
+ var minutes = Math.floor((totalSeconds / 60) % 60);
43
+ var hours = Math.floor((totalSeconds / 60 / 60) % 24);
44
+ var days = Math.floor(totalSeconds / 60 / 60 / 24);
45
+ if (!start)
46
+ return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
47
+ return ((0, jsx_runtime_1.jsxs)(react_core_1.Split, { children: [days !== 0 && ((0, jsx_runtime_1.jsxs)(react_core_1.SplitItem, { children: [days, t('d'), "\u00A0"] })), hours !== 0 && ((0, jsx_runtime_1.jsxs)(react_core_1.SplitItem, { children: [hours, t('h'), "\u00A0"] })), minutes !== 0 && ((0, jsx_runtime_1.jsxs)(react_core_1.SplitItem, { children: [minutes, t('m'), "\u00A0"] })), (0, jsx_runtime_1.jsxs)(react_core_1.SplitItem, { children: [seconds, t('s')] })] }));
48
+ }
49
+ exports.ElapsedTimeCell = ElapsedTimeCell;
@@ -1,12 +1,13 @@
1
1
  import { ReactNode } from 'react';
2
- import { PatternFlyColor } from '../components/patternfly-colors';
2
+ import { PFColor } from '../components/pfcolors';
3
3
  export interface TextCellProps {
4
4
  icon?: ReactNode;
5
5
  iconSize?: 'sm' | 'md' | 'lg';
6
6
  text?: string;
7
7
  to?: string;
8
8
  onClick?: () => void;
9
- textColor?: PatternFlyColor;
9
+ color?: PFColor;
10
+ iconColor?: PFColor;
10
11
  maxWidth?: number;
11
12
  disableLinks?: boolean;
12
13
  }
@@ -15,17 +15,17 @@ exports.TextCell = void 0;
15
15
  var jsx_runtime_1 = require("react/jsx-runtime");
16
16
  var react_core_1 = require("@patternfly/react-core");
17
17
  var IconWrapper_1 = require("../components/IconWrapper");
18
- var patternfly_colors_1 = require("../components/patternfly-colors");
18
+ var pfcolors_1 = require("../components/pfcolors");
19
19
  var usePageNavigate_1 = require("../components/usePageNavigate");
20
20
  function TextCell(props) {
21
- var _a, _b;
21
+ var _a, _b, _c;
22
22
  var navigate = (0, usePageNavigate_1.usePageNavigate)();
23
- return ((0, jsx_runtime_1.jsxs)(react_core_1.Split, __assign({ style: { maxWidth: '100%' } }, { children: [props.icon && ((0, jsx_runtime_1.jsx)(react_core_1.SplitItem, { children: (0, jsx_runtime_1.jsx)(IconWrapper_1.IconWrapper, __assign({ size: (_a = props.iconSize) !== null && _a !== void 0 ? _a : 'sm' }, { children: props.icon })) })), props.text && ((0, jsx_runtime_1.jsx)(react_core_1.SplitItem, __assign({ style: { maxWidth: '100%' } }, { children: (0, jsx_runtime_1.jsx)("div", __assign({ style: {
24
- maxWidth: (_b = props.maxWidth) !== null && _b !== void 0 ? _b : '100%',
23
+ return ((0, jsx_runtime_1.jsxs)(react_core_1.Split, __assign({ style: { maxWidth: '100%' } }, { children: [props.icon && ((0, jsx_runtime_1.jsx)(react_core_1.SplitItem, { children: (0, jsx_runtime_1.jsx)(IconWrapper_1.IconWrapper, __assign({ size: (_a = props.iconSize) !== null && _a !== void 0 ? _a : 'sm', color: (_b = props.iconColor) !== null && _b !== void 0 ? _b : props.color }, { children: props.icon })) })), props.text && ((0, jsx_runtime_1.jsx)(react_core_1.SplitItem, __assign({ style: { maxWidth: '100%' } }, { children: (0, jsx_runtime_1.jsx)("div", __assign({ style: {
24
+ maxWidth: (_c = props.maxWidth) !== null && _c !== void 0 ? _c : '100%',
25
25
  whiteSpace: 'nowrap',
26
26
  textOverflow: 'ellipsis',
27
27
  overflow: 'hidden',
28
- color: props.textColor ? (0, patternfly_colors_1.getPatternflyColor)(props.textColor) : undefined,
28
+ color: props.color ? (0, pfcolors_1.getPatternflyColor)(props.color) : undefined,
29
29
  } }, { children: !props.disableLinks && (props.to || props.onClick) ? ((0, jsx_runtime_1.jsx)("a", __assign({ href: props.to, onClick: function (e) {
30
30
  e.preventDefault();
31
31
  if (props.onClick) {
@@ -1,8 +1,8 @@
1
1
  import { ReactNode } from 'react';
2
- import { PatternFlyColor } from './patternfly-colors';
2
+ import { PFColor } from './pfcolors';
3
3
  export declare function IconWrapper(props: {
4
4
  children: ReactNode;
5
- color?: PatternFlyColor;
5
+ color?: PFColor;
6
6
  size?: 'sm' | 'md' | 'lg';
7
7
  noPadding?: boolean;
8
8
  }): JSX.Element;
@@ -14,11 +14,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
14
14
  exports.IconWrapper = void 0;
15
15
  var jsx_runtime_1 = require("react/jsx-runtime");
16
16
  var react_1 = require("react");
17
- var patternfly_colors_1 = require("./patternfly-colors");
17
+ var pfcolors_1 = require("./pfcolors");
18
18
  function IconWrapper(props) {
19
19
  var newProps = {};
20
20
  if (props.color) {
21
- newProps.color = (0, patternfly_colors_1.getPatternflyColor)(props.color);
21
+ newProps.color = (0, pfcolors_1.getPatternflyColor)(props.color);
22
22
  }
23
23
  var marginOffset = undefined;
24
24
  var marginRight = undefined;
@@ -1,11 +1,17 @@
1
- export declare enum PatternFlyColor {
1
+ export declare enum PFColorE {
2
2
  Green = "green",
3
+ Success = "success",
3
4
  Blue = "blue",
5
+ Info = "info",
4
6
  Red = "red",
7
+ Danger = "danger",
5
8
  Yellow = "yellow",
6
- Grey = "grey"
9
+ Warning = "warning",
10
+ Grey = "grey",
11
+ Disabled = "disabled"
7
12
  }
8
- export declare function getPatternflyColor(color: PatternFlyColor): "var(--pf-global--success-color--100)" | "var(--pf-global--danger-color--100)" | "var(--pf-global--warning-color--100)" | "var(--pf-global--info-color--100)" | "var(--pf-global--disabled-color--100)" | undefined;
13
+ export type PFColor = 'green' | 'success' | 'blue' | 'info' | 'red' | 'danger' | 'yellow' | 'warning' | 'grey' | 'disabled';
14
+ export declare function getPatternflyColor(color: PFColor): "var(--pf-global--success-color--100)" | "var(--pf-global--danger-color--100)" | "var(--pf-global--warning-color--100)" | "var(--pf-global--info-color--100)" | "var(--pf-global--disabled-color--100)";
9
15
  export declare const pfSuccess = "var(--pf-global--success-color--100)";
10
16
  export declare const pfDanger = "var(--pf-global--danger-color--100)";
11
17
  export declare const pfWarning = "var(--pf-global--warning-color--100)";
@@ -1,28 +1,37 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LabelColorE = exports.pfDisabled = exports.pfInfo = exports.pfWarning = exports.pfDanger = exports.pfSuccess = exports.getPatternflyColor = exports.PatternFlyColor = void 0;
4
- var PatternFlyColor;
5
- (function (PatternFlyColor) {
6
- PatternFlyColor["Green"] = "green";
7
- PatternFlyColor["Blue"] = "blue";
8
- PatternFlyColor["Red"] = "red";
9
- PatternFlyColor["Yellow"] = "yellow";
10
- PatternFlyColor["Grey"] = "grey";
11
- })(PatternFlyColor = exports.PatternFlyColor || (exports.PatternFlyColor = {}));
3
+ exports.LabelColorE = exports.pfDisabled = exports.pfInfo = exports.pfWarning = exports.pfDanger = exports.pfSuccess = exports.getPatternflyColor = exports.PFColorE = void 0;
4
+ var PFColorE;
5
+ (function (PFColorE) {
6
+ PFColorE["Green"] = "green";
7
+ PFColorE["Success"] = "success";
8
+ PFColorE["Blue"] = "blue";
9
+ PFColorE["Info"] = "info";
10
+ PFColorE["Red"] = "red";
11
+ PFColorE["Danger"] = "danger";
12
+ PFColorE["Yellow"] = "yellow";
13
+ PFColorE["Warning"] = "warning";
14
+ PFColorE["Grey"] = "grey";
15
+ PFColorE["Disabled"] = "disabled";
16
+ })(PFColorE = exports.PFColorE || (exports.PFColorE = {}));
12
17
  function getPatternflyColor(color) {
13
18
  switch (color) {
14
19
  case 'green':
20
+ case 'success':
15
21
  return exports.pfSuccess;
16
22
  case 'red':
23
+ case 'danger':
17
24
  return exports.pfDanger;
18
25
  case 'yellow':
26
+ case 'warning':
19
27
  return exports.pfWarning;
20
28
  case 'blue':
29
+ case 'info':
21
30
  return exports.pfInfo;
22
31
  case 'grey':
32
+ case 'disabled':
23
33
  return exports.pfDisabled;
24
34
  }
25
- return undefined;
26
35
  }
27
36
  exports.getPatternflyColor = getPatternflyColor;
28
37
  exports.pfSuccess = 'var(--pf-global--success-color--100)';
@@ -1 +1,6 @@
1
+ import { ReactNode } from 'react';
2
+ export declare function PageNavigateCallbackContextProvider(props: {
3
+ callback?: (url: string) => void;
4
+ children: ReactNode;
5
+ }): JSX.Element;
1
6
  export declare function usePageNavigate(): (to?: string) => void;
@@ -1,16 +1,37 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
2
13
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.usePageNavigate = void 0;
14
+ exports.usePageNavigate = exports.PageNavigateCallbackContextProvider = void 0;
15
+ var jsx_runtime_1 = require("react/jsx-runtime");
4
16
  var react_1 = require("react");
17
+ var PageNavigateCallbackContext = (0, react_1.createContext)(undefined);
18
+ function usePageNavigateCallback() {
19
+ return (0, react_1.useContext)(PageNavigateCallbackContext);
20
+ }
21
+ function PageNavigateCallbackContextProvider(props) {
22
+ return ((0, jsx_runtime_1.jsx)(PageNavigateCallbackContext.Provider, __assign({ value: props.callback }, { children: props.children })));
23
+ }
24
+ exports.PageNavigateCallbackContextProvider = PageNavigateCallbackContextProvider;
5
25
  function usePageNavigate() {
26
+ var pageNavigateCallback = usePageNavigateCallback();
6
27
  var navigate = (0, react_1.useCallback)(function (to) {
7
28
  if (to === null || to === void 0 ? void 0 : to.startsWith('http')) {
8
29
  open(to, '_blank');
9
30
  }
10
31
  else {
11
- open(to, '_self');
32
+ pageNavigateCallback ? pageNavigateCallback(to !== null && to !== void 0 ? to : '') : open(to, '_self');
12
33
  }
13
- }, []);
34
+ }, [pageNavigateCallback]);
14
35
  return navigate;
15
36
  }
16
37
  exports.usePageNavigate = usePageNavigate;
package/cjs/index.d.ts CHANGED
@@ -3,6 +3,7 @@ export * from './cells/BytesCell';
3
3
  export * from './cells/CapacityCell';
4
4
  export * from './cells/CopyCell';
5
5
  export * from './cells/DateTimeCell';
6
+ export * from './cells/ElapsedTimeCell';
6
7
  export * from './cells/LabelsCell';
7
8
  export * from './cells/TextCell';
8
9
  export * from './components/BulkSelector';
@@ -10,7 +11,7 @@ export * from './components/Collapse';
10
11
  export * from './components/Details';
11
12
  export * from './components/Help';
12
13
  export * from './components/icons/RunningIcon';
13
- export * from './components/patternfly-colors';
14
+ export * from './components/pfcolors';
14
15
  export * from './components/Scrollable';
15
16
  export * from './components/useBreakPoint';
16
17
  export * from './PageAlertToaster';
package/cjs/index.js CHANGED
@@ -19,6 +19,7 @@ __exportStar(require("./cells/BytesCell"), exports);
19
19
  __exportStar(require("./cells/CapacityCell"), exports);
20
20
  __exportStar(require("./cells/CopyCell"), exports);
21
21
  __exportStar(require("./cells/DateTimeCell"), exports);
22
+ __exportStar(require("./cells/ElapsedTimeCell"), exports);
22
23
  __exportStar(require("./cells/LabelsCell"), exports);
23
24
  __exportStar(require("./cells/TextCell"), exports);
24
25
  __exportStar(require("./components/BulkSelector"), exports);
@@ -26,7 +27,7 @@ __exportStar(require("./components/Collapse"), exports);
26
27
  __exportStar(require("./components/Details"), exports);
27
28
  __exportStar(require("./components/Help"), exports);
28
29
  __exportStar(require("./components/icons/RunningIcon"), exports);
29
- __exportStar(require("./components/patternfly-colors"), exports);
30
+ __exportStar(require("./components/pfcolors"), exports);
30
31
  __exportStar(require("./components/Scrollable"), exports);
31
32
  __exportStar(require("./components/useBreakPoint"), exports);
32
33
  __exportStar(require("./PageAlertToaster"), exports);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ansible/ansible-ui-framework",
3
3
  "description": "Framework for building consistent responsive web applications using PatternFly.",
4
- "version": "0.0.276",
4
+ "version": "0.0.278",
5
5
  "author": "Red Hat",
6
6
  "license": "MIT",
7
7
  "repository": {