@ansible/ansible-ui-framework 0.0.373 → 0.0.375

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.
Files changed (53) hide show
  1. package/cjs/PageActions/PageAction.d.ts +38 -0
  2. package/cjs/PageActions/PageAction.js +2 -0
  3. package/cjs/PageActions/PageActionType.d.ts +7 -0
  4. package/cjs/PageActions/PageActionType.js +11 -0
  5. package/cjs/PageActions/PageActions.d.ts +27 -0
  6. package/cjs/PageActions/PageActions.js +68 -0
  7. package/cjs/PageActions/PageBulkAction.d.ts +7 -0
  8. package/cjs/PageActions/PageBulkAction.js +35 -0
  9. package/cjs/PageActions/PageButtonAction.d.ts +8 -0
  10. package/cjs/PageActions/PageButtonAction.js +34 -0
  11. package/cjs/PageActions/PageDropdownAction.d.ts +15 -0
  12. package/cjs/PageActions/PageDropdownAction.js +125 -0
  13. package/cjs/PageActions/PagePinnedActions.d.ts +20 -0
  14. package/cjs/PageActions/PagePinnedActions.js +57 -0
  15. package/cjs/PageActions/PageSingleAction.d.ts +8 -0
  16. package/cjs/PageActions/PageSingleAction.js +35 -0
  17. package/cjs/PageDataList.d.ts +3 -3
  18. package/cjs/PageDataList.js +4 -3
  19. package/cjs/{PageForm.d.ts → PageForm/PageForm.d.ts} +1 -1
  20. package/cjs/{PageForm.js → PageForm/PageForm.js} +11 -16
  21. package/cjs/PageForm/PageFormSelectOption.d.ts +9 -0
  22. package/cjs/PageForm/PageFormSelectOption.js +29 -0
  23. package/cjs/PageHeader.d.ts +1 -1
  24. package/cjs/PageHeader.js +3 -3
  25. package/cjs/PageTable.d.ts +3 -3
  26. package/cjs/PageTable.js +5 -5
  27. package/cjs/PageTableCard.d.ts +2 -2
  28. package/cjs/PageTableCard.js +2 -2
  29. package/cjs/PageTableList.d.ts +2 -2
  30. package/cjs/PageTableList.js +2 -2
  31. package/cjs/PageToolbar.d.ts +3 -3
  32. package/cjs/PageToolbar.js +6 -5
  33. package/cjs/Settings.js +6 -6
  34. package/cjs/components/PageFormGroup.d.ts +11 -0
  35. package/cjs/components/PageFormGroup.js +27 -0
  36. package/cjs/components/PageSelect.d.ts +16 -0
  37. package/cjs/components/PageSelect.js +54 -0
  38. package/cjs/components/PageSelectOption.d.ts +14 -0
  39. package/cjs/components/PageSelectOption.js +56 -0
  40. package/cjs/components/useOpen.d.ts +1 -1
  41. package/cjs/components/useOpen.js +5 -5
  42. package/cjs/index.d.ts +7 -2
  43. package/cjs/index.js +7 -2
  44. package/docs/components/PageHeader.md +1 -1
  45. package/package.json +1 -1
  46. package/cjs/TypedActions/TypedActions.d.ts +0 -76
  47. package/cjs/TypedActions/TypedActions.js +0 -159
  48. package/cjs/TypedActions/TypedActionsButtons.d.ts +0 -18
  49. package/cjs/TypedActions/TypedActionsButtons.js +0 -113
  50. package/cjs/TypedActions/index.d.ts +0 -2
  51. package/cjs/TypedActions/index.js +0 -18
  52. package/cjs/components/SingleSelect.d.ts +0 -18
  53. package/cjs/components/SingleSelect.js +0 -70
@@ -38,10 +38,11 @@ var react_icons_1 = require("@patternfly/react-icons");
38
38
  var fast_deep_equal_1 = __importDefault(require("fast-deep-equal"));
39
39
  var react_1 = require("react");
40
40
  var react_hook_form_1 = require("react-hook-form");
41
- var Scrollable_1 = require("./components/Scrollable");
42
- var useBreakPoint_1 = require("./components/useBreakPoint");
43
- var PageHeader_1 = require("./PageHeader");
44
- var Settings_1 = require("./Settings");
41
+ var Scrollable_1 = require("../components/Scrollable");
42
+ var useBreakPoint_1 = require("../components/useBreakPoint");
43
+ var PageHeader_1 = require("../PageHeader");
44
+ var Settings_1 = require("../Settings");
45
+ var PageFormSelectOption_1 = require("./PageFormSelectOption");
45
46
  function FormPage(props) {
46
47
  // const methods = useForm<PartialDeep<T>>({
47
48
  // defaultValues: props.defaultValues,
@@ -110,9 +111,7 @@ function FormTextInput(props) {
110
111
  var _c = __read((0, react_1.useState)(false), 2), showSecret = _c[0], setShowSecret = _c[1];
111
112
  return ((0, jsx_runtime_1.jsx)(react_core_1.FormGroup, __assign({ id: "".concat(id, "-form-group"), fieldId: id, label: props.label, helperText: props.helperText, isRequired: props.required, validated: (error === null || error === void 0 ? void 0 : error.message) ? 'error' : undefined, helperTextInvalid: error === null || error === void 0 ? void 0 : error.message }, { children: (0, jsx_runtime_1.jsxs)(react_core_1.InputGroup, { children: [(0, jsx_runtime_1.jsx)(react_core_1.TextInput, __assign({ id: id, type: props.secret && !showSecret ? 'password' : 'text', "aria-describedby": "".concat(id, "-form-group"), isRequired: props.required, validated: (error === null || error === void 0 ? void 0 : error.message) ? 'error' : undefined, autoFocus: props.autoFocus, placeholder: props.placeholder }, registration, { onChange: function (v, e) {
112
113
  void registration.onChange(e);
113
- },
114
- // innerRef={registration.ref}
115
- isReadOnly: isSubmitting })), props.secret && ((0, jsx_runtime_1.jsx)(react_core_1.Button, __assign({ variant: "control", onClick: function () { return setShowSecret(!showSecret); }, "aria-label": "Options menu", isDisabled: isSubmitting }, { children: showSecret ? (0, jsx_runtime_1.jsx)(react_icons_1.EyeIcon, {}) : (0, jsx_runtime_1.jsx)(react_icons_1.EyeSlashIcon, {}) })))] }) })));
114
+ }, isReadOnly: isSubmitting })), props.secret && ((0, jsx_runtime_1.jsx)(react_core_1.Button, __assign({ variant: "control", onClick: function () { return setShowSecret(!showSecret); }, "aria-label": "Options menu", isDisabled: isSubmitting }, { children: showSecret ? (0, jsx_runtime_1.jsx)(react_icons_1.EyeIcon, {}) : (0, jsx_runtime_1.jsx)(react_icons_1.EyeSlashIcon, {}) })))] }) })));
116
115
  }
117
116
  exports.FormTextInput = FormTextInput;
118
117
  function FormTextArea(props) {
@@ -204,7 +203,7 @@ function FormSelect(props) {
204
203
  setOpen(false);
205
204
  }, [field, options]);
206
205
  var index = 0;
