@geotab/zenith 3.0.1-beta.4 → 3.1.0-beta.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.
Files changed (262) hide show
  1. package/README.md +17 -0
  2. package/dist/advancedGroupsFilter/advancedGroupsFilter.d.ts +1 -0
  3. package/dist/advancedGroupsFilter/advancedGroupsFilter.js +2 -2
  4. package/dist/advancedGroupsFilter/advancedGroupsFilterFormSection.js +3 -1
  5. package/dist/chip/chip.js +5 -5
  6. package/dist/commonStyles/zIndex.less +5 -0
  7. package/dist/dateInput/dateInput.d.ts +2 -1
  8. package/dist/dateInput/dateInput.js +11 -2
  9. package/dist/dateRange/dateRange.js +9 -8
  10. package/dist/dropdown/dropdown.d.ts +2 -0
  11. package/dist/dropdown/dropdown.js +6 -5
  12. package/dist/dropdown/dropdownHelper.d.ts +4 -4
  13. package/dist/dropdown/dropdownHelper.js +2 -1
  14. package/dist/dropdown/dropdownList.js +2 -2
  15. package/dist/dropdown/dropdownPopup.d.ts +1 -0
  16. package/dist/dropdown/dropdownPopup.js +2 -2
  17. package/dist/dropdown/dropdownSearchableTrigger.js +1 -1
  18. package/dist/dropdown/stateReducer/stateReducer.d.ts +6 -2
  19. package/dist/dropdown/stateReducer/stateReducer.js +28 -42
  20. package/dist/dropdown/stateReducer/stateReducerHelper.d.ts +2 -0
  21. package/dist/dropdown/stateReducer/stateReducerHelper.js +12 -1
  22. package/dist/dropdown/useDropdownState.d.ts +1 -1
  23. package/dist/dropdown/useDropdownState.js +5 -2
  24. package/dist/filters/components/filtersContainer.d.ts +1 -0
  25. package/dist/filters/components/filtersContainer.js +10 -11
  26. package/dist/filters/components/filtersDateInput.d.ts +10 -0
  27. package/dist/filters/components/filtersDateInput.js +27 -0
  28. package/dist/filters/components/filtersDropdown.d.ts +5 -4
  29. package/dist/filters/components/filtersDropdown.js +3 -3
  30. package/dist/filters/components/filtersEmptySelectedList.d.ts +2 -0
  31. package/dist/filters/components/filtersEmptySelectedList.js +11 -0
  32. package/dist/filters/components/filtersItem.d.ts +5 -4
  33. package/dist/filters/components/filtersItem.js +2 -1
  34. package/dist/filters/components/filtersSaveModal.d.ts +3 -1
  35. package/dist/filters/components/filtersSaveModal.js +2 -2
  36. package/dist/filters/components/filtersSavedChipComponent.js +68 -6
  37. package/dist/filters/components/filtersSearch.d.ts +4 -4
  38. package/dist/filters/components/filtersSearch.js +20 -9
  39. package/dist/filters/components/filtersSearchItemData.js +18 -1
  40. package/dist/filters/components/filtersSearchList.d.ts +5 -1
  41. package/dist/filters/components/filtersSearchList.js +155 -27
  42. package/dist/filters/components/filtersSelect.d.ts +1 -0
  43. package/dist/filters/components/filtersSelect.js +35 -7
  44. package/dist/filters/components/filtersSelectListItem.d.ts +21 -15
  45. package/dist/filters/components/filtersSelectListItem.js +13 -3
  46. package/dist/filters/components/filtersSidePanel.d.ts +15 -0
  47. package/dist/filters/components/filtersSidePanel.js +212 -0
  48. package/dist/filters/components/filtersSidePanelChip.d.ts +9 -0
  49. package/dist/filters/components/filtersSidePanelChip.js +13 -0
  50. package/dist/filters/components/filtersSidePanelDropdown.d.ts +6 -0
  51. package/dist/filters/components/filtersSidePanelDropdown.js +85 -0
  52. package/dist/filters/components/filtersSidePanelItem.d.ts +16 -0
  53. package/dist/filters/components/filtersSidePanelItem.js +67 -0
  54. package/dist/filters/components/filtersSidePanelRange.d.ts +6 -0
  55. package/dist/filters/components/filtersSidePanelRange.js +28 -0
  56. package/dist/filters/filters.d.ts +5 -0
  57. package/dist/filters/filters.js +101 -38
  58. package/dist/filters/filtersHelper.d.ts +4 -2
  59. package/dist/filters/filtersHelper.js +40 -1
  60. package/dist/filters/filtersHooks.d.ts +12 -2
  61. package/dist/filters/filtersHooks.js +21 -3
  62. package/dist/formStepper/formStepper.d.ts +1 -1
  63. package/dist/formStepper/formStepper.js +5 -2
  64. package/dist/groupsFilter/groupsFilter.js +72 -37
  65. package/dist/groupsFilter/groupsFilterMenu.d.ts +1 -0
  66. package/dist/groupsFilter/groupsFilterMenu.js +2 -2
  67. package/dist/groupsFilter/groupsFilterTrigger.js +1 -1
  68. package/dist/images/imageLooking.d.ts +4 -0
  69. package/dist/images/imageLooking.js +16 -0
  70. package/dist/index.css +407 -83
  71. package/dist/index.d.ts +7 -4
  72. package/dist/index.js +26 -15
  73. package/dist/list/list.d.ts +3 -1
  74. package/dist/list/list.js +2 -2
  75. package/dist/mobileSheet/mobileSheet.d.ts +2 -0
  76. package/dist/mobileSheet/mobileSheet.js +4 -4
  77. package/dist/modal/modal.d.ts +1 -0
  78. package/dist/modal/modal.js +2 -2
  79. package/dist/radioGroup/radioGroup.d.ts +1 -0
  80. package/dist/radioGroup/radioGroup.js +3 -2
  81. package/dist/range/range.js +29 -10
  82. package/dist/searchInputRaw/searchInputRaw.js +1 -1
  83. package/dist/sidePanel/sidePanel.d.ts +1 -0
  84. package/dist/sidePanel/sidePanel.js +3 -3
  85. package/dist/tabs/tabItem/tabItem.d.ts +1 -0
  86. package/dist/tabs/tabItem/tabItem.js +2 -2
  87. package/dist/tabs/tabs.d.ts +1 -0
  88. package/dist/tabs/tabs.js +1 -1
  89. package/dist/utils/keyboardHelpers.d.ts +2 -0
  90. package/dist/utils/keyboardHelpers.js +49 -0
  91. package/dist/utils/localization/translations/cs-json.d.ts +1 -0
  92. package/dist/utils/localization/translations/cs-json.js +2 -1
  93. package/dist/utils/localization/translations/de-json.d.ts +1 -0
  94. package/dist/utils/localization/translations/de-json.js +2 -1
  95. package/dist/utils/localization/translations/en-json.d.ts +7 -0
  96. package/dist/utils/localization/translations/en-json.js +8 -1
  97. package/dist/utils/localization/translations/es-json.d.ts +1 -0
  98. package/dist/utils/localization/translations/es-json.js +2 -1
  99. package/dist/utils/localization/translations/fr-FR-json.d.ts +1 -0
  100. package/dist/utils/localization/translations/fr-FR-json.js +2 -1
  101. package/dist/utils/localization/translations/fr-json.d.ts +1 -0
  102. package/dist/utils/localization/translations/fr-json.js +2 -1
  103. package/dist/utils/localization/translations/id-json.d.ts +1 -0
  104. package/dist/utils/localization/translations/id-json.js +2 -1
  105. package/dist/utils/localization/translations/it-json.d.ts +1 -0
  106. package/dist/utils/localization/translations/it-json.js +2 -1
  107. package/dist/utils/localization/translations/ja-json.d.ts +1 -0
  108. package/dist/utils/localization/translations/ja-json.js +2 -1
  109. package/dist/utils/localization/translations/ko-KR-json.d.ts +1 -0
  110. package/dist/utils/localization/translations/ko-KR-json.js +2 -1
  111. package/dist/utils/localization/translations/ms-json.d.ts +1 -0
  112. package/dist/utils/localization/translations/ms-json.js +2 -1
  113. package/dist/utils/localization/translations/nl-json.d.ts +1 -0
  114. package/dist/utils/localization/translations/nl-json.js +2 -1
  115. package/dist/utils/localization/translations/pl-json.d.ts +1 -0
  116. package/dist/utils/localization/translations/pl-json.js +2 -1
  117. package/dist/utils/localization/translations/pt-BR-json.d.ts +1 -0
  118. package/dist/utils/localization/translations/pt-BR-json.js +2 -1
  119. package/dist/utils/localization/translations/sv-json.d.ts +1 -0
  120. package/dist/utils/localization/translations/sv-json.js +2 -1
  121. package/dist/utils/localization/translations/th-json.d.ts +1 -0
  122. package/dist/utils/localization/translations/th-json.js +2 -1
  123. package/dist/utils/localization/translations/tr-json.d.ts +1 -0
  124. package/dist/utils/localization/translations/tr-json.js +2 -1
  125. package/dist/utils/localization/translations/zh-Hans-json.d.ts +1 -0
  126. package/dist/utils/localization/translations/zh-Hans-json.js +2 -1
  127. package/dist/utils/localization/translations/zh-TW-json.d.ts +1 -0
  128. package/dist/utils/localization/translations/zh-TW-json.js +2 -1
  129. package/esm/advancedGroupsFilter/advancedGroupsFilter.d.ts +1 -0
  130. package/esm/advancedGroupsFilter/advancedGroupsFilter.js +2 -2
  131. package/esm/advancedGroupsFilter/advancedGroupsFilterFormSection.js +3 -1
  132. package/esm/chip/chip.js +5 -5
  133. package/esm/dateInput/dateInput.d.ts +2 -1
  134. package/esm/dateInput/dateInput.js +11 -2
  135. package/esm/dateRange/dateRange.js +9 -8
  136. package/esm/dropdown/dropdown.d.ts +2 -0
  137. package/esm/dropdown/dropdown.js +5 -4
  138. package/esm/dropdown/dropdownHelper.d.ts +4 -4
  139. package/esm/dropdown/dropdownHelper.js +2 -1
  140. package/esm/dropdown/dropdownList.js +2 -2
  141. package/esm/dropdown/dropdownPopup.d.ts +1 -0
  142. package/esm/dropdown/dropdownPopup.js +2 -2
  143. package/esm/dropdown/dropdownSearchableTrigger.js +1 -1
  144. package/esm/dropdown/stateReducer/stateReducer.d.ts +6 -2
  145. package/esm/dropdown/stateReducer/stateReducer.js +29 -43
  146. package/esm/dropdown/stateReducer/stateReducerHelper.d.ts +2 -0
  147. package/esm/dropdown/stateReducer/stateReducerHelper.js +10 -0
  148. package/esm/dropdown/useDropdownState.d.ts +1 -1
  149. package/esm/dropdown/useDropdownState.js +5 -2
  150. package/esm/filters/components/filtersContainer.d.ts +1 -0
  151. package/esm/filters/components/filtersContainer.js +12 -13
  152. package/esm/filters/components/filtersDateInput.d.ts +10 -0
  153. package/esm/filters/components/filtersDateInput.js +23 -0
  154. package/esm/filters/components/filtersDropdown.d.ts +5 -4
  155. package/esm/filters/components/filtersDropdown.js +3 -3
  156. package/esm/filters/components/filtersEmptySelectedList.d.ts +2 -0
  157. package/esm/filters/components/filtersEmptySelectedList.js +7 -0
  158. package/esm/filters/components/filtersItem.d.ts +5 -4
  159. package/esm/filters/components/filtersItem.js +2 -1
  160. package/esm/filters/components/filtersSaveModal.d.ts +3 -1
  161. package/esm/filters/components/filtersSaveModal.js +2 -2
  162. package/esm/filters/components/filtersSavedChipComponent.js +68 -6
  163. package/esm/filters/components/filtersSearch.d.ts +4 -4
  164. package/esm/filters/components/filtersSearch.js +20 -9
  165. package/esm/filters/components/filtersSearchItemData.js +18 -1
  166. package/esm/filters/components/filtersSearchList.d.ts +5 -1
  167. package/esm/filters/components/filtersSearchList.js +156 -28
  168. package/esm/filters/components/filtersSelect.d.ts +1 -0
  169. package/esm/filters/components/filtersSelect.js +36 -8
  170. package/esm/filters/components/filtersSelectListItem.d.ts +21 -15
  171. package/esm/filters/components/filtersSelectListItem.js +13 -3
  172. package/esm/filters/components/filtersSidePanel.d.ts +15 -0
  173. package/esm/filters/components/filtersSidePanel.js +208 -0
  174. package/esm/filters/components/filtersSidePanelChip.d.ts +9 -0
  175. package/esm/filters/components/filtersSidePanelChip.js +9 -0
  176. package/esm/filters/components/filtersSidePanelDropdown.d.ts +6 -0
  177. package/esm/filters/components/filtersSidePanelDropdown.js +81 -0
  178. package/esm/filters/components/filtersSidePanelItem.d.ts +16 -0
  179. package/esm/filters/components/filtersSidePanelItem.js +63 -0
  180. package/esm/filters/components/filtersSidePanelRange.d.ts +6 -0
  181. package/esm/filters/components/filtersSidePanelRange.js +24 -0
  182. package/esm/filters/filters.d.ts +5 -0
  183. package/esm/filters/filters.js +101 -38
  184. package/esm/filters/filtersHelper.d.ts +4 -2
  185. package/esm/filters/filtersHelper.js +37 -0
  186. package/esm/filters/filtersHooks.d.ts +12 -2
  187. package/esm/filters/filtersHooks.js +19 -2
  188. package/esm/formStepper/formStepper.d.ts +1 -1
  189. package/esm/formStepper/formStepper.js +5 -2
  190. package/esm/groupsFilter/groupsFilter.js +72 -37
  191. package/esm/groupsFilter/groupsFilterMenu.d.ts +1 -0
  192. package/esm/groupsFilter/groupsFilterMenu.js +2 -2
  193. package/esm/groupsFilter/groupsFilterTrigger.js +1 -1
  194. package/esm/images/imageLooking.d.ts +4 -0
  195. package/esm/images/imageLooking.js +12 -0
  196. package/esm/index.d.ts +7 -4
  197. package/esm/index.js +6 -3
  198. package/esm/list/list.d.ts +3 -1
  199. package/esm/list/list.js +2 -2
  200. package/esm/mobileSheet/mobileSheet.d.ts +2 -0
  201. package/esm/mobileSheet/mobileSheet.js +4 -4
  202. package/esm/modal/modal.d.ts +1 -0
  203. package/esm/modal/modal.js +2 -2
  204. package/esm/radioGroup/radioGroup.d.ts +1 -0
  205. package/esm/radioGroup/radioGroup.js +3 -2
  206. package/esm/range/range.js +29 -10
  207. package/esm/searchInputRaw/searchInputRaw.js +1 -1
  208. package/esm/sidePanel/sidePanel.d.ts +1 -0
  209. package/esm/sidePanel/sidePanel.js +3 -3
  210. package/esm/tabs/tabItem/tabItem.d.ts +1 -0
  211. package/esm/tabs/tabItem/tabItem.js +2 -2
  212. package/esm/tabs/tabs.d.ts +1 -0
  213. package/esm/tabs/tabs.js +1 -1
  214. package/esm/utils/keyboardHelpers.d.ts +2 -0
  215. package/esm/utils/keyboardHelpers.js +44 -0
  216. package/esm/utils/localization/translations/cs-json.d.ts +1 -0
  217. package/esm/utils/localization/translations/cs-json.js +2 -1
  218. package/esm/utils/localization/translations/de-json.d.ts +1 -0
  219. package/esm/utils/localization/translations/de-json.js +2 -1
  220. package/esm/utils/localization/translations/en-json.d.ts +7 -0
  221. package/esm/utils/localization/translations/en-json.js +8 -1
  222. package/esm/utils/localization/translations/es-json.d.ts +1 -0
  223. package/esm/utils/localization/translations/es-json.js +2 -1
  224. package/esm/utils/localization/translations/fr-FR-json.d.ts +1 -0
  225. package/esm/utils/localization/translations/fr-FR-json.js +2 -1
  226. package/esm/utils/localization/translations/fr-json.d.ts +1 -0
  227. package/esm/utils/localization/translations/fr-json.js +2 -1
  228. package/esm/utils/localization/translations/id-json.d.ts +1 -0
  229. package/esm/utils/localization/translations/id-json.js +2 -1
  230. package/esm/utils/localization/translations/it-json.d.ts +1 -0
  231. package/esm/utils/localization/translations/it-json.js +2 -1
  232. package/esm/utils/localization/translations/ja-json.d.ts +1 -0
  233. package/esm/utils/localization/translations/ja-json.js +2 -1
  234. package/esm/utils/localization/translations/ko-KR-json.d.ts +1 -0
  235. package/esm/utils/localization/translations/ko-KR-json.js +2 -1
  236. package/esm/utils/localization/translations/ms-json.d.ts +1 -0
  237. package/esm/utils/localization/translations/ms-json.js +2 -1
  238. package/esm/utils/localization/translations/nl-json.d.ts +1 -0
  239. package/esm/utils/localization/translations/nl-json.js +2 -1
  240. package/esm/utils/localization/translations/pl-json.d.ts +1 -0
  241. package/esm/utils/localization/translations/pl-json.js +2 -1
  242. package/esm/utils/localization/translations/pt-BR-json.d.ts +1 -0
  243. package/esm/utils/localization/translations/pt-BR-json.js +2 -1
  244. package/esm/utils/localization/translations/sv-json.d.ts +1 -0
  245. package/esm/utils/localization/translations/sv-json.js +2 -1
  246. package/esm/utils/localization/translations/th-json.d.ts +1 -0
  247. package/esm/utils/localization/translations/th-json.js +2 -1
  248. package/esm/utils/localization/translations/tr-json.d.ts +1 -0
  249. package/esm/utils/localization/translations/tr-json.js +2 -1
  250. package/esm/utils/localization/translations/zh-Hans-json.d.ts +1 -0
  251. package/esm/utils/localization/translations/zh-Hans-json.js +2 -1
  252. package/esm/utils/localization/translations/zh-TW-json.d.ts +1 -0
  253. package/esm/utils/localization/translations/zh-TW-json.js +2 -1
  254. package/package.json +6 -6
  255. package/dist/filters/components/filtersModal.d.ts +0 -17
  256. package/dist/filters/components/filtersModal.js +0 -107
  257. package/dist/filters/components/filtersModalItem.d.ts +0 -9
  258. package/dist/filters/components/filtersModalItem.js +0 -74
  259. package/esm/filters/components/filtersModal.d.ts +0 -17
  260. package/esm/filters/components/filtersModal.js +0 -103
  261. package/esm/filters/components/filtersModalItem.d.ts +0 -9
  262. package/esm/filters/components/filtersModalItem.js +0 -70
