@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
@@ -5,7 +5,7 @@ const stateActionType_1 = require("./stateActionType");
5
5
  const stateReducerHelper_1 = require("./stateReducerHelper");
6
6
  const groupsFilterHelper_1 = require("../../groupsFilter/groupsFilterHelper");
7
7
  const groupsHelper_1 = require("../../groupsFilter/groupsHelper");
8
- const getInitialState = (isFullSelectionMode, comboItems, selection, defaultValue, isAllSelected, defaultValueIsAllSelected, isChecked, defaultValueIsChecked) => {
8
+ const getInitialState = (isFullSelectionMode, comboItems, selection, listLimit, defaultValue, isAllSelected, defaultValueIsAllSelected, isChecked, defaultValueIsChecked) => {
9
9
  const updatedGroupsMapSelected = new Map();
10
10
  const updatedGroupsMap = comboItems.length ? (0, groupsFilterHelper_1.createGroupsMap)(comboItems, groupsHelper_1.ENTIRE_ORGANIZATION_GROUP_ID) : {};
11
11
  const namelessIds = new Set();
@@ -46,13 +46,15 @@ const getInitialState = (isFullSelectionMode, comboItems, selection, defaultValu
46
46
  defaultValueIsAllSelected: isFullSelectionMode ? defaultValueIsAllSelected || false : undefined,
47
47
  isChecked: isChecked,
48
48
  defaultValueIsChecked: isChecked !== undefined ? defaultValueIsChecked || false : undefined,
49
- globalIsChecked: isChecked
49
+ globalIsChecked: isChecked,
50
+ listLimit,
51
+ resultsExceedListLimit: false
50
52
  };
51
53
  };
52
54
  exports.getInitialState = getInitialState;
53
55
  // eslint-disable-next-line complexity
54
56
  function stateReducer(state, action) {
55
- var _a, _b, _c, _d;
57
+ var _a, _b, _c, _d, _e, _f;
56
58
  const { type, payload } = action;
57
59
  switch (type) {
58
60
  case stateActionType_1.StateActionType.CreateMap: {
@@ -73,7 +75,9 @@ function stateReducer(state, action) {
73
75
  });
74
76
  }
75
77
  const isCurrentListNested = Object.keys(updatedGroupsMap).length > 0 && (updatedGroupsMap[groupsHelper_1.ENTIRE_ORGANIZATION_GROUP_ID].children || []).some(el => el.children && el.children.length);
76
- return Object.assign(Object.assign({}, state), { groupsMap: updatedGroupsMap, namelessIds: newNamelessIds, isNestedList: state.isNestedList ? state.isNestedList : isCurrentListNested });
78
+ state.groupsMap = updatedGroupsMap;
79
+ const additionalStateUpdates = (0, stateReducerHelper_1.updateAllSelectedStateValueBasedOnTotalSelected)(state, state.selectedIds.length - newNamelessIds.size);
80
+ 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);
77
81
  }
