@geotab/zenith 3.1.1-beta.6 → 3.2.0-beta.1

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 (434) 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 +173 -59
  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/components/filtersSidePanelDropdown.js +2 -2
  73. package/dist/filters/filters.js +445 -268
  74. package/dist/filtersBar/components/filtersBarPeriodPicker/getRangeOption.js +729 -272
  75. package/dist/filtersBar/components/resetComponentButton.js +45 -5
  76. package/dist/filtersBar/filtersBarActions/filtersBarActions.js +126 -15
  77. package/dist/filtersBar/filtersBarSidePanel/components/filtersBarSidePanelRadioGroup/filtersBarSidePanelRadioGroup.js +2 -2
  78. package/dist/filtersBar/filtersBarSidePanel/components/filtersBarSidePanelRange/filtersBarSidePanelRange.js +155 -49
  79. package/dist/filtersBar/filtersBarSidePanel/filtersBarSidePanel.js +360 -104
  80. package/dist/filtersBar/filtersContainer/filtersContainer.js +204 -134
  81. package/dist/formField/components/formFieldWithLabel.d.ts +2 -1
  82. package/dist/formField/components/formFieldWithLabel.js +3 -2
  83. package/dist/formField/components/formFieldWithoutLabel.d.ts +2 -1
  84. package/dist/formField/components/formFieldWithoutLabel.js +3 -3
  85. package/dist/formField/components/trailingComponent.d.ts +8 -0
  86. package/dist/formField/components/trailingComponent.js +11 -0
  87. package/dist/formField/formField.js +26 -11
  88. package/dist/formField/hooks/useError.js +100 -36
  89. package/dist/formGroup/components/reviewListToggle/reviewListToggle.js +72 -7
  90. package/dist/formGroup/hooks/useToggle.js +37 -11
  91. package/dist/formGroup/utils/getControls.js +8 -7
  92. package/dist/formLayout/hooks/useError.js +55 -15
  93. package/dist/formLayout/hooks/useFormButtons.js +128 -27
  94. package/dist/formSection/components/formSectionModal.js +1 -1
  95. package/dist/formSection/formSection.js +1 -1
  96. package/dist/formSection/hooks/useError.js +70 -22
  97. package/dist/formStepper/components/formStep.js +65 -10
  98. package/dist/formStepper/formStepper.js +129 -33
  99. package/dist/formStepperButtons/formStepperButtons.js +184 -38
  100. package/dist/groupsFilter/groupsHelper.d.ts +1 -1
  101. package/dist/groupsFilterRaw/groupsFilterAdjustmentState.js +162 -17
  102. package/dist/groupsFilterRaw/groupsFilterBox.js +137 -32
  103. package/dist/groupsFilterRaw/groupsFilterCommon.js +75 -8
  104. package/dist/groupsFilterRaw/groupsFilterCurrentlySelectedState.js +184 -25
  105. package/dist/groupsFilterRaw/groupsFilterHelper.d.ts +2 -1
  106. package/dist/groupsFilterRaw/groupsFilterHelper.js +284 -168
  107. package/dist/groupsFilterRaw/groupsFilterInitialState.js +266 -18
  108. package/dist/groupsFilterRaw/groupsFilterMenu.js +124 -9
  109. package/dist/groupsFilterRaw/groupsFilterRaw.d.ts +1 -0
  110. package/dist/groupsFilterRaw/groupsFilterRaw.js +816 -308
  111. package/dist/groupsFilterRaw/groupsFilterTestData.d.ts +155 -2
  112. package/dist/groupsFilterRaw/groupsFilterTestData.js +153 -58
  113. package/dist/groupsFilterRaw/groupsFilterTrigger.js +139 -35
  114. package/dist/groupsFilterRaw/groupsHelper.js +739 -208
  115. package/dist/groupsFilterRaw/stateReducer/stateReducerHelper.js +3 -1
  116. package/dist/groupsFilterRaw/types.d.ts +1 -0
  117. package/dist/header/components/collapsedItemsControl/collapsedItemsControl.js +107 -52
  118. package/dist/header/components/mobileFilterControl/mobileFilterControl.js +62 -9
  119. package/dist/header/components/mobileSearchControl/mobileSearchControl.js +119 -14
  120. package/dist/header/headerBack.js +64 -20
  121. package/dist/index.css +116 -74
  122. package/dist/index.d.ts +1 -0
  123. package/dist/index.js +4 -1
  124. package/dist/list/itemData/itemDataInternal.js +216 -51
  125. package/dist/list/listItem/listItem.js +168 -55
  126. package/dist/menu/components/menuErrorItem.js +33 -5
  127. package/dist/mobileSheet/mobileSheet.js +195 -69
  128. package/dist/modal/modal.js +300 -142
  129. package/dist/nav/nav.js +1 -1
  130. package/dist/nav/navFooter/navFooter.js +82 -39
  131. package/dist/nav/navFooter/navFooterAction/navFooterAction.js +52 -13
  132. package/dist/nav/navHeader/navHeader.js +86 -36
  133. package/dist/nav/navHeader/navHeaderSearch/navHeaderSearch.js +88 -29
  134. package/dist/nav/navItem/navItem.d.ts +3 -3
  135. package/dist/nav/navItem/navItem.js +35 -33
  136. package/dist/nav/navMobileBar/navMobileBar.js +67 -21
  137. package/dist/notification/notification.js +124 -21
  138. package/dist/pagination/paginationArrow.js +81 -11
  139. package/dist/pagination/paginationText/paginationText.js +45 -11
  140. package/dist/pill/components/pillNonActionable/pillNonActionable.js +93 -24
  141. package/dist/pillBox/components/pillBoxItem.js +52 -9
  142. package/dist/pillBox/pillBox.js +121 -20
  143. package/dist/pillExpandable/pillExpandable.js +333 -139
  144. package/dist/rangeRaw/rangeRaw.js +486 -141
  145. package/dist/rangeRaw/utils/rangeHelper.js +209 -39
  146. package/dist/searchInputRaw/searchInputRaw.js +180 -65
  147. package/dist/skeleton/skeleton.js +51 -6
  148. package/dist/sortControl/sortControl.js +152 -42
  149. package/dist/stepperRaw/stepperRaw.js +116 -42
  150. package/dist/summary/summary.js +94 -8
  151. package/dist/table/actions/actionsMenu.js +171 -78
  152. package/dist/table/flexible/columnSettings.js +80 -10
  153. package/dist/table/flexible/columnsList.js +110 -43
  154. package/dist/table/flexible/columnsPopup.js +77 -20
  155. package/dist/table/nested/useNestedRows.js +167 -77
  156. package/dist/table/selectable/selectableHeader.js +180 -41
  157. package/dist/table/selectable/useSelectableRows.js +270 -191
  158. package/dist/table/sortable/sortableHeader.js +153 -75
  159. package/dist/tabs/tabs.js +227 -118
  160. package/dist/timePickerRaw/timePickerRaw.js +278 -58
  161. package/dist/toastRaw/toastRaw.js +138 -32
  162. package/dist/toggleButton/toggleButton.d.ts +0 -1
  163. package/dist/toggleButtonRaw/toggleButtonRaw.d.ts +1 -0
  164. package/dist/toggleButtonRaw/toggleButtonRaw.js +146 -40
  165. package/dist/utils/formatDate.js +1001 -117
  166. package/{esm/utils/localization/translations/cs-json.js → dist/utils/localization/translations/cs.json} +11 -12
  167. package/{esm/utils/localization/translations/da-DK-json.js → dist/utils/localization/translations/da-DK.json} +31 -23
  168. package/{esm/utils/localization/translations/de-json.js → dist/utils/localization/translations/de.json} +12 -13
  169. package/dist/utils/localization/translations/en.json +308 -0
  170. package/{esm/utils/localization/translations/es-json.js → dist/utils/localization/translations/es.json} +11 -12
  171. package/{esm/utils/localization/translations/fi-FI-json.js → dist/utils/localization/translations/fi-FI.json} +31 -23
  172. package/{esm/utils/localization/translations/fr-FR-json.js → dist/utils/localization/translations/fr-FR.json} +12 -12
  173. package/{esm/utils/localization/translations/fr-json.js → dist/utils/localization/translations/fr.json} +11 -12
  174. package/{esm/utils/localization/translations/hu-HU-json.js → dist/utils/localization/translations/hu-HU.json} +31 -23
  175. package/{esm/utils/localization/translations/id-json.js → dist/utils/localization/translations/id.json} +11 -13
  176. package/{esm/utils/localization/translations/it-json.js → dist/utils/localization/translations/it.json} +11 -12
  177. package/{esm/utils/localization/translations/ja-json.js → dist/utils/localization/translations/ja.json} +11 -12
  178. package/{esm/utils/localization/translations/ko-KR-json.js → dist/utils/localization/translations/ko-KR.json} +24 -23
  179. package/{esm/utils/localization/translations/ms-json.js → dist/utils/localization/translations/ms.json} +11 -12
  180. package/{esm/utils/localization/translations/nb-NO-json.js → dist/utils/localization/translations/nb-NO.json} +31 -23
  181. package/{esm/utils/localization/translations/nl-json.js → dist/utils/localization/translations/nl.json} +11 -12
  182. package/{esm/utils/localization/translations/pl-json.js → dist/utils/localization/translations/pl.json} +11 -12
  183. package/{esm/utils/localization/translations/pt-BR-json.js → dist/utils/localization/translations/pt-BR.json} +11 -12
  184. package/{esm/utils/localization/translations/sk-SK-json.js → dist/utils/localization/translations/sk-SK.json} +31 -23
  185. package/{esm/utils/localization/translations/sv-json.js → dist/utils/localization/translations/sv.json} +11 -12
  186. package/{esm/utils/localization/translations/th-json.js → dist/utils/localization/translations/th.json} +11 -12
  187. package/{esm/utils/localization/translations/tr-json.js → dist/utils/localization/translations/tr.json} +11 -12
  188. package/{esm/utils/localization/translations/zh-Hans-json.js → dist/utils/localization/translations/zh-Hans.json} +11 -12
  189. package/{esm/utils/localization/translations/zh-TW-json.js → dist/utils/localization/translations/zh-TW.json} +11 -23
  190. package/dist/utils/localization/translationsDictionary.d.ts +2 -0
  191. package/dist/utils/localization/translationsDictionary.js +63 -0
  192. package/dist/utils/localization/useLanguage.js +2 -74
  193. package/esm/advancedGroupsFilter/advancedGroupsFilter.js +130 -29
  194. package/esm/advancedGroupsFilter/advancedGroupsFilterForm.js +133 -33
  195. package/esm/advancedGroupsFilter/advancedGroupsFilterFormSection.js +317 -65
  196. package/esm/advancedGroupsFilter/advancedGroupsFilterSectionTooltip.d.ts +0 -1
  197. package/esm/advancedGroupsFilter/advancedGroupsFilterSectionTooltip.js +77 -8
  198. package/esm/alertRaw/alertRaw.js +165 -51
  199. package/esm/banner/bannerMultipLine.js +121 -20
  200. package/esm/banner/bannerSingleLine.js +100 -13
  201. package/esm/betaPill/betaPill.js +105 -19
  202. package/esm/bookmark/bookmark.js +89 -27
  203. package/esm/bulkEditControl/bulkEditControl.js +161 -33
  204. package/esm/calendar/calendar.js +937 -272
  205. package/esm/calendar/calendarUtils.js +151 -84
  206. package/esm/card/card.js +233 -101
  207. package/esm/chart/accessibleChart/accessibleChartNarrative.js +642 -554
  208. package/esm/chart/accessibleChart/accessibleChartTable.js +239 -85
  209. package/esm/chart/chart.js +30 -20
  210. package/esm/chart/chartAxis/chartAxis.js +79 -6
  211. package/esm/checkboxListWithAction/checkboxListWithAction.js +218 -68
  212. package/esm/chip/chip.js +189 -90
  213. package/esm/columnsSelector/columnsSelector.js +91 -11
  214. package/esm/columnsSelector/columnsTab/columnsTab.js +53 -14
  215. package/esm/columnsSelector/columnsTabGroup/columnsTabGroup.js +75 -33
  216. package/esm/comboboxSelected/comboboxSelected.js +1 -3
  217. package/esm/dataFeed/feedExpandControl/feedExpandControl.js +21 -9
  218. package/esm/dataGrid/columns/checkboxColumn/checkboxHeaderCell.js +86 -10
  219. package/esm/dataGrid/dataGrid.js +221 -116
  220. package/esm/dataGrid/emptySearchList/emptySearchList.js +50 -8
  221. package/esm/dataGrid/entitiesListActions/actions/columnsListButton.js +45 -6
  222. package/esm/dataGrid/entitiesListActions/actions/fullscreenButton.js +58 -17
  223. package/esm/dataGrid/withFlexibleColumns/components/columnSettings.js +78 -9
  224. package/esm/dataGrid/withFlexibleColumns/components/columnSettingsSidePanel.js +44 -15
  225. package/esm/dataGrid/withSelectableRows/components/bulkActions/bulkActions.js +217 -31
  226. package/esm/dataGrid/withSelectableRows/withSelectableRows.js +280 -212
  227. package/esm/dataGrid/withSortableColumns/columns/sortableColumnWrapper.js +172 -94
  228. package/esm/dateInputInner/dateInputInner.js +785 -475
  229. package/esm/dateInputInner/dateInputInnerControlBlock.js +119 -21
  230. package/esm/dateInputRaw/dateInputRaw.js +309 -103
  231. package/esm/dateInputRaw/utils/getLabel.js +32 -6
  232. package/esm/dateRangeInner/dateRangeInner.js +167 -58
  233. package/esm/dateRangeRaw/dateRangeRaw.js +595 -238
  234. package/esm/dateRangeRaw/utils/dateRangeUtils.js +622 -239
  235. package/esm/dateSelectionWrapper/dateSelectionWrapper.js +146 -13
  236. package/esm/dialog/dialogContent.js +117 -39
  237. package/esm/dropdownRaw/dropdownHelper.d.ts +2 -2
  238. package/esm/dropdownRaw/dropdownHelper.js +10 -10
  239. package/esm/dropdownRaw/dropdownList.js +412 -56
  240. package/esm/dropdownRaw/dropdownPopup.js +212 -19
  241. package/esm/dropdownRaw/dropdownRaw.js +862 -507
  242. package/esm/dropdownRaw/dropdownSearchableTrigger.js +217 -45
  243. package/esm/dropdownRaw/stateReducer/stateAction.d.ts +5 -1
  244. package/esm/dropdownRaw/stateReducer/stateActionType.d.ts +2 -1
  245. package/esm/dropdownRaw/stateReducer/stateActionType.js +1 -0
  246. package/esm/dropdownRaw/stateReducer/stateReducer.d.ts +6 -1
  247. package/esm/dropdownRaw/stateReducer/stateReducer.js +24 -12
  248. package/esm/dropdownRaw/stateReducer/stateReducerHelper.d.ts +2 -0
  249. package/esm/dropdownRaw/stateReducer/stateReducerHelper.js +18 -0
  250. package/esm/dropdownRaw/stateReducer/stateReducerTestData.d.ts +39 -0
  251. package/esm/dropdownRaw/stateReducer/stateReducerTestData.js +71 -0
  252. package/esm/dropdownRaw/types.d.ts +1 -0
  253. package/esm/favoriteButton/favoriteButton.js +53 -9
  254. package/esm/filters/components/filtersContainer.js +141 -61
  255. package/esm/filters/components/filtersEmptySelectedList.js +24 -3
  256. package/esm/filters/components/filtersSaveModal.js +134 -41
  257. package/esm/filters/components/filtersSavedChipComponent.js +312 -107
  258. package/esm/filters/components/filtersSearchItemData.js +121 -46
  259. package/esm/filters/components/filtersSearchList.js +375 -178
  260. package/esm/filters/components/filtersSelect.js +122 -60
  261. package/esm/filters/components/filtersSelectListItem.js +119 -12
  262. package/esm/filters/components/filtersSidePanel.js +504 -177
  263. package/esm/filters/components/filtersSidePanelDropdown.js +2 -2
  264. package/esm/filters/filters.js +435 -265
  265. package/esm/filtersBar/components/filtersBarPeriodPicker/getRangeOption.js +722 -270
  266. package/esm/filtersBar/components/resetComponentButton.js +39 -4
  267. package/esm/filtersBar/filtersBarActions/filtersBarActions.js +120 -14
  268. package/esm/filtersBar/filtersBarSidePanel/components/filtersBarSidePanelRadioGroup/filtersBarSidePanelRadioGroup.js +2 -2
  269. package/esm/filtersBar/filtersBarSidePanel/components/filtersBarSidePanelRange/filtersBarSidePanelRange.js +149 -48
  270. package/esm/filtersBar/filtersBarSidePanel/filtersBarSidePanel.js +354 -103
  271. package/esm/filtersBar/filtersContainer/filtersContainer.js +198 -133
  272. package/esm/formField/components/formFieldWithLabel.d.ts +2 -1
  273. package/esm/formField/components/formFieldWithLabel.js +3 -2
  274. package/esm/formField/components/formFieldWithoutLabel.d.ts +2 -1
  275. package/esm/formField/components/formFieldWithoutLabel.js +3 -3
  276. package/esm/formField/components/trailingComponent.d.ts +8 -0
  277. package/esm/formField/components/trailingComponent.js +7 -0
  278. package/esm/formField/formField.js +27 -12
  279. package/esm/formField/hooks/useError.js +94 -35
  280. package/esm/formGroup/components/reviewListToggle/reviewListToggle.js +66 -6
  281. package/esm/formGroup/hooks/useToggle.js +31 -10
  282. package/esm/formGroup/utils/getControls.js +8 -7
  283. package/esm/formLayout/hooks/useError.js +49 -14
  284. package/esm/formLayout/hooks/useFormButtons.js +122 -26
  285. package/esm/formSection/components/formSectionModal.js +1 -1
  286. package/esm/formSection/formSection.js +1 -1
  287. package/esm/formSection/hooks/useError.js +64 -21
  288. package/esm/formStepper/components/formStep.js +59 -9
  289. package/esm/formStepper/formStepper.js +123 -32
  290. package/esm/formStepperButtons/formStepperButtons.js +178 -37
  291. package/esm/groupsFilter/groupsHelper.d.ts +1 -1
  292. package/esm/groupsFilterRaw/groupsFilterAdjustmentState.js +152 -14
  293. package/esm/groupsFilterRaw/groupsFilterBox.js +131 -31
  294. package/esm/groupsFilterRaw/groupsFilterCommon.js +69 -7
  295. package/esm/groupsFilterRaw/groupsFilterCurrentlySelectedState.js +178 -24
  296. package/esm/groupsFilterRaw/groupsFilterHelper.d.ts +2 -1
  297. package/esm/groupsFilterRaw/groupsFilterHelper.js +279 -168
  298. package/esm/groupsFilterRaw/groupsFilterInitialState.js +260 -17
  299. package/esm/groupsFilterRaw/groupsFilterMenu.js +118 -8
  300. package/esm/groupsFilterRaw/groupsFilterRaw.d.ts +1 -0
  301. package/esm/groupsFilterRaw/groupsFilterRaw.js +811 -308
  302. package/esm/groupsFilterRaw/groupsFilterTestData.d.ts +155 -2
  303. package/esm/groupsFilterRaw/groupsFilterTestData.js +152 -57
  304. package/esm/groupsFilterRaw/groupsFilterTrigger.js +133 -34
  305. package/esm/groupsFilterRaw/groupsHelper.js +733 -207
  306. package/esm/groupsFilterRaw/stateReducer/stateReducerHelper.js +3 -1
  307. package/esm/groupsFilterRaw/types.d.ts +1 -0
  308. package/esm/header/components/collapsedItemsControl/collapsedItemsControl.js +101 -51
  309. package/esm/header/components/mobileFilterControl/mobileFilterControl.js +56 -8
  310. package/esm/header/components/mobileSearchControl/mobileSearchControl.js +113 -13
  311. package/esm/header/headerBack.js +58 -19
  312. package/esm/index.d.ts +1 -0
  313. package/esm/index.js +1 -0
  314. package/esm/list/itemData/itemDataInternal.js +210 -50
  315. package/esm/list/listItem/listItem.js +162 -54
  316. package/esm/menu/components/menuErrorItem.js +27 -4
  317. package/esm/mobileSheet/mobileSheet.js +189 -68
  318. package/esm/modal/modal.js +265 -120
  319. package/esm/nav/nav.js +1 -1
  320. package/esm/nav/navFooter/navFooter.js +76 -38
  321. package/esm/nav/navFooter/navFooterAction/navFooterAction.js +46 -12
  322. package/esm/nav/navHeader/navHeader.js +80 -35
  323. package/esm/nav/navHeader/navHeaderSearch/navHeaderSearch.js +82 -28
  324. package/esm/nav/navItem/navItem.d.ts +3 -3
  325. package/esm/nav/navItem/navItem.js +35 -33
  326. package/esm/nav/navMobileBar/navMobileBar.js +61 -20
  327. package/esm/notification/notification.js +114 -18
  328. package/esm/pagination/paginationArrow.js +75 -10
  329. package/esm/pagination/paginationText/paginationText.js +39 -10
  330. package/esm/pill/components/pillNonActionable/pillNonActionable.js +87 -23
  331. package/esm/pillBox/components/pillBoxItem.js +46 -8
  332. package/esm/pillBox/pillBox.js +115 -19
  333. package/esm/pillExpandable/pillExpandable.js +327 -138
  334. package/esm/rangeRaw/rangeRaw.js +480 -140
  335. package/esm/rangeRaw/utils/rangeHelper.js +203 -38
  336. package/esm/searchInputRaw/searchInputRaw.js +145 -43
  337. package/esm/skeleton/skeleton.js +45 -5
  338. package/esm/sortControl/sortControl.js +146 -41
  339. package/esm/stepperRaw/stepperRaw.js +112 -41
  340. package/esm/storybookHelpers/dataGridWithDifferentCellOptions/components/EntitiesListAction.js +178 -19
  341. package/esm/summary/summary.js +88 -7
  342. package/esm/table/actions/actionsMenu.js +165 -77
  343. package/esm/table/flexible/columnSettings.js +74 -9
  344. package/esm/table/flexible/columnsList.js +104 -42
  345. package/esm/table/flexible/columnsPopup.js +71 -19
  346. package/esm/table/nested/useNestedRows.js +161 -76
  347. package/esm/table/selectable/selectableHeader.js +174 -40
  348. package/esm/table/selectable/useSelectableRows.js +264 -190
  349. package/esm/table/sortable/sortableHeader.js +147 -74
  350. package/esm/tabs/tabs.js +221 -117
  351. package/esm/timePickerRaw/timePickerRaw.js +272 -57
  352. package/esm/toastRaw/toastRaw.js +132 -31
  353. package/esm/toggleButton/toggleButton.d.ts +0 -1
  354. package/esm/toggleButtonRaw/toggleButtonRaw.d.ts +1 -0
  355. package/esm/toggleButtonRaw/toggleButtonRaw.js +111 -18
  356. package/esm/utils/formatDate.js +995 -116
  357. package/{dist/utils/localization/translations/cs-json.js → esm/utils/localization/translations/cs.json} +11 -15
  358. package/{dist/utils/localization/translations/da-DK-json.js → esm/utils/localization/translations/da-DK.json} +31 -26
  359. package/{dist/utils/localization/translations/de-json.js → esm/utils/localization/translations/de.json} +12 -16
  360. package/esm/utils/localization/translations/en.json +308 -0
  361. package/{dist/utils/localization/translations/es-json.js → esm/utils/localization/translations/es.json} +11 -15
  362. package/{dist/utils/localization/translations/fi-FI-json.js → esm/utils/localization/translations/fi-FI.json} +31 -26
  363. package/{dist/utils/localization/translations/fr-FR-json.js → esm/utils/localization/translations/fr-FR.json} +12 -15
  364. package/{dist/utils/localization/translations/fr-json.js → esm/utils/localization/translations/fr.json} +11 -15
  365. package/{dist/utils/localization/translations/hu-HU-json.js → esm/utils/localization/translations/hu-HU.json} +31 -26
  366. package/{dist/utils/localization/translations/id-json.js → esm/utils/localization/translations/id.json} +11 -16
  367. package/{dist/utils/localization/translations/it-json.js → esm/utils/localization/translations/it.json} +11 -15
  368. package/{dist/utils/localization/translations/ja-json.js → esm/utils/localization/translations/ja.json} +11 -15
  369. package/{dist/utils/localization/translations/ko-KR-json.js → esm/utils/localization/translations/ko-KR.json} +24 -26
  370. package/{dist/utils/localization/translations/ms-json.js → esm/utils/localization/translations/ms.json} +11 -15
  371. package/{dist/utils/localization/translations/nb-NO-json.js → esm/utils/localization/translations/nb-NO.json} +31 -26
  372. package/{dist/utils/localization/translations/nl-json.js → esm/utils/localization/translations/nl.json} +11 -15
  373. package/{dist/utils/localization/translations/pl-json.js → esm/utils/localization/translations/pl.json} +11 -15
  374. package/{dist/utils/localization/translations/pt-BR-json.js → esm/utils/localization/translations/pt-BR.json} +11 -15
  375. package/{dist/utils/localization/translations/sk-SK-json.js → esm/utils/localization/translations/sk-SK.json} +31 -26
  376. package/{dist/utils/localization/translations/sv-json.js → esm/utils/localization/translations/sv.json} +11 -15
  377. package/{dist/utils/localization/translations/th-json.js → esm/utils/localization/translations/th.json} +11 -15
  378. package/{dist/utils/localization/translations/tr-json.js → esm/utils/localization/translations/tr.json} +11 -15
  379. package/{dist/utils/localization/translations/zh-Hans-json.js → esm/utils/localization/translations/zh-Hans.json} +11 -15
  380. package/{dist/utils/localization/translations/zh-TW-json.js → esm/utils/localization/translations/zh-TW.json} +11 -26
  381. package/esm/utils/localization/translationsDictionary.d.ts +2 -0
  382. package/esm/utils/localization/translationsDictionary.js +59 -0
  383. package/esm/utils/localization/useLanguage.js +1 -50
  384. package/package.json +19 -12
  385. package/dist/utils/localization/translations/cs-json.d.ts +0 -251
  386. package/dist/utils/localization/translations/da-DK-json.d.ts +0 -252
  387. package/dist/utils/localization/translations/de-json.d.ts +0 -251
  388. package/dist/utils/localization/translations/en-json.d.ts +0 -314
  389. package/dist/utils/localization/translations/en-json.js +0 -317
  390. package/dist/utils/localization/translations/es-json.d.ts +0 -251
  391. package/dist/utils/localization/translations/fi-FI-json.d.ts +0 -252
  392. package/dist/utils/localization/translations/fr-FR-json.d.ts +0 -250
  393. package/dist/utils/localization/translations/fr-json.d.ts +0 -251
  394. package/dist/utils/localization/translations/hu-HU-json.d.ts +0 -252
  395. package/dist/utils/localization/translations/id-json.d.ts +0 -252
  396. package/dist/utils/localization/translations/it-json.d.ts +0 -251
  397. package/dist/utils/localization/translations/ja-json.d.ts +0 -251
  398. package/dist/utils/localization/translations/ko-KR-json.d.ts +0 -258
  399. package/dist/utils/localization/translations/ms-json.d.ts +0 -251
  400. package/dist/utils/localization/translations/nb-NO-json.d.ts +0 -252
  401. package/dist/utils/localization/translations/nl-json.d.ts +0 -251
  402. package/dist/utils/localization/translations/pl-json.d.ts +0 -251
  403. package/dist/utils/localization/translations/pt-BR-json.d.ts +0 -251
  404. package/dist/utils/localization/translations/sk-SK-json.d.ts +0 -251
  405. package/dist/utils/localization/translations/sv-json.d.ts +0 -251
  406. package/dist/utils/localization/translations/th-json.d.ts +0 -251
  407. package/dist/utils/localization/translations/tr-json.d.ts +0 -251
  408. package/dist/utils/localization/translations/zh-Hans-json.d.ts +0 -251
  409. package/dist/utils/localization/translations/zh-TW-json.d.ts +0 -271
  410. package/esm/utils/localization/translations/cs-json.d.ts +0 -251
  411. package/esm/utils/localization/translations/da-DK-json.d.ts +0 -252
  412. package/esm/utils/localization/translations/de-json.d.ts +0 -251
  413. package/esm/utils/localization/translations/en-json.d.ts +0 -314
  414. package/esm/utils/localization/translations/en-json.js +0 -314
  415. package/esm/utils/localization/translations/es-json.d.ts +0 -251
  416. package/esm/utils/localization/translations/fi-FI-json.d.ts +0 -252
  417. package/esm/utils/localization/translations/fr-FR-json.d.ts +0 -250
  418. package/esm/utils/localization/translations/fr-json.d.ts +0 -251
  419. package/esm/utils/localization/translations/hu-HU-json.d.ts +0 -252
  420. package/esm/utils/localization/translations/id-json.d.ts +0 -252
  421. package/esm/utils/localization/translations/it-json.d.ts +0 -251
  422. package/esm/utils/localization/translations/ja-json.d.ts +0 -251
  423. package/esm/utils/localization/translations/ko-KR-json.d.ts +0 -258
  424. package/esm/utils/localization/translations/ms-json.d.ts +0 -251
  425. package/esm/utils/localization/translations/nb-NO-json.d.ts +0 -252
  426. package/esm/utils/localization/translations/nl-json.d.ts +0 -251
  427. package/esm/utils/localization/translations/pl-json.d.ts +0 -251
  428. package/esm/utils/localization/translations/pt-BR-json.d.ts +0 -251
  429. package/esm/utils/localization/translations/sk-SK-json.d.ts +0 -251
  430. package/esm/utils/localization/translations/sv-json.d.ts +0 -251
  431. package/esm/utils/localization/translations/th-json.d.ts +0 -251
  432. package/esm/utils/localization/translations/tr-json.d.ts +0 -251
  433. package/esm/utils/localization/translations/zh-Hans-json.d.ts +0 -251
  434. package/esm/utils/localization/translations/zh-TW-json.d.ts +0 -271
