@geotab/zenith 3.7.0-beta.0 → 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 +1 -0
- 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/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/groupsFilterInitialState.js +16 -0
- package/dist/groupsFilterRaw/groupsFilterTrigger.js +4 -0
- package/dist/index.css +14 -0
- package/dist/nav/navItem/navItem.d.ts +1 -0
- package/dist/nav/navItem/navItem.js +4 -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/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/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/groupsFilterInitialState.js +16 -0
- package/esm/groupsFilterRaw/groupsFilterTrigger.js +4 -0
- package/esm/nav/navItem/navItem.d.ts +1 -0
- package/esm/nav/navItem/navItem.js +5 -2
- 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 +1 -4
|
@@ -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;
|
|
@@ -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");
|
|
@@ -112,6 +112,10 @@ const GroupsFilterTrigger = _a => {
|
|
|
112
112
|
e.nativeEvent.stopImmediatePropagation();
|
|
113
113
|
handleClick();
|
|
114
114
|
}
|
|
115
|
+
if (e.key === "Tab" && isOpenPopup) {
|
|
116
|
+
e.preventDefault();
|
|
117
|
+
handleFocusOnPopup === null || handleFocusOnPopup === void 0 ? void 0 : handleFocusOnPopup();
|
|
118
|
+
}
|
|
115
119
|
};
|
|
116
120
|
const clickHandler = e => {
|
|
117
121
|
if (e.target === inputRef.current && isOpenPopup) {
|
package/dist/index.css
CHANGED
|
@@ -6721,6 +6721,13 @@
|
|
|
6721
6721
|
.zen-checkbox-list-with-action__color-info--hidden {
|
|
6722
6722
|
display: none;
|
|
6723
6723
|
}
|
|
6724
|
+
.zen-checkbox-list-with-action__sr-only {
|
|
6725
|
+
position: absolute;
|
|
6726
|
+
left: -9999px;
|
|
6727
|
+
width: 1px;
|
|
6728
|
+
height: 1px;
|
|
6729
|
+
opacity: 0;
|
|
6730
|
+
}
|
|
6724
6731
|
.zen-checkbox-list-with-action.zen-checkbox-list-with-action--drive .zen-checkbox-list-with-action__action-checkbox,
|
|
6725
6732
|
.zen-checkbox-list-with-action.zen-checkbox-list-with-action--drive-tablet .zen-checkbox-list-with-action__action-checkbox {
|
|
6726
6733
|
height: 60px;
|
|
@@ -6860,6 +6867,13 @@
|
|
|
6860
6867
|
.zen-dropdown-list__item--end {
|
|
6861
6868
|
justify-content: flex-end;
|
|
6862
6869
|
}
|
|
6870
|
+
.zen-dropdown-list__sentinel-item {
|
|
6871
|
+
position: "absolute";
|
|
6872
|
+
left: "-9999px";
|
|
6873
|
+
width: "1px";
|
|
6874
|
+
height: "1px";
|
|
6875
|
+
opacity: 0;
|
|
6876
|
+
}
|
|
6863
6877
|
.zen-dropdown-list__action-label {
|
|
6864
6878
|
font-family: var(--main-font);
|
|
6865
6879
|
font-size: 14px;
|
|
@@ -27,6 +27,7 @@ export interface ILinkNavItem extends INavItemCommon {
|
|
|
27
27
|
export interface IButtonNavItem extends INavItemCommon {
|
|
28
28
|
onClick?: () => void;
|
|
29
29
|
menuAlignment?: TAlignment;
|
|
30
|
+
onDropdownStateChange?: (isOpen: boolean) => void;
|
|
30
31
|
}
|
|
31
32
|
interface INavItemContext {
|
|
32
33
|
parentLevel?: number;
|
|
@@ -73,9 +73,12 @@ const LinkNavItem = (_a) => {
|
|
|
73
73
|
};
|
|
74
74
|
LinkNavItem.displayName = "LinkNavItem";
|
|
75
75
|
const ButtonNavItem = (_a) => {
|
|
76
|
-
var { className, title, onClick, collapsed, active, children, tabIndex, menuAlignment = "right-top", isMenuItem = true, tooltipAlignment = defaultTooltipAlignment, actionIcon, actionIconTitle, onActionIconClick } = _a, rest = __rest(_a, ["className", "title", "onClick", "collapsed", "active", "children", "tabIndex", "menuAlignment", "isMenuItem", "tooltipAlignment", "actionIcon", "actionIconTitle", "onActionIconClick"]);
|
|
76
|
+
var { className, title, onClick, collapsed, active, children, tabIndex, menuAlignment = "right-top", isMenuItem = true, tooltipAlignment = defaultTooltipAlignment, actionIcon, actionIconTitle, onActionIconClick, onDropdownStateChange } = _a, rest = __rest(_a, ["className", "title", "onClick", "collapsed", "active", "children", "tabIndex", "menuAlignment", "isMenuItem", "tooltipAlignment", "actionIcon", "actionIconTitle", "onActionIconClick", "onDropdownStateChange"]);
|
|
77
77
|
const [menuOpen, setMenuOpen] = (0, react_1.useState)(false);
|
|
78
78
|
const { parentLevel = 0, closeParentMenu } = (0, react_1.useContext)(exports.NavItemContext);
|
|
79
|
+
(0, react_1.useEffect)(() => {
|
|
80
|
+
onDropdownStateChange === null || onDropdownStateChange === void 0 ? void 0 : onDropdownStateChange(menuOpen);
|
|
81
|
+
}, [menuOpen, onDropdownStateChange]);
|
|
79
82
|
const triggerRef = (0, react_1.useRef)(null);
|
|
80
83
|
const currentLevel = parentLevel + 1;
|
|
81
84
|
const validChildren = react_1.Children.toArray(children).filter(child => {
|
|
@@ -316,5 +316,6 @@
|
|
|
316
316
|
"This filter is currently applied.": "This filter is currently applied.",
|
|
317
317
|
"Remove filter": "Remove filter",
|
|
318
318
|
"Exit full screen table view": "Exit full screen table view",
|
|
319
|
-
"Close search": "Close search"
|
|
319
|
+
"Close search": "Close search",
|
|
320
|
+
"Has additional actions. Use right arrow to access button, left arrow to return.": "Has additional actions. Use right arrow to access button, left arrow to return."
|
|
320
321
|
}
|
|
@@ -13,5 +13,7 @@ export interface ICheckbox extends IZenComponentProps {
|
|
|
13
13
|
reverse?: boolean;
|
|
14
14
|
onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
15
15
|
wrapped?: boolean;
|
|
16
|
+
tabIndex?: number;
|
|
17
|
+
describedBy?: string;
|
|
16
18
|
}
|
|
17
|
-
export declare const Checkbox: ({ reverse, fullWidth, id, checked, indeterminate, title, className, children, disabled, wrapped, ...rest }: ICheckbox) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export declare const Checkbox: ({ reverse, fullWidth, id, checked, indeterminate, title, className, children, disabled, wrapped, describedBy, ...rest }: ICheckbox) => import("react/jsx-runtime").JSX.Element;
|
package/esm/checkbox/checkbox.js
CHANGED
|
@@ -20,20 +20,17 @@ import { CheckboxIconCheckmark } from "./checkboxIconCheckmark";
|
|
|
20
20
|
import { CheckboxIconMinus } from "./checkboxIconMinus";
|
|
21
21
|
import { useMobile } from "../commonHelpers/hooks/useMobile";
|
|
22
22
|
export const Checkbox = (_a) => {
|
|
23
|
-
var { reverse, fullWidth, id, checked, indeterminate, title, className = "", children, disabled, wrapped } = _a, rest = __rest(_a, ["reverse", "fullWidth", "id", "checked", "indeterminate", "title", "className", "children", "disabled", "wrapped"]);
|
|
23
|
+
var { reverse, fullWidth, id, checked, indeterminate, title, className = "", children, disabled, wrapped, describedBy } = _a, rest = __rest(_a, ["reverse", "fullWidth", "id", "checked", "indeterminate", "title", "className", "children", "disabled", "wrapped", "describedBy"]);
|
|
24
24
|
const state = getCheckboxState(checked, indeterminate);
|
|
25
25
|
const generatedId = React.useId();
|
|
26
26
|
const intId = id || generatedId;
|
|
27
27
|
const driveClasses = useDriveClassName("zen-checkbox");
|
|
28
28
|
const isMobile = useMobile();
|
|
29
29
|
const checkboxIconClasses = useMemo(() => classNames(["zen-checkbox__icon", disabled ? "zen-checkbox__icon--disabled" : ""]), [disabled]);
|
|
30
|
-
const checkbox = _jsx(TriStateCheckbox, Object.assign({ className: "zen-checkbox__input", id: intId, checked: checked, indeterminate: indeterminate, disabled: disabled, "aria-label": title }, rest));
|
|
31
|
-
const iconAndLabel = _jsxs(_Fragment, { children: [_jsx("div", { className: "zen-checkbox__box", children: state === CheckboxState.Indeterminate ? _jsx(CheckboxIconMinus, { className: checkboxIconClasses, size: driveClasses ? "bigger" : "medium" }) :
|
|
32
|
-
state === CheckboxState.On ? _jsx(CheckboxIconCheckmark, { className: checkboxIconClasses, size: driveClasses ? "bigger" : "medium" }) : null }), children
|
|
33
|
-
? _jsx("div", { className: classNames(["zen-checkbox__label-text", fullWidth ? "zen-checkbox__label-text--full-width" : ""]), children: children })
|
|
34
|
-
: null] });
|
|
30
|
+
const checkbox = (_jsx(TriStateCheckbox, Object.assign({ className: "zen-checkbox__input", id: intId, checked: checked, indeterminate: indeterminate, disabled: disabled, "aria-label": title, "aria-describedby": describedBy }, rest)));
|
|
31
|
+
const iconAndLabel = (_jsxs(_Fragment, { children: [_jsx("div", { className: "zen-checkbox__box", children: state === CheckboxState.Indeterminate ? (_jsx(CheckboxIconMinus, { className: checkboxIconClasses, size: driveClasses ? "bigger" : "medium" })) : state === CheckboxState.On ? (_jsx(CheckboxIconCheckmark, { className: checkboxIconClasses, size: driveClasses ? "bigger" : "medium" })) : null }), children ? _jsx("div", { className: classNames(["zen-checkbox__label-text", fullWidth ? "zen-checkbox__label-text--full-width" : ""]), children: children }) : null] }));
|
|
35
32
|
if (wrapped) {
|
|
36
|
-
return _jsxs("label", { className: classNames(["zen-checkbox", driveClasses || "", className]), title: title, children: [checkbox, _jsx("div", { className: classNames(["zen-checkbox__label", reverse ? "zen-checkbox__label--reverse" : ""]), children: iconAndLabel })] });
|
|
33
|
+
return (_jsxs("label", { className: classNames(["zen-checkbox", driveClasses || "", className]), title: title, children: [checkbox, _jsx("div", { className: classNames(["zen-checkbox__label", reverse ? "zen-checkbox__label--reverse" : ""]), children: iconAndLabel })] }));
|
|
37
34
|
}
|
|
38
|
-
return _jsxs("div", { className: classNames(["zen-checkbox", isMobile && !driveClasses ? "zen-checkbox--mobile" : "", driveClasses || "", className]), children: [checkbox, _jsx("label", { className: classNames(["zen-checkbox__label", reverse ? "zen-checkbox__label--reverse" : ""]), htmlFor: intId, title: title, children: iconAndLabel })] });
|
|
35
|
+
return (_jsxs("div", { className: classNames(["zen-checkbox", isMobile && !driveClasses ? "zen-checkbox--mobile" : "", driveClasses || "", className]), children: [checkbox, _jsx("label", { className: classNames(["zen-checkbox__label", reverse ? "zen-checkbox__label--reverse" : ""]), htmlFor: intId, title: title, children: iconAndLabel })] }));
|
|
39
36
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import "./checkboxListWithAction.less";
|
|
2
3
|
import { IZenComponentProps } from "../commonHelpers/zenComponent";
|
|
3
4
|
import { IColor } from "../groupsFilterRaw/groupsFilterInterfaces";
|
|
@@ -23,6 +24,7 @@ export interface ICheckboxListWithAction extends IZenComponentProps {
|
|
|
23
24
|
search?: string[];
|
|
24
25
|
onChange: (value: IChangeCheckbox) => void;
|
|
25
26
|
onClick: (id: string) => void;
|
|
27
|
+
handleTab?: (e: React.KeyboardEvent, shift?: boolean) => void;
|
|
26
28
|
}
|
|
27
|
-
export declare const CheckboxListWithAction: ({ label, options, onChange, onClick, search, className }: ICheckboxListWithAction) => import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
export declare const CheckboxListWithAction: ({ label, options, onChange, onClick, search, className, handleTab }: ICheckboxListWithAction) => import("react/jsx-runtime").JSX.Element;
|
|
28
30
|
export declare const TRANSLATIONS: string[];
|