@ansible/ansible-ui-framework 0.0.613 → 0.0.615

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 (224) hide show
  1. package/framework/BulkActionDialog.d.ts +14 -0
  2. package/framework/BulkConfirmationDialog.d.ts +20 -0
  3. package/{cjs → framework}/PageActions/PageActions.d.ts +0 -13
  4. package/{cjs → framework}/PageActions/PageButtonAction.d.ts +0 -1
  5. package/{cjs → framework}/PageActions/PagePinnedActions.d.ts +0 -4
  6. package/{cjs → framework}/PageForm/Inputs/FormGroupSelect.d.ts +0 -1
  7. package/{cjs → framework}/PageForm/Inputs/FormGroupSelectOption.d.ts +0 -5
  8. package/{cjs → framework}/PageForm/Inputs/FormGroupTextArea.d.ts +0 -1
  9. package/{cjs → framework}/PageForm/Inputs/FormGroupTextInput.d.ts +0 -1
  10. package/{cjs → framework}/PageForm/Inputs/FormGroupTypeAheadMultiSelect.d.ts +0 -1
  11. package/{cjs → framework}/PageForm/Inputs/PageFormCheckbox.d.ts +0 -1
  12. package/{cjs → framework}/PageForm/Inputs/PageFormCreatableSelect.d.ts +0 -1
  13. package/{cjs → framework}/PageForm/Inputs/PageFormFileUpload.d.ts +0 -1
  14. package/{cjs → framework}/PageForm/Inputs/PageFormGroup.d.ts +0 -1
  15. package/{cjs → framework}/PageForm/Inputs/PageFormSelect.d.ts +0 -1
  16. package/{cjs → framework}/PageForm/Inputs/PageFormSelectOption.d.ts +0 -1
  17. package/{cjs → framework}/PageForm/Inputs/PageFormTextArea.d.ts +0 -1
  18. package/{cjs → framework}/PageForm/Inputs/PageFormTextInput.d.ts +0 -1
  19. package/{cjs → framework}/PageForm/PageFormSchema.d.ts +0 -2
  20. package/framework/PageFramework.d.ts +6 -0
  21. package/framework/PageHeader.d.ts +22 -0
  22. package/framework/PageLayout.d.ts +4 -0
  23. package/{cjs → framework}/PageTable/PageTable.d.ts +0 -15
  24. package/{cjs → framework}/components/useBreakPoint.d.ts +0 -1
  25. package/{cjs → framework}/index.d.ts +1 -0
  26. package/{cjs → framework}/utils/compare.d.ts +3 -3
  27. package/index.js +16475 -0
  28. package/index.umd.cjs +165 -0
  29. package/package.json +16 -15
  30. package/style.css +1 -0
  31. package/cjs/BulkActionDialog.d.ts +0 -34
  32. package/cjs/BulkActionDialog.js +0 -300
  33. package/cjs/BulkConfirmationDialog.d.ts +0 -36
  34. package/cjs/BulkConfirmationDialog.js +0 -135
  35. package/cjs/PageActions/PageAction.js +0 -2
  36. package/cjs/PageActions/PageActionType.js +0 -12
  37. package/cjs/PageActions/PageActions.js +0 -69
  38. package/cjs/PageActions/PageBulkAction.js +0 -35
  39. package/cjs/PageActions/PageButtonAction.js +0 -41
  40. package/cjs/PageActions/PageDropdownAction.js +0 -132
  41. package/cjs/PageActions/PagePinnedActions.js +0 -55
  42. package/cjs/PageActions/PageSingleAction.js +0 -38
  43. package/cjs/PageAlertToaster.js +0 -102
  44. package/cjs/PageAlerts.js +0 -98
  45. package/cjs/PageBody.js +0 -52
  46. package/cjs/PageCells/BytesCell.js +0 -16
  47. package/cjs/PageCells/CapacityCell.js +0 -67
  48. package/cjs/PageCells/CopyCell.js +0 -25
  49. package/cjs/PageCells/DateTimeCell.js +0 -66
  50. package/cjs/PageCells/ElapsedTimeCell.js +0 -48
  51. package/cjs/PageCells/LabelsCell.js +0 -20
  52. package/cjs/PageCells/TextCell.js +0 -39
  53. package/cjs/PageColumnModal.js +0 -131
  54. package/cjs/PageDashboard/PageChartContainer.js +0 -69
  55. package/cjs/PageDashboard/PageDashboardCard.js +0 -22
  56. package/cjs/PageDashboard/PageDashboardChart.js +0 -54
  57. package/cjs/PageDashboard/PageDonutChart.js +0 -53
  58. package/cjs/PageDashboard/PageScatterChart.js +0 -5564
  59. package/cjs/PageDetails/PageDetail.js +0 -28
  60. package/cjs/PageDetails/PageDetails.js +0 -41
  61. package/cjs/PageDetails/PageDetailsFromColumns.js +0 -27
  62. package/cjs/PageDialog.js +0 -28
  63. package/cjs/PageForm/Inputs/FormGroupSelect.js +0 -60
  64. package/cjs/PageForm/Inputs/FormGroupSelectOption.js +0 -61
  65. package/cjs/PageForm/Inputs/FormGroupTextArea.js +0 -53
  66. package/cjs/PageForm/Inputs/FormGroupTextInput.js +0 -58
  67. package/cjs/PageForm/Inputs/FormGroupTypeAheadMultiSelect.js +0 -67
  68. package/cjs/PageForm/Inputs/PageFormCheckbox.js +0 -39
  69. package/cjs/PageForm/Inputs/PageFormCodeEditor.js +0 -154
  70. package/cjs/PageForm/Inputs/PageFormCreatableSelect.js +0 -82
  71. package/cjs/PageForm/Inputs/PageFormFileUpload.js +0 -72
  72. package/cjs/PageForm/Inputs/PageFormGroup.js +0 -24
  73. package/cjs/PageForm/Inputs/PageFormMultiInput.js +0 -102
  74. package/cjs/PageForm/Inputs/PageFormSelect.js +0 -26
  75. package/cjs/PageForm/Inputs/PageFormSelectOption.js +0 -42
  76. package/cjs/PageForm/Inputs/PageFormSlider.js +0 -36
  77. package/cjs/PageForm/Inputs/PageFormSwitch.js +0 -38
  78. package/cjs/PageForm/Inputs/PageFormTextArea.js +0 -50
  79. package/cjs/PageForm/Inputs/PageFormTextInput.js +0 -72
  80. package/cjs/PageForm/Inputs/PageFormTextSelect.js +0 -40
  81. package/cjs/PageForm/PageForm.js +0 -146
  82. package/cjs/PageForm/PageFormAlerts.js +0 -32
  83. package/cjs/PageForm/PageFormButtons.js +0 -28
  84. package/cjs/PageForm/PageFormInputPopover.js +0 -2
  85. package/cjs/PageForm/PageFormSchema.js +0 -138
  86. package/cjs/PageForm/Utils/PageFormHidden.js +0 -13
  87. package/cjs/PageForm/Utils/PageFormSection.js +0 -20
  88. package/cjs/PageForm/Utils/PageFormWatch.js +0 -10
  89. package/cjs/PageFramework.css +0 -27
  90. package/cjs/PageFramework.d.ts +0 -12
  91. package/cjs/PageFramework.js +0 -31
  92. package/cjs/PageHeader.d.ts +0 -45
  93. package/cjs/PageHeader.js +0 -111
  94. package/cjs/PageLayout.d.ts +0 -17
  95. package/cjs/PageLayout.js +0 -60
  96. package/cjs/PageTable/PagePagination.js +0 -28
  97. package/cjs/PageTable/PageTable.js +0 -266
  98. package/cjs/PageTable/PageTableCard.js +0 -161
  99. package/cjs/PageTable/PageTableCards.js +0 -38
  100. package/cjs/PageTable/PageTableList.js +0 -153
  101. package/cjs/PageTable/PageTableViewType.js +0 -9
  102. package/cjs/PageTable/PageToolbar.css +0 -7
  103. package/cjs/PageTable/PageToolbar.js +0 -228
  104. package/cjs/PageTable/useTableItems.js +0 -507
  105. package/cjs/PageTabs.js +0 -86
  106. package/cjs/Settings.js +0 -125
  107. package/cjs/components/BulkSelector.js +0 -91
  108. package/cjs/components/Collapse.css +0 -12
  109. package/cjs/components/Collapse.js +0 -23
  110. package/cjs/components/DetailInfo.js +0 -21
  111. package/cjs/components/Dotted.js +0 -19
  112. package/cjs/components/DropdownControlled.js +0 -28
  113. package/cjs/components/EmptyStateCustom.js +0 -21
  114. package/cjs/components/EmptyStateFilter.js +0 -26
  115. package/cjs/components/EmptyStateNoData.js +0 -11
  116. package/cjs/components/EmptyStateUnauthorized.js +0 -13
  117. package/cjs/components/ErrorBoundary.js +0 -45
  118. package/cjs/components/Help.js +0 -24
  119. package/cjs/components/IconWrapper.js +0 -53
  120. package/cjs/components/LoadingPage.js +0 -25
  121. package/cjs/components/LoadingState.js +0 -20
  122. package/cjs/components/Masonry.js +0 -113
  123. package/cjs/components/PageGrid.js +0 -61
  124. package/cjs/components/Scrollable.js +0 -87
  125. package/cjs/components/StandardPopover.js +0 -64
  126. package/cjs/components/icons/RunningIcon.js +0 -36
  127. package/cjs/components/pfcolors.js +0 -54
  128. package/cjs/components/useBreakPoint.js +0 -145
  129. package/cjs/components/useIsMounted.js +0 -28
  130. package/cjs/components/useOpen.js +0 -36
  131. package/cjs/components/usePageNavigate.js +0 -37
  132. package/cjs/components/useSearchParams.js +0 -20
  133. package/cjs/components/useWindowLocation.js +0 -49
  134. package/cjs/index.js +0 -67
  135. package/cjs/useFrameworkTranslations.js +0 -52
  136. package/cjs/useInMemoryView.js +0 -102
  137. package/cjs/useSelectDialog.js +0 -96
  138. package/cjs/useSelectMultipleDialog.js +0 -62
  139. package/cjs/useView.js +0 -155
  140. package/cjs/utils/capitalize.js +0 -7
  141. package/cjs/utils/compare.js +0 -59
  142. package/cjs/utils/download-file.js +0 -23
  143. package/cjs/utils/formatDateString.js +0 -11
  144. package/cjs/utils/random-string.js +0 -17
  145. /package/{cjs → framework}/PageActions/PageAction.d.ts +0 -0
  146. /package/{cjs → framework}/PageActions/PageActionType.d.ts +0 -0
  147. /package/{cjs → framework}/PageActions/PageBulkAction.d.ts +0 -0
  148. /package/{cjs → framework}/PageActions/PageDropdownAction.d.ts +0 -0
  149. /package/{cjs → framework}/PageActions/PageSingleAction.d.ts +0 -0
  150. /package/{cjs → framework}/PageAlertToaster.d.ts +0 -0
  151. /package/{cjs → framework}/PageAlerts.d.ts +0 -0
  152. /package/{cjs → framework}/PageBody.d.ts +0 -0
  153. /package/{cjs → framework}/PageCells/BytesCell.d.ts +0 -0
  154. /package/{cjs → framework}/PageCells/CapacityCell.d.ts +0 -0
  155. /package/{cjs → framework}/PageCells/CopyCell.d.ts +0 -0
  156. /package/{cjs → framework}/PageCells/DateTimeCell.d.ts +0 -0
  157. /package/{cjs → framework}/PageCells/ElapsedTimeCell.d.ts +0 -0
  158. /package/{cjs → framework}/PageCells/LabelsCell.d.ts +0 -0
  159. /package/{cjs → framework}/PageCells/TextCell.d.ts +0 -0
  160. /package/{cjs → framework}/PageColumnModal.d.ts +0 -0
  161. /package/{cjs → framework}/PageDashboard/PageChartContainer.d.ts +0 -0
  162. /package/{cjs → framework}/PageDashboard/PageDashboardCard.d.ts +0 -0
  163. /package/{cjs → framework}/PageDashboard/PageDashboardChart.d.ts +0 -0
  164. /package/{cjs → framework}/PageDashboard/PageDonutChart.d.ts +0 -0
  165. /package/{cjs → framework}/PageDashboard/PageScatterChart.d.ts +0 -0
  166. /package/{cjs → framework}/PageDetails/PageDetail.d.ts +0 -0
  167. /package/{cjs → framework}/PageDetails/PageDetails.d.ts +0 -0
  168. /package/{cjs → framework}/PageDetails/PageDetailsFromColumns.d.ts +0 -0
  169. /package/{cjs → framework}/PageDialog.d.ts +0 -0
  170. /package/{cjs → framework}/PageForm/Inputs/PageFormCodeEditor.d.ts +0 -0
  171. /package/{cjs → framework}/PageForm/Inputs/PageFormMultiInput.d.ts +0 -0
  172. /package/{cjs → framework}/PageForm/Inputs/PageFormSlider.d.ts +0 -0
  173. /package/{cjs → framework}/PageForm/Inputs/PageFormSwitch.d.ts +0 -0
  174. /package/{cjs → framework}/PageForm/Inputs/PageFormTextSelect.d.ts +0 -0
  175. /package/{cjs → framework}/PageForm/PageForm.d.ts +0 -0
  176. /package/{cjs → framework}/PageForm/PageFormAlerts.d.ts +0 -0
  177. /package/{cjs → framework}/PageForm/PageFormButtons.d.ts +0 -0
  178. /package/{cjs → framework}/PageForm/PageFormInputPopover.d.ts +0 -0
  179. /package/{cjs → framework}/PageForm/Utils/PageFormHidden.d.ts +0 -0
  180. /package/{cjs → framework}/PageForm/Utils/PageFormSection.d.ts +0 -0
  181. /package/{cjs → framework}/PageForm/Utils/PageFormWatch.d.ts +0 -0
  182. /package/{cjs → framework}/PageTable/PagePagination.d.ts +0 -0
  183. /package/{cjs → framework}/PageTable/PageTableCard.d.ts +0 -0
  184. /package/{cjs → framework}/PageTable/PageTableCards.d.ts +0 -0
  185. /package/{cjs → framework}/PageTable/PageTableList.d.ts +0 -0
  186. /package/{cjs → framework}/PageTable/PageTableViewType.d.ts +0 -0
  187. /package/{cjs → framework}/PageTable/PageToolbar.d.ts +0 -0
  188. /package/{cjs → framework}/PageTable/useTableItems.d.ts +0 -0
  189. /package/{cjs → framework}/PageTabs.d.ts +0 -0
  190. /package/{cjs → framework}/Settings.d.ts +0 -0
  191. /package/{cjs → framework}/components/BulkSelector.d.ts +0 -0
  192. /package/{cjs → framework}/components/Collapse.d.ts +0 -0
  193. /package/{cjs → framework}/components/DetailInfo.d.ts +0 -0
  194. /package/{cjs → framework}/components/Dotted.d.ts +0 -0
  195. /package/{cjs → framework}/components/DropdownControlled.d.ts +0 -0
  196. /package/{cjs → framework}/components/EmptyStateCustom.d.ts +0 -0
  197. /package/{cjs → framework}/components/EmptyStateFilter.d.ts +0 -0
  198. /package/{cjs → framework}/components/EmptyStateNoData.d.ts +0 -0
  199. /package/{cjs → framework}/components/EmptyStateUnauthorized.d.ts +0 -0
  200. /package/{cjs → framework}/components/ErrorBoundary.d.ts +0 -0
  201. /package/{cjs → framework}/components/Help.d.ts +0 -0
  202. /package/{cjs → framework}/components/IconWrapper.d.ts +0 -0
  203. /package/{cjs → framework}/components/LoadingPage.d.ts +0 -0
  204. /package/{cjs → framework}/components/LoadingState.d.ts +0 -0
  205. /package/{cjs → framework}/components/Masonry.d.ts +0 -0
  206. /package/{cjs → framework}/components/PageGrid.d.ts +0 -0
  207. /package/{cjs → framework}/components/Scrollable.d.ts +0 -0
  208. /package/{cjs → framework}/components/StandardPopover.d.ts +0 -0
  209. /package/{cjs → framework}/components/icons/RunningIcon.d.ts +0 -0
  210. /package/{cjs → framework}/components/pfcolors.d.ts +0 -0
  211. /package/{cjs → framework}/components/useIsMounted.d.ts +0 -0
  212. /package/{cjs → framework}/components/useOpen.d.ts +0 -0
  213. /package/{cjs → framework}/components/usePageNavigate.d.ts +0 -0
  214. /package/{cjs → framework}/components/useSearchParams.d.ts +0 -0
  215. /package/{cjs → framework}/components/useWindowLocation.d.ts +0 -0
  216. /package/{cjs → framework}/useFrameworkTranslations.d.ts +0 -0
  217. /package/{cjs → framework}/useInMemoryView.d.ts +0 -0
  218. /package/{cjs → framework}/useSelectDialog.d.ts +0 -0
  219. /package/{cjs → framework}/useSelectMultipleDialog.d.ts +0 -0
  220. /package/{cjs → framework}/useView.d.ts +0 -0
  221. /package/{cjs → framework}/utils/capitalize.d.ts +0 -0
  222. /package/{cjs → framework}/utils/download-file.d.ts +0 -0
  223. /package/{cjs → framework}/utils/formatDateString.d.ts +0 -0
  224. /package/{cjs → framework}/utils/random-string.d.ts +0 -0