@@ -1,6 +1,7 @@
1
+ import { injectString } from "../utils/localization/translationsDictionary";
1
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
3
  import { useCallback, useEffect, useId, useMemo, useReducer, useRef, useState } from "react";
3
- import { FilterMenuStep } from "./groupsFilterInterfaces";
4
+ import { FilterMenuStep, RelationOperator } from "./groupsFilterInterfaces";
4
5
  import { GroupsFilterMenu, TRANSLATIONS as GroupsFilterMenuTranslations } from "./groupsFilterMenu";
5
6
  import { GroupsFilterInitialState, TRANSLATIONS as GroupsFilterInitialStateTranslations } from "./groupsFilterInitialState";
6
7
  import { GroupsFilterAdjustmentState, TRANSLATIONS as GroupsFilterAdjustmentStateTranslations } from "./groupsFilterAdjustmentState";
@@ -35,318 +36,820 @@ import { isFormItem } from "../commonHelpers/isFormItem";
35
36
  import { useFormField } from "../commonHelpers/hooks/useFormField";
36
37
  import { ReviewTextControl } from "../formGroup/components/reviewTextControl";
37
38
  // eslint-disable-next-line max-len, complexity
38
- export const GroupsFilterRaw = (props) => {
39
+ injectString("cs", "Groups", "Skupiny");
40
+ injectString("da-DK", "Groups", "Grupper");
41
+ injectString("de", "Groups", "Gruppen");
42
+ injectString("en", "Groups", "Groups");
43
+ injectString("es", "Groups", "Grupos");
44
+ injectString("fi-FI", "Groups", "Ryhm\xE4t");
45
+ injectString("fr", "Groups", "Groupes");
46
+ injectString("fr-FR", "Groups", "Groupes");
47
+ injectString("hu-HU", "Groups", "Csoportok");
48
+ injectString("id", "Groups", "Grup");
49
+ injectString("it", "Groups", "Gruppi");
50
+ injectString("ja", "Groups", "\u30B0\u30EB\u30FC\u30D7");
51
+ injectString("ko-KR", "Groups", "\uADF8\uB8F9");
52
+ injectString("ms", "Groups", "Kumpulan");
53
+ injectString("nb-NO", "Groups", "Grupper");
54
+ injectString("nl", "Groups", "Groepen");
55
+ injectString("pl", "Groups", "Grupy");
56
+ injectString("pt-BR", "Groups", "Grupos");
57
+ injectString("sk-SK", "Groups", "Skupiny");
58
+ injectString("sv", "Groups", "Grupper");
59
+ injectString("th", "Groups", "\u0E01\u0E25\u0E38\u0E48\u0E21");
60
+ injectString("tr", "Groups", "Gruplar");
61
+ injectString("zh-Hans", "Groups", "\u7EC4");
62
+ injectString("zh-TW", "Groups", "\u7FA4\u7D44");
63
+ injectString("cs", "Or", "Nebo");
64
+ injectString("da-DK", "Or", "Eller");
65
+ injectString("de", "Or", "Oder");
66
+ injectString("en", "Or", "Or");
67
+ injectString("es", "Or", "O");
68
+ injectString("fi-FI", "Or", "Tai");
69
+ injectString("fr", "Or", "Ou");
70
+ injectString("fr-FR", "Or", "Ou");
71
+ injectString("hu-HU", "Or", "Vagy");
72
+ injectString("id", "Or", "Atau");
73
+ injectString("it", "Or", "O");
74
+ injectString("ja", "Or", "\u307E\u305F\u306F");
75
+ injectString("ko-KR", "Or", "\uB610\uB294");
76
+ injectString("ms", "Or", "Atau");
77
+ injectString("nb-NO", "Or", "Eller");
78
+ injectString("nl", "Or", "Of");
79
+ injectString("pl", "Or", "Lub");
80
+ injectString("pt-BR", "Or", "Ou");
81
+ injectString("sk-SK", "Or", "Alebo");
82
+ injectString("sv", "Or", "Eller");
83
+ injectString("th", "Or", "\u0E2B\u0E23\u0E37\u0E2D");
84
+ injectString("tr", "Or", "Veya");
85
+ injectString("zh-Hans", "Or", "\u6216");
86
+ injectString("zh-TW", "Or", "\u6216");
87
+ injectString("cs", "And", "A");
88
+ injectString("da-DK", "And", "Og");
89
+ injectString("de", "And", "Und");
90
+ injectString("en", "And", "And");
91
+ injectString("es", "And", "Y");
92
+ injectString("fi-FI", "And", "Ja");
93
+ injectString("fr", "And", "Et");
94
+ injectString("fr-FR", "And", "Et");
95
+ injectString("hu-HU", "And", "\xC9s");
96
+ injectString("id", "And", "Dan");
97
+ injectString("it", "And", "E");
98
+ injectString("ja", "And", "\u3068");
99
+ injectString("ko-KR", "And", "\uADF8\uB9AC\uACE0");
100
+ injectString("ms", "And", "Dan");
101
+ injectString("nb-NO", "And", "Og");
102
+ injectString("nl", "And", "En");
103
+ injectString("pl", "And", "Oraz");
104
+ injectString("pt-BR", "And", "E");
105
+ injectString("sk-SK", "And", "A");
106
+ injectString("sv", "And", "Och");
107
+ injectString("th", "And", "\u0E41\u0E25\u0E30");
108
+ injectString("tr", "And", "Ve");
109
+ injectString("zh-Hans", "And", "\u548C");
110
+ injectString("zh-TW", "And", "\u548C");
111
+ injectString("cs", "Filter by group", "Filtrovat podle skupiny");
112
+ injectString("da-DK", "Filter by group", "Filtrer efter gruppe");
113
+ injectString("de", "Filter by group", "Nach Gruppe filtern");
114
+ injectString("en", "Filter by group", "Filter by group");
115
+ injectString("es", "Filter by group", "Filtrar por grupo");
116
+ injectString("fi-FI", "Filter by group", "Suodata ryhm\xE4n mukaan");
117
+ injectString("fr", "Filter by group", "Filtrer par groupe");
118
+ injectString("fr-FR", "Filter by group", "Filtrer par groupe");
119
+ injectString("hu-HU", "Filter by group", "Sz\u0171rd csoport alapj\xE1n.");
120
+ injectString("id", "Filter by group", "Filter berdasarkan grup");
121
+ injectString("it", "Filter by group", "Filtrare per gruppo");
122
+ injectString("ja", "Filter by group", "\u30B0\u30EB\u30FC\u30D7\u306B\u3088\u308B\u30D5\u30A3\u30EB\u30BF\u30EA\u30F3\u30B0");
123
+ injectString("ko-KR", "Filter by group", "\uADF8\uB8F9\uBCC4 \uD544\uD130\uB9C1");
124
+ injectString("ms", "Filter by group", "Saring mengikut kumpulan");
125
+ injectString("nb-NO", "Filter by group", "Filtrer etter gruppe");
126
+ injectString("nl", "Filter by group", "Filteren op groep");
127
+ injectString("pl", "Filter by group", "Filtruj wed\u0142ug grupy");
128
+ injectString("pt-BR", "Filter by group", "Filtrar por grupo");
129
+ injectString("sk-SK", "Filter by group", "Filtrova\u0165 pod\u013Ea skupiny");
130
+ injectString("sv", "Filter by group", "Filtrera efter grupp");
131
+ injectString("th", "Filter by group", "\u0E01\u0E23\u0E2D\u0E07\u0E15\u0E32\u0E21\u0E01\u0E25\u0E38\u0E48\u0E21");
132
+ injectString("tr", "Filter by group", "Gruba g\xF6re filtrele");
133
+ injectString("zh-Hans", "Filter by group", "\u6309\u7EC4\u8FC7\u6EE4");
134
+ injectString("zh-TW", "Filter by group", "\u4F9D\u7FA4\u7D44\u7BE9\u9078");
135
+ injectString("cs", "Apply", "Pou\u017E\xEDt");
136
+ injectString("da-DK", "Apply", "Anvend");
137
+ injectString("de", "Apply", "Anwenden");
138
+ injectString("en", "Apply", "Apply");
139
+ injectString("es", "Apply", "Aplicar");
140
+ injectString("fi-FI", "Apply", "K\xE4yt\xE4");
141
+ injectString("fr", "Apply", "Appliquer");
142
+ injectString("fr-FR", "Apply", "Appliquer");
143
+ injectString("hu-HU", "Apply", "Alkalmazd.");
144
+ injectString("id", "Apply", "Terapkan");
145
+ injectString("it", "Apply", "Applicare");
146
+ injectString("ja", "Apply", "\u9069\u7528");
147
+ injectString("ko-KR", "Apply", "\uC801\uC6A9");
148
+ injectString("ms", "Apply", "Gunakan");
149
+ injectString("nb-NO", "Apply", "Bruk");
150
+ injectString("nl", "Apply", "Toepassen");
151
+ injectString("pl", "Apply", "Zastosuj");
152
+ injectString("pt-BR", "Apply", "Aplicar");
153
+ injectString("sk-SK", "Apply", "Pou\u017Ei");
154
+ injectString("sv", "Apply", "Ans\xF6k");
155
+ injectString("th", "Apply", "\u0E43\u0E0A\u0E49");
156
+ injectString("tr", "Apply", "Uygula");
157
+ injectString("zh-Hans", "Apply", "\u5E94\u7528");
158
+ injectString("zh-TW", "Apply", "\u5957\u7528");
159
+ injectString("cs", "Cancel", "Zru\u0161it");
160
+ injectString("da-DK", "Cancel", "Annuller");
161
+ injectString("de", "Cancel", "Abbrechen");
162
+ injectString("en", "Cancel", "Cancel");
163
+ injectString("es", "Cancel", "Cancelar");
164
+ injectString("fi-FI", "Cancel", "Peruuta");
165
+ injectString("fr", "Cancel", "Annuler");
166
+ injectString("fr-FR", "Cancel", "Annuler");
167
+ injectString("hu-HU", "Cancel", "M\xE9gse");
168
+ injectString("id", "Cancel", "Batalkan");
169
+ injectString("it", "Cancel", "Annullare");
170
+ injectString("ja", "Cancel", "\u30AD\u30E3\u30F3\u30BB\u30EB");
171
+ injectString("ko-KR", "Cancel", "\uCDE8\uC18C");
172
+ injectString("ms", "Cancel", "Batal");
173
+ injectString("nb-NO", "Cancel", "Avbryt");
174
+ injectString("nl", "Cancel", "Annuleren");
175
+ injectString("pl", "Cancel", "Anuluj");
176
+ injectString("pt-BR", "Cancel", "Cancelar");
177
+ injectString("sk-SK", "Cancel", "Zru\u0161.");
178
+ injectString("sv", "Cancel", "Avbryt");
179
+ injectString("th", "Cancel", "\u0E22\u0E01\u0E40\u0E25\u0E34\u0E01");
180
+ injectString("tr", "Cancel", "\u0130ptal");
181
+ injectString("zh-Hans", "Cancel", "\u53D6\u6D88");
182
+ injectString("zh-TW", "Cancel", "\u53D6\u6D88");
183
+ injectString("cs", "Clear", "Vymazat");
184
+ injectString("da-DK", "Clear", "Ryd");
185
+ injectString("de", "Clear", "L\xF6schen");
186
+ injectString("en", "Clear", "Clear");
187
+ injectString("es", "Clear", "Borrar");
188
+ injectString("fi-FI", "Clear", "Tyhjenn\xE4");
189
+ injectString("fr", "Clear", "Effacer");
190
+ injectString("fr-FR", "Clear", "Effacer");
191
+ injectString("hu-HU", "Clear", "T\xF6r\xF6ld.");
192
+ injectString("id", "Clear", "Hapus");
193
+ injectString("it", "Clear", "Cancella");
194
+ injectString("ja", "Clear", "\u30AF\u30EA\u30A2");
195
+ injectString("ko-KR", "Clear", "\uC9C0\uC6B0\uAE30");
196
+ injectString("ms", "Clear", "Kosongkan");
197
+ injectString("nb-NO", "Clear", "T\xF8m");
198
+ injectString("nl", "Clear", "Wissen");
199
+ injectString("pl", "Clear", "Wyczy\u015B\u0107");
200
+ injectString("pt-BR", "Clear", "Limpar");
201
+ injectString("sk-SK", "Clear", "Vyma\u017E");
202
+ injectString("sv", "Clear", "Rensa");
203
+ injectString("th", "Clear", "\u0E25\u0E49\u0E32\u0E07");
204
+ injectString("tr", "Clear", "Temizle");
205
+ injectString("zh-Hans", "Clear", "\u6E05\u9664");
206
+ injectString("zh-TW", "Clear", "\u6E05\u9664");
207
+ injectString("cs", "Organization groups filter", "Filtr skupin organizace");
208
+ injectString("da-DK", "Organization groups filter", "Filter for organisationsgrupper");
209
+ injectString("de", "Organization groups filter", "Filter f\xFCr Firmengruppen");
210
+ injectString("en", "Organization groups filter", "Organization groups filter");
211
+ injectString("es", "Organization groups filter", "Filtro de grupos de la organizaci\xF3n");
212
+ injectString("fi-FI", "Organization groups filter", "Organisaatioryhmien suodatin");
213
+ injectString("fr", "Organization groups filter", "Filtre de groupes organisationnels");
214
+ injectString("fr-FR", "Organization groups filter", "Filtre des groupes de l\u2019entreprise");
215
+ injectString("hu-HU", "Organization groups filter", "Szervezeti csoportok sz\u0171r\xE9se");
216
+ injectString("id", "Organization groups filter", "Filter grup organisasi");
217
+ injectString("it", "Organization groups filter", "Filtro di gruppi dell'organizzazione");
218
+ injectString("ja", "Organization groups filter", "\u56E3\u4F53\u30B0\u30EB\u30FC\u30D7\u30D5\u30A3\u30EB\u30BF\u30FC");
219
+ injectString("ko-KR", "Organization groups filter", "\uC870\uC9C1 \uADF8\uB8F9 \uD544\uD130");
220
+ injectString("ms", "Organization groups filter", "Penyaring kumpulan organisasi");
221
+ injectString("nb-NO", "Organization groups filter", "Filter for organisasjonsgrupper.");
222
+ injectString("nl", "Organization groups filter", "Filter voor organisatiegroepen");
223
+ injectString("pl", "Organization groups filter", "Filtr grup organizacji");
224
+ injectString("pt-BR", "Organization groups filter", "Filtro de grupos da organiza\xE7\xE3o");
225
+ injectString("sk-SK", "Organization groups filter", "Filter organiza\u010Dn\xFDch skup\xEDn");
226
+ injectString("sv", "Organization groups filter", "Filter f\xF6r organisationsgrupper");
227
+ injectString("th", "Organization groups filter", "\u0E15\u0E31\u0E27\u0E01\u0E23\u0E2D\u0E07\u0E01\u0E25\u0E38\u0E48\u0E21\u0E2D\u0E07\u0E04\u0E4C\u0E01\u0E23");
228
+ injectString("tr", "Organization groups filter", "Organizasyon gruplar\u0131 filtresi");
229
+ injectString("zh-Hans", "Organization groups filter", "\u7EC4\u7EC7\u7EC4\u7B5B\u9009\u5668");
230
+ injectString("zh-TW", "Organization groups filter", "\u7D44\u7E54\u7FA4\u7D44\u7BE9\u9078");
231
+ export const GroupsFilterRaw = props => {
232
+ var _a;
233
+ const {
234
+ fullSize,
235
+ className,
236
+ classNamePopup,
237
+ dataLoader,
238
+ errorHandler,
239
+ initialFilterState,
240
+ isWithColor,
241
+ onChange,
242
+ options,
243
+ listLimit = 500,
244
+ isError,
245
+ isReadOnly,
246
+ chip,
247
+ chipIcon,
248
+ chipId,
249
+ chipName
250
+ } = props;
251
+ const chipStatus = useChipStatus();
252
+ const {
253
+ field
254
+ } = useFormField(props.controller);
255
+ const isFormItemValue = isFormItem(props);
256
+ let initialFilterStateInner, onChangeInner;
257
+ if (isFormItemValue) {
258
+ initialFilterStateInner = (_a = props.controller) === null || _a === void 0 ? void 0 : _a.defaultValue;
259
+ onChangeInner = state => {
260
+ field === null || field === void 0 ? void 0 : field.onChange(state);
261
+ };
262
+ } else {
263
+ initialFilterStateInner = initialFilterState;
264
+ onChangeInner = onChange;
265
+ }
266
+ const {
267
+ translate
268
+ } = useLanguage();
269
+ const [groupPlaceHolder, setGroupPlaceHolder] = useState((options === null || options === void 0 ? void 0 : options.placeholder) || translate("Groups"));
270
+ const [state, dispatchState] = useReducer(stateReducer, getInitialState(translate, initialFilterState));
271
+ const [uiState, dispatchUiState] = useReducer(uiStateReducer, uiInitialGroupsFilterState);
272
+ const [dataItems, setDataItems] = useState([]);
273
+ const isMobile = useMobile();
274
+ const inputRef = useRef(null);
275
+ const emptyInputRef = useRef(null);
276
+ const triggerRef = useRef(null);
277
+ const menuRef = useRef(null);
278
+ const prevInitialState = useRef(initialFilterStateInner);
279
+ const prevSearchField = useRef("");
280
+ const groupsFilterId = useId();
281
+ const blocksMap = useMemo(() => [["builtInGroups", "userGroups"], ["advancedGroups", "builtInGroups", "userGroups"], ["builtInGroups", "userGroups"]], []);
282
+ const onOptionsToggle = useCallback(() => {
283
+ dispatchUiState({
284
+ type: UiStateActionType.ToggleOpen,
285
+ payload: undefined
286
+ });
287
+ }, []);
288
+ const handleSetStep = useCallback(newStep => {
39
289
  var _a;
40
- const { fullSize, className, dataLoader, errorHandler, initialFilterState, isWithColor, onChange, options, listLimit = 500, isError, isReadOnly, chip, chipIcon, chipId, chipName } = props;
41
- const chipStatus = useChipStatus();
42
- const { field } = useFormField(props.controller);
43
- const isFormItemValue = isFormItem(props);
44
- let initialFilterStateInner, onChangeInner;
45
- if (isFormItemValue) {
46
- initialFilterStateInner = (_a = props.controller) === null || _a === void 0 ? void 0 : _a.defaultValue;
47
- onChangeInner = (state) => {
48
- field === null || field === void 0 ? void 0 : field.onChange(state);
49
- };
290
+ uiState.step !== FilterMenuStep.CurrentlySelected && dispatchUiState({
291
+ type: UiStateActionType.ClearUncheckedState,
292
+ payload: undefined
293
+ });
294
+ dispatchUiState({
295
+ type: UiStateActionType.SetStep,
296
+ payload: newStep
297
+ });
298
+ if (((_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.value) && newStep !== FilterMenuStep.Initial) {
299
+ inputRef.current.value = "";
300
+ dispatchUiState({
301
+ type: UiStateActionType.SetSearchValue,
302
+ payload: ""
303
+ });
50
304
  }
51
- else {
52
- initialFilterStateInner = initialFilterState;
53
- onChangeInner = onChange;
305
+ }, [uiState.step]);
306
+ const onSearchChange = useCallback(event => {
307
+ const newValue = event.currentTarget.value;
308
+ dispatchUiState({
309
+ type: UiStateActionType.SetSearchValue,
310
+ payload: newValue
311
+ });
312
+ dispatchUiState({
313
+ type: UiStateActionType.SetIsOpen,
314
+ payload: true
315
+ });
316
+ uiState.step !== FilterMenuStep.Initial && handleSetStep(FilterMenuStep.Initial);
317
+ }, [handleSetStep, uiState.step]);
318
+ const onSearchChipChange = useCallback(newValue => {
319
+ dispatchUiState({
320
+ type: UiStateActionType.SetSearchValue,
321
+ payload: newValue || ""
322
+ });
323
+ dispatchUiState({
324
+ type: UiStateActionType.SetIsOpen,
325
+ payload: true
326
+ });
327
+ uiState.step !== FilterMenuStep.Initial && handleSetStep(FilterMenuStep.Initial);
328
+ }, [handleSetStep, uiState.step]);
329
+ const handleFocusOnClose = useCallback(() => {
330
+ var _a, _b, _c;
331
+ if (chip) {
332
+ (_a = triggerRef.current) === null || _a === void 0 ? void 0 : _a.focus();
333
+ } else {
334
+ !isMobile && ((_b = inputRef.current) === null || _b === void 0 ? void 0 : _b.focus());
335
+ isMobile && ((_c = emptyInputRef.current) === null || _c === void 0 ? void 0 : _c.focus());
54
336
  }
55
- const { translate } = useLanguage();
56
- const [groupPlaceHolder, setGroupPlaceHolder] = useState((options === null || options === void 0 ? void 0 : options.placeholder) || translate("Groups"));
57
- const [state, dispatchState] = useReducer(stateReducer, getInitialState(translate, initialFilterState));
58
- const [uiState, dispatchUiState] = useReducer(uiStateReducer, uiInitialGroupsFilterState);
59
- const [dataItems, setDataItems] = useState([]);
60
- const isMobile = useMobile();
61
- const inputRef = useRef(null);
62
- const emptyInputRef = useRef(null);
63
- const triggerRef = useRef(null);
64
- const menuRef = useRef(null);
65
- const prevInitialState = useRef(initialFilterStateInner);
66
- const prevSearchField = useRef("");
67
- const groupsFilterId = useId();
68
- const blocksMap = useMemo(() => [["builtInGroups", "userGroups"], ["advancedGroups", "builtInGroups", "userGroups"], ["builtInGroups", "userGroups"]], []);
69
- const onOptionsToggle = useCallback(() => { dispatchUiState({ type: UiStateActionType.ToggleOpen, payload: undefined }); }, []);
70
- const handleSetStep = useCallback((newStep) => {
71
- var _a;
72
- uiState.step !== FilterMenuStep.CurrentlySelected && dispatchUiState({ type: UiStateActionType.ClearUncheckedState, payload: undefined });
73
- dispatchUiState({ type: UiStateActionType.SetStep, payload: newStep });
74
- if (((_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.value) && newStep !== FilterMenuStep.Initial) {
75
- inputRef.current.value = "";
76
- dispatchUiState({ type: UiStateActionType.SetSearchValue, payload: "" });
77
- }
78
- }, [uiState.step]);
79
- const onSearchChange = useCallback((event) => {
80
- const newValue = event.currentTarget.value;
81
- dispatchUiState({ type: UiStateActionType.SetSearchValue, payload: newValue });
82
- dispatchUiState({ type: UiStateActionType.SetIsOpen, payload: true });
83
- uiState.step !== FilterMenuStep.Initial && handleSetStep(FilterMenuStep.Initial);
84
- }, [handleSetStep, uiState.step]);
85
- const onSearchChipChange = useCallback((newValue) => {
86
- dispatchUiState({ type: UiStateActionType.SetSearchValue, payload: newValue || "" });
87
- dispatchUiState({ type: UiStateActionType.SetIsOpen, payload: true });
88
- uiState.step !== FilterMenuStep.Initial && handleSetStep(FilterMenuStep.Initial);
89
- }, [handleSetStep, uiState.step]);
90
- const handleFocusOnClose = useCallback(() => {
91
- var _a, _b, _c;
92
- if (chip) {
93
- (_a = triggerRef.current) === null || _a === void 0 ? void 0 : _a.focus();
94
- }
95
- else {
96
- !isMobile && ((_b = inputRef.current) === null || _b === void 0 ? void 0 : _b.focus());
97
- isMobile && ((_c = emptyInputRef.current) === null || _c === void 0 ? void 0 : _c.focus());
98
- }
99
- }, [chip, isMobile]);
100
- const handleCancel = useCallback(() => {
101
- dispatchUiState({ type: UiStateActionType.SetIsOpen, payload: false });
102
- dispatchState({ type: StateActionType.SetState, payload: state.frozenState });
103
- dispatchState({ type: StateActionType.SideWide, payload: state.frozenSideWideState });
104
- handleSetStep(FilterMenuStep.Initial);
105
- handleFocusOnClose();
106
- }, [state.frozenState, state.frozenSideWideState, handleSetStep, handleFocusOnClose]);
107
- const handleApply = useCallback(() => {
108
- dispatchUiState({ type: UiStateActionType.SetIsOpen, payload: false });
109
- dispatchUiState({ type: UiStateActionType.SetSearchValue, payload: "" });
110
- dispatchUiState({ type: UiStateActionType.ClearUncheckedState, payload: undefined });
111
- if (inputRef.current) {
112
- inputRef.current.value = "";
113
- }
114
- handleSetStep(FilterMenuStep.Initial);
115
- dispatchState({ type: StateActionType.FreezeState, payload: getCurrentState(state) });
116
- dispatchState({ type: StateActionType.FreezeSideWide, payload: state.sideWideState });
117
- handleFocusOnClose();
118
- }, [handleSetStep, state, handleFocusOnClose]);
119
- const handleReset = useCallback(() => {
120
- dispatchState({ type: StateActionType.ResetSelection, payload: undefined });
121
- }, []);
122
- const handleChipClose = useCallback(() => {
123
- dispatchState({ type: StateActionType.ResetSelection, payload: undefined });
124
- dispatchUiState({ type: UiStateActionType.SetIsOpen, payload: false });
125
- dispatchUiState({ type: UiStateActionType.SetSearchValue, payload: "" });
126
- dispatchUiState({ type: UiStateActionType.ClearUncheckedState, payload: undefined });
127
- if (inputRef.current) {
128
- inputRef.current.value = "";
129
- }
130
- handleSetStep(FilterMenuStep.Initial);
131
- dispatchState({ type: StateActionType.FreezeState, payload: defaultPreparedFilterState });
132
- dispatchState({ type: StateActionType.FreezeSideWide, payload: false });
133
- }, [handleSetStep]);
134
- const handleCheckboxChange = useCallback((value) => {
135
- if (value.partial) {
136
- dispatchState({ type: StateActionType.DeselectAllChildren, payload: value.id });
137
- }
138
- else {
139
- dispatchState({ type: StateActionType.ChangeSelection, payload: { value: value.state, itemId: value.id } });
140
- }
141
- }, [dispatchState]);
142
- const handleCheckboxItemClick = useCallback((id) => {
143
- dispatchUiState({ type: UiStateActionType.SetCurrentAdjustmentId, payload: id });
144
- handleSetStep(id ? FilterMenuStep.Adjustment : FilterMenuStep.Initial);
145
- }, [dispatchUiState, handleSetStep]);
146
- const handleCheckboxItemAdjustmentClick = useCallback((value) => {
147
- if (value.id === ADVANCED_FILTER_ID) {
148
- const currentVal = value.state ? uiState.uncheckedAdvancedState : state.advancedFilterState;
149
- !value.state && dispatchUiState({ type: UiStateActionType.SetUncheckedAdvancedState, payload: currentVal });
150
- !value.state && dispatchState({ type: StateActionType.SetAdvancedFilterState, payload: getDefaultFilterState() });
151
- value.state && dispatchState({ type: StateActionType.SetAdvancedFilterState, payload: currentVal || state.frozenState.advancedFilterState || getDefaultFilterState() });
152
- return;
153
- }
154
- dispatchUiState({ type: UiStateActionType.SetUncheckedAdjustmentIds, payload: !value.state ?
155
- [...uiState.uncheckedAdjustmentIds, value.id] : uiState.uncheckedAdjustmentIds.filter(id => id !== value.id) });
156
- dispatchState({ type: StateActionType.ChangeSelection, payload: { value: value.state, itemId: value.id } });
157
- }, [dispatchState, dispatchUiState, state.advancedFilterState, state.frozenState.advancedFilterState, uiState.uncheckedAdvancedState, uiState.uncheckedAdjustmentIds]);
158
- const basicHandleBackButtonClick = useCallback(() => {
159
- handleSetStep(FilterMenuStep.Initial);
160
- }, [handleSetStep]);
161
- const handleBackButtonClick = useCallback(() => {
162
- const currentEl = uiState.currentAdjustmentId ? getGroupsTreeItem(state, uiState.currentAdjustmentId) : undefined;
163
- if (!uiState.currentAdjustmentId || !(currentEl === null || currentEl === void 0 ? void 0 : currentEl.parent)) {
164
- basicHandleBackButtonClick();
165
- return;
166
- }
167
- const isNotRoot = currentEl.parent.id && currentEl.parent.id !== ENTIRE_ORGANIZATION_GROUP_ID;
168
- dispatchUiState({ type: UiStateActionType.SetCurrentAdjustmentId, payload: isNotRoot ? currentEl.parent.id : undefined });
169
- handleSetStep(isNotRoot ? FilterMenuStep.Adjustment : FilterMenuStep.Initial);
170
- }, [basicHandleBackButtonClick, handleSetStep, state, uiState.currentAdjustmentId]);
171
- const handleHomeButtonClick = useCallback(() => {
172
- handleSetStep(FilterMenuStep.Initial);
173
- uiState.currentAdjustmentId && dispatchUiState({ type: UiStateActionType.SetCurrentAdjustmentId, payload: undefined });
174
- }, [handleSetStep, uiState.currentAdjustmentId, dispatchUiState]);
175
- const handleCurrentlySelectedClick = useCallback(() => {
176
- handleSetStep(FilterMenuStep.CurrentlySelected);
177
- }, [handleSetStep]);
178
- const selectAllHandler = useCallback((isAllSelected) => {
179
- if (!uiState.currentAdjustmentId) {
180
- return;
337
+ }, [chip, isMobile]);
338
+ const handleCancel = useCallback(() => {
339
+ dispatchUiState({
340
+ type: UiStateActionType.SetIsOpen,
341
+ payload: false
342
+ });
343
+ dispatchState({
344
+ type: StateActionType.SetState,
345
+ payload: state.frozenState
346
+ });
347
+ dispatchState({
348
+ type: StateActionType.SideWide,
349
+ payload: state.frozenSideWideState
350
+ });
351
+ handleSetStep(FilterMenuStep.Initial);
352
+ handleFocusOnClose();
353
+ }, [state.frozenState, state.frozenSideWideState, handleSetStep, handleFocusOnClose]);
354
+ const handleApply = useCallback(() => {
355
+ dispatchUiState({
356
+ type: UiStateActionType.SetIsOpen,
357
+ payload: false
358
+ });
359
+ dispatchUiState({
360
+ type: UiStateActionType.SetSearchValue,
361
+ payload: ""
362
+ });
363
+ dispatchUiState({
364
+ type: UiStateActionType.ClearUncheckedState,
365
+ payload: undefined
366
+ });
367
+ if (inputRef.current) {
368
+ inputRef.current.value = "";
369
+ }
370
+ handleSetStep(FilterMenuStep.Initial);
371
+ dispatchState({
372
+ type: StateActionType.FreezeState,
373
+ payload: getCurrentState(state)
374
+ });
375
+ dispatchState({
376
+ type: StateActionType.FreezeSideWide,
377
+ payload: state.sideWideState
378
+ });
379
+ handleFocusOnClose();
380
+ }, [handleSetStep, state, handleFocusOnClose]);
381
+ const handleReset = useCallback(() => {
382
+ dispatchState({
383
+ type: StateActionType.ResetSelection,
384
+ payload: undefined
385
+ });
386
+ }, []);
387
+ const handleChipClose = useCallback(() => {
388
+ dispatchState({
389
+ type: StateActionType.ResetSelection,
390
+ payload: undefined
391
+ });
392
+ dispatchUiState({
393
+ type: UiStateActionType.SetIsOpen,
394
+ payload: false
395
+ });
396
+ dispatchUiState({
397
+ type: UiStateActionType.SetSearchValue,
398
+ payload: ""
399
+ });
400
+ dispatchUiState({
401
+ type: UiStateActionType.ClearUncheckedState,
402
+ payload: undefined
403
+ });
404
+ if (inputRef.current) {
405
+ inputRef.current.value = "";
406
+ }
407
+ handleSetStep(FilterMenuStep.Initial);
408
+ dispatchState({
409
+ type: StateActionType.FreezeState,
410
+ payload: defaultPreparedFilterState
411
+ });
412
+ dispatchState({
413
+ type: StateActionType.FreezeSideWide,
414
+ payload: false
415
+ });
416
+ }, [handleSetStep]);
417
+ const handleCheckboxChange = useCallback(value => {
418
+ if (value.partial) {
419
+ dispatchState({
420
+ type: StateActionType.DeselectAllChildren,
421
+ payload: value.id
422
+ });
423
+ } else {
424
+ dispatchState({
425
+ type: StateActionType.ChangeSelection,
426
+ payload: {
427
+ value: value.state,
428
+ itemId: value.id
181
429
  }
182
- dispatchState({ type: isAllSelected ? StateActionType.DeselectAllChildren : StateActionType.SelectAllChildren, payload: uiState.currentAdjustmentId });
183
- }, [uiState.currentAdjustmentId, dispatchState]);
184
- const handleTriggerClick = () => {
185
- dispatchUiState({ type: UiStateActionType.ToggleOpen, payload: undefined });
430
+ });
431
+ }
432
+ }, [dispatchState]);
433
+ const handleCheckboxItemClick = useCallback(id => {
434
+ dispatchUiState({
435
+ type: UiStateActionType.SetCurrentAdjustmentId,
436
+ payload: id
437
+ });
438
+ handleSetStep(id ? FilterMenuStep.Adjustment : FilterMenuStep.Initial);
439
+ }, [dispatchUiState, handleSetStep]);
440
+ const handleCheckboxItemAdjustmentClick = useCallback(value => {
441
+ if (value.id === ADVANCED_FILTER_ID) {
442
+ const currentVal = value.state ? uiState.uncheckedAdvancedState : state.advancedFilterState;
443
+ !value.state && dispatchUiState({
444
+ type: UiStateActionType.SetUncheckedAdvancedState,
445
+ payload: currentVal
446
+ });
447
+ !value.state && dispatchState({
448
+ type: StateActionType.SetAdvancedFilterState,
449
+ payload: getDefaultFilterState()
450
+ });
451
+ value.state && dispatchState({
452
+ type: StateActionType.SetAdvancedFilterState,
453
+ payload: currentVal || state.frozenState.advancedFilterState || getDefaultFilterState()
454
+ });
455
+ return;
456
+ }
457
+ dispatchUiState({
458
+ type: UiStateActionType.SetUncheckedAdjustmentIds,
459
+ payload: !value.state ? [...uiState.uncheckedAdjustmentIds, value.id] : uiState.uncheckedAdjustmentIds.filter(id => id !== value.id)
460
+ });
461
+ dispatchState({
462
+ type: StateActionType.ChangeSelection,
463
+ payload: {
464
+ value: value.state,
465
+ itemId: value.id
466
+ }
467
+ });
468
+ }, [dispatchState, dispatchUiState, state.advancedFilterState, state.frozenState.advancedFilterState, uiState.uncheckedAdvancedState, uiState.uncheckedAdjustmentIds]);
469
+ const basicHandleBackButtonClick = useCallback(() => {
470
+ handleSetStep(FilterMenuStep.Initial);
471
+ }, [handleSetStep]);
472
+ const handleBackButtonClick = useCallback(() => {
473
+ const currentEl = uiState.currentAdjustmentId ? getGroupsTreeItem(state, uiState.currentAdjustmentId) : undefined;
474
+ if (!uiState.currentAdjustmentId || !(currentEl === null || currentEl === void 0 ? void 0 : currentEl.parent)) {
475
+ basicHandleBackButtonClick();
476
+ return;
477
+ }
478
+ const isNotRoot = currentEl.parent.id && currentEl.parent.id !== ENTIRE_ORGANIZATION_GROUP_ID;
479
+ dispatchUiState({
480
+ type: UiStateActionType.SetCurrentAdjustmentId,
481
+ payload: isNotRoot ? currentEl.parent.id : undefined
482
+ });
483
+ handleSetStep(isNotRoot ? FilterMenuStep.Adjustment : FilterMenuStep.Initial);
484
+ }, [basicHandleBackButtonClick, handleSetStep, state, uiState.currentAdjustmentId]);
485
+ const handleHomeButtonClick = useCallback(() => {
486
+ handleSetStep(FilterMenuStep.Initial);
487
+ uiState.currentAdjustmentId && dispatchUiState({
488
+ type: UiStateActionType.SetCurrentAdjustmentId,
489
+ payload: undefined
490
+ });
491
+ }, [handleSetStep, uiState.currentAdjustmentId, dispatchUiState]);
492
+ const handleCurrentlySelectedClick = useCallback(() => {
493
+ handleSetStep(FilterMenuStep.CurrentlySelected);
494
+ }, [handleSetStep]);
495
+ const selectAllHandler = useCallback(isAllSelected => {
496
+ if (!uiState.currentAdjustmentId) {
497
+ return;
498
+ }
499
+ dispatchState({
500
+ type: isAllSelected ? StateActionType.DeselectAllChildren : StateActionType.SelectAllChildren,
501
+ payload: uiState.currentAdjustmentId
502
+ });
503
+ }, [uiState.currentAdjustmentId, dispatchState]);
504
+ const handleTriggerClick = () => {
505
+ dispatchUiState({
506
+ type: UiStateActionType.ToggleOpen,
507
+ payload: undefined
508
+ });
509
+ };
510
+ const handleAdvancedDialogOpen = useCallback(() => {
511
+ dispatchUiState({
512
+ type: UiStateActionType.SetAdvancedFilterIsOpen,
513
+ payload: true
514
+ });
515
+ }, []);
516
+ const handleAdvancedDialogClose = useCallback(() => {
517
+ dispatchUiState({
518
+ type: UiStateActionType.SetAdvancedFilterIsOpen,
519
+ payload: false
520
+ });
521
+ }, []);
522
+ const handleAdvancedDialogApply = useCallback(val => {
523
+ dispatchUiState({
524
+ type: UiStateActionType.SetAdvancedFilterIsOpen,
525
+ payload: false
526
+ });
527
+ dispatchState({
528
+ type: StateActionType.SetAdvancedFilterState,
529
+ payload: val.items.length ? val : getDefaultFilterState()
530
+ });
531
+ }, []);
532
+ const getAdvancedData = useCallback((_, searchValue) => dataLoader().then(data => searchValue ? data.filter(el => (el.name || el.id).toLocaleLowerCase().indexOf(searchValue.toLocaleLowerCase()) > -1) : data).catch(e => {
533
+ errorHandler(e);
534
+ return [];
535
+ }), [dataLoader, errorHandler]);
536
+ useEffect(() => {
537
+ dispatchUiState({
538
+ type: UiStateActionType.SetLoadWithError,
539
+ payload: false
540
+ });
541
+ dataLoader().then(groups => {
542
+ dispatchState({
543
+ type: StateActionType.CreateGroupsMap,
544
+ payload: groups
545
+ });
546
+ setDataItems(groups);
547
+ }).catch(e => {
548
+ dispatchUiState({
549
+ type: UiStateActionType.SetLoadWithError,
550
+ payload: true
551
+ });
552
+ errorHandler(e);
553
+ });
554
+ }, [dataLoader, errorHandler]);
555
+ useEffect(() => {
556
+ const step = uiState.step;
557
+ if (step !== FilterMenuStep.CurrentlySelected) {
558
+ return;
559
+ }
560
+ const groupsBlocks = getAdvancedFilterValue({
561
+ blocks: blocksMap[uiState.step],
562
+ state,
563
+ isWithColor: isWithColor || false,
564
+ uncheckedItems: uiState.step === FilterMenuStep.CurrentlySelected ? uiState.uncheckedAdjustmentIds : [],
565
+ uncheckedAdvancedState: uiState.step === FilterMenuStep.CurrentlySelected ? uiState.uncheckedAdvancedState : undefined,
566
+ listLimit
567
+ });
568
+ const label = getAdvancedLabel({
569
+ groupsBlocks
570
+ });
571
+ const selectedValues = dataItems.filter(item => {
572
+ var _a;
573
+ return (_a = state.frozenState.simpleFilterState) === null || _a === void 0 ? void 0 : _a.find(id => id === item.id);
574
+ }).map(item => item.name);
575
+ const selectedValuesLabel = selectedValues.join(` ${state.frozenState.relation === RelationOperator.OR ? translate("Or") : translate("And")} `);
576
+ if (!label && !selectedValuesLabel) {
577
+ setGroupPlaceHolder((options === null || options === void 0 ? void 0 : options.placeholder) || translate("Groups"));
578
+ return;
579
+ }
580
+ const separator = `${label && selectedValuesLabel ? ` ${state.frozenState.relation === RelationOperator.OR ? translate("Or") : translate("And")} ` : ""}`;
581
+ setGroupPlaceHolder(`${label}${separator}${selectedValuesLabel}`);
582
+ }, [uiState.searchValue, uiState.step, blocksMap, state, isWithColor, listLimit, uiState.currentAdjustmentId, uiState.uncheckedAdjustmentIds, uiState.uncheckedAdvancedState, dataItems, options === null || options === void 0 ? void 0 : options.placeholder, translate]);
583
+ const getGroupsBox = useCallback(() => _jsx(GroupsFilterBox, {
584
+ step: uiState.step,
585
+ currentId: uiState.currentAdjustmentId,
586
+ isWithColor: isWithColor || false,
587
+ state: state,
588
+ search: uiState.searchValue,
589
+ blocks: uiState.searchValue && uiState.step === FilterMenuStep.Initial ? [] : blocksMap[uiState.step],
590
+ onChange: uiState.step === FilterMenuStep.CurrentlySelected ? handleCheckboxItemAdjustmentClick : handleCheckboxChange,
591
+ onClick: handleCheckboxItemClick,
592
+ uncheckedItems: uiState.step === FilterMenuStep.CurrentlySelected ? uiState.uncheckedAdjustmentIds : [],
593
+ uncheckedAdvancedState: uiState.step === FilterMenuStep.CurrentlySelected ? uiState.uncheckedAdvancedState : undefined,
594
+ listLimit: listLimit
595
+ }), [blocksMap, handleCheckboxChange, handleCheckboxItemAdjustmentClick, handleCheckboxItemClick, isWithColor, listLimit, state, uiState.currentAdjustmentId, uiState.searchValue, uiState.step, uiState.uncheckedAdjustmentIds, uiState.uncheckedAdvancedState]);
596
+ const onSideWideChange = newState => {
597
+ dispatchState({
598
+ type: StateActionType.SideWide,
599
+ payload: newState
600
+ });
601
+ };
602
+ const onRelationChange = newRelation => {
603
+ dispatchState({
604
+ type: StateActionType.Relation,
605
+ payload: newRelation
606
+ });
607
+ };
608
+ const getSearchResult = useCallback(() => {
609
+ const result = getSearchResultFromObject(state, uiState.searchValue);
610
+ return result ? (result.builtInGroups.length + result.userGroups.length).toString() : "0";
611
+ }, [state, uiState.searchValue]);
612
+ const getAdvancedDialog = useMemo(() => _jsx(AdvancedGroupsFilter, {
613
+ isOpen: uiState.isOpenAdvancedFilter,
614
+ onClose: handleAdvancedDialogClose,
615
+ onApply: handleAdvancedDialogApply,
616
+ state: state.advancedFilterState,
617
+ getData: getAdvancedData,
618
+ errorHandler: errorHandler,
619
+ dataItems: dataItems,
620
+ isMobile: isMobile
621
+ }), [uiState.isOpenAdvancedFilter, handleAdvancedDialogClose, handleAdvancedDialogApply, dataItems, state.advancedFilterState, getAdvancedData, errorHandler, isMobile]);
622
+ useEffect(() => {
623
+ if (!state.globalChanges) {
624
+ return;
625
+ }
626
+ const newState = {
627
+ groups: convertPreparedFilters(state.frozenState),
628
+ sideWide: state.frozenSideWideState
186
629
  };
187
- const handleAdvancedDialogOpen = useCallback(() => {
188
- dispatchUiState({ type: UiStateActionType.SetAdvancedFilterIsOpen, payload: true });
189
- }, []);
190
- const handleAdvancedDialogClose = useCallback(() => {
191
- dispatchUiState({ type: UiStateActionType.SetAdvancedFilterIsOpen, payload: false });
192
- }, []);
193
- const handleAdvancedDialogApply = useCallback((val) => {
194
- dispatchUiState({ type: UiStateActionType.SetAdvancedFilterIsOpen, payload: false });
195
- dispatchState({ type: StateActionType.SetAdvancedFilterState, payload: val.items.length ? val : getDefaultFilterState() });
196
- }, []);
197
- const getAdvancedData = useCallback((_, searchValue) => dataLoader().then(data => (searchValue ? data.filter(el => (el.name || el.id).toLocaleLowerCase().indexOf(searchValue.toLocaleLowerCase()) > -1) : data)).catch((e) => {
198
- errorHandler(e);
199
- return [];
200
- }), [dataLoader, errorHandler]);
201
- useEffect(() => {
202
- dispatchUiState({ type: UiStateActionType.SetLoadWithError, payload: false });
203
- dataLoader().then(groups => {
204
- dispatchState({ type: StateActionType.CreateGroupsMap, payload: groups });
205
- setDataItems(groups);
206
- }).catch((e) => {
207
- dispatchUiState({ type: UiStateActionType.SetLoadWithError, payload: true });
208
- errorHandler(e);
209
- });
210
- }, [dataLoader, errorHandler]);
211
- useEffect(() => {
212
- const step = uiState.step;
213
- if (step !== FilterMenuStep.CurrentlySelected) {
214
- return;
215
- }
216
- const groupsBlocks = getAdvancedFilterValue({
217
- blocks: blocksMap[uiState.step],
218
- state,
219
- isWithColor: isWithColor || false,
220
- uncheckedItems: uiState.step === FilterMenuStep.CurrentlySelected ? uiState.uncheckedAdjustmentIds : [],
221
- uncheckedAdvancedState: uiState.step === FilterMenuStep.CurrentlySelected ? uiState.uncheckedAdvancedState : undefined,
222
- listLimit
223
- });
224
- const label = getAdvancedLabel({ groupsBlocks });
225
- const selectedValues = dataItems.filter((item) => { var _a; return (_a = state.frozenState.simpleFilterState) === null || _a === void 0 ? void 0 : _a.find((id) => id === item.id); }).map((item) => item.name);
226
- const selectedValuesLabel = selectedValues.join(` ${translate(state.frozenState.relation)} `);
227
- if (!label && !selectedValuesLabel) {
228
- setGroupPlaceHolder((options === null || options === void 0 ? void 0 : options.placeholder) || translate("Groups"));
229
- return;
230
- }
231
- const separator = `${label && selectedValuesLabel ? ` ${translate(state.frozenState.relation)} ` : ""}`;
232
- setGroupPlaceHolder(`${label}${separator}${selectedValuesLabel}`);
233
- }, [uiState.searchValue, uiState.step, blocksMap, state, isWithColor, listLimit, uiState.currentAdjustmentId,
234
- uiState.uncheckedAdjustmentIds, uiState.uncheckedAdvancedState, dataItems, options === null || options === void 0 ? void 0 : options.placeholder, translate]);
235
- const getGroupsBox = useCallback(() => _jsx(GroupsFilterBox, { step: uiState.step, currentId: uiState.currentAdjustmentId, isWithColor: isWithColor || false, state: state, search: uiState.searchValue, blocks: uiState.searchValue && uiState.step === FilterMenuStep.Initial ? [] : blocksMap[uiState.step], onChange: uiState.step === FilterMenuStep.CurrentlySelected ? handleCheckboxItemAdjustmentClick : handleCheckboxChange, onClick: handleCheckboxItemClick, uncheckedItems: uiState.step === FilterMenuStep.CurrentlySelected ? uiState.uncheckedAdjustmentIds : [], uncheckedAdvancedState: uiState.step === FilterMenuStep.CurrentlySelected ? uiState.uncheckedAdvancedState : undefined, listLimit: listLimit }), [blocksMap, handleCheckboxChange, handleCheckboxItemAdjustmentClick, handleCheckboxItemClick, isWithColor, listLimit, state, uiState.currentAdjustmentId, uiState.searchValue, uiState.step,
236
- uiState.uncheckedAdjustmentIds, uiState.uncheckedAdvancedState]);
237
- const onSideWideChange = (newState) => { dispatchState({ type: StateActionType.SideWide, payload: newState }); };
238
- const onRelationChange = (newRelation) => { dispatchState({ type: StateActionType.Relation, payload: newRelation }); };
239
- const getSearchResult = useCallback(() => {
240
- const result = getSearchResultFromObject(state, uiState.searchValue);
241
- return result ? (result.builtInGroups.length + result.userGroups.length).toString() : "0";
242
- }, [state, uiState.searchValue]);
243
- const getAdvancedDialog = useMemo(() => _jsx(AdvancedGroupsFilter, { isOpen: uiState.isOpenAdvancedFilter, onClose: handleAdvancedDialogClose, onApply: handleAdvancedDialogApply, state: state.advancedFilterState, getData: getAdvancedData, errorHandler: errorHandler, dataItems: dataItems, isMobile: isMobile }), [uiState.isOpenAdvancedFilter, handleAdvancedDialogClose, handleAdvancedDialogApply, dataItems, state.advancedFilterState, getAdvancedData, errorHandler, isMobile]);
244
- useEffect(() => {
245
- if (!state.globalChanges) {
246
- return;
247
- }
248
- const newState = {
249
- groups: convertPreparedFilters(state.frozenState),
250
- sideWide: state.frozenSideWideState
251
- };
252
- if ((initialFilterStateInner === null || initialFilterStateInner === void 0 ? void 0 : initialFilterStateInner.sideWide) === state.frozenSideWideState && comparePreparedFilters(prepareFilters(initialFilterStateInner.groups), state.frozenState)) {
253
- return;
254
- }
255
- const selectedValues = dataItems.filter(item => { var _a; return (_a = state.frozenState.simpleFilterState) === null || _a === void 0 ? void 0 : _a.find(id => id === item.id); }).map(item => item.name);
256
- setGroupPlaceHolder(selectedValues.length > 0 ? selectedValues.join(", ") : translate("Groups"));
257
- onChangeInner(Object.assign({}, newState));
258
- dispatchState({ type: StateActionType.TurnOfGlobalChanges, payload: undefined });
259
- }, [state.globalChanges, dataItems, translate, state.frozenState, state.frozenSideWideState, onChangeInner, initialFilterStateInner === null || initialFilterStateInner === void 0 ? void 0 : initialFilterStateInner.sideWide, initialFilterStateInner]);
260
- useEffect(() => {
261
- var _a;
262
- if (((_a = prevInitialState.current) === null || _a === void 0 ? void 0 : _a.sideWide) === (initialFilterStateInner === null || initialFilterStateInner === void 0 ? void 0 : initialFilterStateInner.sideWide)
263
- && comparePreparedFilters(prepareFilters(initialFilterStateInner ? initialFilterStateInner.groups : getDefaultFilterState()), prepareFilters(prevInitialState.current ? prevInitialState.current.groups : getDefaultFilterState()))) {
264
- return;
265
- }
266
- const stateForDispatch = (initialFilterStateInner === null || initialFilterStateInner === void 0 ? void 0 : initialFilterStateInner.groups) ?
267
- { value: prepareFilters(initialFilterStateInner.groups), global: initialFilterStateInner.sideWide } : { value: prepareFilters(getDefaultFilterState()), global: false };
268
- if (Object.keys(state.groupsMap).length > 0) {
269
- prevInitialState.current = initialFilterStateInner ? Object.assign({}, initialFilterStateInner) : undefined;
270
- dispatchState({ type: StateActionType.CreateInitialState, payload: stateForDispatch });
271
- !(initialFilterStateInner === null || initialFilterStateInner === void 0 ? void 0 : initialFilterStateInner.groups) && dispatchUiState({ type: UiStateActionType.SetStep, payload: FilterMenuStep.Initial });
272
- }
273
- }, [initialFilterStateInner, state.groupsMap]);
274
- const handleReadyForFocus = useCallback((isCurrentOpen) => {
275
- var _a, _b, _c;
276
- if ((_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.value) {
277
- return;
278
- }
279
- if (!isCurrentOpen) {
280
- (_b = emptyInputRef.current) === null || _b === void 0 ? void 0 : _b.focus();
281
- return;
282
- }
283
- (_c = inputRef.current) === null || _c === void 0 ? void 0 : _c.focus();
284
- }, [inputRef]);
285
- useEffect(() => {
286
- var _a, _b, _c, _d;
287
- if (!uiState.isOpen) {
288
- return;
289
- }
290
- if (uiState.searchValue && uiState.step === FilterMenuStep.Initial || uiState.step === FilterMenuStep.Initial && uiState.searchValue === ""
291
- && prevSearchField.current !== uiState.searchValue) {
292
- (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
293
- prevSearchField.current = uiState.searchValue;
294
- }
295
- else {
296
- const firstFocusable = chip ? (_b = menuRef.current) === null || _b === void 0 ? void 0 : _b.querySelectorAll(FOCUSABLE_SELECTOR)[1] : (_c = menuRef.current) === null || _c === void 0 ? void 0 : _c.querySelector(FOCUSABLE_SELECTOR);
297
- prevSearchField.current = "";
298
- if (firstFocusable && !((_d = inputRef.current) === null || _d === void 0 ? void 0 : _d.value)) {
299
- firstFocusable.focus();
300
- }
301
- }
302
- }, [uiState.searchValue, uiState.isOpen, uiState.step, handleSetStep, chip]);
303
- useEffect(() => {
304
- var _a;
305
- uiState.isOpen && ((_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus());
306
- }, [inputRef, uiState.isOpen]);
307
- useEffect(() => {
308
- if (!uiState.isOpen && uiState.step === FilterMenuStep.Initial && isFilterHasSelection(state.frozenState)) {
309
- dispatchUiState({ type: UiStateActionType.SetStep, payload: FilterMenuStep.CurrentlySelected });
310
- }
311
- }, [uiState.isOpen, state.frozenState, uiState.step]);
312
- function handleEscape(e) {
313
- var _a;
314
- if (e && uiState.isOpen) {
315
- (_a = e.nativeEvent) === null || _a === void 0 ? void 0 : _a.stopImmediatePropagation();
316
- }
317
- if (uiState.isOpenAdvancedFilter) {
318
- handleAdvancedDialogClose();
319
- return;
320
- }
321
- dispatchUiState({ type: UiStateActionType.SetIsOpen, payload: false });
322
- if (triggerRef.current) {
323
- triggerRef.current.focus();
324
- }
630
+ if ((initialFilterStateInner === null || initialFilterStateInner === void 0 ? void 0 : initialFilterStateInner.sideWide) === state.frozenSideWideState && comparePreparedFilters(prepareFilters(initialFilterStateInner.groups), state.frozenState)) {
631
+ return;
632
+ }
633
+ const selectedValues = dataItems.filter(item => {
634
+ var _a;
635
+ return (_a = state.frozenState.simpleFilterState) === null || _a === void 0 ? void 0 : _a.find(id => id === item.id);
636
+ }).map(item => item.name);
637
+ setGroupPlaceHolder(selectedValues.length > 0 ? selectedValues.join(", ") : translate("Groups"));
638
+ onChangeInner(Object.assign({}, newState));
639
+ dispatchState({
640
+ type: StateActionType.TurnOfGlobalChanges,
641
+ payload: undefined
642
+ });
643
+ }, [state.globalChanges, dataItems, translate, state.frozenState, state.frozenSideWideState, onChangeInner, initialFilterStateInner === null || initialFilterStateInner === void 0 ? void 0 : initialFilterStateInner.sideWide, initialFilterStateInner]);
644
+ useEffect(() => {
645
+ var _a;
646
+ if (((_a = prevInitialState.current) === null || _a === void 0 ? void 0 : _a.sideWide) === (initialFilterStateInner === null || initialFilterStateInner === void 0 ? void 0 : initialFilterStateInner.sideWide) && comparePreparedFilters(prepareFilters(initialFilterStateInner ? initialFilterStateInner.groups : getDefaultFilterState()), prepareFilters(prevInitialState.current ? prevInitialState.current.groups : getDefaultFilterState()))) {
647
+ return;
648
+ }
649
+ const stateForDispatch = (initialFilterStateInner === null || initialFilterStateInner === void 0 ? void 0 : initialFilterStateInner.groups) ? {
650
+ value: prepareFilters(initialFilterStateInner.groups),
651
+ global: initialFilterStateInner.sideWide
652
+ } : {
653
+ value: prepareFilters(getDefaultFilterState()),
654
+ global: false
655
+ };
656
+ if (Object.keys(state.groupsMap).length > 0) {
657
+ prevInitialState.current = initialFilterStateInner ? Object.assign({}, initialFilterStateInner) : undefined;
658
+ dispatchState({
659
+ type: StateActionType.CreateInitialState,
660
+ payload: stateForDispatch
661
+ });
662
+ !(initialFilterStateInner === null || initialFilterStateInner === void 0 ? void 0 : initialFilterStateInner.groups) && dispatchUiState({
663
+ type: UiStateActionType.SetStep,
664
+ payload: FilterMenuStep.Initial
665
+ });
666
+ }
667
+ }, [initialFilterStateInner, state.groupsMap]);
668
+ const handleReadyForFocus = useCallback(isCurrentOpen => {
669
+ var _a, _b, _c;
670
+ if ((_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.value) {
671
+ return;
672
+ }
673
+ if (!isCurrentOpen) {
674
+ (_b = emptyInputRef.current) === null || _b === void 0 ? void 0 : _b.focus();
675
+ return;
676
+ }
677
+ (_c = inputRef.current) === null || _c === void 0 ? void 0 : _c.focus();
678
+ }, [inputRef]);
679
+ useEffect(() => {
680
+ var _a, _b, _c, _d;
681
+ if (!uiState.isOpen) {
682
+ return;
683
+ }
684
+ if (uiState.searchValue && uiState.step === FilterMenuStep.Initial || uiState.step === FilterMenuStep.Initial && uiState.searchValue === "" && prevSearchField.current !== uiState.searchValue) {
685
+ (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
686
+ prevSearchField.current = uiState.searchValue;
687
+ } else {
688
+ const firstFocusable = chip ? (_b = menuRef.current) === null || _b === void 0 ? void 0 : _b.querySelectorAll(FOCUSABLE_SELECTOR)[1] : (_c = menuRef.current) === null || _c === void 0 ? void 0 : _c.querySelector(FOCUSABLE_SELECTOR);
689
+ prevSearchField.current = "";
690
+ if (firstFocusable && !((_d = inputRef.current) === null || _d === void 0 ? void 0 : _d.value)) {
691
+ firstFocusable.focus();
692
+ }
693
+ }
694
+ }, [uiState.searchValue, uiState.isOpen, uiState.step, handleSetStep, chip]);
695
+ useEffect(() => {
696
+ var _a;
697
+ uiState.isOpen && ((_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus());
698
+ }, [inputRef, uiState.isOpen]);
699
+ useEffect(() => {
700
+ if (!uiState.isOpen && uiState.step === FilterMenuStep.Initial && isFilterHasSelection(state.frozenState)) {
701
+ dispatchUiState({
702
+ type: UiStateActionType.SetStep,
703
+ payload: FilterMenuStep.CurrentlySelected
704
+ });
705
+ }
706
+ }, [uiState.isOpen, state.frozenState, uiState.step]);
707
+ function handleEscape(e) {
708
+ var _a;
709
+ if (e && uiState.isOpen) {
710
+ (_a = e.nativeEvent) === null || _a === void 0 ? void 0 : _a.stopImmediatePropagation();
711
+ }
712
+ if (uiState.isOpenAdvancedFilter) {
713
+ handleAdvancedDialogClose();
714
+ return;
325
715
  }
326
- useEscape(triggerRef, handleEscape, uiState.isOpen);
327
- const selectedCount = getFrozenCount(state);
328
- const isStateHasData = Object.keys(state.groupsMap).length > 0;
329
- const isApplyDisabled = !isStateChanged(state);
330
- const memoizedContent = useMemo(() => _jsxs("div", { className: classNames(["zen-groups-filter-menu", isMobile ? "zen-groups-filter-menu--mobile" : ""]), ref: menuRef, children: [(chip || isMobile) ? _jsx("div", { className: "zen-groups-filter__input-container", children: _jsx(SearchInput, { className: "zen-groups-filter__chip-input", onChange: onSearchChipChange, value: uiState.searchValue, ref: inputRef, id: groupsFilterId, placeholder: translate("Filter by group") }) }) : null, isStateHasData && !uiState.isLoadWithError && _jsxs(GroupsFilterMenu, { onCancelClick: handleCancel, onApplyClick: handleApply, onResetClick: handleReset, isApplyDisabled: isApplyDisabled, hasFooter: !isMobile, children: [uiState.step === FilterMenuStep.Initial && _jsx(GroupsFilterInitialState, { siteWideState: state.sideWideState, onDialogButtonClick: handleAdvancedDialogOpen, count: getCurrentlySelectedCount(state), onSiteWideChange: onSideWideChange, onCurrentlySelectedClick: handleCurrentlySelectedClick, searchResult: uiState.searchValue ? getSearchResult() : "", children: getGroupsBox() }), uiState.step === FilterMenuStep.Adjustment && _jsx(GroupsFilterAdjustmentState, { onBackButtonClick: handleBackButtonClick, onHomeButtonClick: handleHomeButtonClick, onSelectAllClick: selectAllHandler, backButtonName: getBackButtonName(state, uiState.currentAdjustmentId), isAllSelected: isAllChildrenSelected(state, uiState.currentAdjustmentId), children: getGroupsBox() }), uiState.step === FilterMenuStep.CurrentlySelected && _jsx(GroupsFilterCurrentlySelectedState, { siteWideState: state.sideWideState, relation: state.relation, count: getCurrentlySelectedCount(state), onBackButtonClick: basicHandleBackButtonClick, onSiteWideChange: onSideWideChange, onRelationChange: onRelationChange, children: getGroupsBox() })] }), !uiState.isLoadWithError && !isStateHasData && !Object.keys(state.groupsMap).length && _jsx(SkeletonList, { className: "zen-groups-filter__waiting" })] }), [isMobile, chip, onSearchChipChange, uiState.searchValue, uiState.isLoadWithError, uiState.step, uiState.currentAdjustmentId, groupsFilterId, translate,
331
- isStateHasData, handleCancel, handleApply, handleReset, isApplyDisabled, state, handleAdvancedDialogOpen, handleCurrentlySelectedClick, getSearchResult,
332
- getGroupsBox, handleBackButtonClick, handleHomeButtonClick, selectAllHandler, basicHandleBackButtonClick]);
333
- const memoizedFooterButtons = useMemo(() => _jsxs(FooterButtons, { children: [_jsx(Button, { onClick: handleApply, type: ButtonType.Primary, disabled: isApplyDisabled, className: "zen-groups-filter-menu__apply-button zen-ellipsis", title: translate("Apply"), children: translate("Apply") }), _jsx(Button, { onClick: handleCancel, className: "zen-groups-filter-menu__cancel-button zen-ellipsis", title: translate("Cancel"), children: translate("Cancel") }), _jsx(Button, { type: ButtonType.Tertiary, className: "zen-groups-filter-menu__reset-button zen-ellipsis", onClick: handleReset, children: translate("Clear") })] }), [handleApply, handleCancel, handleReset, isApplyDisabled, translate]);
334
- const memoizedMobileView = useMemo(() => _jsxs(MobileSheet, { label: translate("Organization groups filter"), triggerRef: triggerRef, isOpen: uiState.isOpen, onHidePanel: onOptionsToggle, onCloseClick: onOptionsToggle, preventFirstFocus: true, onReadyForFocus: handleReadyForFocus, children: [_jsx(MobileSheet.Title, { children: translate("Filter by group") }), _jsx(MobileSheet.Content, { children: memoizedContent }), _jsx(MobileSheet.Footer, { children: memoizedFooterButtons })] }), [translate, uiState.isOpen, onOptionsToggle, handleReadyForFocus, memoizedContent, memoizedFooterButtons]);
335
- const memoizedDesktopView = useMemo(() => _jsx(ControlledPopup, { isOpen: uiState.isOpen, className: classNames(["zen-groups-filter__popup",
336
- uiState.isOpenAdvancedFilter ? "zen-groups-filter__popup--inactive" : "", className ? className : ""]), onOpenChange: onOptionsToggle, useTrapFocusWithTrigger: uiState.isOpenAdvancedFilter ? "off" : "withTrigger", shouldHoldScroll: true, triggerRef: triggerRef, ariaLabel: translate("Organization groups filter"), recalculateOnScroll: true, children: memoizedContent }), [className, memoizedContent, onOptionsToggle, translate, uiState.isOpen, uiState.isOpenAdvancedFilter]);
337
- const triggerClassName = classNames(["zen-groups-filter-trigger", isError ? "zen-groups-filter-trigger--error" : ""]);
338
- if (isReadOnly) {
339
- // TODO: how many items should we show?
340
- return _jsx(ReviewTextControl, { value: groupPlaceHolder });
716
+ dispatchUiState({
717
+ type: UiStateActionType.SetIsOpen,
718
+ payload: false
719
+ });
720
+ if (triggerRef.current) {
721
+ triggerRef.current.focus();
341
722
  }
342
- return _jsxs(_Fragment, { children: [chip ? _jsx(Chip, { status: selectedCount ? chipStatus || "active" : undefined, isOpen: uiState.isOpen, disabled: false, onClick: handleTriggerClick, onClose: selectedCount ? handleChipClose : undefined, triggerRef: triggerRef, icon: chipIcon, id: chipId, children: groupPlaceHolder !== translate("Groups") ? groupPlaceHolder : chipName })
343
- : _jsx(GroupsFilterTrigger, { value: uiState.searchValue, className: triggerClassName, onChange: onSearchChange, isOpenPopup: uiState.isOpen, count: selectedCount, withGlobeIcon: state.frozenSideWideState && selectedCount > 0, inputRef: isMobile ? emptyInputRef : inputRef, handleClick: handleTriggerClick, ref: triggerRef, fullSize: fullSize, placeholder: groupPlaceHolder }), isMobile ? memoizedMobileView : memoizedDesktopView, uiState.isOpenAdvancedFilter && getAdvancedDialog] });
723
+ }
724
+ useEscape(triggerRef, handleEscape, uiState.isOpen);
725
+ const selectedCount = getFrozenCount(state);
726
+ const isStateHasData = Object.keys(state.groupsMap).length > 0;
727
+ const isApplyDisabled = !isStateChanged(state);
728
+ const memoizedContent = useMemo(() => _jsxs("div", {
729
+ className: classNames(["zen-groups-filter-menu", isMobile ? "zen-groups-filter-menu--mobile" : ""]),
730
+ ref: menuRef,
731
+ children: [chip || isMobile ? _jsx("div", {
732
+ className: "zen-groups-filter__input-container",
733
+ children: _jsx(SearchInput, {
734
+ className: "zen-groups-filter__chip-input",
735
+ onChange: onSearchChipChange,
736
+ value: uiState.searchValue,
737
+ ref: inputRef,
738
+ id: groupsFilterId,
739
+ placeholder: translate("Filter by group")
740
+ })
741
+ }) : null, isStateHasData && !uiState.isLoadWithError && _jsxs(GroupsFilterMenu, {
742
+ onCancelClick: handleCancel,
743
+ onApplyClick: handleApply,
744
+ onResetClick: handleReset,
745
+ isApplyDisabled: isApplyDisabled,
746
+ hasFooter: !isMobile,
747
+ children: [uiState.step === FilterMenuStep.Initial && _jsx(GroupsFilterInitialState, {
748
+ siteWideState: state.sideWideState,
749
+ onDialogButtonClick: handleAdvancedDialogOpen,
750
+ count: getCurrentlySelectedCount(state),
751
+ onSiteWideChange: onSideWideChange,
752
+ onCurrentlySelectedClick: handleCurrentlySelectedClick,
753
+ searchResult: uiState.searchValue ? getSearchResult() : "",
754
+ children: getGroupsBox()
755
+ }), uiState.step === FilterMenuStep.Adjustment && _jsx(GroupsFilterAdjustmentState, {
756
+ onBackButtonClick: handleBackButtonClick,
757
+ onHomeButtonClick: handleHomeButtonClick,
758
+ onSelectAllClick: selectAllHandler,
759
+ backButtonName: getBackButtonName(state, uiState.currentAdjustmentId),
760
+ isAllSelected: isAllChildrenSelected(state, uiState.currentAdjustmentId),
761
+ children: getGroupsBox()
762
+ }), uiState.step === FilterMenuStep.CurrentlySelected && _jsx(GroupsFilterCurrentlySelectedState, {
763
+ siteWideState: state.sideWideState,
764
+ relation: state.relation,
765
+ count: getCurrentlySelectedCount(state),
766
+ onBackButtonClick: basicHandleBackButtonClick,
767
+ onSiteWideChange: onSideWideChange,
768
+ onRelationChange: onRelationChange,
769
+ children: getGroupsBox()
770
+ })]
771
+ }), !uiState.isLoadWithError && !isStateHasData && !Object.keys(state.groupsMap).length && _jsx(SkeletonList, {
772
+ className: "zen-groups-filter__waiting"
773
+ })]
774
+ }), [isMobile, chip, onSearchChipChange, uiState.searchValue, uiState.isLoadWithError, uiState.step, uiState.currentAdjustmentId, groupsFilterId, translate, isStateHasData, handleCancel, handleApply, handleReset, isApplyDisabled, state, handleAdvancedDialogOpen, handleCurrentlySelectedClick, getSearchResult, getGroupsBox, handleBackButtonClick, handleHomeButtonClick, selectAllHandler, basicHandleBackButtonClick]);
775
+ const memoizedFooterButtons = useMemo(() => _jsxs(FooterButtons, {
776
+ children: [_jsx(Button, {
777
+ onClick: handleApply,
778
+ type: ButtonType.Primary,
779
+ disabled: isApplyDisabled,
780
+ className: "zen-groups-filter-menu__apply-button zen-ellipsis",
781
+ title: translate("Apply"),
782
+ children: translate("Apply")
783
+ }), _jsx(Button, {
784
+ onClick: handleCancel,
785
+ className: "zen-groups-filter-menu__cancel-button zen-ellipsis",
786
+ title: translate("Cancel"),
787
+ children: translate("Cancel")
788
+ }), _jsx(Button, {
789
+ type: ButtonType.Tertiary,
790
+ className: "zen-groups-filter-menu__reset-button zen-ellipsis",
791
+ onClick: handleReset,
792
+ children: translate("Clear")
793
+ })]
794
+ }), [handleApply, handleCancel, handleReset, isApplyDisabled, translate]);
795
+ const memoizedMobileView = useMemo(() => _jsxs(MobileSheet, {
796
+ label: translate("Organization groups filter"),
797
+ triggerRef: triggerRef,
798
+ isOpen: uiState.isOpen,
799
+ onHidePanel: onOptionsToggle,
800
+ onCloseClick: onOptionsToggle,
801
+ preventFirstFocus: true,
802
+ onReadyForFocus: handleReadyForFocus,
803
+ children: [_jsx(MobileSheet.Title, {
804
+ children: translate("Filter by group")
805
+ }), _jsx(MobileSheet.Content, {
806
+ children: memoizedContent
807
+ }), _jsx(MobileSheet.Footer, {
808
+ children: memoizedFooterButtons
809
+ })]
810
+ }), [translate, uiState.isOpen, onOptionsToggle, handleReadyForFocus, memoizedContent, memoizedFooterButtons]);
811
+ const memoizedDesktopView = useMemo(() => _jsx(ControlledPopup, {
812
+ isOpen: uiState.isOpen,
813
+ className: classNames(["zen-groups-filter__popup", uiState.isOpenAdvancedFilter ? "zen-groups-filter__popup--inactive" : "", classNamePopup || ""]),
814
+ onOpenChange: onOptionsToggle,
815
+ useTrapFocusWithTrigger: uiState.isOpenAdvancedFilter ? "off" : "withTrigger",
816
+ shouldHoldScroll: true,
817
+ triggerRef: triggerRef,
818
+ ariaLabel: translate("Organization groups filter"),
819
+ recalculateOnScroll: true,
820
+ children: memoizedContent
821
+ }), [classNamePopup, memoizedContent, onOptionsToggle, translate, uiState.isOpen, uiState.isOpenAdvancedFilter]);
822
+ const triggerClassName = classNames(["zen-groups-filter-trigger", isError ? "zen-groups-filter-trigger--error" : "", className || ""]);
823
+ if (isReadOnly) {
824
+ // TODO: how many items should we show?
825
+ return _jsx(ReviewTextControl, {
826
+ value: groupPlaceHolder
827
+ });
828
+ }
829
+ return _jsxs(_Fragment, {
830
+ children: [chip ? _jsx(Chip, {
831
+ status: selectedCount ? chipStatus || "active" : undefined,
832
+ isOpen: uiState.isOpen,
833
+ disabled: false,
834
+ onClick: handleTriggerClick,
835
+ onClose: selectedCount ? handleChipClose : undefined,
836
+ triggerRef: triggerRef,
837
+ icon: chipIcon,
838
+ id: chipId,
839
+ children: groupPlaceHolder !== translate("Groups") ? groupPlaceHolder : chipName
840
+ }) : _jsx(GroupsFilterTrigger, {
841
+ value: uiState.searchValue,
842
+ className: triggerClassName,
843
+ onChange: onSearchChange,
844
+ isOpenPopup: uiState.isOpen,
845
+ count: selectedCount,
846
+ withGlobeIcon: state.frozenSideWideState && selectedCount > 0,
847
+ inputRef: isMobile ? emptyInputRef : inputRef,
848
+ handleClick: handleTriggerClick,
849
+ ref: triggerRef,
850
+ fullSize: fullSize,
851
+ placeholder: groupPlaceHolder
852
+ }), isMobile ? memoizedMobileView : memoizedDesktopView, uiState.isOpenAdvancedFilter && getAdvancedDialog]
853
+ });
344
854
  };
345
- export const TRANSLATIONS = [
346
- "Organization groups filter",
347
- ...GroupsFilterMenuTranslations,
348
- ...GroupsFilterTriggerTranslations,
349
- ...GroupsFilterAdjustmentStateTranslations,
350
- ...GroupsFilterInitialStateTranslations,
351
- ...GroupsFilterCurrentlySelectedStateTranslations
352
- ];
855
+ export const TRANSLATIONS = ["Organization groups filter", ...GroupsFilterMenuTranslations, ...GroupsFilterTriggerTranslations, ...GroupsFilterAdjustmentStateTranslations, ...GroupsFilterInitialStateTranslations, ...GroupsFilterCurrentlySelectedStateTranslations];