@@ -18,7 +18,8 @@ import { useDebounce } from "../commonHelpers/hooks/useDebounce";
18
18
  import { SkeletonList } from "../skeletonList/skeletonList";
19
19
  import { Chip } from "../chip/chip";
20
20
  import { useChipStatus } from "../chip/chipStatusProvider";
21
- export const Dropdown = ({ className, classNamePopup, getData, errorHandler, dataItems, fetchState, onChange, value, defaultValue, placeholder, dialogAriaLabel, width, isLoading, title, triggerAriaLabel, disabled, inputId, filterName, showCounterPill = true, showSelection, fullWidthTriggerButton, hasApplyButton, searchField = true, multiselect = true, forceSelection = false, selectAllButton = true, getNamedItems, getSelectedItem, buttonType = "secondary", listLimit = 500, alignment = "bottom-left", error, sortFn, checkboxLabel, chip, chipId, chipName, chipIcon, setChecked, setSearch }) => {
21
+ export const LIST_LIMIT = 500;
22
+ export const Dropdown = ({ className, classNamePopup, mobileSheetStackingClassName, getData, errorHandler, dataItems, fetchState, onChange, value, defaultValue, placeholder, dialogAriaLabel, width, isLoading, title, triggerAriaLabel, disabled, inputId, filterName, showCounterPill = true, showSelection, fullWidthTriggerButton, hasApplyButton, searchField = true, multiselect = true, forceSelection = false, selectAllButton = true, getNamedItems, getSelectedItem, buttonType = "secondary", listLimit = LIST_LIMIT, alignment = "bottom-left", error, sortFn, checkboxLabel, chip, chipId, chipName, chipIcon, setChecked, setSearch }) => {
22
23
  var _a;
23
24
  const isFullSelectionMode = useMemo(() => typeof value === "object" &&
24
25
  "selected" in value &&
@@ -28,7 +29,7 @@ export const Dropdown = ({ className, classNamePopup, getData, errorHandler, dat
28
29
  const isQueryMode = useMemo(() => typeof getData === "undefined" && typeof dataItems === "undefined", [getData, dataItems]);
29
30
  const isCheckboxMode = useMemo(() => checkboxLabel && typeof value === "object" && "isChecked" in value && typeof value.isChecked === "boolean" || false, [checkboxLabel, value]);
30
31
  const [initialInChecked] = useState(isCheckboxMode ? value.isChecked : undefined);
31
- const [state, dispatchState] = useReducer(stateReducer, getInitialState(isFullSelectionMode, isQueryMode ? (fetchState === null || fetchState === void 0 ? void 0 : fetchState.data) || [] : dataItems || [], isFullSelectionMode || isCheckboxMode ? value.selected : value, defaultValue ? (isFullSelectionMode || isCheckboxMode ? defaultValue.selected : defaultValue) : undefined, isFullSelectionMode ? value.isAllSelected : undefined, defaultValue ? (isFullSelectionMode ? defaultValue.isAllSelected : undefined) : undefined, isCheckboxMode ? value.isChecked : undefined, isCheckboxMode && defaultValue ? defaultValue.isChecked : undefined));
32
+ const [state, dispatchState] = useReducer(stateReducer, getInitialState(isFullSelectionMode, isQueryMode ? (fetchState === null || fetchState === void 0 ? void 0 : fetchState.data) || [] : dataItems || [], isFullSelectionMode || isCheckboxMode ? value.selected : value, listLimit, defaultValue ? (isFullSelectionMode || isCheckboxMode ? defaultValue.selected : defaultValue) : undefined, isFullSelectionMode ? value.isAllSelected : undefined, defaultValue ? (isFullSelectionMode ? defaultValue.isAllSelected : undefined) : undefined, isCheckboxMode ? value.isChecked : undefined, isCheckboxMode && defaultValue ? defaultValue.isChecked : undefined));
32
33
  const chipStatus = useChipStatus();
33
34
  const isMobile = useMobile();
34
35
  const abortToken = useRef(new AbortController());
@@ -470,7 +471,7 @@ export const Dropdown = ({ className, classNamePopup, getData, errorHandler, dat
470
471
  : sortDropdownItemArray(((_b = state.groupsMap[state.currentId || ENTIRE_ORGANIZATION_GROUP_ID]) === null || _b === void 0 ? void 0 : _b.children) || [], sortFn).slice(0, listLimit) || [], multiselect, currentAllSelected);
471
472
  return _jsx(DropdownList, { onBackButtonClick: handleBackButtonClick, onSelectAllClick: isSearchMode ? handleSelectAllInSearch : handleSelectAllClick, onClearClick: handleClearClick, onCancelClick: handleCancelClick, onApplyClick: handleApplyClick, onChange: handleSelect, onSelect: handleChangeCurrentId, onSingleSelect: handleSingleSelection, activeValue: state.selectedIds.length ? state.selectedIds[0] : "root",
472
473
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
473
- backButtonName: state.currentId ? getGroupDescription(state.groupsMap[state.currentId], translate) : undefined, filterName: isMobile ? undefined : filterName, isAllSelected: currentAllSelected ? currentAllSelected : (isSearchMode ? isEveryItemSelected(getListDataWithDisabled(state.listData, state.isNestedList), state.selectedIds)
474
+ backButtonName: state.currentId && state.groupsMap[state.currentId] ? getGroupDescription(state.groupsMap[state.currentId], translate) : undefined, filterName: isMobile ? undefined : filterName, isAllSelected: currentAllSelected ? currentAllSelected : (isSearchMode ? isEveryItemSelected(getListDataWithDisabled(state.listData, state.isNestedList), state.selectedIds)
474
475
  : (currentAllSelected === undefined ? isAllChildrenSelected(state, state.currentId || ENTIRE_ORGANIZATION_GROUP_ID) : false)), isMultiselect: multiselect, forceSelection: forceSelection,
475
476
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
476
477
  listData: currentListData, width: width || currentWidth === 180 ? undefined : currentWidth, minWidth: currentWidth, hasSelectAllButton: selectAllButton && multiselect, hasApplyButton: hasApplyButton, isApplyDisabled: memoizedIsApplyButtonDisabled, isSelectAllButtonDisable: currentListData.length === 0
@@ -490,7 +491,7 @@ export const Dropdown = ({ className, classNamePopup, getData, errorHandler, dat
490
491
  const memoizedCurrentSelection = useMemo(() => showSelection && !state.inputValue ? currentStringFromSelected : "", [showSelection, state.inputValue, currentStringFromSelected]);
491
492
  const parentTriggerWidth = ((_a = comboboxRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect().width) || 420;
492
493
  return _jsxs("div", { className: containerClassName, ref: comboboxRef, children: [chip ? _jsx(Chip, { status: memoizedIsClearButtonDisabled ? undefined : chipStatus || "active", isOpen: state.isOpenCombo, disabled: disabled, onClick: handleTriggerClick, onClose: memoizedIsClearButtonDisabled ? undefined : handleClearClick, triggerRef: triggerRef, icon: chipIcon, id: chipId, children: currentStringFromSelected || chipName }) :
493
- _jsx(DropdownTrigger, { className: classNames([!width && !fullWidthTriggerButton && parentTriggerWidth < 420 && !searchField ? "zen-dropdown__trigger-button--width-parent" : ""]), currentSelection: memoizedCurrentSelection, isActive: state.isOpenCombo, id: inputId, disabled: disabled, count: showCounterPill ? countSelected : 0, fullWidth: fullWidthTriggerButton, inputValue: state.inputValue, placeholder: placeholder || translate("Filter by group"), searchField: searchField && !isMobile ? searchField : false, onSearchChange: onSearchChange, handleClick: handleTriggerClick, width: width && width > 420 ? 420 : width, title: title, triggerAriaLabel: triggerAriaLabel, triggerRef: triggerRef, inputRef: inputRef, buttonType: buttonType, error: error }), _jsx(DropdownPopup, { alignment: alignment, triggerRef: triggerRef, classNamePopup: classNamePopup, isMobile: isMobile, dialogAriaLabel: dialogAriaLabel, disabled: disabled, filterName: filterName, hasApplyButton: hasApplyButton, inputId: inputId, isClearButtonDisabled: memoizedIsClearButtonDisabled, isApplyButtonDisabled: memoizedIsApplyButtonDisabled, isWithFooter: memoizedWithFooter, isOpenCombo: state.isOpenCombo, searchField: searchField, placeholder: placeholder, inputValue: state.inputValue, handleApplyClick: handleApplyClick, handleClearClick: multiselect ? handleClearClick : handleSingleSelection.bind(this, true), handleTriggerClick: handleTriggerClick, onInputChange: onInputChange, inputRef: inputRef, contentRef: contentRef, onReadyForFocus: handleReadyForFocus, handleCheckboxChange: isCheckboxMode && isMobile ? handleCheckboxChange : undefined, checkboxLabel: checkboxLabel, isChecked: state.isChecked, isSearchInPopup: chip, children: getPopupContent })] });
494
+ _jsx(DropdownTrigger, { className: classNames([!width && !fullWidthTriggerButton && parentTriggerWidth < 420 && !searchField ? "zen-dropdown__trigger-button--width-parent" : ""]), currentSelection: memoizedCurrentSelection, isActive: state.isOpenCombo, id: inputId, disabled: disabled, count: showCounterPill ? countSelected : 0, fullWidth: fullWidthTriggerButton, inputValue: state.inputValue, placeholder: placeholder || translate("Filter by group"), searchField: searchField && !isMobile ? searchField : false, onSearchChange: onSearchChange, handleClick: handleTriggerClick, width: width && width > 420 ? 420 : width, title: title, triggerAriaLabel: triggerAriaLabel, triggerRef: triggerRef, inputRef: inputRef, buttonType: buttonType, error: error }), _jsx(DropdownPopup, { alignment: alignment, triggerRef: triggerRef, classNamePopup: classNamePopup, mobileSheetStackingClassName: mobileSheetStackingClassName, isMobile: isMobile, dialogAriaLabel: dialogAriaLabel, disabled: disabled, filterName: filterName, hasApplyButton: hasApplyButton, inputId: inputId, isClearButtonDisabled: memoizedIsClearButtonDisabled, isApplyButtonDisabled: memoizedIsApplyButtonDisabled, isWithFooter: memoizedWithFooter, isOpenCombo: state.isOpenCombo, searchField: searchField, placeholder: placeholder, inputValue: state.inputValue, handleApplyClick: handleApplyClick, handleClearClick: multiselect ? handleClearClick : handleSingleSelection.bind(this, true), handleTriggerClick: handleTriggerClick, onInputChange: onInputChange, inputRef: inputRef, contentRef: contentRef, onReadyForFocus: handleReadyForFocus, handleCheckboxChange: isCheckboxMode && isMobile ? handleCheckboxChange : undefined, checkboxLabel: checkboxLabel, isChecked: state.isChecked, isSearchInPopup: chip, children: getPopupContent })] });
494
495
  };
495
496
  export const TRANSLATIONS = [
496
497
  ...TriggerTranslations,
@@ -1,5 +1,5 @@
1
1
  import { ICheckboxListWithActionOption } from "../checkboxListWithAction/checkboxListWithAction";
2
- import { IGroupTree, ITypedHash } from "../groupsFilter/groupsFilterInterfaces";
2
+ import { IGroupTree } from "../groupsFilter/groupsFilterInterfaces";
3
3
  import { IDropdownItem } from "./dropdown";
4
4
  import { IDropdownState } from "./stateReducer/stateReducer";
5
5
  export declare const getGroupsTreeItem: (stateObj: IDropdownState, itemId: string) => IGroupTree | undefined;
@@ -25,8 +25,8 @@ export declare const createListDataOptions: (stateObj: IDropdownState, translate
25
25
  }[];
26
26
  export declare const compareStringsArrays: (arr1: string[], arr2: string[]) => boolean;
27
27
  export declare const compareObjectsArrays: (arr1: IDropdownItem[], arr2: IDropdownItem[]) => boolean;
28
- export declare const prepareSelectedIdsToItems: (selectedIds: string[], groupsMap: ITypedHash<IGroupTree>, groupsMapSelected: Map<string, IDropdownItem>) => IDropdownItem[];
29
- export declare const checkIsDataProblem: (selectedIds: string[], groupsMap: ITypedHash<IGroupTree>) => boolean;
28
+ export declare const prepareSelectedIdsToItems: (selectedIds: string[], groupsMap: IDropdownState["groupsMap"], groupsMapSelected: Map<string, IDropdownItem>) => IDropdownItem[];
29
+ export declare const checkIsDataProblem: (selectedIds: string[], groupsMap: IDropdownState["groupsMap"]) => boolean;
30
30
  export declare const getStringFromSelected: (selectedIds: string[], groupsMapSelected: Map<string, IDropdownItem>, translate: (s: string) => string) => string;
31
- export declare const getStringFromAllSelected: (groupsMap: ITypedHash<IGroupTree>, translate: (s: string) => string) => string;
31
+ export declare const getStringFromAllSelected: (groupsMap: IDropdownState["groupsMap"], translate: (s: string) => string) => string;
32
32
  export declare const getSelectedCount: (selectedIds: string[]) => number;
@@ -123,7 +123,8 @@ export const getStringFromAllSelected = (groupsMap, translate) => {
123
123
  if (!((_a = groupsMap[ENTIRE_ORGANIZATION_GROUP_ID]) === null || _a === void 0 ? void 0 : _a.children) || groupsMap[ENTIRE_ORGANIZATION_GROUP_ID].children.length === 0) {
124
124
  return "";
125
125
  }
126
- const selectedItems = groupsMap[ENTIRE_ORGANIZATION_GROUP_ID].children.map(el => groupsMap[el.id] ? getGroupDescription(groupsMap[el.id], translate) : undefined).filter(el => el);
126
+ const selectedItems = groupsMap[ENTIRE_ORGANIZATION_GROUP_ID].children.map(el => groupsMap[el.id] ?
127
+ getGroupDescription(groupsMap[el.id], translate) : undefined).filter(el => el);
127
128
  return selectedItems.join(", ");
128
129
  };
129
130
  export const getSelectedCount = (selectedIds) => selectedIds.length === 1 && selectedIds[0] === ENTIRE_ORGANIZATION_GROUP_ID ? 0 : selectedIds.length;
@@ -45,7 +45,7 @@ export const DropdownList = ({ onBackButtonClick, onSelectAllClick, onClearClick
45
45
  forceSelection ? onSingleSelect(false, newActiveEl || activeValue) : onSingleSelect(false, newActiveEl);
46
46
  }, [activeValue, forceSelection, onSingleSelect]);
47
47
  const selectButtonLabel = isAllSelected ? translate("Deselect all") : translate("Select all");
48
- const getActionButton = (label, title, icon, isDisable, clickHandler, size) => _jsx("button", { type: "button", disabled: isDisable, onClick: clickHandler, className: "zen-dropdown-list__item zen-dropdown-list__item--interactive zen-dropdown-list__action-button zen-dropdown-list__action-button-back", title: title, children: _jsxs(_Fragment, { children: [React.createElement(icon, { className: "zen-dropdown-list__icon zen-dropdown-list__action-icon", size: size }), _jsx("div", { className: classNames(["zen-dropdown-list__action-label", "zen-dropdown-list__action-label--limited", "zen-ellipsis"]), children: label })] }) });
48
+ const getActionButton = (label, title, icon, isDisabled, clickHandler, size) => _jsx("button", { type: "button", disabled: isDisabled, onClick: clickHandler, className: "zen-dropdown-list__item zen-dropdown-list__item--interactive zen-dropdown-list__action-button zen-dropdown-list__action-button-back", title: title, children: _jsxs(_Fragment, { children: [React.createElement(icon, { className: "zen-dropdown-list__icon zen-dropdown-list__action-icon", size: size }), _jsx("div", { className: classNames(["zen-dropdown-list__action-label", "zen-dropdown-list__action-label--limited", "zen-ellipsis"]), children: label })] }) });
49
49
  const styleWidth = useMemo(() => {
50
50
  if (width && !isMobile) {
51
51
  return { style: Object.assign({ width: `${width}px` }, (minWidth ? { minWidth: `${minWidth}px` } : {})) };
@@ -62,7 +62,7 @@ export const DropdownList = ({ onBackButtonClick, onSelectAllClick, onClearClick
62
62
  };
63
63
  return _jsx("div", { className: "zen-dropdown-list__elements", children: isMultiselect ? _jsx(CheckboxListWithAction, { options: listData, label: "", onChange: handleChange, onClick: handleClick }) : _jsx(SelectList, { onChange: handleSingleChange, onClick: handleClick, title: translate("Select option"), id: listId, multiselect: false, selectItemOnFocus: false, items: listData, forceSelection: forceSelection, value: createValue(listData, activeValue) }) });
64
64
  }, [isMultiselect, listData, handleChange, handleClick, handleSingleChange, translate, listId, forceSelection, activeValue]);
65
- return _jsxs("div", Object.assign({ className: classNames(["zen-dropdown-list", driveComponentClass || ""]) }, styleWidth, { children: [filterName ? _jsx("div", { className: "zen-dropdown-list__label", children: filterName }) : null, handleCheckboxChange ? _jsx("div", { className: "zen-dropdown-list__checkbox-container", children: _jsx(Checkbox, { checked: isChecked, onChange: handleCheckboxChange, children: checkboxLabel }) }) : null, backButtonName ? _jsx("div", { className: "zen-dropdown-list__item-wrapper", children: getActionButton(backButtonName, translate("Back"), IconBackArrow, false, onBackButtonClick, "large") }) : null, hasSelectAllButton ? getActionButton(selectButtonLabel, selectButtonLabel, IconCheckRadio, isSelectAllButtonDisable, handleSelectAllClick, isDrive ? "huger" : "huge") : null, listDataComponent, isWithFooter ? _jsxs("div", { className: "zen-dropdown-list__footer", children: [_jsx(Button, { onClick: isMultiselect ? onClearClick : handleClearClick, disabled: isClearButtonDisabled, className: "zen-dropdown-list__clear-button zen-ellipsis", type: ButtonType.Tertiary, title: translate("Clear"), children: translate("Clear") }), hasApplyButton && _jsxs("div", { className: "zen-dropdown-list__button-group", children: [_jsx(Button, { onClick: onCancelClick, className: "zen-dropdown-list__cancel-button zen-ellipsis", title: translate("Cancel"), children: translate("Cancel") }), _jsx(Button, { onClick: onApplyClick, type: ButtonType.Primary, disabled: isApplyDisabled, className: "zen-dropdown-list__apply-button zen-ellipsis", title: translate("Apply"), children: translate("Apply") })] })] }) : null] }));
65
+ return _jsxs("div", Object.assign({ className: classNames(["zen-dropdown-list", driveComponentClass || ""]) }, styleWidth, { children: [filterName ? _jsx("div", { className: "zen-dropdown-list__label", children: filterName }) : null, handleCheckboxChange ? _jsx("div", { className: "zen-dropdown-list__checkbox-container", children: _jsx(Checkbox, { checked: isChecked, onChange: handleCheckboxChange, children: checkboxLabel }) }) : null, backButtonName ? _jsx("div", { className: "zen-dropdown-list__item-wrapper", children: getActionButton(backButtonName, translate("Back"), IconBackArrow, false, onBackButtonClick, "large") }) : null, hasSelectAllButton ? getActionButton(selectButtonLabel, selectButtonLabel, IconCheckRadio, !!isSelectAllButtonDisable, handleSelectAllClick, isDrive ? "huger" : "huge") : null, listDataComponent, isWithFooter ? _jsxs("div", { className: "zen-dropdown-list__footer", children: [_jsx(Button, { onClick: isMultiselect ? onClearClick : handleClearClick, disabled: isClearButtonDisabled, className: "zen-dropdown-list__clear-button zen-ellipsis", type: ButtonType.Tertiary, title: translate("Clear"), children: translate("Clear") }), hasApplyButton && _jsxs("div", { className: "zen-dropdown-list__button-group", children: [_jsx(Button, { onClick: onCancelClick, className: "zen-dropdown-list__cancel-button zen-ellipsis", title: translate("Cancel"), children: translate("Cancel") }), _jsx(Button, { onClick: onApplyClick, type: ButtonType.Primary, disabled: isApplyDisabled, className: "zen-dropdown-list__apply-button zen-ellipsis", title: translate("Apply"), children: translate("Apply") })] })] }) : null] }));
66
66
  };
67
67
  export const TRANSLATIONS = [
68
68
  "Select all",
@@ -5,6 +5,7 @@ export interface IDropdownPopup extends IZenComponentProps {
5
5
  alignment?: TAlignment;
6
6
  triggerRef: RefObject<HTMLElement | null>;
7
7
  classNamePopup?: string;
8
+ mobileSheetStackingClassName?: string;
8
9
  isMobile: boolean;
9
10
  dialogAriaLabel?: string;
10
11
  disabled?: boolean;
@@ -10,7 +10,7 @@ import { useLanguage } from "../utils/localization/useLanguage";
10
10
  import { FooterButtons } from "../footerButtons/footerButtons";
11
11
  import { Checkbox } from "../checkbox/checkbox";
12
12
  import { useScrollWithAndroidKeyboard } from "../utils/useScrollWithAndroidKeyboard";
13
- export const DropdownPopup = ({ alignment, triggerRef, classNamePopup, isMobile, inputValue, dialogAriaLabel, disabled, filterName, handleApplyClick, handleClearClick, handleTriggerClick, onInputChange, hasApplyButton, inputId, isClearButtonDisabled, isWithFooter, placeholder, searchField, isSearchInPopup, isApplyButtonDisabled, isOpenCombo, inputRef, contentRef, children, onReadyForFocus, handleCheckboxChange, checkboxLabel, isChecked }) => {
13
+ export const DropdownPopup = ({ alignment, triggerRef, classNamePopup, isMobile, inputValue, dialogAriaLabel, disabled, filterName, handleApplyClick, handleClearClick, handleTriggerClick, mobileSheetStackingClassName, onInputChange, hasApplyButton, inputId, isClearButtonDisabled, isWithFooter, placeholder, searchField, isSearchInPopup, isApplyButtonDisabled, isOpenCombo, inputRef, contentRef, children, onReadyForFocus, handleCheckboxChange, checkboxLabel, isChecked }) => {
14
14
  const { translate } = useLanguage();
15
15
  const triggerId = useId();
16
16
  const { handleFocus, handleBlur, wrapperClass } = useScrollWithAndroidKeyboard();
@@ -25,7 +25,7 @@ export const DropdownPopup = ({ alignment, triggerRef, classNamePopup, isMobile,
25
25
  }
26
26
  return _jsxs(FooterButtons, { children: [hasApplyButton ? _jsx(Button, { onClick: handleApplyClick, type: ButtonType.Primary, disabled: isApplyButtonDisabled, className: "zen-ellipsis", title: translate("Apply"), children: translate("Apply") }) : null, _jsx(Button, { onClick: handleClearClick, disabled: isClearButtonDisabled, className: "zen-ellipsis", type: ButtonType.Tertiary, title: translate("Clear"), children: translate("Clear") })] });
27
27
  }, [handleApplyClick, handleClearClick, hasApplyButton, isApplyButtonDisabled, isClearButtonDisabled, isWithFooter, translate]);
28
- const memoizedMobileView = useMemo(() => _jsxs(MobileSheet, { className: classNames(["zen-dropdown--mobile", classNamePopup || ""]), wrapperClassName: wrapperClass, label: "label", triggerRef: triggerRef, isOpen: isOpenCombo, onHidePanel: memoizedHandleHide, onCloseClick: memoizedHandleHide, useTrapFocusWithTrigger: true, onReadyForFocus: onReadyForFocus, children: [_jsx(MobileSheet.Title, { className: "zen-dropdown-mobile-sheet__title", children: filterName || placeholder || "" }), _jsx(MobileSheet.Content, { children: memoizedMobileContent }), _jsx(MobileSheet.Footer, { children: memoizedMobileFooter })] }), [classNamePopup, wrapperClass, triggerRef, isOpenCombo, memoizedHandleHide, onReadyForFocus, filterName, placeholder, memoizedMobileContent, memoizedMobileFooter]);
28
+ const memoizedMobileView = useMemo(() => _jsxs(MobileSheet, { className: classNames(["zen-dropdown--mobile", classNamePopup || ""]), wrapperClassName: wrapperClass, stackingClassName: mobileSheetStackingClassName, label: "label", triggerRef: triggerRef, isOpen: isOpenCombo, onHidePanel: memoizedHandleHide, onCloseClick: memoizedHandleHide, useTrapFocusWithTrigger: true, onReadyForFocus: onReadyForFocus, children: [_jsx(MobileSheet.Title, { className: "zen-dropdown-mobile-sheet__title", children: filterName || placeholder || "" }), _jsx(MobileSheet.Content, { children: memoizedMobileContent }), _jsx(MobileSheet.Footer, { children: memoizedMobileFooter })] }), [classNamePopup, wrapperClass, mobileSheetStackingClassName, triggerRef, isOpenCombo, memoizedHandleHide, onReadyForFocus, filterName, placeholder, memoizedMobileContent, memoizedMobileFooter]);
29
29
  const memoizedDesktopView = useMemo(() => _jsx(ControlledPopup, { isOpen: isOpenCombo, className: classNames(["zen-dropdown-popup zen-shadow-dropdown-default", classNamePopup || ""]), onOpenChange: handleTriggerClick, useTrapFocusWithTrigger: "withTrigger", alignment: alignment, shouldHoldScroll: true, triggerRef: triggerRef, ariaLabel: dialogAriaLabel || placeholder || translate("Filter by group"), recalculateOnScroll: true, children: _jsxs("div", { ref: contentRef, children: [searchField && isSearchInPopup ? _jsx("div", { className: "zen-dropdown-popup__search-container", children: _jsx(SearchInput, { className: "zen-dropdown-chip__search", onChange: onInputChange, value: inputValue || "", ref: inputRef, id: inputId || triggerId, disabled: disabled, placeholder: placeholder || translate("Filter by group") }) }) : null, children] }) }), [alignment, children, classNamePopup, contentRef, dialogAriaLabel, disabled, handleTriggerClick, inputId, inputRef, inputValue, isOpenCombo, isSearchInPopup, onInputChange, placeholder, searchField, translate, triggerId, triggerRef]);
30
30
  return isMobile ? memoizedMobileView : memoizedDesktopView;
31
31
  };
@@ -46,7 +46,7 @@ export const DropdownSearchableTrigger = (_a) => {
46
46
  onChange(undefined);
47
47
  };
48
48
  return _jsxs("div", Object.assign({ className: classNames(["zen-dropdown-searchable-trigger", isError ? "zen-dropdown-searchable-trigger--error" : "",
49
- driveComponentClass || "", disabled ? "zen-dropdown-searchable-trigger--disabled" : ""]) }, inputStyle, { ref: ref }, otherProps, { onClick: disabled ? () => { } : clickHandler, role: "combobox", "aria-label": placeholder, children: [_jsxs("div", { className: classNames(["zen-dropdown-searchable-trigger__search-container", className]), children: [_jsx("div", { className: "zen-dropdown-searchable-trigger__input-container", onKeyDown: handleKeydown, children: _jsx(TextInputRaw, { value: value, placeholder: currentSelection ? currentSelection : placeholder || translate("Filter by group"), className: classNames(["zen-dropdown-searchable-trigger__input", "zen-ellipsis", currentSelection ? "zen-dropdown-searchable-trigger__input--selected" : ""]), onChange: onChange, disabled: disabled, type: "text", ref: inputRef, id: id || triggerId }) }), count ? _jsx("div", { className: "zen-dropdown-searchable-trigger__label-element", children: _jsx("div", { className: "zen-dropdown-searchable-trigger__counter", children: _jsx("span", { children: isLargeNumber ? "99+" : count }) }) }) : null, value && _jsx("button", { type: "button", className: "zen-dropdown-searchable-trigger__close-button", ref: clearRef, title: translate("Clear search"), onClick: handleClearSearch, children: _jsx(IconCrossThin, { size: isDrive ? "big" : "small" }) })] }), _jsx("button", { type: "button", tabIndex: -1, "aria-hidden": "true", className: classNames(["zen-dropdown-searchable-trigger__popup-trigger", isOpenPopup ? "zen-dropdown-searchable-trigger__popup-trigger--active" : ""]), title: title || translate(isOpenPopup ? "Close filter" : "Open filter"), children: _jsx(IconChevronDownSmall, { className: isOpenPopup ? "zen-dropdown-searchable-trigger__arrow-icon--up" : "zen-dropdown-searchable-trigger__arrow-icon--down", size: isDrive ? "huge" : "large" }) })] }));
49
+ driveComponentClass || "", disabled ? "zen-dropdown-searchable-trigger--disabled" : ""]) }, inputStyle, { ref: ref }, otherProps, { onClick: disabled ? () => { } : clickHandler, role: "combobox", "aria-label": placeholder, children: [_jsxs("div", { className: classNames(["zen-dropdown-searchable-trigger__search-container", className]), children: [_jsx("div", { className: "zen-dropdown-searchable-trigger__input-container", onKeyDown: handleKeydown, children: _jsx(TextInputRaw, { value: value, placeholder: currentSelection ? currentSelection : placeholder || translate("Filter by group"), className: classNames(["zen-dropdown-searchable-trigger__input", "zen-ellipsis", currentSelection ? "zen-dropdown-searchable-trigger__input--selected" : ""]), onChange: onChange, disabled: disabled, type: "text", ref: inputRef, id: id || triggerId }) }), count ? _jsx("div", { className: "zen-dropdown-searchable-trigger__label-element", children: _jsx("div", { className: "zen-dropdown-searchable-trigger__counter", children: _jsx("span", { children: isLargeNumber ? "99+" : count }) }) }) : null, value && _jsx("button", { type: "button", className: "zen-dropdown-searchable-trigger__close-button", ref: clearRef, title: translate("Clear search"), onClick: handleClearSearch, children: _jsx(IconCrossThin, { size: isDrive ? "big" : "small" }) })] }), _jsx("button", { type: "button", onMouseDown: e => e.preventDefault(), tabIndex: -1, "aria-hidden": "true", className: classNames(["zen-dropdown-searchable-trigger__popup-trigger", isOpenPopup ? "zen-dropdown-searchable-trigger__popup-trigger--active" : ""]), title: title || translate(isOpenPopup ? "Close filter" : "Open filter"), children: _jsx(IconChevronDownSmall, { className: isOpenPopup ? "zen-dropdown-searchable-trigger__arrow-icon--up" : "zen-dropdown-searchable-trigger__arrow-icon--down", size: isDrive ? "huge" : "large" }) })] }));
50
50
  };
51
51
  DropdownSearchableTrigger.displayName = "DropdownSearchableTrigger";
52
52
  export const TRANSLATIONS = [
@@ -3,7 +3,7 @@ import { TStateAction } from "./stateAction";
3
3
  import { IGroupTree, ITypedHash } from "../../groupsFilter/groupsFilterInterfaces";
4
4
  import { IDropdownItem } from "../dropdown";
5
5
  export interface IDropdownState {
6
- groupsMap: ITypedHash<IGroupTree>;
6
+ groupsMap: ITypedHash<IGroupTree | undefined>;
7
7
  selectedIds: string[];
8
8
  globalSelectedIds: string[];
9
9
  defaultValue: string[];
@@ -20,6 +20,8 @@ export interface IDropdownState {
20
20
  pendingNamelessIds: boolean;
21
21
  isNestedList: boolean;
22
22
  isFullSelectionMode: boolean;
23
+ listLimit: number;
24
+ resultsExceedListLimit?: boolean;
23
25
  isAllSelected?: boolean;
24
26
  globalIsAllSelected?: boolean;
25
27
  defaultValueIsAllSelected?: boolean;
@@ -29,7 +31,7 @@ export interface IDropdownState {
29
31
  }
30
32
  export interface IStateReducer extends Reducer<IDropdownState, TStateAction> {
31
33
  }
32
- export declare const getInitialState: (isFullSelectionMode: boolean, comboItems: IDropdownItem[], selection: string[], defaultValue?: string[], isAllSelected?: boolean, defaultValueIsAllSelected?: boolean, isChecked?: boolean, defaultValueIsChecked?: boolean) => {
34
+ export declare const getInitialState: (isFullSelectionMode: boolean, comboItems: IDropdownItem[], selection: string[], listLimit: number, defaultValue?: string[], isAllSelected?: boolean, defaultValueIsAllSelected?: boolean, isChecked?: boolean, defaultValueIsChecked?: boolean) => {
33
35
  groupsMap: ITypedHash<IGroupTree>;
34
36
  selectedIds: string[];
35
37
  globalSelectedIds: string[];
@@ -53,5 +55,7 @@ export declare const getInitialState: (isFullSelectionMode: boolean, comboItems:
53
55
  isChecked: boolean | undefined;
54
56
  defaultValueIsChecked: boolean | undefined;
55
57
  globalIsChecked: boolean | undefined;
58
+ listLimit: number;
59
+ resultsExceedListLimit: boolean;
56
60
  };
57
61
  export declare function stateReducer(state: IDropdownState, action: TStateAction): IDropdownState;
@@ -1,8 +1,8 @@
1
1
  import { StateActionType } from "./stateActionType";
2
- import { getChildList } from "./stateReducerHelper";
2
+ import { getChildList, updateAllSelectedStateValueBasedOnTotalSelected } from "./stateReducerHelper";
3
3
  import { createGroupsMap } from "../../groupsFilter/groupsFilterHelper";
4
4
  import { ENTIRE_ORGANIZATION_GROUP_ID } from "../../groupsFilter/groupsHelper";
5
- export const getInitialState = (isFullSelectionMode, comboItems, selection, defaultValue, isAllSelected, defaultValueIsAllSelected, isChecked, defaultValueIsChecked) => {
5
+ export const getInitialState = (isFullSelectionMode, comboItems, selection, listLimit, defaultValue, isAllSelected, defaultValueIsAllSelected, isChecked, defaultValueIsChecked) => {
6
6
  const updatedGroupsMapSelected = new Map();
7
7
  const updatedGroupsMap = comboItems.length ? createGroupsMap(comboItems, ENTIRE_ORGANIZATION_GROUP_ID) : {};
8
8
  const namelessIds = new Set();
@@ -43,12 +43,14 @@ export const getInitialState = (isFullSelectionMode, comboItems, selection, defa
43
43
  defaultValueIsAllSelected: isFullSelectionMode ? defaultValueIsAllSelected || false : undefined,
44
44
  isChecked: isChecked,
45
45
  defaultValueIsChecked: isChecked !== undefined ? defaultValueIsChecked || false : undefined,
46
- globalIsChecked: isChecked
46
+ globalIsChecked: isChecked,
47
+ listLimit,
48
+ resultsExceedListLimit: false
47
49
  };
48
50
  };
49
51
  // eslint-disable-next-line complexity
50
52
  export function stateReducer(state, action) {
51
- var _a, _b, _c, _d;
53
+ var _a, _b, _c, _d, _e, _f;
52
54
  const { type, payload } = action;
53
55
  switch (type) {
54
56
  case StateActionType.CreateMap: {
@@ -69,7 +71,9 @@ export function stateReducer(state, action) {
69
71
  });
70
72
  }
71
73
  const isCurrentListNested = Object.keys(updatedGroupsMap).length > 0 && (updatedGroupsMap[ENTIRE_ORGANIZATION_GROUP_ID].children || []).some(el => el.children && el.children.length);
72
- return Object.assign(Object.assign({}, state), { groupsMap: updatedGroupsMap, namelessIds: newNamelessIds, isNestedList: state.isNestedList ? state.isNestedList : isCurrentListNested });
74
+ state.groupsMap = updatedGroupsMap;
75
+ const additionalStateUpdates = updateAllSelectedStateValueBasedOnTotalSelected(state, state.selectedIds.length - newNamelessIds.size);
76
+ return Object.assign(Object.assign(Object.assign({}, state), { namelessIds: newNamelessIds, isNestedList: state.isNestedList ? state.isNestedList : isCurrentListNested, resultsExceedListLimit: Object.keys(updatedGroupsMap).length - 1 >= state.listLimit }), additionalStateUpdates);
73
77
  }
74
78
  case StateActionType.SetListData: {
75
79
  state.selectedIds.forEach(id => {
@@ -112,11 +116,8 @@ export function stateReducer(state, action) {
112
116
  const newNamelessIds = new Set(state.namelessIds);
113
117
  payload.selected.forEach(id => {
114
118
  if (!state.groupsMapSelected.has(id)) {
115
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
116
119
  const item = state.groupsMap[id];
117
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
118
120
  item && state.groupsMapSelected.set(id, Object.assign(Object.assign({ id }, (item.name ? { name: item.name } : {})), (item.color ? { color: item.color } : {})));
119
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
120
121
  !item && newNamelessIds.add(id);
121
122
  }
122
123
  });
@@ -129,13 +130,9 @@ export function stateReducer(state, action) {
129
130
  const newNamelessIds = new Set(state.namelessIds);
130
131
  state.selectedIds.forEach(id => {
131
132
  if (!state.groupsMapSelected.has(id)) {
132
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
133
133
  const item = state.groupsMap[id];
134
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
135
134
  item && state.groupsMapSelected.set(id, Object.assign(Object.assign({ id }, (item.name ? { name: item.name } : {})), (item.color ? { color: item.color } : {})));
136
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
137
135
  !item && newNamelessIds.add(id);
138
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
139
136
  item && newNamelessIds.delete(id);
140
137
  }
141
138
  else {
@@ -163,11 +160,8 @@ export function stateReducer(state, action) {
163
160
  const newNamelessIds = new Set(state.namelessIds);
164
161
  payload.forEach(id => {
165
162
  if (!state.groupsMapSelected.has(id)) {
166
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
167
163
  const item = state.groupsMap[id] || state.listData.find(el => el.id === id);
168
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
169
164
  item && state.groupsMapSelected.set(id, Object.assign(Object.assign({ id }, (item.name ? { name: item.name } : {})), (item.color ? { color: item.color } : {})));
170
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
171
165
  !item && newNamelessIds.add(id);
172
166
  }
173
167
  });
@@ -179,9 +173,7 @@ export function stateReducer(state, action) {
179
173
  case StateActionType.ChangeSingleSelection: {
180
174
  const newSelectedId = payload.value ? payload.value : state.defaultValue[0];
181
175
  if (newSelectedId && !state.groupsMapSelected.has(newSelectedId)) {
182
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
183
176
  const item = state.groupsMap[newSelectedId] || state.listData.find(el => el.id === newSelectedId);
184
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
185
177
  item && state.groupsMapSelected.set(newSelectedId, Object.assign(Object.assign({ id: newSelectedId }, (item.name ? { name: item.name } : {})), (item.color ? { color: item.color } : {})));
186
178
  }
187
179
  return Object.assign(Object.assign({}, state), { selectedIds: payload.value ? [payload.value] : (payload.reset ? [...state.defaultValue] : []) });
@@ -201,7 +193,7 @@ export function stateReducer(state, action) {
201
193
  let parent = (_b = (_a = state.groupsMap[payload.itemId]) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.id;
202
194
  while (parent && parent !== "root") {
203
195
  parentForDeselect.push(parent);
204
- parent = (_c = state.groupsMap[parent].parent) === null || _c === void 0 ? void 0 : _c.id;
196
+ parent = (_d = (_c = state.groupsMap[parent]) === null || _c === void 0 ? void 0 : _c.parent) === null || _d === void 0 ? void 0 : _d.id;
205
197
  }
206
198
  parentForDeselect.forEach(parentId => {
207
199
  currentSelectedIds.delete(parentId);
@@ -209,7 +201,7 @@ export function stateReducer(state, action) {
209
201
  // deselect children
210
202
  const childrenForDeselect = [];
211
203
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
212
- const currentChild = getChildList((_d = state.groupsMap[payload.itemId]) === null || _d === void 0 ? void 0 : _d.children);
204
+ const currentChild = getChildList((_e = state.groupsMap[payload.itemId]) === null || _e === void 0 ? void 0 : _e.children);
213
205
  currentChild.forEach(el => {
214
206
  childrenForDeselect.push(el.id);
215
207
  });
@@ -217,13 +209,12 @@ export function stateReducer(state, action) {
217
209
  }
218
210
  currentSelectedIds.forEach(id => {
219
211
  if (!state.groupsMapSelected.has(id)) {
220
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
221
212
  const item = state.groupsMap[id] || state.listData.find(el => el.id === id);
222
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
223
213
  item && state.groupsMapSelected.set(id, Object.assign(Object.assign({ id }, (item.name ? { name: item.name } : {})), (item.color ? { color: item.color } : {})));
224
214
  }
225
215
  });
226
- return Object.assign(Object.assign({}, state), { selectedIds: Array.from(currentSelectedIds) });
216
+ const additionalStateUpdates = updateAllSelectedStateValueBasedOnTotalSelected(state, currentSelectedIds.size);
217
+ return Object.assign(Object.assign(Object.assign({}, state), { selectedIds: Array.from(currentSelectedIds) }), additionalStateUpdates);
227
218
  }
228
219
  case StateActionType.ChangeBulkSelection: {
229
220
  const { itemsIds, value } = payload;
@@ -231,17 +222,17 @@ export function stateReducer(state, action) {
231
222
  const parentsToProcess = new Set();
232
223
  const childrenToProcess = new Set();
233
224
  itemsIds.forEach(itemId => {
234
- var _a, _b, _c, _d;
225
+ var _a, _b, _c, _d, _e;
235
226
  if (value) {
236
227
  currentSelectedIds.add(itemId);
237
228
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
238
229
  let parent = (_b = (_a = state.groupsMap[itemId]) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.id;
239
230
  while (parent && parent !== "root") {
240
231
  parentsToProcess.add(parent);
241
- parent = (_c = state.groupsMap[parent].parent) === null || _c === void 0 ? void 0 : _c.id;
232
+ parent = (_d = (_c = state.groupsMap[parent]) === null || _c === void 0 ? void 0 : _c.parent) === null || _d === void 0 ? void 0 : _d.id;
242
233
  }
243
234
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
244
- const currentChild = getChildList((_d = state.groupsMap[itemId]) === null || _d === void 0 ? void 0 : _d.children);
235
+ const currentChild = getChildList((_e = state.groupsMap[itemId]) === null || _e === void 0 ? void 0 : _e.children);
245
236
  currentChild.forEach(childId => childrenToProcess.add(childId.id));
246
237
  }
247
238
  else {
@@ -252,36 +243,35 @@ export function stateReducer(state, action) {
252
243
  parentsToProcess.forEach(parentId => currentSelectedIds.delete(parentId));
253
244
  currentSelectedIds.forEach(id => {
254
245
  if (!state.groupsMapSelected.has(id)) {
255
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
256
246
  const item = state.groupsMap[id] || state.listData.find(el => el.id === id);
257
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
258
247
  item && state.groupsMapSelected.set(id, Object.assign(Object.assign({ id }, (item.name ? { name: item.name } : {})), (item.color ? { color: item.color } : {})));
259
248
  }
260
249
  });
261
- return Object.assign(Object.assign({}, state), { selectedIds: Array.from(currentSelectedIds) });
250
+ const additionalStateUpdates = updateAllSelectedStateValueBasedOnTotalSelected(state, currentSelectedIds.size);
251
+ return Object.assign(Object.assign(Object.assign({}, state), { selectedIds: Array.from(currentSelectedIds) }), additionalStateUpdates);
262
252
  }
263
253
  case StateActionType.SelectAllChildren: {
264
254
  const currentEl = state.groupsMap[payload];
265
255
  const newSelected = new Set(state.selectedIds);
266
256
  const isDisableStateProhibited = state.isNestedList;
267
- (currentEl.children || []).forEach(el => {
268
- var _a, _b;
257
+ ((currentEl === null || currentEl === void 0 ? void 0 : currentEl.children) || []).forEach(el => {
258
+ var _a, _b, _c, _d, _e;
269
259
  if (!newSelected.has(el.id)) {
270
260
  // select when isDisableStateProhibited, or when disabled elements are allowed to be displayed, and this element is not disabled
271
261
  (isDisableStateProhibited || !el.disabled) && newSelected.add(el.id);
272
262
  // deselect parent
273
263
  const parentForDeselect = [];
274
- let parent = (_a = state.groupsMap[el.id].parent) === null || _a === void 0 ? void 0 : _a.id;
264
+ let parent = (_b = (_a = state.groupsMap[el.id]) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.id;
275
265
  while (parent && parent !== "root") {
276
266
  parentForDeselect.push(parent);
277
- parent = (_b = state.groupsMap[parent].parent) === null || _b === void 0 ? void 0 : _b.id;
267
+ parent = (_d = (_c = state.groupsMap[parent]) === null || _c === void 0 ? void 0 : _c.parent) === null || _d === void 0 ? void 0 : _d.id;
278
268
  }
279
269
  parentForDeselect.forEach(parentId => {
280
270
  newSelected.delete(parentId);
281
271
  });
282
272
  //deselect children
283
273
  const childrenForDeselect = [];
284
- const currentChild = getChildList(state.groupsMap[el.id].children);
274
+ const currentChild = getChildList((_e = state.groupsMap[el.id]) === null || _e === void 0 ? void 0 : _e.children);
285
275
  currentChild.forEach(elt => {
286
276
  childrenForDeselect.push(elt.id);
287
277
  });
@@ -290,9 +280,7 @@ export function stateReducer(state, action) {
290
280
  });
291
281
  newSelected.forEach(id => {
292
282
  if (!state.groupsMapSelected.has(id)) {
293
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
294
283
  const item = state.groupsMap[id] || state.listData.find(el => el.id === id);
295
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
296
284
  item && state.groupsMapSelected.set(id, Object.assign(Object.assign({ id }, (item.name ? { name: item.name } : {})), (item.color ? { color: item.color } : {})));
297
285
  }
298
286
  });
@@ -303,7 +291,7 @@ export function stateReducer(state, action) {
303
291
  // action not submitted for disabled item, other items, even if disabled, not change their state
304
292
  const deselectedItems = payload ? new Set([payload]) : new Set(state.listData.filter(elem => !elem.disabled).map(el => el.id));
305
293
  const newSelected = new Set();
306
- (currentEl.children || []).forEach(el => {
294
+ ((currentEl === null || currentEl === void 0 ? void 0 : currentEl.children) || []).forEach(el => {
307
295
  if (!newSelected.has(el.id) && !deselectedItems.has(el.id)) {
308
296
  newSelected.add(el.id);
309
297
  }
@@ -315,9 +303,7 @@ export function stateReducer(state, action) {
315
303
  });
316
304
  newSelected.forEach(id => {
317
305
  if (!state.groupsMapSelected.has(id)) {
318
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
319
306
  const item = state.groupsMap[id] || state.listData.find(el => el.id === id);
320
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
321
307
  item && state.groupsMapSelected.set(id, Object.assign(Object.assign({ id }, (item.name ? { name: item.name } : {})), (item.color ? { color: item.color } : {})));
322
308
  }
323
309
  });
@@ -326,24 +312,24 @@ export function stateReducer(state, action) {
326
312
  case StateActionType.ToggleValueForAllSelected: {
327
313
  const currentEl = state.groupsMap[ENTIRE_ORGANIZATION_GROUP_ID];
328
314
  const newSelected = new Set();
329
- state.isAllSelected && (currentEl.children || []).forEach(el => {
315
+ state.isAllSelected && ((currentEl === null || currentEl === void 0 ? void 0 : currentEl.children) || []).forEach(el => {
330
316
  if (!newSelected.has(el.id) && el.disabled) {
331
317
  newSelected.add(el.id);
332
318
  }
333
319
  });
334
320
  newSelected.forEach(id => {
335
321
  if (!state.groupsMapSelected.has(id)) {
336
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
337
322
  const item = state.groupsMap[id] || state.listData.find(el => el.id === id);
338
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
339
323
  item && state.groupsMapSelected.set(id, Object.assign(Object.assign({ id }, (item.name ? { name: item.name } : {})), (item.color ? { color: item.color } : {})));
340
324
  }
341
325
  });
342
- return Object.assign(Object.assign({}, state), { selectedIds: state.isAllSelected ? Array.from(newSelected) : [], isAllSelected: state.isFullSelectionMode ? !state.isAllSelected : undefined });
326
+ const updatedIsAllSelectedValue = state.isFullSelectionMode ? !state.isAllSelected : undefined;
327
+ const additionalStateUpdates = updateAllSelectedStateValueBasedOnTotalSelected(state, newSelected.size);
328
+ return Object.assign(Object.assign(Object.assign({}, state), { selectedIds: state.isAllSelected ? Array.from(newSelected) : [], isAllSelected: updatedIsAllSelectedValue }), additionalStateUpdates);
343
329
  }
344
330
  case StateActionType.DeselectAllChildren: {
345
331
  const childrenForDeselect = [];
346
- const currentChild = getChildList(state.groupsMap[payload].children);
332
+ const currentChild = getChildList((_f = state.groupsMap[payload]) === null || _f === void 0 ? void 0 : _f.children);
347
333
  const isDisableStateProhibited = state.isNestedList;
348
334
  currentChild.forEach(el => {
349
335
  // deselect when isDisableStateProhibited, or when disabled elements are allowed to be displayed, and this element is not disabled
@@ -1,2 +1,4 @@
1
1
  import { IDropdownItem } from "../dropdown";
2
+ import { IDropdownState } from "./stateReducer";
2
3
  export declare function getChildList(childArr: IDropdownItem[] | undefined): IDropdownItem[];
4
+ export declare const updateAllSelectedStateValueBasedOnTotalSelected: (state: IDropdownState, totalSelected: number) => Partial<Pick<IDropdownState, "isAllSelected">>;
@@ -12,3 +12,13 @@ export function getChildList(childArr) {
12
12
  });
13
13
  return list;
14
14
  }
15
+ export const updateAllSelectedStateValueBasedOnTotalSelected = (state, totalSelected) => {
16
+ const additionalStateUpdates = {};
17
+ const groupsMapLength = Object.keys(state.groupsMap).length - 1;
18
+ if (!state.resultsExceedListLimit && !state.isAllSelected && state.isFullSelectionMode && groupsMapLength > 0) {
19
+ if (totalSelected >= groupsMapLength) {
20
+ additionalStateUpdates.isAllSelected = true;
21
+ }
22
+ }
23
+ return additionalStateUpdates;
24
+ };
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- export declare const useDropdownState: (withCheckbox?: boolean) => {
2
+ export declare const useDropdownState: (withCheckbox?: boolean, debounceTimeout?: number) => {
3
3
  checked?: boolean | undefined;
4
4
  setChecked?: import("react").Dispatch<import("react").SetStateAction<boolean>> | undefined;
5
5
  search: string;
@@ -1,6 +1,9 @@
1
1
  import { useState } from "react";
2
- export const useDropdownState = (withCheckbox) => {
2
+ import { useDebouncedMemo } from "../commonHelpers/hooks/useDebouncedMemo";
3
+ export const useDropdownState = (withCheckbox, debounceTimeout = 300) => {
3
4
  const [search, setSearch] = useState("");
4
5
  const [checked, setChecked] = useState(false);
5
- return Object.assign({ search, setSearch }, (withCheckbox ? { checked, setChecked } : {}));
6
+ const debouncedSearch = useDebouncedMemo(() => search, [search], debounceTimeout);
7
+ const debouncedChecked = useDebouncedMemo(() => checked, [checked], debounceTimeout);
8
+ return Object.assign({ search: debouncedSearch, setSearch }, (withCheckbox ? { checked: debouncedChecked, setChecked } : {}));
6
9
  };
@@ -8,5 +8,6 @@ export interface IFiltersContainer extends IZenComponentProps {
8
8
  hasSavedFilters: boolean;
9
9
  filtersForCalculation: ReactElement[];
10
10
  onSaveFilters?: (filterName: string, filterState?: Record<string, unknown>) => void;
11
+ filtersChipRef: React.RefObject<HTMLElement>;
11
12
  }
12
13
  export declare const FiltersContainer: React.FC<IFiltersContainer>;
@@ -1,18 +1,19 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useCallback, useMemo, useRef } from "react";
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useCallback, useMemo } from "react";
3
3
  import { classNames } from "../../commonHelpers/classNames/classNames";
4
4
  import { Chip } from "../../chip/chip";
5
5
  import React from "react";
6
6
  import { IconFilter } from "../../icons/iconFilter";
7
- import { IconPin2 } from "../../icons/iconPin2";
8
7
  import { createPropsHash, createStateHash, createStateObject, getFiltersState, getNumberOfChangedFilters, stabilizeChildrenWithId } from "../filtersHelper";
9
8
  import { FiltersSavedChipComponent } from "./filtersSavedChipComponent";
10
9
  import { IconClose } from "../../icons/iconClose";
11
10
  import { useChipStatus } from "../../chip/chipStatusProvider";
12
11
  import { useLanguage } from "../../utils/localization/useLanguage";
13
- export const FiltersContainer = ({ className, isPinned = false, onPinChange, filtersClickHandler, hasSavedFilters, filtersForCalculation, children }) => {
12
+ import { useMobile } from "../../commonHelpers/hooks/useMobile";
13
+ export const FiltersContainer = ({ className, isPinned = false, onPinChange, filtersClickHandler, hasSavedFilters, filtersForCalculation, children, filtersChipRef }) => {
14
14
  const chipStatus = useChipStatus();
15
15
  const { translate } = useLanguage();
16
+ const isMobile = useMobile();
16
17
  const numberOfChangedFilters = useMemo(() => {
17
18
  const suppressedFilters = new Set();
18
19
  filtersForCalculation.forEach(filter => {
@@ -25,12 +26,7 @@ export const FiltersContainer = ({ className, isPinned = false, onPinChange, fil
25
26
  const filteredState = getFiltersState(filtersForCalculation.filter(f => !suppressedFilters.has(f.props.id)));
26
27
  return getNumberOfChangedFilters(filteredState);
27
28
  }, [filtersForCalculation]);
28
- const filtersChipRef = useRef(null);
29
- const handlePinChange = useCallback((newIsPinned) => {
30
- onPinChange && onPinChange(newIsPinned);
31
- }, [onPinChange]);
32
- const pinComponent = useMemo(() => _jsx(Chip, { active: isPinned, status: isPinned ? "accent" : undefined, onChange: handlePinChange, icon: IconPin2, children: isPinned ? "" : "+" }), [isPinned, handlePinChange]);
33
- const filtersChipComponent = useMemo(() => _jsx(Chip, { quantity: numberOfChangedFilters, isOpen: false, status: numberOfChangedFilters > 0 ? chipStatus || "active" : undefined, onClick: filtersClickHandler, icon: IconFilter, title: translate("All Filters"), triggerRef: filtersChipRef, children: "+" }), [numberOfChangedFilters, chipStatus, filtersClickHandler, translate]);
29
+ const filtersChipComponent = useMemo(() => _jsx(Chip, { quantity: numberOfChangedFilters, isOpen: false, status: numberOfChangedFilters > 0 ? chipStatus || "active" : undefined, onClick: filtersClickHandler, icon: IconFilter, title: translate("All Filters"), triggerRef: filtersChipRef, children: "+" }), [numberOfChangedFilters, chipStatus, filtersClickHandler, translate, filtersChipRef]);
34
30
  const childrenSignature = useMemo(() => {
35
31
  const childrenArray = React.Children.toArray(children).filter(Boolean);
36
32
  return childrenArray
@@ -42,10 +38,11 @@ export const FiltersContainer = ({ className, isPinned = false, onPinChange, fil
42
38
  const state = child.props.state;
43
39
  const defaultState = child.props.defaultState;
44
40
  const childPropsQuery = JSON.stringify(child.props.fetchState || {});
41
+ const childPropsDataItems = JSON.stringify(child.props.dataItems || "no-data-items");
45
42
  const stateHash = createStateHash(state);
46
43
  const defaultStateHash = createStateHash(defaultState);
47
44
  const propsHash = createPropsHash(child.props);
48
- return `${childId}|${stateHash}|${defaultStateHash}|${propsHash}|${childPropsQuery}`;
45
+ return `${childId}|${stateHash}|${defaultStateHash}|${propsHash}|${childPropsQuery}|${childPropsDataItems}`;
49
46
  })
50
47
  .join("||");
51
48
  }, [children]);
@@ -66,9 +63,11 @@ export const FiltersContainer = ({ className, isPinned = false, onPinChange, fil
66
63
  }
67
64
  });
68
65
  onPinChange === null || onPinChange === void 0 ? void 0 : onPinChange(false);
69
- }, [filtersForCalculation, onPinChange]);
66
+ filtersChipRef.current.focus();
67
+ }, [filtersChipRef, filtersForCalculation, onPinChange]);
70
68
  const chipRemovalComponent = useMemo(() => numberOfChangedFilters ?
71
69
  _jsx(Chip, { title: translate("Clear"), className: "zen-filters-container__removal-chip", active: false, status: isPinned ? "accent" : undefined, onChange: handleRemovalClick, icon: IconClose })
72
70
  : null, [isPinned, handleRemovalClick, translate, numberOfChangedFilters]);
73
- return _jsxs("div", { className: classNames(["zen-filters-container", className || ""]), children: [memoizedChildren, onPinChange ? pinComponent : null, hasSavedFilters ? _jsx(FiltersSavedChipComponent, {}) : null, filtersChipComponent, chipRemovalComponent] });
71
+ const memoizedFiltersElements = useMemo(() => _jsxs(_Fragment, { children: [memoizedChildren, hasSavedFilters ? _jsx(FiltersSavedChipComponent, {}) : null, filtersChipComponent, chipRemovalComponent] }), [chipRemovalComponent, filtersChipComponent, hasSavedFilters, memoizedChildren]);
72
+ return _jsx("div", { className: classNames(["zen-filters-container", isMobile ? "zen-filters-container--mobile" : "", className || ""]), children: isMobile ? _jsx("div", { className: "zen-filters-container__mobile-scroll-wrapper", children: memoizedFiltersElements }) : memoizedFiltersElements });
74
73
  };
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import { IFiltersItem } from "./filtersItem";
3
+ import { IDateInput } from "../../dateInput/dateInput";
4
+ export interface IFiltersDateInputProps extends Pick<IDateInput, "classNamePopup" | "disabled" | "dropDownTitle" | "timeSelect" | "disableFutureDates" | "disablePastDates" | "disableDatesBefore" | "disableDatesAfter" | "requireSelection" | "chipIcon"> {
5
+ }
6
+ export type TFiltersDateInputState = string | undefined;
7
+ export interface IFiltersDateInput extends IFiltersItem<TFiltersDateInputState>, IFiltersDateInputProps {
8
+ }
9
+ export declare const FiltersDateInputDisplayName = "FiltersDateInput";
10
+ export declare const FiltersDateInput: React.FC<IFiltersDateInput>;
@@ -0,0 +1,23 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { useMemo } from "react";
14
+ import { classNames } from "../../commonHelpers/classNames/classNames";
15
+ import { DateInput } from "../../dateInput/dateInput";
16
+ import { IconCalendar } from "../../icons/iconCalendar";
17
+ export const FiltersDateInputDisplayName = "FiltersDateInput";
18
+ export const FiltersDateInput = (_a) => {
19
+ var { className, state, defaultState, name, onChange: onChangeState, id, chipIcon } = _a, otherRangeProps = __rest(_a, ["className", "state", "defaultState", "name", "onChange", "id", "chipIcon"]);
20
+ const component = useMemo(() => _jsx(DateInput, Object.assign({}, otherRangeProps, { buttonLabel: name, value: state, onChange: onChangeState, defaultValue: defaultState, className: classNames(["zen-filters-date-input", className || ""]), chip: true, chipId: id, chipName: name, chipIcon: chipIcon || IconCalendar })), [otherRangeProps, chipIcon, state, onChangeState, defaultState, className, id, name]);
21
+ return component;
22
+ };
23
+ FiltersDateInput.displayName = FiltersDateInputDisplayName;