207
- return ((0, jsx_runtime_1.jsx)(react_core_1.FormGroup, __assign({ id: "".concat(id, "-form-group"), fieldId: id, label: props.label, helperTextInvalid: error, helperText: props.help, isRequired: props.required, validated: error ? 'error' : undefined }, { children: (0, jsx_runtime_1.jsx)(react_core_1.Select, __assign({ id: id, variant: react_core_1.SelectVariant.single, "aria-describedby": "".concat(id, "-helper"), validated: error ? 'error' : undefined }, field, { isOpen: open, onToggle: function () { return setOpen(!open); }, selections: selectedIndex === -1 ? '' : selectedIndex.toString(), onSelect: onSelect, isCreatable: props.create, isInputFilterPersisted: props.create, placeholderText: props.placeholder, isGrouped: isGrouped, footer: ((_b = props.footer) === null || _b === void 0 ? void 0 : _b.label) && ((0, jsx_runtime_1.jsx)(react_core_1.Button, __assign({ variant: "link", isInline: true, onClick: function () {
206
+ return ((0, jsx_runtime_1.jsx)(react_core_1.FormGroup, __assign({ id: "".concat(id, "-form-group"), fieldId: id, label: props.label, helperTextInvalid: error, helperText: props.help, isRequired: props.required, validated: error ? 'error' : undefined }, { children: (0, jsx_runtime_1.jsx)(react_core_1.Select, __assign({ id: id, variant: react_core_1.SelectVariant.single, "aria-describedby": "".concat(id, "-helper"), validated: error ? 'error' : undefined }, field, { isOpen: open, onToggle: function () { return setOpen(!open); }, selections: selectedIndex === -1 ? '' : selectedIndex.toString(), onSelect: onSelect, isCreatable: props.create, isInputFilterPersisted: props.create, placeholderText: props.placeholder, isGrouped: isGrouped, ref: field.ref, footer: ((_b = props.footer) === null || _b === void 0 ? void 0 : _b.label) && ((0, jsx_runtime_1.jsx)(react_core_1.Button, __assign({ variant: "link", isInline: true, onClick: function () {
208
207
  var _a, _b;
209
208
  setOpen(false);
210
209
  (_b = (_a = props.footer) === null || _a === void 0 ? void 0 : _a.click) === null || _b === void 0 ? void 0 : _b.call(_a);
@@ -282,7 +281,7 @@ function FormSchema(props) {
282
281
  case 'select': {
283
282
  if ('options' in property) {
284
283
  var formSelectProps = property;
285
- p.push((0, jsx_runtime_1.jsx)(FormSelect, { name: base + propertyName, label: title, placeholder: placeholder, required: required, options: formSelectProps.options, footer: formSelectProps.footer }, base + propertyName));
284
+ p.push((0, jsx_runtime_1.jsx)(PageFormSelectOption_1.PageFormSelectOption, { name: base + propertyName, label: title, placeholder: placeholder, isRequired: required, options: formSelectProps.options, footer: formSelectProps.footer }, base + propertyName));
286
285
  }
287
286
  else {
288
287
  p.push((0, jsx_runtime_1.jsx)(FormTextSelect, { name: base + propertyName, label: title, placeholder: placeholder, required: required, selectTitle: property.selectTitle, selectValue: property.selectValue, selectOpen: property.selectOpen }, base + propertyName));
@@ -353,14 +352,10 @@ function PageForm(props) {
353
352
  flexGrow: 1,
354
353
  overflow: props.disableScrolling ? undefined : 'hidden',
355
354
  gap: 0,
356
- } }, { children: [props.disableScrolling ? ((0, jsx_runtime_1.jsx)(react_core_1.PageSection, __assign({ isFilled: true,
357
- // padding={{ default: props.onCancel ? 'padding' : 'noPadding' }}
358
- variant: "light", style: { maxWidth: maxWidth } }, { children: (0, jsx_runtime_1.jsxs)(react_core_1.Grid, __assign({ hasGutter: true, span: 12, sm: sm, md: md, lg: lg, xl: xl, xl2: xl2 }, { children: [props.schema && (0, jsx_runtime_1.jsx)(FormSchema, { schema: props.schema }), props.children] })) }))) : ((0, jsx_runtime_1.jsx)(Scrollable_1.Scrollable, __assign({ style: { height: '100%', flexGrow: 1 } }, { children: (0, jsx_runtime_1.jsx)(react_core_1.PageSection, __assign({ isFilled: true,
359
- // padding={{ default: props.onCancel ? 'padding' : 'noPadding' }}
360
- variant: "light", style: { maxWidth: maxWidth } }, { children: (0, jsx_runtime_1.jsxs)(react_core_1.Grid, __assign({ hasGutter: true, span: 12, sm: sm, md: md, lg: lg, xl: xl, xl2: xl2 }, { children: [props.schema && (0, jsx_runtime_1.jsx)(FormSchema, { schema: props.schema }), props.children] })) })) }))), error && ((0, jsx_runtime_1.jsx)(react_core_1.Alert, { variant: "danger", title: error !== null && error !== void 0 ? error : '', isInline: true, style: { paddingLeft: isMd && props.onCancel ? 190 : undefined } })), props.onCancel ? ((0, jsx_runtime_1.jsx)(react_core_1.PageSection, __assign({ isFilled: false, style: {
361
- borderTop: 'thin solid var(--pf-global--BorderColor--100)',
355
+ } }, { children: [props.disableScrolling ? ((0, jsx_runtime_1.jsx)("div", __assign({ style: { maxWidth: maxWidth, padding: 24 } }, { children: (0, jsx_runtime_1.jsxs)(react_core_1.Grid, __assign({ hasGutter: true, span: 12, sm: sm, md: md, lg: lg, xl: xl, xl2: xl2 }, { children: [props.schema && (0, jsx_runtime_1.jsx)(FormSchema, { schema: props.schema }), props.children] })) }))) : ((0, jsx_runtime_1.jsx)(Scrollable_1.Scrollable, __assign({ style: { height: '100%', flexGrow: 1 } }, { children: (0, jsx_runtime_1.jsx)("div", __assign({ style: { maxWidth: maxWidth, padding: 24 } }, { children: (0, jsx_runtime_1.jsxs)(react_core_1.Grid, __assign({ hasGutter: true, span: 12, sm: sm, md: md, lg: lg, xl: xl, xl2: xl2 }, { children: [props.schema && (0, jsx_runtime_1.jsx)(FormSchema, { schema: props.schema }), props.children] })) })) }))), error && ((0, jsx_runtime_1.jsx)(react_core_1.Alert, { variant: "danger", title: error !== null && error !== void 0 ? error : '', isInline: true, style: { paddingLeft: isMd && props.onCancel ? 190 : undefined } })), props.onCancel ? ((0, jsx_runtime_1.jsx)("div", __assign({ style: {
362
356
  backgroundColor: settings.theme === 'dark' ? 'var(--pf-global--BackgroundColor--400)' : undefined,
363
- }, variant: "light" }, { children: (0, jsx_runtime_1.jsxs)(react_core_1.ActionGroup, __assign({ style: { marginTop: 0 } }, { children: [(0, jsx_runtime_1.jsx)(PageFormSubmitButton, { children: props.submitText }), props.onCancel && ((0, jsx_runtime_1.jsx)(PageFormCancelButton, __assign({ onCancel: props.onCancel }, { children: props.cancelText })))] })) }))) : ((0, jsx_runtime_1.jsx)(PageFormSubmitButton, __assign({ style: { marginTop: 48 } }, { children: props.submitText })))] })) }))
357
+ padding: 24,
358
+ } }, { children: (0, jsx_runtime_1.jsxs)(react_core_1.ActionGroup, __assign({ style: { marginTop: 0 } }, { children: [(0, jsx_runtime_1.jsx)(PageFormSubmitButton, { children: props.submitText }), props.onCancel && ((0, jsx_runtime_1.jsx)(PageFormCancelButton, __assign({ onCancel: props.onCancel }, { children: props.cancelText })))] })) }))) : ((0, jsx_runtime_1.jsx)(PageFormSubmitButton, __assign({ style: { marginTop: 48 } }, { children: props.submitText })))] })) }))
364
359
  // </PageBody>
365
360
  );
366
361
  }
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { PageSelectOptionProps } from '../components/PageSelectOption';
3
+ export type PageFormSelectOption<T> = {
4
+ name: string;
5
+ } & Omit<PageSelectOptionProps<T>, 'onSelect' | 'value'>;
6
+ /**
7
+ * A PageSelectOption for use in PageForms
8
+ */
9
+ export declare function PageFormSelectOption<T>(props: PageFormSelectOption<T>): JSX.Element;
@@ -0,0 +1,29 @@
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.PageFormSelectOption = void 0;
15
+ var jsx_runtime_1 = require("react/jsx-runtime");
16
+ var react_hook_form_1 = require("react-hook-form");
17
+ var PageSelectOption_1 = require("../components/PageSelectOption");
18
+ /**
19
+ * A PageSelectOption for use in PageForms
20
+ */
21
+ function PageFormSelectOption(props) {
22
+ var _a = (0, react_hook_form_1.useFormContext)(), control = _a.control, isSubmitting = _a.formState.isSubmitting;
23
+ var name = props.name;
24
+ return ((0, jsx_runtime_1.jsx)(react_hook_form_1.Controller, { name: name, control: control, render: function (_a) {
25
+ var _b = _a.field, onChange = _b.onChange, value = _b.value, error = _a.fieldState.error;
26
+ return ((0, jsx_runtime_1.jsx)(PageSelectOption_1.PageSelectOption, __assign({}, props, { value: value, onSelect: onChange, helperTextInvalid: error === null || error === void 0 ? void 0 : error.message, readOnly: isSubmitting })));
27
+ } }));
28
+ }
29
+ exports.PageFormSelectOption = PageFormSelectOption;
@@ -37,7 +37,7 @@ export interface PageHeaderProps {
37
37
  * breadcrumbs={[{ label: 'Home', to: '/home' }, { label: 'Page title' }]}
38
38
  * title='Page title'
39
39
  * description='Page description'
40
- * headerActions={<PageActions actions={actions} />}
40
+ * headerActions={<TypedActions actions={actions} />}
41
41
  * />
42
42
  * <PageBody />...</PageBody>
43
43
  * </PageLayout>
package/cjs/PageHeader.js CHANGED
@@ -51,14 +51,14 @@ function Breadcrumbs(props) {
51
51
  * breadcrumbs={[{ label: 'Home', to: '/home' }, { label: 'Page title' }]}
52
52
  * title='Page title'
53
53
  * description='Page description'
54
- * headerActions={<PageActions actions={actions} />}
54
+ * headerActions={<TypedActions actions={actions} />}
55
55
  * />
56
56
  * <PageBody />...</PageBody>
57
57
  * </PageLayout>
58
58
  * <Page>
59
59
  */
60
60
  function PageHeader(props) {
61
- var navigation = props.navigation, breadcrumbs = props.breadcrumbs, title = props.title, description = props.description, controls = props.controls, pageActions = props.headerActions;
61
+ var navigation = props.navigation, breadcrumbs = props.breadcrumbs, title = props.title, description = props.description, controls = props.controls, headerActions = props.headerActions;
62
62
  var lg = (0, useBreakPoint_1.useBreakpoint)('lg');
63
63
  var xl = (0, useBreakPoint_1.useBreakpoint)('xl');
64
64
  var isMdOrLarger = (0, useBreakPoint_1.useBreakpoint)('md');
@@ -91,6 +91,6 @@ function PageHeader(props) {
91
91
  marginTop: 1,
92
92
  marginLeft: 8,
93
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 && (pageActions || 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 })), pageActions && (0, jsx_runtime_1.jsx)(react_core_1.FlexItem, { children: pageActions })] })))] })) })))] }));
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 })] })))] })) })))] }));
95
95
  }
