@rh-support/components 2.1.29 → 2.4.10-beta.6
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/README.md +0 -2
- package/lib/cjs/CustomTextInput/CustomTextInput.d.ts +0 -2
- package/lib/cjs/CustomTextInput/CustomTextInput.d.ts.map +1 -1
- package/lib/cjs/CustomTextInput/CustomTextInput.js +2 -4
- package/lib/cjs/DropDownList/DropDownList.js +10 -10
- package/lib/cjs/DropDownList/DropdownWrapper.js +2 -2
- package/lib/cjs/DropDownList/SearchableList.js +5 -5
- package/lib/cjs/DropDownList/SelectList.js +4 -4
- package/lib/cjs/DropDownList/dropdownList.css +5 -10
- package/lib/cjs/ErrorBoundary/ErrorBoundaryFallbackComponent.d.ts.map +1 -1
- package/lib/cjs/ErrorBoundary/ErrorBoundaryFallbackComponent.js +3 -2
- package/lib/cjs/InlineEdit/NewInlineEdit.js +1 -1
- package/lib/cjs/InlineEdit/newInlineEdit.css +3 -3
- package/lib/cjs/LoadingDots/LoadingDots.js +1 -1
- package/lib/cjs/MarkdownEditor/MarkdownEditor.d.ts.map +1 -1
- package/lib/cjs/MarkdownEditor/MarkdownEditor.js +10 -11
- package/lib/cjs/MarkdownEditor/markdownEditor.css +1 -3
- package/lib/cjs/PaginationCompact/PaginationCompact.js +4 -4
- package/lib/cjs/PaginationCompact/paginationCompact.css +1 -1
- package/lib/cjs/PhoneInput/PhoneInput.d.ts.map +1 -1
- package/lib/cjs/PhoneInput/PhoneInput.js +7 -10
- package/lib/cjs/PhoneInput/PhoneInput.scss +1 -1
- package/lib/cjs/SupportFeedbackForm/SupportFeedbackModal.js +12 -12
- package/lib/cjs/Table/PFTable.d.ts +1 -2
- package/lib/cjs/Table/PFTable.d.ts.map +1 -1
- package/lib/cjs/Table/PFTable.js +7 -7
- package/lib/cjs/Table/TablePagination.d.ts.map +1 -1
- package/lib/cjs/Table/TablePagination.js +1 -3
- package/lib/cjs/Table/columnSelector.css +1 -1
- package/lib/cjs/TermsAndConditions/AcceptTermsModal.d.ts.map +1 -1
- package/lib/cjs/TermsAndConditions/AcceptTermsModal.js +5 -6
- package/lib/cjs/TextAreaResizable/TextAreaResizable.d.ts.map +1 -1
- package/lib/cjs/TextAreaResizable/TextAreaResizable.js +1 -1
- package/lib/cjs/ToastNotification/toastNotification.css +1 -1
- package/lib/cjs/TopContentSearch/TopContentSearch.d.ts.map +1 -1
- package/lib/cjs/TopContentSearch/TopContentSearch.js +5 -6
- package/lib/cjs/helperFunctions/errorMessage.js +2 -2
- package/lib/cjs/helperFunctions/errorMessage.scss +1 -1
- package/lib/cjs/hooks/index.d.ts +0 -1
- package/lib/cjs/hooks/index.d.ts.map +1 -1
- package/lib/cjs/hooks/index.js +0 -1
- package/lib/cjs/hooks/useBreakpoint.d.ts.map +1 -1
- package/lib/cjs/hooks/useBreakpoint.js +0 -1
- package/lib/esm/CustomTextInput/CustomTextInput.d.ts +0 -2
- package/lib/esm/CustomTextInput/CustomTextInput.d.ts.map +1 -1
- package/lib/esm/CustomTextInput/CustomTextInput.js +2 -4
- package/lib/esm/DropDownList/DropDownList.js +10 -10
- package/lib/esm/DropDownList/DropdownWrapper.js +2 -2
- package/lib/esm/DropDownList/SearchableList.js +5 -5
- package/lib/esm/DropDownList/SelectList.js +4 -4
- package/lib/esm/DropDownList/dropdownList.css +5 -10
- package/lib/esm/ErrorBoundary/ErrorBoundaryFallbackComponent.d.ts.map +1 -1
- package/lib/esm/ErrorBoundary/ErrorBoundaryFallbackComponent.js +4 -3
- package/lib/esm/InlineEdit/NewInlineEdit.js +1 -1
- package/lib/esm/InlineEdit/newInlineEdit.css +3 -3
- package/lib/esm/LoadingDots/LoadingDots.js +1 -1
- package/lib/esm/MarkdownEditor/MarkdownEditor.d.ts.map +1 -1
- package/lib/esm/MarkdownEditor/MarkdownEditor.js +8 -9
- package/lib/esm/MarkdownEditor/markdownEditor.css +1 -3
- package/lib/esm/PaginationCompact/PaginationCompact.js +4 -4
- package/lib/esm/PaginationCompact/paginationCompact.css +1 -1
- package/lib/esm/PhoneInput/PhoneInput.d.ts.map +1 -1
- package/lib/esm/PhoneInput/PhoneInput.js +7 -10
- package/lib/esm/PhoneInput/PhoneInput.scss +1 -1
- package/lib/esm/SupportFeedbackForm/SupportFeedbackModal.js +13 -13
- package/lib/esm/Table/PFTable.d.ts +1 -2
- package/lib/esm/Table/PFTable.d.ts.map +1 -1
- package/lib/esm/Table/PFTable.js +6 -6
- package/lib/esm/Table/TablePagination.d.ts.map +1 -1
- package/lib/esm/Table/TablePagination.js +2 -4
- package/lib/esm/Table/columnSelector.css +1 -1
- package/lib/esm/TermsAndConditions/AcceptTermsModal.d.ts.map +1 -1
- package/lib/esm/TermsAndConditions/AcceptTermsModal.js +6 -7
- package/lib/esm/TextAreaResizable/TextAreaResizable.d.ts.map +1 -1
- package/lib/esm/TextAreaResizable/TextAreaResizable.js +1 -1
- package/lib/esm/ToastNotification/toastNotification.css +1 -1
- package/lib/esm/TopContentSearch/TopContentSearch.d.ts.map +1 -1
- package/lib/esm/TopContentSearch/TopContentSearch.js +5 -6
- package/lib/esm/helperFunctions/errorMessage.js +2 -2
- package/lib/esm/helperFunctions/errorMessage.scss +1 -1
- package/lib/esm/hooks/index.d.ts +0 -1
- package/lib/esm/hooks/index.d.ts.map +1 -1
- package/lib/esm/hooks/index.js +0 -1
- package/lib/esm/hooks/useBreakpoint.d.ts.map +1 -1
- package/lib/esm/hooks/useBreakpoint.js +0 -1
- package/package.json +14 -12
- package/lib/cjs/hooks/useSelectKeyboardNavigator.d.ts +0 -13
- package/lib/cjs/hooks/useSelectKeyboardNavigator.d.ts.map +0 -1
- package/lib/cjs/hooks/useSelectKeyboardNavigator.js +0 -58
- package/lib/esm/hooks/useSelectKeyboardNavigator.d.ts +0 -13
- package/lib/esm/hooks/useSelectKeyboardNavigator.d.ts.map +0 -1
- package/lib/esm/hooks/useSelectKeyboardNavigator.js +0 -54
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useSelectKeyboardNavigator.d.ts","sourceRoot":"","sources":["../../../src/hooks/useSelectKeyboardNavigator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAEnD,UAAU,MAAM;IACZ,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;IAC1D,QAAQ,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;CAClC;AAED,wBAAgB,0BAA0B,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,MAAM;4BAiCrD,mBAAmB,CAAC,gBAAgB,CAAC;;EAuBvE"}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from 'react';
|
|
2
|
-
export function useSelectKeyboardNavigator({ list, isOpen, setIsOpen, onSelect }) {
|
|
3
|
-
const [focusedItemIndex, setFocusedItemIndex] = useState(null);
|
|
4
|
-
useEffect(() => {
|
|
5
|
-
setFocusedItemIndex(null);
|
|
6
|
-
}, [list.length]);
|
|
7
|
-
const handleMenuArrowKeys = (key) => {
|
|
8
|
-
let indexToFocus;
|
|
9
|
-
if (isOpen) {
|
|
10
|
-
if (key === 'ArrowUp') {
|
|
11
|
-
// When no index is set or at the first index, focus to the last, otherwise decrement focus index
|
|
12
|
-
if (focusedItemIndex === null || focusedItemIndex === 0) {
|
|
13
|
-
indexToFocus = list.length - 1;
|
|
14
|
-
}
|
|
15
|
-
else {
|
|
16
|
-
indexToFocus = focusedItemIndex - 1;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
if (key === 'ArrowDown') {
|
|
20
|
-
// When no index is set or at the last index, focus to the first, otherwise increment focus index
|
|
21
|
-
if (focusedItemIndex === null || focusedItemIndex === list.length - 1) {
|
|
22
|
-
indexToFocus = 0;
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
indexToFocus = focusedItemIndex + 1;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
setFocusedItemIndex(indexToFocus);
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
const onInputKeyDown = (event) => {
|
|
32
|
-
const focusedItem = focusedItemIndex !== null ? list[focusedItemIndex] : null;
|
|
33
|
-
switch (event.key) {
|
|
34
|
-
// Select the first available option
|
|
35
|
-
case 'Enter':
|
|
36
|
-
if (!isOpen) {
|
|
37
|
-
setIsOpen((pre) => !pre);
|
|
38
|
-
}
|
|
39
|
-
else if (isOpen && focusedItem !== null) {
|
|
40
|
-
onSelect(focusedItem);
|
|
41
|
-
}
|
|
42
|
-
break;
|
|
43
|
-
case 'Escape':
|
|
44
|
-
setIsOpen(false);
|
|
45
|
-
break;
|
|
46
|
-
case 'ArrowUp':
|
|
47
|
-
case 'ArrowDown':
|
|
48
|
-
event.preventDefault();
|
|
49
|
-
handleMenuArrowKeys(event.key);
|
|
50
|
-
break;
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
return { onInputKeyDown, focusedItemIndex };
|
|
54
|
-
}
|