@geotab/zenith 3.6.3 → 3.7.0
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 +15 -0
- package/dist/absolute/absolute.d.ts +3 -1
- package/dist/absolute/absolute.js +4 -4
- package/dist/checkbox/checkbox.d.ts +3 -1
- package/dist/checkbox/checkbox.js +5 -8
- package/dist/checkboxListWithAction/checkboxListWithAction.d.ts +3 -1
- package/dist/checkboxListWithAction/checkboxListWithAction.js +185 -3
- package/dist/controlledPopup/controlledPopup.d.ts +3 -1
- package/dist/controlledPopup/controlledPopup.js +2 -2
- package/dist/dropdown/dropdownPopup.d.ts +1 -1
- package/dist/dropdown/dropdownTrigger.d.ts +1 -1
- package/dist/dropdownRaw/dropdownList.d.ts +2 -1
- package/dist/dropdownRaw/dropdownList.js +15 -4
- package/dist/dropdownRaw/dropdownPopup.d.ts +3 -1
- package/dist/dropdownRaw/dropdownPopup.js +35 -5
- package/dist/dropdownRaw/dropdownRaw.js +82 -7
- package/dist/dropdownRaw/dropdownSearchableTrigger.d.ts +2 -1
- package/dist/dropdownRaw/dropdownSearchableTrigger.js +7 -2
- package/dist/dropdownRaw/dropdownTrigger.d.ts +2 -1
- package/dist/dropdownRaw/dropdownTrigger.js +3 -5
- package/dist/footerButtons/footerButtons.d.ts +6 -4
- package/dist/footerButtons/footerButtons.js +3 -8
- package/dist/groupsFilterRaw/groupsFilterCurrentlySelectedState.js +8 -2
- package/dist/groupsFilterRaw/groupsFilterInitialState.js +16 -0
- package/dist/groupsFilterRaw/groupsFilterRaw.js +43 -9
- package/dist/groupsFilterRaw/groupsFilterTrigger.d.ts +2 -1
- package/dist/groupsFilterRaw/groupsFilterTrigger.js +13 -2
- package/dist/index.css +222 -18
- package/dist/index.d.ts +1 -1
- package/dist/list/hooks/useDragAndDrop.d.ts +3 -1
- package/dist/list/hooks/useDragAndDrop.js +11 -4
- package/dist/menu/components/menuItem.js +12 -2
- package/dist/menu/contexts/pathContext.d.ts +3 -1
- package/dist/menu/contexts/pathProvider.d.ts +1 -1
- package/dist/menu/contexts/pathProvider.js +1 -1
- package/dist/menu/controlledMenu.js +97 -29
- package/dist/nav/nav.d.ts +2 -1
- package/dist/nav/nav.js +3 -2
- package/dist/nav/navEditList/navEditList.js +2 -1
- package/dist/nav/navItem/navItem.d.ts +1 -0
- package/dist/nav/navItem/navItem.js +4 -1
- package/dist/pillExpandable/pillContent.d.ts +2 -1
- package/dist/pillExpandable/pillContent.js +8 -3
- package/dist/pillExpandable/pillExpandable.d.ts +27 -4
- package/dist/pillExpandable/pillExpandable.js +426 -196
- package/dist/pillExpandable/pillExpandablePopoverContent.d.ts +19 -0
- package/dist/pillExpandable/pillExpandablePopoverContent.js +7 -0
- package/dist/pillExpandable/pillExpandableSimple.d.ts +5 -3
- package/dist/pillExpandable/pillExpandableSimple.js +12 -5
- package/dist/summary/summary.js +29 -1
- package/dist/summaryTile/summaryTile.d.ts +2 -1
- package/dist/summaryTile/summaryTile.js +175 -65
- package/dist/summaryTile/summaryTileTrigger.d.ts +1 -1
- package/dist/summaryTile/summaryTileTrigger.js +1 -1
- package/dist/toggleButtonRaw/toggleButtonRaw.js +2 -1
- package/dist/utils/localization/getSupportedLanguage.d.ts +2 -2
- package/dist/utils/localization/getSupportedLanguage.js +28 -8
- package/dist/utils/localization/languageContext.d.ts +1 -1
- package/dist/utils/localization/translations/cs.json +2 -1
- package/dist/utils/localization/translations/de.json +2 -1
- package/dist/utils/localization/translations/en.json +2 -1
- package/dist/utils/localization/translations/es.json +2 -1
- package/dist/utils/localization/translations/fr-FR.json +2 -1
- package/dist/utils/localization/translations/fr.json +2 -1
- package/dist/utils/localization/translations/id.json +2 -1
- package/dist/utils/localization/translations/it.json +2 -1
- package/dist/utils/localization/translations/ja.json +2 -1
- package/dist/utils/localization/translations/ms.json +2 -1
- package/dist/utils/localization/translations/nl.json +2 -1
- package/dist/utils/localization/translations/pl.json +2 -1
- package/dist/utils/localization/translations/pt-BR.json +2 -1
- package/dist/utils/localization/translations/sv.json +2 -1
- package/dist/utils/localization/translations/th.json +2 -1
- package/dist/utils/localization/translations/tr.json +2 -1
- package/dist/utils/localization/translations/zh-Hans.json +2 -1
- package/esm/absolute/absolute.d.ts +3 -1
- package/esm/absolute/absolute.js +4 -4
- package/esm/checkbox/checkbox.d.ts +3 -1
- package/esm/checkbox/checkbox.js +5 -8
- package/esm/checkboxListWithAction/checkboxListWithAction.d.ts +3 -1
- package/esm/checkboxListWithAction/checkboxListWithAction.js +186 -4
- package/esm/controlledPopup/controlledPopup.d.ts +3 -1
- package/esm/controlledPopup/controlledPopup.js +2 -2
- package/esm/dropdown/dropdownPopup.d.ts +1 -1
- package/esm/dropdown/dropdownTrigger.d.ts +1 -1
- package/esm/dropdownRaw/dropdownList.d.ts +2 -1
- package/esm/dropdownRaw/dropdownList.js +16 -5
- package/esm/dropdownRaw/dropdownPopup.d.ts +3 -1
- package/esm/dropdownRaw/dropdownPopup.js +37 -7
- package/esm/dropdownRaw/dropdownRaw.js +82 -7
- package/esm/dropdownRaw/dropdownSearchableTrigger.d.ts +2 -1
- package/esm/dropdownRaw/dropdownSearchableTrigger.js +7 -2
- package/esm/dropdownRaw/dropdownTrigger.d.ts +2 -1
- package/esm/dropdownRaw/dropdownTrigger.js +3 -5
- package/esm/footerButtons/footerButtons.d.ts +6 -4
- package/esm/footerButtons/footerButtons.js +3 -8
- package/esm/groupsFilterRaw/groupsFilterCurrentlySelectedState.js +9 -3
- package/esm/groupsFilterRaw/groupsFilterInitialState.js +16 -0
- package/esm/groupsFilterRaw/groupsFilterRaw.js +43 -9
- package/esm/groupsFilterRaw/groupsFilterTrigger.d.ts +2 -1
- package/esm/groupsFilterRaw/groupsFilterTrigger.js +13 -2
- package/esm/index.d.ts +1 -1
- package/esm/list/hooks/useDragAndDrop.d.ts +3 -1
- package/esm/list/hooks/useDragAndDrop.js +11 -4
- package/esm/menu/components/menuItem.js +12 -2
- package/esm/menu/contexts/pathContext.d.ts +3 -1
- package/esm/menu/contexts/pathProvider.d.ts +1 -1
- package/esm/menu/contexts/pathProvider.js +1 -1
- package/esm/menu/controlledMenu.js +98 -30
- package/esm/nav/nav.d.ts +2 -1
- package/esm/nav/nav.js +3 -2
- package/esm/nav/navEditList/navEditList.js +2 -1
- package/esm/nav/navItem/navItem.d.ts +1 -0
- package/esm/nav/navItem/navItem.js +5 -2
- package/esm/pillExpandable/pillContent.d.ts +2 -1
- package/esm/pillExpandable/pillContent.js +8 -3
- package/esm/pillExpandable/pillExpandable.d.ts +27 -4
- package/esm/pillExpandable/pillExpandable.js +427 -197
- package/esm/pillExpandable/pillExpandablePopoverContent.d.ts +19 -0
- package/esm/pillExpandable/pillExpandablePopoverContent.js +3 -0
- package/esm/pillExpandable/pillExpandableSimple.d.ts +5 -3
- package/esm/pillExpandable/pillExpandableSimple.js +12 -5
- package/esm/summary/summary.js +29 -1
- package/esm/summaryTile/summaryTile.d.ts +2 -1
- package/esm/summaryTile/summaryTile.js +140 -43
- package/esm/summaryTile/summaryTileTrigger.d.ts +1 -1
- package/esm/summaryTile/summaryTileTrigger.js +1 -1
- package/esm/toggleButtonRaw/toggleButtonRaw.js +2 -1
- package/esm/utils/localization/getSupportedLanguage.d.ts +2 -2
- package/esm/utils/localization/getSupportedLanguage.js +28 -8
- package/esm/utils/localization/languageContext.d.ts +1 -1
- package/esm/utils/localization/translations/cs.json +2 -1
- package/esm/utils/localization/translations/de.json +2 -1
- package/esm/utils/localization/translations/en.json +2 -1
- package/esm/utils/localization/translations/es.json +2 -1
- package/esm/utils/localization/translations/fr-FR.json +2 -1
- package/esm/utils/localization/translations/fr.json +2 -1
- package/esm/utils/localization/translations/id.json +2 -1
- package/esm/utils/localization/translations/it.json +2 -1
- package/esm/utils/localization/translations/ja.json +2 -1
- package/esm/utils/localization/translations/ms.json +2 -1
- package/esm/utils/localization/translations/nl.json +2 -1
- package/esm/utils/localization/translations/pl.json +2 -1
- package/esm/utils/localization/translations/pt-BR.json +2 -1
- package/esm/utils/localization/translations/sv.json +2 -1
- package/esm/utils/localization/translations/th.json +2 -1
- package/esm/utils/localization/translations/tr.json +2 -1
- package/esm/utils/localization/translations/zh-Hans.json +2 -1
- package/package.json +4 -7
|
@@ -62,6 +62,8 @@ const useFormFieldValues_1 = require("../commonHelpers/hooks/useFormFieldValues/
|
|
|
62
62
|
const formSectionProvider_1 = require("../formSection/utils/formSectionProvider");
|
|
63
63
|
const dropdown_1 = require("../dropdown/dropdown");
|
|
64
64
|
const zen_1 = require("../utils/zen");
|
|
65
|
+
const isChildOf_1 = require("../utils/isChildOf");
|
|
66
|
+
const keyboardHelpers_1 = require("../utils/keyboardHelpers");
|
|
65
67
|
const DropdownRaw = props => {
|
|
66
68
|
var _a, _b;
|
|
67
69
|
const {
|
|
@@ -142,6 +144,8 @@ const DropdownRaw = props => {
|
|
|
142
144
|
const popupId = (0, react_1.useId)();
|
|
143
145
|
const abortToken = (0, react_1.useRef)(new AbortController());
|
|
144
146
|
const triggerRef = (0, react_1.useRef)(null);
|
|
147
|
+
const listElementRef = (0, react_1.useRef)(null);
|
|
148
|
+
const nextFocusableItemRef = (0, react_1.useRef)(false);
|
|
145
149
|
const comboboxRef = (0, react_1.useRef)(null);
|
|
146
150
|
const inputRef = (0, react_1.useRef)(null);
|
|
147
151
|
const contentRef = (0, react_1.useRef)(null);
|
|
@@ -309,6 +313,9 @@ const DropdownRaw = props => {
|
|
|
309
313
|
type: stateActionType_1.StateActionType.SetCurrentId,
|
|
310
314
|
payload: newCurrentId === state.rootId || state.inputValue ? undefined : newCurrentId
|
|
311
315
|
});
|
|
316
|
+
// const focusableElements = contentRef.current?.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR);
|
|
317
|
+
// focusableElements?.[0]?.focus();
|
|
318
|
+
nextFocusableItemRef.current = state.currentId ? `button[data-btn='${state.currentId}']` : true;
|
|
312
319
|
}, [state.currentId, state.groupsMap, state.inputValue, state.rootId]);
|
|
313
320
|
const handleSelect = (0, react_1.useCallback)(val => {
|
|
314
321
|
if (isFullSelectionMode && state.isAllSelected) {
|
|
@@ -408,11 +415,14 @@ const DropdownRaw = props => {
|
|
|
408
415
|
});
|
|
409
416
|
}, [isFullSelectionMode, state.isAllSelected, state.listData, state.isNestedList, state.selectedIds]);
|
|
410
417
|
const handleClearClick = (0, react_1.useCallback)(() => {
|
|
418
|
+
var _a, _b;
|
|
411
419
|
dispatchState({
|
|
412
420
|
type: stateActionType_1.StateActionType.ResetSelection,
|
|
413
421
|
payload: undefined
|
|
414
422
|
});
|
|
415
|
-
|
|
423
|
+
const focusableElements = (_a = contentRef.current) === null || _a === void 0 ? void 0 : _a.querySelectorAll(focusableSelector_1.FOCUSABLE_SELECTOR);
|
|
424
|
+
(_b = focusableElements === null || focusableElements === void 0 ? void 0 : focusableElements[0]) === null || _b === void 0 ? void 0 : _b.focus();
|
|
425
|
+
}, [contentRef]);
|
|
416
426
|
const handleCancelClick = (0, react_1.useCallback)(() => {
|
|
417
427
|
dispatchState({
|
|
418
428
|
type: stateActionType_1.StateActionType.ResetStateToGlobal,
|
|
@@ -672,6 +682,7 @@ const DropdownRaw = props => {
|
|
|
672
682
|
payload: isChecked
|
|
673
683
|
});
|
|
674
684
|
prevIsChecked.current = isChecked;
|
|
685
|
+
nextFocusableItemRef.current = `.zen-dropdown-list__checkbox-container input`;
|
|
675
686
|
const currentAbort = abortToken.current;
|
|
676
687
|
controlData(currentAbort.signal, state.inputValue, isChecked);
|
|
677
688
|
}, [controlData, state.inputValue]);
|
|
@@ -708,18 +719,27 @@ const DropdownRaw = props => {
|
|
|
708
719
|
}
|
|
709
720
|
}, [searchField, state.currentId, state.showList, contentRef]);
|
|
710
721
|
(0, react_1.useEffect)(() => {
|
|
711
|
-
var _a;
|
|
722
|
+
var _a, _b;
|
|
712
723
|
if (!state.isOpenCombo || !state.showList) {
|
|
713
724
|
return;
|
|
714
725
|
}
|
|
715
|
-
|
|
716
|
-
|
|
726
|
+
if (nextFocusableItemRef.current && typeof nextFocusableItemRef.current === "string") {
|
|
727
|
+
const nextFocusable = (_a = contentRef.current) === null || _a === void 0 ? void 0 : _a.querySelector(nextFocusableItemRef.current);
|
|
728
|
+
if (nextFocusable) {
|
|
729
|
+
nextFocusable.focus();
|
|
730
|
+
nextFocusableItemRef.current = false;
|
|
731
|
+
return;
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
const firstFocusable = (_b = contentRef.current) === null || _b === void 0 ? void 0 : _b.querySelector(focusableSelector_1.FOCUSABLE_SELECTOR);
|
|
735
|
+
if (firstFocusable && (!searchField || state.currentId || nextFocusableItemRef.current)) {
|
|
736
|
+
nextFocusableItemRef.current = false;
|
|
717
737
|
firstFocusable.focus();
|
|
718
738
|
} else {
|
|
719
739
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
720
740
|
(inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) && inputRef.current.focus();
|
|
721
741
|
}
|
|
722
|
-
}, [state.isOpenCombo, state.currentId, state.showList, searchField]);
|
|
742
|
+
}, [state.isOpenCombo, state.currentId, state.showList, searchField, contentRef]);
|
|
723
743
|
(0, react_1.useEffect)(() => {
|
|
724
744
|
const shouldExit = !getNamedItems || Object.keys(state.groupsMap).length === 0 && Object.keys(state.groupsMapSelected).length === 0 || getNamedItemsHasBeenCalled.current || state.groupsMapSelected.size === 0;
|
|
725
745
|
if (shouldExit) {
|
|
@@ -751,6 +771,57 @@ const DropdownRaw = props => {
|
|
|
751
771
|
return currentAllSelected !== undefined ? state.defaultValueIsAllSelected === currentAllSelected && isStringsTheSame && isCheckedEqualDefault : isStringsTheSame && isCheckedEqualDefault;
|
|
752
772
|
}, [currentAllSelected, currentIsChecked, forceSelection, multiselect, state.defaultValue, state.defaultValueIsAllSelected, state.defaultValueIsChecked, state.selectedIds]);
|
|
753
773
|
const memoizedIsApplyButtonDisabled = (0, react_1.useMemo)(() => (0, dropdownHelper_1.compareStringsArrays)(state.globalSelectedIds, state.selectedIds) && (isFullSelectionMode ? state.globalIsAllSelected === state.isAllSelected : true) && (isCheckboxMode ? state.globalIsChecked === state.isChecked : true), [isCheckboxMode, isFullSelectionMode, state.globalIsAllSelected, state.globalIsChecked, state.globalSelectedIds, state.isAllSelected, state.isChecked, state.selectedIds]);
|
|
774
|
+
const handleKeydown = (0, react_1.useCallback)(e => {
|
|
775
|
+
const isChildOfListElements = listElementRef.current && e.target instanceof Node ? (0, isChildOf_1.isChildOf)(e.target, listElementRef.current) : false;
|
|
776
|
+
if (isChildOfListElements) {
|
|
777
|
+
return;
|
|
778
|
+
}
|
|
779
|
+
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
780
|
+
if (!contentRef.current) {
|
|
781
|
+
return;
|
|
782
|
+
}
|
|
783
|
+
const focusableElements = contentRef.current.querySelectorAll(focusableSelector_1.FOCUSABLE_SELECTOR);
|
|
784
|
+
if (focusableElements.length === 0) {
|
|
785
|
+
return;
|
|
786
|
+
}
|
|
787
|
+
const currentIndex = Array.from(focusableElements).indexOf(e.target);
|
|
788
|
+
let nextIndex;
|
|
789
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
790
|
+
if (currentIndex === 0 && e.key === "ArrowUp" && inputRef.current) {
|
|
791
|
+
inputRef.current.focus();
|
|
792
|
+
return;
|
|
793
|
+
}
|
|
794
|
+
if (e.key === "ArrowDown") {
|
|
795
|
+
e.preventDefault();
|
|
796
|
+
nextIndex = currentIndex === -1 ? 0 : (currentIndex + 1) % focusableElements.length;
|
|
797
|
+
} else {
|
|
798
|
+
e.preventDefault();
|
|
799
|
+
nextIndex = currentIndex === -1 ? focusableElements.length - 1 : (currentIndex - 1 + focusableElements.length) % focusableElements.length;
|
|
800
|
+
}
|
|
801
|
+
focusableElements[nextIndex].focus();
|
|
802
|
+
}
|
|
803
|
+
}, []);
|
|
804
|
+
const handleFocusOnSentinelItem = (0, react_1.useCallback)(() => {
|
|
805
|
+
var _a;
|
|
806
|
+
if (isMobile) {
|
|
807
|
+
return;
|
|
808
|
+
}
|
|
809
|
+
const firstFocusable = (0, keyboardHelpers_1.getFirstFocusableItem)(contentRef.current);
|
|
810
|
+
if (firstFocusable && listElementRef.current && (0, isChildOf_1.isChildOf)(firstFocusable, listElementRef.current)) {
|
|
811
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
812
|
+
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
813
|
+
} else {
|
|
814
|
+
firstFocusable === null || firstFocusable === void 0 ? void 0 : firstFocusable.focus();
|
|
815
|
+
}
|
|
816
|
+
}, [contentRef, isMobile, listElementRef]);
|
|
817
|
+
const handleFocusOnPopup = (0, react_1.useCallback)(() => {
|
|
818
|
+
var _a;
|
|
819
|
+
if (!state.showList) {
|
|
820
|
+
return;
|
|
821
|
+
}
|
|
822
|
+
const firstFocusable = (_a = contentRef.current) === null || _a === void 0 ? void 0 : _a.querySelector(focusableSelector_1.FOCUSABLE_SELECTOR);
|
|
823
|
+
firstFocusable === null || firstFocusable === void 0 ? void 0 : firstFocusable.focus();
|
|
824
|
+
}, [state.showList, contentRef]);
|
|
754
825
|
const countSelected = (0, react_1.useMemo)(() => {
|
|
755
826
|
var _a, _b;
|
|
756
827
|
if (hasApplyButton && state.globalIsAllSelected || !hasApplyButton && state.isAllSelected) {
|
|
@@ -820,7 +891,8 @@ const DropdownRaw = props => {
|
|
|
820
891
|
isMobile: isMobile,
|
|
821
892
|
handleCheckboxChange: isCheckboxMode && !isMobile ? handleCheckboxChange : undefined,
|
|
822
893
|
checkboxLabel: checkboxLabel,
|
|
823
|
-
isChecked: state.isChecked
|
|
894
|
+
isChecked: state.isChecked,
|
|
895
|
+
listElementRef: listElementRef
|
|
824
896
|
});
|
|
825
897
|
}
|
|
826
898
|
return null;
|
|
@@ -870,7 +942,8 @@ const DropdownRaw = props => {
|
|
|
870
942
|
triggerRef: triggerRef,
|
|
871
943
|
inputRef: inputRef,
|
|
872
944
|
buttonType: buttonType,
|
|
873
|
-
popupId: popupId
|
|
945
|
+
popupId: popupId,
|
|
946
|
+
handleFocusOnPopup: handleFocusOnPopup
|
|
874
947
|
}, accessibilityProps)), (0, jsx_runtime_1.jsx)(dropdownPopup_1.DropdownPopup, {
|
|
875
948
|
alignment: alignment,
|
|
876
949
|
triggerRef: triggerRef,
|
|
@@ -893,6 +966,7 @@ const DropdownRaw = props => {
|
|
|
893
966
|
handleClearClick: multiselect ? handleClearClick : handleSingleSelection.bind(this, true),
|
|
894
967
|
handleTriggerClick: handleTriggerClick,
|
|
895
968
|
onInputChange: onInputChange,
|
|
969
|
+
handleKeydown: handleKeydown,
|
|
896
970
|
inputRef: inputRef,
|
|
897
971
|
contentRef: contentRef,
|
|
898
972
|
onReadyForFocus: handleReadyForFocus,
|
|
@@ -901,6 +975,7 @@ const DropdownRaw = props => {
|
|
|
901
975
|
isChecked: state.isChecked,
|
|
902
976
|
isSearchInPopup: chip,
|
|
903
977
|
mobileSheetStackingClassName: mobileSheetStackingClassName,
|
|
978
|
+
handleFocusOnSentinelItem: handleFocusOnSentinelItem,
|
|
904
979
|
children: getPopupContent
|
|
905
980
|
})]
|
|
906
981
|
});
|
|
@@ -20,9 +20,10 @@ interface IDropdownSearchableTrigger {
|
|
|
20
20
|
name?: string;
|
|
21
21
|
onBlur?: () => void;
|
|
22
22
|
popupId?: string;
|
|
23
|
+
handleFocusOnPopup?: () => void;
|
|
23
24
|
}
|
|
24
25
|
export declare const DropdownSearchableTrigger: {
|
|
25
|
-
({ value, className, onChange, placeholder, isOpenPopup, inputRef, handleClick, width, title, id, disabled, count, currentSelection, isError, fullWidth, ref, name, onBlur, popupId, ...otherProps }: IDropdownSearchableTrigger): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
({ value, className, onChange, placeholder, isOpenPopup, inputRef, handleClick, width, title, id, disabled, count, currentSelection, isError, fullWidth, ref, name, onBlur, popupId, handleFocusOnPopup, ...otherProps }: IDropdownSearchableTrigger): import("react/jsx-runtime").JSX.Element;
|
|
26
27
|
displayName: string;
|
|
27
28
|
};
|
|
28
29
|
export declare const TRANSLATIONS: string[];
|
|
@@ -149,9 +149,10 @@ const DropdownSearchableTrigger = _a => {
|
|
|
149
149
|
ref,
|
|
150
150
|
name,
|
|
151
151
|
onBlur,
|
|
152
|
-
popupId
|
|
152
|
+
popupId,
|
|
153
|
+
handleFocusOnPopup
|
|
153
154
|
} = _a,
|
|
154
|
-
otherProps = __rest(_a, ["value", "className", "onChange", "placeholder", "isOpenPopup", "inputRef", "handleClick", "width", "title", "id", "disabled", "count", "currentSelection", "isError", "fullWidth", "ref", "name", "onBlur", "popupId"])
|
|
155
|
+
otherProps = __rest(_a, ["value", "className", "onChange", "placeholder", "isOpenPopup", "inputRef", "handleClick", "width", "title", "id", "disabled", "count", "currentSelection", "isError", "fullWidth", "ref", "name", "onBlur", "popupId", "handleFocusOnPopup"])
|
|
155
156
|
// eslint-disable-next-line complexity
|
|
156
157
|
;
|
|
157
158
|
const {
|
|
@@ -184,6 +185,10 @@ const DropdownSearchableTrigger = _a => {
|
|
|
184
185
|
if (e.key === " " && !isOpenPopup) {
|
|
185
186
|
handleClick(true);
|
|
186
187
|
}
|
|
188
|
+
if (e.key === "ArrowDown" && isOpenPopup) {
|
|
189
|
+
e.preventDefault();
|
|
190
|
+
handleFocusOnPopup === null || handleFocusOnPopup === void 0 ? void 0 : handleFocusOnPopup();
|
|
191
|
+
}
|
|
187
192
|
};
|
|
188
193
|
const clickHandler = e => {
|
|
189
194
|
if (e.target === inputRef.current && isOpenPopup || e.target === clearRef.current && isOpenPopup) {
|
|
@@ -23,6 +23,7 @@ export interface IDropdownTrigger extends IZenComponentProps {
|
|
|
23
23
|
name?: string;
|
|
24
24
|
onBlur?: () => void;
|
|
25
25
|
popupId?: string;
|
|
26
|
+
handleFocusOnPopup?: () => void;
|
|
26
27
|
}
|
|
27
|
-
export declare const DropdownTrigger: ({ name, onBlur, isActive, id, triggerRef, searchField, placeholder, disabled, fullWidth, currentSelection, handleClick, inputValue, className, onSearchChange, width, title, triggerAriaLabel, count, inputRef, buttonType, isError, popupId, ...otherProps }: IDropdownTrigger) => import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
export declare const DropdownTrigger: ({ name, onBlur, isActive, id, triggerRef, searchField, placeholder, disabled, fullWidth, currentSelection, handleClick, inputValue, className, onSearchChange, width, title, triggerAriaLabel, count, inputRef, buttonType, isError, popupId, handleFocusOnPopup, ...otherProps }: IDropdownTrigger) => import("react/jsx-runtime").JSX.Element;
|
|
28
29
|
export declare const TRANSLATIONS: string[];
|
|
@@ -18,14 +18,12 @@ const filterButton_1 = require("../filterButton/filterButton");
|
|
|
18
18
|
const react_1 = require("react");
|
|
19
19
|
const classNames_1 = require("../commonHelpers/classNames/classNames");
|
|
20
20
|
const DropdownTrigger = (_a) => {
|
|
21
|
-
var { name, onBlur, isActive, id, triggerRef, searchField, placeholder, disabled, fullWidth, currentSelection, handleClick, inputValue, className, onSearchChange = () => { }, width, title, triggerAriaLabel, count, inputRef, buttonType, isError, popupId } = _a, otherProps = __rest(_a, ["name", "onBlur", "isActive", "id", "triggerRef", "searchField", "placeholder", "disabled", "fullWidth", "currentSelection", "handleClick", "inputValue", "className", "onSearchChange", "width", "title", "triggerAriaLabel", "count", "inputRef", "buttonType", "isError", "popupId"]);
|
|
21
|
+
var { name, onBlur, isActive, id, triggerRef, searchField, placeholder, disabled, fullWidth, currentSelection, handleClick, inputValue, className, onSearchChange = () => { }, width, title, triggerAriaLabel, count, inputRef, buttonType, isError, popupId, handleFocusOnPopup } = _a, otherProps = __rest(_a, ["name", "onBlur", "isActive", "id", "triggerRef", "searchField", "placeholder", "disabled", "fullWidth", "currentSelection", "handleClick", "inputValue", "className", "onSearchChange", "width", "title", "triggerAriaLabel", "count", "inputRef", "buttonType", "isError", "popupId", "handleFocusOnPopup"]);
|
|
22
22
|
const elInpRef = (0, react_1.useRef)(null);
|
|
23
23
|
const handleButtonClick = () => {
|
|
24
24
|
handleClick(!isActive);
|
|
25
25
|
};
|
|
26
|
-
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: searchField ? (0, jsx_runtime_1.jsx)(dropdownSearchableTrigger_1.DropdownSearchableTrigger, Object.assign({ value: inputValue || "", name: name, onChange: onSearchChange, isOpenPopup: isActive, inputRef: inputRef || elInpRef, handleClick: handleClick, ref: triggerRef, width: width, placeholder: placeholder, disabled: disabled, id: id, title: title, count: count, currentSelection: currentSelection, className: className, isError: isError, fullWidth: fullWidth, popupId: popupId }, otherProps)) : (0, jsx_runtime_1.jsx)(filterButton_1.FilterButton, Object.assign({ ref: triggerRef, id: id, name: name, onBlur: onBlur, className: (0, classNames_1.classNames)(["zen-dropdown__trigger-button", isError ? "zen-dropdown__trigger-button--error" : "", className || ""]), onClick: handleButtonClick, disabled: disabled, isActive: isActive, fullWidth: width ? true : fullWidth, maxWidth: width, minWidth: width, quantity: count || undefined, type: buttonType, title: title, ariaLabel: triggerAriaLabel || placeholder, "aria-expanded": isActive, "aria-haspopup": "dialog", "data-role": "dialog", "aria-controls": popupId }, otherProps, { children: currentSelection ? (0, jsx_runtime_1.jsx)("span", { className: (0, classNames_1.classNames)(["zen-dropdown__trigger-button-text", buttonType ? `zen-dropdown__trigger-button-text--${buttonType.toString()}` : ""]), children: currentSelection }) : placeholder })) });
|
|
26
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: searchField ? ((0, jsx_runtime_1.jsx)(dropdownSearchableTrigger_1.DropdownSearchableTrigger, Object.assign({ value: inputValue || "", name: name, onChange: onSearchChange, isOpenPopup: isActive, inputRef: inputRef || elInpRef, handleClick: handleClick, handleFocusOnPopup: handleFocusOnPopup, ref: triggerRef, width: width, placeholder: placeholder, disabled: disabled, id: id, title: title, count: count, currentSelection: currentSelection, className: className, isError: isError, fullWidth: fullWidth, popupId: popupId }, otherProps))) : ((0, jsx_runtime_1.jsx)(filterButton_1.FilterButton, Object.assign({ ref: triggerRef, id: id, name: name, onBlur: onBlur, className: (0, classNames_1.classNames)(["zen-dropdown__trigger-button", isError ? "zen-dropdown__trigger-button--error" : "", className || ""]), onClick: handleButtonClick, disabled: disabled, isActive: isActive, fullWidth: width ? true : fullWidth, maxWidth: width, minWidth: width, quantity: count || undefined, type: buttonType, title: title, ariaLabel: triggerAriaLabel || placeholder, "aria-expanded": isActive, "aria-haspopup": "dialog", "data-role": "dialog", "aria-controls": popupId }, otherProps, { children: currentSelection ? ((0, jsx_runtime_1.jsx)("span", { className: (0, classNames_1.classNames)(["zen-dropdown__trigger-button-text", buttonType ? `zen-dropdown__trigger-button-text--${buttonType.toString()}` : ""]), children: currentSelection })) : (placeholder) }))) }));
|
|
27
27
|
};
|
|
28
28
|
exports.DropdownTrigger = DropdownTrigger;
|
|
29
|
-
exports.TRANSLATIONS = [
|
|
30
|
-
...dropdownSearchableTrigger_1.TRANSLATIONS
|
|
31
|
-
];
|
|
29
|
+
exports.TRANSLATIONS = [...dropdownSearchableTrigger_1.TRANSLATIONS];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import { IZenComponentProps } from "./../commonHelpers/zenComponent";
|
|
2
3
|
import { ReactElement } from "react";
|
|
3
4
|
import { IButton } from "../button/button";
|
|
@@ -5,10 +6,11 @@ import "./footerButtons.less";
|
|
|
5
6
|
export interface IFooterButtons extends IZenComponentProps {
|
|
6
7
|
children: ReactElement<IButton> | (ReactElement<IButton> | null | undefined)[];
|
|
7
8
|
/**
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
* @deprecated
|
|
10
|
+
* @param stacked - will be removed in the next major release
|
|
11
|
+
*/
|
|
11
12
|
stacked?: boolean;
|
|
12
13
|
isSticky?: boolean;
|
|
14
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
13
15
|
}
|
|
14
|
-
export declare const FooterButtons: ({ className, children, isSticky }: IFooterButtons) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export declare const FooterButtons: ({ className, children, isSticky, ref }: IFooterButtons) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -35,7 +35,7 @@ const getChildren = (children) => {
|
|
|
35
35
|
}
|
|
36
36
|
return (react_1.default.Children.count(children) === 1 ? [children] : react_1.default.Children.toArray(children).filter((child) => react_1.default.isValidElement(child)));
|
|
37
37
|
};
|
|
38
|
-
const FooterButtons = ({ className, children, isSticky = false }) => {
|
|
38
|
+
const FooterButtons = ({ className, children, isSticky = false, ref }) => {
|
|
39
39
|
const footerButtonsId = (0, useUniqueId_1.useUniqueId)();
|
|
40
40
|
const driveComponentClassName = (0, useDriveClassName_1.useDriveClassName)("zen-footer-buttons");
|
|
41
41
|
const maxLength = 3;
|
|
@@ -54,12 +54,7 @@ const FooterButtons = ({ className, children, isSticky = false }) => {
|
|
|
54
54
|
});
|
|
55
55
|
return clonedElements;
|
|
56
56
|
}, [children, footerButtonsId]);
|
|
57
|
-
const containerClassNames = (0, classNames_1.classNames)([
|
|
58
|
-
|
|
59
|
-
isSticky && driveComponentClassName ? "zen-footer-buttons--sticky" : "",
|
|
60
|
-
driveComponentClassName || "",
|
|
61
|
-
className || ""
|
|
62
|
-
]);
|
|
63
|
-
return (0, jsx_runtime_1.jsx)("div", { className: containerClassNames, children: childrenArray });
|
|
57
|
+
const containerClassNames = (0, classNames_1.classNames)(["zen-footer-buttons", isSticky && driveComponentClassName ? "zen-footer-buttons--sticky" : "", driveComponentClassName || "", className || ""]);
|
|
58
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: containerClassNames, ref: ref, children: childrenArray }));
|
|
64
59
|
};
|
|
65
60
|
exports.FooterButtons = FooterButtons;
|
|
@@ -134,9 +134,15 @@ const GroupsFilterCurrentlySelectedState = ({
|
|
|
134
134
|
translate
|
|
135
135
|
} = (0, useLanguage_1.useLanguage)();
|
|
136
136
|
const togglerId = (0, react_1.useId)();
|
|
137
|
-
const
|
|
137
|
+
const handleBackButtonKeyDown = (0, react_1.useCallback)(event => {
|
|
138
|
+
if (event.key === "ArrowLeft") {
|
|
139
|
+
onBackButtonClick();
|
|
140
|
+
}
|
|
141
|
+
}, [onBackButtonClick]);
|
|
142
|
+
const getActionButton = (label, title, icon, handleClick, handleKeyDown) => (0, jsx_runtime_1.jsx)("button", {
|
|
138
143
|
type: "button",
|
|
139
144
|
onClick: handleClick,
|
|
145
|
+
onKeyDown: handleKeyDown,
|
|
140
146
|
className: "zen-groups-filter-menu__item zen-groups-filter-menu__item--interactive zen-groups-filter-menu__action-button zen-groups-filter-menu__action-button-back",
|
|
141
147
|
title: title,
|
|
142
148
|
children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, {
|
|
@@ -156,7 +162,7 @@ const GroupsFilterCurrentlySelectedState = ({
|
|
|
156
162
|
};
|
|
157
163
|
return (0, jsx_runtime_1.jsxs)("div", {
|
|
158
164
|
className: "zen-groups-filter-menu__content-selected",
|
|
159
|
-
children: [getActionButton(translate("Back"), translate("Back"), iconBackArrow_1.IconBackArrow, onBackButtonClick), (0, jsx_runtime_1.jsx)("div", {
|
|
165
|
+
children: [getActionButton(translate("Back"), translate("Back"), iconBackArrow_1.IconBackArrow, onBackButtonClick, handleBackButtonKeyDown), (0, jsx_runtime_1.jsx)("div", {
|
|
160
166
|
className: "zen-groups-filter-menu__item-wrapper",
|
|
161
167
|
children: (0, jsx_runtime_1.jsx)(toggleButtonRaw_1.ToggleButtonRaw, {
|
|
162
168
|
onChange: handleTogglerChange,
|
|
@@ -192,14 +192,30 @@ injectString("tr", "Select Filters:", "Se\xE7ili Filtreler:");
|
|
|
192
192
|
injectString("zh-Hans", "Select Filters:", "\u9009\u4E2D\u7684\u7B5B\u9009\u5668\uFF1A");
|
|
193
193
|
injectString("zh-TW", "Select Filters:", "\u9078\u64C7\u7BE9\u9078\u689D\u4EF6\uFF1A");
|
|
194
194
|
injectString("ro-RO", "Select Filters:", "Selecta\u021Bi filtrele:");
|
|
195
|
+
injectString("cs", "Results", "V\xFDsledky");
|
|
195
196
|
injectString("da-DK", "Results", "Resultater");
|
|
197
|
+
injectString("de", "Results", "Ergebnisse");
|
|
196
198
|
injectString("en", "Results", "Results");
|
|
199
|
+
injectString("es", "Results", "Resultados");
|
|
197
200
|
injectString("fi-FI", "Results", "Tulokset");
|
|
201
|
+
injectString("fr", "Results", "R\xE9sultats");
|
|
202
|
+
injectString("fr-FR", "Results", "R\xE9sultats");
|
|
198
203
|
injectString("hu-HU", "Results", "Eredm\xE9nyek");
|
|
204
|
+
injectString("id", "Results", "Hasil");
|
|
205
|
+
injectString("it", "Results", "Risultati");
|
|
206
|
+
injectString("ja", "Results", "\u7D50\u679C");
|
|
199
207
|
injectString("ko-KR", "Results", "\uACB0\uACFC");
|
|
208
|
+
injectString("ms", "Results", "Keputusan");
|
|
200
209
|
injectString("nb-NO", "Results", "Resultater");
|
|
210
|
+
injectString("nl", "Results", "Resultaten");
|
|
211
|
+
injectString("pl", "Results", "Wyniki");
|
|
212
|
+
injectString("pt-BR", "Results", "Resultados");
|
|
201
213
|
injectString("pt-PT", "Results", "Resultados");
|
|
202
214
|
injectString("sk-SK", "Results", "V\xFDsledky");
|
|
215
|
+
injectString("sv", "Results", "Resultat");
|
|
216
|
+
injectString("th", "Results", "\u0E1C\u0E25\u0E25\u0E31\u0E1E\u0E18\u0E4C");
|
|
217
|
+
injectString("tr", "Results", "Sonu\xE7lar");
|
|
218
|
+
injectString("zh-Hans", "Results", "\u7ED3\u679C");
|
|
203
219
|
injectString("zh-TW", "Results", "\u7D50\u679C");
|
|
204
220
|
injectString("ro-RO", "Results", "Rezultate");
|
|
205
221
|
const iconGlobe_1 = require("../icons/deprecated/iconGlobe");
|
|
@@ -298,6 +298,7 @@ const GroupsFilterRaw = props => {
|
|
|
298
298
|
const inputRef = (0, react_1.useRef)(null);
|
|
299
299
|
const emptyInputRef = (0, react_1.useRef)(null);
|
|
300
300
|
const triggerRef = (0, react_1.useRef)(null);
|
|
301
|
+
const nextFocusableItemRef = (0, react_1.useRef)(false);
|
|
301
302
|
const menuRef = (0, react_1.useRef)(null);
|
|
302
303
|
const prevInitialState = (0, react_1.useRef)(initialFilterStateInner);
|
|
303
304
|
const prevSearchField = (0, react_1.useRef)("");
|
|
@@ -320,6 +321,7 @@ const GroupsFilterRaw = props => {
|
|
|
320
321
|
type: uiStateActionType_1.UiStateActionType.SetStep,
|
|
321
322
|
payload: newStep
|
|
322
323
|
});
|
|
324
|
+
nextFocusableItemRef.current = true;
|
|
323
325
|
if (((_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.value) && newStep !== groupsFilterInterfaces_1.FilterMenuStep.Initial) {
|
|
324
326
|
inputRef.current.value = "";
|
|
325
327
|
dispatchUiState({
|
|
@@ -461,6 +463,7 @@ const GroupsFilterRaw = props => {
|
|
|
461
463
|
payload: id
|
|
462
464
|
});
|
|
463
465
|
handleSetStep(id ? groupsFilterInterfaces_1.FilterMenuStep.Adjustment : groupsFilterInterfaces_1.FilterMenuStep.Initial);
|
|
466
|
+
nextFocusableItemRef.current = true;
|
|
464
467
|
}, [dispatchUiState, handleSetStep]);
|
|
465
468
|
const handleCheckboxItemAdjustmentClick = (0, react_1.useCallback)(value => {
|
|
466
469
|
if (value.id === groupsFilterBox_1.ADVANCED_FILTER_ID) {
|
|
@@ -493,6 +496,7 @@ const GroupsFilterRaw = props => {
|
|
|
493
496
|
}, [dispatchState, dispatchUiState, state.advancedFilterState, state.frozenState.advancedFilterState, uiState.uncheckedAdvancedState, uiState.uncheckedAdjustmentIds]);
|
|
494
497
|
const basicHandleBackButtonClick = (0, react_1.useCallback)(() => {
|
|
495
498
|
handleSetStep(groupsFilterInterfaces_1.FilterMenuStep.Initial);
|
|
499
|
+
nextFocusableItemRef.current = "button.zen-groups-filter-menu__currently-selected-button";
|
|
496
500
|
}, [handleSetStep]);
|
|
497
501
|
const handleBackButtonClick = (0, react_1.useCallback)(() => {
|
|
498
502
|
const currentEl = uiState.currentAdjustmentId ? (0, stateReducerHelper_1.getGroupsTreeItem)(state, uiState.currentAdjustmentId) : undefined;
|
|
@@ -506,6 +510,11 @@ const GroupsFilterRaw = props => {
|
|
|
506
510
|
payload: isNotRoot ? currentEl.parent.id : undefined
|
|
507
511
|
});
|
|
508
512
|
handleSetStep(isNotRoot ? groupsFilterInterfaces_1.FilterMenuStep.Adjustment : groupsFilterInterfaces_1.FilterMenuStep.Initial);
|
|
513
|
+
if (!isNotRoot) {
|
|
514
|
+
nextFocusableItemRef.current = `button[data-btn=${uiState.currentAdjustmentId}]`;
|
|
515
|
+
return;
|
|
516
|
+
}
|
|
517
|
+
nextFocusableItemRef.current = true;
|
|
509
518
|
}, [basicHandleBackButtonClick, handleSetStep, state, uiState.currentAdjustmentId]);
|
|
510
519
|
const handleHomeButtonClick = (0, react_1.useCallback)(() => {
|
|
511
520
|
handleSetStep(groupsFilterInterfaces_1.FilterMenuStep.Initial);
|
|
@@ -513,6 +522,7 @@ const GroupsFilterRaw = props => {
|
|
|
513
522
|
type: uiStateActionType_1.UiStateActionType.SetCurrentAdjustmentId,
|
|
514
523
|
payload: undefined
|
|
515
524
|
});
|
|
525
|
+
nextFocusableItemRef.current = true;
|
|
516
526
|
}, [handleSetStep, uiState.currentAdjustmentId, dispatchUiState]);
|
|
517
527
|
const handleCurrentlySelectedClick = (0, react_1.useCallback)(() => {
|
|
518
528
|
handleSetStep(groupsFilterInterfaces_1.FilterMenuStep.CurrentlySelected);
|
|
@@ -714,6 +724,23 @@ const GroupsFilterRaw = props => {
|
|
|
714
724
|
}
|
|
715
725
|
(_c = inputRef.current) === null || _c === void 0 ? void 0 : _c.focus();
|
|
716
726
|
}, [inputRef]);
|
|
727
|
+
const handleFocusOnPopup = (0, react_1.useCallback)(() => {
|
|
728
|
+
var _a;
|
|
729
|
+
const firstFocusable = (_a = menuRef.current) === null || _a === void 0 ? void 0 : _a.querySelector(focusableSelector_1.FOCUSABLE_SELECTOR);
|
|
730
|
+
firstFocusable === null || firstFocusable === void 0 ? void 0 : firstFocusable.focus();
|
|
731
|
+
}, [menuRef]);
|
|
732
|
+
(0, react_1.useEffect)(() => {
|
|
733
|
+
var _a, _b, _c;
|
|
734
|
+
if (nextFocusableItemRef.current) {
|
|
735
|
+
const firstFocusable = chip || isMobile ? (_a = menuRef.current) === null || _a === void 0 ? void 0 : _a.querySelectorAll(focusableSelector_1.FOCUSABLE_SELECTOR)[1] : (_b = menuRef.current) === null || _b === void 0 ? void 0 : _b.querySelector(focusableSelector_1.FOCUSABLE_SELECTOR);
|
|
736
|
+
const nextFocusable = typeof nextFocusableItemRef.current === "string" ? (_c = menuRef.current) === null || _c === void 0 ? void 0 : _c.querySelector(nextFocusableItemRef.current) : firstFocusable;
|
|
737
|
+
if (nextFocusable) {
|
|
738
|
+
nextFocusable.focus();
|
|
739
|
+
nextFocusableItemRef.current = false;
|
|
740
|
+
return;
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
}, [uiState.currentAdjustmentId, chip, menuRef, nextFocusableItemRef, isMobile]);
|
|
717
744
|
(0, react_1.useEffect)(() => {
|
|
718
745
|
var _a, _b, _c, _d;
|
|
719
746
|
if (!uiState.isOpen) {
|
|
@@ -723,13 +750,18 @@ const GroupsFilterRaw = props => {
|
|
|
723
750
|
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
724
751
|
prevSearchField.current = uiState.searchValue;
|
|
725
752
|
} else {
|
|
726
|
-
const firstFocusable = chip ? (_b = menuRef.current) === null || _b === void 0 ? void 0 : _b.querySelectorAll(focusableSelector_1.FOCUSABLE_SELECTOR)[1] : (_c = menuRef.current) === null || _c === void 0 ? void 0 : _c.querySelector(focusableSelector_1.FOCUSABLE_SELECTOR);
|
|
753
|
+
const firstFocusable = chip || isMobile ? (_b = menuRef.current) === null || _b === void 0 ? void 0 : _b.querySelectorAll(focusableSelector_1.FOCUSABLE_SELECTOR)[1] : (_c = menuRef.current) === null || _c === void 0 ? void 0 : _c.querySelector(focusableSelector_1.FOCUSABLE_SELECTOR);
|
|
727
754
|
prevSearchField.current = "";
|
|
728
|
-
if (
|
|
729
|
-
|
|
755
|
+
if (nextFocusableItemRef.current) {
|
|
756
|
+
const nextFocusable = typeof nextFocusableItemRef.current === "string" ? (_d = menuRef.current) === null || _d === void 0 ? void 0 : _d.querySelector(nextFocusableItemRef.current) : firstFocusable;
|
|
757
|
+
if (nextFocusable) {
|
|
758
|
+
nextFocusable.focus();
|
|
759
|
+
nextFocusableItemRef.current = false;
|
|
760
|
+
return;
|
|
761
|
+
}
|
|
730
762
|
}
|
|
731
763
|
}
|
|
732
|
-
}, [uiState.searchValue, uiState.isOpen, uiState.step, handleSetStep, chip]);
|
|
764
|
+
}, [uiState.searchValue, uiState.isOpen, uiState.step, handleSetStep, chip, isMobile]);
|
|
733
765
|
(0, react_1.useEffect)(() => {
|
|
734
766
|
var _a;
|
|
735
767
|
uiState.isOpen && ((_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus());
|
|
@@ -763,6 +795,7 @@ const GroupsFilterRaw = props => {
|
|
|
763
795
|
const selectedCount = (0, stateReducerHelper_1.getFrozenCount)(state);
|
|
764
796
|
const isStateHasData = Object.keys(state.groupsMap).length > 0;
|
|
765
797
|
const isApplyDisabled = !(0, stateReducerHelper_1.isStateChanged)(state);
|
|
798
|
+
const isDataEmpty = dataItems.length === 0;
|
|
766
799
|
const memoizedContent = (0, react_1.useMemo)(() => (0, jsx_runtime_1.jsxs)("div", {
|
|
767
800
|
className: (0, classNames_1.classNames)(["zen-groups-filter-menu", isMobile ? "zen-groups-filter-menu--mobile" : ""]),
|
|
768
801
|
ref: menuRef,
|
|
@@ -776,7 +809,7 @@ const GroupsFilterRaw = props => {
|
|
|
776
809
|
id: groupsFilterId,
|
|
777
810
|
placeholder: translate("Filter by group")
|
|
778
811
|
})
|
|
779
|
-
}) : null, isStateHasData && !uiState.hasError && (0, jsx_runtime_1.jsxs)(groupsFilterMenu_1.GroupsFilterMenu, {
|
|
812
|
+
}) : null, isStateHasData && !uiState.hasError && !(uiState.isLoading && isDataEmpty) && (0, jsx_runtime_1.jsxs)(groupsFilterMenu_1.GroupsFilterMenu, {
|
|
780
813
|
onCancelClick: handleCancel,
|
|
781
814
|
onApplyClick: handleApply,
|
|
782
815
|
onResetClick: handleReset,
|
|
@@ -806,10 +839,10 @@ const GroupsFilterRaw = props => {
|
|
|
806
839
|
onRelationChange: onRelationChange,
|
|
807
840
|
children: getGroupsBox()
|
|
808
841
|
})]
|
|
809
|
-
}), !uiState.hasError && !isStateHasData && !Object.keys(state.groupsMap).length && (0, jsx_runtime_1.jsx)(skeletonList_1.SkeletonList, {
|
|
842
|
+
}), (!uiState.hasError && !isStateHasData && !Object.keys(state.groupsMap).length || uiState.isLoading && isDataEmpty) && (0, jsx_runtime_1.jsx)(skeletonList_1.SkeletonList, {
|
|
810
843
|
className: "zen-groups-filter__waiting"
|
|
811
844
|
})]
|
|
812
|
-
}), [isMobile, chip, onSearchChipChange, uiState.searchValue, uiState.hasError, uiState.step, uiState.currentAdjustmentId, groupsFilterId, translate, isStateHasData, handleCancel, handleApply, handleReset, isApplyDisabled, state, handleAdvancedDialogOpen, handleCurrentlySelectedClick, getSearchResult, getGroupsBox, handleBackButtonClick, handleHomeButtonClick, selectAllHandler, basicHandleBackButtonClick]);
|
|
845
|
+
}), [isMobile, chip, onSearchChipChange, uiState.searchValue, uiState.hasError, uiState.step, uiState.currentAdjustmentId, groupsFilterId, translate, isStateHasData, handleCancel, handleApply, handleReset, isApplyDisabled, state, handleAdvancedDialogOpen, handleCurrentlySelectedClick, getSearchResult, getGroupsBox, handleBackButtonClick, handleHomeButtonClick, selectAllHandler, basicHandleBackButtonClick, uiState.isLoading, isDataEmpty]);
|
|
813
846
|
const memoizedFooterButtons = (0, react_1.useMemo)(() => (0, jsx_runtime_1.jsxs)(footerButtons_1.FooterButtons, {
|
|
814
847
|
children: [(0, jsx_runtime_1.jsx)(button_1.Button, {
|
|
815
848
|
onClick: handleApply,
|
|
@@ -887,7 +920,7 @@ const GroupsFilterRaw = props => {
|
|
|
887
920
|
isOpen: uiState.isOpen,
|
|
888
921
|
className: (0, classNames_1.classNames)(["zen-groups-filter__popup", uiState.isOpenAdvancedFilter ? "zen-groups-filter__popup--inactive" : "", classNamePopup || ""]),
|
|
889
922
|
onOpenChange: onOptionsToggle,
|
|
890
|
-
useTrapFocusWithTrigger: uiState.isOpenAdvancedFilter ? "off" : "
|
|
923
|
+
useTrapFocusWithTrigger: uiState.isOpenAdvancedFilter ? "off" : "none",
|
|
891
924
|
shouldHoldScroll: true,
|
|
892
925
|
triggerRef: triggerRef,
|
|
893
926
|
ariaLabel: translate("Organization groups filter"),
|
|
@@ -928,7 +961,8 @@ const GroupsFilterRaw = props => {
|
|
|
928
961
|
ref: triggerRef,
|
|
929
962
|
fullSize: fullSize,
|
|
930
963
|
placeholder: groupPlaceHolder,
|
|
931
|
-
popupId: popupId
|
|
964
|
+
popupId: popupId,
|
|
965
|
+
handleFocusOnPopup: handleFocusOnPopup
|
|
932
966
|
}), isMobile ? memoizedMobileView : memoizedDesktopView, uiState.isOpenAdvancedFilter && getAdvancedDialog]
|
|
933
967
|
});
|
|
934
968
|
};
|
|
@@ -15,9 +15,10 @@ interface IGroupsFilterTrigger {
|
|
|
15
15
|
ref?: React.RefObject<HTMLDivElement | null>;
|
|
16
16
|
isError?: boolean;
|
|
17
17
|
popupId?: string;
|
|
18
|
+
handleFocusOnPopup?: () => void;
|
|
18
19
|
}
|
|
19
20
|
export declare const GroupsFilterTrigger: {
|
|
20
|
-
({ value, className, onChange, placeholder, isOpenPopup, count, withGlobeIcon, inputRef, handleClick, fullSize, ref, isError, popupId, ...otherProps }: IGroupsFilterTrigger): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
({ value, className, onChange, placeholder, isOpenPopup, count, withGlobeIcon, inputRef, handleClick, fullSize, ref, isError, popupId, handleFocusOnPopup, ...otherProps }: IGroupsFilterTrigger): import("react/jsx-runtime").JSX.Element;
|
|
21
22
|
displayName: string;
|
|
22
23
|
};
|
|
23
24
|
export declare const TRANSLATIONS: string[];
|
|
@@ -89,9 +89,10 @@ const GroupsFilterTrigger = _a => {
|
|
|
89
89
|
fullSize,
|
|
90
90
|
ref,
|
|
91
91
|
isError,
|
|
92
|
-
popupId
|
|
92
|
+
popupId,
|
|
93
|
+
handleFocusOnPopup
|
|
93
94
|
} = _a,
|
|
94
|
-
otherProps = __rest(_a, ["value", "className", "onChange", "placeholder", "isOpenPopup", "count", "withGlobeIcon", "inputRef", "handleClick", "fullSize", "ref", "isError", "popupId"]);
|
|
95
|
+
otherProps = __rest(_a, ["value", "className", "onChange", "placeholder", "isOpenPopup", "count", "withGlobeIcon", "inputRef", "handleClick", "fullSize", "ref", "isError", "popupId", "handleFocusOnPopup"]);
|
|
95
96
|
const {
|
|
96
97
|
translate
|
|
97
98
|
} = (0, useLanguage_1.useLanguage)();
|
|
@@ -101,10 +102,20 @@ const GroupsFilterTrigger = _a => {
|
|
|
101
102
|
if (e.key === "Enter" && !isOpenPopup) {
|
|
102
103
|
handleClick();
|
|
103
104
|
}
|
|
105
|
+
if (e.key === "ArrowDown" && !isOpenPopup) {
|
|
106
|
+
handleClick();
|
|
107
|
+
}
|
|
108
|
+
if (e.key === "ArrowDown" && isOpenPopup) {
|
|
109
|
+
handleFocusOnPopup === null || handleFocusOnPopup === void 0 ? void 0 : handleFocusOnPopup();
|
|
110
|
+
}
|
|
104
111
|
if (e.key === "Escape" && isOpenPopup && e.nativeEvent) {
|
|
105
112
|
e.nativeEvent.stopImmediatePropagation();
|
|
106
113
|
handleClick();
|
|
107
114
|
}
|
|
115
|
+
if (e.key === "Tab" && isOpenPopup) {
|
|
116
|
+
e.preventDefault();
|
|
117
|
+
handleFocusOnPopup === null || handleFocusOnPopup === void 0 ? void 0 : handleFocusOnPopup();
|
|
118
|
+
}
|
|
108
119
|
};
|
|
109
120
|
const clickHandler = e => {
|
|
110
121
|
if (e.target === inputRef.current && isOpenPopup) {
|