@ansible/ansible-ui-framework 0.0.473 → 0.0.475

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -3,3 +3,21 @@
3
3
  A framework for building applications using [PatternFly](https://www.patternfly.org), developed by the Ansible UI developers.
4
4
 
5
5
  [Documentation](https://github.com/ansible/ansible-ui/wiki/Ansible-UI-Framework)
6
+
7
+ ####Storybook
8
+
9
+ For development you may use Storybook. It allows you to try some of the existing components and develop new ones without running the whole UI.
10
+
11
+ Install dependencies:
12
+
13
+ `npm ci`
14
+
15
+ Build Storybook:
16
+
17
+ `npm run build-storybook`
18
+
19
+ Start Storybook:
20
+
21
+ `npm run storybook`
22
+
23
+ Storybook will run at http://localhost:6006/
@@ -1,11 +1,10 @@
1
1
  import { AlertProps } from '@patternfly/react-core';
2
2
  import { ReactNode } from 'react';
3
- export type AlertToasterProps = AlertProps;
4
3
  export interface IPageAlertToaster {
5
- addAlert: (alert: AlertToasterProps) => void;
6
- removeAlert: (alert: AlertToasterProps) => void;
7
- replaceAlert: (oldAlert: AlertToasterProps, newAlert: AlertToasterProps) => void;
8
- removeAlerts: (filter?: (alert: AlertToasterProps) => boolean) => void;
4
+ addAlert: (alert: AlertProps) => void;
5
+ removeAlert: (alert: AlertProps) => void;
6
+ replaceAlert: (oldAlert: AlertProps, newAlert: AlertProps) => void;
7
+ removeAlerts: (filter?: (alert: AlertProps) => boolean) => void;
9
8
  }
10
9
  export declare const PageAlertToasterContext: import("react").Context<IPageAlertToaster>;
11
10
  export declare function usePageAlertToaster(): IPageAlertToaster;
@@ -65,7 +65,17 @@ function PageAlertToasterProvider(props) {
65
65
  setTimeout(function () { return removeAlert(alert); }, alert.timeout);
66
66
  delete alert.timeout;
67
67
  }
68
- setToasterAlerts(function (alerts) { return __spreadArray(__spreadArray([], __read(alerts), false), [alert], false); });
68
+ setToasterAlerts(function (alerts) {
69
+ var alertIndex = alerts.findIndex(function (a) { return a === alert; });
70
+ if (alertIndex !== -1) {
71
+ var newAlerts = __spreadArray([], __read(alerts), false);
72
+ newAlerts[alertIndex] = alert;
73
+ return newAlerts;
74
+ }
75
+ else {
76
+ return __spreadArray(__spreadArray([], __read(alerts), false), [alert], false);
77
+ }
78
+ });
69
79
  }
70
80
  function replaceAlert(oldAlert, alert) {
71
81
  setToasterAlerts(function (alerts) {
@@ -0,0 +1,14 @@
1
+ import { AlertProps } from '@patternfly/react-core';
2
+ import { ReactNode } from 'react';
3
+ export interface IPageAlerts {
4
+ addAlert: (alert: AlertProps) => void;
5
+ removeAlert: (alert: AlertProps) => void;
6
+ replaceAlert: (oldAlert: AlertProps, newAlert: AlertProps) => void;
7
+ removeAlerts: (filter?: (alert: AlertProps) => boolean) => void;
8
+ }
9
+ export declare const PageAlertsContext: import("react").Context<IPageAlerts>;
10
+ export declare const PageAlertsArrayContext: import("react").Context<AlertProps[]>;
11
+ export declare function usePageAlerts(): IPageAlerts;
12
+ export declare function PageAlertsProvider(props: {
13
+ children: ReactNode;
14
+ }): JSX.Element;
@@ -0,0 +1,98 @@
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
+ };
13
+ var __read = (this && this.__read) || function (o, n) {
14
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
15
+ if (!m) return o;
16
+ var i = m.call(o), r, ar = [], e;
17
+ try {
18
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
19
+ }
20
+ catch (error) { e = { error: error }; }
21
+ finally {
22
+ try {
23
+ if (r && !r.done && (m = i["return"])) m.call(i);
24
+ }
25
+ finally { if (e) throw e.error; }
26
+ }
27
+ return ar;
28
+ };
29
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
30
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
31
+ if (ar || !(i in from)) {
32
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
33
+ ar[i] = from[i];
34
+ }
35
+ }
36
+ return to.concat(ar || Array.prototype.slice.call(from));
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.PageAlertsProvider = exports.usePageAlerts = exports.PageAlertsArrayContext = exports.PageAlertsContext = void 0;
40
+ var jsx_runtime_1 = require("react/jsx-runtime");
41
+ var react_1 = require("react");
42
+ exports.PageAlertsContext = (0, react_1.createContext)({
43
+ addAlert: function () { return null; },
44
+ removeAlert: function () { return null; },
45
+ replaceAlert: function () { return null; },
46
+ removeAlerts: function () { return null; },
47
+ });
48
+ exports.PageAlertsArrayContext = (0, react_1.createContext)([]);
49
+ function usePageAlerts() {
50
+ return (0, react_1.useContext)(exports.PageAlertsContext);
51
+ }
52
+ exports.usePageAlerts = usePageAlerts;
53
+ function PageAlertsProvider(props) {
54
+ var _a = __read((0, react_1.useState)([]), 2), toasterAlerts = _a[0], setToasterAlerts = _a[1];
55
+ var _b = __read((0, react_1.useState)(function () {
56
+ function removeAlerts(filter) {
57
+ setToasterAlerts(function (alerts) { return (filter ? alerts.filter(filter) : []); });
58
+ }
59
+ function removeAlert(alert) {
60
+ setToasterAlerts(function (alerts) { return alerts.filter(function (a) { return a !== alert; }); });
61
+ }
62
+ function addAlert(alert) {
63
+ if (Number.isInteger(alert.timeout)) {
64
+ setTimeout(function () { return removeAlert(alert); }, alert.timeout);
65
+ delete alert.timeout;
66
+ }
67
+ setToasterAlerts(function (alerts) {
68
+ var alertIndex = alerts.findIndex(function (a) { return a === alert; });
69
+ if (alertIndex !== -1) {
70
+ var newAlerts = __spreadArray([], __read(alerts), false);
71
+ newAlerts[alertIndex] = alert;
72
+ return newAlerts;
73
+ }
74
+ else {
75
+ return __spreadArray(__spreadArray([], __read(alerts), false), [alert], false);
76
+ }
77
+ });
78
+ }
79
+ function replaceAlert(oldAlert, alert) {
80
+ setToasterAlerts(function (alerts) {
81
+ var oldAlertIndex = alerts.findIndex(function (a) { return a === oldAlert; });
82
+ if (oldAlertIndex !== -1) {
83
+ if (Number.isInteger(alert.timeout)) {
84
+ setTimeout(function () { return removeAlert(alert); }, alert.timeout);
85
+ delete alert.timeout;
86
+ }
87
+ var newAlerts = __spreadArray([], __read(alerts), false);
88
+ newAlerts[oldAlertIndex] = alert;
89
+ return newAlerts;
90
+ }
91
+ return alerts;
92
+ });
93
+ }
94
+ return { addAlert: addAlert, removeAlert: removeAlert, removeAlerts: removeAlerts, replaceAlert: replaceAlert };
95
+ }), 1), pageAlerts = _b[0];
96
+ return ((0, jsx_runtime_1.jsx)(exports.PageAlertsContext.Provider, __assign({ value: pageAlerts }, { children: (0, jsx_runtime_1.jsx)(exports.PageAlertsArrayContext.Provider, __assign({ value: toasterAlerts }, { children: props.children })) })));
97
+ }
98
+ exports.PageAlertsProvider = PageAlertsProvider;
@@ -1,5 +1,6 @@
1
- import { ReactNode } from 'react';
1
+ import { CSSProperties, ReactNode } from 'react';
2
2
  export declare function PageDashboardCard(props: {
3
3
  to?: string;
4
4
  children: ReactNode;
5
+ style?: CSSProperties;
5
6
  }): JSX.Element;
@@ -17,6 +17,6 @@ var react_core_1 = require("@patternfly/react-core");
17
17
  var usePageNavigate_1 = require("../components/usePageNavigate");
18
18
  function PageDashboardCard(props) {
19
19
  var history = (0, usePageNavigate_1.usePageNavigate)();
20
- return ((0, jsx_runtime_1.jsx)(react_core_1.Card, __assign({ isFlat: true, isSelectable: true, isRounded: true, style: { transition: 'box-shadow 0.25s', minHeight: 300 }, onClick: function () { return props.to && history(props.to); } }, { children: props.children })));
20
+ return ((0, jsx_runtime_1.jsx)(react_core_1.Card, __assign({ isFlat: true, isSelectable: !!props.to, isRounded: true, style: __assign({ transition: 'box-shadow 0.25s' }, props.style), onClick: function () { return props.to && history(props.to); } }, { children: props.children })));
21
21
  }
22
22
  exports.PageDashboardCard = PageDashboardCard;
package/cjs/PageHeader.js CHANGED
@@ -12,17 +12,19 @@ var __assign = (this && this.__assign) || function () {
12
12
  };
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
14
  exports.PageHeader = void 0;
15
+ var react_1 = require("react");
15
16
  var jsx_runtime_1 = require("react/jsx-runtime");
16
17
  var react_core_1 = require("@patternfly/react-core");
17
18
  var react_icons_1 = require("@patternfly/react-icons");
18
- var react_1 = require("react");
19
+ var react_2 = require("react");
19
20
  var useBreakPoint_1 = require("./components/useBreakPoint");
20
21
  var usePageNavigate_1 = require("./components/usePageNavigate");
22
+ var PageAlerts_1 = require("./PageAlerts");
21
23
  var Settings_1 = require("./Settings");
22
24
  function Breadcrumbs(props) {
23
25
  var navigate = (0, usePageNavigate_1.usePageNavigate)();
24
26
  if (!props.breadcrumbs)
25
- return (0, jsx_runtime_1.jsx)(react_1.Fragment, {});
27
+ return (0, jsx_runtime_1.jsx)(react_2.Fragment, {});
26
28
  return ((0, jsx_runtime_1.jsx)(react_core_1.Breadcrumb, __assign({ style: props.style }, { children: props.breadcrumbs.map(function (breadcrumb) {
27
29
  var _a;
28
30
  if (!breadcrumb.label)
@@ -74,21 +76,28 @@ function PageHeader(props) {
74
76
  ? 'thin solid var(--pf-global--BorderColor--100)'
75
77
  : undefined,
76
78
  backgroundColor: 'var(--pf-global--BackgroundColor--100)',
77
- } }, { children: (0, jsx_runtime_1.jsx)(react_core_1.Flex, __assign({ direction: { default: 'row' }, flexWrap: { default: 'nowrap' }, style: { maxWidth: '100%' } }, { children: (0, jsx_runtime_1.jsx)(react_core_1.PageNavigation, __assign({ style: { paddingTop: 0, flexShrink: 1, flexGrow: 1 } }, { children: navigation })) })) }))), true && ((0, jsx_runtime_1.jsx)(react_core_1.PageSection, __assign({ variant: react_core_1.PageSectionVariants.light, style: {
78
- paddingTop: breadcrumbs ? (xl ? 16 : 12) : xl ? 16 : 12,
79
- paddingBottom: xl ? 16 : 12,
80
- borderTop: !navigation && settings.theme !== 'light' && settings.borders
81
- ? 'thin solid var(--pf-global--BorderColor--100)'
82
- : undefined,
83
- borderBottom: !props.disableBorderBottom && settings.borders
84
- ? 'thin solid var(--pf-global--BorderColor--100)'
85
- : undefined,
86
- backgroundColor: settings.theme !== 'light' ? 'var(--pf-global--BackgroundColor--300)' : undefined,
87
- } }, { children: (0, jsx_runtime_1.jsxs)(react_core_1.Flex, __assign({ flexWrap: { default: 'nowrap' }, alignItems: { default: 'alignItemsStretch' } }, { children: [(0, jsx_runtime_1.jsxs)(react_core_1.FlexItem, __assign({ grow: { default: 'grow' } }, { children: [breadcrumbs && ((0, jsx_runtime_1.jsx)(Breadcrumbs, { breadcrumbs: breadcrumbs, style: { paddingBottom: lg ? 6 : 4 } })), title ? (props.titleHelp ? ((0, jsx_runtime_1.jsx)(react_core_1.Popover, __assign({ headerContent: props.titleHelpTitle, bodyContent: (0, jsx_runtime_1.jsxs)(react_core_1.Stack, __assign({ hasGutter: true }, { children: [typeof props.titleHelp === 'string' ? ((0, jsx_runtime_1.jsx)(react_core_1.StackItem, { children: props.titleHelp })) : (props.titleHelp.map(function (help, index) { return ((0, jsx_runtime_1.jsx)(react_core_1.StackItem, { children: help }, index)); })), props.titleDocLink && ((0, jsx_runtime_1.jsx)(react_core_1.StackItem, { children: (0, jsx_runtime_1.jsx)(react_core_1.Button, __assign({ icon: (0, jsx_runtime_1.jsx)(react_icons_1.ExternalLinkAltIcon, {}), variant: "link", onClick: function () { return window.open(props.titleDocLink, '_blank'); }, isInline: true }, { children: t('Documentation') })) }))] })), position: "bottom-start", removeFindDomNode: true }, { children: (0, jsx_runtime_1.jsxs)(react_core_1.Title, __assign({ headingLevel: "h1" }, { children: [title, (0, jsx_runtime_1.jsx)(react_core_1.Button, __assign({ variant: "link", style: {
88
- padding: 0,
89
- marginTop: 1,
90
- marginLeft: 8,
91
- verticalAlign: 'top',
92
- } }, { children: (0, jsx_runtime_1.jsx)(react_icons_1.OutlinedQuestionCircleIcon, {}) }))] })) }))) : ((0, jsx_runtime_1.jsx)(react_core_1.Title, __assign({ headingLevel: "h1" }, { children: title })))) : ((0, jsx_runtime_1.jsx)(react_core_1.Title, __assign({ headingLevel: "h1" }, { children: (0, jsx_runtime_1.jsx)(react_core_1.Skeleton, { width: "160px" }) }))), isMdOrLarger && description && ((0, jsx_runtime_1.jsx)(react_core_1.Text, __assign({ component: "p", style: { paddingTop: xl ? 4 : 2, opacity: 0.8 } }, { children: typeof description === 'string' ? ((0, jsx_runtime_1.jsx)(react_core_1.Truncate, { content: description })) : ((0, jsx_runtime_1.jsx)(react_core_1.Stack, { children: description.map(function (d) { return ((0, jsx_runtime_1.jsx)(react_core_1.StackItem, { children: d }, d)); }) })) })))] })), title && (headerActions || controls) && ((0, jsx_runtime_1.jsxs)(react_core_1.Flex, __assign({ direction: { default: 'column' }, spaceItems: { default: 'spaceItemsSm', xl: 'spaceItemsMd' }, justifyContent: { default: 'justifyContentCenter' } }, { children: [controls && (0, jsx_runtime_1.jsx)(react_core_1.FlexItem, __assign({ grow: { default: 'grow' } }, { children: controls })), headerActions && (0, jsx_runtime_1.jsx)(react_core_1.FlexItem, { children: headerActions })] })))] })) })))] }));
79
+ } }, { children: (0, jsx_runtime_1.jsx)(react_core_1.Flex, __assign({ direction: { default: 'row' }, flexWrap: { default: 'nowrap' }, style: { maxWidth: '100%' } }, { children: (0, jsx_runtime_1.jsx)(react_core_1.PageNavigation, __assign({ style: { paddingTop: 0, flexShrink: 1, flexGrow: 1 } }, { children: navigation })) })) }))), true && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_core_1.PageSection, __assign({ variant: react_core_1.PageSectionVariants.light, style: {
80
+ paddingTop: breadcrumbs ? (xl ? 16 : 12) : xl ? 16 : 12,
81
+ paddingBottom: xl ? 16 : 12,
82
+ borderTop: !navigation && settings.theme !== 'light' && settings.borders
83
+ ? 'thin solid var(--pf-global--BorderColor--100)'
84
+ : undefined,
85
+ borderBottom: !props.disableBorderBottom && settings.borders
86
+ ? 'thin solid var(--pf-global--BorderColor--100)'
87
+ : undefined,
88
+ backgroundColor: settings.theme !== 'light' ? 'var(--pf-global--BackgroundColor--300)' : undefined,
89
+ } }, { children: (0, jsx_runtime_1.jsxs)(react_core_1.Flex, __assign({ flexWrap: { default: 'nowrap' }, alignItems: { default: 'alignItemsStretch' } }, { children: [(0, jsx_runtime_1.jsxs)(react_core_1.FlexItem, __assign({ grow: { default: 'grow' } }, { children: [breadcrumbs && ((0, jsx_runtime_1.jsx)(Breadcrumbs, { breadcrumbs: breadcrumbs, style: { paddingBottom: lg ? 6 : 4 } })), title ? (props.titleHelp ? ((0, jsx_runtime_1.jsx)(react_core_1.Popover, __assign({ headerContent: props.titleHelpTitle, bodyContent: (0, jsx_runtime_1.jsxs)(react_core_1.Stack, __assign({ hasGutter: true }, { children: [typeof props.titleHelp === 'string' ? ((0, jsx_runtime_1.jsx)(react_core_1.StackItem, { children: props.titleHelp })) : (props.titleHelp.map(function (help, index) { return ((0, jsx_runtime_1.jsx)(react_core_1.StackItem, { children: help }, index)); })), props.titleDocLink && ((0, jsx_runtime_1.jsx)(react_core_1.StackItem, { children: (0, jsx_runtime_1.jsx)(react_core_1.Button, __assign({ icon: (0, jsx_runtime_1.jsx)(react_icons_1.ExternalLinkAltIcon, {}), variant: "link", onClick: function () { return window.open(props.titleDocLink, '_blank'); }, isInline: true }, { children: t('Documentation') })) }))] })), position: "bottom-start", removeFindDomNode: true }, { children: (0, jsx_runtime_1.jsxs)(react_core_1.Title, __assign({ headingLevel: "h1" }, { children: [title, (0, jsx_runtime_1.jsx)(react_core_1.Button, __assign({ variant: "link", style: {
90
+ padding: 0,
91
+ marginTop: 1,
92
+ marginLeft: 8,
93
+ verticalAlign: 'top',
94
+ } }, { children: (0, jsx_runtime_1.jsx)(react_icons_1.OutlinedQuestionCircleIcon, {}) }))] })) }))) : ((0, jsx_runtime_1.jsx)(react_core_1.Title, __assign({ headingLevel: "h1" }, { children: title })))) : ((0, jsx_runtime_1.jsx)(react_core_1.Title, __assign({ headingLevel: "h1" }, { children: (0, jsx_runtime_1.jsx)(react_core_1.Skeleton, { width: "160px" }) }))), isMdOrLarger && description && ((0, jsx_runtime_1.jsx)(react_core_1.Text, __assign({ component: "p", style: { paddingTop: xl ? 4 : 2, opacity: 0.8 } }, { children: typeof description === 'string' ? ((0, jsx_runtime_1.jsx)(react_core_1.Truncate, { content: description })) : ((0, jsx_runtime_1.jsx)(react_core_1.Stack, { children: description.map(function (d) { return ((0, jsx_runtime_1.jsx)(react_core_1.StackItem, { children: d }, d)); }) })) })))] })), title && (headerActions || controls) && ((0, jsx_runtime_1.jsxs)(react_core_1.Flex, __assign({ direction: { default: 'column' }, spaceItems: { default: 'spaceItemsSm', xl: 'spaceItemsMd' }, justifyContent: { default: 'justifyContentCenter' } }, { children: [controls && (0, jsx_runtime_1.jsx)(react_core_1.FlexItem, __assign({ grow: { default: 'grow' } }, { children: controls })), headerActions && (0, jsx_runtime_1.jsx)(react_core_1.FlexItem, { children: headerActions })] })))] })) })), (0, jsx_runtime_1.jsx)(PageAlerts_1.PageAlertsContext.Consumer, { children: function (pageAlerts) { return ((0, jsx_runtime_1.jsx)(PageAlerts_1.PageAlertsArrayContext.Consumer, { children: function (pageAlertsArray) {
95
+ if (pageAlertsArray.length === 0)
96
+ return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
97
+ return ((0, jsx_runtime_1.jsx)("div", __assign({ style: { borderBottom: 'thin solid rgba(0, 0, 0, 0.12)' } }, { children: pageAlertsArray.map(function (alertProps, index) {
98
+ var _a, _b;
99
+ return ((0, react_1.createElement)(react_core_1.Alert, __assign({}, alertProps, { key: (_b = (_a = alertProps.key) !== null && _a !== void 0 ? _a : alertProps.id) !== null && _b !== void 0 ? _b : index, actionClose: (0, jsx_runtime_1.jsx)(react_core_1.AlertActionCloseButton, { onClose: function () { return pageAlerts.removeAlert(alertProps); } }), isInline: true, isExpandable: !!alertProps.children })));
100
+ }) })));
101
+ } })); } })] }))] }));
93
102
  }
