@geotab/zenith 3.1.1-beta.6 → 3.2.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 (430) hide show
  1. package/README.md +20 -0
  2. package/dist/advancedGroupsFilter/advancedGroupsFilter.js +136 -30
  3. package/dist/advancedGroupsFilter/advancedGroupsFilterForm.js +139 -34
  4. package/dist/advancedGroupsFilter/advancedGroupsFilterFormSection.js +352 -87
  5. package/dist/advancedGroupsFilter/advancedGroupsFilterSectionTooltip.d.ts +0 -1
  6. package/dist/advancedGroupsFilter/advancedGroupsFilterSectionTooltip.js +83 -9
  7. package/dist/alertRaw/alertRaw.js +175 -54
  8. package/dist/banner/bannerMultipLine.js +131 -23
  9. package/dist/banner/bannerSingleLine.js +110 -16
  10. package/dist/betaPill/betaPill.js +111 -20
  11. package/dist/bookmark/bookmark.js +95 -28
  12. package/dist/bulkEditControl/bulkEditControl.js +167 -34
  13. package/dist/calendar/calendar.js +943 -273
  14. package/dist/calendar/calendarUtils.js +157 -85
  15. package/dist/card/card.js +268 -123
  16. package/dist/chart/accessibleChart/accessibleChartNarrative.js +648 -555
  17. package/dist/chart/accessibleChart/accessibleChartTable.js +245 -86
  18. package/dist/chart/chart.js +36 -21
  19. package/dist/chart/chartAxis/chartAxis.js +85 -7
  20. package/dist/checkboxListWithAction/checkboxListWithAction.js +224 -69
  21. package/dist/chip/chip.js +195 -91
  22. package/dist/columnsSelector/columnsSelector.js +97 -12
  23. package/dist/columnsSelector/columnsTab/columnsTab.js +59 -15
  24. package/dist/columnsSelector/columnsTabGroup/columnsTabGroup.js +81 -34
  25. package/dist/comboboxSelected/comboboxSelected.js +1 -3
  26. package/dist/dataFeed/feedExpandControl/feedExpandControl.js +25 -10
  27. package/dist/dataGrid/columns/checkboxColumn/checkboxHeaderCell.js +92 -11
  28. package/dist/dataGrid/dataGrid.js +227 -117
  29. package/dist/dataGrid/emptySearchList/emptySearchList.js +56 -9
  30. package/dist/dataGrid/entitiesListActions/actions/columnsListButton.js +51 -7
  31. package/dist/dataGrid/entitiesListActions/actions/fullscreenButton.js +64 -18
  32. package/dist/dataGrid/withFlexibleColumns/components/columnSettings.js +84 -10
  33. package/dist/dataGrid/withFlexibleColumns/components/columnSettingsSidePanel.js +48 -16
  34. package/dist/dataGrid/withSelectableRows/components/bulkActions/bulkActions.js +223 -32
  35. package/dist/dataGrid/withSelectableRows/withSelectableRows.js +286 -213
  36. package/dist/dataGrid/withSortableColumns/columns/sortableColumnWrapper.js +178 -95
  37. package/dist/dateInputInner/dateInputInner.js +791 -476
  38. package/dist/dateInputInner/dateInputInnerControlBlock.js +125 -22
  39. package/dist/dateInputRaw/dateInputRaw.js +315 -104
  40. package/dist/dateInputRaw/utils/getLabel.js +38 -7
  41. package/dist/dateRangeInner/dateRangeInner.js +172 -58
  42. package/dist/dateRangeRaw/dateRangeRaw.js +601 -239
  43. package/dist/dateRangeRaw/utils/dateRangeUtils.js +629 -241
  44. package/dist/dateSelectionWrapper/dateSelectionWrapper.js +152 -14
  45. package/dist/dialog/dialogContent.js +123 -40
  46. package/dist/dropdownRaw/dropdownHelper.d.ts +2 -2
  47. package/dist/dropdownRaw/dropdownHelper.js +9 -9
  48. package/dist/dropdownRaw/dropdownList.js +447 -78
  49. package/dist/dropdownRaw/dropdownPopup.js +218 -20
  50. package/dist/dropdownRaw/dropdownRaw.js +866 -506
  51. package/dist/dropdownRaw/dropdownSearchableTrigger.js +223 -46
  52. package/dist/dropdownRaw/stateReducer/stateAction.d.ts +5 -1
  53. package/dist/dropdownRaw/stateReducer/stateActionType.d.ts +2 -1
  54. package/dist/dropdownRaw/stateReducer/stateActionType.js +1 -0
  55. package/dist/dropdownRaw/stateReducer/stateReducer.d.ts +6 -1
  56. package/dist/dropdownRaw/stateReducer/stateReducer.js +24 -12
  57. package/dist/dropdownRaw/stateReducer/stateReducerHelper.d.ts +2 -0
  58. package/dist/dropdownRaw/stateReducer/stateReducerHelper.js +20 -1
  59. package/dist/dropdownRaw/stateReducer/stateReducerTestData.d.ts +39 -0
  60. package/dist/dropdownRaw/stateReducer/stateReducerTestData.js +74 -0
  61. package/dist/dropdownRaw/types.d.ts +1 -0
  62. package/dist/favoriteButton/favoriteButton.js +59 -10
  63. package/dist/filters/components/filtersContainer.js +151 -64
  64. package/dist/filters/components/filtersEmptySelectedList.js +30 -4
  65. package/dist/filters/components/filtersSaveModal.js +140 -42
  66. package/dist/filters/components/filtersSavedChipComponent.js +318 -108
  67. package/dist/filters/components/filtersSearchItemData.js +127 -47
  68. package/dist/filters/components/filtersSearchList.js +381 -179
  69. package/dist/filters/components/filtersSelect.js +128 -61
  70. package/dist/filters/components/filtersSelectListItem.js +125 -13
  71. package/dist/filters/components/filtersSidePanel.js +510 -178
  72. package/dist/filters/filters.js +445 -268
  73. package/dist/filtersBar/components/filtersBarPeriodPicker/getRangeOption.js +729 -272
  74. package/dist/filtersBar/components/resetComponentButton.js +45 -5
  75. package/dist/filtersBar/filtersBarActions/filtersBarActions.js +126 -15
  76. package/dist/filtersBar/filtersBarSidePanel/components/filtersBarSidePanelRange/filtersBarSidePanelRange.js +155 -49
  77. package/dist/filtersBar/filtersBarSidePanel/filtersBarSidePanel.js +360 -104
  78. package/dist/filtersBar/filtersContainer/filtersContainer.js +204 -134
  79. package/dist/formField/components/formFieldWithLabel.d.ts +2 -1
  80. package/dist/formField/components/formFieldWithLabel.js +3 -2
  81. package/dist/formField/components/formFieldWithoutLabel.d.ts +2 -1
  82. package/dist/formField/components/formFieldWithoutLabel.js +3 -3
  83. package/dist/formField/components/trailingComponent.d.ts +8 -0
  84. package/dist/formField/components/trailingComponent.js +11 -0
  85. package/dist/formField/formField.js +12 -11
  86. package/dist/formField/hooks/useError.js +100 -36
  87. package/dist/formGroup/components/reviewListToggle/reviewListToggle.js +72 -7
  88. package/dist/formGroup/hooks/useToggle.js +37 -11
  89. package/dist/formGroup/utils/getControls.js +8 -7
  90. package/dist/formLayout/hooks/useError.js +55 -15
  91. package/dist/formLayout/hooks/useFormButtons.js +128 -27
  92. package/dist/formSection/components/formSectionModal.js +1 -1
  93. package/dist/formSection/formSection.js +1 -1
  94. package/dist/formSection/hooks/useError.js +70 -22
  95. package/dist/formStepper/components/formStep.js +65 -10
  96. package/dist/formStepper/formStepper.js +129 -33
  97. package/dist/formStepperButtons/formStepperButtons.js +184 -38
  98. package/dist/groupsFilter/groupsHelper.d.ts +1 -1
  99. package/dist/groupsFilterRaw/groupsFilterAdjustmentState.js +162 -17
  100. package/dist/groupsFilterRaw/groupsFilterBox.js +137 -32
  101. package/dist/groupsFilterRaw/groupsFilterCommon.js +75 -8
  102. package/dist/groupsFilterRaw/groupsFilterCurrentlySelectedState.js +184 -25
  103. package/dist/groupsFilterRaw/groupsFilterHelper.d.ts +2 -1
  104. package/dist/groupsFilterRaw/groupsFilterHelper.js +284 -168
  105. package/dist/groupsFilterRaw/groupsFilterInitialState.js +266 -18
  106. package/dist/groupsFilterRaw/groupsFilterMenu.js +124 -9
  107. package/dist/groupsFilterRaw/groupsFilterRaw.d.ts +1 -0
  108. package/dist/groupsFilterRaw/groupsFilterRaw.js +816 -308
  109. package/dist/groupsFilterRaw/groupsFilterTestData.d.ts +155 -2
  110. package/dist/groupsFilterRaw/groupsFilterTestData.js +153 -58
  111. package/dist/groupsFilterRaw/groupsFilterTrigger.js +139 -35
  112. package/dist/groupsFilterRaw/groupsHelper.js +739 -208
  113. package/dist/groupsFilterRaw/stateReducer/stateReducerHelper.js +3 -1
  114. package/dist/groupsFilterRaw/types.d.ts +1 -0
  115. package/dist/header/components/collapsedItemsControl/collapsedItemsControl.js +107 -52
  116. package/dist/header/components/mobileFilterControl/mobileFilterControl.js +62 -9
  117. package/dist/header/components/mobileSearchControl/mobileSearchControl.js +119 -14
  118. package/dist/header/headerBack.js +64 -20
  119. package/dist/index.css +110 -71
  120. package/dist/index.d.ts +1 -0
  121. package/dist/index.js +4 -1
  122. package/dist/list/itemData/itemDataInternal.js +216 -51
  123. package/dist/list/listItem/listItem.js +168 -55
  124. package/dist/menu/components/menuErrorItem.js +33 -5
  125. package/dist/mobileSheet/mobileSheet.js +195 -69
  126. package/dist/modal/modal.js +300 -142
  127. package/dist/nav/nav.js +1 -1
  128. package/dist/nav/navFooter/navFooter.js +82 -39
  129. package/dist/nav/navFooter/navFooterAction/navFooterAction.js +52 -13
  130. package/dist/nav/navHeader/navHeader.js +86 -36
  131. package/dist/nav/navHeader/navHeaderSearch/navHeaderSearch.js +88 -29
  132. package/dist/nav/navItem/navItem.d.ts +3 -3
  133. package/dist/nav/navItem/navItem.js +35 -33
  134. package/dist/nav/navMobileBar/navMobileBar.js +67 -21
  135. package/dist/notification/notification.js +124 -21
  136. package/dist/pagination/paginationArrow.js +81 -11
  137. package/dist/pagination/paginationText/paginationText.js +45 -11
  138. package/dist/pill/components/pillNonActionable/pillNonActionable.js +93 -24
  139. package/dist/pillBox/components/pillBoxItem.js +52 -9
  140. package/dist/pillBox/pillBox.js +121 -20
  141. package/dist/pillExpandable/pillExpandable.js +333 -139
  142. package/dist/rangeRaw/rangeRaw.js +486 -141
  143. package/dist/rangeRaw/utils/rangeHelper.js +209 -39
  144. package/dist/searchInputRaw/searchInputRaw.js +180 -65
  145. package/dist/skeleton/skeleton.js +51 -6
  146. package/dist/sortControl/sortControl.js +152 -42
  147. package/dist/stepperRaw/stepperRaw.js +116 -42
  148. package/dist/summary/summary.js +94 -8
  149. package/dist/table/actions/actionsMenu.js +171 -78
  150. package/dist/table/flexible/columnSettings.js +80 -10
  151. package/dist/table/flexible/columnsList.js +110 -43
  152. package/dist/table/flexible/columnsPopup.js +77 -20
  153. package/dist/table/nested/useNestedRows.js +167 -77
  154. package/dist/table/selectable/selectableHeader.js +180 -41
  155. package/dist/table/selectable/useSelectableRows.js +270 -191
  156. package/dist/table/sortable/sortableHeader.js +153 -75
  157. package/dist/tabs/tabs.js +227 -118
  158. package/dist/timePickerRaw/timePickerRaw.js +278 -58
  159. package/dist/toastRaw/toastRaw.js +138 -32
  160. package/dist/toggleButton/toggleButton.d.ts +0 -1
  161. package/dist/toggleButtonRaw/toggleButtonRaw.d.ts +1 -0
  162. package/dist/toggleButtonRaw/toggleButtonRaw.js +146 -40
  163. package/dist/utils/formatDate.js +1001 -117
  164. package/{esm/utils/localization/translations/cs-json.js → dist/utils/localization/translations/cs.json} +11 -12
  165. package/{esm/utils/localization/translations/da-DK-json.js → dist/utils/localization/translations/da-DK.json} +31 -23
  166. package/{esm/utils/localization/translations/de-json.js → dist/utils/localization/translations/de.json} +12 -13
  167. package/dist/utils/localization/translations/en.json +308 -0
  168. package/{esm/utils/localization/translations/es-json.js → dist/utils/localization/translations/es.json} +11 -12
  169. package/{esm/utils/localization/translations/fi-FI-json.js → dist/utils/localization/translations/fi-FI.json} +31 -23
  170. package/{esm/utils/localization/translations/fr-FR-json.js → dist/utils/localization/translations/fr-FR.json} +12 -12
  171. package/{esm/utils/localization/translations/fr-json.js → dist/utils/localization/translations/fr.json} +11 -12
  172. package/{esm/utils/localization/translations/hu-HU-json.js → dist/utils/localization/translations/hu-HU.json} +31 -23
  173. package/{esm/utils/localization/translations/id-json.js → dist/utils/localization/translations/id.json} +11 -13
  174. package/{esm/utils/localization/translations/it-json.js → dist/utils/localization/translations/it.json} +11 -12
  175. package/{esm/utils/localization/translations/ja-json.js → dist/utils/localization/translations/ja.json} +11 -12
  176. package/{esm/utils/localization/translations/ko-KR-json.js → dist/utils/localization/translations/ko-KR.json} +24 -23
  177. package/{esm/utils/localization/translations/ms-json.js → dist/utils/localization/translations/ms.json} +11 -12
  178. package/{esm/utils/localization/translations/nb-NO-json.js → dist/utils/localization/translations/nb-NO.json} +31 -23
  179. package/{esm/utils/localization/translations/nl-json.js → dist/utils/localization/translations/nl.json} +11 -12
  180. package/{esm/utils/localization/translations/pl-json.js → dist/utils/localization/translations/pl.json} +11 -12
  181. package/{esm/utils/localization/translations/pt-BR-json.js → dist/utils/localization/translations/pt-BR.json} +11 -12
  182. package/{esm/utils/localization/translations/sk-SK-json.js → dist/utils/localization/translations/sk-SK.json} +31 -23
  183. package/{esm/utils/localization/translations/sv-json.js → dist/utils/localization/translations/sv.json} +11 -12
  184. package/{esm/utils/localization/translations/th-json.js → dist/utils/localization/translations/th.json} +11 -12
  185. package/{esm/utils/localization/translations/tr-json.js → dist/utils/localization/translations/tr.json} +11 -12
  186. package/{esm/utils/localization/translations/zh-Hans-json.js → dist/utils/localization/translations/zh-Hans.json} +11 -12
  187. package/{esm/utils/localization/translations/zh-TW-json.js → dist/utils/localization/translations/zh-TW.json} +11 -23
  188. package/dist/utils/localization/translationsDictionary.d.ts +2 -0
  189. package/dist/utils/localization/translationsDictionary.js +63 -0
  190. package/dist/utils/localization/useLanguage.js +2 -74
  191. package/esm/advancedGroupsFilter/advancedGroupsFilter.js +130 -29
  192. package/esm/advancedGroupsFilter/advancedGroupsFilterForm.js +133 -33
  193. package/esm/advancedGroupsFilter/advancedGroupsFilterFormSection.js +317 -65
  194. package/esm/advancedGroupsFilter/advancedGroupsFilterSectionTooltip.d.ts +0 -1
  195. package/esm/advancedGroupsFilter/advancedGroupsFilterSectionTooltip.js +77 -8
  196. package/esm/alertRaw/alertRaw.js +165 -51
  197. package/esm/banner/bannerMultipLine.js +121 -20
  198. package/esm/banner/bannerSingleLine.js +100 -13
  199. package/esm/betaPill/betaPill.js +105 -19
  200. package/esm/bookmark/bookmark.js +89 -27
  201. package/esm/bulkEditControl/bulkEditControl.js +161 -33
  202. package/esm/calendar/calendar.js +937 -272
  203. package/esm/calendar/calendarUtils.js +151 -84
  204. package/esm/card/card.js +233 -101
  205. package/esm/chart/accessibleChart/accessibleChartNarrative.js +642 -554
  206. package/esm/chart/accessibleChart/accessibleChartTable.js +239 -85
  207. package/esm/chart/chart.js +30 -20
  208. package/esm/chart/chartAxis/chartAxis.js +79 -6
  209. package/esm/checkboxListWithAction/checkboxListWithAction.js +218 -68
  210. package/esm/chip/chip.js +189 -90
  211. package/esm/columnsSelector/columnsSelector.js +91 -11
  212. package/esm/columnsSelector/columnsTab/columnsTab.js +53 -14
  213. package/esm/columnsSelector/columnsTabGroup/columnsTabGroup.js +75 -33
  214. package/esm/comboboxSelected/comboboxSelected.js +1 -3
  215. package/esm/dataFeed/feedExpandControl/feedExpandControl.js +21 -9
  216. package/esm/dataGrid/columns/checkboxColumn/checkboxHeaderCell.js +86 -10
  217. package/esm/dataGrid/dataGrid.js +221 -116
  218. package/esm/dataGrid/emptySearchList/emptySearchList.js +50 -8
  219. package/esm/dataGrid/entitiesListActions/actions/columnsListButton.js +45 -6
  220. package/esm/dataGrid/entitiesListActions/actions/fullscreenButton.js +58 -17
  221. package/esm/dataGrid/withFlexibleColumns/components/columnSettings.js +78 -9
  222. package/esm/dataGrid/withFlexibleColumns/components/columnSettingsSidePanel.js +44 -15
  223. package/esm/dataGrid/withSelectableRows/components/bulkActions/bulkActions.js +217 -31
  224. package/esm/dataGrid/withSelectableRows/withSelectableRows.js +280 -212
  225. package/esm/dataGrid/withSortableColumns/columns/sortableColumnWrapper.js +172 -94
  226. package/esm/dateInputInner/dateInputInner.js +785 -475
  227. package/esm/dateInputInner/dateInputInnerControlBlock.js +119 -21
  228. package/esm/dateInputRaw/dateInputRaw.js +309 -103
  229. package/esm/dateInputRaw/utils/getLabel.js +32 -6
  230. package/esm/dateRangeInner/dateRangeInner.js +166 -57
  231. package/esm/dateRangeRaw/dateRangeRaw.js +595 -238
  232. package/esm/dateRangeRaw/utils/dateRangeUtils.js +622 -239
  233. package/esm/dateSelectionWrapper/dateSelectionWrapper.js +146 -13
  234. package/esm/dialog/dialogContent.js +117 -39
  235. package/esm/dropdownRaw/dropdownHelper.d.ts +2 -2
  236. package/esm/dropdownRaw/dropdownHelper.js +10 -10
  237. package/esm/dropdownRaw/dropdownList.js +412 -56
  238. package/esm/dropdownRaw/dropdownPopup.js +212 -19
  239. package/esm/dropdownRaw/dropdownRaw.js +862 -507
  240. package/esm/dropdownRaw/dropdownSearchableTrigger.js +217 -45
  241. package/esm/dropdownRaw/stateReducer/stateAction.d.ts +5 -1
  242. package/esm/dropdownRaw/stateReducer/stateActionType.d.ts +2 -1
  243. package/esm/dropdownRaw/stateReducer/stateActionType.js +1 -0
  244. package/esm/dropdownRaw/stateReducer/stateReducer.d.ts +6 -1
  245. package/esm/dropdownRaw/stateReducer/stateReducer.js +24 -12
  246. package/esm/dropdownRaw/stateReducer/stateReducerHelper.d.ts +2 -0
  247. package/esm/dropdownRaw/stateReducer/stateReducerHelper.js +18 -0
  248. package/esm/dropdownRaw/stateReducer/stateReducerTestData.d.ts +39 -0
  249. package/esm/dropdownRaw/stateReducer/stateReducerTestData.js +71 -0
  250. package/esm/dropdownRaw/types.d.ts +1 -0
  251. package/esm/favoriteButton/favoriteButton.js +53 -9
  252. package/esm/filters/components/filtersContainer.js +141 -61
  253. package/esm/filters/components/filtersEmptySelectedList.js +24 -3
  254. package/esm/filters/components/filtersSaveModal.js +134 -41
  255. package/esm/filters/components/filtersSavedChipComponent.js +312 -107
  256. package/esm/filters/components/filtersSearchItemData.js +121 -46
  257. package/esm/filters/components/filtersSearchList.js +375 -178
  258. package/esm/filters/components/filtersSelect.js +122 -60
  259. package/esm/filters/components/filtersSelectListItem.js +119 -12
  260. package/esm/filters/components/filtersSidePanel.js +504 -177
  261. package/esm/filters/filters.js +435 -265
  262. package/esm/filtersBar/components/filtersBarPeriodPicker/getRangeOption.js +722 -270
  263. package/esm/filtersBar/components/resetComponentButton.js +39 -4
  264. package/esm/filtersBar/filtersBarActions/filtersBarActions.js +120 -14
  265. package/esm/filtersBar/filtersBarSidePanel/components/filtersBarSidePanelRange/filtersBarSidePanelRange.js +149 -48
  266. package/esm/filtersBar/filtersBarSidePanel/filtersBarSidePanel.js +354 -103
  267. package/esm/filtersBar/filtersContainer/filtersContainer.js +198 -133
  268. package/esm/formField/components/formFieldWithLabel.d.ts +2 -1
  269. package/esm/formField/components/formFieldWithLabel.js +3 -2
  270. package/esm/formField/components/formFieldWithoutLabel.d.ts +2 -1
  271. package/esm/formField/components/formFieldWithoutLabel.js +3 -3
  272. package/esm/formField/components/trailingComponent.d.ts +8 -0
  273. package/esm/formField/components/trailingComponent.js +7 -0
  274. package/esm/formField/formField.js +12 -11
  275. package/esm/formField/hooks/useError.js +94 -35
  276. package/esm/formGroup/components/reviewListToggle/reviewListToggle.js +66 -6
  277. package/esm/formGroup/hooks/useToggle.js +31 -10
  278. package/esm/formGroup/utils/getControls.js +8 -7
  279. package/esm/formLayout/hooks/useError.js +49 -14
  280. package/esm/formLayout/hooks/useFormButtons.js +122 -26
  281. package/esm/formSection/components/formSectionModal.js +1 -1
  282. package/esm/formSection/formSection.js +1 -1
  283. package/esm/formSection/hooks/useError.js +64 -21
  284. package/esm/formStepper/components/formStep.js +59 -9
  285. package/esm/formStepper/formStepper.js +123 -32
  286. package/esm/formStepperButtons/formStepperButtons.js +178 -37
  287. package/esm/groupsFilter/groupsHelper.d.ts +1 -1
  288. package/esm/groupsFilterRaw/groupsFilterAdjustmentState.js +152 -14
  289. package/esm/groupsFilterRaw/groupsFilterBox.js +131 -31
  290. package/esm/groupsFilterRaw/groupsFilterCommon.js +69 -7
  291. package/esm/groupsFilterRaw/groupsFilterCurrentlySelectedState.js +178 -24
  292. package/esm/groupsFilterRaw/groupsFilterHelper.d.ts +2 -1
  293. package/esm/groupsFilterRaw/groupsFilterHelper.js +279 -168
  294. package/esm/groupsFilterRaw/groupsFilterInitialState.js +260 -17
  295. package/esm/groupsFilterRaw/groupsFilterMenu.js +118 -8
  296. package/esm/groupsFilterRaw/groupsFilterRaw.d.ts +1 -0
  297. package/esm/groupsFilterRaw/groupsFilterRaw.js +811 -308
  298. package/esm/groupsFilterRaw/groupsFilterTestData.d.ts +155 -2
  299. package/esm/groupsFilterRaw/groupsFilterTestData.js +152 -57
  300. package/esm/groupsFilterRaw/groupsFilterTrigger.js +133 -34
  301. package/esm/groupsFilterRaw/groupsHelper.js +733 -207
  302. package/esm/groupsFilterRaw/stateReducer/stateReducerHelper.js +3 -1
  303. package/esm/groupsFilterRaw/types.d.ts +1 -0
  304. package/esm/header/components/collapsedItemsControl/collapsedItemsControl.js +101 -51
  305. package/esm/header/components/mobileFilterControl/mobileFilterControl.js +56 -8
  306. package/esm/header/components/mobileSearchControl/mobileSearchControl.js +113 -13
  307. package/esm/header/headerBack.js +58 -19
  308. package/esm/index.d.ts +1 -0
  309. package/esm/index.js +1 -0
  310. package/esm/list/itemData/itemDataInternal.js +210 -50
  311. package/esm/list/listItem/listItem.js +162 -54
  312. package/esm/menu/components/menuErrorItem.js +27 -4
  313. package/esm/mobileSheet/mobileSheet.js +189 -68
  314. package/esm/modal/modal.js +265 -120
  315. package/esm/nav/nav.js +1 -1
  316. package/esm/nav/navFooter/navFooter.js +76 -38
  317. package/esm/nav/navFooter/navFooterAction/navFooterAction.js +46 -12
  318. package/esm/nav/navHeader/navHeader.js +80 -35
  319. package/esm/nav/navHeader/navHeaderSearch/navHeaderSearch.js +82 -28
  320. package/esm/nav/navItem/navItem.d.ts +3 -3
  321. package/esm/nav/navItem/navItem.js +35 -33
  322. package/esm/nav/navMobileBar/navMobileBar.js +61 -20
  323. package/esm/notification/notification.js +114 -18
  324. package/esm/pagination/paginationArrow.js +75 -10
  325. package/esm/pagination/paginationText/paginationText.js +39 -10
  326. package/esm/pill/components/pillNonActionable/pillNonActionable.js +87 -23
  327. package/esm/pillBox/components/pillBoxItem.js +46 -8
  328. package/esm/pillBox/pillBox.js +115 -19
  329. package/esm/pillExpandable/pillExpandable.js +327 -138
  330. package/esm/rangeRaw/rangeRaw.js +480 -140
  331. package/esm/rangeRaw/utils/rangeHelper.js +203 -38
  332. package/esm/searchInputRaw/searchInputRaw.js +145 -43
  333. package/esm/skeleton/skeleton.js +45 -5
  334. package/esm/sortControl/sortControl.js +146 -41
  335. package/esm/stepperRaw/stepperRaw.js +112 -41
  336. package/esm/storybookHelpers/dataGridWithDifferentCellOptions/components/EntitiesListAction.js +178 -19
  337. package/esm/summary/summary.js +88 -7
  338. package/esm/table/actions/actionsMenu.js +165 -77
  339. package/esm/table/flexible/columnSettings.js +74 -9
  340. package/esm/table/flexible/columnsList.js +104 -42
  341. package/esm/table/flexible/columnsPopup.js +71 -19
  342. package/esm/table/nested/useNestedRows.js +161 -76
  343. package/esm/table/selectable/selectableHeader.js +174 -40
  344. package/esm/table/selectable/useSelectableRows.js +264 -190
  345. package/esm/table/sortable/sortableHeader.js +147 -74
  346. package/esm/tabs/tabs.js +221 -117
  347. package/esm/timePickerRaw/timePickerRaw.js +272 -57
  348. package/esm/toastRaw/toastRaw.js +132 -31
  349. package/esm/toggleButton/toggleButton.d.ts +0 -1
  350. package/esm/toggleButtonRaw/toggleButtonRaw.d.ts +1 -0
  351. package/esm/toggleButtonRaw/toggleButtonRaw.js +111 -18
  352. package/esm/utils/formatDate.js +995 -116
  353. package/{dist/utils/localization/translations/cs-json.js → esm/utils/localization/translations/cs.json} +11 -15
  354. package/{dist/utils/localization/translations/da-DK-json.js → esm/utils/localization/translations/da-DK.json} +31 -26
  355. package/{dist/utils/localization/translations/de-json.js → esm/utils/localization/translations/de.json} +12 -16
  356. package/esm/utils/localization/translations/en.json +308 -0
  357. package/{dist/utils/localization/translations/es-json.js → esm/utils/localization/translations/es.json} +11 -15
  358. package/{dist/utils/localization/translations/fi-FI-json.js → esm/utils/localization/translations/fi-FI.json} +31 -26
  359. package/{dist/utils/localization/translations/fr-FR-json.js → esm/utils/localization/translations/fr-FR.json} +12 -15
  360. package/{dist/utils/localization/translations/fr-json.js → esm/utils/localization/translations/fr.json} +11 -15
  361. package/{dist/utils/localization/translations/hu-HU-json.js → esm/utils/localization/translations/hu-HU.json} +31 -26
  362. package/{dist/utils/localization/translations/id-json.js → esm/utils/localization/translations/id.json} +11 -16
  363. package/{dist/utils/localization/translations/it-json.js → esm/utils/localization/translations/it.json} +11 -15
  364. package/{dist/utils/localization/translations/ja-json.js → esm/utils/localization/translations/ja.json} +11 -15
  365. package/{dist/utils/localization/translations/ko-KR-json.js → esm/utils/localization/translations/ko-KR.json} +24 -26
  366. package/{dist/utils/localization/translations/ms-json.js → esm/utils/localization/translations/ms.json} +11 -15
  367. package/{dist/utils/localization/translations/nb-NO-json.js → esm/utils/localization/translations/nb-NO.json} +31 -26
  368. package/{dist/utils/localization/translations/nl-json.js → esm/utils/localization/translations/nl.json} +11 -15
  369. package/{dist/utils/localization/translations/pl-json.js → esm/utils/localization/translations/pl.json} +11 -15
  370. package/{dist/utils/localization/translations/pt-BR-json.js → esm/utils/localization/translations/pt-BR.json} +11 -15
  371. package/{dist/utils/localization/translations/sk-SK-json.js → esm/utils/localization/translations/sk-SK.json} +31 -26
  372. package/{dist/utils/localization/translations/sv-json.js → esm/utils/localization/translations/sv.json} +11 -15
  373. package/{dist/utils/localization/translations/th-json.js → esm/utils/localization/translations/th.json} +11 -15
  374. package/{dist/utils/localization/translations/tr-json.js → esm/utils/localization/translations/tr.json} +11 -15
  375. package/{dist/utils/localization/translations/zh-Hans-json.js → esm/utils/localization/translations/zh-Hans.json} +11 -15
  376. package/{dist/utils/localization/translations/zh-TW-json.js → esm/utils/localization/translations/zh-TW.json} +11 -26
  377. package/esm/utils/localization/translationsDictionary.d.ts +2 -0
  378. package/esm/utils/localization/translationsDictionary.js +59 -0
  379. package/esm/utils/localization/useLanguage.js +1 -50
  380. package/package.json +17 -10
  381. package/dist/utils/localization/translations/cs-json.d.ts +0 -251
  382. package/dist/utils/localization/translations/da-DK-json.d.ts +0 -252
  383. package/dist/utils/localization/translations/de-json.d.ts +0 -251
  384. package/dist/utils/localization/translations/en-json.d.ts +0 -314
  385. package/dist/utils/localization/translations/en-json.js +0 -317
  386. package/dist/utils/localization/translations/es-json.d.ts +0 -251
  387. package/dist/utils/localization/translations/fi-FI-json.d.ts +0 -252
  388. package/dist/utils/localization/translations/fr-FR-json.d.ts +0 -250
  389. package/dist/utils/localization/translations/fr-json.d.ts +0 -251
  390. package/dist/utils/localization/translations/hu-HU-json.d.ts +0 -252
  391. package/dist/utils/localization/translations/id-json.d.ts +0 -252
  392. package/dist/utils/localization/translations/it-json.d.ts +0 -251
  393. package/dist/utils/localization/translations/ja-json.d.ts +0 -251
  394. package/dist/utils/localization/translations/ko-KR-json.d.ts +0 -258
  395. package/dist/utils/localization/translations/ms-json.d.ts +0 -251
  396. package/dist/utils/localization/translations/nb-NO-json.d.ts +0 -252
  397. package/dist/utils/localization/translations/nl-json.d.ts +0 -251
  398. package/dist/utils/localization/translations/pl-json.d.ts +0 -251
  399. package/dist/utils/localization/translations/pt-BR-json.d.ts +0 -251
  400. package/dist/utils/localization/translations/sk-SK-json.d.ts +0 -251
  401. package/dist/utils/localization/translations/sv-json.d.ts +0 -251
  402. package/dist/utils/localization/translations/th-json.d.ts +0 -251
  403. package/dist/utils/localization/translations/tr-json.d.ts +0 -251
  404. package/dist/utils/localization/translations/zh-Hans-json.d.ts +0 -251
  405. package/dist/utils/localization/translations/zh-TW-json.d.ts +0 -271
  406. package/esm/utils/localization/translations/cs-json.d.ts +0 -251
  407. package/esm/utils/localization/translations/da-DK-json.d.ts +0 -252
  408. package/esm/utils/localization/translations/de-json.d.ts +0 -251
  409. package/esm/utils/localization/translations/en-json.d.ts +0 -314
  410. package/esm/utils/localization/translations/en-json.js +0 -314
  411. package/esm/utils/localization/translations/es-json.d.ts +0 -251
  412. package/esm/utils/localization/translations/fi-FI-json.d.ts +0 -252
  413. package/esm/utils/localization/translations/fr-FR-json.d.ts +0 -250
  414. package/esm/utils/localization/translations/fr-json.d.ts +0 -251
  415. package/esm/utils/localization/translations/hu-HU-json.d.ts +0 -252
  416. package/esm/utils/localization/translations/id-json.d.ts +0 -252
  417. package/esm/utils/localization/translations/it-json.d.ts +0 -251
  418. package/esm/utils/localization/translations/ja-json.d.ts +0 -251
  419. package/esm/utils/localization/translations/ko-KR-json.d.ts +0 -258
  420. package/esm/utils/localization/translations/ms-json.d.ts +0 -251
  421. package/esm/utils/localization/translations/nb-NO-json.d.ts +0 -252
  422. package/esm/utils/localization/translations/nl-json.d.ts +0 -251
  423. package/esm/utils/localization/translations/pl-json.d.ts +0 -251
  424. package/esm/utils/localization/translations/pt-BR-json.d.ts +0 -251
  425. package/esm/utils/localization/translations/sk-SK-json.d.ts +0 -251
  426. package/esm/utils/localization/translations/sv-json.d.ts +0 -251
  427. package/esm/utils/localization/translations/th-json.d.ts +0 -251
  428. package/esm/utils/localization/translations/tr-json.d.ts +0 -251
  429. package/esm/utils/localization/translations/zh-Hans-json.d.ts +0 -251
  430. package/esm/utils/localization/translations/zh-TW-json.d.ts +0 -271
