@rh-support/components 2.0.5 → 2.0.8
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.
- package/lib/cjs/AlertMessage/AlertMessage.js +5 -5
- package/lib/cjs/ConfirmationModal/ConfirmationContext.js +13 -41
- package/lib/cjs/ConfirmationModal/ConfirmationDialog.js +5 -5
- package/lib/cjs/CoverSpinner/CoverSpinner.js +1 -1
- package/lib/cjs/CustomContentLoader/CustomContentLoader.js +4 -4
- package/lib/cjs/CustomTextInput/CustomTextInput.js +8 -19
- package/lib/cjs/DropDownList/AsyncDropDownList.js +5 -5
- package/lib/cjs/DropDownList/DropDownList.js +45 -75
- package/lib/cjs/DropDownList/DropdownWrapper.js +7 -18
- package/lib/cjs/DropDownList/MultiSelectDropdownList.js +3 -3
- package/lib/cjs/DropDownList/SearchableList.js +41 -55
- package/lib/cjs/DropDownList/SelectList.js +15 -26
- package/lib/cjs/DropDownList/async.js +28 -38
- package/lib/cjs/DropDownList/dropdownUtils.js +9 -20
- package/lib/cjs/DropDownList/withMulti.js +15 -26
- package/lib/cjs/ErrorBoundary/ErrorBoundary.js +18 -47
- package/lib/cjs/ErrorBoundary/ErrorBoundaryFallbackComponent.js +10 -10
- package/lib/cjs/ErrorPages/Generic403.js +2 -2
- package/lib/cjs/FeedbackForm/FeedbackForm.js +24 -52
- package/lib/cjs/Functional/CaseContactsSelectorExternal.js +81 -154
- package/lib/cjs/InlineEdit/InlineEdit.js +56 -142
- package/lib/cjs/InlineEdit/NewInlineEdit.js +60 -145
- package/lib/cjs/LanguageSelector/LanguageSelector.js +10 -26
- package/lib/cjs/LoadingDots/LoadingDots.js +3 -3
- package/lib/cjs/LoadingIndicator/LoadingIndicator.js +3 -3
- package/lib/cjs/LoginModal/LoginModal.js +3 -3
- package/lib/cjs/MarkdownEditor/MarkdownEditor.js +113 -165
- package/lib/cjs/MoreOrLess/MoreOrLess.js +20 -40
- package/lib/cjs/PaginatedList/PaginatedList.js +15 -31
- package/lib/cjs/PaginationCompact/PaginationCompact.js +14 -31
- package/lib/cjs/ProgressBar/CircularProgressBar/CircularProgressBar.js +14 -14
- package/lib/cjs/ProgressBar/CircularProgressBar/Path.js +20 -18
- package/lib/cjs/ProgressBar/ProgressBar.js +8 -19
- package/lib/cjs/PromisifyModal/PromisifyModal.js +19 -36
- package/lib/cjs/SubscriptionAbuse/SubscriptionAbuseModal.js +5 -5
- package/lib/cjs/SubscriptionAbuse/const.js +3 -3
- package/lib/cjs/SupportFeedbackForm/SupportFeedbackForm.js +8 -24
- package/lib/cjs/SupportFeedbackForm/SupportFeedbackModal.js +50 -120
- package/lib/cjs/Table/PFTable.js +52 -89
- package/lib/cjs/Table/Table.js +12 -29
- package/lib/cjs/Table/TableColumnSelector.js +14 -15
- package/lib/cjs/Table/TablePagination.js +8 -8
- package/lib/cjs/Table/TableProvider.js +6 -6
- package/lib/cjs/TermsAndConditions/AcceptTermsModal.js +46 -100
- package/lib/cjs/TextAreaAutosize/TextAreaAutosize.js +35 -62
- package/lib/cjs/TextAreaResizable/TextAreaResizable.js +9 -25
- package/lib/cjs/ToastNotification/ToastNotification.js +35 -70
- package/lib/cjs/TopContentSearch/TopContentSearch.js +48 -113
- package/lib/cjs/ValueChangedIcon/ValueChangedIcon.js +13 -29
- package/lib/cjs/helperFunctions/errorMessage.js +13 -13
- package/lib/cjs/hooks/useBreakpoint.js +26 -43
- package/lib/cjs/hooks/useCopyToClipboard.js +8 -24
- package/lib/cjs/hooks/useDebounce.js +13 -38
- package/lib/cjs/hooks/useFetch.js +47 -123
- package/lib/cjs/hooks/useForceUpdate.js +2 -18
- package/lib/cjs/hooks/useForkRef.js +3 -3
- package/lib/cjs/hooks/useIsMounted.js +4 -4
- package/lib/cjs/hooks/useLRUCache.js +11 -11
- package/lib/cjs/hooks/useLocalStorage.js +7 -23
- package/lib/cjs/hooks/useOnScreen.js +5 -24
- package/lib/cjs/hooks/usePolling.js +8 -30
- package/lib/cjs/hooks/usePrevious.js +3 -3
- package/lib/cjs/hooks/useTitle.js +4 -4
- package/lib/cjs/hooks/useUndo.js +49 -72
- package/lib/esm/AlertMessage/AlertMessage.js +2 -2
- package/package.json +9 -10
|
@@ -18,54 +18,38 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
18
18
|
__setModuleDefault(result, mod);
|
|
19
19
|
return result;
|
|
20
20
|
};
|
|
21
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
22
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
23
|
-
if (!m) return o;
|
|
24
|
-
var i = m.call(o), r, ar = [], e;
|
|
25
|
-
try {
|
|
26
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
27
|
-
}
|
|
28
|
-
catch (error) { e = { error: error }; }
|
|
29
|
-
finally {
|
|
30
|
-
try {
|
|
31
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
32
|
-
}
|
|
33
|
-
finally { if (e) throw e.error; }
|
|
34
|
-
}
|
|
35
|
-
return ar;
|
|
36
|
-
};
|
|
37
21
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
38
22
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
39
23
|
};
|
|
40
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
25
|
exports.PaginatedList = void 0;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
26
|
+
const react_core_1 = require("@patternfly/react-core");
|
|
27
|
+
const times_1 = __importDefault(require("lodash/times"));
|
|
28
|
+
const react_1 = __importStar(require("react"));
|
|
29
|
+
const AlertMessage_1 = require("../AlertMessage");
|
|
30
|
+
const CustomContentLoader_1 = require("../CustomContentLoader/CustomContentLoader");
|
|
47
31
|
function PaginatedList(props) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
32
|
+
const [pageSize, setPageSize] = react_1.useState(props.perPage || 10);
|
|
33
|
+
const [currentPage, setCurrentPage] = react_1.useState(1);
|
|
34
|
+
const indexOfFirstShownElement = (currentPage - 1) * pageSize;
|
|
35
|
+
const skeltonLoader = times_1.default(pageSize, (index) => react_1.default.createElement(CustomContentLoader_1.CustomContentLoader, { key: index }));
|
|
52
36
|
// wrap the list components in patternfly list item component
|
|
53
|
-
|
|
37
|
+
let listItems = props.listItems.map((listItem, index) => (react_1.default.createElement(react_core_1.ListItem, { type: 'none', className: `${props.id}-listItem`, key: index }, listItem)));
|
|
54
38
|
// trim the list to the "current page" if data is not paginated by server.
|
|
55
39
|
if (!props.serverPaginated) {
|
|
56
40
|
listItems = listItems.slice(indexOfFirstShownElement, indexOfFirstShownElement + pageSize);
|
|
57
41
|
}
|
|
58
|
-
|
|
42
|
+
const onSetPage = (event, pageNumber) => {
|
|
59
43
|
setCurrentPage(pageNumber);
|
|
60
44
|
props.onSetPage && props.onSetPage(pageNumber);
|
|
61
45
|
};
|
|
62
|
-
|
|
46
|
+
const onPerPageSelect = (event, pageSize) => {
|
|
63
47
|
setPageSize(pageSize);
|
|
64
48
|
props.onPerPageSelect && props.onPerPageSelect(pageSize);
|
|
65
49
|
onSetPage(event, 1);
|
|
66
50
|
};
|
|
67
51
|
// reset to first page on fetch
|
|
68
|
-
react_1.useEffect(
|
|
52
|
+
react_1.useEffect(() => {
|
|
69
53
|
if (props.isFetching) {
|
|
70
54
|
setCurrentPage(1);
|
|
71
55
|
}
|
|
@@ -73,7 +57,7 @@ function PaginatedList(props) {
|
|
|
73
57
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
74
58
|
!!props.isFetching && skeltonLoader,
|
|
75
59
|
react_1.default.createElement(AlertMessage_1.AlertMessage, { variant: AlertMessage_1.AlertType.WARNING, show: !!props.errorMessage, title: props.errorMessage }),
|
|
76
|
-
!props.isFetching && (react_1.default.createElement(react_core_1.List, { id: props.id, className:
|
|
77
|
-
props.listItems.length > pageSize && (react_1.default.createElement(react_core_1.Pagination, { itemCount: props.serverPaginated ? props.itemCount : props.listItems.length, widgetId: props.id
|
|
60
|
+
!props.isFetching && (react_1.default.createElement(react_core_1.List, { id: props.id, className: `${props.className || ''}` }, listItems)),
|
|
61
|
+
props.listItems.length > pageSize && (react_1.default.createElement(react_core_1.Pagination, { itemCount: props.serverPaginated ? props.itemCount : props.listItems.length, widgetId: `${props.id}-pagination`, perPage: pageSize, page: currentPage, perPageOptions: props.perPageOptions, variant: react_core_1.PaginationVariant.bottom, onSetPage: onSetPage, isDisabled: props.isFetching, onPerPageSelect: onPerPageSelect }))));
|
|
78
62
|
}
|
|
79
63
|
exports.PaginatedList = PaginatedList;
|
|
@@ -18,43 +18,26 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
18
18
|
__setModuleDefault(result, mod);
|
|
19
19
|
return result;
|
|
20
20
|
};
|
|
21
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
22
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
23
|
-
if (!m) return o;
|
|
24
|
-
var i = m.call(o), r, ar = [], e;
|
|
25
|
-
try {
|
|
26
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
27
|
-
}
|
|
28
|
-
catch (error) { e = { error: error }; }
|
|
29
|
-
finally {
|
|
30
|
-
try {
|
|
31
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
32
|
-
}
|
|
33
|
-
finally { if (e) throw e.error; }
|
|
34
|
-
}
|
|
35
|
-
return ar;
|
|
36
|
-
};
|
|
37
21
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
38
22
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
39
23
|
};
|
|
40
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
25
|
exports.PaginationCompact = void 0;
|
|
42
26
|
require("./paginationCompact.css");
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
function PaginationCompact(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
setCurrentPage(function (currentPage) { return currentPage + 1; });
|
|
27
|
+
const react_core_1 = require("@patternfly/react-core");
|
|
28
|
+
const angle_left_icon_1 = __importDefault(require("@patternfly/react-icons/dist/js/icons/angle-left-icon"));
|
|
29
|
+
const angle_right_icon_1 = __importDefault(require("@patternfly/react-icons/dist/js/icons/angle-right-icon"));
|
|
30
|
+
const react_1 = __importStar(require("react"));
|
|
31
|
+
function PaginationCompact({ maxPage, dataTrackingId, onPageChange }) {
|
|
32
|
+
const [currentPage, setCurrentPage] = react_1.useState(1);
|
|
33
|
+
const isFirstMountRef = react_1.useRef(true);
|
|
34
|
+
const onNextClick = () => {
|
|
35
|
+
setCurrentPage((currentPage) => currentPage + 1);
|
|
53
36
|
};
|
|
54
|
-
|
|
55
|
-
setCurrentPage(
|
|
37
|
+
const onPreviousClick = () => {
|
|
38
|
+
setCurrentPage((currentPage) => currentPage - 1);
|
|
56
39
|
};
|
|
57
|
-
react_1.useEffect(
|
|
40
|
+
react_1.useEffect(() => {
|
|
58
41
|
if (isFirstMountRef.current) {
|
|
59
42
|
isFirstMountRef.current = false;
|
|
60
43
|
return;
|
|
@@ -65,7 +48,7 @@ function PaginationCompact(_a) {
|
|
|
65
48
|
return (react_1.default.createElement("div", { className: "pagination-compact pf-c-pagination pf-m-compact pf-m-bottom pf-u-ml-auto" },
|
|
66
49
|
react_1.default.createElement("nav", { className: "pf-c-pagination__nav" },
|
|
67
50
|
react_1.default.createElement("div", { className: "pf-c-pagination__nav-control pf-m-prev" },
|
|
68
|
-
react_1.default.createElement(react_core_1.Button, { variant: react_core_1.ButtonVariant.plain, type: "button", "data-tracking-id": dataTrackingId
|
|
51
|
+
react_1.default.createElement(react_core_1.Button, { variant: react_core_1.ButtonVariant.plain, type: "button", "data-tracking-id": `${dataTrackingId}-previous`, onClick: onPreviousClick, isDisabled: currentPage === 1, "aria-label": "Go to previous page" },
|
|
69
52
|
react_1.default.createElement(angle_left_icon_1.default, null))),
|
|
70
53
|
react_1.default.createElement("div", { style: {
|
|
71
54
|
lineHeight: 2.6,
|
|
@@ -74,7 +57,7 @@ function PaginationCompact(_a) {
|
|
|
74
57
|
" of ",
|
|
75
58
|
maxPage),
|
|
76
59
|
react_1.default.createElement("div", { className: "pf-c-pagination__nav-control pf-m-next" },
|
|
77
|
-
react_1.default.createElement(react_core_1.Button, { variant: react_core_1.ButtonVariant.plain, onClick: onNextClick, "data-tracking-id": dataTrackingId
|
|
60
|
+
react_1.default.createElement(react_core_1.Button, { variant: react_core_1.ButtonVariant.plain, onClick: onNextClick, "data-tracking-id": `${dataTrackingId}-next`, isDisabled: currentPage === maxPage, type: "button", "aria-label": "Go to next page" },
|
|
78
61
|
react_1.default.createElement(angle_right_icon_1.default, null))))));
|
|
79
62
|
}
|
|
80
63
|
exports.PaginationCompact = PaginationCompact;
|
|
@@ -5,11 +5,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.CircularProgressbar = void 0;
|
|
7
7
|
require("./styles.css");
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
const constants_1 = require("./constants");
|
|
10
|
+
const Path_1 = __importDefault(require("./Path"));
|
|
11
11
|
// Credits https://github.com/kevinsqi/react-circular-progressbar
|
|
12
|
-
|
|
12
|
+
const defaultProps = {
|
|
13
13
|
background: false,
|
|
14
14
|
backgroundPadding: 0,
|
|
15
15
|
circleRatio: 1,
|
|
@@ -35,33 +35,33 @@ var defaultProps = {
|
|
|
35
35
|
text: '',
|
|
36
36
|
};
|
|
37
37
|
function CircularProgressbar(props) {
|
|
38
|
-
|
|
38
|
+
const getBackgroundPadding = () => {
|
|
39
39
|
if (!props.background) {
|
|
40
40
|
// Don't add padding if not displaying background
|
|
41
41
|
return 0;
|
|
42
42
|
}
|
|
43
43
|
return props.backgroundPadding;
|
|
44
44
|
};
|
|
45
|
-
|
|
45
|
+
const getPathRadius = () => {
|
|
46
46
|
// The radius of the path is defined to be in the middle, so in order for the path to
|
|
47
47
|
// fit perfectly inside the 100x100 viewBox, need to subtract half the strokeWidth
|
|
48
48
|
return constants_1.VIEWBOX_HEIGHT_HALF - props.strokeWidth / 2 - getBackgroundPadding();
|
|
49
49
|
};
|
|
50
50
|
// Ratio of path length to trail length, as a value between 0 and 1
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
const getPathRatio = () => {
|
|
52
|
+
const { value, minValue, maxValue } = props;
|
|
53
|
+
const boundedValue = Math.min(Math.max(value, minValue), maxValue);
|
|
54
54
|
return (boundedValue - minValue) / (maxValue - minValue);
|
|
55
55
|
};
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
const { circleRatio, className, classes, counterClockwise, styles, strokeWidth, text } = props;
|
|
57
|
+
const pathRadius = getPathRadius();
|
|
58
|
+
const pathRatio = getPathRatio();
|
|
59
59
|
return (react_1.default.createElement("div", { role: "progressbar", "aria-valuenow": props.value, "aria-valuemin": props.minValue, "aria-valuemax": props.maxValue },
|
|
60
|
-
react_1.default.createElement("svg", { className: classes.root
|
|
60
|
+
react_1.default.createElement("svg", { className: `${classes.root} ${className}`, style: styles.root, viewBox: `0 0 ${constants_1.VIEWBOX_WIDTH} ${constants_1.VIEWBOX_HEIGHT}`, "data-test-id": "CircularProgressbar" },
|
|
61
61
|
props.background ? (react_1.default.createElement("circle", { className: classes.background, style: styles.background, cx: constants_1.VIEWBOX_CENTER_X, cy: constants_1.VIEWBOX_CENTER_Y, r: constants_1.VIEWBOX_HEIGHT_HALF })) : null,
|
|
62
62
|
react_1.default.createElement(Path_1.default, { className: classes.trail, counterClockwise: counterClockwise, dashRatio: circleRatio, pathRadius: pathRadius, strokeWidth: strokeWidth, style: styles.trail }),
|
|
63
63
|
react_1.default.createElement(Path_1.default, { className: classes.path, counterClockwise: counterClockwise, dashRatio: pathRatio * circleRatio, pathRadius: pathRadius, strokeWidth: strokeWidth, style: styles.path },
|
|
64
|
-
react_1.default.createElement("title", null, props.title || props.value
|
|
64
|
+
react_1.default.createElement("title", null, props.title || `${props.value}%`)),
|
|
65
65
|
text ? (react_1.default.createElement("text", { className: classes.text, style: styles.text, x: constants_1.VIEWBOX_CENTER_X, y: constants_1.VIEWBOX_CENTER_Y }, text)) : null)));
|
|
66
66
|
}
|
|
67
67
|
exports.CircularProgressbar = CircularProgressbar;
|
|
@@ -3,35 +3,37 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
function Path(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
counterClockwise: counterClockwise,
|
|
6
|
+
const react_1 = __importDefault(require("react"));
|
|
7
|
+
const constants_1 = require("./constants");
|
|
8
|
+
function Path({ className, counterClockwise, dashRatio, pathRadius, strokeWidth, style, children, }) {
|
|
9
|
+
return (react_1.default.createElement("path", { className: className, style: Object.assign({}, style, getDashStyle({ pathRadius, dashRatio, counterClockwise })), d: getPathDescription({
|
|
10
|
+
pathRadius,
|
|
11
|
+
counterClockwise,
|
|
13
12
|
}), strokeWidth: strokeWidth, fillOpacity: 0 }, children ? children : null));
|
|
14
13
|
}
|
|
15
14
|
// SVG path description specifies how the path should be drawn
|
|
16
|
-
function getPathDescription(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
var rotation = counterClockwise ? 1 : 0;
|
|
15
|
+
function getPathDescription({ pathRadius, counterClockwise }) {
|
|
16
|
+
const radius = pathRadius;
|
|
17
|
+
const rotation = counterClockwise ? 1 : 0;
|
|
20
18
|
// Move to center of canvas
|
|
21
19
|
// Relative move to top canvas
|
|
22
20
|
// Relative arc to bottom of canvas
|
|
23
21
|
// Relative arc to top of canvas
|
|
24
|
-
return
|
|
22
|
+
return `
|
|
23
|
+
M ${constants_1.VIEWBOX_CENTER_X},${constants_1.VIEWBOX_CENTER_Y}
|
|
24
|
+
m 0,-${radius}
|
|
25
|
+
a ${radius},${radius} ${rotation} 1 1 0,${2 * radius}
|
|
26
|
+
a ${radius},${radius} ${rotation} 1 1 0,-${2 * radius}
|
|
27
|
+
`;
|
|
25
28
|
}
|
|
26
|
-
function getDashStyle(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
var gapLength = (1 - dashRatio) * diameter;
|
|
29
|
+
function getDashStyle({ counterClockwise, dashRatio, pathRadius, }) {
|
|
30
|
+
const diameter = Math.PI * 2 * pathRadius;
|
|
31
|
+
const gapLength = (1 - dashRatio) * diameter;
|
|
30
32
|
return {
|
|
31
33
|
// Have dash be full diameter, and gap be full diameter
|
|
32
|
-
strokeDasharray: diameter
|
|
34
|
+
strokeDasharray: `${diameter}px ${diameter}px`,
|
|
33
35
|
// Shift dash backward by gapLength, so gap starts appearing at correct distance
|
|
34
|
-
strokeDashoffset:
|
|
36
|
+
strokeDashoffset: `${counterClockwise ? -gapLength : gapLength}px`,
|
|
35
37
|
};
|
|
36
38
|
}
|
|
37
39
|
exports.default = Path;
|
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
2
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
3
|
var t = {};
|
|
15
4
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -26,22 +15,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
15
|
};
|
|
27
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
17
|
exports.ProgressBar = void 0;
|
|
29
|
-
|
|
30
|
-
|
|
18
|
+
const react_1 = __importDefault(require("react"));
|
|
19
|
+
const defaultProps = {
|
|
31
20
|
progressBarClassName: '',
|
|
32
21
|
show: true,
|
|
33
22
|
className: '',
|
|
34
23
|
};
|
|
35
24
|
function ProgressBar(props) {
|
|
36
|
-
|
|
25
|
+
const { valueMin, valueMax, valueNow, progressBarClassName, progressBarLabel, show, className } = props, restProps = __rest(props, ["valueMin", "valueMax", "valueNow", "progressBarClassName", "progressBarLabel", "show", "className"]);
|
|
37
26
|
if (!show) {
|
|
38
27
|
return null;
|
|
39
28
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
return (react_1.default.createElement("div",
|
|
43
|
-
react_1.default.createElement("div", { role: "progressbar", className:
|
|
44
|
-
react_1.default.createElement("span", { className:
|
|
29
|
+
const valueNowInPercent = valueMax > valueMin ? ((valueNow - valueMin) / (valueMax - valueMin)) * 100 : NaN;
|
|
30
|
+
const widthInPercent = valueNowInPercent > 100 ? 100 : valueNowInPercent < 0 || isNaN(valueNowInPercent) ? 0 : valueNowInPercent;
|
|
31
|
+
return (react_1.default.createElement("div", Object.assign({ className: `${className} progress` }, restProps),
|
|
32
|
+
react_1.default.createElement("div", { role: "progressbar", className: `progress-bar ${progressBarClassName}`, "aria-valuenow": valueNow, "aria-valuemin": valueMin, "aria-valuemax": valueMax, style: { width: `${widthInPercent}%` } },
|
|
33
|
+
react_1.default.createElement("span", { className: `${progressBarLabel ? '' : 'sr-only'}` }, progressBarLabel ? progressBarLabel : `${valueNowInPercent}% complete`))));
|
|
45
34
|
}
|
|
46
35
|
exports.ProgressBar = ProgressBar;
|
|
47
36
|
ProgressBar.defaultProps = defaultProps;
|
|
@@ -1,54 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Original source
|
|
3
3
|
// https://github.com/prezly/react-promise-modal/
|
|
4
|
-
var __assign = (this && this.__assign) || function () {
|
|
5
|
-
__assign = Object.assign || function(t) {
|
|
6
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
7
|
-
s = arguments[i];
|
|
8
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
9
|
-
t[p] = s[p];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
|
-
return __assign.apply(this, arguments);
|
|
14
|
-
};
|
|
15
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
5
|
exports.PromisifyModal = void 0;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
6
|
+
const react_dom_1 = require("react-dom");
|
|
7
|
+
const DEFAULT_DESTRUCTION_DELAY = 300;
|
|
8
|
+
const DEFAULT_OPTIONS = {
|
|
20
9
|
destructionDelay: DEFAULT_DESTRUCTION_DELAY,
|
|
21
10
|
};
|
|
22
|
-
|
|
23
|
-
function PromisifyModal(renderModal, options) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
var container = document.createElement('div');
|
|
11
|
+
const noop = () => { };
|
|
12
|
+
function PromisifyModal(renderModal, options = {}) {
|
|
13
|
+
const { destructionDelay } = Object.assign(Object.assign({}, DEFAULT_OPTIONS), options);
|
|
14
|
+
const container = document.createElement('div');
|
|
27
15
|
document.body.appendChild(container);
|
|
28
|
-
function displayModal(
|
|
29
|
-
|
|
30
|
-
react_dom_1.render(renderModal({ onSubmit: onSubmit, onDismiss: onDismiss, show: true }), container);
|
|
16
|
+
function displayModal({ onSubmit, onDismiss }) {
|
|
17
|
+
react_dom_1.render(renderModal({ onSubmit, onDismiss, show: true }), container);
|
|
31
18
|
}
|
|
32
|
-
function hideModal(
|
|
33
|
-
|
|
34
|
-
react_dom_1.render(renderModal({ onSubmit: onSubmit, onDismiss: onDismiss, show: false }), container, callback);
|
|
19
|
+
function hideModal({ onSubmit, onDismiss }, callback) {
|
|
20
|
+
react_dom_1.render(renderModal({ onSubmit, onDismiss, show: false }), container, callback);
|
|
35
21
|
}
|
|
36
22
|
function destroyModal() {
|
|
37
23
|
react_dom_1.unmountComponentAtNode(container);
|
|
38
24
|
document.body.removeChild(container);
|
|
39
25
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
};
|
|
45
|
-
var onDismiss = function () { return resolve(undefined); };
|
|
46
|
-
displayModal({ onSubmit: onSubmit, onDismiss: onDismiss });
|
|
26
|
+
const confirmation = new Promise((resolve) => {
|
|
27
|
+
const onSubmit = (value = true) => resolve(value);
|
|
28
|
+
const onDismiss = () => resolve(undefined);
|
|
29
|
+
displayModal({ onSubmit, onDismiss });
|
|
47
30
|
});
|
|
48
|
-
return confirmation.then(
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
hideModal({ onSubmit
|
|
31
|
+
return confirmation.then((result) => {
|
|
32
|
+
const onSubmit = noop;
|
|
33
|
+
const onDismiss = noop;
|
|
34
|
+
hideModal({ onSubmit, onDismiss }, () => {
|
|
52
35
|
setTimeout(destroyModal, destructionDelay);
|
|
53
36
|
});
|
|
54
37
|
return result;
|
|
@@ -4,12 +4,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.SubscriptionAbuseModal = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
const react_core_1 = require("@patternfly/react-core");
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
const react_i18next_1 = require("react-i18next");
|
|
10
|
+
const const_1 = require("./const");
|
|
11
11
|
function SubscriptionAbuseModal(props) {
|
|
12
|
-
|
|
12
|
+
const { t } = react_i18next_1.useTranslation();
|
|
13
13
|
return (react_1.default.createElement(react_core_1.Modal, { id: "subscription-abuse-confirmation", title: t(const_1.SubscriptionAbuseModalTitle), isOpen: props.isOpen, variant: react_core_1.ModalVariant.small, onClose: props.onConfirm, actions: [
|
|
14
14
|
react_1.default.createElement(react_core_1.Button, { key: "confirm", variant: react_core_1.ButtonVariant.primary, onClick: props.onConfirm, "data-tracking-id": "subscription-abuse-close-cases-confirm" },
|
|
15
15
|
react_1.default.createElement(react_i18next_1.Trans, null, "I understand")),
|
|
@@ -4,10 +4,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.SubscriptionAbuseModalText = exports.SubscriptionAbuseModalTitle = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const SubscriptionAbuseModalTitle = 'Please address your account issues';
|
|
9
9
|
exports.SubscriptionAbuseModalTitle = SubscriptionAbuseModalTitle;
|
|
10
|
-
|
|
10
|
+
const SubscriptionAbuseModalText = (react_1.default.createElement(react_1.default.Fragment, null,
|
|
11
11
|
"A support case cannot be opened or modified for this account at this time. Please contact your Sales Account Manager for more information. If you do not know who your Account Manager is please visit",
|
|
12
12
|
' ',
|
|
13
13
|
react_1.default.createElement("a", { href: "https://www.redhat.com/contact", target: "_blank", rel: "noopener noreferrer" }, "www.redhat.com/contact"),
|
|
@@ -18,41 +18,25 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
18
18
|
__setModuleDefault(result, mod);
|
|
19
19
|
return result;
|
|
20
20
|
};
|
|
21
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
22
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
23
|
-
if (!m) return o;
|
|
24
|
-
var i = m.call(o), r, ar = [], e;
|
|
25
|
-
try {
|
|
26
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
27
|
-
}
|
|
28
|
-
catch (error) { e = { error: error }; }
|
|
29
|
-
finally {
|
|
30
|
-
try {
|
|
31
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
32
|
-
}
|
|
33
|
-
finally { if (e) throw e.error; }
|
|
34
|
-
}
|
|
35
|
-
return ar;
|
|
36
|
-
};
|
|
37
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
22
|
exports.SupportFeedbackForm = void 0;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
23
|
+
const react_core_1 = require("@patternfly/react-core");
|
|
24
|
+
const react_1 = __importStar(require("react"));
|
|
25
|
+
const react_i18next_1 = require("react-i18next");
|
|
26
|
+
const SupportFeedbackModal_1 = require("./SupportFeedbackModal");
|
|
27
|
+
const defaultProps = {
|
|
44
28
|
buttonLabel: 'Provide feedback',
|
|
45
29
|
additionalBtnClass: '',
|
|
46
30
|
isInline: false,
|
|
47
31
|
};
|
|
48
32
|
function SupportFeedbackForm(props) {
|
|
49
|
-
|
|
33
|
+
const [isModalOpen, toggleModal] = react_1.useState(false);
|
|
50
34
|
// Function for Toggling the Modal when Provide feedback button is clicked
|
|
51
|
-
|
|
35
|
+
const handleModalToggle = () => {
|
|
52
36
|
toggleModal(!isModalOpen);
|
|
53
37
|
};
|
|
54
38
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
55
|
-
react_1.default.createElement(react_core_1.Button, { key: "confirm", onClick: handleModalToggle, className:
|
|
39
|
+
react_1.default.createElement(react_core_1.Button, { key: "confirm", onClick: handleModalToggle, className: `${props.additionalBtnClass}`, "data-tracking-id": "app-feedback-trigger", variant: "link", isInline: props.isInline ? true : null },
|
|
56
40
|
react_1.default.createElement(react_i18next_1.Trans, null, props.isInline ? props.buttonLabel.toLowerCase() : props.buttonLabel)),
|
|
57
41
|
react_1.default.createElement(SupportFeedbackModal_1.SupportFeedbackModal, { isModalOpen: isModalOpen, onClose: handleModalToggle })));
|
|
58
42
|
}
|