94
103
  exports.PageHeader = PageHeader;
package/cjs/PageLayout.js CHANGED
@@ -33,6 +33,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
33
33
  exports.PageLayout = void 0;
34
34
  var jsx_runtime_1 = require("react/jsx-runtime");
35
35
  var ErrorBoundary_1 = __importDefault(require("./components/ErrorBoundary"));
36
+ var PageAlerts_1 = require("./PageAlerts");
36
37
  var useFrameworkTranslations_1 = require("./useFrameworkTranslations");
37
38
  /**
38
39
  * The PageLayout is used as the container for the contents of the page.
@@ -49,11 +50,11 @@ var useFrameworkTranslations_1 = require("./useFrameworkTranslations");
49
50
  */
50
51
  function PageLayout(props) {
51
52
  var _a = __read((0, useFrameworkTranslations_1.useFrameworkTranslations)(), 1), translations = _a[0];
52
- return ((0, jsx_runtime_1.jsx)(ErrorBoundary_1.default, __assign({ message: translations.errorText }, { children: (0, jsx_runtime_1.jsx)("div", __assign({ style: {
53
- display: 'flex',
54
- flexDirection: 'column',
55
- height: '100%',
56
- maxHeight: '100%',
57
- } }, { children: props.children })) })));
53
+ return ((0, jsx_runtime_1.jsx)(ErrorBoundary_1.default, __assign({ message: translations.errorText }, { children: (0, jsx_runtime_1.jsx)(PageAlerts_1.PageAlertsProvider, { children: (0, jsx_runtime_1.jsx)("div", __assign({ style: {
54
+ display: 'flex',
55
+ flexDirection: 'column',
56
+ height: '100%',
57
+ maxHeight: '100%',
58
+ } }, { children: props.children })) }) })));
58
59
  }