96
96
  exports.PageHeader = PageHeader;
@@ -1,8 +1,8 @@
1
1
  import { Dispatch, ReactNode, SetStateAction } from 'react';
2
+ import { IPageAction } from './PageActions/PageAction';
2
3
  import { PageHeaderProps } from './PageHeader';
3
4
  import { PageTableViewType } from './PageTableViewType';
4
5
  import { IToolbarFilter } from './PageToolbar';
5
- import { ITypedAction } from './TypedActions';
6
6
  export type TablePageProps<T extends object> = PageHeaderProps & PageTableProps<T> & {
7
7
  error?: Error;
8
8
  };
@@ -11,9 +11,9 @@ export type PageTableProps<T extends object> = {
11
11
  keyFn: (item: T) => string | number;
12
12
  itemCount?: number;
13
13
  pageItems: T[] | undefined;
14
- toolbarActions?: ITypedAction<T>[];
14
+ toolbarActions?: IPageAction<T>[];
15
15
  tableColumns: ITableColumn<T>[];
16
- rowActions?: ITypedAction<T>[];
16
+ rowActions?: IPageAction<T>[];
17
17
  toolbarFilters?: IToolbarFilter[];
18
18
  filters?: Record<string, string[]>;
19
19
  setFilters?: Dispatch<SetStateAction<Record<string, string[]>>>;
package/cjs/PageTable.js CHANGED
@@ -42,6 +42,8 @@ var LabelsCell_1 = require("./cells/LabelsCell");
42
42
  var TextCell_1 = require("./cells/TextCell");
43
43
  var Scrollable_1 = require("./components/Scrollable");
44
44
  var useBreakPoint_1 = require("./components/useBreakPoint");
45
+ var PageActions_1 = require("./PageActions/PageActions");
46
+ var PageActionType_1 = require("./PageActions/PageActionType");
45
47
  var PageBody_1 = require("./PageBody");
46
48
  var PageColumnModal_1 = require("./PageColumnModal");
47
49
  var PageHeader_1 = require("./PageHeader");
@@ -52,7 +54,6 @@ var PageTableList_1 = require("./PageTableList");
52
54
  var PageTableViewType_1 = require("./PageTableViewType");
53
55
  var PageToolbar_1 = require("./PageToolbar");
54
56
  var Settings_1 = require("./Settings");
55
- var TypedActions_1 = require("./TypedActions");
56
57
  function TablePage(props) {
57
58
  return ((0, jsx_runtime_1.jsxs)(PageLayout_1.PageLayout, { children: [(0, jsx_runtime_1.jsx)(PageHeader_1.PageHeader, __assign({}, props)), (0, jsx_runtime_1.jsx)(PageTable, __assign({}, props))] }));
58
59
  }
@@ -77,7 +78,7 @@ function PageTable(props) {
77
78
  // const { disableBodyPadding } = props
78
79
  var toolbarActions = props.toolbarActions, filters = props.filters, error = props.error, itemCount = props.itemCount;
79
80
  var _b = (0, PageColumnModal_1.useColumnModal)(props.tableColumns), openColumnModal = _b.openColumnModal, columnModal = _b.columnModal, managedColumns = _b.managedColumns;
80
- var showSelect = (toolbarActions === null || toolbarActions === void 0 ? void 0 : toolbarActions.find(function (toolbarAction) { return TypedActions_1.TypedActionType.bulk === toolbarAction.type; })) !==
81
+ var showSelect = (toolbarActions === null || toolbarActions === void 0 ? void 0 : toolbarActions.find(function (toolbarAction) { return PageActionType_1.PageActionType.bulk === toolbarAction.type; })) !==
81
82
  undefined;
82
83
  var hasTableViewType = !props.disableTableView;
83
84
  var hasListViewType = !props.disableListView;
@@ -121,7 +122,7 @@ function PageTableView(props) {
121
122
  var t = props.t;
122
123
  t = t ? t : function (t) { return t; };
123
124
  var showSelect = props.showSelect ||
124
- (toolbarActions === null || toolbarActions === void 0 ? void 0 : toolbarActions.find(function (toolbarAction) { return TypedActions_1.TypedActionType.bulk === toolbarAction.type; })) !==
125
+ (toolbarActions === null || toolbarActions === void 0 ? void 0 : toolbarActions.find(function (toolbarAction) { return PageActionType_1.PageActionType.bulk === toolbarAction.type; })) !==
125
126
  undefined;
126
127
  var containerRef = (0, react_1.useRef)(null);
127
128
  var _a = __read((0, react_1.useState)({
@@ -242,8 +243,7 @@ function TableCells(props) {
242
243
  paddingLeft: 8,
243
244
  width: '0%',
244
245
  right: 0,
245
- // display: 'flex',
246
- }, isStickyColumn: true, stickyMinWidth: "0px", className: props.scrollRight ? 'pf-m-border-left' : undefined }, { children: (0, jsx_runtime_1.jsx)(TypedActions_1.TypedActions, { actions: rowActions, selectedItem: item, position: react_core_1.DropdownPosition.right, iconOnly: true, isFilled: true }) })))] }));
246
+ }, isStickyColumn: true, stickyMinWidth: "0px", className: props.scrollRight ? 'pf-m-border-left' : undefined }, { children: (0, jsx_runtime_1.jsx)(PageActions_1.PageActions, { actions: rowActions, selectedItem: item, position: react_core_1.DropdownPosition.right, iconOnly: true }) })))] }));
247
247
  }
