@geotab/zenith 3.0.1-beta.4 → 3.1.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (262) hide show
  1. package/README.md +17 -0
  2. package/dist/advancedGroupsFilter/advancedGroupsFilter.d.ts +1 -0
  3. package/dist/advancedGroupsFilter/advancedGroupsFilter.js +2 -2
  4. package/dist/advancedGroupsFilter/advancedGroupsFilterFormSection.js +3 -1
  5. package/dist/chip/chip.js +5 -5
  6. package/dist/commonStyles/zIndex.less +5 -0
  7. package/dist/dateInput/dateInput.d.ts +2 -1
  8. package/dist/dateInput/dateInput.js +11 -2
  9. package/dist/dateRange/dateRange.js +9 -8
  10. package/dist/dropdown/dropdown.d.ts +2 -0
  11. package/dist/dropdown/dropdown.js +6 -5
  12. package/dist/dropdown/dropdownHelper.d.ts +4 -4
  13. package/dist/dropdown/dropdownHelper.js +2 -1
  14. package/dist/dropdown/dropdownList.js +2 -2
  15. package/dist/dropdown/dropdownPopup.d.ts +1 -0
  16. package/dist/dropdown/dropdownPopup.js +2 -2
  17. package/dist/dropdown/dropdownSearchableTrigger.js +1 -1
  18. package/dist/dropdown/stateReducer/stateReducer.d.ts +6 -2
  19. package/dist/dropdown/stateReducer/stateReducer.js +28 -42
  20. package/dist/dropdown/stateReducer/stateReducerHelper.d.ts +2 -0
  21. package/dist/dropdown/stateReducer/stateReducerHelper.js +12 -1
  22. package/dist/dropdown/useDropdownState.d.ts +1 -1
  23. package/dist/dropdown/useDropdownState.js +5 -2
  24. package/dist/filters/components/filtersContainer.d.ts +1 -0
  25. package/dist/filters/components/filtersContainer.js +10 -11
  26. package/dist/filters/components/filtersDateInput.d.ts +10 -0
  27. package/dist/filters/components/filtersDateInput.js +27 -0
  28. package/dist/filters/components/filtersDropdown.d.ts +5 -4
  29. package/dist/filters/components/filtersDropdown.js +3 -3
  30. package/dist/filters/components/filtersEmptySelectedList.d.ts +2 -0
  31. package/dist/filters/components/filtersEmptySelectedList.js +11 -0
  32. package/dist/filters/components/filtersItem.d.ts +5 -4
  33. package/dist/filters/components/filtersItem.js +2 -1
  34. package/dist/filters/components/filtersSaveModal.d.ts +3 -1
  35. package/dist/filters/components/filtersSaveModal.js +2 -2
  36. package/dist/filters/components/filtersSavedChipComponent.js +68 -6
  37. package/dist/filters/components/filtersSearch.d.ts +4 -4
  38. package/dist/filters/components/filtersSearch.js +20 -9
  39. package/dist/filters/components/filtersSearchItemData.js +18 -1
  40. package/dist/filters/components/filtersSearchList.d.ts +5 -1
  41. package/dist/filters/components/filtersSearchList.js +155 -27
  42. package/dist/filters/components/filtersSelect.d.ts +1 -0
  43. package/dist/filters/components/filtersSelect.js +35 -7
  44. package/dist/filters/components/filtersSelectListItem.d.ts +21 -15
  45. package/dist/filters/components/filtersSelectListItem.js +13 -3
  46. package/dist/filters/components/filtersSidePanel.d.ts +15 -0
  47. package/dist/filters/components/filtersSidePanel.js +212 -0
  48. package/dist/filters/components/filtersSidePanelChip.d.ts +9 -0
  49. package/dist/filters/components/filtersSidePanelChip.js +13 -0
  50. package/dist/filters/components/filtersSidePanelDropdown.d.ts +6 -0
  51. package/dist/filters/components/filtersSidePanelDropdown.js +85 -0
  52. package/dist/filters/components/filtersSidePanelItem.d.ts +16 -0
  53. package/dist/filters/components/filtersSidePanelItem.js +67 -0
  54. package/dist/filters/components/filtersSidePanelRange.d.ts +6 -0
  55. package/dist/filters/components/filtersSidePanelRange.js +28 -0
  56. package/dist/filters/filters.d.ts +5 -0
  57. package/dist/filters/filters.js +101 -38
  58. package/dist/filters/filtersHelper.d.ts +4 -2
  59. package/dist/filters/filtersHelper.js +40 -1
  60. package/dist/filters/filtersHooks.d.ts +12 -2
  61. package/dist/filters/filtersHooks.js +21 -3
  62. package/dist/formStepper/formStepper.d.ts +1 -1
  63. package/dist/formStepper/formStepper.js +5 -2
  64. package/dist/groupsFilter/groupsFilter.js +72 -37
  65. package/dist/groupsFilter/groupsFilterMenu.d.ts +1 -0
  66. package/dist/groupsFilter/groupsFilterMenu.js +2 -2
  67. package/dist/groupsFilter/groupsFilterTrigger.js +1 -1
  68. package/dist/images/imageLooking.d.ts +4 -0
  69. package/dist/images/imageLooking.js +16 -0
  70. package/dist/index.css +407 -83
  71. package/dist/index.d.ts +7 -4
  72. package/dist/index.js +26 -15
  73. package/dist/list/list.d.ts +3 -1
  74. package/dist/list/list.js +2 -2
  75. package/dist/mobileSheet/mobileSheet.d.ts +2 -0
  76. package/dist/mobileSheet/mobileSheet.js +4 -4
  77. package/dist/modal/modal.d.ts +1 -0
  78. package/dist/modal/modal.js +2 -2
  79. package/dist/radioGroup/radioGroup.d.ts +1 -0
  80. package/dist/radioGroup/radioGroup.js +3 -2
  81. package/dist/range/range.js +29 -10
  82. package/dist/searchInputRaw/searchInputRaw.js +1 -1
  83. package/dist/sidePanel/sidePanel.d.ts +1 -0
  84. package/dist/sidePanel/sidePanel.js +3 -3
  85. package/dist/tabs/tabItem/tabItem.d.ts +1 -0
  86. package/dist/tabs/tabItem/tabItem.js +2 -2
  87. package/dist/tabs/tabs.d.ts +1 -0
  88. package/dist/tabs/tabs.js +1 -1
  89. package/dist/utils/keyboardHelpers.d.ts +2 -0
  90. package/dist/utils/keyboardHelpers.js +49 -0
  91. package/dist/utils/localization/translations/cs-json.d.ts +1 -0
  92. package/dist/utils/localization/translations/cs-json.js +2 -1
  93. package/dist/utils/localization/translations/de-json.d.ts +1 -0
  94. package/dist/utils/localization/translations/de-json.js +2 -1
  95. package/dist/utils/localization/translations/en-json.d.ts +7 -0
  96. package/dist/utils/localization/translations/en-json.js +8 -1
  97. package/dist/utils/localization/translations/es-json.d.ts +1 -0
  98. package/dist/utils/localization/translations/es-json.js +2 -1
  99. package/dist/utils/localization/translations/fr-FR-json.d.ts +1 -0
  100. package/dist/utils/localization/translations/fr-FR-json.js +2 -1
  101. package/dist/utils/localization/translations/fr-json.d.ts +1 -0
  102. package/dist/utils/localization/translations/fr-json.js +2 -1
  103. package/dist/utils/localization/translations/id-json.d.ts +1 -0
  104. package/dist/utils/localization/translations/id-json.js +2 -1
  105. package/dist/utils/localization/translations/it-json.d.ts +1 -0
  106. package/dist/utils/localization/translations/it-json.js +2 -1
  107. package/dist/utils/localization/translations/ja-json.d.ts +1 -0
  108. package/dist/utils/localization/translations/ja-json.js +2 -1
  109. package/dist/utils/localization/translations/ko-KR-json.d.ts +1 -0
  110. package/dist/utils/localization/translations/ko-KR-json.js +2 -1
  111. package/dist/utils/localization/translations/ms-json.d.ts +1 -0
  112. package/dist/utils/localization/translations/ms-json.js +2 -1
  113. package/dist/utils/localization/translations/nl-json.d.ts +1 -0
  114. package/dist/utils/localization/translations/nl-json.js +2 -1
  115. package/dist/utils/localization/translations/pl-json.d.ts +1 -0
  116. package/dist/utils/localization/translations/pl-json.js +2 -1
  117. package/dist/utils/localization/translations/pt-BR-json.d.ts +1 -0
  118. package/dist/utils/localization/translations/pt-BR-json.js +2 -1
  119. package/dist/utils/localization/translations/sv-json.d.ts +1 -0
  120. package/dist/utils/localization/translations/sv-json.js +2 -1
  121. package/dist/utils/localization/translations/th-json.d.ts +1 -0
  122. package/dist/utils/localization/translations/th-json.js +2 -1
  123. package/dist/utils/localization/translations/tr-json.d.ts +1 -0
  124. package/dist/utils/localization/translations/tr-json.js +2 -1
  125. package/dist/utils/localization/translations/zh-Hans-json.d.ts +1 -0
  126. package/dist/utils/localization/translations/zh-Hans-json.js +2 -1
  127. package/dist/utils/localization/translations/zh-TW-json.d.ts +1 -0
  128. package/dist/utils/localization/translations/zh-TW-json.js +2 -1
  129. package/esm/advancedGroupsFilter/advancedGroupsFilter.d.ts +1 -0
  130. package/esm/advancedGroupsFilter/advancedGroupsFilter.js +2 -2
  131. package/esm/advancedGroupsFilter/advancedGroupsFilterFormSection.js +3 -1
  132. package/esm/chip/chip.js +5 -5
  133. package/esm/dateInput/dateInput.d.ts +2 -1
  134. package/esm/dateInput/dateInput.js +11 -2
  135. package/esm/dateRange/dateRange.js +9 -8
  136. package/esm/dropdown/dropdown.d.ts +2 -0
  137. package/esm/dropdown/dropdown.js +5 -4
  138. package/esm/dropdown/dropdownHelper.d.ts +4 -4
  139. package/esm/dropdown/dropdownHelper.js +2 -1
  140. package/esm/dropdown/dropdownList.js +2 -2
  141. package/esm/dropdown/dropdownPopup.d.ts +1 -0
  142. package/esm/dropdown/dropdownPopup.js +2 -2
  143. package/esm/dropdown/dropdownSearchableTrigger.js +1 -1
  144. package/esm/dropdown/stateReducer/stateReducer.d.ts +6 -2
  145. package/esm/dropdown/stateReducer/stateReducer.js +29 -43
  146. package/esm/dropdown/stateReducer/stateReducerHelper.d.ts +2 -0
  147. package/esm/dropdown/stateReducer/stateReducerHelper.js +10 -0
  148. package/esm/dropdown/useDropdownState.d.ts +1 -1
  149. package/esm/dropdown/useDropdownState.js +5 -2
  150. package/esm/filters/components/filtersContainer.d.ts +1 -0
  151. package/esm/filters/components/filtersContainer.js +12 -13
  152. package/esm/filters/components/filtersDateInput.d.ts +10 -0
  153. package/esm/filters/components/filtersDateInput.js +23 -0
  154. package/esm/filters/components/filtersDropdown.d.ts +5 -4
  155. package/esm/filters/components/filtersDropdown.js +3 -3
  156. package/esm/filters/components/filtersEmptySelectedList.d.ts +2 -0
  157. package/esm/filters/components/filtersEmptySelectedList.js +7 -0
  158. package/esm/filters/components/filtersItem.d.ts +5 -4
  159. package/esm/filters/components/filtersItem.js +2 -1
  160. package/esm/filters/components/filtersSaveModal.d.ts +3 -1
  161. package/esm/filters/components/filtersSaveModal.js +2 -2
  162. package/esm/filters/components/filtersSavedChipComponent.js +68 -6
  163. package/esm/filters/components/filtersSearch.d.ts +4 -4
  164. package/esm/filters/components/filtersSearch.js +20 -9
  165. package/esm/filters/components/filtersSearchItemData.js +18 -1
  166. package/esm/filters/components/filtersSearchList.d.ts +5 -1
  167. package/esm/filters/components/filtersSearchList.js +156 -28
  168. package/esm/filters/components/filtersSelect.d.ts +1 -0
  169. package/esm/filters/components/filtersSelect.js +36 -8
  170. package/esm/filters/components/filtersSelectListItem.d.ts +21 -15
  171. package/esm/filters/components/filtersSelectListItem.js +13 -3
  172. package/esm/filters/components/filtersSidePanel.d.ts +15 -0
  173. package/esm/filters/components/filtersSidePanel.js +208 -0
  174. package/esm/filters/components/filtersSidePanelChip.d.ts +9 -0
  175. package/esm/filters/components/filtersSidePanelChip.js +9 -0
  176. package/esm/filters/components/filtersSidePanelDropdown.d.ts +6 -0
  177. package/esm/filters/components/filtersSidePanelDropdown.js +81 -0
  178. package/esm/filters/components/filtersSidePanelItem.d.ts +16 -0
  179. package/esm/filters/components/filtersSidePanelItem.js +63 -0
  180. package/esm/filters/components/filtersSidePanelRange.d.ts +6 -0
  181. package/esm/filters/components/filtersSidePanelRange.js +24 -0
  182. package/esm/filters/filters.d.ts +5 -0
  183. package/esm/filters/filters.js +101 -38
  184. package/esm/filters/filtersHelper.d.ts +4 -2
  185. package/esm/filters/filtersHelper.js +37 -0
  186. package/esm/filters/filtersHooks.d.ts +12 -2
  187. package/esm/filters/filtersHooks.js +19 -2
  188. package/esm/formStepper/formStepper.d.ts +1 -1
  189. package/esm/formStepper/formStepper.js +5 -2
  190. package/esm/groupsFilter/groupsFilter.js +72 -37
  191. package/esm/groupsFilter/groupsFilterMenu.d.ts +1 -0
  192. package/esm/groupsFilter/groupsFilterMenu.js +2 -2
  193. package/esm/groupsFilter/groupsFilterTrigger.js +1 -1
  194. package/esm/images/imageLooking.d.ts +4 -0
  195. package/esm/images/imageLooking.js +12 -0
  196. package/esm/index.d.ts +7 -4
  197. package/esm/index.js +6 -3
  198. package/esm/list/list.d.ts +3 -1
  199. package/esm/list/list.js +2 -2
  200. package/esm/mobileSheet/mobileSheet.d.ts +2 -0
  201. package/esm/mobileSheet/mobileSheet.js +4 -4
  202. package/esm/modal/modal.d.ts +1 -0
  203. package/esm/modal/modal.js +2 -2
  204. package/esm/radioGroup/radioGroup.d.ts +1 -0
  205. package/esm/radioGroup/radioGroup.js +3 -2
  206. package/esm/range/range.js +29 -10
  207. package/esm/searchInputRaw/searchInputRaw.js +1 -1
  208. package/esm/sidePanel/sidePanel.d.ts +1 -0
  209. package/esm/sidePanel/sidePanel.js +3 -3
  210. package/esm/tabs/tabItem/tabItem.d.ts +1 -0
  211. package/esm/tabs/tabItem/tabItem.js +2 -2
  212. package/esm/tabs/tabs.d.ts +1 -0
  213. package/esm/tabs/tabs.js +1 -1
  214. package/esm/utils/keyboardHelpers.d.ts +2 -0
  215. package/esm/utils/keyboardHelpers.js +44 -0
  216. package/esm/utils/localization/translations/cs-json.d.ts +1 -0
  217. package/esm/utils/localization/translations/cs-json.js +2 -1
  218. package/esm/utils/localization/translations/de-json.d.ts +1 -0
  219. package/esm/utils/localization/translations/de-json.js +2 -1
  220. package/esm/utils/localization/translations/en-json.d.ts +7 -0
  221. package/esm/utils/localization/translations/en-json.js +8 -1
  222. package/esm/utils/localization/translations/es-json.d.ts +1 -0
  223. package/esm/utils/localization/translations/es-json.js +2 -1
  224. package/esm/utils/localization/translations/fr-FR-json.d.ts +1 -0
  225. package/esm/utils/localization/translations/fr-FR-json.js +2 -1
  226. package/esm/utils/localization/translations/fr-json.d.ts +1 -0
  227. package/esm/utils/localization/translations/fr-json.js +2 -1
  228. package/esm/utils/localization/translations/id-json.d.ts +1 -0
  229. package/esm/utils/localization/translations/id-json.js +2 -1
  230. package/esm/utils/localization/translations/it-json.d.ts +1 -0
  231. package/esm/utils/localization/translations/it-json.js +2 -1
  232. package/esm/utils/localization/translations/ja-json.d.ts +1 -0
  233. package/esm/utils/localization/translations/ja-json.js +2 -1
  234. package/esm/utils/localization/translations/ko-KR-json.d.ts +1 -0
  235. package/esm/utils/localization/translations/ko-KR-json.js +2 -1
  236. package/esm/utils/localization/translations/ms-json.d.ts +1 -0
  237. package/esm/utils/localization/translations/ms-json.js +2 -1
  238. package/esm/utils/localization/translations/nl-json.d.ts +1 -0
  239. package/esm/utils/localization/translations/nl-json.js +2 -1
  240. package/esm/utils/localization/translations/pl-json.d.ts +1 -0
  241. package/esm/utils/localization/translations/pl-json.js +2 -1
  242. package/esm/utils/localization/translations/pt-BR-json.d.ts +1 -0
  243. package/esm/utils/localization/translations/pt-BR-json.js +2 -1
  244. package/esm/utils/localization/translations/sv-json.d.ts +1 -0
  245. package/esm/utils/localization/translations/sv-json.js +2 -1
  246. package/esm/utils/localization/translations/th-json.d.ts +1 -0
  247. package/esm/utils/localization/translations/th-json.js +2 -1
  248. package/esm/utils/localization/translations/tr-json.d.ts +1 -0
  249. package/esm/utils/localization/translations/tr-json.js +2 -1
  250. package/esm/utils/localization/translations/zh-Hans-json.d.ts +1 -0
  251. package/esm/utils/localization/translations/zh-Hans-json.js +2 -1
  252. package/esm/utils/localization/translations/zh-TW-json.d.ts +1 -0
  253. package/esm/utils/localization/translations/zh-TW-json.js +2 -1
  254. package/package.json +6 -6
  255. package/dist/filters/components/filtersModal.d.ts +0 -17
  256. package/dist/filters/components/filtersModal.js +0 -107
  257. package/dist/filters/components/filtersModalItem.d.ts +0 -9
  258. package/dist/filters/components/filtersModalItem.js +0 -74
  259. package/esm/filters/components/filtersModal.d.ts +0 -17
  260. package/esm/filters/components/filtersModal.js +0 -103
  261. package/esm/filters/components/filtersModalItem.d.ts +0 -9
  262. package/esm/filters/components/filtersModalItem.js +0 -70