@@ -1,9 +1,10 @@
1
+ import { injectString } from "../utils/localization/translationsDictionary";
1
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
3
  /* eslint-disable complexity */
3
4
  import { useCallback, useContext, useEffect, useMemo, useReducer, useRef, useState } from "react";
4
5
  import { classNames } from "../commonHelpers/classNames/classNames";
5
6
  import { DropdownList, EmptyList } from "./dropdownList";
6
- import { getInitialState, stateReducer } from "./stateReducer/stateReducer";
7
+ import { getInitialState, stateReducer, ROOT_GROUP_ID } from "./stateReducer/stateReducer";
7
8
  import { StateActionType } from "./stateReducer/stateActionType";
8
9
  import { FOCUSABLE_SELECTOR } from "../utils/focusableSelector";
9
10
  import { useEscape } from "../commonHelpers/hooks/useEscape";
@@ -19,519 +20,873 @@ import { ReviewTextControl } from "../formGroup/components/reviewTextControl";
19
20
  import { getSelectedValues } from "./utils/getSelectedValues";
20
21
  import { Chip } from "../chip/chip";
21
22
  import { useChipStatus } from "../chip/chipStatusProvider";
22
- import { ENTIRE_ORGANIZATION_GROUP_ID, getGroupDescription } from "../groupsFilterRaw/groupsHelper";
23
+ import { getGroupDescription } from "../groupsFilterRaw/groupsHelper";
23
24
  import { isFormItem } from "../commonHelpers/isFormItem";
