@rh-support/components 2.0.4 → 2.0.7-beta.1
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/AlertMessage/index.d.ts +0 -1
- package/lib/cjs/AlertMessage/index.d.ts.map +1 -1
- package/lib/cjs/AlertMessage/index.js +1 -1
- package/lib/cjs/ConfirmationModal/ConfirmationContext.d.ts +0 -1
- package/lib/cjs/ConfirmationModal/ConfirmationContext.d.ts.map +1 -1
- package/lib/cjs/ConfirmationModal/ConfirmationContext.js +13 -41
- package/lib/cjs/ConfirmationModal/ConfirmationDialog.d.ts +4 -2
- package/lib/cjs/ConfirmationModal/ConfirmationDialog.d.ts.map +1 -1
- package/lib/cjs/ConfirmationModal/ConfirmationDialog.js +7 -6
- package/lib/cjs/ConfirmationModal/ConfirmationModal.stories.d.ts +0 -6
- package/lib/cjs/ConfirmationModal/ConfirmationModal.stories.d.ts.map +1 -1
- package/lib/cjs/ConfirmationModal/ConfirmationModal.stories.js +29 -69
- package/lib/cjs/CoverSpinner/CoverSpinner.d.ts +0 -1
- package/lib/cjs/CoverSpinner/CoverSpinner.d.ts.map +1 -1
- package/lib/cjs/CoverSpinner/CoverSpinner.js +1 -1
- package/lib/cjs/CustomContentLoader/CustomContentLoader.d.ts.map +1 -1
- package/lib/cjs/CustomContentLoader/CustomContentLoader.js +25 -25
- package/lib/cjs/CustomTextInput/CustomTextInput.d.ts +0 -1
- package/lib/cjs/CustomTextInput/CustomTextInput.d.ts.map +1 -1
- package/lib/cjs/CustomTextInput/CustomTextInput.js +10 -21
- package/lib/cjs/DropDownList/AsyncDropDownList.js +5 -5
- package/lib/cjs/DropDownList/DropDownList.d.ts +0 -1
- package/lib/cjs/DropDownList/DropDownList.d.ts.map +1 -1
- 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.d.ts +1 -0
- package/lib/cjs/DropDownList/SearchableList.d.ts.map +1 -1
- package/lib/cjs/DropDownList/SearchableList.js +45 -55
- package/lib/cjs/DropDownList/SelectList.js +15 -26
- package/lib/cjs/DropDownList/async.js +28 -38
- package/lib/cjs/DropDownList/dropdownList.css +1 -1
- package/lib/cjs/DropDownList/dropdownUtils.d.ts.map +1 -1
- package/lib/cjs/DropDownList/dropdownUtils.js +9 -19
- package/lib/cjs/DropDownList/types.d.ts +1 -0
- package/lib/cjs/DropDownList/types.d.ts.map +1 -1
- package/lib/cjs/DropDownList/withMulti.js +15 -26
- package/lib/cjs/ErrorBoundary/ErrorBoundary.js +18 -47
- package/lib/cjs/ErrorBoundary/ErrorBoundaryFallbackComponent.d.ts +0 -1
- package/lib/cjs/ErrorBoundary/ErrorBoundaryFallbackComponent.d.ts.map +1 -1
- package/lib/cjs/ErrorBoundary/ErrorBoundaryFallbackComponent.js +10 -10
- package/lib/cjs/ErrorPages/Generic403.d.ts +0 -1
- package/lib/cjs/ErrorPages/Generic403.d.ts.map +1 -1
- package/lib/cjs/ErrorPages/Generic403.js +2 -2
- package/lib/cjs/FeedbackForm/FeedbackForm.d.ts +0 -1
- package/lib/cjs/FeedbackForm/FeedbackForm.d.ts.map +1 -1
- package/lib/cjs/FeedbackForm/FeedbackForm.js +24 -52
- package/lib/cjs/Functional/CaseContactsSelectorExternal.d.ts.map +1 -1
- package/lib/cjs/Functional/CaseContactsSelectorExternal.js +81 -154
- package/lib/cjs/InlineEdit/InlineEdit.d.ts +1 -0
- package/lib/cjs/InlineEdit/InlineEdit.d.ts.map +1 -1
- package/lib/cjs/InlineEdit/InlineEdit.js +58 -144
- package/lib/cjs/InlineEdit/NewInlineEdit.d.ts +1 -0
- package/lib/cjs/InlineEdit/NewInlineEdit.d.ts.map +1 -1
- package/lib/cjs/InlineEdit/NewInlineEdit.js +62 -147
- package/lib/cjs/InlineEdit/inlineEdit.css +4 -0
- package/lib/cjs/InlineEdit/newInlineEdit.css +4 -0
- package/lib/cjs/LanguageSelector/LanguageSelector.d.ts +0 -1
- package/lib/cjs/LanguageSelector/LanguageSelector.d.ts.map +1 -1
- package/lib/cjs/LanguageSelector/LanguageSelector.js +10 -26
- package/lib/cjs/LoadingDots/LoadingDots.d.ts +0 -1
- package/lib/cjs/LoadingDots/LoadingDots.d.ts.map +1 -1
- package/lib/cjs/LoadingDots/LoadingDots.js +4 -4
- package/lib/cjs/LoadingDots/index.d.ts +0 -1
- package/lib/cjs/LoadingDots/index.d.ts.map +1 -1
- package/lib/cjs/LoadingDots/index.js +1 -1
- package/lib/cjs/LoadingIndicator/LoadingIndicator.d.ts +0 -1
- package/lib/cjs/LoadingIndicator/LoadingIndicator.d.ts.map +1 -1
- package/lib/cjs/LoadingIndicator/LoadingIndicator.js +3 -3
- package/lib/cjs/LoginModal/LoginModal.d.ts +0 -1
- package/lib/cjs/LoginModal/LoginModal.d.ts.map +1 -1
- 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.d.ts +0 -1
- package/lib/cjs/PaginationCompact/PaginationCompact.d.ts.map +1 -1
- package/lib/cjs/PaginationCompact/PaginationCompact.js +14 -31
- package/lib/cjs/PhoneInput/CountryData.d.ts +3 -0
- package/lib/cjs/PhoneInput/CountryData.d.ts.map +1 -0
- package/lib/cjs/PhoneInput/CountryData.js +583 -0
- package/lib/cjs/PhoneInput/PhoneInput.d.ts +19 -0
- package/lib/cjs/PhoneInput/PhoneInput.d.ts.map +1 -0
- package/lib/cjs/PhoneInput/PhoneInput.js +284 -0
- package/lib/cjs/PhoneInput/PhoneInput.scss +753 -0
- package/lib/cjs/PhoneInput/flags.png +0 -0
- package/lib/cjs/PhoneInput/index.d.ts +2 -0
- package/lib/cjs/PhoneInput/index.d.ts.map +1 -0
- package/lib/cjs/PhoneInput/index.js +13 -0
- package/lib/cjs/ProgressBar/CircularProgressBar/CircularProgressBar.d.ts +0 -1
- package/lib/cjs/ProgressBar/CircularProgressBar/CircularProgressBar.d.ts.map +1 -1
- 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.d.ts +0 -1
- package/lib/cjs/SubscriptionAbuse/SubscriptionAbuseModal.d.ts.map +1 -1
- package/lib/cjs/SubscriptionAbuse/SubscriptionAbuseModal.js +5 -5
- package/lib/cjs/SubscriptionAbuse/const.d.ts +0 -1
- package/lib/cjs/SubscriptionAbuse/const.d.ts.map +1 -1
- package/lib/cjs/SubscriptionAbuse/const.js +3 -3
- package/lib/cjs/SupportFeedbackForm/SupportFeedbackForm.d.ts +0 -1
- package/lib/cjs/SupportFeedbackForm/SupportFeedbackForm.d.ts.map +1 -1
- package/lib/cjs/SupportFeedbackForm/SupportFeedbackForm.js +8 -24
- package/lib/cjs/SupportFeedbackForm/SupportFeedbackModal.d.ts +0 -1
- package/lib/cjs/SupportFeedbackForm/SupportFeedbackModal.d.ts.map +1 -1
- 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.d.ts +0 -1
- package/lib/cjs/Table/TableColumnSelector.d.ts.map +1 -1
- package/lib/cjs/Table/TableColumnSelector.js +14 -15
- package/lib/cjs/Table/TablePagination.d.ts +0 -1
- package/lib/cjs/Table/TablePagination.d.ts.map +1 -1
- package/lib/cjs/Table/TablePagination.js +8 -8
- package/lib/cjs/Table/TableProvider.js +6 -6
- package/lib/cjs/TermsAndConditions/AcceptTermsModal.d.ts +0 -1
- package/lib/cjs/TermsAndConditions/AcceptTermsModal.d.ts.map +1 -1
- package/lib/cjs/TermsAndConditions/AcceptTermsModal.js +46 -100
- package/lib/cjs/TextAreaAutosize/TextAreaAutosize.js +35 -62
- package/lib/cjs/TextAreaResizable/TextAreaResizable.js +12 -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.d.ts +0 -1
- package/lib/cjs/helperFunctions/errorMessage.d.ts.map +1 -1
- 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/cjs/index.d.ts +1 -0
- package/lib/cjs/index.d.ts.map +1 -1
- package/lib/cjs/index.js +1 -0
- package/lib/esm/AlertMessage/AlertMessage.js +2 -2
- package/lib/esm/AlertMessage/index.d.ts +0 -1
- package/lib/esm/AlertMessage/index.d.ts.map +1 -1
- package/lib/esm/AlertMessage/index.js +1 -1
- package/lib/esm/ConfirmationModal/ConfirmationContext.d.ts +0 -1
- package/lib/esm/ConfirmationModal/ConfirmationContext.d.ts.map +1 -1
- package/lib/esm/ConfirmationModal/ConfirmationDialog.d.ts +4 -2
- package/lib/esm/ConfirmationModal/ConfirmationDialog.d.ts.map +1 -1
- package/lib/esm/ConfirmationModal/ConfirmationDialog.js +3 -2
- package/lib/esm/ConfirmationModal/ConfirmationModal.stories.d.ts +0 -6
- package/lib/esm/ConfirmationModal/ConfirmationModal.stories.d.ts.map +1 -1
- package/lib/esm/ConfirmationModal/ConfirmationModal.stories.js +19 -18
- package/lib/esm/CoverSpinner/CoverSpinner.d.ts +0 -1
- package/lib/esm/CoverSpinner/CoverSpinner.d.ts.map +1 -1
- package/lib/esm/CustomContentLoader/CustomContentLoader.d.ts.map +1 -1
- package/lib/esm/CustomContentLoader/CustomContentLoader.js +23 -23
- package/lib/esm/CustomTextInput/CustomTextInput.d.ts +0 -1
- package/lib/esm/CustomTextInput/CustomTextInput.d.ts.map +1 -1
- package/lib/esm/CustomTextInput/CustomTextInput.js +1 -1
- package/lib/esm/DropDownList/DropDownList.d.ts +0 -1
- package/lib/esm/DropDownList/DropDownList.d.ts.map +1 -1
- package/lib/esm/DropDownList/SearchableList.d.ts +1 -0
- package/lib/esm/DropDownList/SearchableList.d.ts.map +1 -1
- package/lib/esm/DropDownList/SearchableList.js +6 -2
- package/lib/esm/DropDownList/dropdownList.css +1 -1
- package/lib/esm/DropDownList/dropdownUtils.d.ts.map +1 -1
- package/lib/esm/DropDownList/dropdownUtils.js +1 -0
- package/lib/esm/DropDownList/types.d.ts +1 -0
- package/lib/esm/DropDownList/types.d.ts.map +1 -1
- package/lib/esm/ErrorBoundary/ErrorBoundaryFallbackComponent.d.ts +0 -1
- package/lib/esm/ErrorBoundary/ErrorBoundaryFallbackComponent.d.ts.map +1 -1
- package/lib/esm/ErrorPages/Generic403.d.ts +0 -1
- package/lib/esm/ErrorPages/Generic403.d.ts.map +1 -1
- package/lib/esm/FeedbackForm/FeedbackForm.d.ts +0 -1
- package/lib/esm/FeedbackForm/FeedbackForm.d.ts.map +1 -1
- package/lib/esm/Functional/CaseContactsSelectorExternal.d.ts.map +1 -1
- package/lib/esm/Functional/CaseContactsSelectorExternal.js +2 -2
- package/lib/esm/InlineEdit/InlineEdit.d.ts +1 -0
- package/lib/esm/InlineEdit/InlineEdit.d.ts.map +1 -1
- package/lib/esm/InlineEdit/InlineEdit.js +3 -3
- package/lib/esm/InlineEdit/NewInlineEdit.d.ts +1 -0
- package/lib/esm/InlineEdit/NewInlineEdit.d.ts.map +1 -1
- package/lib/esm/InlineEdit/NewInlineEdit.js +3 -3
- package/lib/esm/InlineEdit/inlineEdit.css +4 -0
- package/lib/esm/InlineEdit/newInlineEdit.css +4 -0
- package/lib/esm/LanguageSelector/LanguageSelector.d.ts +0 -1
- package/lib/esm/LanguageSelector/LanguageSelector.d.ts.map +1 -1
- package/lib/esm/LoadingDots/LoadingDots.d.ts +0 -1
- package/lib/esm/LoadingDots/LoadingDots.d.ts.map +1 -1
- package/lib/esm/LoadingDots/LoadingDots.js +1 -1
- package/lib/esm/LoadingDots/index.d.ts +0 -1
- package/lib/esm/LoadingDots/index.d.ts.map +1 -1
- package/lib/esm/LoadingDots/index.js +1 -1
- package/lib/esm/LoadingIndicator/LoadingIndicator.d.ts +0 -1
- package/lib/esm/LoadingIndicator/LoadingIndicator.d.ts.map +1 -1
- package/lib/esm/LoginModal/LoginModal.d.ts +0 -1
- package/lib/esm/LoginModal/LoginModal.d.ts.map +1 -1
- package/lib/esm/PaginationCompact/PaginationCompact.d.ts +0 -1
- package/lib/esm/PaginationCompact/PaginationCompact.d.ts.map +1 -1
- package/lib/esm/PhoneInput/CountryData.d.ts +3 -0
- package/lib/esm/PhoneInput/CountryData.d.ts.map +1 -0
- package/lib/esm/PhoneInput/CountryData.js +580 -0
- package/lib/esm/PhoneInput/PhoneInput.d.ts +19 -0
- package/lib/esm/PhoneInput/PhoneInput.d.ts.map +1 -0
- package/lib/esm/PhoneInput/PhoneInput.js +257 -0
- package/lib/esm/PhoneInput/PhoneInput.scss +753 -0
- package/lib/esm/PhoneInput/flags.png +0 -0
- package/lib/esm/PhoneInput/index.d.ts +2 -0
- package/lib/esm/PhoneInput/index.d.ts.map +1 -0
- package/lib/esm/PhoneInput/index.js +1 -0
- package/lib/esm/ProgressBar/CircularProgressBar/CircularProgressBar.d.ts +0 -1
- package/lib/esm/ProgressBar/CircularProgressBar/CircularProgressBar.d.ts.map +1 -1
- package/lib/esm/SubscriptionAbuse/SubscriptionAbuseModal.d.ts +0 -1
- package/lib/esm/SubscriptionAbuse/SubscriptionAbuseModal.d.ts.map +1 -1
- package/lib/esm/SubscriptionAbuse/const.d.ts +0 -1
- package/lib/esm/SubscriptionAbuse/const.d.ts.map +1 -1
- package/lib/esm/SupportFeedbackForm/SupportFeedbackForm.d.ts +0 -1
- package/lib/esm/SupportFeedbackForm/SupportFeedbackForm.d.ts.map +1 -1
- package/lib/esm/SupportFeedbackForm/SupportFeedbackModal.d.ts +0 -1
- package/lib/esm/SupportFeedbackForm/SupportFeedbackModal.d.ts.map +1 -1
- package/lib/esm/Table/TableColumnSelector.d.ts +0 -1
- package/lib/esm/Table/TableColumnSelector.d.ts.map +1 -1
- package/lib/esm/Table/TablePagination.d.ts +0 -1
- package/lib/esm/Table/TablePagination.d.ts.map +1 -1
- package/lib/esm/TermsAndConditions/AcceptTermsModal.d.ts +0 -1
- package/lib/esm/TermsAndConditions/AcceptTermsModal.d.ts.map +1 -1
- package/lib/esm/TextAreaResizable/TextAreaResizable.js +1 -1
- package/lib/esm/helperFunctions/errorMessage.d.ts +0 -1
- package/lib/esm/helperFunctions/errorMessage.d.ts.map +1 -1
- package/lib/esm/index.d.ts +1 -0
- package/lib/esm/index.d.ts.map +1 -1
- package/lib/esm/index.js +1 -0
- package/package.json +16 -30
- package/lib/cjs/AlertMessage/AlertMessage.stories.d.ts +0 -12
- package/lib/cjs/AlertMessage/AlertMessage.stories.d.ts.map +0 -1
- package/lib/cjs/AlertMessage/AlertMessage.stories.js +0 -29
- package/lib/cjs/DropDownList/Dropdownlist.stories.d.ts +0 -17
- package/lib/cjs/DropDownList/Dropdownlist.stories.d.ts.map +0 -1
- package/lib/cjs/DropDownList/Dropdownlist.stories.js +0 -253
- package/lib/cjs/LoadingDots/LoadingDots.stories.d.ts +0 -10
- package/lib/cjs/LoadingDots/LoadingDots.stories.d.ts.map +0 -1
- package/lib/cjs/LoadingDots/LoadingDots.stories.js +0 -16
- package/lib/cjs/LoadingIndicator/LoadingIndicator.stories.d.ts +0 -11
- package/lib/cjs/LoadingIndicator/LoadingIndicator.stories.d.ts.map +0 -1
- package/lib/cjs/LoadingIndicator/LoadingIndicator.stories.js +0 -18
- package/lib/cjs/Table/PFTable.stories.d.ts +0 -20
- package/lib/cjs/Table/PFTable.stories.d.ts.map +0 -1
- package/lib/cjs/Table/PFTable.stories.js +0 -81
- package/lib/cjs/demo/Demo.css +0 -3
- package/lib/cjs/demo/Demo.d.ts +0 -13
- package/lib/cjs/demo/Demo.d.ts.map +0 -1
- package/lib/cjs/demo/Demo.js +0 -42
- package/lib/cjs/demo/Demo.md +0 -0
- package/lib/cjs/demo/Demo.scss +0 -3
- package/lib/cjs/demo/index.d.ts +0 -3
- package/lib/cjs/demo/index.d.ts.map +0 -1
- package/lib/cjs/demo/index.js +0 -23
- package/lib/esm/AlertMessage/AlertMessage.stories.d.ts +0 -12
- package/lib/esm/AlertMessage/AlertMessage.stories.d.ts.map +0 -1
- package/lib/esm/AlertMessage/AlertMessage.stories.js +0 -20
- package/lib/esm/DropDownList/Dropdownlist.stories.d.ts +0 -17
- package/lib/esm/DropDownList/Dropdownlist.stories.d.ts.map +0 -1
- package/lib/esm/DropDownList/Dropdownlist.stories.js +0 -156
- package/lib/esm/LoadingDots/LoadingDots.stories.d.ts +0 -10
- package/lib/esm/LoadingDots/LoadingDots.stories.d.ts.map +0 -1
- package/lib/esm/LoadingDots/LoadingDots.stories.js +0 -8
- package/lib/esm/LoadingIndicator/LoadingIndicator.stories.d.ts +0 -11
- package/lib/esm/LoadingIndicator/LoadingIndicator.stories.d.ts.map +0 -1
- package/lib/esm/LoadingIndicator/LoadingIndicator.stories.js +0 -9
- package/lib/esm/Table/PFTable.stories.d.ts +0 -20
- package/lib/esm/Table/PFTable.stories.d.ts.map +0 -1
- package/lib/esm/Table/PFTable.stories.js +0 -73
- package/lib/esm/demo/Demo.css +0 -3
- package/lib/esm/demo/Demo.d.ts +0 -13
- package/lib/esm/demo/Demo.d.ts.map +0 -1
- package/lib/esm/demo/Demo.js +0 -26
- package/lib/esm/demo/Demo.md +0 -0
- package/lib/esm/demo/Demo.scss +0 -3
- package/lib/esm/demo/index.d.ts +0 -3
- package/lib/esm/demo/index.d.ts.map +0 -1
- package/lib/esm/demo/index.js +0 -2
|
@@ -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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
3
|
if (k2 === undefined) k2 = k;
|
|
15
4
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
@@ -29,42 +18,21 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
29
18
|
__setModuleDefault(result, mod);
|
|
30
19
|
return result;
|
|
31
20
|
};
|
|
32
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
33
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
34
|
-
if (!m) return o;
|
|
35
|
-
var i = m.call(o), r, ar = [], e;
|
|
36
|
-
try {
|
|
37
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
38
|
-
}
|
|
39
|
-
catch (error) { e = { error: error }; }
|
|
40
|
-
finally {
|
|
41
|
-
try {
|
|
42
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
43
|
-
}
|
|
44
|
-
finally { if (e) throw e.error; }
|
|
45
|
-
}
|
|
46
|
-
return ar;
|
|
47
|
-
};
|
|
48
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
49
|
-
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
50
|
-
to[j] = from[i];
|
|
51
|
-
return to;
|
|
52
|
-
};
|
|
53
21
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
54
22
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
55
23
|
};
|
|
56
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
57
25
|
exports.Dropdown = void 0;
|
|
58
26
|
require("./dropdownList.css");
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
27
|
+
const check_icon_1 = __importDefault(require("@patternfly/react-icons/dist/js/icons/check-icon"));
|
|
28
|
+
const isEmpty_1 = __importDefault(require("lodash/isEmpty"));
|
|
29
|
+
const map_1 = __importDefault(require("lodash/map"));
|
|
30
|
+
const react_1 = __importStar(require("react"));
|
|
31
|
+
const react_i18next_1 = require("react-i18next");
|
|
32
|
+
const dropdownUtils_1 = require("./dropdownUtils");
|
|
33
|
+
const SearchableList_1 = __importDefault(require("./SearchableList"));
|
|
34
|
+
const SelectList_1 = __importDefault(require("./SelectList"));
|
|
35
|
+
const defaultProps = {
|
|
68
36
|
className: '',
|
|
69
37
|
id: '',
|
|
70
38
|
searchable: false,
|
|
@@ -86,27 +54,26 @@ var defaultProps = {
|
|
|
86
54
|
};
|
|
87
55
|
function Dropdown(props) {
|
|
88
56
|
var _a, _b, _c;
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
var selectedItem = _a.selectedItem;
|
|
57
|
+
const [resultsShown, setResultsShown] = react_1.useState(props.maxResults);
|
|
58
|
+
const [itemsList, setItemsList] = react_1.useState(props.list);
|
|
59
|
+
const onChangeLocal = ({ selectedItem, }) => {
|
|
93
60
|
selectedItem && props.onChange && props.onChange(selectedItem);
|
|
94
61
|
};
|
|
95
|
-
react_1.useEffect(
|
|
62
|
+
react_1.useEffect(() => {
|
|
96
63
|
setItemsList(props.list);
|
|
97
64
|
}, [props.list]);
|
|
98
|
-
|
|
65
|
+
const onPaginatonButtonClick = (e, downshift) => {
|
|
99
66
|
e.stopPropagation();
|
|
100
|
-
|
|
67
|
+
const finalCount = resultsShown + props.maxResults;
|
|
101
68
|
setResultsShown(finalCount);
|
|
102
69
|
props.onPaginate && props.onPaginate(finalCount, downshift.inputValue, e);
|
|
103
70
|
};
|
|
104
|
-
|
|
71
|
+
const isSelectedItemLocal = (item) => {
|
|
105
72
|
return !item.isNotSelectable && dropdownUtils_1.itemToString(props.selectedItem) === dropdownUtils_1.itemToString(item);
|
|
106
73
|
};
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
74
|
+
const isSelectedItem = props.isSelectedItem || isSelectedItemLocal;
|
|
75
|
+
const getListItemClassNames = (downshift, item, itemIndex) => {
|
|
76
|
+
let toReturn = 'downshift-item pf-c-select__menu-item';
|
|
110
77
|
toReturn += item.additionalInfo ? ' pf-m-description' : '';
|
|
111
78
|
toReturn += isSelectedItem(item) ? ' pf-m-selected' : '';
|
|
112
79
|
toReturn += item.disabled ? ' pf-m-disabled' : '';
|
|
@@ -114,58 +81,61 @@ function Dropdown(props) {
|
|
|
114
81
|
toReturn += item.className ? item.className : '';
|
|
115
82
|
return toReturn;
|
|
116
83
|
};
|
|
117
|
-
|
|
84
|
+
const onInputChangeLocal = (items, inputValue) => {
|
|
118
85
|
setResultsShown(props.maxResults);
|
|
119
86
|
setItemsList(items);
|
|
120
87
|
props.onInputChange && props.onInputChange(inputValue);
|
|
121
88
|
};
|
|
122
|
-
|
|
123
|
-
|
|
89
|
+
const renderListItems = (downshift) => {
|
|
90
|
+
const listToRender = [];
|
|
124
91
|
if (!downshift.isOpen)
|
|
125
92
|
return [];
|
|
126
|
-
|
|
127
|
-
|
|
93
|
+
let optionsToRender = itemsList;
|
|
94
|
+
const shouldPaginate = props.paginate && resultsShown < optionsToRender.length;
|
|
128
95
|
optionsToRender = props.paginate ? optionsToRender.slice(0, resultsShown) : optionsToRender;
|
|
129
|
-
optionsToRender.filter(
|
|
96
|
+
optionsToRender.filter((item) => !item.isNotSearchable).length === 0 &&
|
|
130
97
|
props.emptyListLabel &&
|
|
131
98
|
listToRender.push(react_1.default.createElement("li", { key: "empty-label", className: "pf-u-p-sm" },
|
|
132
99
|
react_1.default.createElement(react_i18next_1.Trans, null, props.emptyListLabel)));
|
|
133
|
-
listToRender.push
|
|
134
|
-
|
|
100
|
+
listToRender.push(...map_1.default(optionsToRender, (item, index) => {
|
|
101
|
+
const itemProps = item.isNonActionable
|
|
135
102
|
? {}
|
|
136
103
|
: downshift.getItemProps({
|
|
137
|
-
item
|
|
138
|
-
index
|
|
104
|
+
item,
|
|
105
|
+
index,
|
|
139
106
|
disabled: item.disabled,
|
|
140
107
|
className: getListItemClassNames(downshift, item, index),
|
|
141
108
|
});
|
|
142
|
-
return (react_1.default.createElement("li", { className: item.actionItem ? 'pf-c-select__menu-wrapper' : '', role: "presentation", key: index
|
|
109
|
+
return (react_1.default.createElement("li", { className: item.actionItem ? 'pf-c-select__menu-wrapper' : '', role: "presentation", key: `${index}-${props.id}-${dropdownUtils_1.itemToString(item)}` },
|
|
143
110
|
item.isNonActionable ? (isEmpty_1.default(item.children) ? dropdownUtils_1.itemToString(item) : item.children) : null,
|
|
144
|
-
props.multiSelect && !item.isNotSelectable && !item.isNonActionable && (react_1.default.createElement("div",
|
|
111
|
+
props.multiSelect && !item.isNotSelectable && !item.isNonActionable && (react_1.default.createElement("div", Object.assign({}, itemProps),
|
|
145
112
|
react_1.default.createElement("div", { className: item.additionalInfo ? 'pf-c-select__menu-item-main' : '' },
|
|
146
113
|
react_1.default.createElement("input", { disabled: item.disabled === true, className: "pf-c-check__input pf-u-mr-sm", checked: isSelectedItem(item), onChange: dropdownUtils_1.noop, type: "checkbox" }),
|
|
147
114
|
isEmpty_1.default(item.children) ? dropdownUtils_1.itemToString(item) : item.children),
|
|
148
115
|
item.additionalInfo && (react_1.default.createElement("div", { className: "pf-c-select__menu-item-description" }, item.additionalInfo)))),
|
|
149
|
-
!props.multiSelect && !item.isNonActionable && (react_1.default.createElement("button",
|
|
116
|
+
!props.multiSelect && !item.isNonActionable && (react_1.default.createElement("button", Object.assign({}, itemProps, { type: "button", title: dropdownUtils_1.itemToString(item) }),
|
|
150
117
|
react_1.default.createElement("div", { className: item.additionalInfo ? 'pf-c-select__menu-item-main' : '' },
|
|
151
118
|
isEmpty_1.default(item.children) ? dropdownUtils_1.itemToString(item) : item.children,
|
|
152
119
|
isSelectedItem(item) && (react_1.default.createElement("span", { className: "pf-c-select__menu-item-icon" },
|
|
153
120
|
react_1.default.createElement(check_icon_1.default, { "aria-hidden": true })))),
|
|
154
121
|
item.additionalInfo && (react_1.default.createElement("div", { className: "pf-c-select__menu-item-description" }, item.additionalInfo)))),
|
|
155
122
|
item.actionItem ? react_1.default.cloneElement(item.actionItem, { disabled: item.disabled }) : null));
|
|
156
|
-
}))
|
|
157
|
-
shouldPaginate &&
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
react_1.default.createElement("
|
|
161
|
-
react_1.default.createElement(
|
|
162
|
-
|
|
123
|
+
}));
|
|
124
|
+
shouldPaginate &&
|
|
125
|
+
listToRender.push(...[
|
|
126
|
+
react_1.default.createElement("li", { key: "separator", className: "dropdown-divider", role: "separator" }),
|
|
127
|
+
react_1.default.createElement("li", { key: "pagination-item", className: "downshift-pagination-item" },
|
|
128
|
+
react_1.default.createElement("button", { type: "button", onClick: (e) => onPaginatonButtonClick(e, downshift), className: "pf-c-button pf-m-link pf-m-block", disabled: props.isLoadingList },
|
|
129
|
+
react_1.default.createElement(react_i18next_1.Trans, null, props.paginationBtnText))),
|
|
130
|
+
]);
|
|
163
131
|
return listToRender;
|
|
164
132
|
};
|
|
165
133
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
134
|
+
const selectedItem = react_1.useMemo(() => props.selectedItem, [(_c = (_b = (_a = props.selectedItem) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : props.selectedItem) !== null && _c !== void 0 ? _c : '']);
|
|
135
|
+
const newProps = Object.assign(Object.assign({}, props), { selectedItem, onChange: onChangeLocal, itemToString: dropdownUtils_1.itemToString,
|
|
136
|
+
renderListItems,
|
|
137
|
+
itemsList });
|
|
138
|
+
return props.searchable ? (react_1.default.createElement(SearchableList_1.default, Object.assign({}, newProps, { onInputChange: onInputChangeLocal }))) : (react_1.default.createElement(SelectList_1.default, Object.assign({}, newProps)));
|
|
169
139
|
}
|
|
170
140
|
exports.Dropdown = Dropdown;
|
|
171
141
|
Dropdown.defaultProps = defaultProps;
|
|
@@ -1,23 +1,12 @@
|
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
4
|
};
|
|
16
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
|
|
18
|
-
|
|
6
|
+
const utils_1 = require("@rh-support/utils");
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
19
8
|
function DropdownWrapper(props) {
|
|
20
|
-
|
|
9
|
+
const onBlur = (event) => {
|
|
21
10
|
// on ios devices the onBlur event is called before the onClick event, so selecting an item in droponw
|
|
22
11
|
// closes the dropdown without selecting the item
|
|
23
12
|
// this is just a hack to prevent the downshift onBlur method from being called which closes the dropdown
|
|
@@ -25,12 +14,12 @@ function DropdownWrapper(props) {
|
|
|
25
14
|
event.nativeEvent.preventDownshiftDefault = true;
|
|
26
15
|
}
|
|
27
16
|
};
|
|
28
|
-
return (react_1.default.createElement("div", { id:
|
|
29
|
-
props.label && react_1.default.createElement("label",
|
|
17
|
+
return (react_1.default.createElement("div", { id: `${props.id}`, className: `downshift ${props.className} pf-c-select ${props.isOpen ? 'pf-m-expanded' : ''} `, "data-tracking-id": props['data-tracking-id'] ? props['data-tracking-id'] : null },
|
|
18
|
+
props.label && react_1.default.createElement("label", Object.assign({}, props.getLabelProps()), props.label),
|
|
30
19
|
props.toggleMenuComponent,
|
|
31
|
-
react_1.default.createElement("ul",
|
|
20
|
+
react_1.default.createElement("ul", Object.assign({}, props.getMenuProps({
|
|
32
21
|
onBlur: onBlur,
|
|
33
|
-
className:
|
|
22
|
+
className: `downshift-menu pf-c-select__menu ${props.hasTwoColumns ? 'column-selector-menu' : ''} ${props.isOpen ? 'open' : ''}`,
|
|
34
23
|
})), props.children)));
|
|
35
24
|
}
|
|
36
25
|
exports.default = DropdownWrapper;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MultiSelectDropDownList = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
const DropDownList_1 = require("./DropDownList");
|
|
5
|
+
const withMulti_1 = require("./withMulti");
|
|
6
|
+
const MultiSelectDropDownList = withMulti_1.withMulti(DropDownList_1.Dropdown);
|
|
7
7
|
exports.MultiSelectDropDownList = MultiSelectDropDownList;
|
|
@@ -7,6 +7,7 @@ interface IProps<T> extends Omit<IDropdownListProps<T>, 'onChange' | 'onInputCha
|
|
|
7
7
|
onChange: (changes: UseComboboxStateChange<IOption<T>>) => void;
|
|
8
8
|
itemsList: IOption<T>[];
|
|
9
9
|
onInputChange?: (items: IOption<T>[], inputValue: string) => void;
|
|
10
|
+
isPDFExporting?: boolean;
|
|
10
11
|
}
|
|
11
12
|
export default function SearchableList<T>(props: IProps<T>): JSX.Element;
|
|
12
13
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchableList.d.ts","sourceRoot":"","sources":["../../../src/DropDownList/SearchableList.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAEH,sBAAsB,EAEtB,sBAAsB,EAEzB,MAAM,WAAW,CAAC;AAGnB,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE7C,UAAU,MAAM,CAAC,CAAC,CAAE,SAAQ,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAAE,UAAU,GAAG,eAAe,CAAC;IACjF,eAAe,EAAE,CAAC,SAAS,EAAE,sBAAsB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,SAAS,EAAE,CAAC;IACtF,QAAQ,EAAE,CAAC,OAAO,EAAE,sBAAsB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;IAChE,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;IACxB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"SearchableList.d.ts","sourceRoot":"","sources":["../../../src/DropDownList/SearchableList.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAEH,sBAAsB,EAEtB,sBAAsB,EAEzB,MAAM,WAAW,CAAC;AAGnB,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE7C,UAAU,MAAM,CAAC,CAAC,CAAE,SAAQ,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAAE,UAAU,GAAG,eAAe,CAAC;IACjF,eAAe,EAAE,CAAC,SAAS,EAAE,sBAAsB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,SAAS,EAAE,CAAC;IACtF,QAAQ,EAAE,CAAC,OAAO,EAAE,sBAAsB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;IAChE,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;IACxB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IAClE,cAAc,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,eA+IzD"}
|
|
@@ -1,65 +1,53 @@
|
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
4
|
};
|
|
16
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
6
|
+
const caret_down_icon_1 = __importDefault(require("@patternfly/react-icons/dist/js/icons/caret-down-icon"));
|
|
7
|
+
const times_circle_icon_1 = __importDefault(require("@patternfly/react-icons/dist/js/icons/times-circle-icon"));
|
|
8
|
+
const downshift_1 = require("downshift");
|
|
9
|
+
const includes_1 = __importDefault(require("lodash/includes"));
|
|
10
|
+
const isEmpty_1 = __importDefault(require("lodash/isEmpty"));
|
|
11
|
+
const react_1 = __importDefault(require("react"));
|
|
12
|
+
const LoadingIndicator_1 = require("../LoadingIndicator/LoadingIndicator");
|
|
13
|
+
const dropdownUtils_1 = require("./dropdownUtils");
|
|
14
|
+
const DropdownWrapper_1 = __importDefault(require("./DropdownWrapper"));
|
|
26
15
|
function SearchableList(props) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return includes_1.default(labelLC, inputValueLC);
|
|
35
|
-
};
|
|
16
|
+
const doesMatchInput = (inputVal) => (item) => {
|
|
17
|
+
// Should always keep non-searchable, or item with no labels
|
|
18
|
+
if (item.isNotSearchable || item.label === null || item.label === undefined)
|
|
19
|
+
return true;
|
|
20
|
+
const inputValueLC = inputVal ? inputVal.trim().toLowerCase() : '';
|
|
21
|
+
const labelLC = dropdownUtils_1.itemToString(item).trim().toLowerCase();
|
|
22
|
+
return includes_1.default(labelLC, inputValueLC);
|
|
36
23
|
};
|
|
37
|
-
|
|
24
|
+
const onIsOpenChange = (changes) => {
|
|
38
25
|
if (!changes.isOpen && changes.type !== downshift_1.useCombobox.stateChangeTypes.ItemClick) {
|
|
39
26
|
props.onOuterClick && props.onOuterClick(props.selectedItem);
|
|
40
27
|
}
|
|
41
28
|
};
|
|
42
|
-
|
|
43
|
-
|
|
29
|
+
const comboboxStateReducer = (state, actionAndChanges) => {
|
|
30
|
+
const { changes, type } = actionAndChanges;
|
|
44
31
|
switch (type) {
|
|
45
32
|
case downshift_1.useCombobox.stateChangeTypes.InputBlur:
|
|
46
|
-
return
|
|
33
|
+
return Object.assign(Object.assign({}, changes), { inputValue: dropdownUtils_1.itemToString(props.selectedItem) && downshift.inputValue !== dropdownUtils_1.itemToString(props.selectedItem)
|
|
47
34
|
? dropdownUtils_1.itemToString(props.selectedItem)
|
|
48
35
|
: state.inputValue });
|
|
36
|
+
case downshift_1.useCombobox.stateChangeTypes.InputKeyDownEnter:
|
|
37
|
+
return Object.assign(Object.assign({}, changes), { inputValue: state.inputValue });
|
|
49
38
|
default:
|
|
50
39
|
return changes;
|
|
51
40
|
}
|
|
52
41
|
};
|
|
53
|
-
|
|
42
|
+
const downshift = downshift_1.useCombobox({
|
|
54
43
|
selectedItem: props.selectedItem,
|
|
55
44
|
items: props.itemsList,
|
|
56
45
|
onSelectedItemChange: props.onChange,
|
|
57
|
-
labelId: props.id
|
|
46
|
+
labelId: `${props.id}-label`,
|
|
58
47
|
itemToString: dropdownUtils_1.itemToString,
|
|
59
|
-
onIsOpenChange
|
|
60
|
-
onInputValueChange:
|
|
61
|
-
|
|
62
|
-
var newList = props.searchable && (props.filterListOnMenuOpen || isOpen) && !props.isAsyncSearch
|
|
48
|
+
onIsOpenChange,
|
|
49
|
+
onInputValueChange: ({ inputValue, isOpen }) => {
|
|
50
|
+
const newList = props.searchable && (props.filterListOnMenuOpen || isOpen) && !props.isAsyncSearch
|
|
63
51
|
? props.list.filter(doesMatchInput(inputValue))
|
|
64
52
|
: props.list;
|
|
65
53
|
// for async search we want to make sure that we don't call input change unless the user changes
|
|
@@ -68,30 +56,30 @@ function SearchableList(props) {
|
|
|
68
56
|
},
|
|
69
57
|
stateReducer: props.multiSelect ? dropdownUtils_1.multiSelectDropdownStateReducer : comboboxStateReducer,
|
|
70
58
|
});
|
|
71
|
-
|
|
72
|
-
|
|
59
|
+
const { getInputProps, getToggleButtonProps, getMenuProps, getLabelProps, openMenu, isOpen } = downshift;
|
|
60
|
+
const clearSelection = () => (event) => {
|
|
73
61
|
props.onClearSelection && props.onClearSelection();
|
|
74
62
|
// in case of multi select we force input to get cleared on clear button click
|
|
75
63
|
downshift.selectItem(null);
|
|
76
64
|
!isOpen && openMenu();
|
|
77
|
-
};
|
|
78
|
-
|
|
65
|
+
};
|
|
66
|
+
const onInputClick = () => (e) => {
|
|
79
67
|
if (!isOpen) {
|
|
80
68
|
openMenu();
|
|
81
69
|
props.onMenuToggle && props.onMenuToggle();
|
|
82
70
|
}
|
|
83
|
-
};
|
|
84
|
-
|
|
71
|
+
};
|
|
72
|
+
const onInputBlur = () => (e) => {
|
|
85
73
|
props.onInputBlur && props.onInputBlur(e);
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
return (react_1.default.createElement("div",
|
|
74
|
+
};
|
|
75
|
+
const renderSearchableToggleButton = () => {
|
|
76
|
+
return (react_1.default.createElement("div", Object.assign({}, downshift.getComboboxProps({ className: 'pf-c-select__toggle pf-m-typeahead' })),
|
|
89
77
|
react_1.default.createElement("div", { className: "pf-c-select__toggle-wrapper" },
|
|
90
78
|
props.chipGroupComponent,
|
|
91
|
-
react_1.default.createElement("input",
|
|
79
|
+
react_1.default.createElement("input", Object.assign({}, getInputProps({
|
|
92
80
|
placeholder: props.placeholder,
|
|
93
|
-
className:
|
|
94
|
-
id: props.id
|
|
81
|
+
className: `pf-c-form-control pf-c-select__toggle-typeahead`,
|
|
82
|
+
id: `${props.id}-downshift-search`,
|
|
95
83
|
'aria-invalid': props.isInValid,
|
|
96
84
|
'aria-required': props.required,
|
|
97
85
|
required: props.required,
|
|
@@ -100,12 +88,14 @@ function SearchableList(props) {
|
|
|
100
88
|
onBlur: onInputBlur(),
|
|
101
89
|
})))),
|
|
102
90
|
react_1.default.createElement(LoadingIndicator_1.LoadingIndicator, { isInline: true, show: props.isLoadingList }),
|
|
103
|
-
!isEmpty_1.default(downshift.inputValue) &&
|
|
104
|
-
|
|
105
|
-
|
|
91
|
+
!isEmpty_1.default(downshift.inputValue) &&
|
|
92
|
+
!props.isLoadingList &&
|
|
93
|
+
(!props.isExportingPDF ? (react_1.default.createElement("button", { className: "pf-c-button pf-m-plain pf-c-select__toggle-clear", onClick: clearSelection(), "aria-label": "clear selection", type: "button", title: "Clear selection", disabled: props.disabled, "data-tracking-id": `${props['data-tracking-id']}-clear` },
|
|
94
|
+
react_1.default.createElement(times_circle_icon_1.default, null))) : null),
|
|
95
|
+
!props.hideToggleButton && (react_1.default.createElement("button", Object.assign({ type: "button" }, getToggleButtonProps({
|
|
106
96
|
disabled: props.disabled || props.isLoadingList,
|
|
107
97
|
className: 'pf-c-button pf-c-select__toggle-button pf-m-plain',
|
|
108
|
-
onClick: props.onMenuToggle ?
|
|
98
|
+
onClick: props.onMenuToggle ? () => props.onMenuToggle() : dropdownUtils_1.noop,
|
|
109
99
|
})),
|
|
110
100
|
react_1.default.createElement(caret_down_icon_1.default, null)))));
|
|
111
101
|
};
|
|
@@ -1,45 +1,34 @@
|
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
4
|
};
|
|
16
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
6
|
+
const caret_down_icon_1 = __importDefault(require("@patternfly/react-icons/dist/js/icons/caret-down-icon"));
|
|
7
|
+
const downshift_1 = require("downshift");
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
const LoadingIndicator_1 = require("../LoadingIndicator/LoadingIndicator");
|
|
10
|
+
const dropdownUtils_1 = require("./dropdownUtils");
|
|
11
|
+
const DropdownWrapper_1 = __importDefault(require("./DropdownWrapper"));
|
|
23
12
|
function SelectList(props) {
|
|
24
|
-
|
|
13
|
+
const onIsOpenChange = (changes) => {
|
|
25
14
|
if (!changes.isOpen && changes.type !== downshift_1.useSelect.stateChangeTypes.ItemClick) {
|
|
26
15
|
props.onOuterClick && props.onOuterClick(props.selectedItem);
|
|
27
16
|
}
|
|
28
17
|
};
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
18
|
+
const downshift = downshift_1.useSelect(Object.assign({ selectedItem: props.selectedItem, items: props.list, onIsOpenChange, onSelectedItemChange: props.onChange, labelId: `${props.id}-label`, itemToString: dropdownUtils_1.itemToString }, (props.multiSelect && { stateReducer: dropdownUtils_1.multiSelectDropdownStateReducer })));
|
|
19
|
+
const { getToggleButtonProps, getLabelProps, getMenuProps, isOpen } = downshift;
|
|
20
|
+
const renderToggleButton = () => {
|
|
32
21
|
var _a;
|
|
33
|
-
return (react_1.default.createElement("button",
|
|
34
|
-
id: props.id
|
|
35
|
-
className:
|
|
22
|
+
return (react_1.default.createElement("button", Object.assign({ type: "button" }, getToggleButtonProps({
|
|
23
|
+
id: `${props.id}-toggle`,
|
|
24
|
+
className: `pf-c-select__toggle ${props.isInValid ? 'form-invalid' : ''}`,
|
|
36
25
|
disabled: props.disabled || props.isLoadingList,
|
|
37
|
-
'aria-label':
|
|
26
|
+
'aria-label': `${isOpen ? 'Close ' + props.title : 'Open ' + props.title}`,
|
|
38
27
|
'aria-invalid': props.isInValid,
|
|
39
28
|
name: props.name,
|
|
40
29
|
title: dropdownUtils_1.itemToString(props.selectedItem) || props.placeholder,
|
|
41
30
|
'data-tracking-id': (_a = props['data-tracking-id']) !== null && _a !== void 0 ? _a : '',
|
|
42
|
-
onClick: props.onMenuToggle ?
|
|
31
|
+
onClick: props.onMenuToggle ? () => props.onMenuToggle() : dropdownUtils_1.noop,
|
|
43
32
|
})),
|
|
44
33
|
react_1.default.createElement("div", { className: "pf-c-select__toggle-wrapper" },
|
|
45
34
|
react_1.default.createElement("span", { className: "pf-c-select__toggle-text" }, dropdownUtils_1.itemToString(props.selectedItem) || (react_1.default.createElement("span", { className: "pf-c-select__placeholder-text" }, props.placeholder)))),
|
|
@@ -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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
3
|
if (k2 === undefined) k2 = k;
|
|
15
4
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
@@ -45,13 +34,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
45
34
|
};
|
|
46
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
47
36
|
exports.withAsync = exports.useAsync = void 0;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
37
|
+
const debounce_1 = __importDefault(require("lodash/debounce"));
|
|
38
|
+
const react_1 = __importStar(require("react"));
|
|
39
|
+
const hooks_1 = require("../hooks");
|
|
40
|
+
const usePrevious_1 = require("../hooks/usePrevious");
|
|
52
41
|
// Most of the code credit goes to
|
|
53
42
|
// https://github.com/ericgio/react-bootstrap-typeahead/blob/master/src/behaviors/async.js
|
|
54
|
-
|
|
43
|
+
const defaultProps = {
|
|
55
44
|
delay: 200,
|
|
56
45
|
minLength: 2,
|
|
57
46
|
promptText: '',
|
|
@@ -59,13 +48,13 @@ var defaultProps = {
|
|
|
59
48
|
useCache: false,
|
|
60
49
|
};
|
|
61
50
|
function useAsync(props) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
51
|
+
const { delay, isLoadingList, minLength, onInputChange, onSearch, useCache, list, onInputBlur, emptyListLabel, onClearSelection, suggestedItems } = props, otherProps = __rest(props, ["delay", "isLoadingList", "minLength", "onInputChange", "onSearch", "useCache", "list", "onInputBlur", "emptyListLabel", "onClearSelection", "suggestedItems"]);
|
|
52
|
+
const { getFromCache, setInCache, clearCache } = hooks_1.useLRUCache(25);
|
|
53
|
+
const handleSearchDebouncedRef = react_1.useRef();
|
|
54
|
+
const queryRef = react_1.useRef('');
|
|
55
|
+
const forceUpdate = hooks_1.useForceUpdate();
|
|
56
|
+
const prevProps = usePrevious_1.usePrevious(props);
|
|
57
|
+
const handleSearch = react_1.useCallback((query) => {
|
|
69
58
|
queryRef.current = query;
|
|
70
59
|
if (!query || (minLength && query.length < minLength)) {
|
|
71
60
|
return;
|
|
@@ -82,33 +71,33 @@ function useAsync(props) {
|
|
|
82
71
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
83
72
|
[forceUpdate, minLength, onSearch, useCache]);
|
|
84
73
|
// Set the debounced search function.
|
|
85
|
-
react_1.useEffect(
|
|
74
|
+
react_1.useEffect(() => {
|
|
86
75
|
handleSearchDebouncedRef.current = debounce_1.default(handleSearch, delay);
|
|
87
|
-
return
|
|
76
|
+
return () => {
|
|
88
77
|
handleSearchDebouncedRef.current && handleSearchDebouncedRef.current.cancel();
|
|
89
78
|
};
|
|
90
79
|
}, [delay, handleSearch]);
|
|
91
|
-
react_1.useEffect(
|
|
80
|
+
react_1.useEffect(() => {
|
|
92
81
|
// Ensure that we've gone from a loading to a completed state. Otherwise
|
|
93
82
|
// an empty response could get cached if the component updates during the
|
|
94
83
|
// request (eg: if the parent re-renders for some reason).
|
|
95
84
|
// NOTE: There is a limitation that empty responses will not be cached.
|
|
96
|
-
|
|
85
|
+
const listToCache = list.filter((item) => !item.isNotSearchable);
|
|
97
86
|
if (!isLoadingList && useCache && queryRef.current && (listToCache || []).length > 0) {
|
|
98
87
|
setInCache(queryRef.current, list);
|
|
99
88
|
}
|
|
100
89
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
101
90
|
}, [list, isLoadingList, useCache]);
|
|
102
|
-
react_1.useEffect(
|
|
91
|
+
react_1.useEffect(() => {
|
|
103
92
|
if (prevProps && prevProps.useCache && !useCache) {
|
|
104
93
|
clearCache();
|
|
105
94
|
}
|
|
106
|
-
return
|
|
95
|
+
return () => {
|
|
107
96
|
clearCache();
|
|
108
97
|
};
|
|
109
98
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
110
99
|
}, [useCache]);
|
|
111
|
-
|
|
100
|
+
const getEmptyLabel = () => {
|
|
112
101
|
if (!queryRef.current.length) {
|
|
113
102
|
return props.promptText;
|
|
114
103
|
}
|
|
@@ -117,19 +106,20 @@ function useAsync(props) {
|
|
|
117
106
|
}
|
|
118
107
|
return emptyListLabel;
|
|
119
108
|
};
|
|
120
|
-
|
|
109
|
+
const handleInputBlur = (e) => {
|
|
121
110
|
onInputBlur && onInputBlur(e);
|
|
122
111
|
};
|
|
123
|
-
|
|
112
|
+
const handleClearSelection = () => {
|
|
124
113
|
onClearSelection && onClearSelection();
|
|
125
114
|
queryRef.current = '';
|
|
126
115
|
};
|
|
127
|
-
|
|
116
|
+
const handleInputChange = react_1.useCallback((query) => {
|
|
128
117
|
onInputChange && onInputChange(query);
|
|
129
118
|
handleSearchDebouncedRef.current && handleSearchDebouncedRef.current(query);
|
|
130
119
|
}, [onInputChange]);
|
|
131
|
-
|
|
132
|
-
return
|
|
120
|
+
const cachedQuery = getFromCache(queryRef.current);
|
|
121
|
+
return Object.assign(Object.assign({}, otherProps), { isLoadingList,
|
|
122
|
+
minLength, onInputChange: handleInputChange, emptyListLabel: getEmptyLabel(), list: useCache && cachedQuery
|
|
133
123
|
? cachedQuery
|
|
134
124
|
: !queryRef.current
|
|
135
125
|
? (suggestedItems || []).length > 0
|
|
@@ -139,9 +129,9 @@ function useAsync(props) {
|
|
|
139
129
|
}
|
|
140
130
|
exports.useAsync = useAsync;
|
|
141
131
|
function withAsync(WrappedComponent) {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
AsyncDropdown.displayName =
|
|
132
|
+
const AsyncDropdown = (props) => (react_1.default.createElement(WrappedComponent, Object.assign({}, useAsync(props))));
|
|
133
|
+
const displayName = WrappedComponent.displayName || WrappedComponent.name || 'Component';
|
|
134
|
+
AsyncDropdown.displayName = `withAsync${displayName}`;
|
|
145
135
|
AsyncDropdown.defaultProps = defaultProps;
|
|
146
136
|
return AsyncDropdown;
|
|
147
137
|
}
|