package/README.md CHANGED
@@ -40,6 +40,23 @@ Zenith library provides components defined in Zenith Design System. It includes
40
40
 
41
41
  ## Change log
42
42
 
43
+ ### 3.1.0
44
+
45
+ **🎉 Introducing the Beta `Filters` Component**
46
+
47
+ We're excited to announce the beta launch of our new `Filters` component, designed to be the future successor to `FiltersBar`. This modern component delivers the same powerful functionality you rely on, while offering significant improvements:
48
+
49
+ - **Clean, intuitive appearance** that reduces cognitive load for your users
50
+ - **Developer-friendly API** that's simple to integrate and maintain
51
+ - **React Query compatible** for seamless data fetching workflows
52
+
53
+ Change log:
54
+
55
+ * New `Filters` component is available in beta
56
+ * Fix accessibility issue in `Dropdown` component
57
+ * Update `Dropdown` to auto set 'All selected' state when all items are selected
58
+ * Add ability to prevent step change in `FormStepper` component
59
+
43
60
  ### 3.0.1
44
61
 
45
62
  * Fix accessibility issues in `SelectList`
@@ -12,6 +12,7 @@ export interface IAdvancedGroupsFilter extends IZenComponentProps {
12
12
  errorHandler: (e: Error) => void;
13
13
  dataItems?: IDropdownItem[];
14
14
  tooltipText?: string;
15
+ isMobile?: boolean;
15
16
  }
16
17
  export declare const AdvancedGroupsFilter: React.FC<IAdvancedGroupsFilter>;
17
18
  export declare const TRANSLATIONS: string[];
@@ -8,7 +8,7 @@ const advancedGroupsFilterForm_1 = require("./advancedGroupsFilterForm");
8
8
  const classNames_1 = require("../commonHelpers/classNames/classNames");
9
9
  const useLanguage_1 = require("../utils/localization/useLanguage");
10
10
  const modal_1 = require("../modal/modal");