248
248
  var TableColumnSomething;
249
249
  (function (TableColumnSomething) {
@@ -1,7 +1,7 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { LabelColor } from './components/pfcolors';
3
+ import { IPageAction } from './PageActions/PageAction';
3
4
  import { ITableColumn } from './PageTable';
4
- import { ITypedAction } from './TypedActions';
5
5
  export interface IPageTableCard {
6
6
  id: string | number;
7
7
  icon?: ReactNode;
@@ -26,7 +26,7 @@ export declare function PageTableCard<T extends object>(props: {
26
26
  isSelected?: (item: T) => boolean;
27
27
  selectItem?: (item: T) => void;
28
28
  unselectItem?: (item: T) => void;
29
- itemActions?: ITypedAction<T>[];
29
+ itemActions?: IPageAction<T>[];
30
30
  showSelect?: boolean;
31
31
  defaultCardSubtitle?: ReactNode;
32
32
  }): JSX.Element;
@@ -30,8 +30,8 @@ var react_core_1 = require("@patternfly/react-core");
30
30
  var react_1 = require("react");
31
31
  var Details_1 = require("./components/Details");
32
32
  var IconWrapper_1 = require("./components/IconWrapper");
33
+ var PageActions_1 = require("./PageActions/PageActions");
33
34
  var PageTable_1 = require("./PageTable");
34
- var TypedActions_1 = require("./TypedActions");
35
35
  function PageTableCard(props) {
36
36
  var _a;
37
37
  var item = props.item, itemToCardFn = props.itemToCardFn, isSelected = props.isSelected, selectItem = props.selectItem, unselectItem = props.unselectItem, itemActions = props.itemActions, showSelect = props.showSelect, defaultCardSubtitle = props.defaultCardSubtitle;
@@ -63,7 +63,7 @@ function PageTableCard(props) {
63
63
  alignItems: 'center',
64
64
  gap: 16,
65
65
  maxWidth: '100%',
66
- } }, { children: [card.icon && (0, jsx_runtime_1.jsx)(IconWrapper_1.IconWrapper, __assign({ size: "xl" }, { children: card.icon })), (0, jsx_runtime_1.jsxs)("div", __assign({ style: { maxWidth: '100%' } }, { children: [(0, jsx_runtime_1.jsx)(react_core_1.CardTitle, { children: card.title }), card.subtitle ? ((0, jsx_runtime_1.jsx)(react_core_1.Text, __assign({ component: "small", style: { opacity: 0.7 } }, { children: card.subtitle }))) : (defaultCardSubtitle && ((0, jsx_runtime_1.jsx)(react_core_1.Text, __assign({ component: "small", style: { opacity: 0.7 } }, { children: defaultCardSubtitle }))))] }))] })), card.badge && card.badgeTooltip && ((0, jsx_runtime_1.jsx)(react_core_1.FlexItem, { children: (0, jsx_runtime_1.jsx)("div", __assign({ onClick: function (e) { return e.stopPropagation(); } }, { children: (0, jsx_runtime_1.jsx)(react_core_1.Popover, __assign({ headerContent: card.badgeTooltipTitle, bodyContent: card.badgeTooltip, removeFindDomNode: true }, { children: (0, jsx_runtime_1.jsx)(react_core_1.Label, __assign({ color: card.badgeColor }, { children: card.badge })) })) })) })), card.badge && !card.badgeTooltip && ((0, jsx_runtime_1.jsx)(react_core_1.FlexItem, { children: (0, jsx_runtime_1.jsx)(react_core_1.Label, __assign({ color: card.badgeColor }, { children: card.badge })) }))] })), showActions && ((0, jsx_runtime_1.jsxs)(react_core_1.CardActions, { children: [itemActions && itemActions.length && ((0, jsx_runtime_1.jsx)(TypedActions_1.TypedActions, { actions: itemActions, position: react_core_1.DropdownPosition.right, selectedItem: item, iconOnly: true, collapse: "always" })), showSelect && ((0, jsx_runtime_1.jsx)(react_core_1.Checkbox, { isChecked: isSelected === null || isSelected === void 0 ? void 0 : isSelected(item), onChange: onSelectClick,
66
+ } }, { children: [card.icon && (0, jsx_runtime_1.jsx)(IconWrapper_1.IconWrapper, __assign({ size: "xl" }, { children: card.icon })), (0, jsx_runtime_1.jsxs)("div", __assign({ style: { maxWidth: '100%' } }, { children: [(0, jsx_runtime_1.jsx)(react_core_1.CardTitle, { children: card.title }), card.subtitle ? ((0, jsx_runtime_1.jsx)(react_core_1.Text, __assign({ component: "small", style: { opacity: 0.7 } }, { children: card.subtitle }))) : (defaultCardSubtitle && ((0, jsx_runtime_1.jsx)(react_core_1.Text, __assign({ component: "small", style: { opacity: 0.7 } }, { children: defaultCardSubtitle }))))] }))] })), card.badge && card.badgeTooltip && ((0, jsx_runtime_1.jsx)(react_core_1.FlexItem, { children: (0, jsx_runtime_1.jsx)("div", __assign({ onClick: function (e) { return e.stopPropagation(); } }, { children: (0, jsx_runtime_1.jsx)(react_core_1.Popover, __assign({ headerContent: card.badgeTooltipTitle, bodyContent: card.badgeTooltip, removeFindDomNode: true }, { children: (0, jsx_runtime_1.jsx)(react_core_1.Label, __assign({ color: card.badgeColor }, { children: card.badge })) })) })) })), card.badge && !card.badgeTooltip && ((0, jsx_runtime_1.jsx)(react_core_1.FlexItem, { children: (0, jsx_runtime_1.jsx)(react_core_1.Label, __assign({ color: card.badgeColor }, { children: card.badge })) }))] })), showActions && ((0, jsx_runtime_1.jsxs)(react_core_1.CardActions, { children: [itemActions && itemActions.length && ((0, jsx_runtime_1.jsx)(PageActions_1.PageActions, { actions: itemActions, position: react_core_1.DropdownPosition.right, selectedItem: item, iconOnly: true, collapse: "always" })), showSelect && ((0, jsx_runtime_1.jsx)(react_core_1.Checkbox, { isChecked: isSelected === null || isSelected === void 0 ? void 0 : isSelected(item), onChange: onSelectClick,
67
67
  // aria-label="card checkbox example"
68
68
  id: "check-1" }))] }))] })), card.cardBody, card.labels && ((0, jsx_runtime_1.jsx)(react_core_1.CardFooter, { children: (0, jsx_runtime_1.jsx)("div", __assign({ style: {
69
69
  display: 'flex',
@@ -1,6 +1,6 @@
1
1
  import { ReactNode } from 'react';
2
+ import { IPageAction } from './PageActions/PageAction';
2
3
  import { ITableColumn, PageTableProps } from './PageTable';
3
- import { ITypedAction } from './TypedActions';
4
4
  export type PageTableListProps<T extends object> = PageTableProps<T>;
5
5
  export declare function PageTableList<T extends object>(props: PageTableListProps<T>): JSX.Element;
6
- export declare function useColumnsToDataList<T extends object>(tableColumns: ITableColumn<T>[], keyFn: (item: T) => string | number, isSelected?: (item: T) => boolean, selectItem?: (item: T) => void, unselectItem?: (item: T) => void, rowActions?: ITypedAction<T>[], defaultCardSubtitle?: ReactNode, showSelect?: boolean): (item: T) => ReactNode;
6
+ export declare function useColumnsToDataList<T extends object>(tableColumns: ITableColumn<T>[], keyFn: (item: T) => string | number, isSelected?: (item: T) => boolean, selectItem?: (item: T) => void, unselectItem?: (item: T) => void, rowActions?: IPageAction<T>[], defaultCardSubtitle?: ReactNode, showSelect?: boolean): (item: T) => ReactNode;
@@ -27,8 +27,8 @@ var jsx_runtime_1 = require("react/jsx-runtime");
27
27
  var react_core_1 = require("@patternfly/react-core");
28
28
  var react_1 = require("react");
29
29
  var IconWrapper_1 = require("./components/IconWrapper");
30
+ var PageActions_1 = require("./PageActions/PageActions");
30
31
  var PageTable_1 = require("./PageTable");
31
- var TypedActions_1 = require("./TypedActions");
32
32
  function PageTableList(props) {
33
33
  var keyFn = props.keyFn, pageItems = props.pageItems, tableColumns = props.tableColumns, isSelected = props.isSelected, selectItem = props.selectItem, unselectItem = props.unselectItem, rowActions = props.rowActions, defaultCardSubtitle = props.defaultSubtitle, showSelect = props.showSelect;
34
34
  var columnsToDataList = useColumnsToDataList(tableColumns, keyFn, isSelected, selectItem, unselectItem, rowActions, defaultCardSubtitle, showSelect);
@@ -133,7 +133,7 @@ function useColumnsToDataList(tableColumns, keyFn, isSelected, selectItem, unsel
133
133
  return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
134
134
  return ((0, jsx_runtime_1.jsxs)(react_core_1.DescriptionListGroup, { children: [(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: (0, jsx_runtime_1.jsx)(PageTable_1.TableColumnCell, { column: column, item: item }) })] }, column.header));
135
135
  }) })) }, "secondary")) : null,