@@ -1,146 +0,0 @@
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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
- return new (P || (P = Promise))(function (resolve, reject) {
16
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
- step((generator = generator.apply(thisArg, _arguments || [])).next());
20
- });
21
- };
22
- var __generator = (this && this.__generator) || function (thisArg, body) {
23
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
24
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
- function verb(n) { return function (v) { return step([n, v]); }; }
26
- function step(op) {
27
- if (f) throw new TypeError("Generator is already executing.");
28
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
29
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
30
- if (y = 0, t) op = [op[0] & 2, t.value];
31
- switch (op[0]) {
32
- case 0: case 1: t = op; break;
33
- case 4: _.label++; return { value: op[1], done: false };
34
- case 5: _.label++; y = op[1]; op = [0]; continue;
35
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
- default:
37
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
- if (t[2]) _.ops.pop();
42
- _.trys.pop(); continue;
43
- }
44
- op = body.call(thisArg, _);
45
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
- }
48
- };
49
- var __read = (this && this.__read) || function (o, n) {
50
- var m = typeof Symbol === "function" && o[Symbol.iterator];
51
- if (!m) return o;
52
- var i = m.call(o), r, ar = [], e;
53
- try {
54
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
55
- }
56
- catch (error) { e = { error: error }; }
57
- finally {
58
- try {
59
- if (r && !r.done && (m = i["return"])) m.call(i);
60
- }
61
- finally { if (e) throw e.error; }
62
- }
63
- return ar;
64
- };
65
- Object.defineProperty(exports, "__esModule", { value: true });
66
- exports.PageFormCancelButton = exports.PageFormSubmitButton = exports.PageForm = void 0;
67
- var jsx_runtime_1 = require("react/jsx-runtime");
68
- var ajv_1 = require("@hookform/resolvers/ajv");
69
- var react_core_1 = require("@patternfly/react-core");
70
- var react_1 = require("react");
71
- var react_hook_form_1 = require("react-hook-form");
72
- var Scrollable_1 = require("../components/Scrollable");
73
- var useBreakPoint_1 = require("../components/useBreakPoint");
74
- var PageBody_1 = require("../PageBody");
75
- var Settings_1 = require("../Settings");
76
- var useFrameworkTranslations_1 = require("../useFrameworkTranslations");
77
- function PageForm(props) {
78
- var _this = this;
79
- var _a;
80
- var schema = props.schema, defaultValue = props.defaultValue, disableBody = props.disableBody, disablePadding = props.disablePadding;
81
- var form = (0, react_hook_form_1.useForm)({
82
- defaultValues: defaultValue !== null && defaultValue !== void 0 ? defaultValue : {},
83
- resolver: schema
84
- ? (0, ajv_1.ajvResolver)(schema, { strict: false, addFormats: true })
85
- : undefined,
86
- });
87
- var _b = __read((0, useFrameworkTranslations_1.useFrameworkTranslations)(), 1), frameworkTranslations = _b[0];
88
- var handleSubmit = form.handleSubmit, setFieldError = form.setError;
89
- var _c = __read((0, react_1.useState)(''), 2), error = _c[0], setError = _c[1];
90
- var isMd = (0, useBreakPoint_1.useBreakpoint)('md');
91
- var _d = __read((0, react_1.useContext)(Settings_1.SettingsContext), 1), settings = _d[0];
92
- var isHorizontal = props.isVertical ? false : settings.formLayout === 'horizontal';
93
- var multipleColumns = props.singleColumn ? false : settings.formColumns === 'multiple';
94
- var sm = multipleColumns ? (isHorizontal ? 12 : 12) : 12;
95
- var md = multipleColumns ? (isHorizontal ? 12 : 6) : 12;
96
- var lg = multipleColumns ? (isHorizontal ? 6 : 6) : 12;
97
- var xl = multipleColumns ? (isHorizontal ? 6 : 6) : 12;
98
- var xl2 = multipleColumns ? (isHorizontal ? 4 : 4) : 12;
99
- var maxWidth = multipleColumns ? undefined : isHorizontal ? 960 : 800;
100
- var Component = ((0, jsx_runtime_1.jsx)(react_hook_form_1.FormProvider, __assign({}, form, { children: (0, jsx_runtime_1.jsxs)(react_core_1.Form
101
- // eslint-disable-next-line @typescript-eslint/no-misused-promises
102
- , __assign({
103
- // eslint-disable-next-line @typescript-eslint/no-misused-promises
104
- onSubmit: handleSubmit(function (data) { return __awaiter(_this, void 0, void 0, function () {
105
- var err_1;
106
- return __generator(this, function (_a) {
107
- switch (_a.label) {
108
- case 0:
109
- setError('');
110
- _a.label = 1;
111
- case 1:
112
- _a.trys.push([1, 3, , 4]);
113
- return [4 /*yield*/, props.onSubmit(data, setError, setFieldError)];
114
- case 2:
115
- _a.sent();
116
- return [3 /*break*/, 4];
117
- case 3:
118
- err_1 = _a.sent();
119
- setError(err_1 instanceof Error ? err_1.message : 'Unknown error');
120
- return [3 /*break*/, 4];
121
- case 4: return [2 /*return*/];
122
- }
123
- });
124
- }); }), isHorizontal: isHorizontal, style: {
125
- display: 'flex',
126
- flexDirection: 'column',
127
- flexGrow: 1,
128
- overflow: props.disableScrolling ? undefined : 'hidden',
129
- gap: 0,
130
- } }, { children: [props.disableScrolling ? ((0, jsx_runtime_1.jsx)("div", __assign({ style: { maxWidth: maxWidth, padding: disablePadding ? undefined : 24 } }, { children: (0, jsx_runtime_1.jsx)(react_core_1.Grid, __assign({ hasGutter: true, span: 12, sm: sm, md: md, lg: lg, xl: xl, xl2: xl2 }, { children: 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: disablePadding ? undefined : 24 } }, { children: (0, jsx_runtime_1.jsx)(react_core_1.Grid, __assign({ hasGutter: true, span: 12, sm: sm, md: md, lg: lg, xl: xl, xl2: xl2 }, { children: 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({ className: "dark-2 border-top", style: { padding: disablePadding ? undefined : 24 } }, { 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: (_a = props.cancelText) !== null && _a !== void 0 ? _a : frameworkTranslations.cancelText })))] })) }))) : ((0, jsx_runtime_1.jsx)(PageFormSubmitButton, __assign({ style: { marginTop: 48 } }, { children: props.submitText })))] })) })));
131
- if (!disableBody) {
132
- Component = (0, jsx_runtime_1.jsx)(PageBody_1.PageBody, { children: Component });
133
- }
134
- return Component;
135
- }
136
- exports.PageForm = PageForm;
137
- function PageFormSubmitButton(props) {
138
- var _a = (0, react_hook_form_1.useFormState)(), isSubmitting = _a.isSubmitting, errors = _a.errors;
139
- var hasErrors = errors && Object.keys(errors).length > 0;
140
- 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 })) })));
141
- }
142
- exports.PageFormSubmitButton = PageFormSubmitButton;
143
- function PageFormCancelButton(props) {
144
- return ((0, jsx_runtime_1.jsx)(react_core_1.Button, __assign({ type: "button", variant: "link", onClick: props.onCancel }, { children: props.children })));
145
- }
146
- exports.PageFormCancelButton = PageFormCancelButton;
@@ -1,32 +0,0 @@
1
- "use strict";
2
- var __read = (this && this.__read) || function (o, n) {
3
- var m = typeof Symbol === "function" && o[Symbol.iterator];
4
- if (!m) return o;
5
- var i = m.call(o), r, ar = [], e;
6
- try {
7
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
8
- }
9
- catch (error) { e = { error: error }; }
10
- finally {
11
- try {
12
- if (r && !r.done && (m = i["return"])) m.call(i);
13
- }
14
- finally { if (e) throw e.error; }
15
- }
16
- return ar;
17
- };
18
- Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.PageFormAlerts = void 0;
20
- var jsx_runtime_1 = require("react/jsx-runtime");
21
- var react_core_1 = require("@patternfly/react-core");
22
- var react_1 = require("react");
23
- var react_hook_form_1 = require("react-hook-form");
24
- var useBreakPoint_1 = require("../components/useBreakPoint");
25
- var useFrameworkTranslations_1 = require("../useFrameworkTranslations");
26
- function PageFormAlerts() {
27
- var errors = (0, react_hook_form_1.useFormState)().errors;
28
- var isMd = (0, useBreakPoint_1.useBreakpoint)('md');
29
- var _a = __read((0, useFrameworkTranslations_1.useFrameworkTranslations)(), 1), translations = _a[0];
30
- 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: translations.pleaseFixValidationErrors, isInline: true, style: { width: '100%', paddingLeft: isMd ? 190 : undefined }, variant: "danger" })) }));
31
- }
32
- exports.PageFormAlerts = PageFormAlerts;
@@ -1,28 +0,0 @@
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.PageFormButtons = void 0;
15
- var jsx_runtime_1 = require("react/jsx-runtime");
16
- var react_core_1 = require("@patternfly/react-core");
17
- var react_hook_form_1 = require("react-hook-form");
18
- var PageFormAlerts_1 = require("./PageFormAlerts");
19
- function PageFormButtons(props) {
20
- var errors = (0, react_hook_form_1.useFormState)().errors;
21
- return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(PageFormAlerts_1.PageFormAlerts, {}), (0, jsx_runtime_1.jsx)(react_core_1.PageSection, __assign({ isFilled: true, style: {
22
- display: 'flex',
23
- flexDirection: 'column',
24
- maxHeight: '100%',
25
- borderTop: 'thin solid var(--pf-global--BorderColor--100)',
26
- }, 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 }))] })) }))] }));
27
- }
28
- exports.PageFormButtons = PageFormButtons;
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,138 +0,0 @@
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.TypeSelect = exports.TypeSecretInput = exports.TypeTextInput = exports.PageFormSchema = void 0;
15
- var jsx_runtime_1 = require("react/jsx-runtime");
16
- var typebox_1 = require("@sinclair/typebox");
17
- var PageFormSelectOption_1 = require("./Inputs/PageFormSelectOption");
18
- var PageFormSlider_1 = require("./Inputs/PageFormSlider");
19
- var PageFormSwitch_1 = require("./Inputs/PageFormSwitch");
20
- var PageFormTextArea_1 = require("./Inputs/PageFormTextArea");
21
- var PageFormTextInput_1 = require("./Inputs/PageFormTextInput");
22
- var PageFormTextSelect_1 = require("./Inputs/PageFormTextSelect");
23
- function PageFormSchema(props) {
24
- var _a, _b, _c, _d, _e, _f, _g;
25
- var schema = props.schema;
26
- var base = props.base ? props.base + '.' : '';
27
- var p = [];
28
- for (var propertyName in schema.properties) {
29
- var property = schema.properties[propertyName];
30
- switch (property) {
31
- case true:
32
- case false:
33
- continue;
34
- }
35
- var title = typeof property.title === 'string' ? property.title : propertyName;
36
- var description = typeof property.description === 'string' ? property.description : undefined;
37
- var required = Array.isArray(schema.required) && schema.required.includes(propertyName);
38
- var prop = property;
39
- prop.errorMessage = (_a = prop.errorMessage) !== null && _a !== void 0 ? _a : {};
40
- switch (property.type) {
41
- case 'string':
42
- switch (prop.variant) {
43
- case 'select':
44
- {
45
- if (!prop.placeholder) {
46
- prop.placeholder = "Select ".concat(((_b = property.title) !== null && _b !== void 0 ? _b : propertyName).toLowerCase());
47
- }
48
- if (!prop.enum) {
49
- prop.enum = (_c = prop.options) === null || _c === void 0 ? void 0 : _c.map(function (option) { return option.value; });
50
- }
51
- }
52
- break;
53
- default:
54
- {
55
- if (!prop.placeholder) {
56
- prop.placeholder = "Enter ".concat(((_d = property.title) !== null && _d !== void 0 ? _d : propertyName).toLowerCase());
57
- }
58
- if (property.minLength) {
59
- if (!prop.errorMessage.minLength) {
60
- prop.errorMessage.minLength = "".concat((_e = property.title) !== null && _e !== void 0 ? _e : propertyName, " must be at least ").concat(property.minLength, " characters.");
61
- }
62
- }
63
- else if (required) {
64
- property.minLength = 1;
65
- prop.errorMessage.minLength = "".concat((_f = property.title) !== null && _f !== void 0 ? _f : propertyName, " is required");
66
- }
67
- if (property.maxLength) {
68
- if (!prop.errorMessage.maxLength) {
69
- prop.errorMessage.maxLength = "".concat((_g = property.title) !== null && _g !== void 0 ? _g : propertyName, " must be less than ").concat(property.maxLength, " characters.");
70
- }
71
- }
72
- }
73
- break;
74
- }
75
- break;
76
- }
77
- var placeholder = property.placeholder;
78
- placeholder = typeof placeholder === 'string' ? placeholder : undefined;
79
- switch (property.type) {
80
- case 'string': {
81
- switch (property.variant) {
82
- case 'select': {
83
- if ('options' in property) {
84
- var formSelectProps = property;
85
- p.push((0, jsx_runtime_1.jsx)(PageFormSelectOption_1.PageFormSelectOption, { id: base + propertyName, name: base + propertyName, label: title, placeholderText: placeholder, isRequired: required, options: formSelectProps.options, footer: formSelectProps.footer, labelHelpTitle: title, labelHelp: description }, base + propertyName));
86
- }
87
- else {
88
- p.push((0, jsx_runtime_1.jsx)(PageFormTextSelect_1.FormTextSelect, { name: base + propertyName, label: title, placeholder: placeholder, required: required, selectTitle: property.selectTitle, selectValue: property.selectValue, selectOpen: property.selectOpen }, base + propertyName));
89
- }
90
- break;
91
- }
92
- case 'textarea':
93
- p.push((0, jsx_runtime_1.jsx)(PageFormTextArea_1.PageFormTextArea, { id: base + propertyName, name: base + propertyName, label: title, placeholder: placeholder, isRequired: required }, base + propertyName));
94
- break;
95
- case 'secret':
96
- {
97
- var typeSecretInputOptions = property;
98
- p.push((0, jsx_runtime_1.jsx)(PageFormTextInput_1.PageFormTextInput, { id: base + propertyName, name: base + propertyName, label: title, placeholder: placeholder, isRequired: required, type: "password", autoComplete: typeSecretInputOptions.autoComplete }, base + propertyName));
99
- }
100
- break;
101
- default:
102
- {
103
- var typeTextInputOptions = property;
104
- p.push((0, jsx_runtime_1.jsx)(PageFormTextInput_1.PageFormTextInput, { id: base + propertyName, name: base + propertyName, label: title, placeholder: placeholder, isRequired: required, autoComplete: typeTextInputOptions.autoComplete }, base + propertyName));
105
- }
106
- break;
107
- }
108
- break;
109
- }
110
- case 'number': {
111
- p.push((0, jsx_runtime_1.jsx)(PageFormSlider_1.PageFormSlider, { name: base + propertyName, label: title, required: required, min: property.min, max: property.max, valueLabel: property.valueLabel }, base + propertyName));
112
- break;
113
- }
114
- case 'boolean': {
115
- p.push((0, jsx_runtime_1.jsx)(PageFormSwitch_1.PageFormSwitch, { name: base + propertyName, label: title, required: required }, base + propertyName));
116
- break;
117
- }
118
- case 'object': {
119
- p.push((0, jsx_runtime_1.jsx)(PageFormSchema, { schema: property, base: base + propertyName }, propertyName));
120
- break;
121
- }
122
- }
123
- }
124
- return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: p });
125
- }
126
- exports.PageFormSchema = PageFormSchema;
127
- function TypeTextInput(options) {
128
- return typebox_1.Type.String(__assign({}, options));
129
- }
130
- exports.TypeTextInput = TypeTextInput;
131
- function TypeSecretInput(options) {
132
- return typebox_1.Type.String(__assign(__assign({}, options), { variant: 'secret' }));
133
- }
134
- exports.TypeSecretInput = TypeSecretInput;
135
- function TypeSelect(options) {
136
- return typebox_1.Type.String(__assign(__assign({}, options), { variant: 'select' }));
137
- }
138
- exports.TypeSelect = TypeSelect;
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PageFormHidden = void 0;
4
- var jsx_runtime_1 = require("react/jsx-runtime");
5
- var react_hook_form_1 = require("react-hook-form");
6
- function PageFormHidden(props) {
7
- var value = (0, react_hook_form_1.useWatch)({ name: props.watch });
8
- var hidden = props.hidden(value);
9
- if (hidden)
10
- return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
11
- return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: props.children });
12
- }
13
- exports.PageFormHidden = PageFormHidden;
@@ -1,20 +0,0 @@
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.PageFormSection = void 0;
15
- var jsx_runtime_1 = require("react/jsx-runtime");
16
- var react_core_1 = require("@patternfly/react-core");
17
- function PageFormSection(props) {
18
- return ((0, jsx_runtime_1.jsx)(react_core_1.FormSection, __assign({ title: props.title, style: { marginTop: 16 } }, { children: props.children })));
19
- }
20
- exports.PageFormSection = PageFormSection;
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PageFormWatch = void 0;
4
- var jsx_runtime_1 = require("react/jsx-runtime");
5
- var react_hook_form_1 = require("react-hook-form");
6
- function PageFormWatch(props) {
7
- var value = (0, react_hook_form_1.useWatch)({ name: props.watch });
8
- return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: props.children(value) });
9
- }
10
- exports.PageFormWatch = PageFormWatch;
@@ -1,27 +0,0 @@
1
- .border-top {
2
- border-top: thin solid var(--pf-global--BorderColor--100);
3
- }
4
-
5
- .border-bottom {
6
- border-bottom: thin solid var(--pf-global--BorderColor--100);
7
- }
8
-
9
- .light {
10
- background-color: var(--pf-global--BackgroundColor--100);
11
- }
12
-
13
- :root:where(.pf-theme-dark) .dark-0 {
14
- background-color: var(--pf-global--BackgroundColor--200);
15
- }
16
-
17
- :root:where(.pf-theme-dark) .dark-1 {
18
- background-color: var(--pf-global--BackgroundColor--100);
19
- }
20
-
21
- :root:where(.pf-theme-dark) .dark-2 {
22
- background-color: var(--pf-global--BackgroundColor--300);
23
- }
24
-
25
- :root:where(.pf-theme-dark) .dark-3 {
26
- background-color: var(--pf-global--BackgroundColor--400);
27
- }
@@ -1,12 +0,0 @@
1
- import { ReactNode } from 'react';
2
- import './PageFramework.css';
3
- /**
4
- * The `PageFramework` component bundles up all the context providers in the Ansible UI framework in a convienent component for framework consumers. Examples of internal context providers are translations, navigation, settings, alerts, and dialogs.
5
- *
6
- * @example
7
- * <PageFramework navigate={navigate}>...</PageFramework>
8
- */
9
- export declare function PageFramework(props: {
10
- children: ReactNode;
11
- navigate?: (to: string) => void;
12
- }): JSX.Element;
@@ -1,31 +0,0 @@
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.PageFramework = void 0;
15
- var jsx_runtime_1 = require("react/jsx-runtime");
16
- var usePageNavigate_1 = require("./components/usePageNavigate");
17
- var PageAlertToaster_1 = require("./PageAlertToaster");
18
- var PageDialog_1 = require("./PageDialog");
19
- require("./PageFramework.css");
20
- var Settings_1 = require("./Settings");
21
- var useFrameworkTranslations_1 = require("./useFrameworkTranslations");
22
- /**
23
- * The `PageFramework` component bundles up all the context providers in the Ansible UI framework in a convienent component for framework consumers. Examples of internal context providers are translations, navigation, settings, alerts, and dialogs.
24
- *
25
- * @example
26
- * <PageFramework navigate={navigate}>...</PageFramework>
27
- */
28
- function PageFramework(props) {
29
- return ((0, jsx_runtime_1.jsx)(useFrameworkTranslations_1.FrameworkTranslationsProvider, { children: (0, jsx_runtime_1.jsx)(Settings_1.SettingsProvider, { children: (0, jsx_runtime_1.jsx)(PageDialog_1.PageDialogProvider, { children: (0, jsx_runtime_1.jsx)(PageAlertToaster_1.PageAlertToasterProvider, { children: (0, jsx_runtime_1.jsx)(usePageNavigate_1.PageNavigateCallbackContextProvider, __assign({ callback: props.navigate }, { children: props.children })) }) }) }) }));
30
- }
31
- exports.PageFramework = PageFramework;
@@ -1,45 +0,0 @@
1
- import { ReactNode } from 'react';
2
- import './PageFramework.css';
3
- export interface ICatalogBreadcrumb {
4
- id?: string;
5
- label?: string;
6
- to?: string;
7
- target?: string;
8
- component?: React.ElementType;
9
- }
10
- export interface PageHeaderProps {
11
- navigation?: ReactNode;
12
- breadcrumbs?: ICatalogBreadcrumb[];
13
- title?: string;
14
- titleHelpTitle?: string;
15
- titleHelp?: string | string[];
16
- titleDocLink?: string;
17
- description?: string | string[];
18
- controls?: ReactNode;
19
- headerActions?: ReactNode;
20
- footer?: ReactNode;
21
- }
22
- /**
23
- * PageHeader enables the responsive layout of the header.
24
- *
25
- * @param {Breadcrumb[]} breadcrumbs - The breadcrumbs for the page.
26
- * @param {string} title - The title of the page.
27
- * @param {string} titleHelpTitle - The title of help popover.
28
- * @param {ReactNode} titleHelp - The content for the help popover.
29
- * @param {string} description - The description of the page.
30
- * @param {ReactNode} controls - Support for extra page controls.
31
- * @param {ReactNode} headerActions - The actions for the page.
32
- * @param {ReactNode} footer - Extra components to render at the bottom of the header.
33
- *
34
- * @example
35
- * <PageLayout>
36
- * <PageHeader
37
- * breadcrumbs={[{ label: 'Home', to: '/home' }, { label: 'Page title' }]}
38
- * title='Page title'
39
- * description='Page description'
40
- * headerActions={<TypedActions actions={actions} />}
41
- * />
42
- * ...
43
- * </PageLayout>
44
- */
45
- export declare function PageHeader(props: PageHeaderProps): JSX.Element;
package/cjs/PageHeader.js DELETED
@@ -1,111 +0,0 @@
1
- "use strict";
2
- var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
3
- if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
4
- return cooked;
5
- };
6
- var __assign = (this && this.__assign) || function () {
7
- __assign = Object.assign || function(t) {
8
- for (var s, i = 1, n = arguments.length; i < n; i++) {
9
- s = arguments[i];
10
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
11
- t[p] = s[p];
12
- }
13
- return t;
14
- };
15
- return __assign.apply(this, arguments);
16
- };
17
- var __read = (this && this.__read) || function (o, n) {
18
- var m = typeof Symbol === "function" && o[Symbol.iterator];
19
- if (!m) return o;
20
- var i = m.call(o), r, ar = [], e;
21
- try {
22
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
23
- }
24
- catch (error) { e = { error: error }; }
25
- finally {
26
- try {
27
- if (r && !r.done && (m = i["return"])) m.call(i);
28
- }
29
- finally { if (e) throw e.error; }
30
- }
31
- return ar;
32
- };
33
- var __importDefault = (this && this.__importDefault) || function (mod) {
34
- return (mod && mod.__esModule) ? mod : { "default": mod };
35
- };
36
- Object.defineProperty(exports, "__esModule", { value: true });
37
- exports.PageHeader = void 0;
38
- var react_1 = require("react");
39
- var jsx_runtime_1 = require("react/jsx-runtime");
40
- var react_core_1 = require("@patternfly/react-core");
41
- var react_icons_1 = require("@patternfly/react-icons");
42
- var react_2 = require("react");
43
- var styled_components_1 = __importDefault(require("styled-components"));
44
- var useBreakPoint_1 = require("./components/useBreakPoint");
45
- var usePageNavigate_1 = require("./components/usePageNavigate");
46
- var PageAlerts_1 = require("./PageAlerts");
47
- require("./PageFramework.css");
48
- var useFrameworkTranslations_1 = require("./useFrameworkTranslations");
49
- var PageAlertsDiv = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n border-bottom: thin solid rgba(0, 0, 0, 0.12);\n"], ["\n border-bottom: thin solid rgba(0, 0, 0, 0.12);\n"])));
50
- function Breadcrumbs(props) {
51
- var navigate = (0, usePageNavigate_1.usePageNavigate)();
52
- if (!props.breadcrumbs)
53
- return (0, jsx_runtime_1.jsx)(react_2.Fragment, {});
54
- return ((0, jsx_runtime_1.jsx)(react_core_1.Breadcrumb, __assign({ style: props.style }, { children: props.breadcrumbs.map(function (breadcrumb) {
55
- var _a;
56
- if (!breadcrumb.label)
57
- return null;
58
- return ((0, jsx_runtime_1.jsx)(react_core_1.BreadcrumbItem, __assign({ id: breadcrumb.id, component: breadcrumb.component, isActive: breadcrumb.to === undefined }, { children: breadcrumb.to ? ((0, jsx_runtime_1.jsx)("a", __assign({ href: breadcrumb.to, onClick: function (e) {
59
- e.preventDefault();
60
- navigate(breadcrumb.to);
61
- } }, { children: breadcrumb.label }))) : (breadcrumb.label) }), (_a = breadcrumb.id) !== null && _a !== void 0 ? _a : breadcrumb.label));
62
- }) })));
63
- }
64
- /**
65
- * PageHeader enables the responsive layout of the header.
66
- *
67
- * @param {Breadcrumb[]} breadcrumbs - The breadcrumbs for the page.
68
- * @param {string} title - The title of the page.
69
- * @param {string} titleHelpTitle - The title of help popover.
70
- * @param {ReactNode} titleHelp - The content for the help popover.
71
- * @param {string} description - The description of the page.
72
- * @param {ReactNode} controls - Support for extra page controls.
73
- * @param {ReactNode} headerActions - The actions for the page.
74
- * @param {ReactNode} footer - Extra components to render at the bottom of the header.
75
- *
76
- * @example
77
- * <PageLayout>
78
- * <PageHeader
79
- * breadcrumbs={[{ label: 'Home', to: '/home' }, { label: 'Page title' }]}
80
- * title='Page title'
81
- * description='Page description'
82
- * headerActions={<TypedActions actions={actions} />}
83
- * />
84
- * ...
85
- * </PageLayout>
86
- */
87
- function PageHeader(props) {
88
- var navigation = props.navigation, breadcrumbs = props.breadcrumbs, title = props.title, description = props.description, controls = props.controls, headerActions = props.headerActions, footer = props.footer;
89
- var lg = (0, useBreakPoint_1.useBreakpoint)('lg');
90
- var xl = (0, useBreakPoint_1.useBreakpoint)('xl');
91
- var isMdOrLarger = (0, useBreakPoint_1.useBreakpoint)('md');
92
- var _a = __read((0, useFrameworkTranslations_1.useFrameworkTranslations)(), 1), translations = _a[0];
93
- 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, className: "border-top dark-1", style: { paddingLeft: 0, paddingTop: 0, paddingBottom: 0 } }, { children: (0, jsx_runtime_1.jsx)(react_core_1.Flex, __assign({ direction: { default: 'row' }, flexWrap: { default: 'nowrap' }, style: { maxWidth: '100%' } }, { children: (0, jsx_runtime_1.jsx)(react_core_1.PageNavigation, __assign({ style: { paddingTop: 0, flexShrink: 1, flexGrow: 1 } }, { children: navigation })) })) }))), (0, jsx_runtime_1.jsx)(react_core_1.PageSection, __assign({ variant: react_core_1.PageSectionVariants.light, className: "border-top border-bottom dark-3", style: {
94
- paddingTop: breadcrumbs ? (xl ? 16 : 12) : xl ? 16 : 12,
95
- paddingBottom: xl ? 16 : 12,
96
- } }, { children: (0, jsx_runtime_1.jsxs)(react_core_1.Stack, __assign({ hasGutter: true }, { 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: translations.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: {
97
- padding: 0,
98
- marginTop: 1,
99
- marginLeft: 8,
100
- verticalAlign: 'top',
101
- } }, { 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 })] })))] })), footer] })) })), (0, jsx_runtime_1.jsx)(PageAlerts_1.PageAlertsContext.Consumer, { children: function (pageAlerts) { return ((0, jsx_runtime_1.jsx)(PageAlerts_1.PageAlertsArrayContext.Consumer, { children: function (pageAlertsArray) {
102
- if (pageAlertsArray.length === 0)
103
- return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
104
- return ((0, jsx_runtime_1.jsx)(PageAlertsDiv, { children: pageAlertsArray.map(function (alertProps, index) {
105
- var _a, _b;
106
- return ((0, react_1.createElement)(react_core_1.Alert, __assign({}, alertProps, { key: (_b = (_a = alertProps.key) !== null && _a !== void 0 ? _a : alertProps.id) !== null && _b !== void 0 ? _b : index, actionClose: (0, jsx_runtime_1.jsx)(react_core_1.AlertActionCloseButton, { onClose: function () { return pageAlerts.removeAlert(alertProps); } }), isInline: true, isExpandable: !!alertProps.children })));
107
- }) }));
108
- } })); } })] }));
109
- }
110
- exports.PageHeader = PageHeader;
111
- var templateObject_1;