@ansible/ansible-ui-framework 0.0.190

Sign up to get free protection for your applications and to get access to all the features.
Files changed (143) hide show
  1. package/LICENSE +21 -0
  2. package/cjs/framework/BulkActionDialog.js +217 -0
  3. package/cjs/framework/BulkProgressDialog.js +240 -0
  4. package/cjs/framework/FilterDrawer.js +64 -0
  5. package/cjs/framework/PageBody.js +47 -0
  6. package/cjs/framework/PageCatalog.js +178 -0
  7. package/cjs/framework/PageCells.js +141 -0
  8. package/cjs/framework/PageColumnModal.js +130 -0
  9. package/cjs/framework/PageDataList.js +61 -0
  10. package/cjs/framework/PageDialog.js +28 -0
  11. package/cjs/framework/PageForm.js +376 -0
  12. package/cjs/framework/PageFramework.js +11 -0
  13. package/cjs/framework/PageHeader.js +96 -0
  14. package/cjs/framework/PageLayout.js +41 -0
  15. package/cjs/framework/PagePagination.js +28 -0
  16. package/cjs/framework/PageTable.js +205 -0
  17. package/cjs/framework/PageTabs.js +82 -0
  18. package/cjs/framework/PageToolbar.js +209 -0
  19. package/cjs/framework/Settings.js +122 -0
  20. package/cjs/framework/TypedActions.js +303 -0
  21. package/cjs/framework/components/BulkSelector.js +89 -0
  22. package/cjs/framework/components/Collapse.js +22 -0
  23. package/cjs/framework/components/DetailInfo.js +23 -0
  24. package/cjs/framework/components/Details.js +88 -0
  25. package/cjs/framework/components/Dotted.js +19 -0
  26. package/cjs/framework/components/DropdownControlled.js +28 -0
  27. package/cjs/framework/components/ErrorBoundary.js +45 -0
  28. package/cjs/framework/components/Grid.js +64 -0
  29. package/cjs/framework/components/Help.js +24 -0
  30. package/cjs/framework/components/IconWrapper.js +55 -0
  31. package/cjs/framework/components/LoadingPage.js +14 -0
  32. package/cjs/framework/components/Masonry.js +113 -0
  33. package/cjs/framework/components/Scrollable.js +87 -0
  34. package/cjs/framework/components/SingleSelect.js +70 -0
  35. package/cjs/framework/components/patternfly-colors.js +32 -0
  36. package/cjs/framework/components/useBreakPoint.js +145 -0
  37. package/cjs/framework/components/useOpen.js +36 -0
  38. package/cjs/framework/components/useWindowLocation.js +70 -0
  39. package/cjs/framework/index.js +39 -0
  40. package/cjs/framework/useFrameworkTranslations.js +38 -0
  41. package/cjs/framework/useSelectDialog.js +81 -0
  42. package/cjs/framework/useSelectMultipleDialog.js +62 -0
  43. package/cjs/framework/useTableItems.js +485 -0
  44. package/cjs/framework/useView.js +155 -0
  45. package/cjs/framework/utils/compare.js +59 -0
  46. package/cjs/framework/utils/download-file.js +23 -0
  47. package/cjs/framework/utils/random-string.js +17 -0
  48. package/cjs/frontend/controller/access/organizations/Organization.js +2 -0
  49. package/mjs/framework/BulkActionDialog.d.ts +25 -0
  50. package/mjs/framework/BulkActionDialog.js +104 -0
  51. package/mjs/framework/BulkProgressDialog.d.ts +20 -0
  52. package/mjs/framework/BulkProgressDialog.js +131 -0
  53. package/mjs/framework/FilterDrawer.d.ts +8 -0
  54. package/mjs/framework/FilterDrawer.js +24 -0
  55. package/mjs/framework/PageBody.d.ts +4 -0
  56. package/mjs/framework/PageBody.js +29 -0
  57. package/mjs/framework/PageCatalog.d.ts +113 -0
  58. package/mjs/framework/PageCatalog.js +140 -0
  59. package/mjs/framework/PageCells.d.ts +35 -0
  60. package/mjs/framework/PageCells.js +102 -0
  61. package/mjs/framework/PageColumnModal.d.ts +7 -0
  62. package/mjs/framework/PageColumnModal.js +64 -0
  63. package/mjs/framework/PageDataList.d.ts +46 -0
  64. package/mjs/framework/PageDataList.js +45 -0
  65. package/mjs/framework/PageDialog.d.ts +10 -0
  66. package/mjs/framework/PageDialog.js +12 -0
  67. package/mjs/framework/PageForm.d.ts +147 -0
  68. package/mjs/framework/PageForm.js +316 -0
  69. package/mjs/framework/PageFramework.d.ts +4 -0
  70. package/mjs/framework/PageFramework.js +7 -0
  71. package/mjs/framework/PageHeader.d.ts +45 -0
  72. package/mjs/framework/PageHeader.js +80 -0
  73. package/mjs/framework/PageLayout.d.ts +15 -0
  74. package/mjs/framework/PageLayout.js +23 -0
  75. package/mjs/framework/PagePagination.d.ts +10 -0
  76. package/mjs/framework/PagePagination.js +22 -0
  77. package/mjs/framework/PageTable.d.ts +68 -0
  78. package/mjs/framework/PageTable.js +170 -0
  79. package/mjs/framework/PageTabs.d.ts +15 -0
  80. package/mjs/framework/PageTabs.js +45 -0
  81. package/mjs/framework/PageToolbar.d.ts +57 -0
  82. package/mjs/framework/PageToolbar.js +148 -0
  83. package/mjs/framework/Settings.d.ts +19 -0
  84. package/mjs/framework/Settings.js +87 -0
  85. package/mjs/framework/TypedActions.d.ts +80 -0
  86. package/mjs/framework/TypedActions.js +251 -0
  87. package/mjs/framework/components/BulkSelector.d.ts +11 -0
  88. package/mjs/framework/components/BulkSelector.js +56 -0
  89. package/mjs/framework/components/Collapse.d.ts +5 -0
  90. package/mjs/framework/components/Collapse.js +7 -0
  91. package/mjs/framework/components/DetailInfo.d.ts +5 -0
  92. package/mjs/framework/components/DetailInfo.js +8 -0
  93. package/mjs/framework/components/Details.d.ts +38 -0
  94. package/mjs/framework/components/Details.js +68 -0
  95. package/mjs/framework/components/Dotted.d.ts +4 -0
  96. package/mjs/framework/components/Dotted.js +4 -0
  97. package/mjs/framework/components/DropdownControlled.d.ts +4 -0
  98. package/mjs/framework/components/DropdownControlled.js +8 -0
  99. package/mjs/framework/components/ErrorBoundary.d.ts +15 -0
  100. package/mjs/framework/components/ErrorBoundary.js +25 -0
  101. package/mjs/framework/components/Grid.d.ts +6 -0
  102. package/mjs/framework/components/Grid.js +27 -0
  103. package/mjs/framework/components/Help.d.ts +5 -0
  104. package/mjs/framework/components/Help.js +9 -0
  105. package/mjs/framework/components/IconWrapper.d.ts +8 -0
  106. package/mjs/framework/components/IconWrapper.js +40 -0
  107. package/mjs/framework/components/LoadingPage.d.ts +6 -0
  108. package/mjs/framework/components/LoadingPage.js +9 -0
  109. package/mjs/framework/components/Masonry.d.ts +6 -0
  110. package/mjs/framework/components/Masonry.js +69 -0
  111. package/mjs/framework/components/Scrollable.d.ts +7 -0
  112. package/mjs/framework/components/Scrollable.js +60 -0
  113. package/mjs/framework/components/SingleSelect.d.ts +18 -0
  114. package/mjs/framework/components/SingleSelect.js +37 -0
  115. package/mjs/framework/components/patternfly-colors.d.ts +13 -0
  116. package/mjs/framework/components/patternfly-colors.js +28 -0
  117. package/mjs/framework/components/useBreakPoint.d.ts +5 -0
  118. package/mjs/framework/components/useBreakPoint.js +118 -0
  119. package/mjs/framework/components/useOpen.d.ts +4 -0
  120. package/mjs/framework/components/useOpen.js +16 -0
  121. package/mjs/framework/components/useWindowLocation.d.ts +6 -0
  122. package/mjs/framework/components/useWindowLocation.js +48 -0
  123. package/mjs/framework/index.d.ts +23 -0
  124. package/mjs/framework/index.js +23 -0
  125. package/mjs/framework/useFrameworkTranslations.d.ts +17 -0
  126. package/mjs/framework/useFrameworkTranslations.js +22 -0
  127. package/mjs/framework/useSelectDialog.d.ts +30 -0
  128. package/mjs/framework/useSelectDialog.js +49 -0
  129. package/mjs/framework/useSelectMultipleDialog.d.ts +21 -0
  130. package/mjs/framework/useSelectMultipleDialog.js +29 -0
  131. package/mjs/framework/useTableItems.d.ts +76 -0
  132. package/mjs/framework/useTableItems.js +371 -0
  133. package/mjs/framework/useView.d.ts +15 -0
  134. package/mjs/framework/useView.js +108 -0
  135. package/mjs/framework/utils/compare.d.ts +3 -0
  136. package/mjs/framework/utils/compare.js +53 -0
  137. package/mjs/framework/utils/download-file.d.ts +2 -0
  138. package/mjs/framework/utils/download-file.js +18 -0
  139. package/mjs/framework/utils/random-string.d.ts +1 -0
  140. package/mjs/framework/utils/random-string.js +12 -0
  141. package/mjs/frontend/controller/access/organizations/Organization.d.ts +44 -0
  142. package/mjs/frontend/controller/access/organizations/Organization.js +1 -0
  143. package/package.json +39 -0
