@rh-support/components 2.5.1 → 2.5.3
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/esm/Functional/CaseContactsSelectorExternal.d.ts +12 -7
- package/lib/esm/Functional/CaseContactsSelectorExternal.d.ts.map +1 -1
- package/lib/esm/Functional/CaseContactsSelectorExternal.js +67 -60
- package/lib/esm/OwnerTypeaheadDropdown/OwnerTypeaheadDropdown.d.ts +17 -0
- package/lib/esm/OwnerTypeaheadDropdown/OwnerTypeaheadDropdown.d.ts.map +1 -0
- package/lib/esm/OwnerTypeaheadDropdown/OwnerTypeaheadDropdown.js +98 -0
- package/lib/esm/OwnerTypeaheadDropdown/index.d.ts +2 -0
- package/lib/esm/OwnerTypeaheadDropdown/index.d.ts.map +1 -0
- package/lib/esm/OwnerTypeaheadDropdown/index.js +1 -0
- package/lib/esm/SingleSelectDropdown/SingleSelectDropdown.d.ts +27 -0
- package/lib/esm/SingleSelectDropdown/SingleSelectDropdown.d.ts.map +1 -0
- package/lib/esm/SingleSelectDropdown/SingleSelectDropdown.js +26 -0
- package/lib/esm/SingleSelectDropdown/index.d.ts +2 -0
- package/lib/esm/SingleSelectDropdown/index.d.ts.map +1 -0
- package/lib/esm/SingleSelectDropdown/index.js +1 -0
- package/lib/esm/TypeaheadDropdown/TypeaheadDropdown.d.ts +39 -0
- package/lib/esm/TypeaheadDropdown/TypeaheadDropdown.d.ts.map +1 -0
- package/lib/esm/TypeaheadDropdown/TypeaheadDropdown.js +218 -0
- package/lib/esm/TypeaheadDropdown/index.d.ts +2 -0
- package/lib/esm/TypeaheadDropdown/index.d.ts.map +1 -0
- package/lib/esm/TypeaheadDropdown/index.js +1 -0
- package/lib/esm/hooks/index.d.ts +2 -0
- package/lib/esm/hooks/index.d.ts.map +1 -1
- package/lib/esm/hooks/index.js +2 -0
- package/lib/esm/hooks/usePatternFlySingleSelectToggle.d.ts +16 -0
- package/lib/esm/hooks/usePatternFlySingleSelectToggle.d.ts.map +1 -0
- package/lib/esm/hooks/usePatternFlySingleSelectToggle.js +17 -0
- package/lib/esm/hooks/useProgressiveLoading.d.ts +10 -0
- package/lib/esm/hooks/useProgressiveLoading.d.ts.map +1 -0
- package/lib/esm/hooks/useProgressiveLoading.js +33 -0
- package/lib/esm/hooks/useSelectKeyboardNavigator.d.ts +9 -1
- package/lib/esm/hooks/useSelectKeyboardNavigator.d.ts.map +1 -1
- package/lib/esm/hooks/useSelectKeyboardNavigator.js +82 -3
- package/lib/esm/index.d.ts +2 -1
- package/lib/esm/index.d.ts.map +1 -1
- package/lib/esm/index.js +2 -1
- package/package.json +6 -8
- package/lib/esm/DropDownList/AsyncDropDownList.d.ts +0 -6
- package/lib/esm/DropDownList/AsyncDropDownList.d.ts.map +0 -1
- package/lib/esm/DropDownList/AsyncDropDownList.js +0 -6
- package/lib/esm/DropDownList/DropDownList.d.ts +0 -9
- package/lib/esm/DropDownList/DropDownList.d.ts.map +0 -1
- package/lib/esm/DropDownList/DropDownList.js +0 -116
- package/lib/esm/DropDownList/DropdownWrapper.d.ts +0 -16
- package/lib/esm/DropDownList/DropdownWrapper.d.ts.map +0 -1
- package/lib/esm/DropDownList/DropdownWrapper.js +0 -19
- package/lib/esm/DropDownList/MultiSelectDropdownList.d.ts +0 -4
- package/lib/esm/DropDownList/MultiSelectDropdownList.d.ts.map +0 -1
- package/lib/esm/DropDownList/MultiSelectDropdownList.js +0 -4
- package/lib/esm/DropDownList/Readme.md +0 -114
- package/lib/esm/DropDownList/SearchableList.d.ts +0 -14
- package/lib/esm/DropDownList/SearchableList.d.ts.map +0 -1
- package/lib/esm/DropDownList/SearchableList.js +0 -98
- package/lib/esm/DropDownList/SelectList.d.ts +0 -11
- package/lib/esm/DropDownList/SelectList.d.ts.map +0 -1
- package/lib/esm/DropDownList/SelectList.js +0 -35
- package/lib/esm/DropDownList/async.d.ts +0 -9
- package/lib/esm/DropDownList/async.d.ts.map +0 -1
- package/lib/esm/DropDownList/async.js +0 -111
- package/lib/esm/DropDownList/dropdownList.css +0 -59
- package/lib/esm/DropDownList/dropdownUtils.d.ts +0 -5
- package/lib/esm/DropDownList/dropdownUtils.d.ts.map +0 -1
- package/lib/esm/DropDownList/dropdownUtils.js +0 -23
- package/lib/esm/DropDownList/index.d.ts +0 -4
- package/lib/esm/DropDownList/index.d.ts.map +0 -1
- package/lib/esm/DropDownList/index.js +0 -3
- package/lib/esm/DropDownList/types.d.ts +0 -53
- package/lib/esm/DropDownList/types.d.ts.map +0 -1
- package/lib/esm/DropDownList/types.js +0 -1
- package/lib/esm/DropDownList/withMulti.d.ts +0 -5
- package/lib/esm/DropDownList/withMulti.d.ts.map +0 -1
- package/lib/esm/DropDownList/withMulti.js +0 -46
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { IOption } from '@rh-support/types/shared';
|
|
2
|
-
export declare function itemToString<T>(item: IOption<T>): string;
|
|
3
|
-
export declare const noop: () => void;
|
|
4
|
-
export declare const multiSelectDropdownStateReducer: (state: any, actionAndChanges: any) => any;
|
|
5
|
-
//# sourceMappingURL=dropdownUtils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dropdownUtils.d.ts","sourceRoot":"","sources":["../../../src/DropDownList/dropdownUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAGnD,wBAAgB,YAAY,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,MAAM,CAExD;AAED,eAAO,MAAM,IAAI,YAAW,CAAC;AAE7B,eAAO,MAAM,+BAA+B,4CAoC3C,CAAC"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { useCombobox, useSelect } from 'downshift';
|
|
2
|
-
export function itemToString(item) {
|
|
3
|
-
return item ? item.label : '';
|
|
4
|
-
}
|
|
5
|
-
export const noop = () => { };
|
|
6
|
-
export const multiSelectDropdownStateReducer = (state, actionAndChanges) => {
|
|
7
|
-
const { changes, type } = actionAndChanges;
|
|
8
|
-
switch (type) {
|
|
9
|
-
case useSelect.stateChangeTypes.MenuKeyDownSpaceButton:
|
|
10
|
-
return Object.assign(Object.assign({}, changes), { isOpen: true, highlightedIndex: state.highlightedIndex });
|
|
11
|
-
case useSelect.stateChangeTypes.MenuKeyDownEnter:
|
|
12
|
-
case useSelect.stateChangeTypes.ItemClick:
|
|
13
|
-
return Object.assign(Object.assign({}, changes), { isOpen: true, highlightedIndex: state.highlightedIndex, inputValue: '' });
|
|
14
|
-
case useCombobox.stateChangeTypes.InputKeyDownEnter:
|
|
15
|
-
return Object.assign(Object.assign({}, changes), { inputValue: state.inputValue });
|
|
16
|
-
case useCombobox.stateChangeTypes.ItemClick:
|
|
17
|
-
return Object.assign(Object.assign({}, changes), { isOpen: true, highlightedIndex: state.highlightedIndex, inputValue: '' });
|
|
18
|
-
case useCombobox.stateChangeTypes.InputBlur:
|
|
19
|
-
return Object.assign({}, changes);
|
|
20
|
-
default:
|
|
21
|
-
return changes;
|
|
22
|
-
}
|
|
23
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/DropDownList/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC"}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { IDClassNameProps, IOption } from '@rh-support/types/shared';
|
|
2
|
-
export interface IDropdownListProps<T> extends IDClassNameProps {
|
|
3
|
-
list: Array<IOption<T>>;
|
|
4
|
-
selectedItem: IOption<T>;
|
|
5
|
-
placeholder?: string;
|
|
6
|
-
title: string;
|
|
7
|
-
disabled?: boolean;
|
|
8
|
-
isLoadingList?: boolean;
|
|
9
|
-
searchable?: boolean;
|
|
10
|
-
isInValid?: boolean;
|
|
11
|
-
required?: boolean;
|
|
12
|
-
name?: string;
|
|
13
|
-
onOuterClick?: (selectedItem: IOption<T>) => void;
|
|
14
|
-
onClearSelection?: () => void;
|
|
15
|
-
onChange: (selection: IOption<T>) => any;
|
|
16
|
-
onMenuToggle?: () => void;
|
|
17
|
-
'data-tracking-id'?: string;
|
|
18
|
-
filterListOnMenuOpen?: boolean;
|
|
19
|
-
onInputChange?: (query: string) => void;
|
|
20
|
-
paginate?: boolean;
|
|
21
|
-
maxResults?: number;
|
|
22
|
-
onPaginate?: (resultShown: number, inputVal: string, e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
23
|
-
emptyListLabel?: string;
|
|
24
|
-
onInputBlur?: (e: React.FocusEvent<HTMLInputElement>) => void;
|
|
25
|
-
paginationBtnText?: string;
|
|
26
|
-
isAsyncSearch?: boolean;
|
|
27
|
-
multiSelect?: boolean;
|
|
28
|
-
isSelectedItem?: (item: IOption<T>) => boolean;
|
|
29
|
-
label?: string | React.ReactNode;
|
|
30
|
-
hasTwoColumns?: boolean;
|
|
31
|
-
chipGroupComponent?: React.ReactNode;
|
|
32
|
-
hideToggleButton?: boolean;
|
|
33
|
-
isExportingPDF?: boolean;
|
|
34
|
-
}
|
|
35
|
-
export type IMultiSelectOnlyProps<T> = {
|
|
36
|
-
selectedItems?: Array<IOption<T>>;
|
|
37
|
-
onChange: (selectedItems: IOption<T>[]) => any;
|
|
38
|
-
onOuterClick?: (selectedItems: IOption<T>[]) => any;
|
|
39
|
-
};
|
|
40
|
-
export type IDropdownListBasePropsForMultiSelect<T> = Omit<IDropdownListProps<T>, 'onChange' | 'onOuterClick' | 'multiSelect' | 'selectedItem' | 'isSelectedItem' | 'isAsyncSearch'>;
|
|
41
|
-
export type MultiSelectDropdownProps<T> = IDropdownListBasePropsForMultiSelect<T> & IMultiSelectOnlyProps<T>;
|
|
42
|
-
export type IAsyncOnlyProps<T> = {
|
|
43
|
-
delay?: number;
|
|
44
|
-
minLength?: number;
|
|
45
|
-
onSearch: (string: any) => void;
|
|
46
|
-
promptText?: string;
|
|
47
|
-
searchText?: string;
|
|
48
|
-
useCache?: boolean;
|
|
49
|
-
suggestedItems?: Array<IOption<T>>;
|
|
50
|
-
};
|
|
51
|
-
export type IDropdownListBasePropsForAsync<T> = Omit<IDropdownListProps<T>, 'isAsyncSearch' | 'searchable' | 'multiSelect'> | MultiSelectDropdownProps<T>;
|
|
52
|
-
export type AsyncDropdownProps<T> = Omit<IDropdownListProps<T>, 'isAsyncSearch' | 'searchable' | 'multiSelect'> & IAsyncOnlyProps<T>;
|
|
53
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/DropDownList/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAIrE,MAAM,WAAW,kBAAkB,CAAC,CAAC,CAAE,SAAQ,gBAAgB;IAC3D,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IACxB,YAAY,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;IAClD,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC9B,QAAQ,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC;IACzC,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,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D,CAAC;AAEF,MAAM,MAAM,oCAAoC,CAAC,CAAC,IAAI,IAAI,CACtD,kBAAkB,CAAC,CAAC,CAAC,EACrB,UAAU,GAAG,cAAc,GAAG,aAAa,GAAG,cAAc,GAAG,gBAAgB,GAAG,eAAe,CACpG,CAAC;AAEF,MAAM,MAAM,wBAAwB,CAAC,CAAC,IAAI,oCAAoC,CAAC,CAAC,CAAC,GAAG,qBAAqB,CAAC,CAAC,CAAC,CAAC;AAE7G,MAAM,MAAM,eAAe,CAAC,CAAC,IAAI;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,CAAC,MAAM,KAAA,KAAK,IAAI,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,cAAc,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,8BAA8B,CAAC,CAAC,IACtC,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAAE,eAAe,GAAG,YAAY,GAAG,aAAa,CAAC,GAC3E,wBAAwB,CAAC,CAAC,CAAC,CAAC;AAElC,MAAM,MAAM,kBAAkB,CAAC,CAAC,IAAI,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAAE,eAAe,GAAG,YAAY,GAAG,aAAa,CAAC,GAC3G,eAAe,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { IDropdownListBasePropsForMultiSelect, IMultiSelectOnlyProps } from './types';
|
|
3
|
-
export declare function useMulti<OptionType, DropdownPropsType extends IDropdownListBasePropsForMultiSelect<OptionType>>(props: DropdownPropsType & IMultiSelectOnlyProps<OptionType>): DropdownPropsType;
|
|
4
|
-
export declare function withMulti<DropdownPropsType extends IDropdownListBasePropsForMultiSelect<OptionType>, OptionType>(WrappedComponent: React.ComponentType<DropdownPropsType>): React.ForwardRefExoticComponent<React.RefAttributes<unknown>>;
|
|
5
|
-
//# sourceMappingURL=withMulti.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"withMulti.d.ts","sourceRoot":"","sources":["../../../src/DropDownList/withMulti.tsx"],"names":[],"mappings":"AACA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAG1C,OAAO,EAAE,oCAAoC,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAMtF,wBAAgB,QAAQ,CAAC,UAAU,EAAE,iBAAiB,SAAS,oCAAoC,CAAC,UAAU,CAAC,EAC3G,KAAK,EAAE,iBAAiB,GAAG,qBAAqB,CAAC,UAAU,CAAC,GAC7D,iBAAiB,CA8BnB;AAED,wBAAgB,SAAS,CAAC,iBAAiB,SAAS,oCAAoC,CAAC,UAAU,CAAC,EAAE,UAAU,EAC5G,gBAAgB,EAAE,KAAK,CAAC,aAAa,CAAC,iBAAiB,CAAC,iEAa3D"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
import React, { forwardRef } from 'react';
|
|
13
|
-
import { itemToString } from './dropdownUtils';
|
|
14
|
-
const defaultProps = {
|
|
15
|
-
selectedItems: [],
|
|
16
|
-
};
|
|
17
|
-
export function useMulti(props) {
|
|
18
|
-
const { selectedItems, onChange } = props, rest = __rest(props, ["selectedItems", "onChange"]);
|
|
19
|
-
const onChangeLocal = (selectedItem) => {
|
|
20
|
-
let newItems = (selectedItems || []).slice();
|
|
21
|
-
const selectedItemsLabel = props.selectedItems.filter((item) => !item.isNotSelectable).map(itemToString);
|
|
22
|
-
const selectedItemLabel = itemToString(selectedItem);
|
|
23
|
-
if (selectedItemsLabel.includes(selectedItemLabel)) {
|
|
24
|
-
newItems = selectedItems.filter((i) => itemToString(i) !== itemToString(selectedItem));
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
newItems.push(selectedItem);
|
|
28
|
-
}
|
|
29
|
-
props.onChange && props.onChange(newItems);
|
|
30
|
-
};
|
|
31
|
-
const onOuterClickLocal = () => {
|
|
32
|
-
props.onOuterClick && props.onOuterClick(props.selectedItems);
|
|
33
|
-
};
|
|
34
|
-
const isSelectedItemLocal = (item) => {
|
|
35
|
-
return !item.isNotSelectable && props.selectedItems.map(itemToString).includes(itemToString(item));
|
|
36
|
-
};
|
|
37
|
-
return Object.assign(Object.assign({}, rest), { multiSelect: true, onChange: onChangeLocal, selectedItem: null, onOuterClick: onOuterClickLocal, isSelectedItem: isSelectedItemLocal });
|
|
38
|
-
}
|
|
39
|
-
export function withMulti(WrappedComponent) {
|
|
40
|
-
// @ts-ignore
|
|
41
|
-
const MultiSelectDropdown = forwardRef((props, ref) => (React.createElement(WrappedComponent, Object.assign({}, useMulti(props), { ref: ref }))));
|
|
42
|
-
const displayName = WrappedComponent.displayName || WrappedComponent.name || 'Component';
|
|
43
|
-
MultiSelectDropdown.displayName = `withMulti${displayName}`;
|
|
44
|
-
MultiSelectDropdown.defaultProps = defaultProps;
|
|
45
|
-
return MultiSelectDropdown;
|
|
46
|
-
}
|