24
25
  import { useFormField } from "../commonHelpers/hooks/useFormField";
25
26
  import { getAriaAttributes } from "../commonHelpers/getAriaAttributes";
26
27
  import { useFormFieldValues } from "../commonHelpers/hooks/useFormFieldValues/useFormFieldValues";
27
28
  import { FormSectionContext } from "../formSection/utils/formSectionProvider";
28
29
  import { LIST_LIMIT } from "../dropdown/dropdown";
29
- export const DropdownRaw = (props) => {
30
- var _a, _b;
31
- const { className, classNamePopup, getData, errorHandler, dataItems, onChange, defaultValue, placeholder, dialogAriaLabel, width, isLoading, title, triggerAriaLabel, 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", isReadOnly, sortFn, checkboxLabel, chip, chipId, chipName, chipIcon, setChecked, setSearch, fetchState, isLoadingError, mobileSheetStackingClassName } = props;
32
- const { isFormSection } = useContext(FormSectionContext);
33
- const accessibilityProps = getAriaAttributes(props);
34
- const isFormItemVal = isFormItem(props);
35
- const { field } = useFormField(props.controller);
36
- const { name, value = [], disabled, onBlur } = useFormFieldValues(props.controller, props);
37
- let onChangeInner, defaultValueInner;
38
- if (isFormItemVal) {
39
- onChangeInner = (val) => {
40
- field === null || field === void 0 ? void 0 : field.onChange(val.map((item) => item.id));
41
- };
42
- defaultValueInner = ((_a = props.controller) === null || _a === void 0 ? void 0 : _a.defaultValue) || [];
43
- }
44
- else {
45
- onChangeInner = onChange;
46
- defaultValueInner = defaultValue;
47
- }
48
- const isFullSelectionMode = useMemo(() => typeof value === "object" &&
49
- "selected" in value &&
50
- Array.isArray(value.selected) &&
51
- "isAllSelected" in value &&
52
- typeof (value === null || value === void 0 ? void 0 : value.isAllSelected) === "boolean", [value]);
53
- const isQueryMode = useMemo(() => typeof getData === "undefined" && typeof dataItems === "undefined", [getData, dataItems]);
54
- const isCheckboxMode = useMemo(() => checkboxLabel && typeof value === "object" && "isChecked" in value && typeof value.isChecked === "boolean" || false, [checkboxLabel, value]);
55
- const [initialInChecked] = useState(isCheckboxMode ? value.isChecked : undefined);
56
- 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));
57
- const chipStatus = useChipStatus();
58
- const isMobile = useMobile();
59
- const abortToken = useRef(new AbortController());
60
- const triggerRef = useRef(null);
61
- const comboboxRef = useRef(null);
62
- const inputRef = useRef(null);
63
- const contentRef = useRef(null);
64
- const prevSelectedIds = useRef({ selected: [], isAllSelected: undefined, isChecked: initialInChecked });
65
- const prevSelection = useRef({ selected: [], isAllSelected: undefined, isChecked: initialInChecked });
66
- const { translate } = useLanguage();
67
- const getNamedItemsHasBeenCalled = useRef(false);
68
- const selectedItemsLoader = useRef(undefined);
69
- const previousMapDataItems = useRef(isQueryMode ? (fetchState === null || fetchState === void 0 ? void 0 : fetchState.data) || [] : (!getData && (dataItems === null || dataItems === void 0 ? void 0 : dataItems.length) ? dataItems : []));
70
- const prevIsLoading = useRef(isLoading);
71
- const prevIsChecked = useRef(isCheckboxMode ? value.isChecked : undefined);
72
- const currentAllSelected = useMemo(() => (state.isNestedList || !multiselect || !isFullSelectionMode)
73
- ? undefined : state.isAllSelected, [state.isNestedList, state.isAllSelected, multiselect, isFullSelectionMode]);
74
- const currentIsChecked = useMemo(() => isCheckboxMode ?
75
- value.isChecked : undefined, [isCheckboxMode, value]);
76
- useEffect(() => {
77
- const timeoutId = setTimeout(() => {
78
- if (Object.keys(state.groupsMap).length === 0 && getData) {
79
- const currentAbort = abortToken.current;
80
- (initialInChecked !== undefined ? getData(currentAbort.signal, undefined, initialInChecked) : getData(currentAbort.signal, undefined)).then((dta) => {
81
- dta.length && dispatchState({ type: StateActionType.CreateMap, payload: dta });
82
- previousMapDataItems.current = [...dta];
83
- }).catch(errorHandler);
84
- }
85
- });
86
- return () => clearTimeout(timeoutId);
87
- }, [getData, errorHandler, state.groupsMap, initialInChecked]);
88
- useEffect(() => {
89
- const timeoutId = setTimeout(() => {
90
- if (!getData && dataItems && dataItems.length && !compareObjectsArrays(dataItems, previousMapDataItems.current)) {
91
- dispatchState({ type: StateActionType.CreateMap, payload: dataItems });
92
- previousMapDataItems.current = [...dataItems];
93
- }
94
- });
95
- return () => clearTimeout(timeoutId);
96
- }, [dataItems, getData, state.groupsMap]);
97
- useEffect(() => {
98
- if (prevIsLoading.current !== isLoading && Object.keys(state.groupsMap).length !== 0) {
99
- isLoading === false && dispatchState({ type: StateActionType.ShowList, payload: undefined });
100
- prevIsLoading.current = isLoading;
101
- }
102
- }, [isLoading, dataItems, state.groupsMap]);
103
- useEffect(() => {
104
- const defaultSelectedValue = defaultValue ? (isFullSelectionMode || isCheckboxMode ? defaultValue.selected : defaultValue) : [];
105
- const defaultAllSelectedValue = defaultValue ? (isFullSelectionMode ? defaultValue.isAllSelected : undefined)
106
- : (isFullSelectionMode ? false : undefined);
107
- const defaultIsCheckedValue = defaultValue ?
108
- (isCheckboxMode ? defaultValue.isChecked || false : undefined)
109
- : (isCheckboxMode ? false : undefined);
110
- if (defaultIsCheckedValue !== state.defaultValueIsChecked) {
111
- defaultIsCheckedValue !== undefined && dispatchState({ type: StateActionType.SetDefaultIsChecked, payload: defaultIsCheckedValue });
112
- }
113
- if (compareStringsArrays(defaultSelectedValue, state.defaultValue) && defaultAllSelectedValue === state.defaultValueIsAllSelected) {
114
- return;
115
- }
116
- dispatchState({ type: StateActionType.SetDefaultValue, payload: defaultSelectedValue });
117
- isFullSelectionMode && defaultAllSelectedValue !== state.defaultValueIsAllSelected
118
- && dispatchState({ type: StateActionType.SetDefaultAllSelected, payload: defaultAllSelectedValue });
119
- }, [defaultValue, defaultValueInner, isCheckboxMode, isFullSelectionMode, state.defaultValue, state.defaultValueIsAllSelected, state.defaultValueIsChecked]);
120
- const loadSelectedItems = useCallback((ids) => {
121
- if (!getSelectedItem || !ids.size) {
122
- return;
123
- }
124
- const promises = [];
125
- Array.from(ids).forEach((id, ind) => {
126
- if (ind > 99) {
127
- return;
128
- }
129
- const itemOrPromise = getSelectedItem(id);
130
- promises.push(Promise.resolve(itemOrPromise));
131
- });
132
- // eslint-disable-next-line consistent-return
133
- return Promise.all(promises).then((items) => {
134
- const result = items.filter(el => el !== undefined);
135
- dispatchState({ type: StateActionType.UpdateSelectedItems, payload: result });
136
- getNamedItemsHasBeenCalled.current = false;
137
- }).catch(() => {
138
- dispatchState({ type: StateActionType.UpdateSelectedItems, payload: [] });
30
+ injectString("cs", "Filter by group", "Filtrovat podle skupiny");
31
+ injectString("da-DK", "Filter by group", "Filtrer efter gruppe");
32
+ injectString("de", "Filter by group", "Nach Gruppe filtern");
33
+ injectString("en", "Filter by group", "Filter by group");
34
+ injectString("es", "Filter by group", "Filtrar por grupo");
35
+ injectString("fi-FI", "Filter by group", "Suodata ryhm\xE4n mukaan");
36
+ injectString("fr", "Filter by group", "Filtrer par groupe");
37
+ injectString("fr-FR", "Filter by group", "Filtrer par groupe");
38
+ injectString("hu-HU", "Filter by group", "Sz\u0171rd csoport alapj\xE1n.");
39
+ injectString("id", "Filter by group", "Filter berdasarkan grup");
40
+ injectString("it", "Filter by group", "Filtrare per gruppo");
41
+ injectString("ja", "Filter by group", "\u30B0\u30EB\u30FC\u30D7\u306B\u3088\u308B\u30D5\u30A3\u30EB\u30BF\u30EA\u30F3\u30B0");
42
+ injectString("ko-KR", "Filter by group", "\uADF8\uB8F9\uBCC4 \uD544\uD130\uB9C1");
43
+ injectString("ms", "Filter by group", "Saring mengikut kumpulan");
44
+ injectString("nb-NO", "Filter by group", "Filtrer etter gruppe");
45
+ injectString("nl", "Filter by group", "Filteren op groep");
46
+ injectString("pl", "Filter by group", "Filtruj wed\u0142ug grupy");
47
+ injectString("pt-BR", "Filter by group", "Filtrar por grupo");
48
+ injectString("sk-SK", "Filter by group", "Filtrova\u0165 pod\u013Ea skupiny");
49
+ injectString("sv", "Filter by group", "Filtrera efter grupp");
50
+ injectString("th", "Filter by group", "\u0E01\u0E23\u0E2D\u0E07\u0E15\u0E32\u0E21\u0E01\u0E25\u0E38\u0E48\u0E21");
51
+ injectString("tr", "Filter by group", "Gruba g\xF6re filtrele");
52
+ injectString("zh-Hans", "Filter by group", "\u6309\u7EC4\u8FC7\u6EE4");
53
+ injectString("zh-TW", "Filter by group", "\u4F9D\u7FA4\u7D44\u7BE9\u9078");
54
+ export const DropdownRaw = props => {
55
+ var _a, _b;
56
+ const {
57
+ className,
58
+ classNamePopup,
59
+ getData,
60
+ errorHandler,
61
+ dataItems,
62
+ onChange,
63
+ defaultValue,
64
+ placeholder,
65
+ dialogAriaLabel,
66
+ width,
67
+ isLoading,
68
+ title,
69
+ triggerAriaLabel,
70
+ inputId,
71
+ filterName,
72
+ showCounterPill = true,
73
+ showSelection,
74
+ fullWidthTriggerButton,
75
+ hasApplyButton,
76
+ searchField = true,
77
+ multiselect = true,
78
+ forceSelection = false,
79
+ selectAllButton = true,
80
+ getNamedItems,
81
+ getSelectedItem,
82
+ buttonType = "secondary",
83
+ listLimit = LIST_LIMIT,
84
+ alignment = "bottom-left",
85
+ isReadOnly,
86
+ sortFn,
87
+ checkboxLabel,
88
+ chip,
89
+ chipId,
90
+ chipName,
91
+ chipIcon,
92
+ setChecked,
93
+ setSearch,
94
+ fetchState,
95
+ isLoadingError,
96
+ mobileSheetStackingClassName,
97
+ isError,
98
+ firstParentNodeIsVisible
99
+ } = props;
100
+ const {
101
+ isFormSection
102
+ } = useContext(FormSectionContext);
103
+ const accessibilityProps = getAriaAttributes(props);
104
+ const isFormItemVal = isFormItem(props);
105
+ const {
106
+ field
107
+ } = useFormField(props.controller);
108
+ const {
109
+ name,
110
+ value = [],
111
+ disabled,
112
+ onBlur
113
+ } = useFormFieldValues(props.controller, props);
114
+ let onChangeInner, defaultValueInner;
115
+ if (isFormItemVal) {
116
+ onChangeInner = val => {
117
+ field === null || field === void 0 ? void 0 : field.onChange(val.map(item => item.id));
118
+ };
119
+ defaultValueInner = ((_a = props.controller) === null || _a === void 0 ? void 0 : _a.defaultValue) || [];
120
+ } else {
121
+ onChangeInner = onChange;
122
+ defaultValueInner = defaultValue;
123
+ }
124
+ const isFullSelectionMode = useMemo(() => typeof value === "object" && "selected" in value && Array.isArray(value.selected) && "isAllSelected" in value && typeof (value === null || value === void 0 ? void 0 : value.isAllSelected) === "boolean", [value]);
125
+ const isQueryMode = useMemo(() => typeof getData === "undefined" && typeof dataItems === "undefined", [getData, dataItems]);
126
+ const isCheckboxMode = useMemo(() => checkboxLabel && typeof value === "object" && "isChecked" in value && typeof value.isChecked === "boolean" || false, [checkboxLabel, value]);
127
+ const [initialInChecked] = useState(isCheckboxMode ? value.isChecked : undefined);
128
+ 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, firstParentNodeIsVisible));
129
+ const chipStatus = useChipStatus();
130
+ const isMobile = useMobile();
131
+ const abortToken = useRef(new AbortController());
132
+ const triggerRef = useRef(null);
133
+ const comboboxRef = useRef(null);
134
+ const inputRef = useRef(null);
135
+ const contentRef = useRef(null);
136
+ const prevSelectedIds = useRef({
137
+ selected: [],
138
+ isAllSelected: undefined,
139
+ isChecked: initialInChecked
140
+ });
141
+ const prevSelection = useRef({
142
+ selected: [],
143
+ isAllSelected: undefined,
144
+ isChecked: initialInChecked
145
+ });
146
+ const {
147
+ translate
148
+ } = useLanguage();
149
+ const getNamedItemsHasBeenCalled = useRef(false);
150
+ const selectedItemsLoader = useRef(undefined);
151
+ const previousMapDataItems = useRef(isQueryMode ? (fetchState === null || fetchState === void 0 ? void 0 : fetchState.data) || [] : !getData && (dataItems === null || dataItems === void 0 ? void 0 : dataItems.length) ? dataItems : []);
152
+ const prevIsLoading = useRef(isLoading);
153
+ const prevIsChecked = useRef(isCheckboxMode ? value.isChecked : undefined);
154
+ const currentAllSelected = useMemo(() => state.isNestedList || !multiselect || !isFullSelectionMode ? undefined : state.isAllSelected, [state.isNestedList, state.isAllSelected, multiselect, isFullSelectionMode]);
155
+ const currentIsChecked = useMemo(() => isCheckboxMode ? value.isChecked : undefined, [isCheckboxMode, value]);
156
+ useEffect(() => {
157
+ const timeoutId = setTimeout(() => {
158
+ if (Object.keys(state.groupsMap).length === 0 && getData) {
159
+ const currentAbort = abortToken.current;
160
+ (initialInChecked !== undefined ? getData(currentAbort.signal, undefined, initialInChecked) : getData(currentAbort.signal, undefined)).then(dta => {
161
+ dta.length && dispatchState({
162
+ type: StateActionType.CreateMap,
163
+ payload: dta
164
+ });
165
+ previousMapDataItems.current = [...dta];
166
+ }).catch(errorHandler);
167
+ }
168
+ });
169
+ return () => clearTimeout(timeoutId);
170
+ }, [getData, errorHandler, state.groupsMap, initialInChecked]);
171
+ useEffect(() => {
172
+ const timeoutId = setTimeout(() => {
173
+ if (!getData && dataItems && dataItems.length && !compareObjectsArrays(dataItems, previousMapDataItems.current)) {
174
+ dispatchState({
175
+ type: StateActionType.CreateMap,
176
+ payload: dataItems
139
177
  });
140
- }, [getSelectedItem]);
141
- useEffect(() => {
142
- if (isLoadingError) {
143
- dispatchState({ type: StateActionType.SetIsOpenCombo, payload: false });
144
- }
145
- }, [isLoadingError]);
146
- useEffect(() => {
147
- if (!getSelectedItem) {
148
- return;
149
- }
150
- dispatchState({ type: StateActionType.UpdateNamelessItems, payload: undefined });
151
- }, [getSelectedItem]);
152
- useEffect(() => {
153
- if (state.namelessIds.size === 0 || !getSelectedItem || state.pendingNamelessIds) {
154
- return;
155
- }
156
- selectedItemsLoader.current = loadSelectedItems(state.namelessIds);
157
- dispatchState({ type: StateActionType.SetPendingState, payload: true });
158
- }, [getSelectedItem, loadSelectedItems, state.namelessIds, state.pendingNamelessIds]);
159
- const handleChangeCurrentId = useCallback((id) => {
160
- dispatchState({ type: StateActionType.SetCurrentId, payload: id });
161
- dispatchState({ type: StateActionType.SetInputValue, payload: "" });
162
- isQueryMode && setSearch && setSearch("");
163
- }, [isQueryMode, setSearch]);
164
- const handleBackButtonClick = useCallback(() => {
165
- var _a, _b;
178
+ previousMapDataItems.current = [...dataItems];
179
+ }
180
+ });
181
+ return () => clearTimeout(timeoutId);
182
+ }, [dataItems, getData, state.groupsMap]);
183
+ useEffect(() => {
184
+ if (prevIsLoading.current !== isLoading && Object.keys(state.groupsMap).length !== 0) {
185
+ isLoading === false && dispatchState({
186
+ type: StateActionType.ShowList,
187
+ payload: undefined
188
+ });
189
+ prevIsLoading.current = isLoading;
190
+ }
191
+ }, [isLoading, dataItems, state.groupsMap]);
192
+ useEffect(() => {
193
+ const defaultSelectedValue = defaultValue ? isFullSelectionMode || isCheckboxMode ? defaultValue.selected : defaultValue : [];
194
+ const defaultAllSelectedValue = defaultValue ? isFullSelectionMode ? defaultValue.isAllSelected : undefined : isFullSelectionMode ? false : undefined;
195
+ const defaultIsCheckedValue = defaultValue ? isCheckboxMode ? defaultValue.isChecked || false : undefined : isCheckboxMode ? false : undefined;
196
+ if (defaultIsCheckedValue !== state.defaultValueIsChecked) {
197
+ defaultIsCheckedValue !== undefined && dispatchState({
198
+ type: StateActionType.SetDefaultIsChecked,
199
+ payload: defaultIsCheckedValue
200
+ });
201
+ }
202
+ if (compareStringsArrays(defaultSelectedValue, state.defaultValue) && defaultAllSelectedValue === state.defaultValueIsAllSelected) {
203
+ return;
204
+ }
205
+ dispatchState({
206
+ type: StateActionType.SetDefaultValue,
207
+ payload: defaultSelectedValue
208
+ });
209
+ isFullSelectionMode && defaultAllSelectedValue !== state.defaultValueIsAllSelected && dispatchState({
210
+ type: StateActionType.SetDefaultAllSelected,
211
+ payload: defaultAllSelectedValue
212
+ });
213
+ }, [defaultValue, defaultValueInner, isCheckboxMode, isFullSelectionMode, state.defaultValue, state.defaultValueIsAllSelected, state.defaultValueIsChecked]);
214
+ const loadSelectedItems = useCallback(ids => {
215
+ if (!getSelectedItem || !ids.size) {
216
+ return;
217
+ }
218
+ const promises = [];
219
+ Array.from(ids).forEach((id, ind) => {
220
+ if (ind > 99) {
221
+ return;
222
+ }
223
+ const itemOrPromise = getSelectedItem(id);
224
+ promises.push(Promise.resolve(itemOrPromise));
225
+ });
226
+ // eslint-disable-next-line consistent-return
227
+ return Promise.all(promises).then(items => {
228
+ const result = items.filter(el => el !== undefined);
229
+ dispatchState({
230
+ type: StateActionType.UpdateSelectedItems,
231
+ payload: result
232
+ });
233
+ getNamedItemsHasBeenCalled.current = false;
234
+ }).catch(() => {
235
+ dispatchState({
236
+ type: StateActionType.UpdateSelectedItems,
237
+ payload: []
238
+ });
239
+ });
240
+ }, [getSelectedItem]);
241
+ useEffect(() => {
242
+ if (isLoadingError) {
243
+ dispatchState({
244
+ type: StateActionType.SetIsOpenCombo,
245
+ payload: false
246
+ });
247
+ }
248
+ }, [isLoadingError]);
249
+ useEffect(() => {
250
+ if (!getSelectedItem) {
251
+ return;
252
+ }
253
+ dispatchState({
254
+ type: StateActionType.UpdateNamelessItems,
255
+ payload: undefined
256
+ });
257
+ }, [getSelectedItem]);
258
+ useEffect(() => {
259
+ if (state.namelessIds.size === 0 || !getSelectedItem || state.pendingNamelessIds) {
260
+ return;
261
+ }
262
+ selectedItemsLoader.current = loadSelectedItems(state.namelessIds);
263
+ dispatchState({
264
+ type: StateActionType.SetPendingState,
265
+ payload: true
266
+ });
267
+ }, [getSelectedItem, loadSelectedItems, state.namelessIds, state.pendingNamelessIds]);
268
+ useEffect(() => {
269
+ dispatchState({
270
+ type: StateActionType.SetFirstParentNodeIsVisible,
271
+ payload: firstParentNodeIsVisible
272
+ });
273
+ }, [firstParentNodeIsVisible]);
274
+ const handleChangeCurrentId = useCallback(id => {
275
+ dispatchState({
276
+ type: StateActionType.SetCurrentId,
277
+ payload: id
278
+ });
279
+ dispatchState({
280
+ type: StateActionType.SetInputValue,
281
+ payload: ""
282
+ });
283
+ isQueryMode && setSearch && setSearch("");
284
+ }, [isQueryMode, setSearch]);
285
+ const handleBackButtonClick = useCallback(() => {
286
+ var _a, _b;
287
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
288
+ const newCurrentId = state.currentId ? (_b = (_a = state.groupsMap[state.currentId]) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.id : undefined;
289
+ dispatchState({
290
+ type: StateActionType.SetCurrentId,
291
+ payload: newCurrentId === state.rootId || state.inputValue ? undefined : newCurrentId
292
+ });
293
+ }, [state.currentId, state.groupsMap, state.inputValue, state.rootId]);
294
+ const handleSelect = useCallback(val => {
295
+ if (isFullSelectionMode && state.isAllSelected) {
296
+ dispatchState({
297
+ type: StateActionType.DeselectItemsFromAllSelected,
298
+ payload: val.id
299
+ });
300
+ return;
301
+ }
302
+ if (val.partial) {
303
+ dispatchState({
304
+ type: StateActionType.DeselectAllChildren,
305
+ payload: val.id
306
+ });
307
+ } else {
308
+ dispatchState({
309
+ type: StateActionType.ChangeSelection,
310
+ payload: {
311
+ value: val.state,
312
+ itemId: val.id
313
+ }
314
+ });
315
+ }
316
+ }, [isFullSelectionMode, state.isAllSelected]);
317
+ const handleClose = useCallback(() => {
318
+ dispatchState({
319
+ type: StateActionType.SetInputValue,
320
+ payload: ""
321
+ });
322
+ if (!triggerRef.current) {
323
+ return;
324
+ }
325
+ if (isFocusable(triggerRef.current)) {
326
+ triggerRef.current.focus();
327
+ return;
328
+ }
329
+ const focusable = [...Array.from(triggerRef.current.querySelectorAll(FOCUSABLE_SELECTOR))];
330
+ (focusable[0] || triggerRef.current).focus();
331
+ }, []);
332
+ const handleEscape = useCallback(() => {
333
+ dispatchState({
334
+ type: StateActionType.SetIsOpenCombo,
335
+ payload: false
336
+ });
337
+ dispatchState({
338
+ type: StateActionType.SetCurrentId,
339
+ payload: undefined
340
+ });
341
+ abortToken.current.abort();
342
+ abortToken.current = new AbortController();
343
+ handleClose();
344
+ }, [handleClose]);
345
+ const memoizedAllowClosing = useMemo(() => state.currentId === undefined || state.currentId === state.rootId, [state.currentId, state.rootId]);
346
+ const handleSingleSelection = useCallback((reset, selected) => {
347
+ const shouldBeClosed = !hasApplyButton && memoizedAllowClosing && (!reset && selected || reset);
348
+ dispatchState({
349
+ type: StateActionType.ChangeSingleSelection,
350
+ payload: {
351
+ value: selected,
352
+ reset: reset
353
+ }
354
+ });
355
+ shouldBeClosed && handleEscape();
356
+ shouldBeClosed && dispatchState({
357
+ type: StateActionType.SetInputValue,
358
+ payload: ""
359
+ });
360
+ }, [handleEscape, hasApplyButton, memoizedAllowClosing]);
361
+ const handleSelectAllClick = useCallback(isAllSelect => {
362
+ if (isFullSelectionMode) {
363
+ dispatchState({
364
+ type: StateActionType.ToggleValueForAllSelected,
365
+ payload: undefined
366
+ });
367
+ return;
368
+ }
369
+ dispatchState({
370
+ type: isAllSelect ? StateActionType.DeselectAllChildren : StateActionType.SelectAllChildren,
371
+ payload: state.currentId || state.rootId
372
+ });
373
+ }, [isFullSelectionMode, state.currentId, state.rootId]);
374
+ const handleSelectAllInSearch = useCallback(isAllSelect => {
375
+ if (isFullSelectionMode && state.isAllSelected) {
376
+ dispatchState({
377
+ type: StateActionType.DeselectItemsFromAllSelected,
378
+ payload: undefined
379
+ });
380
+ return;
381
+ }
382
+ const dataForChange = getDataForChange(getListDataWithDisabled(state.listData, state.isNestedList), state.selectedIds, isAllSelect);
383
+ dispatchState({
384
+ type: StateActionType.ChangeBulkSelection,
385
+ payload: {
386
+ itemsIds: dataForChange,
387
+ value: !isAllSelect
388
+ }
389
+ });
390
+ }, [isFullSelectionMode, state.isAllSelected, state.listData, state.isNestedList, state.selectedIds]);
391
+ const handleClearClick = useCallback(() => {
392
+ dispatchState({
393
+ type: StateActionType.ResetSelection,
394
+ payload: undefined
395
+ });
396
+ }, []);
397
+ const handleCancelClick = useCallback(() => {
398
+ dispatchState({
399
+ type: StateActionType.ResetStateToGlobal,
400
+ payload: undefined
401
+ });
402
+ dispatchState({
403
+ type: StateActionType.SetIsOpenCombo,
404
+ payload: false
405
+ });
406
+ dispatchState({
407
+ type: StateActionType.SetCurrentId,
408
+ payload: undefined
409
+ });
410
+ abortToken.current.abort();
411
+ abortToken.current = new AbortController();
412
+ handleClose();
413
+ }, [handleClose]);
414
+ const handleApplyClick = useCallback(() => {
415
+ dispatchState({
416
+ type: StateActionType.SetGlobalState,
417
+ payload: Object.assign({
418
+ selected: state.selectedIds,
419
+ isAllSelected: state.isAllSelected
420
+ }, isCheckboxMode ? {
421
+ isChecked: state.isChecked
422
+ } : {})
423
+ });
424
+ dispatchState({
425
+ type: StateActionType.SetIsOpenCombo,
426
+ payload: false
427
+ });
428
+ dispatchState({
429
+ type: StateActionType.SetCurrentId,
430
+ payload: undefined
431
+ });
432
+ abortToken.current.abort();
433
+ abortToken.current = new AbortController();
434
+ handleClose();
435
+ dispatchState({
436
+ type: StateActionType.SetDataProblem,
437
+ payload: checkIsDataProblem(state.selectedIds, state.groupsMap)
438
+ });
439
+ const preparedItems = prepareSelectedIdsToItems(state.selectedIds, state.groupsMap, state.groupsMapSelected);
440
+ if (isFullSelectionMode) {
441
+ const newValue = isCheckboxMode ? {
442
+ selected: preparedItems,
443
+ isAllSelected: state.isAllSelected || false,
444
+ isChecked: state.isChecked
445
+ } : {
446
+ selected: preparedItems,
447
+ isAllSelected: state.isAllSelected || false
448
+ };
449
+ onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
450
+ } else {
451
+ const newValue = isCheckboxMode ? {
452
+ selected: preparedItems,
453
+ isChecked: state.isChecked
454
+ } : preparedItems;
455
+ onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
456
+ }
457
+ }, [state.selectedIds, state.isAllSelected, state.isChecked, state.groupsMap, state.groupsMapSelected, isCheckboxMode, handleClose, isFullSelectionMode, onChange]);
458
+ const customGetData = useCallback(str => str && dataItems ? Promise.resolve(dataItems.filter(el => {
459
+ var _a;
460
+ return (((_a = el.name) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase()) || "").indexOf(str.trim().toLocaleLowerCase()) > -1;
461
+ })) : Promise.resolve(dataItems || []), [dataItems]);
462
+ const handleData = useCallback((dta, searchVal) => {
463
+ if (dta.length && !searchVal && (getData || dataItems || isQueryMode)) {
464
+ dispatchState({
465
+ type: StateActionType.CreateMap,
466
+ payload: dta
467
+ });
468
+ previousMapDataItems.current = [...dta];
469
+ }
470
+ dispatchState({
471
+ type: StateActionType.SetListData,
472
+ payload: dta
473
+ });
474
+ searchVal && dispatchState({
475
+ type: StateActionType.SetCurrentId,
476
+ payload: undefined
477
+ });
478
+ dta.length ? dispatchState({
479
+ type: StateActionType.ShowList,
480
+ payload: undefined
481
+ }) : dispatchState({
482
+ type: StateActionType.ShowEmptyList,
483
+ payload: undefined
484
+ });
485
+ }, [getData, dataItems, isQueryMode]);
486
+ const handleError = useCallback(e => {
487
+ errorHandler(e);
488
+ dispatchState({
489
+ type: StateActionType.NothingToShow,
490
+ payload: undefined
491
+ });
492
+ }, [errorHandler]);
493
+ const handleDataQuery = useCallback((dta, searchVal) => {
494
+ if (dta.length && !searchVal && !compareObjectsArrays(dta, previousMapDataItems.current)) {
495
+ dispatchState({
496
+ type: StateActionType.CreateMap,
497
+ payload: dta
498
+ });
499
+ previousMapDataItems.current = [...dta];
500
+ }
501
+ dispatchState({
502
+ type: StateActionType.SetListData,
503
+ payload: dta
504
+ });
505
+ searchVal && dispatchState({
506
+ type: StateActionType.SetCurrentId,
507
+ payload: undefined
508
+ });
509
+ dta.length ? dispatchState({
510
+ type: StateActionType.ShowList,
511
+ payload: undefined
512
+ }) : dispatchState({
513
+ type: StateActionType.ShowEmptyList,
514
+ payload: undefined
515
+ });
516
+ }, []);
517
+ const handleQueryMode = useCallback((searchValue, isChecked) => {
518
+ setChecked && isChecked !== undefined && setChecked(isChecked);
519
+ setSearch && setSearch(searchValue || "");
520
+ }, [setChecked, setSearch]);
521
+ const debouncedGetData = useDebounce((signal, searchValue, isChecked) => getData ? (isCheckboxMode ? getData(signal, searchValue, isChecked) : getData(signal, searchValue)).then(dta => handleData(dta, searchValue)).catch(handleError) : customGetData(searchValue).then(dta => handleData(dta, searchValue)).catch(handleError), 200);
522
+ const controlData = useCallback((signal, searchValue, isChecked) => {
523
+ !isQueryMode && dispatchState({
524
+ type: StateActionType.ShowWaiting,
525
+ payload: undefined
526
+ });
527
+ isQueryMode ? handleQueryMode(searchValue, isChecked) : debouncedGetData(signal, searchValue, isChecked);
528
+ }, [debouncedGetData, handleQueryMode, isQueryMode]);
529
+ useEffect(() => {
530
+ const timeoutId = setTimeout(() => {
531
+ if (!isQueryMode || (fetchState === null || fetchState === void 0 ? void 0 : fetchState.isLoading)) {
532
+ return;
533
+ }
534
+ handleDataQuery((fetchState === null || fetchState === void 0 ? void 0 : fetchState.data) || [], state.inputValue);
535
+ });
536
+ return () => clearTimeout(timeoutId);
537
+ }, [fetchState === null || fetchState === void 0 ? void 0 : fetchState.data, handleDataQuery, fetchState === null || fetchState === void 0 ? void 0 : fetchState.isLoading, isQueryMode, state.inputValue]);
538
+ useEffect(() => {
539
+ // when change inside
540
+ if (hasApplyButton) {
541
+ return;
542
+ }
543
+ const prevIsCheckedValue = isCheckboxMode ? prevSelectedIds.current.isChecked : undefined;
544
+ if (compareStringsArrays(prevSelectedIds.current.selected, state.selectedIds) && prevSelectedIds.current.isAllSelected === state.isAllSelected && prevIsCheckedValue === state.isChecked) {
545
+ return;
546
+ }
547
+ prevSelectedIds.current = {
548
+ selected: state.selectedIds,
549
+ isAllSelected: state.isAllSelected,
550
+ isChecked: state.isChecked
551
+ };
552
+ if (compareStringsArrays(state.selectedIds, isFullSelectionMode || isCheckboxMode ? value.selected : value) && state.isAllSelected === (isFullSelectionMode ? value.isAllSelected : undefined) && state.isChecked === (isCheckboxMode ? value.isChecked : undefined)) {
553
+ return;
554
+ }
555
+ dispatchState({
556
+ type: StateActionType.SetDataProblem,
557
+ payload: checkIsDataProblem(state.selectedIds, state.groupsMap)
558
+ });
559
+ const preparedItems = prepareSelectedIdsToItems(state.selectedIds, state.groupsMap, state.groupsMapSelected);
560
+ if (isFullSelectionMode) {
561
+ const newValue = isCheckboxMode ? {
562
+ selected: preparedItems,
563
+ isAllSelected: state.isAllSelected || false,
564
+ isChecked: state.isChecked
565
+ } : {
566
+ selected: preparedItems,
567
+ isAllSelected: state.isAllSelected || false
568
+ };
569
+ onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
570
+ } else {
571
+ const newValue = isCheckboxMode ? {
572
+ selected: preparedItems,
573
+ isChecked: state.isChecked
574
+ } : preparedItems;
575
+ onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
576
+ }
577
+ // eslint-disable-next-line max-len
578
+ }, [onChangeInner, value, state.selectedIds, state.groupsMapSelected, state.groupsMap, hasApplyButton, state.isAllSelected, isFullSelectionMode, state.isChecked, isCheckboxMode, onChange]);
579
+ useEffect(() => {
580
+ // when change outside
581
+ const selectedValue = isFullSelectionMode || isCheckboxMode ? value.selected : value;
582
+ const isAllSelectedValue = isFullSelectionMode ? value.isAllSelected : undefined;
583
+ const isCheckedValue = isCheckboxMode ? value.isChecked : undefined;
584
+ if (compareStringsArrays(prevSelection.current.selected, selectedValue) && isAllSelectedValue === prevSelection.current.isAllSelected && prevSelection.current.isChecked === isCheckedValue) {
585
+ return;
586
+ }
587
+ prevSelection.current = {
588
+ selected: selectedValue,
589
+ isAllSelected: isAllSelectedValue,
590
+ isChecked: isCheckedValue
591
+ };
592
+ if (compareStringsArrays(hasApplyButton ? state.globalSelectedIds : state.selectedIds, selectedValue) && isAllSelectedValue === (hasApplyButton ? state.globalIsAllSelected : state.isAllSelected) && isCheckedValue === (hasApplyButton ? state.globalIsChecked : state.isChecked)) {
593
+ return;
594
+ }
595
+ // prevSelectedIds.current = { selected: selectedValue, isAllSelected: isAllSelectedValue, isChecked: isCheckedValue };
596
+ hasApplyButton && dispatchState({
597
+ type: StateActionType.SetGlobalState,
598
+ payload: {
599
+ selected: selectedValue,
600
+ isAllSelected: isAllSelectedValue,
601
+ isChecked: isCheckedValue
602
+ }
603
+ });
604
+ dispatchState({
605
+ type: StateActionType.SetState,
606
+ payload: {
607
+ selected: selectedValue,
608
+ isAllSelected: isAllSelectedValue
609
+ }
610
+ });
611
+ isCheckboxMode && isCheckedValue !== undefined && dispatchState({
612
+ type: StateActionType.SetIsChecked,
613
+ payload: isCheckedValue
614
+ });
615
+ }, [value, state.selectedIds, state.globalSelectedIds, hasApplyButton, isFullSelectionMode, state.isAllSelected, state.globalIsAllSelected, isCheckboxMode, state.globalIsChecked, state.isChecked]);
616
+ useEffect(() => {
617
+ if (!isCheckboxMode || prevIsChecked.current === undefined) {
618
+ return;
619
+ }
620
+ if (state.isChecked === prevIsChecked.current) {
621
+ return;
622
+ }
623
+ prevIsChecked.current = state.isChecked;
624
+ const currentAbort = abortToken.current;
625
+ controlData(currentAbort.signal, state.inputValue, state.isChecked);
626
+ }, [controlData, state.inputValue, state.isChecked, isCheckboxMode]);
627
+ useEscape(triggerRef, handleEscape, state.isOpenCombo);
628
+ const onSearchChange = useCallback(event => {
629
+ const newValue = event ? event.currentTarget.value : "";
630
+ dispatchState({
631
+ type: StateActionType.SetInputValue,
632
+ payload: newValue
633
+ });
634
+ const currentAbort = abortToken.current;
635
+ controlData(currentAbort.signal, newValue, state.isChecked);
636
+ }, [controlData, state.isChecked]);
637
+ const onInputChange = useCallback(newValue => {
638
+ dispatchState({
639
+ type: StateActionType.SetInputValue,
640
+ payload: newValue || ""
641
+ });
642
+ const currentAbort = abortToken.current;
643
+ controlData(currentAbort.signal, newValue, state.isChecked);
644
+ }, [controlData, state.isChecked]);
645
+ const containerClassName = classNames(["zen-dropdown", isFormSection ? "zen-dropdown--form-item" : "", "zen-dropdown__container", className || ""]);
646
+ const handleCheckboxChange = useCallback(e => {
647
+ const isChecked = e.target.checked;
648
+ dispatchState({
649
+ type: StateActionType.SetIsChecked,
650
+ payload: isChecked
651
+ });
652
+ prevIsChecked.current = isChecked;
653
+ const currentAbort = abortToken.current;
654
+ controlData(currentAbort.signal, state.inputValue, isChecked);
655
+ }, [controlData, state.inputValue]);
656
+ const handleTriggerClick = useCallback(newVal => {
657
+ const currentAbort = abortToken.current;
658
+ dispatchState({
659
+ type: StateActionType.SetCurrentId,
660
+ payload: undefined
661
+ });
662
+ dispatchState({
663
+ type: StateActionType.SetIsOpenCombo,
664
+ payload: newVal
665
+ });
666
+ newVal && controlData(currentAbort.signal, state.inputValue, state.isChecked);
667
+ !newVal && dispatchState({
668
+ type: StateActionType.SetInputValue,
669
+ payload: ""
670
+ });
671
+ }, [controlData, state.inputValue, state.isChecked]);
672
+ const handleReadyForFocus = useCallback(isCurrentOpen => {
673
+ var _a;
674
+ if (!state.showList) {
675
+ return;
676
+ }
677
+ if (!isCurrentOpen) {
678
+ return;
679
+ }
680
+ const firstFocusable = (_a = contentRef.current) === null || _a === void 0 ? void 0 : _a.querySelector(FOCUSABLE_SELECTOR);
681
+ if (firstFocusable && (state.currentId || !searchField)) {
682
+ firstFocusable.focus();
683
+ } else {
684
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
685
+ (inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) && inputRef.current.focus();
686
+ }
687
+ }, [searchField, state.currentId, state.showList, contentRef]);
688
+ useEffect(() => {
689
+ var _a;
690
+ if (!state.isOpenCombo || !state.showList) {
691
+ return;
692
+ }
693
+ const firstFocusable = (_a = contentRef.current) === null || _a === void 0 ? void 0 : _a.querySelector(FOCUSABLE_SELECTOR);
694
+ if (firstFocusable && (state.currentId || !searchField)) {
695
+ firstFocusable.focus();
696
+ } else {
697
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
698
+ (inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) && inputRef.current.focus();
699
+ }
700
+ }, [state.isOpenCombo, state.currentId, state.showList, searchField]);
701
+ useEffect(() => {
702
+ const shouldExit = !getNamedItems || Object.keys(state.groupsMap).length === 0 && Object.keys(state.groupsMapSelected).length === 0 || getNamedItemsHasBeenCalled.current || state.groupsMapSelected.size === 0;
703
+ if (shouldExit) {
704
+ return;
705
+ }
706
+ getNamedItemsHasBeenCalled.current = true;
707
+ getNamedItems(items => prepareSelectedIdsToItems(items, state.groupsMap, state.groupsMapSelected));
708
+ }, [getNamedItems, state.groupsMap, state.groupsMapSelected, state.namelessIds]);
709
+ useEffect(() => {
710
+ if (state.hasDataProblem && multiselect && state.isNestedList) {
711
+ // eslint-disable-next-line max-len
712
+ console.error("The data retrieved using the getData function could not form a valid object for displaying nested data. The currently displayed data contains nested elements. It is expected that selecting a nested item should deselect its parent, which cannot be achieved with the formed object.");
713
+ }
714
+ }, [state.hasDataProblem, multiselect, state.isNestedList]);
715
+ useEffect(() => {
716
+ if (state.isNestedList && isFullSelectionMode) {
717
+ // eslint-disable-next-line max-len
718
+ console.error("The IDropdownFullSelection interface is not designed to handle nested data. The IDropdownFullSelection interface is intended for use with flat data. If you need to use it with nested data, please use the IDropdown interface instead.");
719
+ }
720
+ }, [state.isNestedList, isFullSelectionMode]);
721
+ const memoizedWithFooter = useMemo(() => !(forceSelection && !state.defaultValue.length && !hasApplyButton), [forceSelection, hasApplyButton, state.defaultValue.length]);
722
+ const memoizedIsClearButtonDisabled = useMemo(() => {
723
+ if (forceSelection && !multiselect && !state.defaultValue.length) {
724
+ return true;
725
+ }
726
+ const isStringsTheSame = compareStringsArrays(state.selectedIds, state.defaultValue);
727
+ const isCheckedEqualDefault = currentIsChecked !== undefined ? currentIsChecked === state.defaultValueIsChecked : true;
728
+ if (currentAllSelected !== undefined && state.defaultValueIsAllSelected !== undefined && state.defaultValueIsAllSelected && isCheckedEqualDefault) {
729
+ return currentAllSelected === state.defaultValueIsAllSelected;
730
+ }
731
+ return currentAllSelected !== undefined ? state.defaultValueIsAllSelected === currentAllSelected && isStringsTheSame && isCheckedEqualDefault : isStringsTheSame && isCheckedEqualDefault;
732
+ }, [currentAllSelected, currentIsChecked, forceSelection, multiselect, state.defaultValue, state.defaultValueIsAllSelected, state.defaultValueIsChecked, state.selectedIds]);
733
+ const memoizedIsApplyButtonDisabled = useMemo(() => compareStringsArrays(state.globalSelectedIds, state.selectedIds) && (isFullSelectionMode ? state.globalIsAllSelected === state.isAllSelected : true) && (isCheckboxMode ? state.globalIsChecked === state.isChecked : true), [isCheckboxMode, isFullSelectionMode, state.globalIsAllSelected, state.globalIsChecked, state.globalSelectedIds, state.isAllSelected, state.isChecked, state.selectedIds]);
734
+ const countSelected = useMemo(() => {
735
+ var _a, _b;
736
+ if (hasApplyButton && state.globalIsAllSelected || !hasApplyButton && state.isAllSelected) {
737
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
738
+ return ((_b = (_a = state.groupsMap[ROOT_GROUP_ID]) === null || _a === void 0 ? void 0 : _a.children) === null || _b === void 0 ? void 0 : _b.length) || 0;
739
+ }
740
+ return getSelectedCount(hasApplyButton ? state.globalSelectedIds : state.selectedIds);
741
+ }, [hasApplyButton, state.globalIsAllSelected, state.globalSelectedIds, state.groupsMap, state.isAllSelected, state.selectedIds]);
742
+ // eslint-disable-next-line complexity
743
+ const getPopupContent = useMemo(() => {
744
+ var _a, _b, _c;
745
+ const triggerRefWidth = (_a = triggerRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect().width;
746
+ let currentWidth = triggerRefWidth ? Math.round(triggerRefWidth) : undefined;
747
+ if (currentWidth && currentWidth > 420) {
748
+ currentWidth = 420;
749
+ }
750
+ if (currentWidth && currentWidth < 180) {
751
+ currentWidth = 180;
752
+ }
753
+ if (state.showWaiting || isLoading || isQueryMode && (fetchState === null || fetchState === void 0 ? void 0 : fetchState.isLoading)) {
754
+ return _jsx(SkeletonList, {
755
+ className: "zen-dropdown-list__container zen-dropdown-list__container--empty",
756
+ width: currentWidth
757
+ });
758
+ }
759
+ if (state.showEmptyList || isQueryMode && (fetchState === null || fetchState === void 0 ? void 0 : fetchState.error)) {
760
+ const isClearButtonDisabled = compareStringsArrays(state.selectedIds, state.defaultValue);
761
+ return _jsx(EmptyList, {
762
+ width: currentWidth,
763
+ onClearClick: handleClearClick,
764
+ onCancelClick: handleCancelClick,
765
+ onApplyClick: handleApplyClick,
766
+ hasApplyButton: hasApplyButton,
767
+ isApplyDisabled: compareStringsArrays(state.globalSelectedIds, state.selectedIds),
768
+ isClearButtonDisabled: isClearButtonDisabled,
769
+ isWithFooter: memoizedWithFooter && Object.keys(state.groupsMap).length === 0 && (!hasApplyButton && !isClearButtonDisabled || hasApplyButton || false),
770
+ hasError: state.showEmptyList && isQueryMode && (fetchState === null || fetchState === void 0 ? void 0 : fetchState.error) !== null
771
+ });
772
+ }
773
+ if (state.showList) {
774
+ const isSearchMode = state.inputValue && !state.currentId;
775
+ const currentListData = createListDataOptions(state, translate, isSearchMode ? sortDropdownItemArray(state.listData, sortFn).slice(0, listLimit).filter(el => el.id !== state.rootId)
776
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
777
+ : sortDropdownItemArray(((_b = state.groupsMap[state.currentId || state.rootId]) === null || _b === void 0 ? void 0 : _b.children) || [], sortFn).slice(0, listLimit) || [], multiselect, currentAllSelected);
778
+ return _jsx(DropdownList, {
779
+ onBackButtonClick: handleBackButtonClick,
780
+ onSelectAllClick: isSearchMode ? handleSelectAllInSearch : handleSelectAllClick,
781
+ onClearClick: handleClearClick,
782
+ onCancelClick: handleCancelClick,
783
+ onApplyClick: handleApplyClick,
784
+ onChange: handleSelect,
785
+ onSelect: handleChangeCurrentId,
786
+ onSingleSelect: handleSingleSelection,
787
+ activeValue: state.selectedIds.length ? state.selectedIds[0] : "root",
166
788
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
167
- const newCurrentId = state.currentId ? (_b = (_a = state.groupsMap[state.currentId]) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.id : undefined;
168
- dispatchState({ type: StateActionType.SetCurrentId, payload: newCurrentId === ENTIRE_ORGANIZATION_GROUP_ID || state.inputValue ? undefined : newCurrentId });
169
- }, [state.currentId, state.groupsMap, state.inputValue]);
170
- const handleSelect = useCallback((val) => {
171
- if (isFullSelectionMode && state.isAllSelected) {
172
- dispatchState({ type: StateActionType.DeselectItemsFromAllSelected, payload: val.id });
173
- return;
174
- }
175
- if (val.partial) {
176
- dispatchState({ type: StateActionType.DeselectAllChildren, payload: val.id });
177
- }
178
- else {
179
- dispatchState({ type: StateActionType.ChangeSelection, payload: { value: val.state, itemId: val.id } });
180
- }
181
- }, [isFullSelectionMode, state.isAllSelected]);
182
- const handleClose = useCallback(() => {
183
- dispatchState({ type: StateActionType.SetInputValue, payload: "" });
184
- if (!triggerRef.current) {
185
- return;
186
- }
187
- if (isFocusable(triggerRef.current)) {
188
- triggerRef.current.focus();
189
- return;
190
- }
191
- const focusable = [...Array.from(triggerRef.current.querySelectorAll(FOCUSABLE_SELECTOR))];
192
- (focusable[0] || triggerRef.current).focus();
193
- }, []);
194
- const handleEscape = useCallback(() => {
195
- dispatchState({ type: StateActionType.SetIsOpenCombo, payload: false });
196
- dispatchState({ type: StateActionType.SetCurrentId, payload: undefined });
197
- abortToken.current.abort();
198
- abortToken.current = new AbortController();
199
- handleClose();
200
- }, [handleClose]);
201
- const memoizedAllowClosing = useMemo(() => state.currentId === undefined || state.currentId === ENTIRE_ORGANIZATION_GROUP_ID, [state.currentId]);
202
- const handleSingleSelection = useCallback((reset, selected) => {
203
- const shouldBeClosed = !hasApplyButton && memoizedAllowClosing && (!reset && selected || reset);
204
- dispatchState({ type: StateActionType.ChangeSingleSelection, payload: { value: selected, reset: reset } });
205
- shouldBeClosed && handleEscape();
206
- shouldBeClosed && dispatchState({ type: StateActionType.SetInputValue, payload: "" });
207
- }, [handleEscape, hasApplyButton, memoizedAllowClosing]);
208
- const handleSelectAllClick = useCallback((isAllSelect) => {
209
- if (isFullSelectionMode) {
210
- dispatchState({ type: StateActionType.ToggleValueForAllSelected, payload: undefined });
211
- return;
212
- }
213
- dispatchState({ type: isAllSelect ? StateActionType.DeselectAllChildren : StateActionType.SelectAllChildren, payload: state.currentId || ENTIRE_ORGANIZATION_GROUP_ID });
214
- }, [isFullSelectionMode, state.currentId]);
215
- const handleSelectAllInSearch = useCallback((isAllSelect) => {
216
- if (isFullSelectionMode && state.isAllSelected) {
217
- dispatchState({ type: StateActionType.DeselectItemsFromAllSelected, payload: undefined });
218
- return;
219
- }
220
- const dataForChange = getDataForChange(getListDataWithDisabled(state.listData, state.isNestedList), state.selectedIds, isAllSelect);
221
- dispatchState({ type: StateActionType.ChangeBulkSelection, payload: { itemsIds: dataForChange, value: !isAllSelect } });
222
- }, [isFullSelectionMode, state.isAllSelected, state.listData, state.isNestedList, state.selectedIds]);
223
- const handleClearClick = useCallback(() => {
224
- dispatchState({ type: StateActionType.ResetSelection, payload: undefined });
225
- }, []);
226
- const handleCancelClick = useCallback(() => {
227
- dispatchState({ type: StateActionType.ResetStateToGlobal, payload: undefined });
228
- dispatchState({ type: StateActionType.SetIsOpenCombo, payload: false });
229
- dispatchState({ type: StateActionType.SetCurrentId, payload: undefined });
230
- abortToken.current.abort();
231
- abortToken.current = new AbortController();
232
- handleClose();
233
- }, [handleClose]);
234
- const handleApplyClick = useCallback(() => {
235
- dispatchState({ type: StateActionType.SetGlobalState, payload: Object.assign({ selected: state.selectedIds, isAllSelected: state.isAllSelected }, (isCheckboxMode ? { isChecked: state.isChecked } : {})) });
236
- dispatchState({ type: StateActionType.SetIsOpenCombo, payload: false });
237
- dispatchState({ type: StateActionType.SetCurrentId, payload: undefined });
238
- abortToken.current.abort();
239
- abortToken.current = new AbortController();
240
- handleClose();
241
- dispatchState({ type: StateActionType.SetDataProblem, payload: checkIsDataProblem(state.selectedIds, state.groupsMap) });
242
- const preparedItems = prepareSelectedIdsToItems(state.selectedIds, state.groupsMap, state.groupsMapSelected);
243
- if (isFullSelectionMode) {
244
- const newValue = (isCheckboxMode
245
- ? { selected: preparedItems, isAllSelected: state.isAllSelected || false, isChecked: state.isChecked }
246
- : { selected: preparedItems, isAllSelected: state.isAllSelected || false });
247
- onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
248
- }
249
- else {
250
- const newValue = isCheckboxMode
251
- ? { selected: preparedItems, isChecked: state.isChecked }
252
- : preparedItems;
253
- onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
254
- }
255
- }, [state.selectedIds, state.isAllSelected, state.isChecked, state.groupsMap, state.groupsMapSelected, isCheckboxMode, handleClose, isFullSelectionMode, onChange]);
256
- const customGetData = useCallback((str) => (str && dataItems
257
- ? Promise.resolve(dataItems.filter(el => { var _a; return (((_a = el.name) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase()) || "").indexOf(str.trim().toLocaleLowerCase()) > -1; }))
258
- : Promise.resolve(dataItems || [])), [dataItems]);
259
- const handleData = useCallback((dta, searchVal) => {
260
- if (dta.length && !searchVal && (getData || dataItems || isQueryMode)) {
261
- dispatchState({ type: StateActionType.CreateMap, payload: dta });
262
- previousMapDataItems.current = [...dta];
263
- }
264
- dispatchState({ type: StateActionType.SetListData, payload: dta });
265
- searchVal && dispatchState({ type: StateActionType.SetCurrentId, payload: undefined });
266
- dta.length ? dispatchState({ type: StateActionType.ShowList, payload: undefined }) : dispatchState({ type: StateActionType.ShowEmptyList, payload: undefined });
267
- }, [getData, dataItems, isQueryMode]);
268
- const handleError = useCallback((e) => {
269
- errorHandler(e);
270
- dispatchState({ type: StateActionType.NothingToShow, payload: undefined });
271
- }, [errorHandler]);
272
- const handleDataQuery = useCallback((dta, searchVal) => {
273
- if (dta.length && !searchVal && !compareObjectsArrays(dta, previousMapDataItems.current)) {
274
- dispatchState({ type: StateActionType.CreateMap, payload: dta });
275
- previousMapDataItems.current = [...dta];
276
- }
277
- dispatchState({ type: StateActionType.SetListData, payload: dta });
278
- searchVal && dispatchState({ type: StateActionType.SetCurrentId, payload: undefined });
279
- dta.length ? dispatchState({ type: StateActionType.ShowList, payload: undefined }) : dispatchState({ type: StateActionType.ShowEmptyList, payload: undefined });
280
- }, []);
281
- const handleQueryMode = useCallback((searchValue, isChecked) => {
282
- setChecked && isChecked !== undefined && setChecked(isChecked);
283
- setSearch && setSearch(searchValue || "");
284
- }, [setChecked, setSearch]);
285
- const debouncedGetData = useDebounce((signal, searchValue, isChecked) => getData ? (isCheckboxMode ? getData(signal, searchValue, isChecked) : getData(signal, searchValue)).then((dta) => handleData(dta, searchValue)).catch(handleError)
286
- : customGetData(searchValue).then((dta) => handleData(dta, searchValue)).catch(handleError), 200);
287
- const controlData = useCallback((signal, searchValue, isChecked) => {
288
- !isQueryMode && dispatchState({ type: StateActionType.ShowWaiting, payload: undefined });
289
- isQueryMode ? handleQueryMode(searchValue, isChecked) : debouncedGetData(signal, searchValue, isChecked);
290
- }, [debouncedGetData, handleQueryMode, isQueryMode]);
291
- useEffect(() => {
292
- const timeoutId = setTimeout(() => {
293
- if (!isQueryMode || (fetchState === null || fetchState === void 0 ? void 0 : fetchState.isLoading)) {
294
- return;
295
- }
296
- handleDataQuery((fetchState === null || fetchState === void 0 ? void 0 : fetchState.data) || [], state.inputValue);
297
- });
298
- return () => clearTimeout(timeoutId);
299
- }, [fetchState === null || fetchState === void 0 ? void 0 : fetchState.data, handleDataQuery, fetchState === null || fetchState === void 0 ? void 0 : fetchState.isLoading, isQueryMode, state.inputValue]);
300
- useEffect(() => {
301
- // when change inside
302
- if (hasApplyButton) {
303
- return;
304
- }
305
- const prevIsCheckedValue = isCheckboxMode ?
306
- prevSelectedIds.current.isChecked : undefined;
307
- if (compareStringsArrays(prevSelectedIds.current.selected, state.selectedIds)
308
- && prevSelectedIds.current.isAllSelected === state.isAllSelected
309
- && prevIsCheckedValue === state.isChecked) {
310
- return;
311
- }
312
- prevSelectedIds.current = { selected: state.selectedIds, isAllSelected: state.isAllSelected, isChecked: state.isChecked };
313
- if (compareStringsArrays(state.selectedIds, isFullSelectionMode || isCheckboxMode ? value.selected : value)
314
- && state.isAllSelected === (isFullSelectionMode ? value.isAllSelected : undefined)
315
- && state.isChecked === (isCheckboxMode ? value.isChecked : undefined)) {
316
- return;
317
- }
318
- dispatchState({ type: StateActionType.SetDataProblem, payload: checkIsDataProblem(state.selectedIds, state.groupsMap) });
319
- const preparedItems = prepareSelectedIdsToItems(state.selectedIds, state.groupsMap, state.groupsMapSelected);
320
- if (isFullSelectionMode) {
321
- const newValue = (isCheckboxMode
322
- ? { selected: preparedItems, isAllSelected: state.isAllSelected || false, isChecked: state.isChecked }
323
- : { selected: preparedItems, isAllSelected: state.isAllSelected || false });
324
- onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
325
- }
326
- else {
327
- const newValue = isCheckboxMode
328
- ? { selected: preparedItems, isChecked: state.isChecked }
329
- : preparedItems;
330
- onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
331
- }
332
- // eslint-disable-next-line max-len
333
- }, [onChangeInner, value, state.selectedIds, state.groupsMapSelected, state.groupsMap, hasApplyButton, state.isAllSelected, isFullSelectionMode, state.isChecked, isCheckboxMode, onChange]);
334
- useEffect(() => {
335
- // when change outside
336
- const selectedValue = isFullSelectionMode || isCheckboxMode ? value.selected : value;
337
- const isAllSelectedValue = isFullSelectionMode ? value.isAllSelected : undefined;
338
- const isCheckedValue = isCheckboxMode ? value.isChecked : undefined;
339
- if (compareStringsArrays(prevSelection.current.selected, selectedValue) && isAllSelectedValue === prevSelection.current.isAllSelected && prevSelection.current.isChecked === isCheckedValue) {
340
- return;
341
- }
342
- prevSelection.current = { selected: selectedValue, isAllSelected: isAllSelectedValue, isChecked: isCheckedValue };
343
- if (compareStringsArrays(hasApplyButton ? state.globalSelectedIds : state.selectedIds, selectedValue)
344
- && isAllSelectedValue === (hasApplyButton ? state.globalIsAllSelected : state.isAllSelected)
345
- && isCheckedValue === (hasApplyButton ? state.globalIsChecked : state.isChecked)) {
346
- return;
347
- }
348
- // prevSelectedIds.current = { selected: selectedValue, isAllSelected: isAllSelectedValue, isChecked: isCheckedValue };
349
- hasApplyButton && dispatchState({ type: StateActionType.SetGlobalState,
350
- payload: { selected: selectedValue, isAllSelected: isAllSelectedValue, isChecked: isCheckedValue } });
351
- dispatchState({ type: StateActionType.SetState,
352
- payload: { selected: selectedValue, isAllSelected: isAllSelectedValue } });
353
- isCheckboxMode && isCheckedValue !== undefined && dispatchState({ type: StateActionType.SetIsChecked, payload: isCheckedValue });
354
- }, [value, state.selectedIds, state.globalSelectedIds, hasApplyButton, isFullSelectionMode, state.isAllSelected,
355
- state.globalIsAllSelected, isCheckboxMode, state.globalIsChecked, state.isChecked]);
356
- useEffect(() => {
357
- if (!isCheckboxMode || prevIsChecked.current === undefined) {
358
- return;
359
- }
360
- if (state.isChecked === prevIsChecked.current) {
361
- return;
362
- }
363
- prevIsChecked.current = state.isChecked;
364
- const currentAbort = abortToken.current;
365
- controlData(currentAbort.signal, state.inputValue, state.isChecked);
366
- }, [controlData, state.inputValue, state.isChecked, isCheckboxMode]);
367
- useEscape(triggerRef, handleEscape, state.isOpenCombo);
368
- const onSearchChange = useCallback((event) => {
369
- const newValue = event ? event.currentTarget.value : "";
370
- dispatchState({ type: StateActionType.SetInputValue, payload: newValue });
371
- const currentAbort = abortToken.current;
372
- controlData(currentAbort.signal, newValue, state.isChecked);
373
- }, [controlData, state.isChecked]);
374
- const onInputChange = useCallback((newValue) => {
375
- dispatchState({ type: StateActionType.SetInputValue, payload: newValue || "" });
376
- const currentAbort = abortToken.current;
377
- controlData(currentAbort.signal, newValue, state.isChecked);
378
- }, [controlData, state.isChecked]);
379
- const containerClassName = classNames([
380
- "zen-dropdown",
381
- isFormSection ? "zen-dropdown--form-item" : "",
382
- "zen-dropdown__container",
383
- className || ""
384
- ]);
385
- const handleCheckboxChange = useCallback((e) => {
386
- const isChecked = e.target.checked;
387
- dispatchState({ type: StateActionType.SetIsChecked, payload: isChecked });
388
- prevIsChecked.current = isChecked;
389
- const currentAbort = abortToken.current;
390
- controlData(currentAbort.signal, state.inputValue, isChecked);
391
- }, [controlData, state.inputValue]);
392
- const handleTriggerClick = useCallback((newVal) => {
393
- const currentAbort = abortToken.current;
394
- dispatchState({ type: StateActionType.SetCurrentId, payload: undefined });
395
- dispatchState({ type: StateActionType.SetIsOpenCombo, payload: newVal });
396
- newVal && controlData(currentAbort.signal, state.inputValue, state.isChecked);
397
- !newVal && dispatchState({ type: StateActionType.SetInputValue, payload: "" });
398
- }, [controlData, state.inputValue, state.isChecked]);
399
- const handleReadyForFocus = useCallback((isCurrentOpen) => {
400
- var _a;
401
- if (!state.showList) {
402
- return;
403
- }
404
- if (!isCurrentOpen) {
405
- return;
406
- }
407
- const firstFocusable = (_a = contentRef.current) === null || _a === void 0 ? void 0 : _a.querySelector(FOCUSABLE_SELECTOR);
408
- if (firstFocusable && (state.currentId || !searchField)) {
409
- firstFocusable.focus();
410
- }
411
- else {
412
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
413
- (inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) && inputRef.current.focus();
414
- }
415
- }, [searchField, state.currentId, state.showList, contentRef]);
416
- useEffect(() => {
417
- var _a;
418
- if (!state.isOpenCombo || !state.showList) {
419
- return;
420
- }
421
- const firstFocusable = (_a = contentRef.current) === null || _a === void 0 ? void 0 : _a.querySelector(FOCUSABLE_SELECTOR);
422
- if (firstFocusable && (state.currentId || !searchField)) {
423
- firstFocusable.focus();
424
- }
425
- else {
426
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
427
- (inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) && inputRef.current.focus();
428
- }
429
- }, [state.isOpenCombo, state.currentId, state.showList, searchField]);
430
- useEffect(() => {
431
- const shouldExit = !getNamedItems ||
432
- (Object.keys(state.groupsMap).length === 0 && Object.keys(state.groupsMapSelected).length === 0) ||
433
- getNamedItemsHasBeenCalled.current ||
434
- state.groupsMapSelected.size === 0;
435
- if (shouldExit) {
436
- return;
437
- }
438
- getNamedItemsHasBeenCalled.current = true;
439
- getNamedItems((items) => prepareSelectedIdsToItems(items, state.groupsMap, state.groupsMapSelected));
440
- }, [getNamedItems, state.groupsMap, state.groupsMapSelected, state.namelessIds]);
441
- useEffect(() => {
442
- if (state.hasDataProblem && multiselect && state.isNestedList) {
443
- // eslint-disable-next-line max-len
444
- console.error("The data retrieved using the getData function could not form a valid object for displaying nested data. The currently displayed data contains nested elements. It is expected that selecting a nested item should deselect its parent, which cannot be achieved with the formed object.");
445
- }
446
- }, [state.hasDataProblem, multiselect, state.isNestedList]);
447
- useEffect(() => {
448
- if (state.isNestedList && isFullSelectionMode) {
449
- // eslint-disable-next-line max-len
450
- console.error("The IDropdownFullSelection interface is not designed to handle nested data. The IDropdownFullSelection interface is intended for use with flat data. If you need to use it with nested data, please use the IDropdown interface instead.");
451
- }
452
- }, [state.isNestedList, isFullSelectionMode]);
453
- const memoizedWithFooter = useMemo(() => !(forceSelection && !state.defaultValue.length && !hasApplyButton), [forceSelection, hasApplyButton, state.defaultValue.length]);
454
- const memoizedIsClearButtonDisabled = useMemo(() => {
455
- if (forceSelection && !multiselect && !state.defaultValue.length) {
456
- return true;
457
- }
458
- const isStringsTheSame = compareStringsArrays(state.selectedIds, state.defaultValue);
459
- const isCheckedEqualDefault = currentIsChecked !== undefined ? currentIsChecked === state.defaultValueIsChecked : true;
460
- if (currentAllSelected !== undefined && state.defaultValueIsAllSelected !== undefined && state.defaultValueIsAllSelected && isCheckedEqualDefault) {
461
- return currentAllSelected === state.defaultValueIsAllSelected;
462
- }
463
- return currentAllSelected !== undefined ? state.defaultValueIsAllSelected === currentAllSelected && isStringsTheSame && isCheckedEqualDefault : isStringsTheSame && isCheckedEqualDefault;
464
- }, [currentAllSelected, currentIsChecked, forceSelection, multiselect, state.defaultValue, state.defaultValueIsAllSelected, state.defaultValueIsChecked, state.selectedIds]);
465
- const memoizedIsApplyButtonDisabled = useMemo(() => compareStringsArrays(state.globalSelectedIds, state.selectedIds)
466
- && (isFullSelectionMode ? state.globalIsAllSelected === state.isAllSelected : true)
467
- && (isCheckboxMode ? state.globalIsChecked === state.isChecked : true), [isCheckboxMode, isFullSelectionMode, state.globalIsAllSelected, state.globalIsChecked, state.globalSelectedIds, state.isAllSelected, state.isChecked, state.selectedIds]);
468
- const countSelected = useMemo(() => {
469
- var _a, _b;
470
- if (hasApplyButton && state.globalIsAllSelected || !hasApplyButton && state.isAllSelected) {
471
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
472
- return ((_b = (_a = state.groupsMap[ENTIRE_ORGANIZATION_GROUP_ID]) === null || _a === void 0 ? void 0 : _a.children) === null || _b === void 0 ? void 0 : _b.length) || 0;
473
- }
474
- return getSelectedCount(hasApplyButton ? state.globalSelectedIds : state.selectedIds);
475
- }, [hasApplyButton, state.globalIsAllSelected, state.globalSelectedIds, state.groupsMap, state.isAllSelected, state.selectedIds]);
476
- // eslint-disable-next-line complexity
477
- const getPopupContent = useMemo(() => {
478
- var _a, _b, _c;
479
- const triggerRefWidth = (_a = triggerRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect().width;
480
- let currentWidth = triggerRefWidth ? Math.round(triggerRefWidth) : undefined;
481
- if (currentWidth && currentWidth > 420) {
482
- currentWidth = 420;
483
- }
484
- if (currentWidth && currentWidth < 180) {
485
- currentWidth = 180;
486
- }
487
- if (state.showWaiting || isLoading || (isQueryMode && (fetchState === null || fetchState === void 0 ? void 0 : fetchState.isLoading))) {
488
- return _jsx(SkeletonList, { className: "zen-dropdown-list__container zen-dropdown-list__container--empty", width: currentWidth });
489
- }
490
- if (state.showEmptyList || (isQueryMode && (fetchState === null || fetchState === void 0 ? void 0 : fetchState.error))) {
491
- const isClearButtonDisabled = compareStringsArrays(state.selectedIds, state.defaultValue);
492
- return _jsx(EmptyList, { width: currentWidth, onClearClick: handleClearClick, onCancelClick: handleCancelClick, onApplyClick: handleApplyClick, hasApplyButton: hasApplyButton, isApplyDisabled: compareStringsArrays(state.globalSelectedIds, state.selectedIds), isClearButtonDisabled: isClearButtonDisabled, isWithFooter: memoizedWithFooter && Object.keys(state.groupsMap).length === 0 && ((!hasApplyButton && !isClearButtonDisabled) || hasApplyButton || false), hasError: state.showEmptyList && (isQueryMode && (fetchState === null || fetchState === void 0 ? void 0 : fetchState.error) !== null) });
493
- }
494
- if (state.showList) {
495
- const isSearchMode = state.inputValue && !state.currentId;
496
- const currentListData = createListDataOptions(state, translate, isSearchMode ? sortDropdownItemArray(state.listData, sortFn).slice(0, listLimit).filter(el => el.id !== ENTIRE_ORGANIZATION_GROUP_ID)
497
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
498
- : sortDropdownItemArray(((_b = state.groupsMap[state.currentId || ENTIRE_ORGANIZATION_GROUP_ID]) === null || _b === void 0 ? void 0 : _b.children) || [], sortFn).slice(0, listLimit) || [], multiselect, currentAllSelected);
499
- 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",
500
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
501
- 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)
502
- : (currentAllSelected === undefined ? isAllChildrenSelected(state, state.currentId || ENTIRE_ORGANIZATION_GROUP_ID) : false)), isMultiselect: multiselect, forceSelection: forceSelection,
503
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
504
- listData: currentListData, width: width || currentWidth === 180 ? undefined : currentWidth, minWidth: currentWidth, hasSelectAllButton: selectAllButton && multiselect, hasApplyButton: hasApplyButton, isApplyDisabled: memoizedIsApplyButtonDisabled, isSelectAllButtonDisable: currentListData.length === 0
505
- || isSearchMode !== "" && state.isNestedList
506
- && isAllItemsHasOneParent(state.listData.filter(el => el.id !== ENTIRE_ORGANIZATION_GROUP_ID),
507
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
508
- (((_c = state.groupsMap[ENTIRE_ORGANIZATION_GROUP_ID]) === null || _c === void 0 ? void 0 : _c.children) || []).map(el => el.id)), isClearButtonDisabled: memoizedIsClearButtonDisabled, isWithFooter: memoizedWithFooter && !isMobile, isMobile: isMobile, handleCheckboxChange: isCheckboxMode && !isMobile ? handleCheckboxChange : undefined, checkboxLabel: checkboxLabel, isChecked: state.isChecked });
509
- }
510
- return null;
511
- }, [state, isLoading, isQueryMode, fetchState === null || fetchState === void 0 ? void 0 : fetchState.isLoading, fetchState === null || fetchState === void 0 ? void 0 : fetchState.error, handleClearClick, handleCancelClick, handleApplyClick, hasApplyButton,
512
- memoizedWithFooter, translate, sortFn, listLimit, multiselect, currentAllSelected, handleBackButtonClick, handleSelectAllInSearch,
513
- handleSelectAllClick, handleSelect, handleChangeCurrentId, handleSingleSelection, isMobile, filterName, forceSelection, width,
514
- selectAllButton, memoizedIsApplyButtonDisabled, memoizedIsClearButtonDisabled, isCheckboxMode, handleCheckboxChange, checkboxLabel]);
515
- const currentStringFromSelected = isFullSelectionMode && hasApplyButton && state.globalIsAllSelected ||
516
- isFullSelectionMode && !hasApplyButton && state.isAllSelected ? getStringFromAllSelected(state.groupsMap, translate)
517
- : getStringFromSelected(hasApplyButton ? state.globalSelectedIds : state.selectedIds, state.groupsMapSelected, translate);
518
- const memoizedCurrentSelection = useMemo(() => showSelection && !state.inputValue ? currentStringFromSelected : "", [showSelection, state.inputValue, currentStringFromSelected]);
519
- const parentTriggerWidth = ((_b = comboboxRef.current) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect().width) || 420;
520
- if (isReadOnly) {
521
- // TODO: how many items should we show?
522
- return _jsx(ReviewTextControl, { value: getSelectedValues(state.groupsMapSelected) });
523
- }
524
- 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 }) :
525
- _jsx(DropdownTrigger, Object.assign({ name: name, onBlur: onBlur, 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 }, accessibilityProps)), _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, mobileSheetStackingClassName: mobileSheetStackingClassName, children: getPopupContent })] });
789
+ backButtonName: state.currentId && state.groupsMap[state.currentId] ? getGroupDescription(state.groupsMap[state.currentId], translate) : undefined,
790
+ filterName: isMobile ? undefined : filterName,
791
+ isAllSelected: currentAllSelected ? currentAllSelected : isSearchMode ? isEveryItemSelected(getListDataWithDisabled(state.listData, state.isNestedList), state.selectedIds) : currentAllSelected === undefined ? isAllChildrenSelected(state, state.currentId || state.rootId) : false,
792
+ isMultiselect: multiselect,
793
+ forceSelection: forceSelection,
794
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
795
+ listData: currentListData,
796
+ width: width || currentWidth === 180 ? undefined : currentWidth,
797
+ minWidth: currentWidth,
798
+ hasSelectAllButton: selectAllButton && multiselect,
799
+ hasApplyButton: hasApplyButton,
800
+ isApplyDisabled: memoizedIsApplyButtonDisabled,
801
+ isSelectAllButtonDisable: currentListData.length === 0 || isSearchMode !== "" && state.isNestedList && isAllItemsHasOneParent(state.listData.filter(el => el.id !== state.rootId),
802
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
803
+ (((_c = state.groupsMap[state.rootId]) === null || _c === void 0 ? void 0 : _c.children) || []).map(el => el.id)),
804
+ isClearButtonDisabled: memoizedIsClearButtonDisabled,
805
+ isWithFooter: memoizedWithFooter && !isMobile,
806
+ isMobile: isMobile,
807
+ handleCheckboxChange: isCheckboxMode && !isMobile ? handleCheckboxChange : undefined,
808
+ checkboxLabel: checkboxLabel,
809
+ isChecked: state.isChecked
810
+ });
811
+ }
812
+ return null;
813
+ }, [state, isLoading, isQueryMode, fetchState === null || fetchState === void 0 ? void 0 : fetchState.isLoading, fetchState === null || fetchState === void 0 ? void 0 : fetchState.error, handleClearClick, handleCancelClick, handleApplyClick, hasApplyButton, memoizedWithFooter, translate, sortFn, listLimit, multiselect, currentAllSelected, handleBackButtonClick, handleSelectAllInSearch, handleSelectAllClick, handleSelect, handleChangeCurrentId, handleSingleSelection, isMobile, filterName, forceSelection, width, selectAllButton, memoizedIsApplyButtonDisabled, memoizedIsClearButtonDisabled, isCheckboxMode, handleCheckboxChange, checkboxLabel]);
814
+ const currentStringFromSelected = isFullSelectionMode && hasApplyButton && state.globalIsAllSelected || isFullSelectionMode && !hasApplyButton && state.isAllSelected ? getStringFromAllSelected(state.groupsMap, translate, state.rootId) : getStringFromSelected(hasApplyButton ? state.globalSelectedIds : state.selectedIds, state.groupsMapSelected, translate, state.rootId);
815
+ const memoizedCurrentSelection = useMemo(() => showSelection && !state.inputValue ? currentStringFromSelected : "", [showSelection, state.inputValue, currentStringFromSelected]);
816
+ const parentTriggerWidth = ((_b = comboboxRef.current) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect().width) || 420;
817
+ if (isReadOnly) {
818
+ // TODO: how many items should we show?
819
+ return _jsx(ReviewTextControl, {
820
+ value: getSelectedValues(state.groupsMapSelected)
821
+ });
822
+ }
823
+ return _jsxs("div", {
824
+ className: containerClassName,
825
+ ref: comboboxRef,
826
+ children: [chip ? _jsx(Chip, {
827
+ status: memoizedIsClearButtonDisabled ? undefined : chipStatus || "active",
828
+ isOpen: state.isOpenCombo,
829
+ disabled: disabled,
830
+ onClick: handleTriggerClick,
831
+ onClose: memoizedIsClearButtonDisabled ? undefined : handleClearClick,
832
+ triggerRef: triggerRef,
833
+ icon: chipIcon,
834
+ id: chipId,
835
+ children: currentStringFromSelected || chipName
836
+ }) : _jsx(DropdownTrigger, Object.assign({
837
+ name: name,
838
+ onBlur: onBlur,
839
+ className: classNames([!width && !fullWidthTriggerButton && parentTriggerWidth < 420 && !searchField ? "zen-dropdown__trigger-button--width-parent" : "", isError ? "zen-dropdown__trigger-button--error" : ""]),
840
+ currentSelection: memoizedCurrentSelection,
841
+ isActive: state.isOpenCombo,
842
+ id: inputId,
843
+ isError: isError,
844
+ disabled: disabled,
845
+ count: showCounterPill ? countSelected : 0,
846
+ fullWidth: fullWidthTriggerButton,
847
+ inputValue: state.inputValue,
848
+ placeholder: placeholder || translate("Filter by group"),
849
+ searchField: searchField && !isMobile ? searchField : false,
850
+ onSearchChange: onSearchChange,
851
+ handleClick: handleTriggerClick,
852
+ width: width && width > 420 ? 420 : width,
853
+ title: title,
854
+ triggerAriaLabel: triggerAriaLabel,
855
+ triggerRef: triggerRef,
856
+ inputRef: inputRef,
857
+ buttonType: buttonType
858
+ }, accessibilityProps)), _jsx(DropdownPopup, {
859
+ alignment: alignment,
860
+ triggerRef: triggerRef,
861
+ classNamePopup: classNamePopup,
862
+ isMobile: isMobile,
863
+ dialogAriaLabel: dialogAriaLabel,
864
+ disabled: disabled,
865
+ filterName: filterName,
866
+ hasApplyButton: hasApplyButton,
867
+ inputId: inputId,
868
+ isClearButtonDisabled: memoizedIsClearButtonDisabled,
869
+ isApplyButtonDisabled: memoizedIsApplyButtonDisabled,
870
+ isWithFooter: memoizedWithFooter,
871
+ isOpenCombo: state.isOpenCombo,
872
+ searchField: searchField,
873
+ placeholder: placeholder,
874
+ inputValue: state.inputValue,
875
+ handleApplyClick: handleApplyClick,
876
+ handleClearClick: multiselect ? handleClearClick : handleSingleSelection.bind(this, true),
877
+ handleTriggerClick: handleTriggerClick,
878
+ onInputChange: onInputChange,
879
+ inputRef: inputRef,
880
+ contentRef: contentRef,
881
+ onReadyForFocus: handleReadyForFocus,
882
+ handleCheckboxChange: isCheckboxMode && isMobile ? handleCheckboxChange : undefined,
883
+ checkboxLabel: checkboxLabel,
884
+ isChecked: state.isChecked,
885
+ isSearchInPopup: chip,
886
+ mobileSheetStackingClassName: mobileSheetStackingClassName,
887
+ children: getPopupContent
888
+ })]
889
+ });
526
890
  };
527
891
  DropdownRaw.displayName = "DropdownRaw";
528
- export const TRANSLATIONS = [
529
- "Filter by group",
530
- "Open filter",
531
- "Clear search",
532
- "Select all",
533
- "Deselect all",
534
- "Clear",
535
- "Back",
536
- "No data"
537
- ];
892
+ export const TRANSLATIONS = ["Filter by group", "Open filter", "Clear search", "Select all", "Deselect all", "Clear", "Back", "No data"];