59
60
  exports.PageLayout = PageLayout;
@@ -166,7 +166,7 @@ function TableHead(props) {
166
166
  };
167
167
  }, [setSort, setSortDirection, sort, sortDirection]);
168
168
  return ((0, jsx_runtime_1.jsx)(react_table_1.Thead, { children: (0, jsx_runtime_1.jsxs)(react_table_1.Tr, __assign({ style: {
169
- backgroundColor: settings.theme === 'dark' ? 'var(--pf-global--BackgroundColor--300)' : undefined,
169
+ backgroundColor: settings.theme === 'dark' ? 'var(--pf-global--BackgroundColor--300)' : 'white',
170
170
  } }, { children: [expandedRow && (0, jsx_runtime_1.jsx)(react_table_1.Th, { style: { padding: 0, backgroundColor: 'inherit' } }), (showSelect || onSelect) && ((0, jsx_runtime_1.jsx)(react_table_1.Th, __assign({ isStickyColumn: true, stickyMinWidth: "0px", hasRightBorder: props.scrollLeft, style: { backgroundColor: 'inherit' } }, { children: "\u00A0" }))), columns
171
171
  .filter(function (column) { return column.enabled !== false; })
172
172
  .map(function (column, index) {
@@ -15,13 +15,13 @@ exports.PageTableCards = 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 react_1 = require("react");
18
- var Grid_1 = require("../components/Grid");
18
+ var PageGrid_1 = require("../components/PageGrid");
19
19
  var PageTableCard_1 = require("./PageTableCard");
20
20
  function PageTableCards(props) {
21
21
  var keyFn = props.keyFn, items = props.pageItems, tableColumns = props.tableColumns, isSelected = props.isSelected, selectItem = props.selectItem, unselectItem = props.unselectItem, rowActions = props.rowActions, showSelect = props.showSelect, defaultCardSubtitle = props.defaultSubtitle;
22
22
  var itemToCardFn = (0, PageTableCard_1.useColumnsToTableCardFn)(tableColumns, keyFn);
23
23
  var catalogCards = (0, react_1.useMemo)(function () {
24
- return ((0, jsx_runtime_1.jsx)(Grid_1.Grid, __assign({ size: 400 }, { children: items === null || items === void 0 ? void 0 : items.map(function (item) { return ((0, jsx_runtime_1.jsx)(PageTableCard_1.PageTableCard, { item: item, itemToCardFn: itemToCardFn, isSelected: isSelected, selectItem: selectItem, unselectItem: unselectItem, itemActions: rowActions, showSelect: showSelect, defaultCardSubtitle: defaultCardSubtitle }, keyFn(item))); }) })));
24
+ return ((0, jsx_runtime_1.jsx)(PageGrid_1.PageGrid, __assign({ size: 400 }, { children: items === null || items === void 0 ? void 0 : items.map(function (item) { return ((0, jsx_runtime_1.jsx)(PageTableCard_1.PageTableCard, { item: item, itemToCardFn: itemToCardFn, isSelected: isSelected, selectItem: selectItem, unselectItem: unselectItem, itemActions: rowActions, showSelect: showSelect, defaultCardSubtitle: defaultCardSubtitle }, keyFn(item))); }) })));
25
25
  }, [
26
26
  items,
27
27
  keyFn,
@@ -0,0 +1,7 @@
1
+ import { ComponentClass, ReactElement, ReactNode } from 'react';
2
+ export declare function EmptyStateCustom(props: {
3
+ title: string;
4
+ description: ReactNode;
5
+ icon?: ComponentClass;
6
+ button?: ReactElement;
7
+ }): JSX.Element;
@@ -0,0 +1,21 @@
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
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.EmptyStateCustom = void 0;
15
+ var jsx_runtime_1 = require("react/jsx-runtime");
16
+ var react_core_1 = require("@patternfly/react-core");
17
+ function EmptyStateCustom(props) {
18
+ var title = props.title, description = props.description, icon = props.icon, button = props.button;
19
+ return ((0, jsx_runtime_1.jsxs)(react_core_1.EmptyState, __assign({ variant: react_core_1.EmptyStateVariant.small }, { children: [icon && (0, jsx_runtime_1.jsx)(react_core_1.EmptyStateIcon, { icon: icon }), (0, jsx_runtime_1.jsx)(react_core_1.Title, __assign({ headingLevel: "h4", size: "lg" }, { children: title })), (0, jsx_runtime_1.jsx)(react_core_1.EmptyStateBody, { children: description }), button && (0, jsx_runtime_1.jsx)(react_core_1.EmptyStatePrimary, { children: button })] })));
20
+ }
21
+ exports.EmptyStateCustom = EmptyStateCustom;
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ export declare function EmptyStateFilter(props: {
3
+ button?: string;
4
+ clearAllFilters?: () => void;
5
+ description?: string;
6
+ title?: string;
7
+ }): JSX.Element;
@@ -0,0 +1,26 @@
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
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.EmptyStateFilter = void 0;
15
+ var jsx_runtime_1 = require("react/jsx-runtime");
16
+ var react_core_1 = require("@patternfly/react-core");
17
+ var react_icons_1 = require("@patternfly/react-icons");
18
+ var EmptyStateCustom_1 = require("./EmptyStateCustom");
19
+ function EmptyStateFilter(props) {
20
+ var button = props.button, clearAllFilters = props.clearAllFilters, description = props.description, title = props.title;
21
+ var defaultButton = 'Clear all filters';
22
+ var defaultDescription = 'No results match the filter criteria. Try changing your filter settings.';
23
+ var defaultTitle = 'No results found';
24
+ return ((0, jsx_runtime_1.jsx)(EmptyStateCustom_1.EmptyStateCustom, { title: title || defaultTitle, description: description || defaultDescription, icon: react_icons_1.SearchIcon, button: clearAllFilters ? ((0, jsx_runtime_1.jsx)(react_core_1.Button, __assign({ onClick: clearAllFilters, variant: "link" }, { children: button || defaultButton }))) : undefined }));
25
+ }
26
+ exports.EmptyStateFilter = EmptyStateFilter;
@@ -0,0 +1,6 @@
1
+ import { ReactElement, ReactNode } from 'react';
2
+ export declare function EmptyStateNoData(props: {
3
+ button?: ReactElement;
4
+ title: string;
5
+ description: ReactNode;
6
+ }): JSX.Element;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EmptyStateNoData = void 0;
4
+ var jsx_runtime_1 = require("react/jsx-runtime");
5
+ var react_icons_1 = require("@patternfly/react-icons");
6
+ var EmptyStateCustom_1 = require("./EmptyStateCustom");
7
+ function EmptyStateNoData(props) {
8
+ var button = props.button, description = props.description, title = props.title;
9
+ return ((0, jsx_runtime_1.jsx)(EmptyStateCustom_1.EmptyStateCustom, { icon: button ? react_icons_1.PlusCircleIcon : react_icons_1.CubesIcon, title: title, description: description, button: button }));
10
+ }
11
+ exports.EmptyStateNoData = EmptyStateNoData;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ export declare function EmptyStateUnauthorized(props: {
3
+ adminMessage?: string;
4
+ loginLink: React.ReactNode;
5
+ title?: string;
6
+ }): JSX.Element;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EmptyStateUnauthorized = void 0;
4
+ var jsx_runtime_1 = require("react/jsx-runtime");
5
+ var react_icons_1 = require("@patternfly/react-icons");
6
+ var EmptyStateCustom_1 = require("./EmptyStateCustom");
7
+ function EmptyStateUnauthorized(props) {
8
+ var defaultAdminMessage = 'Contact your organization administrator for more information.';
9
+ var defaultTitle = 'You do not have access';
10
+ var adminMessage = props.adminMessage, loginLink = props.loginLink, title = props.title;
11
+ return ((0, jsx_runtime_1.jsx)(EmptyStateCustom_1.EmptyStateCustom, { icon: react_icons_1.LockIcon, title: title || defaultTitle, description: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [adminMessage || defaultAdminMessage, (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)("br", {}), loginLink] }) }));
12
+ }
13
+ exports.EmptyStateUnauthorized = EmptyStateUnauthorized;
@@ -1,4 +1,15 @@
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
14
  exports.LoadingPage = void 0;
4
15
  var jsx_runtime_1 = require("react/jsx-runtime");
@@ -9,6 +20,6 @@ function LoadingPage(props) {
9
20
  var _a;
10
21
  return ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(PageHeader_1.PageHeader, { breadcrumbs: props.breadcrumbs, title: (_a = props.title) !== null && _a !== void 0 ? _a : ((0, jsx_runtime_1.jsx)(react_core_1.Skeleton, { width: "200px" })) }), (0, jsx_runtime_1.jsx)(react_core_1.PageSection
11
22
  // variant={theme === ThemeE.Dark ? undefined : 'light'}
12
- , {})] }));
23
+ , { children: (0, jsx_runtime_1.jsx)(react_core_1.Bullseye, __assign({ style: { paddingTop: 32 } }, { children: (0, jsx_runtime_1.jsx)(react_core_1.Spinner, {}) })) })] }));
13
24
  }
14
25
  exports.LoadingPage = LoadingPage;
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare function LoadingState(): JSX.Element;
@@ -0,0 +1,20 @@
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
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.LoadingState = void 0;
15
+ var jsx_runtime_1 = require("react/jsx-runtime");
16
+ var react_core_1 = require("@patternfly/react-core");
17
+ function LoadingState() {
18
+ return ((0, jsx_runtime_1.jsx)(react_core_1.PageSection, __assign({ isFilled: true, variant: "light" }, { children: (0, jsx_runtime_1.jsx)(react_core_1.Bullseye, { children: (0, jsx_runtime_1.jsx)(react_core_1.Spinner, {}) }) })));
19
+ }
20
+ exports.LoadingState = LoadingState;
@@ -1,5 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
- export declare function Grid(props: {
2
+ export declare function PageGrid(props: {
3
3
  size?: number;
4
4
  maxColumns?: number;
5
5
  children?: ReactNode;
@@ -30,12 +30,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
30
30
  return (mod && mod.__esModule) ? mod : { "default": mod };
31
31
  };
32
32
  Object.defineProperty(exports, "__esModule", { value: true });
33
- exports.Grid = void 0;
33
+ exports.PageGrid = void 0;
34
34
  var jsx_runtime_1 = require("react/jsx-runtime");
35
35
  var resize_observer_1 = __importDefault(require("@react-hook/resize-observer"));
36
36
  var react_1 = require("react");
37
- var useBreakPoint_1 = require("./useBreakPoint");
38
- function Grid(props) {
37
+ function PageGrid(props) {
39
38
  var _a;
40
39
  var size = (_a = props.size) !== null && _a !== void 0 ? _a : 350;
41
40
  var target = (0, react_1.useRef)(null);
@@ -52,13 +51,11 @@ function Grid(props) {
52
51
  var _a, _b;
53
52
  resize((_b = (_a = target.current) === null || _a === void 0 ? void 0 : _a.clientWidth) !== null && _b !== void 0 ? _b : 0);
54
53
  }, [resize]);
55
- var isMd = !(0, useBreakPoint_1.useBreakpoint)('lg');
56
- var isXS = !(0, useBreakPoint_1.useBreakpoint)('xs');
57
- var gap = 24;
58
- if (isMd)
59
- gap = 16;
60
- if (isXS)
61
- gap = 8;
54
+ // const isMd = !useBreakpoint('lg');
55
+ // const isXS = !useBreakpoint('xs');
56
+ var gap = 16;
57
+ // if (isMd) gap = 16;
58
+ // if (isXS) gap = 8;
62
59
  return ((0, jsx_runtime_1.jsx)("div", __assign({ ref: target, style: { display: 'grid', gridAutoRows: '1fr', gridTemplateColumns: gridTemplateColumns, gap: gap } }, { children: props.children })));
63
60
  }
64
- exports.Grid = Grid;
61
+ exports.PageGrid = PageGrid;
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.473",
4
+ "version": "0.0.475",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
7
7
  "type": "git",