78
82
  case stateActionType_1.StateActionType.SetListData: {
79
83
  state.selectedIds.forEach(id => {
@@ -116,11 +120,8 @@ function stateReducer(state, action) {
116
120
  const newNamelessIds = new Set(state.namelessIds);
117
121
  payload.selected.forEach(id => {
118
122
  if (!state.groupsMapSelected.has(id)) {
119
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
120
123
  const item = state.groupsMap[id];
121
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
122
124
  item && state.groupsMapSelected.set(id, Object.assign(Object.assign({ id }, (item.name ? { name: item.name } : {})), (item.color ? { color: item.color } : {})));
123
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
124
125
  !item && newNamelessIds.add(id);
125
126
  }
126
127
  });
@@ -133,13 +134,9 @@ function stateReducer(state, action) {
133
134
  const newNamelessIds = new Set(state.namelessIds);
134
135
  state.selectedIds.forEach(id => {
135
136
  if (!state.groupsMapSelected.has(id)) {
136
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
137
137
  const item = state.groupsMap[id];
138
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
139
138
  item && state.groupsMapSelected.set(id, Object.assign(Object.assign({ id }, (item.name ? { name: item.name } : {})), (item.color ? { color: item.color } : {})));
140
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
141
139
  !item && newNamelessIds.add(id);
142
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
143
140
  item && newNamelessIds.delete(id);
144
141
  }
145
142
  else {
@@ -167,11 +164,8 @@ function stateReducer(state, action) {
167
164
  const newNamelessIds = new Set(state.namelessIds);
168
165
  payload.forEach(id => {
169
166
  if (!state.groupsMapSelected.has(id)) {
170
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
171
167
  const item = state.groupsMap[id] || state.listData.find(el => el.id === id);
172
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
173
168
  item && state.groupsMapSelected.set(id, Object.assign(Object.assign({ id }, (item.name ? { name: item.name } : {})), (item.color ? { color: item.color } : {})));
174
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
175
169
  !item && newNamelessIds.add(id);
176
170
  }
177
171
  });
@@ -183,9 +177,7 @@ function stateReducer(state, action) {
183
177
  case stateActionType_1.StateActionType.ChangeSingleSelection: {
184
178
  const newSelectedId = payload.value ? payload.value : state.defaultValue[0];
185
179
  if (newSelectedId && !state.groupsMapSelected.has(newSelectedId)) {
186
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
187
180
  const item = state.groupsMap[newSelectedId] || state.listData.find(el => el.id === newSelectedId);
188
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
189
181
  item && state.groupsMapSelected.set(newSelectedId, Object.assign(Object.assign({ id: newSelectedId }, (item.name ? { name: item.name } : {})), (item.color ? { color: item.color } : {})));
190
182
  }
191
183
  return Object.assign(Object.assign({}, state), { selectedIds: payload.value ? [payload.value] : (payload.reset ? [...state.defaultValue] : []) });
@@ -205,7 +197,7 @@ function stateReducer(state, action) {
205
197
  let parent = (_b = (_a = state.groupsMap[payload.itemId]) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.id;
206
198
  while (parent && parent !== "root") {
207
199
  parentForDeselect.push(parent);
208
- parent = (_c = state.groupsMap[parent].parent) === null || _c === void 0 ? void 0 : _c.id;
200
+ parent = (_d = (_c = state.groupsMap[parent]) === null || _c === void 0 ? void 0 : _c.parent) === null || _d === void 0 ? void 0 : _d.id;
209
201
  }
210
202
  parentForDeselect.forEach(parentId => {
211
203
  currentSelectedIds.delete(parentId);
@@ -213,7 +205,7 @@ function stateReducer(state, action) {
213
205
  // deselect children
214
206
  const childrenForDeselect = [];
215
207
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
216
- const currentChild = (0, stateReducerHelper_1.getChildList)((_d = state.groupsMap[payload.itemId]) === null || _d === void 0 ? void 0 : _d.children);
208
+ const currentChild = (0, stateReducerHelper_1.getChildList)((_e = state.groupsMap[payload.itemId]) === null || _e === void 0 ? void 0 : _e.children);
217
209
  currentChild.forEach(el => {
218
210
  childrenForDeselect.push(el.id);
219
211
  });
@@ -221,13 +213,12 @@ function stateReducer(state, action) {
221
213
  }
222
214
  currentSelectedIds.forEach(id => {
223
215
  if (!state.groupsMapSelected.has(id)) {
224
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
225
216
  const item = state.groupsMap[id] || state.listData.find(el => el.id === id);
226
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
227
217
  item && state.groupsMapSelected.set(id, Object.assign(Object.assign({ id }, (item.name ? { name: item.name } : {})), (item.color ? { color: item.color } : {})));
228
218
  }
229
219
  });
230
- return Object.assign(Object.assign({}, state), { selectedIds: Array.from(currentSelectedIds) });
220
+ const additionalStateUpdates = (0, stateReducerHelper_1.updateAllSelectedStateValueBasedOnTotalSelected)(state, currentSelectedIds.size);
221
+ return Object.assign(Object.assign(Object.assign({}, state), { selectedIds: Array.from(currentSelectedIds) }), additionalStateUpdates);
231
222
  }
232
223
  case stateActionType_1.StateActionType.ChangeBulkSelection: {
233
224
  const { itemsIds, value } = payload;
@@ -235,17 +226,17 @@ function stateReducer(state, action) {
235
226
  const parentsToProcess = new Set();
236
227
  const childrenToProcess = new Set();
237
228
  itemsIds.forEach(itemId => {
238
- var _a, _b, _c, _d;
229
+ var _a, _b, _c, _d, _e;
239
230
  if (value) {
240
231
  currentSelectedIds.add(itemId);
241
232
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
242
233
  let parent = (_b = (_a = state.groupsMap[itemId]) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.id;
243
234
  while (parent && parent !== "root") {
244
235
  parentsToProcess.add(parent);
245
- parent = (_c = state.groupsMap[parent].parent) === null || _c === void 0 ? void 0 : _c.id;
236
+ parent = (_d = (_c = state.groupsMap[parent]) === null || _c === void 0 ? void 0 : _c.parent) === null || _d === void 0 ? void 0 : _d.id;
246
237
  }
247
238
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
248
- const currentChild = (0, stateReducerHelper_1.getChildList)((_d = state.groupsMap[itemId]) === null || _d === void 0 ? void 0 : _d.children);
239
+ const currentChild = (0, stateReducerHelper_1.getChildList)((_e = state.groupsMap[itemId]) === null || _e === void 0 ? void 0 : _e.children);
249
240
  currentChild.forEach(childId => childrenToProcess.add(childId.id));
250
241
  }
251
242
  else {
@@ -256,36 +247,35 @@ function stateReducer(state, action) {
256
247
  parentsToProcess.forEach(parentId => currentSelectedIds.delete(parentId));
257
248
  currentSelectedIds.forEach(id => {
258
249
  if (!state.groupsMapSelected.has(id)) {
259
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
260
250
  const item = state.groupsMap[id] || state.listData.find(el => el.id === id);
261
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
262
251
  item && state.groupsMapSelected.set(id, Object.assign(Object.assign({ id }, (item.name ? { name: item.name } : {})), (item.color ? { color: item.color } : {})));
263
252
  }
264
253
  });
265
- return Object.assign(Object.assign({}, state), { selectedIds: Array.from(currentSelectedIds) });
254
+ const additionalStateUpdates = (0, stateReducerHelper_1.updateAllSelectedStateValueBasedOnTotalSelected)(state, currentSelectedIds.size);
255
+ return Object.assign(Object.assign(Object.assign({}, state), { selectedIds: Array.from(currentSelectedIds) }), additionalStateUpdates);
266
256
  }
267
257
  case stateActionType_1.StateActionType.SelectAllChildren: {
268
258
  const currentEl = state.groupsMap[payload];
269
259
  const newSelected = new Set(state.selectedIds);
270
260
  const isDisableStateProhibited = state.isNestedList;
271
- (currentEl.children || []).forEach(el => {
272
- var _a, _b;
261
+ ((currentEl === null || currentEl === void 0 ? void 0 : currentEl.children) || []).forEach(el => {
262
+ var _a, _b, _c, _d, _e;
273
263
  if (!newSelected.has(el.id)) {
274
264
  // select when isDisableStateProhibited, or when disabled elements are allowed to be displayed, and this element is not disabled
275
265
  (isDisableStateProhibited || !el.disabled) && newSelected.add(el.id);
276
266
  // deselect parent
277
267
  const parentForDeselect = [];
278
- let parent = (_a = state.groupsMap[el.id].parent) === null || _a === void 0 ? void 0 : _a.id;
268
+ let parent = (_b = (_a = state.groupsMap[el.id]) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.id;
279
269
  while (parent && parent !== "root") {
280
270
  parentForDeselect.push(parent);
281
- parent = (_b = state.groupsMap[parent].parent) === null || _b === void 0 ? void 0 : _b.id;
271
+ parent = (_d = (_c = state.groupsMap[parent]) === null || _c === void 0 ? void 0 : _c.parent) === null || _d === void 0 ? void 0 : _d.id;
282
272
  }
283
273
  parentForDeselect.forEach(parentId => {
284
274
  newSelected.delete(parentId);
285
275
  });
286
276
  //deselect children
287
277
  const childrenForDeselect = [];
288
- const currentChild = (0, stateReducerHelper_1.getChildList)(state.groupsMap[el.id].children);
278
+ const currentChild = (0, stateReducerHelper_1.getChildList)((_e = state.groupsMap[el.id]) === null || _e === void 0 ? void 0 : _e.children);
289
279
  currentChild.forEach(elt => {
290
280
  childrenForDeselect.push(elt.id);
291
281
  });
@@ -294,9 +284,7 @@ function stateReducer(state, action) {
294
284
  });
295
285
  newSelected.forEach(id => {
296
286
  if (!state.groupsMapSelected.has(id)) {
297
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
298
287
  const item = state.groupsMap[id] || state.listData.find(el => el.id === id);
299
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
300
288
  item && state.groupsMapSelected.set(id, Object.assign(Object.assign({ id }, (item.name ? { name: item.name } : {})), (item.color ? { color: item.color } : {})));
301
289
  }
302
290
  });
@@ -307,7 +295,7 @@ function stateReducer(state, action) {
307
295
  // action not submitted for disabled item, other items, even if disabled, not change their state
308
296
  const deselectedItems = payload ? new Set([payload]) : new Set(state.listData.filter(elem => !elem.disabled).map(el => el.id));
309
297
  const newSelected = new Set();
310
- (currentEl.children || []).forEach(el => {
298
+ ((currentEl === null || currentEl === void 0 ? void 0 : currentEl.children) || []).forEach(el => {
311
299
  if (!newSelected.has(el.id) && !deselectedItems.has(el.id)) {
312
300
  newSelected.add(el.id);
313
301
  }
@@ -319,9 +307,7 @@ function stateReducer(state, action) {
319
307
  });
320
308
  newSelected.forEach(id => {
321
309
  if (!state.groupsMapSelected.has(id)) {
322
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
323
310
  const item = state.groupsMap[id] || state.listData.find(el => el.id === id);
324
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
325
311
  item && state.groupsMapSelected.set(id, Object.assign(Object.assign({ id }, (item.name ? { name: item.name } : {})), (item.color ? { color: item.color } : {})));
326
312
  }
327
313
  });
@@ -330,24 +316,24 @@ function stateReducer(state, action) {
330
316
  case stateActionType_1.StateActionType.ToggleValueForAllSelected: {
331
317
  const currentEl = state.groupsMap[groupsHelper_1.ENTIRE_ORGANIZATION_GROUP_ID];
332
318
  const newSelected = new Set();
333
- state.isAllSelected && (currentEl.children || []).forEach(el => {
319
+ state.isAllSelected && ((currentEl === null || currentEl === void 0 ? void 0 : currentEl.children) || []).forEach(el => {
334
320
  if (!newSelected.has(el.id) && el.disabled) {
335
321
  newSelected.add(el.id);
336
322
  }
337
323
  });
338
324
  newSelected.forEach(id => {
339
325
  if (!state.groupsMapSelected.has(id)) {
340
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
341
326
  const item = state.groupsMap[id] || state.listData.find(el => el.id === id);
342
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
343
327
  item && state.groupsMapSelected.set(id, Object.assign(Object.assign({ id }, (item.name ? { name: item.name } : {})), (item.color ? { color: item.color } : {})));
344
328
  }
345
329
  });
346
- return Object.assign(Object.assign({}, state), { selectedIds: state.isAllSelected ? Array.from(newSelected) : [], isAllSelected: state.isFullSelectionMode ? !state.isAllSelected : undefined });
330
+ const updatedIsAllSelectedValue = state.isFullSelectionMode ? !state.isAllSelected : undefined;
331
+ const additionalStateUpdates = (0, stateReducerHelper_1.updateAllSelectedStateValueBasedOnTotalSelected)(state, newSelected.size);
332
+ return Object.assign(Object.assign(Object.assign({}, state), { selectedIds: state.isAllSelected ? Array.from(newSelected) : [], isAllSelected: updatedIsAllSelectedValue }), additionalStateUpdates);
347
333
  }
348
334
  case stateActionType_1.StateActionType.DeselectAllChildren: {
349
335
  const childrenForDeselect = [];
350
- const currentChild = (0, stateReducerHelper_1.getChildList)(state.groupsMap[payload].children);
336
+ const currentChild = (0, stateReducerHelper_1.getChildList)((_f = state.groupsMap[payload]) === null || _f === void 0 ? void 0 : _f.children);
351
337
  const isDisableStateProhibited = state.isNestedList;
352
338
  currentChild.forEach(el => {
353
339
  // 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">>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getChildList = void 0;
3
+ exports.updateAllSelectedStateValueBasedOnTotalSelected = exports.getChildList = void 0;
4
4
  function getChildList(childArr) {
5
5
  const list = [];
6
6
  if (!childArr) {
@@ -16,3 +16,14 @@ function getChildList(childArr) {
16
16
  return list;
17
17
  }
18
18
  exports.getChildList = getChildList;
19
+ const updateAllSelectedStateValueBasedOnTotalSelected = (state, totalSelected) => {
20
+ const additionalStateUpdates = {};
21
+ const groupsMapLength = Object.keys(state.groupsMap).length - 1;
22
+ if (!state.resultsExceedListLimit && !state.isAllSelected && state.isFullSelectionMode && groupsMapLength > 0) {
23
+ if (totalSelected >= groupsMapLength) {
24
+ additionalStateUpdates.isAllSelected = true;
25
+ }
26
+ }
27
+ return additionalStateUpdates;
28
+ };
29
+ exports.updateAllSelectedStateValueBasedOnTotalSelected = updateAllSelectedStateValueBasedOnTotalSelected;
@@ -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;
@@ -2,9 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useDropdownState = void 0;
4
4
  const react_1 = require("react");
5
- const useDropdownState = (withCheckbox) => {
5
+ const useDebouncedMemo_1 = require("../commonHelpers/hooks/useDebouncedMemo");
6
+ const useDropdownState = (withCheckbox, debounceTimeout = 300) => {
6
7
  const [search, setSearch] = (0, react_1.useState)("");
7
8
  const [checked, setChecked] = (0, react_1.useState)(false);
8
- return Object.assign({ search, setSearch }, (withCheckbox ? { checked, setChecked } : {}));
9
+ const debouncedSearch = (0, useDebouncedMemo_1.useDebouncedMemo)(() => search, [search], debounceTimeout);
10
+ const debouncedChecked = (0, useDebouncedMemo_1.useDebouncedMemo)(() => checked, [checked], debounceTimeout);
11
+ return Object.assign({ search: debouncedSearch, setSearch }, (withCheckbox ? { checked: debouncedChecked, setChecked } : {}));
9
12
  };
10
13
  exports.useDropdownState = useDropdownState;
@@ -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>;
@@ -10,15 +10,16 @@ const classNames_1 = require("../../commonHelpers/classNames/classNames");
10
10
  const chip_1 = require("../../chip/chip");
11
11
  const react_2 = __importDefault(require("react"));
12
12
  const iconFilter_1 = require("../../icons/iconFilter");
13
- const iconPin2_1 = require("../../icons/iconPin2");
14
13
  const filtersHelper_1 = require("../filtersHelper");
15
14
  const filtersSavedChipComponent_1 = require("./filtersSavedChipComponent");
16
15
  const iconClose_1 = require("../../icons/iconClose");
17
16
  const chipStatusProvider_1 = require("../../chip/chipStatusProvider");
18
17
  const useLanguage_1 = require("../../utils/localization/useLanguage");
19
- const FiltersContainer = ({ className, isPinned = false, onPinChange, filtersClickHandler, hasSavedFilters, filtersForCalculation, children }) => {
18
+ const useMobile_1 = require("../../commonHelpers/hooks/useMobile");
19
+ const FiltersContainer = ({ className, isPinned = false, onPinChange, filtersClickHandler, hasSavedFilters, filtersForCalculation, children, filtersChipRef }) => {
20
20
  const chipStatus = (0, chipStatusProvider_1.useChipStatus)();
21
21
  const { translate } = (0, useLanguage_1.useLanguage)();
22
+ const isMobile = (0, useMobile_1.useMobile)();
22
23
  const numberOfChangedFilters = (0, react_1.useMemo)(() => {
23
24
  const suppressedFilters = new Set();
24
25
  filtersForCalculation.forEach(filter => {
@@ -31,12 +32,7 @@ const FiltersContainer = ({ className, isPinned = false, onPinChange, filtersCli
31
32
  const filteredState = (0, filtersHelper_1.getFiltersState)(filtersForCalculation.filter(f => !suppressedFilters.has(f.props.id)));
32
33
  return (0, filtersHelper_1.getNumberOfChangedFilters)(filteredState);
33
34
  }, [filtersForCalculation]);
34
- const filtersChipRef = (0, react_1.useRef)(null);
35
- const handlePinChange = (0, react_1.useCallback)((newIsPinned) => {
36
- onPinChange && onPinChange(newIsPinned);
37
- }, [onPinChange]);
38
- const pinComponent = (0, react_1.useMemo)(() => (0, jsx_runtime_1.jsx)(chip_1.Chip, { active: isPinned, status: isPinned ? "accent" : undefined, onChange: handlePinChange, icon: iconPin2_1.IconPin2, children: isPinned ? "" : "+" }), [isPinned, handlePinChange]);
39
- const filtersChipComponent = (0, react_1.useMemo)(() => (0, jsx_runtime_1.jsx)(chip_1.Chip, { quantity: numberOfChangedFilters, isOpen: false, status: numberOfChangedFilters > 0 ? chipStatus || "active" : undefined, onClick: filtersClickHandler, icon: iconFilter_1.IconFilter, title: translate("All Filters"), triggerRef: filtersChipRef, children: "+" }), [numberOfChangedFilters, chipStatus, filtersClickHandler, translate]);
35
+ const filtersChipComponent = (0, react_1.useMemo)(() => (0, jsx_runtime_1.jsx)(chip_1.Chip, { quantity: numberOfChangedFilters, isOpen: false, status: numberOfChangedFilters > 0 ? chipStatus || "active" : undefined, onClick: filtersClickHandler, icon: iconFilter_1.IconFilter, title: translate("All Filters"), triggerRef: filtersChipRef, children: "+" }), [numberOfChangedFilters, chipStatus, filtersClickHandler, translate, filtersChipRef]);
40
36
  const childrenSignature = (0, react_1.useMemo)(() => {
41
37
  const childrenArray = react_2.default.Children.toArray(children).filter(Boolean);
42
38
  return childrenArray
@@ -48,10 +44,11 @@ const FiltersContainer = ({ className, isPinned = false, onPinChange, filtersCli
48
44
  const state = child.props.state;
49
45
  const defaultState = child.props.defaultState;
50
46
  const childPropsQuery = JSON.stringify(child.props.fetchState || {});
47
+ const childPropsDataItems = JSON.stringify(child.props.dataItems || "no-data-items");
51
48
  const stateHash = (0, filtersHelper_1.createStateHash)(state);
52
49
  const defaultStateHash = (0, filtersHelper_1.createStateHash)(defaultState);
53
50
  const propsHash = (0, filtersHelper_1.createPropsHash)(child.props);
54
- return `${childId}|${stateHash}|${defaultStateHash}|${propsHash}|${childPropsQuery}`;
51
+ return `${childId}|${stateHash}|${defaultStateHash}|${propsHash}|${childPropsQuery}|${childPropsDataItems}`;
55
52
  })
56
53
  .join("||");
57
54
  }, [children]);
@@ -72,10 +69,12 @@ const FiltersContainer = ({ className, isPinned = false, onPinChange, filtersCli
72
69
  }
73
70
  });
74
71
  onPinChange === null || onPinChange === void 0 ? void 0 : onPinChange(false);
75
- }, [filtersForCalculation, onPinChange]);
72
+ filtersChipRef.current.focus();
73
+ }, [filtersChipRef, filtersForCalculation, onPinChange]);
76
74
  const chipRemovalComponent = (0, react_1.useMemo)(() => numberOfChangedFilters ?
77
75
  (0, jsx_runtime_1.jsx)(chip_1.Chip, { title: translate("Clear"), className: "zen-filters-container__removal-chip", active: false, status: isPinned ? "accent" : undefined, onChange: handleRemovalClick, icon: iconClose_1.IconClose })
78
76
  : null, [isPinned, handleRemovalClick, translate, numberOfChangedFilters]);
79
- return (0, jsx_runtime_1.jsxs)("div", { className: (0, classNames_1.classNames)(["zen-filters-container", className || ""]), children: [memoizedChildren, onPinChange ? pinComponent : null, hasSavedFilters ? (0, jsx_runtime_1.jsx)(filtersSavedChipComponent_1.FiltersSavedChipComponent, {}) : null, filtersChipComponent, chipRemovalComponent] });
77
+ const memoizedFiltersElements = (0, react_1.useMemo)(() => (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [memoizedChildren, hasSavedFilters ? (0, jsx_runtime_1.jsx)(filtersSavedChipComponent_1.FiltersSavedChipComponent, {}) : null, filtersChipComponent, chipRemovalComponent] }), [chipRemovalComponent, filtersChipComponent, hasSavedFilters, memoizedChildren]);
78
+ return (0, jsx_runtime_1.jsx)("div", { className: (0, classNames_1.classNames)(["zen-filters-container", isMobile ? "zen-filters-container--mobile" : "", className || ""]), children: isMobile ? (0, jsx_runtime_1.jsx)("div", { className: "zen-filters-container__mobile-scroll-wrapper", children: memoizedFiltersElements }) : memoizedFiltersElements });
80
79
  };
81
80
  exports.FiltersContainer = FiltersContainer;
@@ -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,27 @@
1
+ "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.FiltersDateInput = exports.FiltersDateInputDisplayName = void 0;
15
+ const jsx_runtime_1 = require("react/jsx-runtime");
16
+ const react_1 = require("react");
17
+ const classNames_1 = require("../../commonHelpers/classNames/classNames");
18
+ const dateInput_1 = require("../../dateInput/dateInput");
19
+ const iconCalendar_1 = require("../../icons/iconCalendar");
20
+ exports.FiltersDateInputDisplayName = "FiltersDateInput";
21
+ const FiltersDateInput = (_a) => {
22
+ var { className, state, defaultState, name, onChange: onChangeState, id, chipIcon } = _a, otherRangeProps = __rest(_a, ["className", "state", "defaultState", "name", "onChange", "id", "chipIcon"]);
23
+ const component = (0, react_1.useMemo)(() => (0, jsx_runtime_1.jsx)(dateInput_1.DateInput, Object.assign({}, otherRangeProps, { buttonLabel: name, value: state, onChange: onChangeState, defaultValue: defaultState, className: (0, classNames_1.classNames)(["zen-filters-date-input", className || ""]), chip: true, chipId: id, chipName: name, chipIcon: chipIcon || iconCalendar_1.IconCalendar })), [otherRangeProps, chipIcon, state, onChangeState, defaultState, className, id, name]);
24
+ return component;
25
+ };
26
+ exports.FiltersDateInput = FiltersDateInput;
27
+ exports.FiltersDateInput.displayName = exports.FiltersDateInputDisplayName;
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
- import { IDropdown, IDropdownFullSelection, IDropdownFullSelectionWithCheckbox, IDropdownWithCheckbox, IFetchDropdownState } from "../../dropdown/dropdown";
2
+ import { IDropdown, IDropdownFullSelection, IDropdownFullSelectionWithCheckbox, IDropdownWithCheckbox, IFetchDropdownState, IDropdownItem } from "../../dropdown/dropdown";
3
3
  import { IFiltersItem } from "./filtersItem";
4
- export interface IFiltersDropdownProps extends Omit<IDropdown | IDropdownFullSelection | IDropdownWithCheckbox | IDropdownFullSelectionWithCheckbox, "value" | "onChange" | "defaultValue" | "className" | "getData" | "dataItems" | "isLoading" | "errorHandler"> {
4
+ export interface IFiltersDropdownProps extends Omit<IDropdown | IDropdownFullSelection | IDropdownWithCheckbox | IDropdownFullSelectionWithCheckbox, "value" | "onChange" | "defaultValue" | "className" | "getData" | "errorHandler"> {
5
5
  }
6
6
  export type TFiltersDropdownState = string[];
7
7
  export interface IFiltersDropdownFullSelectionState {
@@ -22,11 +22,12 @@ export type TFiltersDropdownAllStates = TFiltersDropdownState | TFiltersDropdown
22
22
  export type TInferOnChangeType<T> = T extends string[] ? (state: string[]) => void : T extends IFiltersDropdownWithCheckboxState ? (state: IFiltersDropdownWithCheckboxState) => void : T extends IFiltersDropdownFullSelectionState ? (state: IFiltersDropdownFullSelectionState) => void : T extends IFiltersDropdownFullSelectionWithCheckboxState ? (state: IFiltersDropdownFullSelectionWithCheckboxState) => void : (state: T) => void;
23
23
  export interface IFiltersDropdown<T extends TFiltersDropdownAllStates = TFiltersDropdownState> extends Omit<IFiltersItem<T>, "onChange" | "defaultState">, IFiltersDropdownProps {
24
24
  onChange: TInferOnChangeType<T>;
25
- fetchState: IFetchDropdownState;
25
+ fetchState?: IFetchDropdownState;
26
+ dataItems?: IDropdownItem[];
26
27
  defaultState?: T;
27
28
  }
28
29
  export declare const FiltersDropdownDisplayName = "FiltersDropdown";
29
- export declare function FiltersDropdown<T extends TFiltersDropdownAllStates = TFiltersDropdownState>({ className, state, name, defaultState, onChange: onChangeState, id, chipIcon, classNamePopup, fetchState, ...restDropdownProps }: IFiltersDropdown<T>): React.JSX.Element;
30
+ export declare function FiltersDropdown<T extends TFiltersDropdownAllStates = TFiltersDropdownState>({ className, state, name, defaultState, onChange: onChangeState, id, chipIcon, classNamePopup, fetchState, dataItems, isLoading, ...restDropdownProps }: IFiltersDropdown<T>): React.JSX.Element;
30
31
  export declare namespace FiltersDropdown {
31
32
  var displayName: string;
32
33
  }
@@ -20,7 +20,7 @@ const iconFilter_1 = require("../../icons/iconFilter");
20
20
  const filtersHelper_1 = require("../filtersHelper");
21
21
  exports.FiltersDropdownDisplayName = "FiltersDropdown";
22
22
  function FiltersDropdown(_a) {
23
- var { className, state, name, defaultState, onChange: onChangeState, id, chipIcon, classNamePopup, fetchState } = _a, restDropdownProps = __rest(_a, ["className", "state", "name", "defaultState", "onChange", "id", "chipIcon", "classNamePopup", "fetchState"]);
23
+ var { className, state, name, defaultState, onChange: onChangeState, id, chipIcon, classNamePopup, fetchState, dataItems, isLoading } = _a, restDropdownProps = __rest(_a, ["className", "state", "name", "defaultState", "onChange", "id", "chipIcon", "classNamePopup", "fetchState", "dataItems", "isLoading"]);
24
24
  const prepareValue = (value) => {
25
25
  if (Array.isArray(value)) {
26
26
  return value.map((item) => item.id);
@@ -33,9 +33,9 @@ function FiltersDropdown(_a) {
33
33
  const dropdownPropsForComponent = Object.assign(Object.assign({}, restDropdownProps), { value: state, onChange: (newValue) => {
34
34
  const preparedValue = prepareValue(newValue);
35
35
  onChangeState(preparedValue);
36
- }, multiselect: dropdownStateType === "fullSelection" || dropdownStateType === "fullSelectionWithCheckbox" ? true : restDropdownProps.multiselect, selectAllButton: dropdownStateType === "fullSelection" || dropdownStateType === "fullSelectionWithCheckbox" ? true : restDropdownProps.selectAllButton, fetchState: fetchState, isLoading: undefined, errorHandler: (() => { }), placeholder: restDropdownProps.placeholder || name, defaultValue: memoizedDefaultState, className: (0, classNames_1.classNames)(["zen-filters-dropdown", className || ""]), classNamePopup: (0, classNames_1.classNames)(["zen-filters-dropdown-popup", classNamePopup || ""]), chip: true, chipId: id, chipName: name, chipIcon: chipIcon || iconFilter_1.IconFilter });
36
+ }, multiselect: dropdownStateType === "fullSelection" || dropdownStateType === "fullSelectionWithCheckbox" ? true : restDropdownProps.multiselect, selectAllButton: dropdownStateType === "fullSelection" || dropdownStateType === "fullSelectionWithCheckbox" ? true : restDropdownProps.selectAllButton, fetchState: fetchState, dataItems: dataItems, isLoading: dataItems !== undefined ? isLoading : undefined, errorHandler: (() => { }), placeholder: restDropdownProps.placeholder || name, defaultValue: memoizedDefaultState, className: (0, classNames_1.classNames)(["zen-filters-dropdown", className || ""]), classNamePopup: (0, classNames_1.classNames)(["zen-filters-dropdown-popup", classNamePopup || ""]), chip: true, chipId: id, chipName: name, chipIcon: chipIcon || iconFilter_1.IconFilter });
37
37
  return (0, jsx_runtime_1.jsx)(dropdown_1.Dropdown, Object.assign({}, dropdownPropsForComponent));
38
- }, [restDropdownProps, state, dropdownStateType, memoizedDefaultState, fetchState, className, classNamePopup, id, name, chipIcon, onChangeState]);
38
+ }, [restDropdownProps, state, dropdownStateType, fetchState, dataItems, isLoading, name, memoizedDefaultState, className, classNamePopup, id, chipIcon, onChangeState]);
39
39
  return component;
40
40
  }
41
41
  exports.FiltersDropdown = FiltersDropdown;
@@ -0,0 +1,2 @@
1
+ import "./filtersEmptySelectedList.less";
2
+ export declare const FiltersEmptySelectedList: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FiltersEmptySelectedList = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const useLanguage_1 = require("../../utils/localization/useLanguage");
6
+ const imageLooking_1 = require("../../images/imageLooking");
7
+ const FiltersEmptySelectedList = () => {
8
+ const { translate } = (0, useLanguage_1.useLanguage)();
9
+ return (0, jsx_runtime_1.jsxs)("div", { className: "zen-filters-empty-selected-list", children: [(0, jsx_runtime_1.jsx)(imageLooking_1.ImageLooking, { className: "zen-filters-empty-selected-list__image", title: translate("No Filters Selected"), description: translate("Selected filters will appear here.") }), (0, jsx_runtime_1.jsxs)("div", { className: "zen-filters-empty-selected-list__text", children: [(0, jsx_runtime_1.jsx)("div", { className: "zen-filters-empty-selected-list__header", children: translate("No Filters Selected") }), (0, jsx_runtime_1.jsx)("div", { className: "zen-filters-empty-selected-list__description", children: translate("Selected filters will appear here.") })] })] });
10
+ };
11
+ exports.FiltersEmptySelectedList = FiltersEmptySelectedList;
@@ -5,6 +5,7 @@ import { FiltersDateRange, IFiltersDateRangeItem, TFiltersDateRangeState } from
5
5
  import { FiltersDropdown, IFiltersDropdown, TFiltersDropdownAllStates } from "./filtersDropdown";
6
6
  import { FiltersGroups, IFiltersGroups } from "./filtersGroups";
7
7
  import { FiltersRange, IFiltersRange, IFiltersRangeState } from "./filtersRange";
8
+ import { FiltersDateInput, IFiltersDateInput, TFiltersDateInputState } from "./filtersDateInput";
8
9
  export interface IFiltersItem<State = unknown> {
9
10
  id: string;
10
11
  name: string;
@@ -15,11 +16,11 @@ export interface IFiltersItem<State = unknown> {
15
16
  inhibit?: string[];
16
17
  className?: string;
17
18
  }
18
- export type TFiltersComponents = typeof FiltersChip | typeof FiltersDateRange | typeof FiltersDropdown | typeof FiltersGroups | typeof FiltersRange;
19
- export type TFiltersComponentsProps = IFiltersChip | IFiltersDateRangeItem | IFiltersDropdown | IFiltersGroups | IFiltersRange;
20
- export type TFiltersComponentsItemState = boolean | TFiltersDateRangeState | TFiltersDropdownAllStates | IGroupsFilterTotalState | IFiltersRangeState;
19
+ export type TFiltersComponents = typeof FiltersChip | typeof FiltersDateRange | typeof FiltersDateInput | typeof FiltersDropdown | typeof FiltersGroups | typeof FiltersRange;
20
+ export type TFiltersComponentsProps = IFiltersChip | IFiltersDateRangeItem | IFiltersDropdown | IFiltersGroups | IFiltersRange | IFiltersDateInput;
21
+ export type TFiltersComponentsItemState = boolean | TFiltersDateRangeState | TFiltersDropdownAllStates | IGroupsFilterTotalState | IFiltersRangeState | TFiltersDateInputState;
21
22
  export declare const allowedFiltersComponents: ({
22
23
  <P extends import("./filtersDateRange").IFiltersDateRangeProps = import("./filtersDateRange").IFiltersDateRangeProps>({ className, state, defaultState, name, onChange: onChangeState, id, allowUnsetValue, chipIcon, ...dateRangeProps }: IFiltersDateRangeItem<P>): React.JSX.Element;
23
24
  displayName: string;
24
- } | React.FC<IFiltersGroups> | React.FC<IFiltersRange> | React.FC<IFiltersChip> | typeof FiltersDropdown)[];
25
+ } | React.FC<IFiltersGroups> | React.FC<IFiltersRange> | React.FC<IFiltersDateInput> | React.FC<IFiltersChip> | typeof FiltersDropdown)[];
25
26
  export declare const getAllowedFilters: <T extends React.ReactNode>(items: T[]) => React.ReactElement<unknown, string | React.JSXElementConstructor<any>>[];
@@ -10,7 +10,8 @@ const filtersDateRange_1 = require("./filtersDateRange");
10
10
  const filtersDropdown_1 = require("./filtersDropdown");
11
11
  const filtersGroups_1 = require("./filtersGroups");
12
12
  const filtersRange_1 = require("./filtersRange");
13
- exports.allowedFiltersComponents = [filtersChip_1.FiltersChip, filtersDateRange_1.FiltersDateRange, filtersDropdown_1.FiltersDropdown, filtersGroups_1.FiltersGroups, filtersRange_1.FiltersRange];
13
+ const filtersDateInput_1 = require("./filtersDateInput");
14
+ exports.allowedFiltersComponents = [filtersChip_1.FiltersChip, filtersDateRange_1.FiltersDateRange, filtersDropdown_1.FiltersDropdown, filtersGroups_1.FiltersGroups, filtersRange_1.FiltersRange, filtersDateInput_1.FiltersDateInput];
14
15
  const getAllowedFilters = (items) => items.reduce((acc, item) => {
15
16
  if (!item || !react_1.default.isValidElement(item)) {
16
17
  return acc;
@@ -3,5 +3,7 @@ export interface IFiltersModal {
3
3
  isOpen: boolean;
4
4
  onClose: (isOpen: boolean) => void;
5
5
  onSave: (filterName: string) => void;
6
+ className?: string;
7
+ prioritize?: boolean;
6
8
  }
7
- export declare const FiltersSaveModal: ({ isOpen, onClose, onSave }: IFiltersModal) => import("react/jsx-runtime").JSX.Element;
9
+ export declare const FiltersSaveModal: ({ isOpen, onClose, onSave, className, prioritize }: IFiltersModal) => import("react/jsx-runtime").JSX.Element;
@@ -9,7 +9,7 @@ const textInput_1 = require("../../textInput/textInput");
9
9
  const filtersSavedItemsProvider_1 = require("./filtersSavedItemsProvider");
10
10
  const iconDisk_1 = require("../../icons/iconDisk");
11
11
  const useDriveClassName_1 = require("../../utils/theme/useDriveClassName");
12
- const FiltersSaveModal = ({ isOpen, onClose, onSave }) => {
12
+ const FiltersSaveModal = ({ isOpen, onClose, onSave, className, prioritize }) => {
13
13
  const { translate } = (0, useLanguage_1.useLanguage)();
14
14
  const { items } = (0, filtersSavedItemsProvider_1.useFiltersSavedItems)();
15
15
  const iconDriveClassName = (0, useDriveClassName_1.useDriveClassName)("icon");
@@ -48,6 +48,6 @@ const FiltersSaveModal = ({ isOpen, onClose, onSave }) => {
48
48
  return "";
49
49
  }, [filterName, isValidFilterName, items, translate]);
50
50
  const saveIcon = (0, react_1.useCallback)(() => (0, jsx_runtime_1.jsx)(iconDisk_1.IconDisk, { description: translate("Save"), className: "svgIcon", size: iconDriveClassName ? "huge" : "large" }), [iconDriveClassName, translate]);
51
- return (0, jsx_runtime_1.jsxs)(modal_1.Modal, { isOpen: isOpen, onClose: toggleSaveModal, title: translate("Save filters"), children: [(0, jsx_runtime_1.jsx)("div", { className: "zen-filters-modal__content", children: (0, jsx_runtime_1.jsx)(textInput_1.TextInput, { value: filterName, ariaLabel: translate("Filter title"), placeholder: translate("Filter title"), onChange: handleSaveModalFieldChange, maxLength: 100, error: errorText }) }), (0, jsx_runtime_1.jsx)(modal_1.Modal.SecondaryButton, { onClick: handleCancelSaveModal, title: translate("Cancel"), children: translate("Cancel") }), (0, jsx_runtime_1.jsx)(modal_1.Modal.PrimaryButton, { onClick: handleApplySaveModal, icon: saveIcon, title: translate("Save"), children: translate("Save") })] });
51
+ return (0, jsx_runtime_1.jsxs)(modal_1.Modal, { focus: "content", modalContainerClassName: prioritize ? "zen-filters-prioritized-modal" : "", isOpen: isOpen, onClose: toggleSaveModal, title: translate("Save filters"), className: className || "", children: [(0, jsx_runtime_1.jsx)("div", { className: "zen-filters-modal__content", children: (0, jsx_runtime_1.jsx)(textInput_1.TextInput, { value: filterName, ariaLabel: translate("Filter title"), placeholder: translate("Filter title"), onChange: handleSaveModalFieldChange, maxLength: 100, error: errorText }) }), (0, jsx_runtime_1.jsx)(modal_1.Modal.SecondaryButton, { onClick: handleCancelSaveModal, title: translate("Cancel"), children: translate("Cancel") }), (0, jsx_runtime_1.jsx)(modal_1.Modal.PrimaryButton, { onClick: handleApplySaveModal, icon: saveIcon, title: translate("Save"), children: translate("Save") })] });
52
52
  };
53
53
  exports.FiltersSaveModal = FiltersSaveModal;