11
- const AdvancedGroupsFilter = ({ isOpen, onClose, onApply, state, className, getData, errorHandler, dataItems, tooltipText }) => {
11
+ const AdvancedGroupsFilter = ({ isOpen, onClose, onApply, state, className, getData, errorHandler, dataItems, tooltipText, isMobile }) => {
12
12
  //const dropdownFocusedListClasses = ["zen-dropdown-searchable-trigger__input", "zen-dropdown-searchable-trigger__popup-trigger"];
13
13
  const [currentState, setCurrentState] = (0, react_1.useState)((0, advancedGroupsFilterFormHelper_1.prepareCurrentFilterState)(state));
14
14
  const [dataItemsValue, setDataItemsValue] = (0, react_1.useState)(dataItems || []);
@@ -31,7 +31,7 @@ const AdvancedGroupsFilter = ({ isOpen, onClose, onApply, state, className, getD
31
31
  const handleApply = () => {
32
32
  onApply((0, advancedGroupsFilterFormHelper_1.prepareToFilterState)(currentState));
33
33
  };
34
- return (0, jsx_runtime_1.jsxs)(modal_1.Modal, { title: translate("Advanced groups filter"), className: (0, classNames_1.classNames)(["zen-advanced-groups-filter", className || ""]), isOpen: isOpen, onClose: handleClose, children: [(0, jsx_runtime_1.jsx)(advancedGroupsFilterForm_1.AdvancedGroupsFilterForm, { dataItems: dataItemsValue, getData: getData, errorHandler: errorHandler, state: currentState, onStateChange: setCurrentState, tooltipText: tooltipText }), (0, jsx_runtime_1.jsx)(modal_1.Modal.SecondaryButton, { onClick: onClose, children: translate("Cancel") }), (0, jsx_runtime_1.jsx)(modal_1.Modal.PrimaryButton, { onClick: handleApply, children: translate("Apply") })] });
34
+ return (0, jsx_runtime_1.jsxs)(modal_1.Modal, { title: translate("Advanced groups filter"), className: (0, classNames_1.classNames)(["zen-advanced-groups-filter", className || ""]), isOpen: isOpen, modalContainerClassName: isMobile ? "zen-advanced-groups-filter-prioritized-modal" : undefined, onClose: handleClose, children: [(0, jsx_runtime_1.jsx)(advancedGroupsFilterForm_1.AdvancedGroupsFilterForm, { dataItems: dataItemsValue, getData: getData, errorHandler: errorHandler, state: currentState, onStateChange: setCurrentState, tooltipText: tooltipText }), (0, jsx_runtime_1.jsx)(modal_1.Modal.SecondaryButton, { onClick: onClose, children: translate("Cancel") }), (0, jsx_runtime_1.jsx)(modal_1.Modal.PrimaryButton, { onClick: handleApply, children: translate("Apply") })] });
35
35
  };
36
36
  exports.AdvancedGroupsFilter = AdvancedGroupsFilter;
37
37
  exports.TRANSLATIONS = [
@@ -35,9 +35,11 @@ const advancedGroupsFilterHelper_1 = require("./advancedGroupsFilterHelper");
35
35
  const groupsHelper_1 = require("../groupsFilter/groupsHelper");
36
36
  const useLanguage_1 = require("../utils/localization/useLanguage");
37
37
  const focusableSelector_1 = require("../utils/focusableSelector");
38
+ const useMobile_1 = require("../commonHelpers/hooks/useMobile");
38
39
  const AdvancedGroupsFilterFormSection = ({ state, interSectionRelation, itemId, onInterSectionChange, onRelationChange, onRemoveCondition, onStateChange, getData, errorHandler, dataItems, isHasRemoveConditionButton, isHasTooltip, tooltipText }) => {
39
40
  const { translate } = (0, useLanguage_1.useLanguage)();
40
41
  const inputItem = (0, react_1.useId)();
42
+ const isMobile = (0, useMobile_1.useMobile)();
41
43
  const [currentSelection, setCurrentSelection] = react_1.default.useState((0, advancedGroupsFilterHelper_1.getCurrentSelectionFromIds)(state.items, dataItems));
42
44
  const isPrevEmptyComboItems = (0, react_1.useRef)(dataItems.length === 0);
43
45
  const comboboxRef = (0, react_1.useRef)(null);
@@ -84,7 +86,7 @@ const AdvancedGroupsFilterFormSection = ({ state, interSectionRelation, itemId,
84
86
  ] }) }) }) : null, (0, jsx_runtime_1.jsxs)("div", { className: "zen-advanced-groups-filter-form__main-section", children: [(0, jsx_runtime_1.jsxs)("div", { className: "zen-advanced-groups-filter-form__section-column zen-advanced-groups-filter-form__section-column--left", children: [(0, jsx_runtime_1.jsxs)("div", { className: "zen-advanced-groups-filter-form__section-label zen-advanced-groups-filter-form__operator-section", children: [(0, jsx_runtime_1.jsx)("div", { className: "zen-advanced-groups-filter-form__operator-label", children: translate("Operator") }), isHasTooltip && (0, jsx_runtime_1.jsx)(advancedGroupsFilterSectionTooltip_1.AdvancedGroupsFilterSectionTooltip, { ariaLabel: "Information", text: tooltipText })] }), (0, jsx_runtime_1.jsx)(groupButton_1.GroupButton, { onChange: handleRelationChange, groupData: [
85
87
  { name: translate("And"), value: groupsFilterInterfaces_1.RelationOperator.AND, selected: state.relation === groupsFilterInterfaces_1.RelationOperator.AND },
86
88
  { name: translate("Or"), value: groupsFilterInterfaces_1.RelationOperator.OR, selected: state.relation === groupsFilterInterfaces_1.RelationOperator.OR }
87
- ] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "zen-advanced-groups-filter-form__section-column zen-advanced-groups-filter-form__section-column--right", children: [(0, jsx_runtime_1.jsx)("label", { className: "zen-advanced-groups-filter-form__section-label", children: translate("Groups") }), isHasRemoveConditionButton && (0, jsx_runtime_1.jsx)("button", { type: "button", className: "zen-advanced-groups-filter-form__remove-button", "data-item": itemId, onClick: onRemoveCondition, children: translate("Remove condition") }), (0, jsx_runtime_1.jsxs)("div", { className: "zen-advanced-groups-filter-form__combo-section", children: [(0, jsx_runtime_1.jsx)("div", { className: "zen-advanced-groups-filter-form__combo-box", ref: comboboxRef, children: (0, jsx_runtime_1.jsx)(dropdown_1.Dropdown, { classNamePopup: "zen-advanced-groups-filter-form__popup", getData: getData, errorHandler: errorHandler, dataItems: dataItems, onChange: handleSelection, value: state.items.map((el) => el.id), placeholder: translate("Select groups…"), inputId: `${inputItem}-dropdown-${itemId}`, showCounterPill: true }) }), (0, jsx_runtime_1.jsx)("div", { className: "zen-advanced-groups-filter-form__selected-box", ref: pillBoxRef, children: (0, jsx_runtime_1.jsx)(comboboxSelected_1.ComboboxSelected, { selection: (0, advancedGroupsFilterHelper_1.getCurrentSelectionFromIds)(state.items, dataItems).map((el) => ({ id: el.id, name: el.name })), onRemove: handleRemove, pillEmptyText: groupsHelper_1.ENTIRE_ORGANIZATION_GROUP_ID }) })] })] })] })] });
89
+ ] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "zen-advanced-groups-filter-form__section-column zen-advanced-groups-filter-form__section-column--right", children: [(0, jsx_runtime_1.jsx)("label", { className: "zen-advanced-groups-filter-form__section-label", children: translate("Groups") }), isHasRemoveConditionButton && (0, jsx_runtime_1.jsx)("button", { type: "button", className: "zen-advanced-groups-filter-form__remove-button", "data-item": itemId, onClick: onRemoveCondition, children: translate("Remove condition") }), (0, jsx_runtime_1.jsxs)("div", { className: "zen-advanced-groups-filter-form__combo-section", children: [(0, jsx_runtime_1.jsx)("div", { className: "zen-advanced-groups-filter-form__combo-box", ref: comboboxRef, children: (0, jsx_runtime_1.jsx)(dropdown_1.Dropdown, { classNamePopup: "zen-advanced-groups-filter-form__popup", getData: getData, mobileSheetStackingClassName: isMobile ? "zen-advanced-groups-filter-form__mobile-sheet-stacking" : undefined, errorHandler: errorHandler, dataItems: dataItems, onChange: handleSelection, value: state.items.map((el) => el.id), placeholder: translate("Select groups…"), inputId: `${inputItem}-dropdown-${itemId}`, showCounterPill: true }) }), (0, jsx_runtime_1.jsx)("div", { className: "zen-advanced-groups-filter-form__selected-box", ref: pillBoxRef, children: (0, jsx_runtime_1.jsx)(comboboxSelected_1.ComboboxSelected, { selection: (0, advancedGroupsFilterHelper_1.getCurrentSelectionFromIds)(state.items, dataItems).map((el) => ({ id: el.id, name: el.name })), onRemove: handleRemove, pillEmptyText: groupsHelper_1.ENTIRE_ORGANIZATION_GROUP_ID }) })] })] })] })] });
88
90
  };
89
91
  exports.AdvancedGroupsFilterFormSection = AdvancedGroupsFilterFormSection;
90
92
  exports.TRANSLATIONS = [
package/dist/chip/chip.js CHANGED
@@ -93,13 +93,13 @@ const Chip = (props) => {
93
93
  isTriggerMode ? (0, getChipStateClassName_1.getChipTriggerStateClassName)(!!disabled, isOpen, status) : (0, getChipStateClassName_1.getChipStateClassName)(!!disabled, !!readonly, active, status),
94
94
  className !== null && className !== void 0 ? className : ""
95
95
  ], [driveChipClass, isTriggerMode, disabled, isOpen, status, readonly, active, className]);
96
- const chipComponent = (0, react_1.useMemo)(() => (0, jsx_runtime_1.jsxs)("label", { className: (0, classNames_1.classNames)(memoizedClasses), ref: ref, title: chipTitle, htmlFor: id || chipId, children: [(0, jsx_runtime_1.jsx)("input", { checked: active, onBlur: onBlurHandler, onKeyUp: onKeyUpHandler, onKeyDown: onKeyDownHandler, onChange: onChangeHandler, id: id || chipId, className: "zen-chip__input", type: "checkbox", disabled: disabled, readOnly: readonly }), children ? (0, jsx_runtime_1.jsx)("div", { className: (0, classNames_1.classNames)(["zen-chip-text-content", driveTextClass !== null && driveTextClass !== void 0 ? driveTextClass : ""]), children: children }) : null, svgIcon, isClosable && (0, jsx_runtime_1.jsx)("button", { type: "button", className: "zen-chip__close-button", onClick: handleClose, title: closeAriaText || translate("Close"), "aria-label": closeAriaText || translate("Close"), children: (0, jsx_runtime_1.jsx)(iconClose_1.IconClose, { size: isDrive ? "huger" : "large", className: "zen-pill-non-actionable__close-icon" }) })] }), [memoizedClasses, ref, chipTitle, id, chipId, active, onBlurHandler, onKeyUpHandler, onKeyDownHandler, onChangeHandler, disabled, readonly, children, driveTextClass, svgIcon, isClosable,
97
- handleClose, closeAriaText, translate, isDrive]);
96
+ const chipComponent = (0, react_1.useMemo)(() => (0, jsx_runtime_1.jsxs)("label", { className: (0, classNames_1.classNames)(memoizedClasses), ref: ref, title: title || chipTitle, htmlFor: id || chipId, children: [(0, jsx_runtime_1.jsx)("input", { checked: active, onBlur: onBlurHandler, onKeyUp: onKeyUpHandler, onKeyDown: onKeyDownHandler, onChange: onChangeHandler, id: id || chipId, className: "zen-chip__input", type: "checkbox", disabled: disabled, readOnly: readonly }), children ? (0, jsx_runtime_1.jsx)("div", { className: (0, classNames_1.classNames)(["zen-chip-text-content", driveTextClass !== null && driveTextClass !== void 0 ? driveTextClass : ""]), children: children }) : null, svgIcon, isClosable && (0, jsx_runtime_1.jsx)("button", { type: "button", className: "zen-chip__close-button", onClick: handleClose, title: closeAriaText || translate("Close"), "aria-label": closeAriaText || translate("Close"), children: (0, jsx_runtime_1.jsx)(iconClose_1.IconClose, { size: isDrive ? "huger" : "large", className: "zen-pill-non-actionable__close-icon" }) })] }), [memoizedClasses, ref, title, chipTitle, id, chipId, active, onBlurHandler, onKeyUpHandler, onKeyDownHandler, onChangeHandler, disabled, readonly,
97
+ children, driveTextClass, svgIcon, isClosable, handleClose, closeAriaText, translate, isDrive]);
98
98
  const chipTriggerComponent = (0, react_1.useMemo)(() => {
99
- const extraAttributes = chipTitle ? { "aria-label": chipTitle } : {};
99
+ const extraAttributes = title ? { "aria-label": title } : chipTitle ? { "aria-label": chipTitle } : {};
100
100
  return (0, jsx_runtime_1.jsx)("div", Object.assign({ role: "button", tabIndex: 0 }, extraAttributes, { onClick: handleClick, onKeyDown: chipTriggerKeyDownHandler, className: (0, classNames_1.classNames)(memoizedClasses), "data-id": id || chipId, ref: triggerRef, children: (0, jsx_runtime_1.jsxs)("div", { className: "zen-chip__content-wrapper", children: [hasContent ? (0, jsx_runtime_1.jsx)("div", { className: (0, classNames_1.classNames)(["zen-chip-text-content", driveTextClass !== null && driveTextClass !== void 0 ? driveTextClass : ""]), children: children }) : null, svgIcon, isClosable && (0, jsx_runtime_1.jsx)("button", { type: "button", className: "zen-chip__close-button", onClick: handleClose, title: closeAriaText || translate("Close"), "aria-label": closeAriaText || translate("Close"), children: (0, jsx_runtime_1.jsx)(iconClose_1.IconClose, { size: isDrive ? "huger" : "large", className: "zen-pill-non-actionable__close-icon" }) }), hasQuantity && quantity ? (0, jsx_runtime_1.jsx)("div", { className: "zen-chip__quantity", children: quantity }) : null] }) }));
101
- }, [handleClick, chipTriggerKeyDownHandler, memoizedClasses, id, chipId, triggerRef, hasContent, chipTitle, driveTextClass, children, svgIcon, isClosable, handleClose,
102
- closeAriaText, translate, isDrive, hasQuantity, quantity]);
101
+ }, [title, chipTitle, handleClick, chipTriggerKeyDownHandler, memoizedClasses, id, chipId, triggerRef, hasContent, driveTextClass,
102
+ children, svgIcon, isClosable, handleClose, closeAriaText, translate, isDrive, hasQuantity, quantity]);
103
103
  return isTriggerMode ? chipTriggerComponent : chipComponent;