@@ -0,0 +1,376 @@
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 __importDefault = (this && this.__importDefault) || function (mod) {
30
+ return (mod && mod.__esModule) ? mod : { "default": mod };
31
+ };
32
+ Object.defineProperty(exports, "__esModule", { value: true });
33
+ exports.PageFormCancelButton = exports.PageFormSubmitButton = exports.PageForm = exports.FormSchema = exports.FormTextSelect = exports.FormSelectInput = exports.FormSelect = exports.FormBooleanInput = exports.FormNumberInput = exports.FormTextArea = exports.FormTextInput = exports.FormInputCheckbox = exports.FormPageButtons = exports.FormPageAlerts = exports.FormPage = void 0;
34
+ var jsx_runtime_1 = require("react/jsx-runtime");
35
+ var ajv_1 = require("@hookform/resolvers/ajv");
36
+ var react_core_1 = require("@patternfly/react-core");
37
+ var react_icons_1 = require("@patternfly/react-icons");
38
+ var fast_deep_equal_1 = __importDefault(require("fast-deep-equal"));
39
+ var react_1 = require("react");
40
+ var react_hook_form_1 = require("react-hook-form");
41
+ var _1 = require(".");
42
+ var Scrollable_1 = require("./components/Scrollable");
43
+ var Settings_1 = require("./Settings");
44
+ function FormPage(props) {
45
+ // const methods = useForm<PartialDeep<T>>({
46
+ // defaultValues: props.defaultValues,
47
+ // resolver: ajvResolver(props.schema, { strict: false }),
48
+ // })
49
+ var children = react_1.Children.toArray(props.children);
50
+ var inputs = children.filter(function (child) {
51
+ if (!(0, react_1.isValidElement)(child))
52
+ return false;
53
+ if (child.type === FormPageAlerts)
54
+ return false;
55
+ if (child.type === FormPageButtons)
56
+ return false;
57
+ return true;
58
+ });
59
+ var buttons = children.find(function (child) {
60
+ if (!(0, react_1.isValidElement)(child))
61
+ return false;
62
+ if (child.type === FormPageButtons)
63
+ return true;
64
+ return false;
65
+ });
66
+ var _a = __read((0, react_1.useContext)(Settings_1.SettingsContext), 1), settings = _a[0];
67
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [!props.hideHeader && (0, jsx_runtime_1.jsx)(_1.PageHeader, __assign({}, props)), (0, jsx_runtime_1.jsxs)(react_core_1.Form
68
+ // eslint-disable-next-line @typescript-eslint/no-misused-promises
69
+ , __assign({
70
+ // eslint-disable-next-line @typescript-eslint/no-misused-promises
71
+ onSubmit: props.form.handleSubmit(props.onSubmit), isHorizontal: props.isVertical ? false : settings.formLayout === 'horizontal', style: {
72
+ display: 'flex',
73
+ flexDirection: 'column',
74
+ flexGrow: 1,
75
+ overflow: 'hidden',
76
+ } }, { 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({ padding: { default: props.noPadding ? 'noPadding' : 'padding' }, isWidthLimited: true }, { children: (0, jsx_runtime_1.jsx)(react_core_1.FormSection, { children: inputs }) })) })), buttons] }))] }));
77
+ }
78
+ exports.FormPage = FormPage;
79
+ function FormPageAlerts() {
80
+ var errors = (0, react_hook_form_1.useFormState)().errors;
81
+ var isMd = (0, _1.useBreakpoint)('md');
82
+ return ((0, jsx_runtime_1.jsx)(react_1.Fragment, { children: errors && Object.keys(errors).length > 0 && ((0, jsx_runtime_1.jsx)(react_core_1.Alert, { title: "Please fix validation errors.", isInline: true, style: { width: '100%', paddingLeft: isMd ? 190 : undefined }, variant: "danger" })) }));
83
+ }
84
+ exports.FormPageAlerts = FormPageAlerts;
85
+ function FormPageButtons(props) {
86
+ var errors = (0, react_hook_form_1.useFormState)().errors;
87
+ return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(FormPageAlerts, {}), (0, jsx_runtime_1.jsx)(react_core_1.PageSection, __assign({ isFilled: true, style: {
88
+ display: 'flex',
89
+ flexDirection: 'column',
90
+ maxHeight: '100%',
91
+ borderTop: 'thin solid var(--pf-global--BorderColor--100)',
92
+ }, variant: "light" }, { children: (0, jsx_runtime_1.jsxs)(react_core_1.ActionGroup, __assign({ style: { marginTop: 0 } }, { children: [errors && Object.keys(errors).length > 0 ? ((0, jsx_runtime_1.jsx)(react_core_1.Tooltip, __assign({ content: 'Please fix validation errors' }, { children: (0, jsx_runtime_1.jsx)(react_core_1.Button, __assign({ type: "submit", isAriaDisabled: true }, { children: props.submitText })) }))) : ((0, jsx_runtime_1.jsx)(react_core_1.Button, __assign({ type: "submit" }, { children: props.submitText }))), (0, jsx_runtime_1.jsx)(react_core_1.Button, __assign({ type: "button", variant: "link", onClick: props.onCancel }, { children: props.cancelText }))] })) }))] }));
93
+ }
94
+ exports.FormPageButtons = FormPageButtons;
95
+ function FormInputCheckbox(props) {
96
+ var control = (0, react_hook_form_1.useFormContext)().control;
97
+ var field = (0, react_hook_form_1.useController)({ control: control, name: props.name }).field;
98
+ var id = props.name;
99
+ return ((0, jsx_runtime_1.jsx)(react_core_1.Checkbox, __assign({ label: props.label, id: id, "aria-describedby": "".concat(id, "-helper"), description: props.description, body: field.value ? props.body : undefined }, field, { isChecked: !!field.value })));
100
+ }
101
+ exports.FormInputCheckbox = FormInputCheckbox;
102
+ function FormTextInput(props) {
103
+ var _a;
104
+ var _b = (0, react_hook_form_1.useFormContext)(), register = _b.register, isSubmitting = _b.formState.isSubmitting;
105
+ var registration = register(props.name);
106
+ var fieldState = (0, react_hook_form_1.useController)({ name: props.name }).fieldState;
107
+ var error = fieldState.error;
108
+ var id = (_a = props.id) !== null && _a !== void 0 ? _a : props.name;
109
+ var _c = __read((0, react_1.useState)(false), 2), showSecret = _c[0], setShowSecret = _c[1];
110
+ 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) {
111
+ void registration.onChange(e);
112
+ },
113
+ // innerRef={registration.ref}
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, {}) })))] }) })));
115
+ }
116
+ exports.FormTextInput = FormTextInput;
117
+ function FormTextArea(props) {
118
+ var _a;
119
+ var _b = (0, react_hook_form_1.useFormContext)(), register = _b.register, isSubmitting = _b.formState.isSubmitting;
120
+ var registration = register(props.name);
121
+ var fieldState = (0, react_hook_form_1.useController)({ name: props.name }).fieldState;
122
+ var error = fieldState.error;
123
+ var id = (_a = props.id) !== null && _a !== void 0 ? _a : props.name;
124
+ 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.jsx)(react_core_1.TextArea, __assign({ id: id, type: props.secret ? '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) { return void registration.onChange(e); }, resizeOrientation: "vertical", isReadOnly: isSubmitting })) })));
125
+ }
126
+ exports.FormTextArea = FormTextArea;
127
+ function FormNumberInput(props) {
128
+ var _a, _b, _c;
129
+ var isSubmitting = (0, react_hook_form_1.useFormContext)().formState.isSubmitting;
130
+ var _d = (0, react_hook_form_1.useController)({ name: props.name }), field = _d.field, fieldState = _d.fieldState;
131
+ var error = fieldState.error;
132
+ var id = (_a = props.id) !== null && _a !== void 0 ? _a : props.name;
133
+ var max = (_b = props.max) !== null && _b !== void 0 ? _b : 100;
134
+ var min = (_c = props.min) !== null && _c !== void 0 ? _c : 1;
135
+ var value = Number(field.value);
136
+ 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.Flex, __assign({ alignItems: { default: 'alignItemsFlexStart' } }, { children: [(0, jsx_runtime_1.jsxs)(react_core_1.Flex, __assign({ alignItems: { default: 'alignItemsFlexStart' }, spaceItems: { default: 'spaceItemsSm' } }, { children: [(0, jsx_runtime_1.jsx)(react_core_1.FlexItem, __assign({ style: { paddingTop: 6, minWidth: 20, textAlign: 'right' } }, { children: Math.floor((max - min) * value + min) })), props.valueLabel && ((0, jsx_runtime_1.jsx)(react_core_1.FlexItem, __assign({ style: { paddingTop: 6, minWidth: 40 } }, { children: props.valueLabel })))] })), (0, jsx_runtime_1.jsx)(react_core_1.FlexItem, __assign({ grow: { default: 'grow' } }, { children: (0, jsx_runtime_1.jsx)(react_core_1.Slider, { id: id, "aria-describedby": "".concat(id, "-form-group"),
137
+ // isRequired={props.required}
138
+ // validated={error?.message ? 'error' : undefined}
139
+ autoFocus: props.autoFocus,
140
+ // {...registration}
141
+ value: (max - min) * value + min, onChange: function (v) { return field.onChange((v - min) / (max - min)); }, max: max, min: min,
142
+ // innerRef={registration.ref}
143
+ isDisabled: isSubmitting, showBoundaries: false }) }))] })) })));
144
+ }
145
+ exports.FormNumberInput = FormNumberInput;
146
+ function FormBooleanInput(props) {
147
+ var _a;
148
+ var isSubmitting = (0, react_hook_form_1.useFormContext)().formState.isSubmitting;
149
+ var _b = (0, react_hook_form_1.useController)({ name: props.name }), field = _b.field, fieldState = _b.fieldState;
150
+ var error = fieldState.error;
151
+ var id = (_a = props.id) !== null && _a !== void 0 ? _a : props.name;
152
+ 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.jsx)(react_core_1.Switch, { id: id, "aria-describedby": "".concat(id, "-form-group"),
153
+ // isRequired={props.required}
154
+ // validated={error?.message ? 'error' : undefined}
155
+ autoFocus: props.autoFocus,
156
+ // placeholder={props.placeholder}
157
+ // {...registration}
158
+ isChecked: typeof field.value === 'boolean' ? field.value : false, onChange: function (e) { return field.onChange(e); },
159
+ // innerRef={registration.ref}
160
+ isDisabled: isSubmitting }) })));
161
+ }
162
+ exports.FormBooleanInput = FormBooleanInput;
163
+ function FormSelect(props) {
164
+ var _a, _b;
165
+ var _c = (0, react_hook_form_1.useController)({ name: props.name }), field = _c.field, fieldError = _c.fieldState.error;
166
+ var _d = __read((0, react_1.useState)(false), 2), open = _d[0], setOpen = _d[1];
167
+ var id = (_a = props.id) !== null && _a !== void 0 ? _a : props.name;
168
+ var error = fieldError !== undefined && fieldError.message;
169
+ var options = props.options;
170
+ options.sort(function (l, r) {
171
+ var _a, _b, _c, _d;
172
+ if (((_a = l.group) !== null && _a !== void 0 ? _a : '') < ((_b = r.group) !== null && _b !== void 0 ? _b : ''))
173
+ return -1;
174
+ if (((_c = l.group) !== null && _c !== void 0 ? _c : '') > ((_d = r.group) !== null && _d !== void 0 ? _d : ''))
175
+ return 1;
176
+ if (l.label < r.label)
177
+ return -1;
178
+ if (l.label > r.label)
179
+ return 1;
180
+ return 0;
181
+ });
182
+ var selectedIndex = options.findIndex(function (option) { return (0, fast_deep_equal_1.default)(option.value, field.value); });
183
+ var groups = options.reduce(function (groups, option) {
184
+ var _a;
185
+ var group = (_a = option.group) !== null && _a !== void 0 ? _a : '';
186
+ var optionsArray = groups[group];
187
+ if (!optionsArray) {
188
+ optionsArray = [];
189
+ groups[group] = optionsArray;
190
+ }
191
+ optionsArray.push(option);
192
+ return groups;
193
+ }, {});
194
+ var isGrouped = Object.keys(groups).length > 1 ||
195
+ (Object.keys(groups).length === 1 && Object.keys(groups)[0] !== '');
196
+ var onSelect = (0, react_1.useCallback)(function (_event, value) {
197
+ if (typeof value !== 'string') {
198
+ value = value.toString();
199
+ }
200
+ var selectedIndex = Number(value);
201
+ var selected = options[selectedIndex].value;
202
+ field.onChange(selected);
203
+ setOpen(false);
204
+ }, [field, options]);
205
+ var index = 0;
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, 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 () {
207
+ var _a, _b;
208
+ setOpen(false);
209
+ (_b = (_a = props.footer) === null || _a === void 0 ? void 0 : _a.click) === null || _b === void 0 ? void 0 : _b.call(_a);
210
+ } }, { children: props.footer.label }))), maxHeight: 280 }, { children: !isGrouped
211
+ ? options.map(function (option, index) { return ((0, jsx_runtime_1.jsx)(react_core_1.SelectOption, __assign({ value: index.toString(), label: option.label, description: option.description }, { children: option.label }), index)); })
212
+ : 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: (index++).toString(), label: option.label, description: option.description }, { children: option.label }), index)); }) }), group)); }) })) })));
213
+ }
214
+ exports.FormSelect = FormSelect;
215
+ function FormSelectInput(props) {
216
+ var control = (0, react_hook_form_1.useFormContext)().control;
217
+ var _a = (0, react_hook_form_1.useController)({ control: control, name: props.name }), field = _a.field, error = _a.fieldState.error;
218
+ var menuItems = react_1.Children.toArray(props.children)
219
+ .filter(function (child) { return (0, react_1.isValidElement)(child) && child.type === react_core_1.SelectOption; })
220
+ .map(function (child) {
221
+ if ((0, react_1.isValidElement)(child) && child.type === react_core_1.SelectOption) {
222
+ return ((0, jsx_runtime_1.jsx)(react_core_1.MenuItem, { children: child.props.children }, child.props.value));
223
+ }
224
+ return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
225
+ });
226
+ var _b = __read((0, react_1.useState)(false), 2), open = _b[0], setOpen = _b[1];
227
+ var id = props.name;
228
+ var errorMessage;
229
+ switch (error === null || error === void 0 ? void 0 : error.type) {
230
+ case 'required':
231
+ errorMessage = props.label + ' is required.';
232
+ break;
233
+ default:
234
+ errorMessage = error === null || error === void 0 ? void 0 : error.type;
235
+ break;
236
+ }
237
+ return ((0, jsx_runtime_1.jsx)(react_core_1.FormGroup, __assign({ fieldId: id, label: props.label, helperTextInvalid: errorMessage, helperText: props.helperText, isRequired: props.required, validated: errorMessage ? 'error' : undefined }, { children: (0, jsx_runtime_1.jsxs)(react_core_1.TextInputGroup, { children: [(0, jsx_runtime_1.jsx)(react_core_1.TextInputGroupMain, __assign({}, field)), (0, jsx_runtime_1.jsx)(react_core_1.TextInputGroupUtilities, { children: (0, jsx_runtime_1.jsx)(react_core_1.Button, __assign({ variant: "plain", onClick: function () { return setOpen(!open); }, "aria-label": "Options menu" }, { children: (0, jsx_runtime_1.jsx)(react_icons_1.CaretDownIcon, {}) })) }), open && ((0, jsx_runtime_1.jsx)(react_core_1.Menu, __assign({ style: { position: 'absolute', right: 0, top: 36, width: '100%' } }, { children: menuItems })))] }) })));
238
+ }
239
+ exports.FormSelectInput = FormSelectInput;
240
+ function FormTextSelect(props) {
241
+ var _a;
242
+ var _b = (0, react_hook_form_1.useFormContext)(), register = _b.register, setValue = _b.setValue, isSubmitting = _b.formState.isSubmitting;
243
+ var registration = register(props.name);
244
+ var fieldState = (0, react_hook_form_1.useController)({ name: props.name }).fieldState;
245
+ var error = fieldState.error;
246
+ var id = (_a = props.id) !== null && _a !== void 0 ? _a : props.name;
247
+ id = id.split('.').join('-');
248
+ return ((0, jsx_runtime_1.jsx)(react_1.Fragment, { children: (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 ? '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) {
249
+ void registration.onChange(e);
250
+ },
251
+ // innerRef={registration.ref}
252
+ isReadOnly: isSubmitting })), (0, jsx_runtime_1.jsx)(react_core_1.Button, __assign({ variant: "control", onClick: function () {
253
+ var _a;
254
+ return (_a = props.selectOpen) === null || _a === void 0 ? void 0 : _a.call(props, function (item) {
255
+ if (props.selectValue) {
256
+ var value = props.selectValue(item);
257
+ setValue(props.name, value, { shouldValidate: true });
258
+ }
259
+ }, props.selectTitle);
260
+ }, "aria-label": "Options menu", isDisabled: isSubmitting }, { children: (0, jsx_runtime_1.jsx)(react_icons_1.SearchIcon, {}) }))] }) })) }));
261
+ }
262
+ exports.FormTextSelect = FormTextSelect;
263
+ function FormSchema(props) {
264
+ var schema = props.schema;
265
+ var base = props.base ? props.base + '.' : '';
266
+ var p = [];
267
+ for (var propertyName in schema.properties) {
268
+ var property = schema.properties[propertyName];
269
+ switch (property) {
270
+ case true:
271
+ case false:
272
+ continue;
273
+ }
274
+ var title = typeof property.title === 'string' ? property.title : propertyName;
275
+ var placeholder = property.placeholder;
276
+ placeholder = typeof placeholder === 'string' ? placeholder : undefined;
277
+ var required = Array.isArray(schema.required) && schema.required.includes(propertyName);
278
+ switch (property.type) {
279
+ case 'string': {
280
+ switch (property.variant) {
281
+ case 'select': {
282
+ if ('options' in property) {
283
+ var formSelectProps = property;
284
+ 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));
285
+ }
286
+ else {
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));
288
+ }
289
+ break;
290
+ }
291
+ case 'textarea':
292
+ p.push((0, jsx_runtime_1.jsx)(FormTextArea, { name: base + propertyName, label: title, placeholder: placeholder, required: required }, base + propertyName));
293
+ break;
294
+ case 'secret':
295
+ p.push((0, jsx_runtime_1.jsx)(FormTextInput, { name: base + propertyName, label: title, placeholder: placeholder, required: required, secret: true }, base + propertyName));
296
+ break;
297
+ default:
298
+ p.push((0, jsx_runtime_1.jsx)(FormTextInput, { name: base + propertyName, label: title, placeholder: placeholder, required: required }, base + propertyName));
299
+ break;
300
+ }
301
+ break;
302
+ }
303
+ case 'number': {
304
+ p.push((0, jsx_runtime_1.jsx)(FormNumberInput, { name: base + propertyName, label: title, required: required, min: property.min, max: property.max, valueLabel: property.valueLabel }, base + propertyName));
305
+ break;
306
+ }
307
+ case 'boolean': {
308
+ p.push((0, jsx_runtime_1.jsx)(FormBooleanInput, { name: base + propertyName, label: title, required: required }, base + propertyName));
309
+ break;
310
+ }
311
+ case 'object': {
312
+ p.push((0, jsx_runtime_1.jsx)(FormSchema, { schema: property, base: base + propertyName }, propertyName));
313
+ break;
314
+ }
315
+ }
316
+ }
317
+ return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: p });
318
+ }
319
+ exports.FormSchema = FormSchema;
320
+ function PageForm(props) {
321
+ var schema = props.schema, defaultValue = props.defaultValue;
322
+ var form = (0, react_hook_form_1.useForm)({
323
+ defaultValues: defaultValue !== null && defaultValue !== void 0 ? defaultValue : {},
324
+ resolver: schema
325
+ ? (0, ajv_1.ajvResolver)(schema, { strict: false, addFormats: true })
326
+ : undefined,
327
+ });
328
+ var handleSubmit = form.handleSubmit, setFieldError = form.setError;
329
+ var _a = __read((0, react_1.useState)(''), 2), error = _a[0], setError = _a[1];
330
+ var isMd = (0, _1.useBreakpoint)('md');
331
+ var _b = __read((0, react_1.useContext)(Settings_1.SettingsContext), 1), settings = _b[0];
332
+ var isHorizontal = props.isVertical ? false : settings.formLayout === 'horizontal';
333
+ var multipleColumns = props.singleColumn ? false : settings.formColumns === 'multiple';
334
+ var sm = multipleColumns ? (isHorizontal ? 12 : 12) : 12;
335
+ var md = multipleColumns ? (isHorizontal ? 12 : 6) : 12;
336
+ var lg = multipleColumns ? (isHorizontal ? 6 : 6) : 12;
337
+ var xl = multipleColumns ? (isHorizontal ? 6 : 6) : 12;
338
+ var xl2 = multipleColumns ? (isHorizontal ? 4 : 4) : 12;
339
+ var maxWidth = multipleColumns ? undefined : isHorizontal ? 960 : 800;
340
+ return (
341
+ // <PageBody>
342
+ (0, jsx_runtime_1.jsx)(react_hook_form_1.FormProvider, __assign({}, form, { children: (0, jsx_runtime_1.jsxs)(react_core_1.Form
343
+ // eslint-disable-next-line @typescript-eslint/no-misused-promises
344
+ , __assign({
345
+ // eslint-disable-next-line @typescript-eslint/no-misused-promises
346
+ onSubmit: handleSubmit(function (data) {
347
+ setError('');
348
+ return props.onSubmit(data, setError, setFieldError);
349
+ }), isHorizontal: isHorizontal, style: {
350
+ display: 'flex',
351
+ flexDirection: 'column',
352
+ flexGrow: 1,
353
+ overflow: props.disableScrolling ? undefined : 'hidden',
354
+ gap: 0,
355
+ } }, { children: [props.disableScrolling ? ((0, jsx_runtime_1.jsx)(react_core_1.PageSection, __assign({ isFilled: true,
356
+ // padding={{ default: props.onCancel ? 'padding' : 'noPadding' }}
357
+ 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,
358
+ // padding={{ default: props.onCancel ? 'padding' : 'noPadding' }}
359
+ 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)(_1.Collapse, __assign({ open: !!error }, { children: (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: {
360
+ borderTop: 'thin solid var(--pf-global--BorderColor--100)',
361
+ backgroundColor: settings.theme === 'dark' ? 'var(--pf-global--BackgroundColor--400)' : undefined,
362
+ }, 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 })))] })) }))
363
+ // </PageBody>
364
+ );
365
+ }
366
+ exports.PageForm = PageForm;
367
+ function PageFormSubmitButton(props) {
368
+ var _a = (0, react_hook_form_1.useFormState)(), isSubmitting = _a.isSubmitting, errors = _a.errors;
369
+ var hasErrors = errors && Object.keys(errors).length > 0;
370
+ return ((0, jsx_runtime_1.jsx)(react_core_1.Tooltip, __assign({ content: "Please fix errors", trigger: hasErrors ? undefined : 'manual' }, { children: (0, jsx_runtime_1.jsx)(react_core_1.Button, __assign({ type: "submit", isDisabled: isSubmitting, isLoading: isSubmitting, isDanger: hasErrors, variant: hasErrors ? 'secondary' : undefined, style: props.style }, { children: props.children })) })));
371
+ }
372
+ exports.PageFormSubmitButton = PageFormSubmitButton;
373
+ function PageFormCancelButton(props) {
374
+ return ((0, jsx_runtime_1.jsx)(react_core_1.Button, __assign({ type: "button", variant: "link", onClick: props.onCancel }, { children: props.children })));
375
+ }
376
+ exports.PageFormCancelButton = PageFormCancelButton;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PageFrameworkProvider = void 0;
4
+ var jsx_runtime_1 = require("react/jsx-runtime");
5
+ var PageDialog_1 = require("./PageDialog");
6
+ var Settings_1 = require("./Settings");
7
+ var useFrameworkTranslations_1 = require("./useFrameworkTranslations");
8
+ function PageFrameworkProvider(props) {
9
+ 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: props.children }) }) }));
10
+ }
11
+ exports.PageFrameworkProvider = PageFrameworkProvider;
@@ -0,0 +1,96 @@
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.PageHeader = 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 react_1 = require("react");
19
+ var react_router_dom_1 = require("react-router-dom");
20
+ var useBreakPoint_1 = require("./components/useBreakPoint");
21
+ var Settings_1 = require("./Settings");
22
+ function Breadcrumbs(props) {
23
+ var history = (0, react_router_dom_1.useNavigate)();
24
+ if (!props.breadcrumbs)
25
+ return (0, jsx_runtime_1.jsx)(react_1.Fragment, {});
26
+ return ((0, jsx_runtime_1.jsx)(react_core_1.Breadcrumb, __assign({ style: props.style }, { children: props.breadcrumbs.map(function (breadcrumb) {
27
+ var _a;
28
+ if (!breadcrumb.label)
29
+ return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
30
+ return ((0, jsx_runtime_1.jsx)(react_core_1.BreadcrumbItem, __assign({ id: breadcrumb.id, component: breadcrumb.component, onClick: breadcrumb.to ? function () { return breadcrumb.to && history(breadcrumb.to); } : undefined, style: {
31
+ color: breadcrumb.to ? 'var(--pf-c-breadcrumb__link--Color)' : undefined,
32
+ cursor: breadcrumb.to ? 'pointer' : undefined,
33
+ }, isActive: breadcrumb.to === undefined }, { children: breadcrumb.label }), (_a = breadcrumb.id) !== null && _a !== void 0 ? _a : breadcrumb.label));
34
+ }) })));
35
+ }
36
+ /**
37
+ * PageHeader enables the responsive layout of the header.
38
+ *
39
+ * @param {Breadcrumb[]} breadcrumbs - The breadcrumbs for the page.
40
+ * @param {string} title - The title of the page.
41
+ * @param {string} titleHelpTitle - The title of help popover.
42
+ * @param {ReactNode} titleHelp - The content for the help popover.
43
+ * @param {string} description - The description of the page.
44
+ * @param {ReactNode} controls - Support for extra page controls.
45
+ * @param {ReactNode} headerActions - The actions for the page.
46
+ *
47
+ * @example
48
+ * <Page>
49
+ * <PageLayout>
50
+ * <PageHeader
51
+ * breadcrumbs={[{ label: 'Home', to: '/home' }, { label: 'Page title' }]}
52
+ * title='Page title'
53
+ * description='Page description'
54
+ * headerActions={<PageActions actions={actions} />}
55
+ * />
56
+ * <PageBody />...</PageBody>
57
+ * </PageLayout>
58
+ * <Page>
59
+ */
60
+ function PageHeader(props) {
61
+ var navigation = props.navigation, breadcrumbs = props.breadcrumbs, title = props.title, description = props.description, controls = props.controls, pageActions = props.headerActions;
62
+ var lg = (0, useBreakPoint_1.useBreakpoint)('lg');
63
+ var xl = (0, useBreakPoint_1.useBreakpoint)('xl');
64
+ var xxl = (0, useBreakPoint_1.useBreakpoint)('xxl');
65
+ var isMdOrLarger = (0, useBreakPoint_1.useBreakpoint)('md');
66
+ // const isSmLarger = useBreakpoint('sm')
67
+ var settings = (0, Settings_1.useSettings)();
68
+ var t = props.t;
69
+ t = t ? t : function (t) { return t; };
70
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [navigation && ((0, jsx_runtime_1.jsx)(react_core_1.PageSection, __assign({ variant: react_core_1.PageSectionVariants.light, style: {
71
+ paddingLeft: 0,
72
+ paddingTop: 0,
73
+ paddingBottom: 0,
74
+ borderBottom: settings.borders
75
+ ? 'thin solid var(--pf-global--BorderColor--100)'
76
+ : undefined,
77
+ backgroundColor: 'var(--pf-global--BackgroundColor--100)',
78
+ } }, { 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 }, hasOverflowScroll: true }, { children: navigation })) })) }))), (isMdOrLarger || !navigation) && ((0, jsx_runtime_1.jsx)(react_core_1.PageSection, __assign({ variant: react_core_1.PageSectionVariants.light, style: {
79
+ paddingTop: breadcrumbs ? (xl ? 16 : 12) : xl ? 16 : 12,
80
+ paddingBottom: xl ? 20 : 12,
81
+ borderBottom: settings.borders
82
+ ? 'thin solid var(--pf-global--BorderColor--100)'
83
+ : undefined,
84
+ backgroundColor: settings.theme === 'dark'
85
+ ? xxl
86
+ ? 'var(--pf-global--BackgroundColor--300)'
87
+ : 'var(--pf-global--BackgroundColor--400)'
88
+ : 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: (0, jsx_runtime_1.jsx)(react_core_1.Truncate, { content: description }) })))] })), 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 })] })))] })) })))] }));
95
+ }
96
+ exports.PageHeader = PageHeader;
@@ -0,0 +1,41 @@
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 __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.PageLayout = void 0;
18
+ var jsx_runtime_1 = require("react/jsx-runtime");
19
+ var react_i18next_1 = require("react-i18next");
20
+ var ErrorBoundary_1 = __importDefault(require("./components/ErrorBoundary"));
21
+ /**
22
+ * PageLayout enables the responsive layout of the page.
23
+ *
24
+ * @example
25
+ * <Page>
26
+ * <PageLayout>
27
+ * <PageHeader />
28
+ * <PageBody />...</PageBody>
29
+ * </PageLayout>
30
+ * <Page>
31
+ */
32
+ function PageLayout(props) {
33
+ var t = (0, react_i18next_1.useTranslation)().t;
34
+ return ((0, jsx_runtime_1.jsx)(ErrorBoundary_1.default, __assign({ message: t('Error') }, { children: (0, jsx_runtime_1.jsx)("div", __assign({ style: {
35
+ display: 'flex',
36
+ flexDirection: 'column',
37
+ height: '100%',
38
+ maxHeight: '100%',
39
+ } }, { children: props.children })) })));
40
+ }
41
+ exports.PageLayout = PageLayout;
@@ -0,0 +1,28 @@
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.PagePagination = 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 useBreakPoint_1 = require("./components/useBreakPoint");
19
+ var Settings_1 = require("./Settings");
20
+ function PagePagination(props) {
21
+ var setPage = props.setPage, setPerPage = props.setPerPage;
22
+ var onSetPage = (0, react_1.useCallback)(function (_event, page) { return setPage(page); }, [setPage]);
23
+ var onPerPageSelect = (0, react_1.useCallback)(function (_event, perPage) { return setPerPage(perPage); }, [setPerPage]);
24
+ var sm = (0, useBreakPoint_1.useBreakpoint)('md');
25
+ var settings = (0, Settings_1.useSettings)();
26
+ return ((0, jsx_runtime_1.jsx)(react_core_1.Pagination, { variant: react_core_1.PaginationVariant.bottom, itemCount: props.itemCount, page: props.page, perPage: props.perPage, onSetPage: onSetPage, onPerPageSelect: onPerPageSelect, style: __assign(__assign({}, props.style), { borderTop: 'thin solid var(--pf-global--BorderColor--100)', boxShadow: 'none', zIndex: 301, marginTop: -1, paddingTop: sm ? 6 : undefined, paddingBottom: sm ? 6 : undefined, backgroundColor: settings.theme === 'dark' ? 'var(--pf-global--BackgroundColor--300)' : undefined }) }));
27
+ }
28
+ exports.PagePagination = PagePagination;