@rh-support/react-context 2.1.27 → 2.1.29
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccountSelectorInternal.d.ts","sourceRoot":"","sources":["../../../../src/components/AccountSelector/AccountSelectorInternal.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,wCAAwC,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4CAA4C,CAAC;
|
|
1
|
+
{"version":3,"file":"AccountSelectorInternal.d.ts","sourceRoot":"","sources":["../../../../src/components/AccountSelector/AccountSelectorInternal.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,wCAAwC,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4CAA4C,CAAC;AAehF,OAAO,EAAE,kBAAkB,EAA8B,MAAM,wBAAwB,CAAC;AAQxF,UAAU,MAAO,SAAQ,kBAAkB,CAAC,QAAQ,CAAC;IACjD,gBAAgB,CAAC,EAAE,QAAQ,EAAE,CAAC;IAC9B,eAAe,CAAC,EAAE,QAAQ,EAAE,CAAC;IAC7B,kBAAkB,CAAC,EAAE,QAAQ,EAAE,CAAC;IAChC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,GAAG,CAAC;IACzC,iBAAiB,CAAC,EAAE,kBAAkB,CAAC;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,6BAA6B,CAAC,EAAE,OAAO,CAAC;CAC3C;AAkCD,iBAAS,uBAAuB,CAAC,KAAK,EAAE,MAAM,eAmS7C;kBAnSQ,uBAAuB;;;AAsShC,OAAO,EAAE,uBAAuB,EAAE,CAAC"}
|
|
@@ -8,12 +8,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { accounts } from '@cee-eng/hydrajs';
|
|
11
|
-
import { Button, Flex, FlexItem, MenuToggle, Select,
|
|
11
|
+
import { Button, Flex, FlexItem, MenuToggle, Select, SelectOption, TextInputGroup, TextInputGroupMain, TextInputGroupUtilities, } from '@patternfly/react-core';
|
|
12
12
|
import InfoCircleIcon from '@patternfly/react-icons/dist/js/icons/info-circle-icon';
|
|
13
13
|
import TimesCircleIcon from '@patternfly/react-icons/dist/js/icons/times-circle-icon';
|
|
14
14
|
import { LoadingIndicator, useFetch } from '@rh-support/components';
|
|
15
15
|
import { isUndefined } from 'lodash';
|
|
16
16
|
import isEmpty from 'lodash/isEmpty';
|
|
17
|
+
import isNull from 'lodash/isNull';
|
|
17
18
|
import uniqBy from 'lodash/uniqBy';
|
|
18
19
|
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
19
20
|
import { Trans, useTranslation } from 'react-i18next';
|
|
@@ -80,23 +81,33 @@ function AccountSelectorInternal(props) {
|
|
|
80
81
|
setResultSize((pre) => Math.min(pre + pageSize, items.length));
|
|
81
82
|
setIsOpen(true);
|
|
82
83
|
};
|
|
83
|
-
const dropdownOptions = useMemo(() =>
|
|
84
|
-
|
|
85
|
-
React.createElement(
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
84
|
+
const dropdownOptions = useMemo(() => {
|
|
85
|
+
if (isFetching && isEmpty(itemsToRender)) {
|
|
86
|
+
return (React.createElement(SelectOption, { key: "searching" },
|
|
87
|
+
React.createElement(Trans, null, "Searching...")));
|
|
88
|
+
}
|
|
89
|
+
if (!isEmpty(query) && isEmpty(itemsToRender)) {
|
|
90
|
+
return (React.createElement(SelectOption, { key: "no-results" },
|
|
91
|
+
React.createElement(Trans, null, "No results found")));
|
|
92
|
+
}
|
|
93
|
+
return [
|
|
94
|
+
...itemsToRender.map((item, index) => (React.createElement(SelectOption, { isFocused: focusedItemIndex === index, key: index, value: item, hasCheckbox: props.multiple, isSelected: selectedItems.some((account) => item.accountNumber === account.accountNumber) }, props.restrictedOnSubscriptionAbuse && item.subscriptionAbuse ? (React.createElement(Flex, { justifyContent: { default: 'justifyContentSpaceBetween' } },
|
|
95
|
+
React.createElement(FlexItem, { className: "form-instructions form-invalid" }, getDisplayName(item)),
|
|
96
|
+
React.createElement(FlexItem, { className: "form-instructions form-invalid pf-v5-u-text-nowrap pf-v5-u-pr-sm" },
|
|
97
|
+
React.createElement(InfoCircleIcon, null),
|
|
98
|
+
" ",
|
|
99
|
+
React.createElement(Trans, null, "Subscription abuse")))) : (React.createElement("span", null, getDisplayName(item)))))),
|
|
100
|
+
...(resultSize < items.length
|
|
101
|
+
? [
|
|
102
|
+
React.createElement("div", { className: "pf-v5-c-divider", role: "separator", key: "separator" }),
|
|
103
|
+
React.createElement(SelectOption, { key: 'diplay-more-option', onClick: onDisplayMoreClick, value: 'display-more' },
|
|
104
|
+
React.createElement(Flex, { justifyContent: { default: 'justifyContentCenter' } },
|
|
105
|
+
React.createElement(FlexItem, { className: '"pf-v5-c-button pf-m-link pf-m-inline' },
|
|
106
|
+
React.createElement(Trans, null, "Display additional results")))),
|
|
107
|
+
]
|
|
108
|
+
: []),
|
|
109
|
+
];
|
|
110
|
+
},
|
|
100
111
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
101
112
|
[items, bookmarkedAccountsDeduped]);
|
|
102
113
|
const fetchAccounts = (query) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -179,7 +190,7 @@ function AccountSelectorInternal(props) {
|
|
|
179
190
|
(_a = textInputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
180
191
|
};
|
|
181
192
|
const onSelect = (selection) => {
|
|
182
|
-
if (selection === 'display-more' || isUndefined(selection))
|
|
193
|
+
if (selection === 'display-more' || isUndefined(selection) || isNull(selection))
|
|
183
194
|
return;
|
|
184
195
|
props.multiple ? onMultiAccountSelection(selection) : onSingleAccountSelection(selection);
|
|
185
196
|
};
|
|
@@ -233,8 +244,7 @@ function AccountSelectorInternal(props) {
|
|
|
233
244
|
React.createElement(TextInputGroup, { isPlain: true, innerRef: inputGroupRef },
|
|
234
245
|
React.createElement(TextInputGroupMain, { value: query, onClick: onToggleClick, onKeyDown: onInputKeyDown, onChange: onFilter, placeholder: t(props.placeholder || ''), isExpanded: isOpen, innerRef: textInputRef, "aria-controls": `select${props.multiple ? '-multi' : ''}-typeahead-listbox` }),
|
|
235
246
|
React.createElement(TextInputGroupUtilities, null, !isEmpty(query) && (React.createElement(Button, { variant: "plain", onClick: onClearSelection, isDisabled: isFetching, "aria-label": t('Clear') }, isFetching ? React.createElement(LoadingIndicator, { show: true, size: "sm" }) : React.createElement(TimesCircleIcon, { "aria-hidden": true })))))));
|
|
236
|
-
return (React.createElement(Select, { "data-tracking-id": "account-selector-dropdown", isOpen: isOpen, onOpenChange: () => setIsOpen(false), id: props.id, toggle: toggle, popperProps: { direction: 'down', enableFlip: false }, onSelect: (_e, v) => onSelect(v), selected: selectedItems, isScrollable: true },
|
|
237
|
-
React.createElement(SelectList, null, dropdownOptions)));
|
|
247
|
+
return (React.createElement(Select, { "data-tracking-id": "account-selector-dropdown", isOpen: isOpen, onOpenChange: () => setIsOpen(false), id: props.id, toggle: toggle, popperProps: { direction: 'down', enableFlip: false }, onSelect: (_e, v) => onSelect(v), selected: selectedItems, isScrollable: true }, dropdownOptions));
|
|
238
248
|
}
|
|
239
249
|
AccountSelectorInternal.defaultProps = defaultProps;
|
|
240
250
|
export { AccountSelectorInternal };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rh-support/react-context",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.29",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -40,10 +40,10 @@
|
|
|
40
40
|
"@cee-eng/hydrajs": "4.16.33",
|
|
41
41
|
"@patternfly/react-core": "5.1.1",
|
|
42
42
|
"@patternfly/react-icons": "5.1.1",
|
|
43
|
-
"@rh-support/components": "2.1.
|
|
43
|
+
"@rh-support/components": "2.1.26",
|
|
44
44
|
"@rh-support/types": "2.0.2",
|
|
45
|
-
"@rh-support/user-permissions": "2.1.
|
|
46
|
-
"@rh-support/utils": "2.1.
|
|
45
|
+
"@rh-support/user-permissions": "2.1.19",
|
|
46
|
+
"@rh-support/utils": "2.1.12",
|
|
47
47
|
"i18next": "^19.0.1",
|
|
48
48
|
"localforage": "^1.10.0",
|
|
49
49
|
"lodash": "^4.17.21",
|
|
@@ -85,5 +85,5 @@
|
|
|
85
85
|
"defaults and supports es6-module",
|
|
86
86
|
"maintained node versions"
|
|
87
87
|
],
|
|
88
|
-
"gitHead": "
|
|
88
|
+
"gitHead": "ed9cba460bdbf0d0104fe6e8f21a0ca554bdaee8"
|
|
89
89
|
}
|