104
104
  };
105
105
  exports.Chip = Chip;
@@ -6,6 +6,11 @@
6
6
  @z-index-11020: 11020;
7
7
  // Alert (inside FeedbackContainer)
8
8
  // Toast (inside FeedbackContainer)
9
+ @z-index-11012: 11012;
10
+ // MobileSheet dropdown (inside AdvancedGroupsFilter)
11
+
12
+ @z-index-11011: 11011;
13
+ // Modal with MobileSheet (inside FiltersSavedChipComponent)
9
14
 
10
15
  @z-index-11010: 11010;
11
16
  // MobileSheet
@@ -1,7 +1,8 @@
1
1
  /// <reference types="react" />
2
2
  import "./dateInput.less";
3
3
  import { IZenComponentProps } from "../commonHelpers/zenComponent";
4
- export interface IDateInput extends IZenComponentProps {
4
+ import { IChipsParent } from "../chip/chip";
5
+ export interface IDateInput extends IZenComponentProps, IChipsParent {
5
6
  defaultValue?: string;
6
7
  value: string | undefined;
7
8
  onChange: (value: string | undefined) => void;
@@ -21,9 +21,12 @@ const formFieldError_1 = require("../formFieldError/formFieldError");
21
21
  const footerButtons_1 = require("../footerButtons/footerButtons");
22
22
  const mobileSheet_1 = require("../mobileSheet/mobileSheet");
23
23
  const useDriveClassName_1 = require("../utils/theme/useDriveClassName");
24
- const DateInput = ({ className, classNamePopup, defaultValue, value, onChange, id, disabled, dropDownTitle, timeSelect, disableFutureDates, disablePastDates, disableDatesBefore, disableDatesAfter, error, requireSelection = false, buttonLabel }) => {
24
+ const chip_1 = require("../chip/chip");
25
+ const chipStatusProvider_1 = require("../chip/chipStatusProvider");
26
+ const DateInput = ({ className, classNamePopup, defaultValue, value, onChange, id, disabled, dropDownTitle, timeSelect, disableFutureDates, disablePastDates, disableDatesBefore, disableDatesAfter, error, requireSelection = false, chip, chipIcon, chipId, chipName, buttonLabel }) => {
25
27
  const { translate } = (0, useLanguage_1.useLanguage)();
26
28
  const isMobile = (0, useMobile_1.useMobile)();
29
+ const chipStatus = (0, chipStatusProvider_1.useChipStatus)();
27
30
  const drivePopupClassName = (0, useDriveClassName_1.useDriveClassName)("zen-date-input-popup");
28
31
  const driveWrapperClassName = (0, useDriveClassName_1.useDriveClassName)("zen-date-input-popup-wrapper");
29
32
  const { dateFormat, timeFormat, weekStartsOnSunday, toLocalDateTime } = (0, react_1.useContext)(userFormatContext_1.userFormatContext);
@@ -69,6 +72,11 @@ const DateInput = ({ className, classNamePopup, defaultValue, value, onChange, i
69
72
  const handleClearClick = (0, react_1.useCallback)(() => {
70
73
  setCustomDate(defaultValue);
71
74
  }, [defaultValue]);
75
+ const handleClearAndApply = (0, react_1.useCallback)(() => {
76
+ setCustomDate(defaultValue);
77
+ setIsOpen(false);
78
+ onChange(defaultValue);
79
+ }, [defaultValue, onChange]);
72
80
  (0, react_1.useEffect)(() => {
73
81
  setCustomDate(value);
74
82
  }, [value]);
@@ -101,7 +109,8 @@ const DateInput = ({ className, classNamePopup, defaultValue, value, onChange, i
101
109
  }, [isOpen, isMobile]);
102
110
  const buttonCurrentLabel = getButtonLabel();
103
111
  const buttonCurrentTitle = getButtonLabel(true);
104
- return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(textIconButton_1.TextIconButton, { id: id || undefined, htmlType: "button", title: buttonCurrentTitle, icon: iconCalendar_1.IconCalendar, iconPosition: textIconButton_1.ButtonIconPosition.Start, className: cssClass, disabled: disabled, onClick: toggleVisibility, ref: triggerRef, children: buttonCurrentLabel }), isMobile ? memoizedMobileView : memoizedDesktopView, (0, jsx_runtime_1.jsx)(formFieldError_1.FormFieldError, { error: error })] });
112
+ const chipTriggerComponent = (0, react_1.useMemo)(() => (0, jsx_runtime_1.jsx)(chip_1.Chip, { status: isDefaultState ? undefined : chipStatus || "active", title: isDefaultState ? chipName : buttonCurrentTitle, isOpen: isOpen, disabled: disabled, onClick: toggleVisibility, onClose: isDefaultState ? undefined : handleClearAndApply, triggerRef: triggerRef, icon: chipIcon || iconCalendar_1.IconCalendar, id: chipId, children: isDefaultState ? chipName : buttonCurrentLabel }), [isDefaultState, chipStatus, isOpen, disabled, toggleVisibility, handleClearAndApply, chipIcon, chipId, chipName, buttonCurrentLabel, buttonCurrentTitle]);
113
+ return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [chip ? chipTriggerComponent : (0, jsx_runtime_1.jsx)(textIconButton_1.TextIconButton, { id: id || undefined, htmlType: "button", title: buttonCurrentTitle, icon: iconCalendar_1.IconCalendar, iconPosition: textIconButton_1.ButtonIconPosition.Start, className: cssClass, disabled: disabled, onClick: toggleVisibility, ref: triggerRef, children: buttonCurrentLabel }), isMobile ? memoizedMobileView : memoizedDesktopView, (0, jsx_runtime_1.jsx)(formFieldError_1.FormFieldError, { error: error })] });
105
114
  };
106
115
  exports.DateInput = DateInput;