136
- ] }), 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, iconOnly: true }) })))] }) }), key));
136
+ ] }), 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)(PageActions_1.PageActions, { actions: rowActions, position: react_core_1.DropdownPosition.right, selectedItem: item, iconOnly: true }) })))] }) }), key));
137
137
  }, [
138
138
  keyFn,
139
139
  isSelected,
@@ -1,6 +1,6 @@
1
1
  import { Dispatch, SetStateAction } from 'react';
2
+ import { IPageAction } from './PageActions/PageAction';
2
3
  import { PageTableViewType } from './PageTableViewType';
3
- import { ITypedAction } from './TypedActions';
4
4
  export interface IItemFilter<T extends object> {
5
5
  label: string;
6
6
  type?: 'search' | 'filter';
@@ -11,7 +11,7 @@ export interface IItemFilter<T extends object> {
11
11
  filter: (item: T, values: string[]) => boolean;
12
12
  }
13
13
  export type SetFilterValues<T extends object> = (filter: IItemFilter<T>, values: string[]) => void;
14
- export declare function toolbarActionsHaveBulkActions<T extends object>(actions?: ITypedAction<T>[]): boolean;
14
+ export declare function toolbarActionsHaveBulkActions<T extends object>(actions?: IPageAction<T>[]): boolean;
15
15
  export interface IToolbarStringFilter {
16
16
  key: string;
17
17
  label: string;
@@ -36,7 +36,7 @@ export type PagetableToolbarProps<T extends object> = {
36
36
  openColumnModal?: () => void;
37
37
  keyFn: (item: T) => string | number;
38
38
  itemCount?: number;
39
- toolbarActions?: ITypedAction<T>[];
39
+ toolbarActions?: IPageAction<T>[];
40
40
  toolbarFilters?: IToolbarFilter[];
41
41
  filters?: Record<string, string[]>;
42
42
  setFilters?: Dispatch<SetStateAction<Record<string, string[]>>>;
@@ -44,11 +44,12 @@ var react_core_1 = require("@patternfly/react-core");
44
44
  var react_icons_1 = require("@patternfly/react-icons");
45
45
  var react_1 = require("react");
46
46
  var BulkSelector_1 = require("./components/BulkSelector");
47
- var SingleSelect_1 = require("./components/SingleSelect");
47
+ var PageSelect_1 = require("./components/PageSelect");
48
48
  var useBreakPoint_1 = require("./components/useBreakPoint");
49
+ var PageActions_1 = require("./PageActions/PageActions");
50
+ var PageActionType_1 = require("./PageActions/PageActionType");
49
51
  var PageTableViewType_1 = require("./PageTableViewType");
50
52
  var Settings_1 = require("./Settings");
51
- var TypedActions_1 = require("./TypedActions");
52
53
  var useFrameworkTranslations_1 = require("./useFrameworkTranslations");
53
54
  function toolbarActionsHaveBulkActions(actions) {
54
55
  var e_1, _a;
@@ -85,7 +86,7 @@ function PageTableToolbar(props) {
85
86
  var showSelect = props.showSelect === true ||
86
87
  (selectedItems !== undefined &&
87
88
  toolbarActions &&
88
- toolbarActions.find(function (toolbarAction) { return TypedActions_1.TypedActionType.bulk === toolbarAction.type; }));
89
+ toolbarActions.find(function (toolbarAction) { return PageActionType_1.PageActionType.bulk === toolbarAction.type; }));
89
90
  var showToolbar = showSelect || showSearchAndFilters || showToolbarActions;
90
91
  var _b = __read((0, react_1.useState)(function () {
91
92
  return toolbarFilters ? ((toolbarFilters === null || toolbarFilters === void 0 ? void 0 : toolbarFilters.length) > 0 ? toolbarFilters[0].key : '') : '';
@@ -111,7 +112,7 @@ function PageTableToolbar(props) {
111
112
  paddingBottom: sm ? undefined : 8,
112
113
  paddingTop: sm ? undefined : 8,
113
114
  backgroundColor: settings.theme === 'dark' ? 'var(--pf-global--BackgroundColor--300)' : undefined,
114
- } }, { children: (0, jsx_runtime_1.jsxs)(react_core_1.ToolbarContent, { children: [showSelect && ((0, jsx_runtime_1.jsx)(react_core_1.ToolbarGroup, { children: (0, jsx_runtime_1.jsx)(react_core_1.ToolbarItem, __assign({ variant: "bulk-select" }, { children: (0, jsx_runtime_1.jsx)(BulkSelector_1.BulkSelector, __assign({}, props)) })) })), toolbarFilters && toolbarFilters.length > 0 && ((0, jsx_runtime_1.jsx)(react_core_1.ToolbarToggleGroup, __assign({ toggleIcon: (0, jsx_runtime_1.jsx)(react_icons_1.FilterIcon, {}), breakpoint: "md", style: { zIndex: 302 } }, { children: (0, jsx_runtime_1.jsxs)(react_core_1.ToolbarGroup, __assign({ variant: "filter-group" }, { children: [(0, jsx_runtime_1.jsx)(react_core_1.ToolbarItem, { children: (0, jsx_runtime_1.jsx)(SingleSelect_1.SingleSelect2, __assign({ onChange: setSeletedFilter, value: selectedFilter }, { children: toolbarFilters.map(function (filter) { return ((0, jsx_runtime_1.jsx)(react_core_1.SelectOption, __assign({ value: filter.key }, { children: (0, jsx_runtime_1.jsxs)(react_core_1.Flex, __assign({ spaceItems: { default: 'spaceItemsNone' }, alignItems: { default: 'alignItemsCenter' }, flexWrap: { default: 'nowrap' } }, { children: [(0, jsx_runtime_1.jsx)(react_core_1.FlexItem, __assign({ style: { paddingLeft: 4, paddingRight: 8 } }, { children: (0, jsx_runtime_1.jsx)(react_icons_1.FilterIcon, {}) })), (0, jsx_runtime_1.jsx)(react_core_1.FlexItem, { children: filter.label })] })) }), filter.key)); }) })) }), (0, jsx_runtime_1.jsx)(react_core_1.ToolbarItem, { children: (0, jsx_runtime_1.jsx)(ToolbarFilterInput, { filter: toolbarFilters.find(function (filter) { return filter.key === selectedFilter; }), addFilter: function (value) {
115
+ } }, { children: (0, jsx_runtime_1.jsxs)(react_core_1.ToolbarContent, { children: [showSelect && ((0, jsx_runtime_1.jsx)(react_core_1.ToolbarGroup, { children: (0, jsx_runtime_1.jsx)(react_core_1.ToolbarItem, __assign({ variant: "bulk-select" }, { children: (0, jsx_runtime_1.jsx)(BulkSelector_1.BulkSelector, __assign({}, props)) })) })), toolbarFilters && toolbarFilters.length > 0 && ((0, jsx_runtime_1.jsx)(react_core_1.ToolbarToggleGroup, __assign({ toggleIcon: (0, jsx_runtime_1.jsx)(react_icons_1.FilterIcon, {}), breakpoint: "md", style: { zIndex: 302 } }, { children: (0, jsx_runtime_1.jsxs)(react_core_1.ToolbarGroup, __assign({ variant: "filter-group" }, { children: [(0, jsx_runtime_1.jsx)(react_core_1.ToolbarItem, { children: (0, jsx_runtime_1.jsx)(PageSelect_1.PageSelect, __assign({ onSelect: setSeletedFilter, value: selectedFilter }, { children: toolbarFilters.map(function (filter) { return ((0, jsx_runtime_1.jsx)(react_core_1.SelectOption, __assign({ value: filter.key }, { children: (0, jsx_runtime_1.jsxs)(react_core_1.Flex, __assign({ spaceItems: { default: 'spaceItemsNone' }, alignItems: { default: 'alignItemsCenter' }, flexWrap: { default: 'nowrap' } }, { children: [(0, jsx_runtime_1.jsx)(react_core_1.FlexItem, __assign({ style: { paddingLeft: 4, paddingRight: 8 } }, { children: (0, jsx_runtime_1.jsx)(react_icons_1.FilterIcon, {}) })), (0, jsx_runtime_1.jsx)(react_core_1.FlexItem, { children: filter.label })] })) }), filter.key)); }) })) }), (0, jsx_runtime_1.jsx)(react_core_1.ToolbarItem, { children: (0, jsx_runtime_1.jsx)(ToolbarFilterInput, { filter: toolbarFilters.find(function (filter) { return filter.key === selectedFilter; }), addFilter: function (value) {
115
116
  var _a;
116
117
  var values = filters === null || filters === void 0 ? void 0 : filters[selectedFilter];
117
118
  if (!values)
@@ -158,7 +159,7 @@ function PageTableToolbar(props) {
158
159
  return newState;
159
160
  });
160
161
  }, showToolbarItem: false }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}) }), filter.label));
161
- })] })) }))), (0, jsx_runtime_1.jsx)(react_core_1.ToolbarGroup, __assign({ variant: "button-group", style: { zIndex: 302 } }, { children: (0, jsx_runtime_1.jsx)(react_core_1.ToolbarItem, { children: (0, jsx_runtime_1.jsx)(TypedActions_1.TypedActions, { actions: toolbarActions, selectedItems: selectedItems, wrapper: react_core_1.ToolbarItem }) }) })), (0, jsx_runtime_1.jsx)("div", { style: { flexGrow: 1 } }), (0, jsx_runtime_1.jsxs)(react_core_1.ToolbarGroup, __assign({ variant: "button-group", style: { zIndex: 302 } }, { children: [openColumnModal && viewType === 'table' && ((0, jsx_runtime_1.jsx)(react_core_1.ToolbarItem, { children: (0, jsx_runtime_1.jsx)(react_core_1.Tooltip, __assign({ content: 'Manage columns' }, { children: (0, jsx_runtime_1.jsx)(react_core_1.Button, { variant: "plain", icon: (0, jsx_runtime_1.jsx)(react_icons_1.ColumnsIcon, {}), onClick: openColumnModal }) })) })), (0, jsx_runtime_1.jsx)(react_core_1.ToolbarItem, { children: (0, jsx_runtime_1.jsx)(react_core_1.ToggleGroup, __assign({ "aria-label": "table view toggle" }, { children: [PageTableViewType_1.PageTableViewTypeE.Table, PageTableViewType_1.PageTableViewTypeE.List, PageTableViewType_1.PageTableViewTypeE.Cards]
162
+ })] })) }))), (0, jsx_runtime_1.jsx)(react_core_1.ToolbarGroup, __assign({ variant: "button-group", style: { zIndex: 302 } }, { children: (0, jsx_runtime_1.jsx)(PageActions_1.PageActions, { actions: toolbarActions, selectedItems: selectedItems, wrapper: react_core_1.ToolbarItem }) })), (0, jsx_runtime_1.jsx)("div", { style: { flexGrow: 1 } }), (0, jsx_runtime_1.jsxs)(react_core_1.ToolbarGroup, __assign({ variant: "button-group", style: { zIndex: 302 } }, { children: [openColumnModal && viewType === 'table' && ((0, jsx_runtime_1.jsx)(react_core_1.ToolbarItem, { children: (0, jsx_runtime_1.jsx)(react_core_1.Tooltip, __assign({ content: 'Manage columns' }, { children: (0, jsx_runtime_1.jsx)(react_core_1.Button, { variant: "plain", icon: (0, jsx_runtime_1.jsx)(react_icons_1.ColumnsIcon, {}), onClick: openColumnModal }) })) })), (0, jsx_runtime_1.jsx)(react_core_1.ToolbarItem, { children: (0, jsx_runtime_1.jsx)(react_core_1.ToggleGroup, __assign({ "aria-label": "table view toggle" }, { children: [PageTableViewType_1.PageTableViewTypeE.Table, PageTableViewType_1.PageTableViewTypeE.List, PageTableViewType_1.PageTableViewTypeE.Cards]
162
163
  // .filter((vt) => {
163
164
  // switch (vt) {
164
165
  // case PageTableViewTypeE.Cards:
package/cjs/Settings.js CHANGED
@@ -31,7 +31,7 @@ exports.SettingsDialog = exports.useSettingsDialog = exports.SettingsProvider =
31
31
  var jsx_runtime_1 = require("react/jsx-runtime");
32
32
  var react_core_1 = require("@patternfly/react-core");
33
33
  var react_1 = require("react");
34
- var SingleSelect_1 = require("./components/SingleSelect");
34
+ var PageSelect_1 = require("./components/PageSelect");
35
35
  var PageDialog_1 = require("./PageDialog");
36
36
  var useFrameworkTranslations_1 = require("./useFrameworkTranslations");
37
37
  exports.SettingsContext = (0, react_1.createContext)([
@@ -110,14 +110,14 @@ function SettingsDialog(props) {
110
110
  var _f = __read((0, useFrameworkTranslations_1.useFrameworkTranslations)(), 1), translations = _f[0];
111
111
  return ((0, jsx_runtime_1.jsx)(react_core_1.Modal, __assign({ title: "Settings", isOpen: props.open, onClose: onClose, variant: react_core_1.ModalVariant.medium, tabIndex: 0, actions: [
112
112
  (0, jsx_runtime_1.jsx)(react_core_1.Button, __assign({ variant: "primary", onClick: onClose }, { children: translations.closeText }), "close"),
113
- ] }, { children: (0, jsx_runtime_1.jsxs)(react_core_1.Form, __assign({ isHorizontal: settings.formLayout === 'horizontal' }, { children: [(0, jsx_runtime_1.jsxs)(SingleSelect_1.SingleSelect, __assign({ label: "Theme", value: (_a = settings.theme) !== null && _a !== void 0 ? _a : 'system', onChange: function (theme) {
113
+ ] }, { children: (0, jsx_runtime_1.jsxs)(react_core_1.Form, __assign({ isHorizontal: settings.formLayout === 'horizontal' }, { children: [(0, jsx_runtime_1.jsxs)(PageSelect_1.PageSelect, __assign({ label: "Theme", value: (_a = settings.theme) !== null && _a !== void 0 ? _a : 'system', onSelect: function (theme) {
114
114
  return setSettings(__assign(__assign({}, settings), { theme: theme }));
115
- } }, { children: [(0, jsx_runtime_1.jsx)(react_core_1.SelectOption, __assign({ value: "system" }, { children: 'System default' })), (0, jsx_runtime_1.jsx)(react_core_1.SelectOption, __assign({ value: "light" }, { children: 'Light' })), (0, jsx_runtime_1.jsx)(react_core_1.SelectOption, __assign({ value: "dark" }, { children: 'Dark' }))] })), (0, jsx_runtime_1.jsxs)(SingleSelect_1.SingleSelect, __assign({ label: "Table Layout", value: (_b = settings.tableLayout) !== null && _b !== void 0 ? _b : 'comfortable', onChange: function (tableLayout) {
115
+ } }, { children: [(0, jsx_runtime_1.jsx)(react_core_1.SelectOption, __assign({ value: "system" }, { children: 'System default' })), (0, jsx_runtime_1.jsx)(react_core_1.SelectOption, __assign({ value: "light" }, { children: 'Light' })), (0, jsx_runtime_1.jsx)(react_core_1.SelectOption, __assign({ value: "dark" }, { children: 'Dark' }))] })), (0, jsx_runtime_1.jsxs)(PageSelect_1.PageSelect, __assign({ label: "Table Layout", value: (_b = settings.tableLayout) !== null && _b !== void 0 ? _b : 'comfortable', onSelect: function (tableLayout) {
116
116
  return setSettings(__assign(__assign({}, settings), { tableLayout: tableLayout }));
117
- } }, { children: [(0, jsx_runtime_1.jsx)(react_core_1.SelectOption, __assign({ value: "comfortable" }, { children: 'Comfortable' })), (0, jsx_runtime_1.jsx)(react_core_1.SelectOption, __assign({ value: "compact" }, { children: 'Compact' }))] })), (0, jsx_runtime_1.jsxs)(SingleSelect_1.SingleSelect, __assign({ label: "Form Columns", value: (_c = settings.formColumns) !== null && _c !== void 0 ? _c : 'multiple', onChange: function (formColumns) {
117
+ } }, { children: [(0, jsx_runtime_1.jsx)(react_core_1.SelectOption, __assign({ value: "comfortable" }, { children: 'Comfortable' })), (0, jsx_runtime_1.jsx)(react_core_1.SelectOption, __assign({ value: "compact" }, { children: 'Compact' }))] })), (0, jsx_runtime_1.jsxs)(PageSelect_1.PageSelect, __assign({ label: "Form Columns", value: (_c = settings.formColumns) !== null && _c !== void 0 ? _c : 'multiple', onSelect: function (formColumns) {
118
118
  return setSettings(__assign(__assign({}, settings), { formColumns: formColumns }));
119
- } }, { children: [(0, jsx_runtime_1.jsx)(react_core_1.SelectOption, __assign({ value: "multiple" }, { children: 'Multiple columns' })), (0, jsx_runtime_1.jsx)(react_core_1.SelectOption, __assign({ value: "single" }, { children: 'Single column' }))] })), (0, jsx_runtime_1.jsxs)(SingleSelect_1.SingleSelect, __assign({ label: "Form Layout", value: (_d = settings.formLayout) !== null && _d !== void 0 ? _d : 'vertical', onChange: function (formLayout) {
119
+ } }, { children: [(0, jsx_runtime_1.jsx)(react_core_1.SelectOption, __assign({ value: "multiple" }, { children: 'Multiple columns' })), (0, jsx_runtime_1.jsx)(react_core_1.SelectOption, __assign({ value: "single" }, { children: 'Single column' }))] })), (0, jsx_runtime_1.jsxs)(PageSelect_1.PageSelect, __assign({ label: "Form Layout", value: (_d = settings.formLayout) !== null && _d !== void 0 ? _d : 'vertical', onSelect: function (formLayout) {
120
120
  return setSettings(__assign(__assign({}, settings), { formLayout: formLayout }));
121
- } }, { children: [(0, jsx_runtime_1.jsx)(react_core_1.SelectOption, __assign({ value: "vertical" }, { children: 'Vertical labels' })), (0, jsx_runtime_1.jsx)(react_core_1.SelectOption, __assign({ value: "horizontal" }, { children: 'Horizontal labels' }))] })), (0, jsx_runtime_1.jsxs)(SingleSelect_1.SingleSelect, __assign({ label: "Borders", value: settings.borders ? 'true' : 'false', onChange: function (value) { return setSettings(__assign(__assign({}, settings), { borders: value === 'true' })); }, style: { paddingBottom: 120 } }, { children: [(0, jsx_runtime_1.jsx)(react_core_1.SelectOption, __assign({ value: "true" }, { children: 'Yes' })), (0, jsx_runtime_1.jsx)(react_core_1.SelectOption, __assign({ value: "false" }, { children: 'No' }))] }))] })) })));
121
+ } }, { children: [(0, jsx_runtime_1.jsx)(react_core_1.SelectOption, __assign({ value: "vertical" }, { children: 'Vertical labels' })), (0, jsx_runtime_1.jsx)(react_core_1.SelectOption, __assign({ value: "horizontal" }, { children: 'Horizontal labels' }))] })), (0, jsx_runtime_1.jsxs)(PageSelect_1.PageSelect, __assign({ label: "Borders", value: settings.borders ? 'true' : 'false', onSelect: function (value) { return setSettings(__assign(__assign({}, settings), { borders: value === 'true' })); } }, { children: [(0, jsx_runtime_1.jsx)(react_core_1.SelectOption, __assign({ value: "true" }, { children: 'Yes' })), (0, jsx_runtime_1.jsx)(react_core_1.SelectOption, __assign({ value: "false" }, { children: 'No' }))] }))] })) })));
122
122
  }
123
123
  exports.SettingsDialog = SettingsDialog;
@@ -0,0 +1,11 @@
1
+ import { ReactNode } from 'react';
2
+ export type PageFormGroupProps = {
3
+ children: ReactNode;
4
+ helperText?: ReactNode | undefined;
5
+ helperTextInvalid?: ReactNode | undefined;
6
+ id?: string;
7
+ isRequired?: boolean;
8
+ label?: string;
9
+ };
10
+ /** Wrapper over the PatternFly FormGroup making it optional based on if label is given. */
11
+ export declare function PageFormGroup(props: PageFormGroupProps): JSX.Element;
@@ -0,0 +1,27 @@
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.PageFormGroup = void 0;
15
+ var jsx_runtime_1 = require("react/jsx-runtime");
16
+ var react_core_1 = require("@patternfly/react-core");
17
+ /** Wrapper over the PatternFly FormGroup making it optional based on if label is given. */
18
+ function PageFormGroup(props) {
19
+ var _a;
20
+ var children = props.children, helperText = props.helperText, helperTextInvalid = props.helperTextInvalid, isRequired = props.isRequired, label = props.label;
21
+ if (!label) {
22
+ return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: props.children });
23
+ }
24
+ var id = (_a = props.id) !== null && _a !== void 0 ? _a : label === null || label === void 0 ? void 0 : label.toLocaleLowerCase().split(' ').join('-');
25
+ return ((0, jsx_runtime_1.jsx)(react_core_1.FormGroup, __assign({ fieldId: id, helperText: helperText, helperTextInvalid: helperTextInvalid, id: "".concat(id, "-form-group"), isRequired: isRequired, label: label, validated: helperTextInvalid ? 'error' : undefined }, { children: children })));
26
+ }
27
+ exports.PageFormGroup = PageFormGroup;
@@ -0,0 +1,16 @@
1
+ import React, { ChangeEvent, ReactNode } from 'react';
2
+ import { PageFormGroupProps } from './PageFormGroup';
3
+ export type PageSelectProps = {
4
+ footer?: ReactNode;
5
+ isCreatable?: boolean;
6
+ isGrouped?: boolean | undefined;
7
+ onSelect: (value: string, event: React.MouseEvent<Element, MouseEvent> | ChangeEvent<Element>) => void;
8
+ placeholder?: string;
9
+ value: string | undefined;
10
+ readOnly?: boolean;
11
+ } & PageFormGroupProps;
12
+ /** Wrapper over a PatternFly Select.
13
+ * Simplifies the PatternFly Select.
14
+ * Supports a PageFormGroup with label if label is specififed.
15
+ */
16
+ export declare function PageSelect(props: PageSelectProps): JSX.Element;
@@ -0,0 +1,54 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
30
+ exports.PageSelect = void 0;
31
+ var jsx_runtime_1 = require("react/jsx-runtime");
32
+ var react_core_1 = require("@patternfly/react-core");
33
+ var react_1 = require("react");
34
+ var PageFormGroup_1 = require("./PageFormGroup");
35
+ /** Wrapper over a PatternFly Select.
36
+ * Simplifies the PatternFly Select.
37
+ * Supports a PageFormGroup with label if label is specififed.
38
+ */
39
+ function PageSelect(props) {
40
+ var _a;
41
+ var children = props.children, footer = props.footer, helperTextInvalid = props.helperTextInvalid, isCreatable = props.isCreatable, isGrouped = props.isGrouped, isReadonly = props.readOnly, label = props.label, onSelect = props.onSelect, placeholder = props.placeholder, value = props.value;
42
+ var _b = __read((0, react_1.useState)(false), 2), open = _b[0], setOpen = _b[1];
43
+ var onToggle = (0, react_1.useCallback)(function () { return setOpen(function (open) { return !open; }); }, []);
44
+ var onSelectHandler = (0, react_1.useCallback)(function (event, value) {
45
+ if (typeof value === 'string')
46
+ onSelect(value, event);
47
+ else
48
+ onSelect(value.toString(), event);
49
+ setOpen(false);
50
+ }, [onSelect]);
51
+ var id = (_a = props.id) !== null && _a !== void 0 ? _a : label === null || label === void 0 ? void 0 : label.toLocaleLowerCase().split(' ').join('-');
52
+ return ((0, jsx_runtime_1.jsx)(PageFormGroup_1.PageFormGroup, __assign({}, props, { children: (0, jsx_runtime_1.jsx)(react_core_1.Select, __assign({ "aria-describedby": id ? "".concat(id, "-form-group") : undefined, footer: footer, id: id, isCreatable: isCreatable, isGrouped: isGrouped, isInputFilterPersisted: isCreatable, isOpen: open, maxHeight: 280, onSelect: onSelectHandler, onToggle: onToggle, placeholderText: placeholder, selections: value, validated: helperTextInvalid ? 'error' : undefined, variant: react_core_1.SelectVariant.single, isDisabled: isReadonly }, { children: children })) })));
53
+ }
54
+ exports.PageSelect = PageSelect;
@@ -0,0 +1,14 @@
1
+ import { ChangeEvent } from 'react';
2
+ import { PageSelectProps } from './PageSelect';
3
+ export interface IPageSelectOption<T> {
4
+ group?: string;
5
+ label: string;
6
+ description?: string;
7
+ value: T;
8
+ }
9
+ export type PageSelectOptionProps<T> = {
10
+ options: IPageSelectOption<T>[];
11
+ onSelect: (value: T | undefined, event: React.MouseEvent<Element, MouseEvent> | ChangeEvent<Element>) => void;
12
+ value: T | undefined;
13
+ } & Omit<PageSelectProps, 'onSelect' | 'value' | 'children'>;
14
+ export declare function PageSelectOption<T>(props: PageSelectOptionProps<T>): JSX.Element;
@@ -0,0 +1,56 @@
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.PageSelectOption = void 0;
15
+ var jsx_runtime_1 = require("react/jsx-runtime");
16
+ var react_core_1 = require("@patternfly/react-core");
17
+ var react_1 = require("react");
18
+ var PageSelect_1 = require("./PageSelect");
19
+ function PageSelectOption(props) {
20
+ var onSelect = props.onSelect, value = props.value;
21
+ var onSelectHandler = (0, react_1.useCallback)(function (label, event) {
22
+ var _a;
23
+ onSelect((_a = props.options.find(function (option) { return option.label === label; })) === null || _a === void 0 ? void 0 : _a.value, event);
24
+ }, [onSelect, props.options]);
25
+ var options = props.options;
26
+ options.sort(function (l, r) {
27
+ var _a, _b, _c, _d;
28
+ if (((_a = l.group) !== null && _a !== void 0 ? _a : '') < ((_b = r.group) !== null && _b !== void 0 ? _b : ''))
29
+ return -1;
30
+ if (((_c = l.group) !== null && _c !== void 0 ? _c : '') > ((_d = r.group) !== null && _d !== void 0 ? _d : ''))
31
+ return 1;
32
+ if (l.label < r.label)
33
+ return -1;
34
+ if (l.label > r.label)
35
+ return 1;
36
+ return 0;
37
+ });
38
+ var groups = options.reduce(function (groups, option) {
39
+ var _a;
40
+ var group = (_a = option.group) !== null && _a !== void 0 ? _a : '';
41
+ var optionsArray = groups[group];
42
+ if (!optionsArray) {
43
+ optionsArray = [];
44
+ groups[group] = optionsArray;
45
+ }
46
+ optionsArray.push(option);
47
+ return groups;
48
+ }, {});
49
+ var isGrouped = Object.keys(groups).length > 1 ||
50
+ (Object.keys(groups).length === 1 && Object.keys(groups)[0] !== '');
51
+ var selected = props.options.find(function (option) { return option.value === value; });
52
+ return ((0, jsx_runtime_1.jsx)(PageSelect_1.PageSelect, __assign({}, props, { value: selected === null || selected === void 0 ? void 0 : selected.label, onSelect: onSelectHandler, isGrouped: isGrouped }, { children: !isGrouped
53
+ ? options.map(function (option) { return ((0, jsx_runtime_1.jsx)(react_core_1.SelectOption, __assign({ value: option.label, label: option.label, description: option.description }, { children: option.label }), option.label)); })
54
+ : Object.keys(groups).map(function (group) { return ((0, jsx_runtime_1.jsx)(react_core_1.SelectGroup, __assign({ label: group }, { children: groups[group].map(function (option) { return ((0, jsx_runtime_1.jsx)(react_core_1.SelectOption, __assign({ value: option.label, label: option.label, description: option.description }, { children: option.label }), option.label)); }) }), group)); }) })));
55
+ }
56
+ exports.PageSelectOption = PageSelectOption;
@@ -1,4 +1,4 @@
1
- export declare function useOpen(props: {
1
+ export declare function useOpen(props?: {
2
2
  open?: boolean;
3
3
  setOpen?: (open: boolean) => void;
4
4
  }): [boolean, (open: boolean) => void, () => void];