107
116
  exports.TRANSLATIONS = [
@@ -27,6 +27,7 @@ const useDrive_1 = require("../utils/theme/useDrive");
27
27
  const iconChevronRightSmall_1 = require("../icons/iconChevronRightSmall");
28
28
  const chip_1 = require("../chip/chip");
29
29
  const chipStatusProvider_1 = require("../chip/chipStatusProvider");
30
+ const focusableSelector_1 = require("../utils/focusableSelector");
30
31
  const parseLabel = (option, dateFormat, translate, toLacalFn) => {
31
32
  const localeFrom = toLacalFn(option.from);
32
33
  const localeTo = toLacalFn(option.to);
@@ -53,7 +54,7 @@ const DateRange = ({ className, classNamePopup, defaultValue, value, onChange, o
53
54
  const optionsMap = (0, react_1.useMemo)(() => (0, getRangeOption_1.getOptionsPeriodMap)(optionsArg, translate, toLocalDateTime, weekStartsOnSunday ? "Sunday" : "Monday", toReverseOffsetDateTime), [optionsArg, toLocalDateTime, toReverseOffsetDateTime, translate, weekStartsOnSunday]);
54
55
  const previousStepOption = (0, react_1.useRef)("");
55
56
  const [selectedRange, setSelectedRange] = (0, react_1.useState)((0, getRangeOption_1.getSelectedRangeFromValue)(optionsMap, value));
56
- const [renderContent, setRenderContent] = (0, react_1.useState)(false);
57
+ const mobileContentRef = (0, react_1.useRef)(null);
57
58
  const isCustomDateOption = (selectedRange === null || selectedRange === void 0 ? void 0 : selectedRange.label) === dateRangeInner_1.CUSTOM_CALENDAR_ID;
58
59
  const [isOpen, setIsOpen] = (0, react_1.useState)(false);
59
60
  const prevIsOpenRef = (0, react_1.useRef)(false);
@@ -189,16 +190,17 @@ const DateRange = ({ className, classNamePopup, defaultValue, value, onChange, o
189
190
  setIsOpen(false);
190
191
  }, [setIsOpen]);
191
192
  const onReadyForFocus = (0, react_1.useCallback)((isCurrentOpen) => {
193
+ var _a;
192
194
  if (!isMobile) {
193
195
  return;
194
196
  }
195
197
  if (isCurrentOpen) {
196
- setRenderContent(true);
198
+ const focusableElement = (_a = mobileContentRef.current) === null || _a === void 0 ? void 0 : _a.querySelector(focusableSelector_1.FOCUSABLE_SELECTOR);
199
+ focusableElement === null || focusableElement === void 0 ? void 0 : focusableElement.focus();
197
200
  return;
198
201
  }
199
- setRenderContent(false);
200
202
  prevIsOpenRef.current = isCurrentOpen;
201
- }, [isMobile]);
203
+ }, [isMobile, mobileContentRef]);
202
204
  const isValueNotChanged = (0, react_1.useMemo)(() => {
203
205
  if (!hasApplyButton) {
204
206
  return false;
@@ -210,7 +212,6 @@ const DateRange = ({ className, classNamePopup, defaultValue, value, onChange, o
210
212
  }, [customDate.from, customDate.to, hasApplyButton, isCustomDateOption, selectedRange === null || selectedRange === void 0 ? void 0 : selectedRange.label, value === null || value === void 0 ? void 0 : value.from, value === null || value === void 0 ? void 0 : value.label, value === null || value === void 0 ? void 0 : value.to]);
211
213
  const memoizedDesktopView = (0, react_1.useMemo)(() => (0, jsx_runtime_1.jsx)(controlledPopup_1.ControlledPopup, { className: (0, classNames_1.classNames)(["zen-date-range-popup-wrapper", driveWrapperPopupClassName || ""]), ariaLabel: translate("Date range"), useTrapFocusWithTrigger: "on", role: "dialog", triggerRef: triggerRef, onOpenChange: setIsOpen, shouldHoldScroll: true, isOpen: isOpen, recalculateOnScroll: true, children: (0, jsx_runtime_1.jsxs)("div", { className: (0, classNames_1.classNames)(["zen-date-range-popup", drivePopupClassName || "", classNamePopup !== null && classNamePopup !== void 0 ? classNamePopup : ""]), children: [(0, jsx_runtime_1.jsx)("div", { className: "zen-date-range-popup__header", children: title }), component, (0, jsx_runtime_1.jsxs)("div", { className: "zen-date-range-popup__footer", children: [(0, jsx_runtime_1.jsx)(button_1.Button, { className: "zen-date-range-popup__button-clear", type: buttonType_1.ButtonType.Tertiary, disabled: !!isDefaultState, onClick: handleClearClick, children: translate("Clear") }), (!isCustomDateOption && hasApplyButton) &&
212
214
  (0, jsx_runtime_1.jsx)(button_1.Button, { className: "zen-date-range-popup__button-reset", type: buttonType_1.ButtonType.Secondary, onClick: handleCancelClick, children: translate("Cancel") }), (isCustomDateOption || hasApplyButton) && (0, jsx_runtime_1.jsx)(button_1.Button, { className: "zen-date-range-popup__button-apply", type: buttonType_1.ButtonType.Primary, disabled: (isCustomDateOption && (!customDate.from || !customDate.to)) || isValueNotChanged || !selectedRange, onClick: handleApplyClick, children: translate("Apply") })] })] }) }), [classNamePopup, component, customDate.from, customDate.to, drivePopupClassName, driveWrapperPopupClassName, handleApplyClick, handleCancelClick, handleClearClick, hasApplyButton, isCustomDateOption, isDefaultState, isOpen, isValueNotChanged, selectedRange, title, translate]);
213
- const notFocusedComponent = (0, react_1.useMemo)(() => !range.from && !range.to, [range.from, range.to]);
214
215
  const memoizedMobileFooter = (0, react_1.useMemo)(() => {
215
216
  const clearButton = (0, jsx_runtime_1.jsx)(button_1.Button, { type: buttonType_1.ButtonType.Tertiary, disabled: !!isDefaultState, onClick: handleClearClick, children: translate("Clear") });
216
217
  const cancelButton = hasApplyButton && !showMobileCalendar ? (0, jsx_runtime_1.jsx)(button_1.Button, { type: buttonType_1.ButtonType.Secondary, onClick: handleCancelClick, children: translate("Cancel") }) : null;
@@ -219,8 +220,8 @@ const DateRange = ({ className, classNamePopup, defaultValue, value, onChange, o
219
220
  return (0, jsx_runtime_1.jsxs)(footerButtons_1.FooterButtons, { children: [applyButton, cancelButton, clearButton] });
220
221
  }, [customDate.from, customDate.to, handleApplyClick, handleCancelClick, handleClearClick, hasApplyButton, isCustomDateOption, isDefaultState, isValueNotChanged, selectedRange,
221
222
  showMobileCalendar, translate]);
222
- const memoizedMobileView = (0, react_1.useMemo)(() => (0, jsx_runtime_1.jsxs)(mobileSheet_1.MobileSheet, { className: (0, classNames_1.classNames)(["zen-date-range-mobile-sheet", classNamePopup ? `${classNamePopup}--mobile-sheet` : ""]), label: translate("Date range"), triggerRef: triggerRef, isOpen: isOpen, onHidePanel: memoizedHandleClose, onCloseClick: memoizedHandleClose, useTrapFocusWithTrigger: notFocusedComponent ? false : true, isBackVisible: showMobileCalendar, onBackClick: handleMobileBackClick, onReadyForFocus: onReadyForFocus, children: [(0, jsx_runtime_1.jsx)(mobileSheet_1.MobileSheet.Title, { children: showMobileCalendar ? calendarLabel : title }), (0, jsx_runtime_1.jsx)(mobileSheet_1.MobileSheet.Content, { children: renderContent ? component : null }), (0, jsx_runtime_1.jsx)(mobileSheet_1.MobileSheet.Footer, { children: memoizedMobileFooter })] }), [calendarLabel, classNamePopup, component, handleMobileBackClick, isOpen, memoizedHandleClose, memoizedMobileFooter, notFocusedComponent,
223
- onReadyForFocus, renderContent, showMobileCalendar, title, translate]);
223
+ const memoizedMobileView = (0, react_1.useMemo)(() => (0, jsx_runtime_1.jsxs)(mobileSheet_1.MobileSheet, { className: (0, classNames_1.classNames)(["zen-date-range-mobile-sheet", classNamePopup ? `${classNamePopup}--mobile-sheet` : ""]), label: translate("Date range"), triggerRef: triggerRef, isOpen: isOpen, onHidePanel: memoizedHandleClose, onCloseClick: memoizedHandleClose, useTrapFocusWithTrigger: false, preventFirstFocus: true, isBackVisible: showMobileCalendar, onBackClick: handleMobileBackClick, onReadyForFocus: onReadyForFocus, children: [(0, jsx_runtime_1.jsx)(mobileSheet_1.MobileSheet.Title, { children: showMobileCalendar ? calendarLabel : title }), (0, jsx_runtime_1.jsx)(mobileSheet_1.MobileSheet.Content, { children: (0, jsx_runtime_1.jsx)("div", { ref: mobileContentRef, children: component }) }), (0, jsx_runtime_1.jsx)(mobileSheet_1.MobileSheet.Footer, { children: memoizedMobileFooter })] }), [calendarLabel, classNamePopup, component, handleMobileBackClick, isOpen, memoizedHandleClose, memoizedMobileFooter,
224
+ onReadyForFocus, showMobileCalendar, title, translate, mobileContentRef]);
224
225
  const checkIsRangeDisable = (0, react_1.useCallback)((isIncrease) => {
225
226
  if (!selectedRange) {
226
227
  return true;
@@ -258,7 +259,7 @@ const DateRange = ({ className, classNamePopup, defaultValue, value, onChange, o
258
259
  !defaultValue && !value || (defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.label) === currentLabel || type && type !== buttonType_1.ButtonType.Secondary ? "" : "zen-date-range--active"
259
260
  ]);
260
261
  const popupTriggerComponent = (0, react_1.useMemo)(() => (0, jsx_runtime_1.jsx)(textIconButton_1.TextIconButton, { htmlType: "button", title: buttonTitle, icon: iconCalendar_1.IconCalendar, iconPosition: textIconButton_1.ButtonIconPosition.Start, className: cssClass, type: type, disabled: disabled, onClick: toggleVisibility, ref: triggerRef, children: buttonLabel }), [cssClass, type, disabled, toggleVisibility, buttonLabel, buttonTitle]);
261
- const chipTriggerComponent = (0, react_1.useMemo)(() => (0, jsx_runtime_1.jsx)(chip_1.Chip, { status: isDefaultState ? undefined : chipStatus || "active", isOpen: isOpen, disabled: disabled, onClick: toggleVisibility, onClose: isDefaultState ? undefined : handleClearClick, triggerRef: triggerRef, icon: chipIcon || iconCalendar_1.IconCalendar, id: chipId, children: isDefaultState ? chipName : buttonLabel }), [isDefaultState, chipStatus, isOpen, disabled, toggleVisibility, handleClearClick, chipIcon, chipId, chipName, buttonLabel]);
262
+ const chipTriggerComponent = (0, react_1.useMemo)(() => (0, jsx_runtime_1.jsx)(chip_1.Chip, { status: isDefaultState ? undefined : chipStatus || "active", title: isDefaultState ? chipName : buttonTitle, isOpen: isOpen, disabled: disabled, onClick: toggleVisibility, onClose: isDefaultState ? undefined : handleClearClick, triggerRef: triggerRef, icon: chipIcon || iconCalendar_1.IconCalendar, id: chipId, children: isDefaultState ? chipName : buttonLabel }), [isDefaultState, chipStatus, isOpen, disabled, toggleVisibility, handleClearClick, chipIcon, chipId, chipName, buttonLabel, buttonTitle]);
262
263
  return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [stepper ? (0, jsx_runtime_1.jsxs)("div", { className: (0, classNames_1.classNames)(["zen-date-range-wrapper", driveWrapperTriggerClassName || "", classNameWrapper || ""]), children: [(0, jsx_runtime_1.jsx)("button", { type: "button", disabled: checkIsRangeDisable(false), onClick: decreaseRange, className: (0, classNames_1.classNames)(["zen-date-range__stepper", "zen-date-range__stepper--left"]), title: translate("Previous"), children: (0, jsx_runtime_1.jsx)(iconChevronLeftSmall_1.IconChevronLeftSmall, { size: isDrive ? "huge" : "large" }) }), popupTriggerComponent, (0, jsx_runtime_1.jsx)("button", { type: "button", disabled: checkIsRangeDisable(true), onClick: increaseRange, className: (0, classNames_1.classNames)(["zen-date-range__stepper", "zen-date-range__stepper--right"]), title: translate("Next"), children: (0, jsx_runtime_1.jsx)(iconChevronRightSmall_1.IconChevronRightSmall, { size: isDrive ? "huge" : "large" }) })] }) : (chip ? chipTriggerComponent : popupTriggerComponent), isMobile ? memoizedMobileView : memoizedDesktopView, (0, jsx_runtime_1.jsx)(formFieldError_1.FormFieldError, { error: error })] });
263
264
  };
264
265
  exports.DateRange = DateRange;
@@ -5,6 +5,7 @@ import { IColor } from "../groupsFilter/groupsFilterInterfaces";
5
5
  import { TFilterButton } from "../filterButton/filterButton";
6
6
  import { TAlignment } from "../absolute/absolute";
7
7
  import { IChipsParent } from "../chip/chip";
8
+ export declare const LIST_LIMIT = 500;
8
9
  export interface ISelectionItem {
9
10
  id: string;
10
11
  name?: string;
@@ -49,6 +50,7 @@ interface IDropdownBase extends IChipsParent {
49
50
  isLoading?: boolean;
50
51
  alignment?: TAlignment;
51
52
  classNamePopup?: string;
53
+ mobileSheetStackingClassName?: string;
52
54
  error?: string;
53
55
  sortFn?: (a: IDropdownItem, b: IDropdownItem) => number;
54
56
  checkboxLabel?: string;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TRANSLATIONS = exports.Dropdown = void 0;
3
+ exports.TRANSLATIONS = exports.Dropdown = exports.LIST_LIMIT = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  /* eslint-disable complexity */
6
6
  const react_1 = require("react");
@@ -21,7 +21,8 @@ const useDebounce_1 = require("../commonHelpers/hooks/useDebounce");
21
21
  const skeletonList_1 = require("../skeletonList/skeletonList");
22
22
  const chip_1 = require("../chip/chip");
23
23
  const chipStatusProvider_1 = require("../chip/chipStatusProvider");
24
- const Dropdown = ({ className, classNamePopup, getData, errorHandler, dataItems, fetchState, onChange, value, defaultValue, placeholder, dialogAriaLabel, width, isLoading, title, triggerAriaLabel, disabled, inputId, filterName, showCounterPill = true, showSelection, fullWidthTriggerButton, hasApplyButton, searchField = true, multiselect = true, forceSelection = false, selectAllButton = true, getNamedItems, getSelectedItem, buttonType = "secondary", listLimit = 500, alignment = "bottom-left", error, sortFn, checkboxLabel, chip, chipId, chipName, chipIcon, setChecked, setSearch }) => {
24
+ exports.LIST_LIMIT = 500;
25
+ const Dropdown = ({ className, classNamePopup, mobileSheetStackingClassName, getData, errorHandler, dataItems, fetchState, onChange, value, defaultValue, placeholder, dialogAriaLabel, width, isLoading, title, triggerAriaLabel, disabled, inputId, filterName, showCounterPill = true, showSelection, fullWidthTriggerButton, hasApplyButton, searchField = true, multiselect = true, forceSelection = false, selectAllButton = true, getNamedItems, getSelectedItem, buttonType = "secondary", listLimit = exports.LIST_LIMIT, alignment = "bottom-left", error, sortFn, checkboxLabel, chip, chipId, chipName, chipIcon, setChecked, setSearch }) => {
25
26
  var _a;
26
27
  const isFullSelectionMode = (0, react_1.useMemo)(() => typeof value === "object" &&
27
28
  "selected" in value &&
@@ -31,7 +32,7 @@ const Dropdown = ({ className, classNamePopup, getData, errorHandler, dataItems,
31
32
  const isQueryMode = (0, react_1.useMemo)(() => typeof getData === "undefined" && typeof dataItems === "undefined", [getData, dataItems]);
32
33
  const isCheckboxMode = (0, react_1.useMemo)(() => checkboxLabel && typeof value === "object" && "isChecked" in value && typeof value.isChecked === "boolean" || false, [checkboxLabel, value]);
33
34
  const [initialInChecked] = (0, react_1.useState)(isCheckboxMode ? value.isChecked : undefined);
34
- const [state, dispatchState] = (0, react_1.useReducer)(stateReducer_1.stateReducer, (0, stateReducer_1.getInitialState)(isFullSelectionMode, isQueryMode ? (fetchState === null || fetchState === void 0 ? void 0 : fetchState.data) || [] : dataItems || [], isFullSelectionMode || isCheckboxMode ? value.selected : value, defaultValue ? (isFullSelectionMode || isCheckboxMode ? defaultValue.selected : defaultValue) : undefined, isFullSelectionMode ? value.isAllSelected : undefined, defaultValue ? (isFullSelectionMode ? defaultValue.isAllSelected : undefined) : undefined, isCheckboxMode ? value.isChecked : undefined, isCheckboxMode && defaultValue ? defaultValue.isChecked : undefined));
35
+ const [state, dispatchState] = (0, react_1.useReducer)(stateReducer_1.stateReducer, (0, stateReducer_1.getInitialState)(isFullSelectionMode, isQueryMode ? (fetchState === null || fetchState === void 0 ? void 0 : fetchState.data) || [] : dataItems || [], isFullSelectionMode || isCheckboxMode ? value.selected : value, listLimit, defaultValue ? (isFullSelectionMode || isCheckboxMode ? defaultValue.selected : defaultValue) : undefined, isFullSelectionMode ? value.isAllSelected : undefined, defaultValue ? (isFullSelectionMode ? defaultValue.isAllSelected : undefined) : undefined, isCheckboxMode ? value.isChecked : undefined, isCheckboxMode && defaultValue ? defaultValue.isChecked : undefined));
35
36
  const chipStatus = (0, chipStatusProvider_1.useChipStatus)();
36
37
  const isMobile = (0, useMobile_1.useMobile)();
37
38
  const abortToken = (0, react_1.useRef)(new AbortController());
@@ -473,7 +474,7 @@ const Dropdown = ({ className, classNamePopup, getData, errorHandler, dataItems,
473
474
  : (0, dropdownHelper_1.sortDropdownItemArray)(((_b = state.groupsMap[state.currentId || groupsHelper_1.ENTIRE_ORGANIZATION_GROUP_ID]) === null || _b === void 0 ? void 0 : _b.children) || [], sortFn).slice(0, listLimit) || [], multiselect, currentAllSelected);
474
475
  return (0, jsx_runtime_1.jsx)(dropdownList_1.DropdownList, { onBackButtonClick: handleBackButtonClick, onSelectAllClick: isSearchMode ? handleSelectAllInSearch : handleSelectAllClick, onClearClick: handleClearClick, onCancelClick: handleCancelClick, onApplyClick: handleApplyClick, onChange: handleSelect, onSelect: handleChangeCurrentId, onSingleSelect: handleSingleSelection, activeValue: state.selectedIds.length ? state.selectedIds[0] : "root",
475
476
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
476
- backButtonName: state.currentId ? (0, groupsHelper_1.getGroupDescription)(state.groupsMap[state.currentId], translate) : undefined, filterName: isMobile ? undefined : filterName, isAllSelected: currentAllSelected ? currentAllSelected : (isSearchMode ? (0, dropdownHelper_1.isEveryItemSelected)((0, dropdownHelper_1.getListDataWithDisabled)(state.listData, state.isNestedList), state.selectedIds)
477
+ backButtonName: state.currentId && state.groupsMap[state.currentId] ? (0, groupsHelper_1.getGroupDescription)(state.groupsMap[state.currentId], translate) : undefined, filterName: isMobile ? undefined : filterName, isAllSelected: currentAllSelected ? currentAllSelected : (isSearchMode ? (0, dropdownHelper_1.isEveryItemSelected)((0, dropdownHelper_1.getListDataWithDisabled)(state.listData, state.isNestedList), state.selectedIds)
477
478
  : (currentAllSelected === undefined ? (0, dropdownHelper_1.isAllChildrenSelected)(state, state.currentId || groupsHelper_1.ENTIRE_ORGANIZATION_GROUP_ID) : false)), isMultiselect: multiselect, forceSelection: forceSelection,
478
479
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
479
480
  listData: currentListData, width: width || currentWidth === 180 ? undefined : currentWidth, minWidth: currentWidth, hasSelectAllButton: selectAllButton && multiselect, hasApplyButton: hasApplyButton, isApplyDisabled: memoizedIsApplyButtonDisabled, isSelectAllButtonDisable: currentListData.length === 0
@@ -493,7 +494,7 @@ const Dropdown = ({ className, classNamePopup, getData, errorHandler, dataItems,
493
494
  const memoizedCurrentSelection = (0, react_1.useMemo)(() => showSelection && !state.inputValue ? currentStringFromSelected : "", [showSelection, state.inputValue, currentStringFromSelected]);
494
495
  const parentTriggerWidth = ((_a = comboboxRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect().width) || 420;
495
496
  return (0, jsx_runtime_1.jsxs)("div", { className: containerClassName, ref: comboboxRef, children: [chip ? (0, jsx_runtime_1.jsx)(chip_1.Chip, { status: memoizedIsClearButtonDisabled ? undefined : chipStatus || "active", isOpen: state.isOpenCombo, disabled: disabled, onClick: handleTriggerClick, onClose: memoizedIsClearButtonDisabled ? undefined : handleClearClick, triggerRef: triggerRef, icon: chipIcon, id: chipId, children: currentStringFromSelected || chipName }) :
496
- (0, jsx_runtime_1.jsx)(dropdownTrigger_1.DropdownTrigger, { className: (0, classNames_1.classNames)([!width && !fullWidthTriggerButton && parentTriggerWidth < 420 && !searchField ? "zen-dropdown__trigger-button--width-parent" : ""]), currentSelection: memoizedCurrentSelection, isActive: state.isOpenCombo, id: inputId, disabled: disabled, count: showCounterPill ? countSelected : 0, fullWidth: fullWidthTriggerButton, inputValue: state.inputValue, placeholder: placeholder || translate("Filter by group"), searchField: searchField && !isMobile ? searchField : false, onSearchChange: onSearchChange, handleClick: handleTriggerClick, width: width && width > 420 ? 420 : width, title: title, triggerAriaLabel: triggerAriaLabel, triggerRef: triggerRef, inputRef: inputRef, buttonType: buttonType, error: error }), (0, jsx_runtime_1.jsx)(dropdownPopup_1.DropdownPopup, { alignment: alignment, triggerRef: triggerRef, classNamePopup: classNamePopup, isMobile: isMobile, dialogAriaLabel: dialogAriaLabel, disabled: disabled, filterName: filterName, hasApplyButton: hasApplyButton, inputId: inputId, isClearButtonDisabled: memoizedIsClearButtonDisabled, isApplyButtonDisabled: memoizedIsApplyButtonDisabled, isWithFooter: memoizedWithFooter, isOpenCombo: state.isOpenCombo, searchField: searchField, placeholder: placeholder, inputValue: state.inputValue, handleApplyClick: handleApplyClick, handleClearClick: multiselect ? handleClearClick : handleSingleSelection.bind(this, true), handleTriggerClick: handleTriggerClick, onInputChange: onInputChange, inputRef: inputRef, contentRef: contentRef, onReadyForFocus: handleReadyForFocus, handleCheckboxChange: isCheckboxMode && isMobile ? handleCheckboxChange : undefined, checkboxLabel: checkboxLabel, isChecked: state.isChecked, isSearchInPopup: chip, children: getPopupContent })] });
497
+ (0, jsx_runtime_1.jsx)(dropdownTrigger_1.DropdownTrigger, { className: (0, classNames_1.classNames)([!width && !fullWidthTriggerButton && parentTriggerWidth < 420 && !searchField ? "zen-dropdown__trigger-button--width-parent" : ""]), currentSelection: memoizedCurrentSelection, isActive: state.isOpenCombo, id: inputId, disabled: disabled, count: showCounterPill ? countSelected : 0, fullWidth: fullWidthTriggerButton, inputValue: state.inputValue, placeholder: placeholder || translate("Filter by group"), searchField: searchField && !isMobile ? searchField : false, onSearchChange: onSearchChange, handleClick: handleTriggerClick, width: width && width > 420 ? 420 : width, title: title, triggerAriaLabel: triggerAriaLabel, triggerRef: triggerRef, inputRef: inputRef, buttonType: buttonType, error: error }), (0, jsx_runtime_1.jsx)(dropdownPopup_1.DropdownPopup, { alignment: alignment, triggerRef: triggerRef, classNamePopup: classNamePopup, mobileSheetStackingClassName: mobileSheetStackingClassName, isMobile: isMobile, dialogAriaLabel: dialogAriaLabel, disabled: disabled, filterName: filterName, hasApplyButton: hasApplyButton, inputId: inputId, isClearButtonDisabled: memoizedIsClearButtonDisabled, isApplyButtonDisabled: memoizedIsApplyButtonDisabled, isWithFooter: memoizedWithFooter, isOpenCombo: state.isOpenCombo, searchField: searchField, placeholder: placeholder, inputValue: state.inputValue, handleApplyClick: handleApplyClick, handleClearClick: multiselect ? handleClearClick : handleSingleSelection.bind(this, true), handleTriggerClick: handleTriggerClick, onInputChange: onInputChange, inputRef: inputRef, contentRef: contentRef, onReadyForFocus: handleReadyForFocus, handleCheckboxChange: isCheckboxMode && isMobile ? handleCheckboxChange : undefined, checkboxLabel: checkboxLabel, isChecked: state.isChecked, isSearchInPopup: chip, children: getPopupContent })] });
497
498
  };
498
499
  exports.Dropdown = Dropdown;
499
500
  exports.TRANSLATIONS = [
@@ -1,5 +1,5 @@
1
1
  import { ICheckboxListWithActionOption } from "../checkboxListWithAction/checkboxListWithAction";
2
- import { IGroupTree, ITypedHash } from "../groupsFilter/groupsFilterInterfaces";
2
+ import { IGroupTree } from "../groupsFilter/groupsFilterInterfaces";
3
3
  import { IDropdownItem } from "./dropdown";
4
4
  import { IDropdownState } from "./stateReducer/stateReducer";
5
5
  export declare const getGroupsTreeItem: (stateObj: IDropdownState, itemId: string) => IGroupTree | undefined;
@@ -25,8 +25,8 @@ export declare const createListDataOptions: (stateObj: IDropdownState, translate
25
25
  }[];
26
26
  export declare const compareStringsArrays: (arr1: string[], arr2: string[]) => boolean;
27
27
  export declare const compareObjectsArrays: (arr1: IDropdownItem[], arr2: IDropdownItem[]) => boolean;
28
- export declare const prepareSelectedIdsToItems: (selectedIds: string[], groupsMap: ITypedHash<IGroupTree>, groupsMapSelected: Map<string, IDropdownItem>) => IDropdownItem[];
29
- export declare const checkIsDataProblem: (selectedIds: string[], groupsMap: ITypedHash<IGroupTree>) => boolean;
28
+ export declare const prepareSelectedIdsToItems: (selectedIds: string[], groupsMap: IDropdownState["groupsMap"], groupsMapSelected: Map<string, IDropdownItem>) => IDropdownItem[];
29
+ export declare const checkIsDataProblem: (selectedIds: string[], groupsMap: IDropdownState["groupsMap"]) => boolean;
30
30
  export declare const getStringFromSelected: (selectedIds: string[], groupsMapSelected: Map<string, IDropdownItem>, translate: (s: string) => string) => string;
31
- export declare const getStringFromAllSelected: (groupsMap: ITypedHash<IGroupTree>, translate: (s: string) => string) => string;
31
+ export declare const getStringFromAllSelected: (groupsMap: IDropdownState["groupsMap"], translate: (s: string) => string) => string;
32
32
  export declare const getSelectedCount: (selectedIds: string[]) => number;
@@ -142,7 +142,8 @@ const getStringFromAllSelected = (groupsMap, translate) => {
142
142
  if (!((_a = groupsMap[groupsHelper_1.ENTIRE_ORGANIZATION_GROUP_ID]) === null || _a === void 0 ? void 0 : _a.children) || groupsMap[groupsHelper_1.ENTIRE_ORGANIZATION_GROUP_ID].children.length === 0) {
143
143
  return "";
144
144
  }
145
- const selectedItems = groupsMap[groupsHelper_1.ENTIRE_ORGANIZATION_GROUP_ID].children.map(el => groupsMap[el.id] ? (0, groupsHelper_1.getGroupDescription)(groupsMap[el.id], translate) : undefined).filter(el => el);
145
+ const selectedItems = groupsMap[groupsHelper_1.ENTIRE_ORGANIZATION_GROUP_ID].children.map(el => groupsMap[el.id] ?
146
+ (0, groupsHelper_1.getGroupDescription)(groupsMap[el.id], translate) : undefined).filter(el => el);
146
147
  return selectedItems.join(", ");
147
148
  };
148
149
  exports.getStringFromAllSelected = getStringFromAllSelected;
@@ -72,7 +72,7 @@ const DropdownList = ({ onBackButtonClick, onSelectAllClick, onClearClick, onApp
72
72
  forceSelection ? onSingleSelect(false, newActiveEl || activeValue) : onSingleSelect(false, newActiveEl);
73
73
  }, [activeValue, forceSelection, onSingleSelect]);
74
74
  const selectButtonLabel = isAllSelected ? translate("Deselect all") : translate("Select all");
75
- const getActionButton = (label, title, icon, isDisable, clickHandler, size) => (0, jsx_runtime_1.jsx)("button", { type: "button", disabled: isDisable, onClick: clickHandler, className: "zen-dropdown-list__item zen-dropdown-list__item--interactive zen-dropdown-list__action-button zen-dropdown-list__action-button-back", title: title, children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [react_1.default.createElement(icon, { className: "zen-dropdown-list__icon zen-dropdown-list__action-icon", size: size }), (0, jsx_runtime_1.jsx)("div", { className: (0, classNames_1.classNames)(["zen-dropdown-list__action-label", "zen-dropdown-list__action-label--limited", "zen-ellipsis"]), children: label })] }) });
75
+ const getActionButton = (label, title, icon, isDisabled, clickHandler, size) => (0, jsx_runtime_1.jsx)("button", { type: "button", disabled: isDisabled, onClick: clickHandler, className: "zen-dropdown-list__item zen-dropdown-list__item--interactive zen-dropdown-list__action-button zen-dropdown-list__action-button-back", title: title, children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [react_1.default.createElement(icon, { className: "zen-dropdown-list__icon zen-dropdown-list__action-icon", size: size }), (0, jsx_runtime_1.jsx)("div", { className: (0, classNames_1.classNames)(["zen-dropdown-list__action-label", "zen-dropdown-list__action-label--limited", "zen-ellipsis"]), children: label })] }) });
76
76
  const styleWidth = (0, react_1.useMemo)(() => {
77
77
  if (width && !isMobile) {
78
78
  return { style: Object.assign({ width: `${width}px` }, (minWidth ? { minWidth: `${minWidth}px` } : {})) };
@@ -89,7 +89,7 @@ const DropdownList = ({ onBackButtonClick, onSelectAllClick, onClearClick, onApp
89
89
  };
90
90
  return (0, jsx_runtime_1.jsx)("div", { className: "zen-dropdown-list__elements", children: isMultiselect ? (0, jsx_runtime_1.jsx)(checkboxListWithAction_1.CheckboxListWithAction, { options: listData, label: "", onChange: handleChange, onClick: handleClick }) : (0, jsx_runtime_1.jsx)(selectList_1.SelectList, { onChange: handleSingleChange, onClick: handleClick, title: translate("Select option"), id: listId, multiselect: false, selectItemOnFocus: false, items: listData, forceSelection: forceSelection, value: createValue(listData, activeValue) }) });
91
91
  }, [isMultiselect, listData, handleChange, handleClick, handleSingleChange, translate, listId, forceSelection, activeValue]);
92
- return (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: (0, classNames_1.classNames)(["zen-dropdown-list", driveComponentClass || ""]) }, styleWidth, { children: [filterName ? (0, jsx_runtime_1.jsx)("div", { className: "zen-dropdown-list__label", children: filterName }) : null, handleCheckboxChange ? (0, jsx_runtime_1.jsx)("div", { className: "zen-dropdown-list__checkbox-container", children: (0, jsx_runtime_1.jsx)(checkbox_1.Checkbox, { checked: isChecked, onChange: handleCheckboxChange, children: checkboxLabel }) }) : null, backButtonName ? (0, jsx_runtime_1.jsx)("div", { className: "zen-dropdown-list__item-wrapper", children: getActionButton(backButtonName, translate("Back"), iconBackArrow_1.IconBackArrow, false, onBackButtonClick, "large") }) : null, hasSelectAllButton ? getActionButton(selectButtonLabel, selectButtonLabel, iconCheckRadio_1.IconCheckRadio, isSelectAllButtonDisable, handleSelectAllClick, isDrive ? "huger" : "huge") : null, listDataComponent, isWithFooter ? (0, jsx_runtime_1.jsxs)("div", { className: "zen-dropdown-list__footer", children: [(0, jsx_runtime_1.jsx)(button_1.Button, { onClick: isMultiselect ? onClearClick : handleClearClick, disabled: isClearButtonDisabled, className: "zen-dropdown-list__clear-button zen-ellipsis", type: buttonType_1.ButtonType.Tertiary, title: translate("Clear"), children: translate("Clear") }), hasApplyButton && (0, jsx_runtime_1.jsxs)("div", { className: "zen-dropdown-list__button-group", children: [(0, jsx_runtime_1.jsx)(button_1.Button, { onClick: onCancelClick, className: "zen-dropdown-list__cancel-button zen-ellipsis", title: translate("Cancel"), children: translate("Cancel") }), (0, jsx_runtime_1.jsx)(button_1.Button, { onClick: onApplyClick, type: buttonType_1.ButtonType.Primary, disabled: isApplyDisabled, className: "zen-dropdown-list__apply-button zen-ellipsis", title: translate("Apply"), children: translate("Apply") })] })] }) : null] }));
92
+ return (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: (0, classNames_1.classNames)(["zen-dropdown-list", driveComponentClass || ""]) }, styleWidth, { children: [filterName ? (0, jsx_runtime_1.jsx)("div", { className: "zen-dropdown-list__label", children: filterName }) : null, handleCheckboxChange ? (0, jsx_runtime_1.jsx)("div", { className: "zen-dropdown-list__checkbox-container", children: (0, jsx_runtime_1.jsx)(checkbox_1.Checkbox, { checked: isChecked, onChange: handleCheckboxChange, children: checkboxLabel }) }) : null, backButtonName ? (0, jsx_runtime_1.jsx)("div", { className: "zen-dropdown-list__item-wrapper", children: getActionButton(backButtonName, translate("Back"), iconBackArrow_1.IconBackArrow, false, onBackButtonClick, "large") }) : null, hasSelectAllButton ? getActionButton(selectButtonLabel, selectButtonLabel, iconCheckRadio_1.IconCheckRadio, !!isSelectAllButtonDisable, handleSelectAllClick, isDrive ? "huger" : "huge") : null, listDataComponent, isWithFooter ? (0, jsx_runtime_1.jsxs)("div", { className: "zen-dropdown-list__footer", children: [(0, jsx_runtime_1.jsx)(button_1.Button, { onClick: isMultiselect ? onClearClick : handleClearClick, disabled: isClearButtonDisabled, className: "zen-dropdown-list__clear-button zen-ellipsis", type: buttonType_1.ButtonType.Tertiary, title: translate("Clear"), children: translate("Clear") }), hasApplyButton && (0, jsx_runtime_1.jsxs)("div", { className: "zen-dropdown-list__button-group", children: [(0, jsx_runtime_1.jsx)(button_1.Button, { onClick: onCancelClick, className: "zen-dropdown-list__cancel-button zen-ellipsis", title: translate("Cancel"), children: translate("Cancel") }), (0, jsx_runtime_1.jsx)(button_1.Button, { onClick: onApplyClick, type: buttonType_1.ButtonType.Primary, disabled: isApplyDisabled, className: "zen-dropdown-list__apply-button zen-ellipsis", title: translate("Apply"), children: translate("Apply") })] })] }) : null] }));
93
93
  };
94
94
  exports.DropdownList = DropdownList;
95
95
  exports.TRANSLATIONS = [
@@ -5,6 +5,7 @@ export interface IDropdownPopup extends IZenComponentProps {
5
5
  alignment?: TAlignment;
6
6
  triggerRef: RefObject<HTMLElement | null>;
7
7
  classNamePopup?: string;
8
+ mobileSheetStackingClassName?: string;
8
9
  isMobile: boolean;
9
10
  dialogAriaLabel?: string;
10
11
  disabled?: boolean;
@@ -13,7 +13,7 @@ const useLanguage_1 = require("../utils/localization/useLanguage");
13
13
  const footerButtons_1 = require("../footerButtons/footerButtons");
14
14
  const checkbox_1 = require("../checkbox/checkbox");
15
15
  const useScrollWithAndroidKeyboard_1 = require("../utils/useScrollWithAndroidKeyboard");
16
- const DropdownPopup = ({ alignment, triggerRef, classNamePopup, isMobile, inputValue, dialogAriaLabel, disabled, filterName, handleApplyClick, handleClearClick, handleTriggerClick, onInputChange, hasApplyButton, inputId, isClearButtonDisabled, isWithFooter, placeholder, searchField, isSearchInPopup, isApplyButtonDisabled, isOpenCombo, inputRef, contentRef, children, onReadyForFocus, handleCheckboxChange, checkboxLabel, isChecked }) => {
16
+ const DropdownPopup = ({ alignment, triggerRef, classNamePopup, isMobile, inputValue, dialogAriaLabel, disabled, filterName, handleApplyClick, handleClearClick, handleTriggerClick, mobileSheetStackingClassName, onInputChange, hasApplyButton, inputId, isClearButtonDisabled, isWithFooter, placeholder, searchField, isSearchInPopup, isApplyButtonDisabled, isOpenCombo, inputRef, contentRef, children, onReadyForFocus, handleCheckboxChange, checkboxLabel, isChecked }) => {
17
17
  const { translate } = (0, useLanguage_1.useLanguage)();
18
18
  const triggerId = (0, react_1.useId)();
19
19
  const { handleFocus, handleBlur, wrapperClass } = (0, useScrollWithAndroidKeyboard_1.useScrollWithAndroidKeyboard)();
@@ -28,7 +28,7 @@ const DropdownPopup = ({ alignment, triggerRef, classNamePopup, isMobile, inputV
28
28
  }
29
29
  return (0, jsx_runtime_1.jsxs)(footerButtons_1.FooterButtons, { children: [hasApplyButton ? (0, jsx_runtime_1.jsx)(button_1.Button, { onClick: handleApplyClick, type: buttonType_1.ButtonType.Primary, disabled: isApplyButtonDisabled, className: "zen-ellipsis", title: translate("Apply"), children: translate("Apply") }) : null, (0, jsx_runtime_1.jsx)(button_1.Button, { onClick: handleClearClick, disabled: isClearButtonDisabled, className: "zen-ellipsis", type: buttonType_1.ButtonType.Tertiary, title: translate("Clear"), children: translate("Clear") })] });
30
30
  }, [handleApplyClick, handleClearClick, hasApplyButton, isApplyButtonDisabled, isClearButtonDisabled, isWithFooter, translate]);
31
- const memoizedMobileView = (0, react_1.useMemo)(() => (0, jsx_runtime_1.jsxs)(mobileSheet_1.MobileSheet, { className: (0, classNames_1.classNames)(["zen-dropdown--mobile", classNamePopup || ""]), wrapperClassName: wrapperClass, label: "label", triggerRef: triggerRef, isOpen: isOpenCombo, onHidePanel: memoizedHandleHide, onCloseClick: memoizedHandleHide, useTrapFocusWithTrigger: true, onReadyForFocus: onReadyForFocus, children: [(0, jsx_runtime_1.jsx)(mobileSheet_1.MobileSheet.Title, { className: "zen-dropdown-mobile-sheet__title", children: filterName || placeholder || "" }), (0, jsx_runtime_1.jsx)(mobileSheet_1.MobileSheet.Content, { children: memoizedMobileContent }), (0, jsx_runtime_1.jsx)(mobileSheet_1.MobileSheet.Footer, { children: memoizedMobileFooter })] }), [classNamePopup, wrapperClass, triggerRef, isOpenCombo, memoizedHandleHide, onReadyForFocus, filterName, placeholder, memoizedMobileContent, memoizedMobileFooter]);
31
+ const memoizedMobileView = (0, react_1.useMemo)(() => (0, jsx_runtime_1.jsxs)(mobileSheet_1.MobileSheet, { className: (0, classNames_1.classNames)(["zen-dropdown--mobile", classNamePopup || ""]), wrapperClassName: wrapperClass, stackingClassName: mobileSheetStackingClassName, label: "label", triggerRef: triggerRef, isOpen: isOpenCombo, onHidePanel: memoizedHandleHide, onCloseClick: memoizedHandleHide, useTrapFocusWithTrigger: true, onReadyForFocus: onReadyForFocus, children: [(0, jsx_runtime_1.jsx)(mobileSheet_1.MobileSheet.Title, { className: "zen-dropdown-mobile-sheet__title", children: filterName || placeholder || "" }), (0, jsx_runtime_1.jsx)(mobileSheet_1.MobileSheet.Content, { children: memoizedMobileContent }), (0, jsx_runtime_1.jsx)(mobileSheet_1.MobileSheet.Footer, { children: memoizedMobileFooter })] }), [classNamePopup, wrapperClass, mobileSheetStackingClassName, triggerRef, isOpenCombo, memoizedHandleHide, onReadyForFocus, filterName, placeholder, memoizedMobileContent, memoizedMobileFooter]);
32
32
  const memoizedDesktopView = (0, react_1.useMemo)(() => (0, jsx_runtime_1.jsx)(controlledPopup_1.ControlledPopup, { isOpen: isOpenCombo, className: (0, classNames_1.classNames)(["zen-dropdown-popup zen-shadow-dropdown-default", classNamePopup || ""]), onOpenChange: handleTriggerClick, useTrapFocusWithTrigger: "withTrigger", alignment: alignment, shouldHoldScroll: true, triggerRef: triggerRef, ariaLabel: dialogAriaLabel || placeholder || translate("Filter by group"), recalculateOnScroll: true, children: (0, jsx_runtime_1.jsxs)("div", { ref: contentRef, children: [searchField && isSearchInPopup ? (0, jsx_runtime_1.jsx)("div", { className: "zen-dropdown-popup__search-container", children: (0, jsx_runtime_1.jsx)(searchInput_1.SearchInput, { className: "zen-dropdown-chip__search", onChange: onInputChange, value: inputValue || "", ref: inputRef, id: inputId || triggerId, disabled: disabled, placeholder: placeholder || translate("Filter by group") }) }) : null, children] }) }), [alignment, children, classNamePopup, contentRef, dialogAriaLabel, disabled, handleTriggerClick, inputId, inputRef, inputValue, isOpenCombo, isSearchInPopup, onInputChange, placeholder, searchField, translate, triggerId, triggerRef]);
33
33
  return isMobile ? memoizedMobileView : memoizedDesktopView;
34
34
  };
@@ -49,7 +49,7 @@ const DropdownSearchableTrigger = (_a) => {
49
49
  onChange(undefined);
50
50
  };
51
51
  return (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: (0, classNames_1.classNames)(["zen-dropdown-searchable-trigger", isError ? "zen-dropdown-searchable-trigger--error" : "",
52
- driveComponentClass || "", disabled ? "zen-dropdown-searchable-trigger--disabled" : ""]) }, inputStyle, { ref: ref }, otherProps, { onClick: disabled ? () => { } : clickHandler, role: "combobox", "aria-label": placeholder, children: [(0, jsx_runtime_1.jsxs)("div", { className: (0, classNames_1.classNames)(["zen-dropdown-searchable-trigger__search-container", className]), children: [(0, jsx_runtime_1.jsx)("div", { className: "zen-dropdown-searchable-trigger__input-container", onKeyDown: handleKeydown, children: (0, jsx_runtime_1.jsx)(textInputRaw_1.TextInputRaw, { value: value, placeholder: currentSelection ? currentSelection : placeholder || translate("Filter by group"), className: (0, classNames_1.classNames)(["zen-dropdown-searchable-trigger__input", "zen-ellipsis", currentSelection ? "zen-dropdown-searchable-trigger__input--selected" : ""]), onChange: onChange, disabled: disabled, type: "text", ref: inputRef, id: id || triggerId }) }), count ? (0, jsx_runtime_1.jsx)("div", { className: "zen-dropdown-searchable-trigger__label-element", children: (0, jsx_runtime_1.jsx)("div", { className: "zen-dropdown-searchable-trigger__counter", children: (0, jsx_runtime_1.jsx)("span", { children: isLargeNumber ? "99+" : count }) }) }) : null, value && (0, jsx_runtime_1.jsx)("button", { type: "button", className: "zen-dropdown-searchable-trigger__close-button", ref: clearRef, title: translate("Clear search"), onClick: handleClearSearch, children: (0, jsx_runtime_1.jsx)(iconCrossThin_1.IconCrossThin, { size: isDrive ? "big" : "small" }) })] }), (0, jsx_runtime_1.jsx)("button", { type: "button", tabIndex: -1, "aria-hidden": "true", className: (0, classNames_1.classNames)(["zen-dropdown-searchable-trigger__popup-trigger", isOpenPopup ? "zen-dropdown-searchable-trigger__popup-trigger--active" : ""]), title: title || translate(isOpenPopup ? "Close filter" : "Open filter"), children: (0, jsx_runtime_1.jsx)(iconChevronDownSmall_1.IconChevronDownSmall, { className: isOpenPopup ? "zen-dropdown-searchable-trigger__arrow-icon--up" : "zen-dropdown-searchable-trigger__arrow-icon--down", size: isDrive ? "huge" : "large" }) })] }));
52
+ driveComponentClass || "", disabled ? "zen-dropdown-searchable-trigger--disabled" : ""]) }, inputStyle, { ref: ref }, otherProps, { onClick: disabled ? () => { } : clickHandler, role: "combobox", "aria-label": placeholder, children: [(0, jsx_runtime_1.jsxs)("div", { className: (0, classNames_1.classNames)(["zen-dropdown-searchable-trigger__search-container", className]), children: [(0, jsx_runtime_1.jsx)("div", { className: "zen-dropdown-searchable-trigger__input-container", onKeyDown: handleKeydown, children: (0, jsx_runtime_1.jsx)(textInputRaw_1.TextInputRaw, { value: value, placeholder: currentSelection ? currentSelection : placeholder || translate("Filter by group"), className: (0, classNames_1.classNames)(["zen-dropdown-searchable-trigger__input", "zen-ellipsis", currentSelection ? "zen-dropdown-searchable-trigger__input--selected" : ""]), onChange: onChange, disabled: disabled, type: "text", ref: inputRef, id: id || triggerId }) }), count ? (0, jsx_runtime_1.jsx)("div", { className: "zen-dropdown-searchable-trigger__label-element", children: (0, jsx_runtime_1.jsx)("div", { className: "zen-dropdown-searchable-trigger__counter", children: (0, jsx_runtime_1.jsx)("span", { children: isLargeNumber ? "99+" : count }) }) }) : null, value && (0, jsx_runtime_1.jsx)("button", { type: "button", className: "zen-dropdown-searchable-trigger__close-button", ref: clearRef, title: translate("Clear search"), onClick: handleClearSearch, children: (0, jsx_runtime_1.jsx)(iconCrossThin_1.IconCrossThin, { size: isDrive ? "big" : "small" }) })] }), (0, jsx_runtime_1.jsx)("button", { type: "button", onMouseDown: e => e.preventDefault(), tabIndex: -1, "aria-hidden": "true", className: (0, classNames_1.classNames)(["zen-dropdown-searchable-trigger__popup-trigger", isOpenPopup ? "zen-dropdown-searchable-trigger__popup-trigger--active" : ""]), title: title || translate(isOpenPopup ? "Close filter" : "Open filter"), children: (0, jsx_runtime_1.jsx)(iconChevronDownSmall_1.IconChevronDownSmall, { className: isOpenPopup ? "zen-dropdown-searchable-trigger__arrow-icon--up" : "zen-dropdown-searchable-trigger__arrow-icon--down", size: isDrive ? "huge" : "large" }) })] }));
53
53
  };
54
54
  exports.DropdownSearchableTrigger = DropdownSearchableTrigger;
55
55
  exports.DropdownSearchableTrigger.displayName = "DropdownSearchableTrigger";
@@ -3,7 +3,7 @@ import { TStateAction } from "./stateAction";
3
3
  import { IGroupTree, ITypedHash } from "../../groupsFilter/groupsFilterInterfaces";
4
4
  import { IDropdownItem } from "../dropdown";
5
5
  export interface IDropdownState {
6
- groupsMap: ITypedHash<IGroupTree>;
6
+ groupsMap: ITypedHash<IGroupTree | undefined>;
7
7
  selectedIds: string[];
8
8
  globalSelectedIds: string[];
9
9
  defaultValue: string[];
@@ -20,6 +20,8 @@ export interface IDropdownState {
20
20
  pendingNamelessIds: boolean;
21
21
  isNestedList: boolean;
22
22
  isFullSelectionMode: boolean;
23
+ listLimit: number;
24
+ resultsExceedListLimit?: boolean;
23
25
  isAllSelected?: boolean;
24
26
  globalIsAllSelected?: boolean;
25
27
  defaultValueIsAllSelected?: boolean;
@@ -29,7 +31,7 @@ export interface IDropdownState {
29
31
  }
30
32
  export interface IStateReducer extends Reducer<IDropdownState, TStateAction> {
31
33
  }
32
- export declare const getInitialState: (isFullSelectionMode: boolean, comboItems: IDropdownItem[], selection: string[], defaultValue?: string[], isAllSelected?: boolean, defaultValueIsAllSelected?: boolean, isChecked?: boolean, defaultValueIsChecked?: boolean) => {
34
+ export declare const getInitialState: (isFullSelectionMode: boolean, comboItems: IDropdownItem[], selection: string[], listLimit: number, defaultValue?: string[], isAllSelected?: boolean, defaultValueIsAllSelected?: boolean, isChecked?: boolean, defaultValueIsChecked?: boolean) => {
33
35
  groupsMap: ITypedHash<IGroupTree>;
34
36
  selectedIds: string[];
35
37
  globalSelectedIds: string[];
@@ -53,5 +55,7 @@ export declare const getInitialState: (isFullSelectionMode: boolean, comboItems:
53
55
  isChecked: boolean | undefined;
54
56
  defaultValueIsChecked: boolean | undefined;
55
57
  globalIsChecked: boolean | undefined;
58
+ listLimit: number;
59
+ resultsExceedListLimit: boolean;
56
60
  };
57
61
  export declare function stateReducer(state: IDropdownState, action: TStateAction): IDropdownState;